Skip to content

fix(dx12): no UAV for sRGB views of storage textures; free a removed device's submissions - #18

Merged
turbo-devv merged 2 commits into
mainfrom
fix/dx12-srgb-storage-view
Nov 25, 2026
Merged

turbo-devv merged 2 commits into
mainfrom
fix/dx12-srgb-storage-view

Conversation

@turbo-devv

Copy link
Copy Markdown
Contributor

Direct3D 12 fixes for openOMSI's ray tracing on NVIDIA (openOMSI#4223; logs from RTX 3060, 3070 and 5070 Ti). With ray tracing on, the Direct3D 12 device was removed while openOMSI built its renderer, with DXGI_ERROR_INVALID_CALL and no command list submitted.

  • No UAV for an sRGB view of a storage texture. A texture made with STORAGE_BINDING got a UAV for every view, its sRGB views included. Direct3D 12 has no sRGB UAV, and CreateUnorderedAccessView returns nothing, so the invalid call removed the device. openOMSI's RT texture atlas is Rgba8Unorm with storage, sampled through an Rgba8UnormSrgb view. The new mx_types::is_storage_view_format is false for sRGB, depth and block-compressed formats. is_heap_storage_view uses it, and mx-dx12 makes no UAV for such a view. mx-vulkan leaves STORAGE out of such a view's usage (VUID-VkImageViewCreateInfo-usage-02275). Test: an_srgb_view_of_a_storage_texture_is_no_storage_view.
  • Device::is_lost. True once Direct3D 12 has removed the device; false on the other backends. openOMSI uses it so it does not build its renderer again on a device that cannot come back.
  • A removed device frees what its submissions held. On a removed device (fence at u64::MAX), poll returned without freeing the in-flight submissions. They held the last frames' swapchain buffers, and so the flip-model swapchain on the window. After openOMSI went on with Vulkan, the window kept showing the last Direct3D 12 picture: the grey loading screen of #4223.

Checked: cargo check for mx-types, mx-vulkan, mx-gl, mx-metal and mx-noop on macOS; mx, mx-dx12 and mx-dx11 for x86_64-pc-windows-msvc; cargo test -p mx-types. Not run yet on a Windows machine with an NVIDIA card.

…ith INVALID_CALL)

A texture made with STORAGE_BINDING got a UAV for every view, its sRGB view
included. Direct3D 12 has no sRGB UAV, and CreateUnorderedAccessView returns
nothing: the invalid call removed the device (DXGI_ERROR_INVALID_CALL, no
command list submitted). openOMSI's ray tracing texture atlas is such a
texture (Rgba8Unorm, sampled through an Rgba8UnormSrgb view): with ray
tracing on, every NVIDIA card lost the device while the renderer was built.

- mx-types: is_storage_view_format, shared by is_heap_storage_view
- mx-dx12: a view in such a format gets no UAV
- mx-vulkan: such a view of a storage image leaves STORAGE out of its usage
  (VUID-VkImageViewCreateInfo-usage-02275)
- mx: Device::is_lost (Direct3D 12's removed device; false elsewhere), so a
  renderer is not built again on a device that cannot come back
poll returned on a removed device (the fence at u64::MAX) without freeing
the in-flight submissions. They held the last frames' swapchain buffers,
and so the flip-model swapchain on the window: after the game went on with
Vulkan, the window kept showing the last Direct3D 12 picture (a grey
loading screen over a running game, openOMSI #4223).
@turbo-devv
turbo-devv merged commit 49d24fa into main Nov 25, 2026
4 checks passed
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