yum-mirror/slang

Making it easier to work with shaders

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

Simon KallweitDraft: integrate slang-rhi (#4970)f428a058e

master
1.1 KiB29 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -compute -output-using-type -shaderobj
2//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -compute -output-using-type -shaderobj
3//TEST(compute):SIMPLE(filecheck=SPIRV): -target spirv-asm -stage compute
4//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl -compute -output-using-type -shaderobj
5//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -output-using-type -shaderobj
6
7//TEST_INPUT:ubuffer(data=[0.0 0.0 0.0 0.0], stride=4):out,name=outputBuffer
8RWStructuredBuffer<float> outputBuffer;
9
10//SPIRV-NOT: Validation of generated SPIR-V failed
11
12[shader("compute")]
13[numthreads(1, 1, 1)]
14void computeMain(uint3 id: SV_DispatchThreadID)
15{
16    float3x4 a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
17    double3x4 b = (double3x4)a;
18
19    // CHECK: 1.000000
20    outputBuffer[0] = (float)b[0][0];
21    // CHECK: 2.000000
22    outputBuffer[1] = (float)b[0][1];
23
24    // CHECK: 7.000000
25    outputBuffer[2] = (float)b[1][2];
26
27    // CHECK: 12.000000
28    outputBuffer[3] = (float)b[2][3];
29}