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
872 B35 linesraw
1// if.slang
2
3// Test active mask synthesis in the "easy case" of a two-sided `if`.
4
5//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute 
6//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
7//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0
8//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
9//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -capability cuda_sm_7_0
10
11//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name buffer
12RWStructuredBuffer<int> buffer;
13
14#define THREAD_COUNT 4
15#define WRITE(IDX) buffer[IDX*THREAD_COUNT + tid] = WaveGetActiveMask()
16
17void test(int tid)
18{
19	WRITE(0);
20	if((tid & 1) != 0)
21	{
22		WRITE(1);
23	}
24	else
25	{
26		WRITE(2);
27	}
28	WRITE(3);
29}
30
31[numthreads(THREAD_COUNT, 1, 1)]
32void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
33{
34	test(dispatchThreadID.x);
35}