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
644 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's assignment syntax
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        %two   = OpConstant $$int 2;
22        result = OpIMul $$int $n %two;
23    };
24    outputBuffer[i] = r;
25}