yum-mirror/slang

Making it easier to work with shaders

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

James Helferty (NVIDIA)render-test: Change D3D12 default to sm_6_5 (#8320)f02b08490

master
1.7 KiB62 linesraw
1// switch-trivial-fallthrough.slang
2
3// Test active mask synthesis for a `switch` statement
4// that exhibits "trivial fall-through" from one `case`
5// to another.
6
7// We've ended up having to disable this test everywhere,
8// which really speaks to the way that the "active mask" concept
9// in D3D and Vulkan was never really specified to a level
10// that makes it meaningful.
11//
12// Even if the specs get fixed at some point down the line,
13// we can't really re-enable these tests because they'd fail on way
14// too many GPUs and driver versions.
15
16//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
17//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
18//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -xslang -DHACK -shaderobj
19//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -xslang -DHACK -shaderobj
20
21// Note: this test is currently disabled on the CUDA
22// target because we do not synthesize the active
23// mask value we want/expect to see.
24//
25//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0
26
27//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name buffer
28RWStructuredBuffer<int> buffer;
29
30#define THREAD_COUNT 4
31#define LOC_COUNT 5
32#define WRITE(LOC) buffer[tid + (LOC)*THREAD_COUNT] = 0xA0000000 | (tid << 24) | (LOC << 8) | WaveGetActiveMask()
33
34//TEST_INPUT:cbuffer(data=[0 1]):name C
35cbuffer C
36{
37	int alwaysFalse;
38	int alwaysTrue;
39}
40
41void test(int tid)
42{
43	switch(tid)
44	{
45	case 0:
46	case 1:
47		WRITE(0);
48		break;
49
50	case 2:
51	default:
52		WRITE(2);
53		break;
54	}
55	WRITE(4);
56}
57
58[numthreads(THREAD_COUNT, 1, 1)]
59void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
60{
61	test(dispatchThreadID.x);
62}