upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorRafael <rafaelalvesp2005@gmail.com>2026-11-22 12:39:21 -0300
committerRafael <rafaelalvesp2005@gmail.com>2026-11-22 12:39:21 -0300
commit9420e70bb23a42b59f9ff2b47741f7d4391fa3e2 (patch)
tree30940047029f650c11f98f26852ccd66dc4e5718 /runtime
parent2f9b2a76a292ef4a99a0b237ad60f53f73a483e4 (diff)
d3d12_first_light: pin the stage separation of the FSSM lookup
From @SuarezPM's review of #2001: the description promised that a container swapped for the other stage's fails, but nothing asserted it. The shader library must not find the PS hash as a vs program or the VS hash as a ps program, and CreateGraphicsPipelineState with the pixel shader's container as the VS must fail and return no PSO. Both hold on the RTX 3060; the draw and the 16,383 + 1 comparison are unchanged, 0 validation messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/test/d3d12_first_light_test.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/test/d3d12_first_light_test.cpp b/runtime/test/d3d12_first_light_test.cpp
index 4fe86fd84..75a894148 100644
--- a/runtime/test/d3d12_first_light_test.cpp
+++ b/runtime/test/d3d12_first_light_test.cpp
@@ -103,6 +103,8 @@ int main() {
103 leonida::ShaderLibrary library; 103 leonida::ShaderLibrary library;
104 EXPECT(library.load(dir.string())); 104 EXPECT(library.load(dir.string()));
105 EXPECT(library.find("vs", vs_hash) && library.find("ps", ps_hash)); 105 EXPECT(library.find("vs", vs_hash) && library.find("ps", ps_hash));
106 // The lookup is keyed by stage as well as hash: each program must not be found as the other stage.
107 EXPECT(!library.find("vs", ps_hash) && !library.find("ps", vs_hash));
106 108
107 // mesh.bin: u32 vertex_count, u32 index_count, (x, y, z, u, v) f32 per vertex, u32 indices. 109 // mesh.bin: u32 vertex_count, u32 index_count, (x, y, z, u, v) f32 per vertex, u32 indices.
108 const auto mesh = read_file(dir / "mesh.bin"); 110 const auto mesh = read_file(dir / "mesh.bin");
@@ -161,6 +163,13 @@ int main() {
161 pso_desc.NumRenderTargets = 1; 163 pso_desc.NumRenderTargets = 1;
162 pso_desc.RTVFormats[0] = DXGI_FORMAT_R32G32B32A32_FLOAT; 164 pso_desc.RTVFormats[0] = DXGI_FORMAT_R32G32B32A32_FLOAT;
163 pso_desc.SampleDesc.Count = 1; 165 pso_desc.SampleDesc.Count = 1;
166 {
167 // The pixel shader's container as the VS: the proxy finds no vs program with that hash, so no PSO.
168 D3D12_GRAPHICS_PIPELINE_STATE_DESC swapped = pso_desc;
169 swapped.VS = pso_desc.PS;
170 Ref<ID3D12PipelineState> wrong;
171 EXPECT(FAILED(device->CreateGraphicsPipelineState(&swapped, IID_PPV_ARGS(&wrong.p))) && !wrong.p);
172 }
164 Ref<ID3D12PipelineState> pso; 173 Ref<ID3D12PipelineState> pso;
165 EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&pso_desc, IID_PPV_ARGS(&pso.p)))); 174 EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&pso_desc, IID_PPV_ARGS(&pso.p))));
166 175