yum-mirror/slang

Making it easier to work with shaders

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

sricker-nvidiaFix broken -emit-spirv-via-glsl test option (#7091)b39ec87cc

master
1.5 KiB41 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -stage compute  -entry computeMain -target glsl -allow-glsl -DQUAD -DMODIFIER
2//TEST:SIMPLE(filecheck=CHECK): -stage compute  -entry computeMain -target glsl -allow-glsl -DMODIFIER
3//TEST:SIMPLE(filecheck=CHECK): -stage compute  -entry computeMain -target glsl -allow-glsl -DQUAD
4//TEST:SIMPLE(filecheck=CHECK): -stage compute  -entry computeMain -target glsl -allow-glsl
5//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type -emit-spirv-via-glsl -allow-glsl -xslang -DQUAD
6//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type -emit-spirv-via-glsl -allow-glsl
7
8//TEST_INPUT: ubuffer(data=[0], stride=4):out,name outputBuffer
9RWStructuredBuffer<float> outputBuffer;
10//TEST_INPUT: Texture2D(size=4, content = one):name t2D
11Texture2D<float> t2D;
12//TEST_INPUT: Sampler:name samplerState
13SamplerState samplerState;
14
15// "local_size_x" must appear before "derivative_group_"
16//CHECK:local_size_x
17//CHECK:derivative_group_{{.*}}NV
18
19#ifndef MODIFIER
20#ifdef QUAD
21layout(derivative_group_quadsNV) in;
22#else
23layout(derivative_group_linearNV) in;
24#endif // #ifdef QUAD
25layout(local_size_x = 2, local_size_y = 2, local_size_z = 1) in;
26
27#else
28
29#ifdef QUAD
30[DerivativeGroupQuad]
31#else
32[DerivativeGroupLinear]
33#endif // #ifdef QUAD
34[numthreads(2, 2, 1)]
35#endif // #ifndef MODIFIER
36[shader("compute")]
37void computeMain()
38{
39    //BUF:1
40    outputBuffer[0] = t2D.Sample(samplerState, float2(0.5, 0.5));
41}