heads up for when you peeps start running the material + lighting passes lol
heyy me again, been poking at the deferred side on my own and hit a couple of things that might save you peeps some pain later
first one is the gbuffer formats, the material shaders pack some stuff into plain bytes (the normal is octahedral packed across 3 bytes of one target, and theres some id bytes in another) and the lighting shaders unpack them with a times 255 and a truncate so if those render targets arent 8 bit unorm like on the console, like if u use f16 for everything u lose a byte in a bunch of pixels and the normals go weird and u get sparkly garbage in the specular. took me a while to figure that one out ngl
second, the image_load bounds check uses the width and height from the T# so if ur test descriptors dont have a real size in them every load except pixel 0,0 comes back zero and the lighting looks completely black even though everything else is right lol
third, for the mesh shaders with s_barrier, a wave that already ended doesnt count for the barrier on amd but in vulkan everything has to stay alive to write the outputs, and on nvidia the lanes inside the dispatch loop dont stay together, so barrier() deep in the loop can hang the gpu. what worked for me was leaving the loop at the barrier, syncing at the top level and keeping track of which waves finished
anyway just dropping it here, cool to see the mesh v5 fix btw :3
Activity
3@IAmNotSiob I claimed SHADER-91 in #374 before I saw your offer here, sorry. If you'd rather do it, say so and I'll release it. Otherwise I'll start from your analysis: guard the native path when an s_barrier is not in workgroup-uniform control flow (switch that shader to the emulated scheduler, or refuse it), with the 128-thread repro as a test. On NVIDIA that should matter for wave32 mesh shaders, which don't go through --wave64-emulate.
AI-assisted (Claude Code).
nah go for it, its yours :) the 128-thread repro from my comment should work as the test, ping me if u want a review
Thanks, these are useful. I checked each one against
main(b8f6c74):1. G-buffer formats. Agreed on the hazard. The runtime keeps the RTV formats the PSO declares (DXGI to Vulkan, and #388 kept explicit RGBA8 typeless RTVs for clears), so the real path shouldn't swap in f16. A test harness or a "just use RGBA16F" shortcut would hit exactly the ×255-and-truncate breakage you describe, though. Worth a line in the docs next to the render-target notes.
2. Image size from the T#. Correct. The image size is decoded from the T#'s WIDTH/HEIGHT fields (
runtime/src/gfx10_descriptors.h:159-160, stored as size − 1, so a zeroed descriptor means 1×1).image_loadis anOpImageFetch, and an out-of-range fetch returns 0. So a synthetic descriptor without a real size gives black everywhere except (0,0). Same deal: a docs note for anyone writing descriptor fixtures.3.
s_barrierin mesh/compute shaders.--wave64-emulate(the default on GPUs without 64-wide subgroups, so NVIDIA), this is already what the translator does (#152).s_barrieris scheduler state, finished waves stop counting, and the onlyOpControlBarriersits at the top level of the round loop. That's essentially your fix.s_barrierbecomes a plainOpControlBarrierwherever it sits. Minimal case: a 128-thread group where wave 1 jumps tos_endpgmand wave 0 runss_barrier. It translates and passesspirv-val, but the barrier lands inside anOpSelectionMergeconstruct that wave 1 never enters:On RDNA hardware that's fine (an ended wave doesn't count), and an AMD driver likely compiles it to the same
s_barrier. Vulkan doesn't promise it, though: a barrier in non-uniform control flow is undefined. Another driver, or a native run on a 32-wide GPU with emulation forced off, can hang. I haven't seen it hang yet (the only GPU I had was NVIDIA, which uses the emulated path).A possible guard for native mode: when an
s_barrierdoesn't sit in workgroup-uniform control flow (not post-dominating the entry, or inside the dispatch loop), either refuse it (Unsupported) or switch that shader to the emulated scheduler. I can put that together if nobody else wants it.AI-assisted (Claude Code): it read the code, built the repro shader and checked the SPIR-V.
TL;DR: you're right on all three.