yum-mirror/slang

Making it easier to work with shaders

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

Mukund KeshavaEnable tests for CUDA (#7593)141eac9eb

master
1.3 KiB38 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
2//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
3//TEST:SIMPLE(filecheck=HLSL): -target hlsl -profile cs_5_0 -entry computeMain -line-directive-mode none
4//TEST:SIMPLE(filecheck=GLSL): -target glsl -profile glsl_450 -stage compute -entry computeMain -line-directive-mode none
5//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj -output-using-type
6
7// Metal does not support custom data layout.
8//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl
9
10
11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
12RWStructuredBuffer<float> outputBuffer;
13
14//TEST_INPUT:set Constants.v0={1.0,2.0,3.0,4.0}
15//TEST_INPUT:set Constants.v1={5.0,6.0,7.0}
16//TEST_INPUT:set Constants.v2=8.0
17
18cbuffer Constants
19{
20    float4 v0 : packoffset(c0);
21    float3 v1 : packoffset(c1);
22    float v2 : packoffset(c1.w);
23};
24// HLSL: cbuffer
25// HLSL: {
26// HLSL: {{.*}} : packoffset(c0);
27// HLSL: {{.*}} : packoffset(c1);
28// HLSL: {{.*}} : packoffset(c1.w);
29// HLSL: }
30// GLSL: layout(offset = 0)
31// GLSL: layout(offset = 16)
32// GLSL: layout(offset = 28)
33
34[numthreads(1, 1, 1)]
35void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
36{
37    outputBuffer[dispatchThreadID.x] = v2;
38}