yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeFix WGSL parameter block binding. (#5500)2533125cb

master
868 B32 linesraw
1//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj
2//TEST(compute):COMPARE_COMPUTE:-cuda -shaderobj
3//TEST(compute):COMPARE_COMPUTE:-vk -shaderobj
4//TEST(compute):COMPARE_COMPUTE:-shaderobj
5//TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl -render-features argument-buffer-tier-2
6//TEST(compute):COMPARE_COMPUTE:-wgpu
7
8// Ensure that Slang `ParameterBlock` type is lowered
9// to HLSL in the fashion that we expect.
10
11struct P
12{
13	RWStructuredBuffer<int> buffer;
14};
15
16//TEST_INPUT: set block0 = new{ out ubuffer(data=[0 0 0 0], stride=4) }
17ParameterBlock<P> block0;
18
19//TEST_INPUT: set block1 = new{ ubuffer(data=[0 1 2 3], stride=4) }
20ParameterBlock<P> block1;
21
22[numthreads(4, 1, 1)]
23void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
24{
25	uint tid = dispatchThreadID.x;
26
27	int inVal = block1.buffer[tid];
28
29	int outVal = inVal;
30
31	block0.buffer[tid] = outVal;
32}