summaryrefslogtreecommitdiffstats
path: root/tests/bugs/user-attribute-lookup.slang
blob: 2b6ab0cfe5acf0ceac972229ee3f555e16e9e4c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
//TEST_INPUT: Sampler:name samplerState

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;

// To test for a bug where a user attribute, gets incorrectly looked up
// as a cached lookup made before creation will make it multiply defined.

// Define an attribute that will appear in reflection
[__AttributeUsage(_AttributeTargets.Var)]
struct StaticSamplerAttribute {};

struct Thing
{
    [StaticSampler] SamplerState samplerState1;
    [StaticSampler] SamplerState samplerState2;
}

[StaticSampler] SamplerState samplerState;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
	uint tid = dispatchThreadID.x;

	float inVal = float(tid);

	outputBuffer[tid] = int(inVal);
}