Skip to content

Commit 3923cd7

Browse files
committed
Add SPV_EXT_descriptor_heap test fixtures and regenerate goldens
Adds tests/descriptor_heap/{glsl,slang}/ with bindless and per-draw fixtures that exercise the SPV_EXT_descriptor_heap reflection path, plus two slang-only compute fixtures: multi_type_heap.comp.spv covers sampled-image, storage-image, uniform/storage texel-buffer, and storage-buffer (StructuredBuffer/RWStructuredBuffer via OpTypeBufferEXT) slots in a single entry point's call graph; as_heap.comp.spv covers the acceleration-structure heap path. Regenerates 113 existing goldens to pick up the new entry_point_heap_accesses YAML section emitted by the library half of this change. The three user_type/byte_address_buffer* and rw_byte_address_buffer goldens were patched by hand instead of mechanically regenerated, preserving the pre-existing offset-ordering mismatch tracked as upstream issue #307 so that signal stays visible. Registers the new fixtures in tests/test-spirv-reflect.cpp. This commit depends on the library changes in the follow-up PR; on its own the goldens will not match what the unchanged library produces.
1 parent c90b7b7 commit 3923cd7

149 files changed

Lines changed: 8840 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tests/16bit/vert_in_out_16.spv.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,4 +354,10 @@ module:
354354
push_constants:
355355
specialization_constant_count: 0,
356356
specialization_constants:
357+
entry_point_heap_accesses:
358+
- entry: "main"
359+
resource_heap_access_count: 0
360+
resource_heap_accesses:
361+
sampler_heap_access_count: 0
362+
sampler_heap_accesses:
357363
...

tests/access_chains/array_length_from_access_chain.spv.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,10 @@ module:
149149
push_constants:
150150
specialization_constant_count: 0,
151151
specialization_constants:
152+
entry_point_heap_accesses:
153+
- entry: "main"
154+
resource_heap_access_count: 0
155+
resource_heap_accesses:
156+
sampler_heap_access_count: 0
157+
sampler_heap_accesses:
152158
...

tests/access_chains/pointer_access_chain_phy_storage_buffer.spv.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,10 @@ module:
201201
push_constants:
202202
specialization_constant_count: 0,
203203
specialization_constants:
204+
entry_point_heap_accesses:
205+
- entry: "main"
206+
resource_heap_access_count: 0
207+
resource_heap_accesses:
208+
sampler_heap_access_count: 0
209+
sampler_heap_accesses:
204210
...

tests/cbuffer_unused/cbuffer_unused_001.spv.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3493,4 +3493,10 @@ module:
34933493
push_constants:
34943494
specialization_constant_count: 0,
34953495
specialization_constants:
3496+
entry_point_heap_accesses:
3497+
- entry: "main"
3498+
resource_heap_access_count: 0
3499+
resource_heap_accesses:
3500+
sampler_heap_access_count: 0
3501+
sampler_heap_accesses:
34963502
...
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Compile: glslang -V --target-env vulkan1.3 -S frag -e main -IC:/code/source/nvpro-samples/nvpro_core2 -IC:/code/source/nvpro-samples/vk_mini_samples/common -o bindless.frag.spv bindless.frag.glsl
2+
/*
3+
* Copyright (c) 2024-2026, NVIDIA CORPORATION. All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
18+
* SPDX-License-Identifier: Apache-2.0
19+
*/
20+
#version 450
21+
22+
#extension GL_GOOGLE_include_directive : enable
23+
#extension GL_EXT_nonuniform_qualifier : enable
24+
#extension GL_EXT_descriptor_heap : enable
25+
26+
#include "shaderio.h"
27+
28+
layout(location = 0) in vec2 inUV;
29+
layout(location = 1) in vec3 inNormal;
30+
layout(location = 2) flat in int inFaceIdx;
31+
layout(location = 3) flat in uint inBaseFaceTexIdx;
32+
33+
layout(location = 0) out vec4 outColor;
34+
35+
// Bindless mode: direct descriptor heap access via layout(descriptor_heap).
36+
// No set/binding mapping needed. The shader computes texIdx = baseFaceTexIdx +
37+
// faceIdx and indexes heapTextures[] directly. baseFaceTexIdx was computed in
38+
// the vertex shader from gl_InstanceIndex.
39+
layout(descriptor_heap) uniform texture2D heapTextures[];
40+
layout(descriptor_heap) uniform sampler heapSamplers[];
41+
42+
layout(push_constant) uniform PushConstants_
43+
{
44+
FrameInfo frame;
45+
BindlessPushData bindless;
46+
};
47+
48+
vec3 unpackColor(uint c)
49+
{
50+
return vec3(float(c & 0xFFu), float((c >> 8) & 0xFFu), float((c >> 16) & 0xFFu)) / 255.0;
51+
}
52+
53+
void main()
54+
{
55+
uint texIdx = inBaseFaceTexIdx + inFaceIdx;
56+
vec4 texColor = texture(sampler2D(heapTextures[nonuniformEXT(texIdx)], heapSamplers[0]), inUV);
57+
58+
// Replace border pixels with per-draw-call border color
59+
float borderWidth = 1.0 / 48.0;
60+
if(inUV.x < borderWidth || inUV.x > 1.0 - borderWidth || inUV.y < borderWidth || inUV.y > 1.0 - borderWidth)
61+
{
62+
texColor.rgb = unpackColor(bindless.borderColor);
63+
}
64+
65+
vec3 N = normalize(inNormal);
66+
float NdotL = max(dot(N, normalize(frame.lightDir)), 0.0);
67+
outColor = vec4(texColor.rgb * (0.3 + 0.7 * NdotL), 1.0);
68+
}
4.41 KB
Binary file not shown.

0 commit comments

Comments
 (0)