yum-mirror/slang

Making it easier to work with shaders

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

Ellie HermaszewskaAllow bitwise or expressions and numeric literals in spirv_asm blocks (#3157)508dc3a95

master
817 B29 linesraw
1//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):-emit-spirv-directly -target spirv-asm -entry computeMain -stage compute
2
3//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):out,name=outputBuffer
4RWStructuredBuffer<int> outputBuffer;
5
6// CHECK: ; Debug Information
7// CHECK-NOT: ; Annotations
8// CHECK: OpName %{{[a-zA-Z]+}} "INTEGERRRRRRRRRRRRRRRRRRRRR"
9// CHECK: ; Annotations
10
11//
12// This test tests that OpName is put in the correct location in the generated spriv
13//
14[numthreads(4, 1, 1)]
15void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
16{
17    spirv_asm
18    {
19        OpName $$int "INTEGERRRRRRRRRRRRRRRRRRRRR"
20    };
21    int i = dispatchThreadID.x;
22    int n = outputBuffer[i];
23    int r = spirv_asm
24    {
25        OpConstant $$int %two 2;
26        OpIMul $$int result $n %two
27    };
28    outputBuffer[i] = r;
29}