-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Description
rive_native_windows.cpp does not export a function to retrieve the currently-presenting D3D11 swapchain texture from an opaque WindowsContextPLS* renderer. External consumers that need the rendered frame (e.g., for GPU compositing via DXGI shared handles) cannot access it because WindowsContextPLS is opaque and the swapchain uses 4-texture quad-buffering.
Current Exports (rive_native_windows.cpp)
EXPORT rive::Renderer* makeRenderer(WindowsContextPLS* pls);
EXPORT bool clear(WindowsContextPLS* pls, bool clear, uint32_t color);
EXPORT bool flush(WindowsContextPLS* pls, float devicePixelRatio);
EXPORT void riveFlushGpuCommands() {} // no-op stub
There is no nativeTexture() equivalent to retrieve the presenting ID3D11Texture2D*.
Changes We Made
Added three exports to rive_native_windows.cpp (after flush() , around line 310):
EXPORT void *nativeTexture(WindowsContextPLS *pls) {
if (pls == nullptr) {
return nullptr;
}
FlutterWindowsSwapchain::PresentingTextureLock lock(pls->m_swapchain);
const auto &tex = lock.texture();
if (!tex || !tex->nativeTexture) {
return nullptr;
}
return tex->nativeTexture.Get();
}
EXPORT void *rivePresentingTexture(void *rendererPtr) {
return nativeTexture(static_cast<WindowsContextPLS *>(rendererPtr));
}
EXPORT void riveFlushGpuCommands() {}
Note:
nativeTexture accesses pls->m_swapchain, which is currently a private member. This required making m_swapchain accessible (via friend, accessor, or by making nativeTexture a member function).
Impact
Without this, external consumers must re-implement the function in a separate DLL, requiring access to internal types (FlutterWindowsSwapchain, PresentingTextureLock).
Environment
- Package: rive_native 0.1.2
- Platform: Windows (D3D11)
- File: native/platform/windows/rive_native_windows.cpp