yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
93f5d13fc
master
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj 3//TEST_DISABLED(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj 4// Not supported in WGSL: Arrays of textures or buffers 5//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu 6 7// Note: can't actually test this on Vulkan right now because 8// the support in render-test isn't good enough. 9 10// Confirm that we can handle arrays of resources 11// being passed to a function. 12 13//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name gBuffer 14RWStructuredBuffer<int> gBuffer; 15 16//TEST_INPUT: Texture2D(size=4, content=one):name gTextures[0] 17//TEST_INPUT: Texture2D(size=4, content=one):name gTextures[1] 18Texture2D gTextures[2]; 19 20float broken(Texture2D t[2]) 21{ 22 return t[0].Load(int3(0)).x + t[1].Load(int3(0)).x; 23} 24 25int test(int val) 26{ 27 return val*int(broken(gTextures)); 28} 29 30 31[numthreads(4, 1, 1)] 32void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 33{ 34 uint tid = dispatchThreadID.x; 35 int val = int(tid); 36 val = test(val); 37 gBuffer[tid] = val; 38}