yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
508dc3a95
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 we correctly wrap constants in ids when required and 13// can look up names through that wrapped operand kind 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 // A dummy barrier, this tests that we can look up these names without 24 // their Scope and MemorySemantics prefixes, and correctly wrap them in 25 // OpConstant. 26 OpMemoryBarrier Invocation 27 // Test that an unqualified enum works 28 AcquireRelease 29 // Test that a decimal integer literal works 30 | 64 31 // Test that a hex integer literal works 32 | 0x800 33 // Test that an explicit scope works 34 | MemorySemanticsAtomicCounterMemory; 35 OpIMul $$int result $n %two 36 }; 37 outputBuffer[i] = r; 38}