From 1ee750aed57e306ebc0c92e4874dc476f2cc9edb Mon Sep 17 00:00:00 2001 From: lriki Date: Thu, 25 Jun 2020 12:27:28 +0900 Subject: [PATCH] Add pack_matrix test --- .../hlsl.matpack-pragma-global.frag.out | 102 ++++++++++++++++++ Test/hlsl.matpack-pragma-global.frag | 8 ++ gtests/Hlsl.FromFile.cpp | 1 + 3 files changed, 111 insertions(+) create mode 100644 Test/baseResults/hlsl.matpack-pragma-global.frag.out create mode 100644 Test/hlsl.matpack-pragma-global.frag diff --git a/Test/baseResults/hlsl.matpack-pragma-global.frag.out b/Test/baseResults/hlsl.matpack-pragma-global.frag.out new file mode 100644 index 000000000..2feef9e92 --- /dev/null +++ b/Test/baseResults/hlsl.matpack-pragma-global.frag.out @@ -0,0 +1,102 @@ +hlsl.matpack-pragma-global.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:6 Function Definition: @main( ( temp 4-component vector of float) +0:6 Function Parameters: +0:? Sequence +0:7 Branch: Return with expression +0:7 direct index ( temp 4-component vector of float) +0:7 g_GlobalMat1: direct index for structure ( uniform 4X4 matrix of float) +0:7 'anon@0' (layout( column_major std140) uniform block{ uniform 4X4 matrix of float g_GlobalMat1}) +0:7 Constant: +0:7 0 (const uint) +0:7 Constant: +0:7 0 (const int) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:6 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( column_major std140) uniform block{ uniform 4X4 matrix of float g_GlobalMat1}) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:6 Function Definition: @main( ( temp 4-component vector of float) +0:6 Function Parameters: +0:? Sequence +0:7 Branch: Return with expression +0:7 direct index ( temp 4-component vector of float) +0:7 g_GlobalMat1: direct index for structure ( uniform 4X4 matrix of float) +0:7 'anon@0' (layout( column_major std140) uniform block{ uniform 4X4 matrix of float g_GlobalMat1}) +0:7 Constant: +0:7 0 (const uint) +0:7 Constant: +0:7 0 (const int) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:6 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( column_major std140) uniform block{ uniform 4X4 matrix of float g_GlobalMat1}) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + +// Module Version 10000 +// Generated by (magic number): 8000a +// Id's are bound by 25 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 23 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 9 "@main(" + Name 12 "$Global" + MemberName 12($Global) 0 "g_GlobalMat1" + Name 14 "" + Name 23 "@entryPointOutput" + MemberDecorate 12($Global) 0 ColMajor + MemberDecorate 12($Global) 0 Offset 0 + MemberDecorate 12($Global) 0 MatrixStride 16 + Decorate 12($Global) Block + Decorate 14 DescriptorSet 0 + Decorate 14 Binding 0 + Decorate 23(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeFunction 7(fvec4) + 11: TypeMatrix 7(fvec4) 4 + 12($Global): TypeStruct 11 + 13: TypePointer Uniform 12($Global) + 14: 13(ptr) Variable Uniform + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Uniform 7(fvec4) + 22: TypePointer Output 7(fvec4) +23(@entryPointOutput): 22(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 24: 7(fvec4) FunctionCall 9(@main() + Store 23(@entryPointOutput) 24 + Return + FunctionEnd + 9(@main(): 7(fvec4) Function None 8 + 10: Label + 18: 17(ptr) AccessChain 14 16 16 + 19: 7(fvec4) Load 18 + ReturnValue 19 + FunctionEnd diff --git a/Test/hlsl.matpack-pragma-global.frag b/Test/hlsl.matpack-pragma-global.frag new file mode 100644 index 000000000..2a0ff45f6 --- /dev/null +++ b/Test/hlsl.matpack-pragma-global.frag @@ -0,0 +1,8 @@ +#pragma pack_matrix(row_major) + +float4x4 g_GlobalMat1; + +float4 main() : SV_Target0 +{ + return g_GlobalMat1[0]; +} diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index c5e6d9f54..f3ca0b5ac 100755 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -279,6 +279,7 @@ INSTANTIATE_TEST_CASE_P( {"hlsl.logical.unary.frag", "main"}, {"hlsl.loopattr.frag", "main"}, {"hlsl.matpack-pragma.frag", "main"}, + {"hlsl.matpack-pragma-global.frag", "main"}, {"hlsl.mip.operator.frag", "main"}, {"hlsl.mip.negative.frag", "main"}, {"hlsl.mip.negative2.frag", "main"},