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
853 B27 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv-asm
2//TEST_INPUT:ubuffer(data=[0], stride=4):out
3
4// Test that DerivativeGroupLinearKHR execution mode validates workgroup size
5// This test should produce an error because numthreads(3,1,1) violates the requirement
6// that the product of dimensions must be a multiple of 4
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[DerivativeGroupLinear]
18[numthreads(3, 1, 1)]  // Invalid: 3*1*1 = 3, not multiple of 4
19void main() {
20    float4 texture_color = g_textures[0].Sample(
21        g_samplers[0],
22        float2(0.0f, 0.0f)
23    );
24    g_ssbo[0] = texture_color;
25}
26
27// CHECK: error 31211: compute derivative group linear requires total thread dispatch count to be at a multiple of 4