yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Lujin WangFix DerivativeGroupQuadsKHR workgroup size validation for texture sampling (#8647)4e4aad5a0

master
851 B26 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv-asm
2//TEST_INPUT:ubuffer(data=[0], stride=4):out
3
4// Test that DerivativeGroupQuadsKHR execution mode validates workgroup size
5// This test should produce an error because numthreads(1,1,1) violates the requirement
6// that X and Y dimensions must be multiples of 2
7
8[[vk::binding(0, 0)]]
9RWStructuredBuffer<float4> g_ssbo;
10
11[[vk::binding(0, 1)]]
12Texture2D g_textures[];
13[[vk::binding(0, 2)]]
14SamplerState g_samplers[];
15
16[shader("compute")]
17[numthreads(1, 1, 1)]  // Invalid: should be multiples of 2 for derivative group quads
18void main() {
19    float4 texture_color = g_textures[0].Sample(
20        g_samplers[0],
21        float2(0.0f, 0.0f)
22    );
23    g_ssbo[0] = texture_color;
24}
25
26// CHECK: error 31210: compute derivative group quad requires thread dispatch count of X and Y to each be at a multiple of 2