Skip to content

Mark Forge bridge interop memory as a dedicated allocation - #102

Draft
sambvfx wants to merge 1 commit into
NVIDIAGameWorks:mainfrom
sambvfx:forge-interop-dedicated-memory
Draft

sambvfx wants to merge 1 commit into
NVIDIAGameWorks:mainfrom
sambvfx:forge-interop-dedicated-memory

Conversation

@sambvfx

@sambvfx sambvfx commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Refs #41. Companion to #100.

The bug

The Forge 1.12.2 bridge imports the runtime's shared color and depth images into OpenGL in legacy-gl-interop.cpp, the same way the Fabric mod's GlInterop does. Both images are dedicated allocations, because DXVK gives every shared image its own allocation. EXT_external_objects requires an importer of such memory to set GL_DEDICATED_MEMORY_OBJECT_EXT to GL_TRUE before the import, and the bridge never did. Windows drivers accept the import anyway. Under Wine and Proton the import reportedly binds no memory, which is what #41 describes for the Fabric mod.

The change

LegacyGlInterop loads glMemoryObjectParameterivEXT and sets the flag on every memory object before importing it, color and depth alike. The existing check after each import also covers the new call. There is no switch, matching #100.

Testing

Tested on Windows 11 only: one RTX PRO 6000 Blackwell desktop, driver 616.92, runtime a00da12a, JDK 8u512.

  • build-bridge.ps1 -GpuSmoke against the pinned runtime passed 4 times in a row. It covers color and depth import, a resize that re-imports both images, timeline ownership, copies in both directions, context guards, GL state restoration and shutdown. One earlier attempt, the first GPU run in a fresh checkout, failed before its output was captured. It hasn't failed since.
  • gradlew build test diagnosticJar in forge-1.12.2 passes.
  • Not tested: an in-game launch of the Forge client.

Still needs testing

The same as #100: Linux through Proton or Wine, AMD, Intel, NVIDIA laptops with two GPUs, and older NVIDIA drivers.

🤖 Generated with Claude Code

The runtime's shared color and depth images are dedicated allocations,
because DXVK gives every shared image its own allocation, and
EXT_external_objects requires an importer of one to set
GL_DEDICATED_MEMORY_OBJECT_EXT before importing it. The legacy OpenGL
interop never set it. Windows drivers accept the import anyway; under
Wine the import reportedly binds no memory (NVIDIAGameWorks#41).

LegacyGlInterop now sets the flag on every memory object before the
import, the same fix NVIDIAGameWorks#100 makes in the Fabric mod's GlInterop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant