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
716 B25 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: OpExtension "SPV_KHR_vulkan_memory_model"
8// CHECK: ; Annotations
9
10//
11// This test tests that we can position OpExtension correctly
12//
13[numthreads(4, 1, 1)]
14void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
15{
16    int i = dispatchThreadID.x;
17    int n = outputBuffer[i];
18    int r = spirv_asm
19    {
20        OpExtension "SPV_KHR_vulkan_memory_model";
21        OpConstant $$int %two 2;
22        OpIMul $$int result $n %two
23    };
24    outputBuffer[i] = r;
25}