yum-mirror/slang

Making it easier to work with shaders

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

Ellie HermaszewskaInitial version of spirv_asm block (#3151)ef4c9f1f1

master
617 B25 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj -emit-spirv-directly
2
3//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):out,name=outputBuffer
4RWStructuredBuffer<int> outputBuffer;
5
6// CHECK:      2
7// CHECK-NEXT: 4
8// CHECK-NEXT: 6
9// CHECK-NEXT: 8
10
11//
12// This test tests a basic application of the spirv_asm block
13//
14[numthreads(4, 1, 1)]
15void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
16{
17    int i = dispatchThreadID.x;
18    int n = outputBuffer[i];
19    int r = spirv_asm
20    {
21        OpConstant $$int %two 2;
22        OpIMul $$int result $n %two
23    };
24    outputBuffer[i] = r;
25}