rive-app / rive-app/rive-flutter

nativeTexture() and rivePresentingTexture() not exported in native/platform/windows/rive_native_windows.cpp

Open
#610 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
1.5k
Forks
240
PR merge metrics
No merged PRs in 30d

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in native/platform/windows/rive_native_windows.cpp and inspect FlutterWindowsSwapchain and PresentingTextureLock, especially how m_swapchain is accessed. Expose nativeTexture() and rivePresentingTexture() while preserving the null and missing-texture cases described, then build the Windows target and verify external consumers can retrieve the presenting texture.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, desktop-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.