Repository navigation
feat(heap): multisampled depth, storage textures and acceleration structures in the heap - #16
Merged
Merged
Conversation
…tructures in the heap Heap bindings renumbered: 0..=6 sampled textures (mx_texdepth_ms at 6), 7/8 samplers, 9/10 mx_buffers/mx_rw_buffers, 11 acceleration structures, 12..=15 shader-declared storage-texture views, 16..=63 typed buffer views. Writers place the new kinds (MSL: texture table; SPIR-V: one storage-image binding, one AS binding; HLSL: spaces 14, 27, 28..=31, sampler heap moved to space 80). naga patched for binding arrays of acceleration structures (validator, MSL writer).
…l, Vulkan and GL - Texture views with STORAGE_BINDING (one mip of a 2D view) get a heap index; TLASes get one too (Tlas::index), in the texture index space. - Metal: storage views and TLASes in the texture table; storage textures declared for writing, TLASes and their BLASes declared to every encoder; direct binding of TLASes; Metal 2 refuses heap acceleration structures. - Vulkan: MS depth views in mx_texdepth_ms, a STORAGE_IMAGE array and an ACCELERATION_STRUCTURE_KHR array in the heap set (update after bind); ray queries now need descriptorBindingAccelerationStructureUpdateAfterBind. - GL: heap storage textures bound to image units. - Conformance tests for each kind.
…ct3D 12 and 11 - Direct3D 12: a UAV per texture slot after the buffer UAVs for storage-texture views, TLAS SRVs in texture slots (Tlas::index), root signature ranges for both (spaces 27 and 28..=31); draws and dispatches that write storage textures through the heap put them in UNORDERED_ACCESS. The texture limit halves (two descriptors a slot). - Direct3D 11 (bound tier): heap storage textures bound as UAVs, MS depth as SRVs.
turbo-devv
added a commit
to turbo-devv/openOMSI-fork
that referenced
this pull request
Nov 24, 2026
…n structures in the heap; openOMSI-org/mX#16)
This was referenced Nov 24, 2026
turbo-devv
added a commit
to openOMSI-org/openOMSI
that referenced
this pull request
Nov 24, 2026
* perf(render-mx): the temporal motion group read from the heap The motion vectors' uniform and the last frame's model places are read at the scene shader's lights and grid places, which the motion pipelines do not otherwise read (MotionHeap); no group 3 for them. * build(mx): pin mX aca1cb9 (MS depth, storage textures and acceleration structures in the heap; openOMSI-org/mX#16) * perf(render-mx): the last bind groups go: ray tracing and the multisampled pane depth through the heap - groups_to_heap reads storage textures (one heap array a format, mX's bindings 12-15), acceleration structures (mx_tlas, binding 11), multisampled depth (mx_texdepth_ms) and writable buffers (read-write typed views; HeapGroup makes writable views for them), and keeps a module's enable directives first. - The ray tracing's modules (lighting, texture means, coordinates, reflections, denoiser) read everything from the heap (RT_LIGHTING, RT_AVG, RT_UV, RT_REFLECT, RT_DENOISE). - The masked prefill reads the panes' multisampled depth at the frame's ground place. - every_module_in_the_heap_validates covers the ray tracing and the scene shader. * build(mx): pin mX 8118158 (GL heap slots stay readable until their submission is done) * build(mx): pin mX a78aa1a (OpenGL ES 3.0 blends: no per-buffer calls where the targets agree) * perf(ui-mx, xr-mx): the interface and the headset's mirror read their pictures from the heap A layer's numbers and the picture's and sampler's places are a draw's 128 bytes of immediates; the per-layer uniform buffer and the bind groups go. No bind groups are left in openOMSI's mX crates. * docs(mx): no bind groups left; the GL fixes * build(mx): pin mX eaa7aa1 (per-buffer blending through OES_draw_buffers_indexed on ES 3.0) * build(mx): pin mX c447f0b (openOMSI-org/mX#17: the GL fixes on top of main)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shaders can now read three more kinds of resource from the heap (group 7), indexed by immediates, so openOMSI's renderer can drop its last root bind groups.
Heap bindings
mx_tex2d..mx_tex2d_u32(unchanged)mx_texdepth_ms: binding_array<texture_depth_multisampled_2d>(new)mx_samplers,mx_samplers_cmp(were 6, 7)mx_buffers,mx_rw_buffers(were 8, 9)binding_array<acceleration_structure>binding_array<texture_storage_2d<F, write>>, any formatEverything refers to
mx_shader::heap::*. Acceleration structures are not in the prelude, which would ask every shader for ray queries.STORAGE_BINDINGtexture showing one mip of a 2D texture gets a heap index (the same one as its sampled view when the texture also hasTEXTURE_BINDING). All arrays at 12..=15 alias one array of storage textures.Tlas::index(), taken from the texture index space.Per backend
MTLResourceIDs). Storage textures are declared for writing, and TLASes plus the BLASes of their last build for reading, on every encoder. Direct heap binding (write_direct) binds TLASes withset*AccelerationStructure. Metal 2 (bound tier) refuses heap acceleration structures.STORAGE_IMAGEarray sits at binding 12 (needsdescriptorBindingStorageImageUpdateAfterBind) and anACCELERATION_STRUCTURE_KHRarray at binding 11. Ray queries now requiredescriptorBindingAccelerationStructureUpdateAfterBind, which every driver with ray queries has.TUAVs, one per texture slot, for storage views. TLAS SRVs sit in texture slots. Root-signature ranges cover them (spaces 27 and 28..=31), and the sampler heap moves to space 80. Draws and dispatches that write storage textures through the heap put them inUNORDERED_ACCESS. The texture-slot limit is halved because each slot now takes two descriptors.vendor/naga/MX_PATCHES.md): the validator and the MSL writer now accept binding arrays of acceleration structures. The HLSL storage-textureunreachable!happened because mX's binding map gave those arrays no size; that is fixed inmx_shader::hlsland needed no naga patch.Tests
New conformance tests: MS depth read through
mx_texdepth_ms; a compute pass writing rgba16float and rgba8unorm storage textures through the heap, then sampling one of them throughmx_tex2d; ray queries against two TLASes taken from the heap.Ran on an M4:
cargo test -p mx-types -p mx-shader --all-features: pass. Includes new unit tests per writer, SPIR-V throughspirv-valand GLSL throughglslangValidator.MX_METAL_DIRECT=0andMX_NO_RESIDENCY_SET=1, and under Metal API and shader validation.MX_METAL_BOUND=1: pass.openomsi_shaders: pass on Metal, Metal 2, MoltenVK and ANGLE.cargo clippy(workspace, andx86_64-pc-windows-gnufor mx-dx12/mx-dx11/mx) andcargo fmt: clean.Not run: Direct3D 12 and 11 (compiled only; CI's WARP runs the D3D12 tests), Vulkan ray queries through the heap, GL storage textures and MS depth (CI's llvmpipe runs them).
OpenGL fixes (found with openOMSI on ANGLE):
fix(gl)8118158: a dropped view's heap slot stays readable until its submission is done. GL replays command buffers at submit; the entry was cleared at once, so a draw recorded before the drop bound an empty slot (openOMSI's GPU mip chain came out black). Test:a_removed_slot_reads_until_reclaimed.fix(gl)a78aa1a, eaa7aa1: blend state and colour masks. glow calls the ES 3.2glEnablei/glBlendFuncSeparatei/glColorMaski, which ANGLE's ES 3.0 refuses, so blending was off. Targets that agree now use the plain calls; others useOES_draw_buffers_indexed's entry points, loaded through EGL (IndexedOes), on ES 3.0/3.1. Checked with openOMSI's renderer and interface on ANGLE.