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
842 B28 linesraw
1//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-NOT: ; Annotations
7// CHECK: OpCapability Matrix
8// CHECK: ; Annotations
9
10//
11// This test tests that we can look up unscoped enums based on context, and
12// position OpCapability correctly
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        // We should be able to look this up directly, without having to
22        // specify CapabilityMatrix or anything
23        OpCapability Matrix;
24        OpConstant $$int %two 2;
25        OpIMul $$int result $n %two
26    };
27    outputBuffer[i] = r;
28}