Files
mandy/runtime/test/glsl/ps_image_atomic.frag
iFeyz 5fdd6abbc0 D3D-448-GRAPHICS: graphics root arguments in the console layout, mesh shaders through a window
The graphics bind point laid root arguments out with pack() (from s0, two
dwords per table), while the console starts them at s8 for VS/PS/GS with
one dword per table (the corpus census, and the retail frame loop reading
its tables at s8..s10). Compute already took the console layout (D3D-448);
graphics waited because a mesh shader (s16) and a pixel shader (s8) share
one push-constant block.

- translator: user_data_dword() - a mesh shader loads s16..s31 from push
  dwords 8..23, s8..s15 as 0, s0..s7 unchanged, so root dword k is push
  dword 8 + k for every graphics stage; index.json records the window as
  "root_window" on mesh shaders. VS/PS/GS/CS are unchanged.
- runtime: CreateRootSignature lays graphics out with
  pack_stage(Stage::Vertex) and checks Stage::Mesh (mesh_ok); a table is
  one dword at both bind points; DispatchMesh with a signature past the
  16-dword mesh window invalidates the list; a mesh PSO whose mesh shader
  has no root_window (translated before) is refused with a log line.
- fixtures: the GLSL stand-ins read the root arguments at push dword 8 + k;
  the M1.5/M2/M3 asm read their tables as one dword from s8.
- tests: tests/semantic/test_ms_root_window.py (MeshEXT and --mesh-compute
  on the CPU interpreter), graphics-window cases in root_signature_test,
  the two refusals in d3d12_mesh_test.
- docs: d3d12_vulkan.md 3.5, design.md user-data row.
2026-11-24 16:50:49 +01:00

25 lines
1.1 KiB
GLSL

#version 460
// A pixel shader that does an image atomic, written to the translator's runtime contract (docs/design.md, "User
// data" and "Images"), standing in for a translated one in d3d12_stores_atomics_test. The translator declares the
// storage images of such a shader without NonWritable; this one does the same (no `readonly`), at the binding set 0
// has for the R32ui views the atomic instructions use (binding 4, src/vulkan_bindless.h). Outside a compute shader
// Vulkan allows that only on a device with fragmentStoresAndAtomics (VUID-RuntimeSpirv-NonWritable-06340).
// The test creates the pipeline and never draws with it: index 0 is the set's fallback view.
#extension GL_EXT_nonuniform_qualifier : require
layout(location = 0) in vec4 color;
layout(location = 0) out vec4 target;
layout(push_constant) uniform UserData {
uint s[32];
uvec2 heap_base;
uvec2 code_base;
} pc;
layout(set = 0, binding = 4, r32ui) uniform uimage2D counters[];
void main() {
const uint before = imageAtomicMax(counters[0], ivec2(gl_FragCoord.xy), pc.s[8]);
target = vec4(color.rgb, float(before & 1u));
}