Description
RiveNativeRenderTexture holds a FlutterWindowsSwapchain m_swapchain and a void* m_riveRenderer, but provides no way to retrieve the currently-presenting D3D11 texture or access the swapchain. External code that needs to bridge the Rive texture to another D3D11 device (via DXGI shared handles) cannot reach the swapchain texture.
Changes We Made
Added two public members to RiveNativeRenderTexture in rive_native_plugin.hpp:
// Returns the raw ID3D11Texture2D* of the currently-presenting swapchain
// texture. Thread-safe (briefly locks the swapchain mutex).
void *presentingNativeTexture();
// Access the swapchain for the presenting texture lock.
FlutterWindowsSwapchain *swapchain() { return &m_swapchain; }
With the implementation in rive_native_plugin.cpp:
void* RiveNativeRenderTexture::presentingNativeTexture() {
FlutterWindowsSwapchain::PresentingTextureLock lock(&m_swapchain);
const auto& tex = lock.texture();
if (!tex || !tex->nativeTexture) return nullptr;
return tex->nativeTexture.Get();
}
Impact
Without these accessors, the only way to reach the presenting texture is through the internal m_swapchain member, which is private.
Environment
- Package: rive_native 0.1.2
- Platform: Windows (D3D11)
- File: windows/include/rive_native/rive_native_plugin.hpp