yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
8086adc90
master
1//TEST:SIMPLE(filecheck=METAL): -target metal -stage compute -entry computeMain 2//TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage compute -entry computeMain 3//TEST:COMPARE_COMPUTE(filecheck-buffer=BUF): -vk -emit-spirv-directly 4//TEST:COMPARE_COMPUTE(filecheck-buffer=BUF): -metal -render-features argument-buffer-tier-2 5//TEST:COMPARE_COMPUTE(filecheck-buffer=BUF): -cuda 6//TEST:COMPARE_COMPUTE(filecheck-buffer=BUF): -cpu 7 8// This reproduces the specific case that was failing where uniform pointers 9// are used for buffer copy operations with array indexing targeting Metal. 10 11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 12RWStructuredBuffer<int> outputBuffer; 13 14//METAL: int{{.*}}device{{ *\*}} src 15 16// "indirect_argument" means a pointer 17//METALLIB: !"int", !"src{{[^"]*}}", !"air.indirect_argument" 18 19//TEST_INPUT: set src = ubuffer(data=[1 2 3 4 5 6 7 8],stride=4); 20uniform int* src; 21 22[shader("compute")] 23[numthreads(4,1,1)] 24void computeMain(uint3 threadID : SV_DispatchThreadID) 25{ 26 let input = src[threadID.x]; 27 outputBuffer[threadID.x] = input; 28} 29 30//BUF:1 31//BUF-NEXT:2 32//BUF-NEXT:3 33//BUF-NEXT:4