yum-mirror/slang

Making it easier to work with shaders

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

cheneym2Fix user-attribute-lookup wgpu crash (#5510)64c6cb19b

master
905 B33 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
3//TEST_INPUT: Sampler:name samplerState
4
5//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
6RWStructuredBuffer<int> outputBuffer;
7
8// To test for a bug where a user attribute, gets incorrectly looked up
9// as a cached lookup made before creation will make it multiply defined.
10
11// Define an attribute that will appear in reflection
12[__AttributeUsage(_AttributeTargets.Var)]
13struct StaticSamplerAttribute {};
14
15struct Thing
16{
17    [StaticSampler] SamplerState samplerState1;
18    [StaticSampler] SamplerState samplerState2;
19}
20
21[StaticSampler] SamplerState samplerState;
22
23[numthreads(4, 1, 1)]
24void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
25{
26	uint tid = dispatchThreadID.x;
27
28	float inVal = float(tid);
29
30	outputBuffer[tid] = int(inVal);
31}
32
33