yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
ef4c9f1f1
master
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 that the implicit `OpName` inserted for spirv_asm IDs can 13// coexist with an explicit OpName instruction 14// 15[numthreads(4, 1, 1)] 16void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 17{ 18 int i = dispatchThreadID.x; 19 int n = outputBuffer[i]; 20 int r = spirv_asm 21 { 22 OpConstant $$int %two 2; 23 OpName %two "TWO"; 24 OpIMul $$int result $n %two 25 }; 26 outputBuffer[i] = r; 27}