summaryrefslogtreecommitdiff
path: root/tests/spirv/spirv-reflection.slang
blob: 90414eb5981965125bbc3fa6cc4d48bc7e04ae21 (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:SIMPLE(filecheck=SPIRV): -stage compute -entry computeMain -target spirv -emit-spirv-directly -fspv-reflect

// Test ability to directly output SPIR-V reflection info on parameters.

Texture2D mTexture : MY_HLSL_SEMANTIC;
struct MyElement
{
    float x;
}
StructuredBuffer<MyElement> myBuffer : MY_HLSL_SEMANTIC1;
AppendStructuredBuffer<float> myAppendBuffer : MY_HLSL_SEMANTIC2;

[numthreads(8, 8, 1)]
void computeMain()
{
    float4 color = mTexture.Load(int3(0, 0, 0));
    myAppendBuffer.Append(color.x + myBuffer[0].x);
}

// SPIRV-DAG: OpExtension "SPV_GOOGLE_user_type"

// SPIRV-DAG: OpDecorate %mTexture UserTypeGOOGLE "Texture2D"
// SPIRV-DAG: OpDecorate %mTexture UserSemantic "MY_HLSL_SEMANTIC"

// SPIRV-DAG: OpDecorate %myBuffer UserTypeGOOGLE "StructuredBuffer<MyElement_std430>"
// SPIRV-DAG: OpDecorate %myBuffer UserSemantic "MY_HLSL_SEMANTIC1"

// SPIRV-DAG: OpDecorate %myAppendBuffer_counter UserTypeGOOGLE "RWStructuredBuffer<int>"
// SPIRV-DAG: OpDecorate %myAppendBuffer_counter UserSemantic "MY_HLSL_SEMANTIC2"

// SPIRV-DAG: OpDecorate %myAppendBuffer_elements UserTypeGOOGLE "RWStructuredBuffer<float>"
// SPIRV-DAG: OpDecorate %myAppendBuffer_elements UserSemantic "MY_HLSL_SEMANTIC2"
// SPIRV-DAG: OpDecorateId %myAppendBuffer_elements CounterBuffer %myAppendBuffer_counter