diff --git a/Test/baseResults/hlsl.nested-runtimeArray.frag.out b/Test/baseResults/hlsl.nested-runtimeArray.frag.out new file mode 100644 index 000000000..f019290c9 --- /dev/null +++ b/Test/baseResults/hlsl.nested-runtimeArray.frag.out @@ -0,0 +1,119 @@ +hlsl.nested-runtimeArray.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: @main( ( temp float) +0:7 Function Parameters: +0:? Sequence +0:8 Branch: Return with expression +0:8 direct index ( temp float) +0:8 a: direct index for structure ( temp unsized 1-element array of float) +0:8 direct index (layout( row_major std430) buffer structure{ temp unsized 1-element array of float a}) +0:8 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp unsized 1-element array of float a}) +0:8 'B' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp unsized 1-element array of float a} @data}) +0:8 Constant: +0:8 0 (const uint) +0:8 Constant: +0:8 0 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 Constant: +0:8 0 (const int) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 move second child to first child ( temp float) +0:? '@entryPointOutput' (layout( location=0) out float) +0:7 Function Call: @main( ( temp float) +0:? Linker Objects +0:? 'B' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp unsized 1-element array of float a} @data}) +0:? '@entryPointOutput' (layout( location=0) out float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: @main( ( temp float) +0:7 Function Parameters: +0:? Sequence +0:8 Branch: Return with expression +0:8 direct index ( temp float) +0:8 a: direct index for structure ( temp unsized 1-element array of float) +0:8 direct index (layout( row_major std430) buffer structure{ temp unsized 1-element array of float a}) +0:8 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp unsized 1-element array of float a}) +0:8 'B' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp unsized 1-element array of float a} @data}) +0:8 Constant: +0:8 0 (const uint) +0:8 Constant: +0:8 0 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 Constant: +0:8 0 (const int) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 move second child to first child ( temp float) +0:? '@entryPointOutput' (layout( location=0) out float) +0:7 Function Call: @main( ( temp float) +0:? Linker Objects +0:? 'B' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp unsized 1-element array of float a} @data}) +0:? '@entryPointOutput' (layout( location=0) out float) + +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 26 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 24 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 8 "@main(" + Name 11 "A" + MemberName 11(A) 0 "a" + Name 13 "B" + MemberName 13(B) 0 "@data" + Name 15 "B" + Name 24 "@entryPointOutput" + Decorate 10 ArrayStride 4 + MemberDecorate 11(A) 0 Offset 0 + Decorate 11(A) BufferBlock + Decorate 12 ArrayStride 4 + MemberDecorate 13(B) 0 Offset 0 + Decorate 13(B) BufferBlock + Decorate 15(B) DescriptorSet 0 + Decorate 15(B) Binding 0 + Decorate 24(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeFunction 6(float) + 10: TypeRuntimeArray 6(float) + 11(A): TypeStruct 10 + 12: TypeRuntimeArray 11(A) + 13(B): TypeStruct 12 + 14: TypePointer Uniform 13(B) + 15(B): 14(ptr) Variable Uniform + 16: TypeInt 32 1 + 17: 16(int) Constant 0 + 18: TypePointer Uniform 6(float) + 23: TypePointer Output 6(float) +24(@entryPointOutput): 23(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 25: 6(float) FunctionCall 8(@main() + Store 24(@entryPointOutput) 25 + Return + FunctionEnd + 8(@main(): 6(float) Function None 7 + 9: Label + 19: 18(ptr) AccessChain 15(B) 17 17 17 17 + 20: 6(float) Load 19 + ReturnValue 20 + FunctionEnd diff --git a/Test/hlsl.nested-runtimeArray.frag b/Test/hlsl.nested-runtimeArray.frag new file mode 100644 index 000000000..3606adac3 --- /dev/null +++ b/Test/hlsl.nested-runtimeArray.frag @@ -0,0 +1,9 @@ +struct A { + float a[]; +}; + +RWStructuredBuffer B; + +float main() { + return B[0].a[0]; +} diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 597425762..32d5df9e3 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -417,6 +417,7 @@ INSTANTIATE_TEST_SUITE_P( {"hlsl.matType.bool.frag", "main"}, {"hlsl.matType.int.frag", "main"}, {"hlsl.max.frag", "PixelShaderFunction"}, + {"hlsl.nested-runtimeArray.frag", "main"}, {"hlsl.preprocessor.frag", "main"}, {"hlsl.precedence.frag", "PixelShaderFunction"}, {"hlsl.precedence2.frag", "PixelShaderFunction"},