Skip to content

Direct3D 12: release the device and its retired textures (#4); openOMSI's shaders through DXC in CI - #13

Merged
turbo-devv merged 4 commits into
mainfrom
fix/device-cycle-and-openomsi-shaders
Nov 23, 2026
Merged

turbo-devv merged 4 commits into
mainfrom
fix/device-cycle-and-openomsi-shaders

Conversation

@turbo-devv

Copy link
Copy Markdown
Contributor

What

  • Direct3D 12: a resource is released while the queue still uses it, at exit (id 921) #4, the device never released (Direct3D 12). A released heap view kept a clone of its texture (or buffer) in Heap::retired until the next submission finished. Every texture holds the device's Shared, and Shared holds the heap, so after the program's last submission nothing reclaimed the list. The device and every texture retired late stayed alive, as @m3rlinek01 measured: 1189 textures at openOMSI's exit.
    • The retired lists now keep the ID3D12Resource alone, as Vulkan's and Metal's keep their raw objects.
    • Every Device and Queue the program gets shares an Owner, as on Vulkan. When the last one goes, it waits for the queue. That submits the pending queue writes and lets go of what finished submissions and released views kept. This covers both ways suggested in the issue.
  • openOMSI's current shaders in CI. crates/mx/tests/openomsi holds the 23 modules of openOMSI's mX renderer at openOMSI 940ab2f97, including the weather overhaul's clouds, volumetric fog, glass and ray-traced reflections. openomsi_shaders now runs on them by default.
    • On Windows, CI puts the Windows SDK's DXC on the path and compiles them on WARP. The game's HLSL has never been through DXC before, and a pipeline DXC refuses leaves openOMSI with a grey screen.
    • On Linux, CI compiles them under the Khronos layer.

Checked here

A released heap view kept a clone of its texture (buffer) in `Heap::retired` until the next
submission was done; a texture holds the device's shared state, which holds the heap. After
the program's last submission nothing reclaimed it, and the device with every texture
retired late was never released (1189 textures and the device at openOMSI's exit, #4).

- The retired lists keep the resource alone (`ID3D12Resource`), as Vulkan's and Metal's keep
  their raw objects.
- Every `Device` and `Queue` the program is given shares an owner, as on Vulkan: when the last
  goes, the queue is waited for, which submits the pending queue writes and lets go of what
  finished submissions and released views kept.
…er the validation layer

The 23 modules of openOMSI's mX renderer (openOMSI 940ab2f97, the weather overhaul's clouds,
volumetric fog, glass and ray-traced reflections included) are in tests/openomsi, and
`openomsi_shaders` runs on them by default. CI compiles them on Windows through the Windows
SDK's DXC on WARP - the game's HLSL had never been through DXC - and on Linux under the
Khronos validation layer. On an M4 they compile on Metal, and on MoltenVK under the layer with
no findings.
… has no timestamps

First run of the bound tier on a GPU (ANGLE over Metal, OpenGL ES 3.0 - what ANGLE gives
older chips too): 10 of 29 conformance tests failed, now 29 of 29 pass.
- A multisampled render target is a renderbuffer where the context has no multisampled
  textures (ES 3.0): glTexStorage2DMultisample failed and an MSAA pass drew black. A
  multisampled texture that is sampled or copied is Unsupported there.
- Indirect draws on ES 3.0 read their arguments back and draw directly; they panicked.
- Timestamps count only where a timestamp query gives a time: ANGLE has
  EXT_disjoint_timer_query for elapsed time alone, and every timestamp read 0.
- precompile writes each entry point as the context's GLSL and has the driver compile it;
  it only lowered the module before, so a module the driver refused passed.
- The conformance tests of compute and the buffer heap say they are skipped on a GPU without
  them; openomsi_shaders skips the bound tier (openOMSI writes its own GL variants).
@turbo-devv
turbo-devv merged commit 25e1abf into main Nov 23, 2026
4 checks passed
@m3rlinek01

Copy link
Copy Markdown
Contributor

Checked on an RTX 5080 (driver 621.24) with MX_DX12_VALIDATION=1: openOMSI main 03cebca7 with mX at 25e1abf, against the same tree with mX at fd964cd (plus two local fixes that don't touch the heap). Berlin-Spandau, the MAN EN92 standing for 100 s, ray tracing off. For the count I logged every id 0 message locally; #11 logs the first five and every thousandth.

mX Live Producer refcount at exit Live Objects
fd964cd 1380 over 2000
25e1abf (#13) 1 820, all with refcount 0

No errors while running, only the clear-value warnings (820/821), and no id 921. So the retired textures are released now, and openOMSI lets go of everything it made. One reference to the device itself is still held at exit, and the 820 objects stay only because of it. The simple report doesn't say what holds it; the callback's ID3D12InfoQueue1 is dropped at the end of log_debug_messages.
Ray tracing was off because on mX it removes the device at start: mx-dx12 makes a typed UAV for every view of a STORAGE_BINDING texture, also for openOMSI's sRGB view of the ray tracing texture atlas (debug layer id 342). I have a fix with a conformance test and will send it separately.

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.

2 participants