Reserve unused std140 uniform block in reflection, and fix uniform block matrix layou...
authorRoy.li <lryer@msn.com>
Fri, 15 May 2020 08:26:48 +0000 (16:26 +0800)
committerGitHub <noreply@github.com>
Fri, 15 May 2020 08:26:48 +0000 (02:26 -0600)
commit24dcbd1b1f68ff268bfa22dc4b72bec73d52abe7
tree0d7eeba5979262d0d4736ed05f5ac1ac4bf88502
parentc6874320de63a631ffe62f4d379e086ae5ff2483
Reserve unused std140 uniform block in reflection, and fix uniform block matrix layout (#2041)

According to the spec glsl4.60.7:
4.4.5. Uniform and Shader Storage Block Layout Qualifiers:
"The packed qualifier overrides only std140, std430, and shared; other qualifiers are inherited.
When packed is used, no shareable layout is guaranteed. The compiler and linker can optimize
memory use based on what variables actively get used and on other criteria. Offsets must be
queried, as there is no other way of guaranteeing where (and which) variables reside within the
block"

we should reserve std140 block and shared block in reflection.

According to the spec glsl4.60.7:
4.4.5. Uniform and Shader Storage Block Layout Qualifiers:
"The row_major and column_major qualifiers only affect the layout of matrices, including all
matrices contained in structures and arrays they are applied to, to all depths of nesting. These
qualifiers can be applied to other types, but will have no effect."

We need ensure all matrix block member been effect.

Support EShMsgKeepUncalled in reflection

EShMsgKeepUncalled  is a link message for link program.
We need only one option to control uncalled function optimization.
If we set EShMsgKeepUncalled as false in link time, linker won't be keep the uncall function sequence in AST,  and if we set EShMsgKeepUncalled as true in link time, linker will keep all uncalled function sequence in AST.
So, in reflecte time, we just only travers all function sequence. It make EShMsgKeepUncalled  only work at linker, and can effect reflection.

Recursively layout packing to "block member"

layout packing isn't set recursively, it causes TReflection::getOffsets doesn't work correctly.
Test/baseResults/300block.frag.out
Test/baseResults/310.inheritMemory.frag.out
Test/baseResults/hlsl.reflection.vert.out
Test/baseResults/reflection.vert.out
glslang/Include/glslang_c_shader_types.h
glslang/MachineIndependent/ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.h
glslang/MachineIndependent/reflection.cpp
glslang/Public/ShaderLang.h [changed mode: 0755->0644]