diff options
| author | Yong He <yonghe@outlook.com> | 2024-01-19 18:02:40 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-19 18:02:40 -0800 |
| commit | fdc17a974970559d8ff76d52c3ce40aaa056d441 (patch) | |
| tree | a7b2264776982707b36f901ac50acd4e047fd2bd /tests/spirv | |
| parent | 84b214389cacde9f3c94d61b3d4ca6a927cecd04 (diff) | |
Add `-fspv-reflect` support. (#3464)
* Add `-fspv-reflect` support.
Closes #3462.
* Fix.
* Fix.
* Remove use of `SPV_GOOGLE_hlsl_functionality1`.
* Fix spirv validation error.
* Fix test.
* Update typename hints.
* Update commandline options doc.
* Remove superfluous empty lines.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/spirv')
| -rw-r--r-- | tests/spirv/spirv-reflection.slang | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/spirv/spirv-reflection.slang b/tests/spirv/spirv-reflection.slang new file mode 100644 index 000000000..90414eb59 --- /dev/null +++ b/tests/spirv/spirv-reflection.slang @@ -0,0 +1,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 |
