-
Notifications
You must be signed in to change notification settings - Fork 835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reflection issue fix #2041
Reflection issue fix #2041
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I afraid that GLSL reflection is mistakenly getting used as a substitute for SPIR-V reflection.
I think there are tools out there to help with SPIR-V reflection.
At a high-level, the same struct can be used in multiple places with contradictory layouts, implying two lower-level structs with different layouts to back the one high-level/abstract struct.
GLSL and the AST are higher level, representing all this with one struct.
SPIR-V is lower level, expanding this one struct to two structs.
} | ||
} | ||
|
||
// Spread LayoutPacking to block member, if a block member is a struct, we need spread LayoutPacking to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect.
The same struct can be used in multiple places with contradictory layouts, implying two lower-level structs with different layouts to back the one high-level/abstract struct.
GLSL and the AST are higher level, representing all this with one struct. SPIR-V is lower level, expanding this one struct to two structs.
I'm afraid you're trying to apply a low-level transform to a high-level representation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the code. Now when fix layoutMatrix and layoutPacking will clone a new struct, and will declare a new struct in Spirv code too. But I'm worry it will affect decompiling. because this structs in spirv have the same name, we make work out a way to give them a mangle name; like:
BlockName@structName .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, it is not correct at GLSL or AST level to have duplicate structures. They really are the same type at the high level, but different types at the SPIR-V level.
SPIR-V was already doing the duplication, and I think the SPIR-V code was already correct, yes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there already an existing problem with GLSL/AST level starting to push information into nested structures, but incorrectly? It seems there are two paths here:
A. fix it from doing that, at the high level, there should be only one
B. do it more, completely, requiring structure copying, which is a pretty major change
So, I guess three questions here:
- is it true this issue was present? (I can believe it from the memory qualifier test)
- is it the case you are choosing path B instead of fixing the code to match the design with path A?
- What are all the implications of changing GLSL/AST from single copy to multiple copy of the same struct?
It is possible you are fixing real problems here, but I worry it is by changing design and interface, and wonder about path A as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there already an existing problem with GLSL/AST level starting to push information into nested structures, but incorrectly? It seems there are two paths here:
A. fix it from doing that, at the high level, there should be only one
B. do it more, completely, requiring structure copying, which is a pretty major changeSo, I guess three questions here:
- is it true this issue was present? (I can believe it from the memory qualifier test)
- is it the case you are choosing path B instead of fixing the code to match the design with path A?
- What are all the implications of changing GLSL/AST from single copy to multiple copy of the same struct?
It is possible you are fixing real problems here, but I worry it is by changing design and interface, and wonder about path A as well.
Yes, there is a existing problem with GLSL/AST level.
- is it true this issue was present?
- This issue was present.
- is it the case you are choosing path B instead of fixing the code to match the design with path A?
- I chooise the path B to fix it.
- What are all the implications of changing GLSL/AST from single copy to multiple copy of the same struct?
- This will result in multiple copies of the structure in memory in addition to the original structure, but these copies are unique if they have the same memory layout or the same matrix layout. That's vary important, it can help we not generate duplicate struct in spirv code. So, it won't implicate spirv generate. One practical effect it may bring is that when we want to modify only the origin structure to affect all struct used in block, we may not get the results we want. If we want to affect all struct used in block, we need to process all the structural branches in the record.
In fact, I chose path B to reduce the impact on the design and interface. If we want fix it in high level, we have to modify the TTypeLoc (path A), and save layout information, matrix information in it, we have discussed internally, I think this is more fit, but the risk will be higher. path B won't impact interface, we only make a struct copy in AST, When we choose path B, this is the only way. If the behavior of some interfaces is affected, I think this is also easy to fix, just apply the behavior of the interface to all records.
5b21a86
to
7e479de
Compare
} | ||
} | ||
|
||
// Spread LayoutPacking to block member, if a block member is a struct, we need spread LayoutPacking to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, it is not correct at GLSL or AST level to have duplicate structures. They really are the same type at the high level, but different types at the SPIR-V level.
SPIR-V was already doing the duplication, and I think the SPIR-V code was already correct, yes?
There has been little discussion or answers about the biggest thing happening here.
It's a pretty big change to instead have the AST in the SPIR-V bucket instead of the GLSL and HLSL bucket. If this major architectural change is proposed, we should:
Maybe this is okay to do, but it should not just be a side effect of seeing a bug in code reading. It should be a proactively broadcast design change. |
I agree that, and I think the most important is that we must be clear what the new architecture and high-level design is.
Ideally, AST should be closer to the semantics of high-level languages, rather than to accommodate the structure of low-level languages. but, why do we encounter such problems? rename : and :
To make a separation of type and type qualifier and use TTypeDetail to instead the TType in symbol node. And it can help us solve problems from a theoretical level rather than an engineering level. So I think the root cause is not share one high-level structure for multiply physical layouts, the root cause is we put two different things together in AST. But it a huge change. This will be a huge contraction and bring about possible refactoring. We need to adjust in many places. It can be a long-term plan, but currently we need to solve this problem engineeringly, and cloning a new structure is the most convenient effective method. The biggest uncertainty brought by this solution is that the change of debugging information leads to more inaccurate decompiled results. We are frequently developing and integrating on glslang. When new problems are exposed, we will follow up and fix them in a timely manner. Because this change caused a big change in the generated spirv, I had some negligence when I checked, and I am sorry for this. But the big changes also prove that our test cases cover a very wide range, and I'm glad to have such a comprehensive test and a careful reviewer like you. So don't worry too much, git gives us a truth: brave to modify, roll back if bad. |
Hi John, We have other development and refinement plans, so I hope this pr can be merged as soon as possible, if nothing else.b @johnkslang Thanks |
Hi @johnkslang , Best wishes for you. beside that, could this change been merge to master now? Thanks |
Hi John, Thanks |
The currently open "Conversation" issue should be addressed somehow. I view this as an example issue that it already has that needs a fix. Repeating here, but hopefully we can discuss in the issue:
|
This issue have been fixed in those commit, and the solution is create a map to record the structure copy, at first time, we create a structure copy as a temp. And fix it's layoutPacking or layoutMatrix on the temp structure, after that, we will check this 2 qualifier whether been changed, if it been changed, we will use the copied structure replace the original structure. Based on this design, in order to ensure that our records can be properly recorded and recursive, layoutMatrix will also be recorded in the TType of the structure, which is why some case's AST dump has changed, in which more layout declarations came out. But I think it's expected and it's correct, It can also make sure TQualifier::isMatrix can return a correct result. Thanks |
What is the progress of the review, do you have any other suggestions? I hope this Pr can be merged into the master as soon as possible. It's a huge change, and our work been blocked on it. |
Hi John, Best Regards, |
Yes, I am actually reviewing now. Hope to finish today. |
Sorry this is taking so long, part of that is my fault. For other parts, it will be faster to handle PRs when:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still a few genuine concerns here.
@@ -3,7 +3,8 @@ reflection.linked.frag | |||
Uniform reflection: | |||
ubo_block.shared_uniform: offset 4, type 1406, size 1, index 0, binding -1, stages 17 | |||
ubo_block.vsonly_uniform: offset 8, type 1406, size 1, index 0, binding -1, stages 17 | |||
ubo_block.fsonly_uniform: offset 12, type 1406, size 1, index 0, binding -1, stages 16 | |||
ubo_block.unused_uniform: offset 0, type 1406, size 1, index 0, binding -1, stages 17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of the test was to ensure that unused_uniform
was not reflected, and that fsonly_uniform
was only reflected for the fragment stage.
Is there a reason to be breaking this?
I'm pretty sure some users depend on reflection not reporting unused items. There are separate options to turn on to get more information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of the test was to ensure that
unused_uniform
was not reflected, and thatfsonly_uniform
was only reflected for the fragment stage.Is there a reason to be breaking this?
I'm pretty sure some users depend on reflection not reporting unused items. There are separate options to turn on to get more information.
According to the spec OpenGL spec4.60.7:
7.6 Uniform Variables:
All members of a named uniform block declared with a shared or std140 layout qualifier are considered active, even if they are not referenced in any shader in the program. The uniform block itself is also considered active, even if no member of the block is referenced.
layout(binding = 0, std140) uniform ubo_block {
float unused_uniform;
float shared_uniform;
float vsonly_uniform;
float fsonly_uniform;
} ubo;
If app user don't want compiler reporting unused uniform block, they should use std430 layout.
If gpu driver user don't want compiler reporting unused uniform block, they can implement a reflection out of glslang, and travers again. In fact, when we encounter similar problems, we do just that. Glslang should correctly based on the spec, and venders needs to find a way to meet its own needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reflection isn't a normative specification thing, it as a tooling thing added on by users that needed that specific tooling.
Khronos does not have a specification for this tooling feature.
Maybe you need something similar, but need to add what it is you need, not re-specify and break something that people are already using.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reflection isn't a normative specification thing, it as a tooling thing added on by users that needed that specific tooling.
Khronos does not have a specification for this tooling feature.
Maybe you need something similar, but need to add what it is you need, not re-specify and break something that people are already using.
You can't use "Reflection isn't a normative specification thing" to deny that reflection needs to abide by glsl norms. The compiler is just a tooling thing too, but since this compiler is a glsl compiler, it should be subject to the glsl norms, the same Since reflection is glsl's reflection, it should also be subject to glsl's specifications, otherwise it is not glsl's reflection, or you should rename it to someotherReflection. So, I think glsl should honor to the spec, not to mention that I have not seen negative comments or questions from users under this Pr. Bringing people more standard tools is not a break.
The changes we have made are based on the test results from CTS. There are sufficient and legitimate reasons for glslang to respect and restore the provisions of the spec from all angles.
} | ||
} | ||
|
||
// Spread LayoutPacking to block member, if a block member is a struct, we need spread LayoutPacking to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there already an existing problem with GLSL/AST level starting to push information into nested structures, but incorrectly? It seems there are two paths here:
A. fix it from doing that, at the high level, there should be only one
B. do it more, completely, requiring structure copying, which is a pretty major change
So, I guess three questions here:
- is it true this issue was present? (I can believe it from the memory qualifier test)
- is it the case you are choosing path B instead of fixing the code to match the design with path A?
- What are all the implications of changing GLSL/AST from single copy to multiple copy of the same struct?
It is possible you are fixing real problems here, but I worry it is by changing design and interface, and wonder about path A as well.
The code of this change itself is not very large, but it affects a lot of cases, I did not do enough checks, so a lot of errors occurred at the beginning (Self-confidence is a good thing , but I should not check it when it affects so many cases :)). I can't blame you. Actually I am very worried about your life and hope you pay attention to safety and stay healthy during COV-19, no one would like to lose a great engineer / scientist. If you need any help from china, you may contect me. |
First, despite my strict review, I want to thank you for doing much hard work here and figuring all this out. I am sure you have found important improvements, and thank you for that. I think there are two things going on here:
The first one is great, while the second one is worrisome. A few paths forward: A) separate this into multiple PRs that are clearly fixes versus behavior changes independent of the fixes, |
About A: About B: About C: |
It is partly my fault, but also the code review cycle is long partly because of the size of the original changes, and because each review finds non-backward-compatible changes. Smaller PRs without backward incompatible changes can progress much faster. I'm not understanding why we can't incrementally make the fixes without breaking existing users. I did not know CTS was measuring this. CTS tests drivers, not glslang reflection, yes? Glslang reflection was a side-band tool, for a particular GLSL purpose, not a legally normative implementation of any specification. Can you help us understand better? |
@@ -1,5 +1,9 @@ | |||
hlsl.reflection.vert | |||
Uniform reflection: | |||
anonDeadMember2: offset 64, type 8b52, size 1, index 0, binding -1, stages 1 | |||
ufDead4: offset 28, type 1406, size 1, index 1, binding -1, stages 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those case are under the influence of EShMsgKeepUncalled option, this option did not work in old implementation, but now it can work normally. Therefore, some changes have taken place when traversing the grammar tree, which will result in the change of some variables and index used in EShMsgKeepUncalled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnkslang ,I rebased all commit for you easily review code.
I add a option for disable this reflection, please review again, if no problem, after test passed, you can merge it now. |
d742aca
to
d33cd51
Compare
…ock matrix layout 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.
d33cd51
to
41ea69b
Compare
* wait time increased for the install * Fix build on CMake 2.8, and fix Web build And suppress some warnings that are too verbose in Web builds. * update README * test names updated * rayQueryEXT assignment is allowed. * rayQueryEXT function parameter * rayQuery test cases added * compute and fragment shader test_cases added for rayQuery * const rayFlag defs used in the test cases in stead of numerical values * .travis updated to origin, rayQueryCheck removed * spirv.hpp reverted to commit f368dcb * copyright notice changes removed from unchanged files * copyright notice changes removed from unchanged files * copyright notice changes removed from unchanged files * switch format update * Add missing braces to if condition The indentation implies this was the intention. Noticed the issue while trying to compile our code with -Werror -Wall * pass-by-reference updates * pass by reference updates * accelerationStructureEXT - issue KhronosGroup#2152 * accelerationStructureEXT - issue KhronosGroup#2152 * Update spirv-tools known_good to latest stable * opposite inner condition * bitwise on boolean * unused var * printf format * Fix KhronosGroup#2163: improve comments for addProcess() and the preamble. * Remove unused variables. This CL removes two unused variables from the initialization code. * Error assigns to objects of rayQueryEXT type. * Bump revision. * Build warning: Fix KhronosGroup#2167: Remove nested reuse of 'unreachable'. * Shader interface matching rework to fix KhronosGroup#2136 (KhronosGroup#2156) * rework how shader interface block naming rules are handled * Fixes 2136 According to the spec, shader interfaces (uniform blocks, buffer blocks, input blocks, output blocks) all should be matched up via their block names across all compilation units, not instance names. Also, all block names can be re-used between all 4 interface types without conflict. This change makes it so all of these blocks are matched and remapped using block name and not by instance name. Additional the rule that matched uniform and buffer blocks must either be anonymous or named (but not nessearily the same name) is now imposed. * add warning if instance names differ between matched shader interfaces * Add test cases from KhronosGroup#2137 which is now fixed as well. * replace some tab characters with spaces * buffer blocks and uniform blocks now share the same block namespace * Remove extra semicolons (KhronosGroup#2170) This is causing downstream users compiler errors if they have Werror or other particularly restrictive flags turned on. * Error message: Finish addressing KhronosGroup#2097, better texture error message. * Add support for EXT_ray_flags_primitive_culling. (KhronosGroup#2173) Fixes issue KhronosGroup#2169. * Get rid of all warnings with MSVC and clang-cl (KhronosGroup#2177) * Fix KhronosGroup#2178: Allow specialization constants for texel offsets. * Support multiple swizzled out operands (KhronosGroup#2175) Swizzled out operands were added in bbbd9a2. This was sufficient for most tests, but we ran into problems with umulExtended and imulExtended, which have two. This CL converts the tracking values to vectors so multiple operands can be supported. Test: KHR-GLES31.core.shader_bitfield_operation.* Test: ctest * Add support for extension GL_ARB_shader_bit_encoding (KhronosGroup#2183) * Add support for extension GL_ARB_shader_image_size (KhronosGroup#2185) * xcode warnings fix (KhronosGroup#2188) * TPpToken: Fix compiling on clang-10 (KhronosGroup#2189) * Add support for extension GL_ARB_shader_storage_buffer_object (KhronosGroup#2184) Enable below features for GL Core version 420: * layout qualifier "std430" * storage qualifier "buffer" * atomic memory functions * Move to latest SPIR-V header, and bump glslang revision. * Note about Build Status. * Move to SPIR-V 1.5 Rev. 3, bump revision, remove a status from README. * Add support for extension GL_ARB_shading_language_packing (KhronosGroup#2192) * Remove unused Es310Desktop430 (KhronosGroup#2200) This variable is no longer used, remove. * Add support for extension GL_ARB_texture_query_lod. (KhronosGroup#2194) * Add support for extension GL_ARB_vertex_attrib_64bit (KhronosGroup#2193) * Fix KhronosGroup#2201: Improve const and copy constructor for TVarLivePair. * Add support for extension GL_EXT_shader_implicit_conversions Updated extension management in TIntermediate class. * Add support for extension GL_EXT_shader_integer_mix (KhronosGroup#2203) * Add support for es extension GL_EXT_blend_func_extended * Introduces builtin variables gl_SecondaryFragColorEXT and gl_SecondaryFragDataEXT * Introduces builtin constant gl_MaxDualSourceDrawBuffersEXT * enables support for layout qualifier "index" in es profile * GLSL: Separate out swizzle handling (potentially fixing bugs). Noticed this when looking at swizzles. It's at least better structure, removing hard-to-see early returns, which might be contributing to bugs. * Fix KhronosGroup#2191: Error check for indexing reference containing unsize array. * Explicitly mark some enums as unsigned This allows casting from and to any unsigned value, previously this was undefined behavior. This fixes ubsan complaining in `TParseContext::layoutQualifierCheck`, where `~EShLangComputeMask` is used. * Fix Web build * Address KhronosGroup#2211: Improve the copy constructor of TVarLivePair. * Move to newer version of SPIRV-Tools * Update tests according to spirv-opt update We refactored function inlining pass of spirv-opt and it results in different numbering of result ids in SPIR-V code. This commit updates test cases to avoid a test failure according to the spirv-opt update. * Update known good * Bump version. * Reserve unused std140 uniform block in reflection, and fix uniform block matrix layout (KhronosGroup#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. * Bump version. * Flatten all interface variables (KhronosGroup#2217) Specifically, add flattening of arrayed io for geometry and tesselation shaders. Previously some interface structs just had builtins split out which caused some interfaces to not be exactly the same as that of flattened adjacent stages, affecting validation and correctness. This obviates builtin splitting. That will be removed in a followup commit. It was left in for this commit to better exhibit the functional changes that were made. Fixes KhronosGroup#1660. * Add check for DOUBLE in low versions (KhronosGroup#2223) Add check for DOUBLE in low versions, fix issue KhronosGroup#2206 * Code refine. (KhronosGroup#2227) * Build: Fix KhronosGroup#2228, by correcting the type used. * Fix KhronosGroup#2227, which was coded incorrectly, to be simpler/safer. * Add an option to make Exceptions enabled (KhronosGroup#2239) * Add an option to make Exceptions enabled * /EHsc enable exceptions since vs2003 * fix incorrect error when multiple compilation units don't declare layouts (KhronosGroup#2238) when using multiple compilation units, input/output layouts don't need to be declared in every unit. * Do not build glslang-testsuite when ENABLE_CTEST is disabled (KhronosGroup#2240) * Replace incorrect uint32_t with correct int vars (KhronosGroup#2235) * Add support for primitive culling layout qualifier. (KhronosGroup#2220) * Add support for primitive culling layout qualifier. * Add error checks for primitive flags and negative test. * Reorder member init to match decl order (KhronosGroup#2241) Fixes field reorder warning. * Update spirv tools (KhronosGroup#2246) * Update known good SPIRV-Tools * Update test expectations * Update SPIRV-Tools to stable. Also SPIRV-Headers to TOT. (KhronosGroup#2250) * Fix missing patch decoration for TessFactor PCF arg (KhronosGroup#2249) Fixes KhronosGroup#1553 * fix warning unused parameter in release build (KhronosGroup#2251) * EXT_ray_tracing requires spv1.4 (KhronosGroup#2237) * EXT_ray_tracing requires spv1.4 * Fix typo. * Add extension data table. * Updated feedback #2. * Remove install to the SPIRV/ folder. (KhronosGroup#2256) This CL updates the build scripts to only install to glslang/SPIRV instead of also installing to the SPIRV/ folder. The deprecation notice is also removed. Note, this may cause downstream build issues if include directories have not been updated Fixes KhronosGroup#1964 KhronosGroup#2216 * Update news for header location change and recommendation. * Add default descriptorset decoration for acceleration structure (KhronosGroup#2257) variables. * HLSL: fix handling of uniform qualifier in entry point parameters (KhronosGroup#2254) * HLSL: Fix handling of uniforms in entry point parameters * HLSL: fix handling of "uniform in" * Tests: Update baseResults of hlsl.function.frag.out for KhronosGroup#2254 * HLSL: fix uniforms in function parameters for opaque types * HLSL: Recognize POSITION semantic et al in DX9 compatibility mode (KhronosGroup#2255) * HLSL: Add better diagnostic when using in/out qualifiers in global scope (KhronosGroup#2258) * Add SPIR-V capabilities needed for spec constants (KhronosGroup#2199) Fixes KhronosGroup#2198. * spirv: Support initializers on uniforms (KhronosGroup#1588) If a uniform has an initializer it will now be given as the optional initializer operand to the OpVariable instruction. Fixes: KhronosGroup#1259 Signed-off-by: Neil Roberts <nroberts@igalia.com> (the code) Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com> (the tests) Signed-off-by: Arcady Goldmints-Orlov <agoldmints@igalia.com> Co-authored-by: Neil Roberts <nroberts@igalia.com> * Add Shared/Std140 SSBO process & top-level array elements related (KhronosGroup#2231) * Add Shared/Std140 SSBO process & top-level array elements related process 1.Add process options for shared/std140 ssbo, following ubo process 2.Add IO Variables reflection option, would keep all input/output variables in reflection 3.Add Top-level related process, fix top-level array size issues, following spec 4.Split ssbo/ubo reflection options, merge blowup expanding all into function blowupActiveAggregate to allow other functions keep same entry format. Add options in StandAlone and test symbols. 1. Add options in StandAlone for std140/shared ubo/ssbo and all io variables reflection. 2. Add test for ssbo. When EShReflectionSharedStd140SSBO turns on, generated symbol and output would be different, to remind the difference. Defaultly disabled and nothing would change, nor blocking normal test. * Add options in runtest script, refresh test results. Add options in StandAlone: --reflect-all-io-variables --reflect-shared-std140-ubo --reflect-shared-std140-ssbo refresh test results. Now the index, size of unsized array are expected. * Fix xfb stride limit issue (KhronosGroup#2088) * Fix xfb_stride limit issue Unsized array can't apply to transform trace. layout qualifier "offset" require GL_ARB_enhanced_layouts enable or glsl core version > 440. * Add negative test for xfb limit * update case result * Fix compile information issue Fix compile information issue and test comment issue. * remove es profile condition, use profileRequires to limit. * Fix xfb_stride limit issue Unsized array can't apply to transform trace. layout qualifier "offset" require GL_ARB_enhanced_layouts enable or glsl core version > 440. Add negative test for xfb limit * Move es profile check out of version number check * Adjust error information and related cases remove the new version check, refine original version check. * Revert condition for vulkan, and remove redundant test code. * Use correct type for var storing returned value (KhronosGroup#2263) * Fix KhronosGroup#2264: OpEntryPoint incorrectly including function parameters. * Bump code gen version, due to removal of OpEntryPoint operands. * Fix signed / unsigned mismatch warning (KhronosGroup#2266) * C Interface: Split SPIR-V C interface to own file This breaks a cyclic dependency between the SPIRV and glslang build targets. * HLSL: Fix incorrect case in name of DX9-style cube sampler type (KhronosGroup#2265) * HLSL: Remove support for having GLSL versions of HLSL intrinsics. Related to PR KhronosGroup#2265. * Remove unused function, BaseTypeName (KhronosGroup#2272) * Remove unused variable. (KhronosGroup#2273) The `isMat` variable is no longer used in the HLSL parser. Removed. * CMake: Fold HLSL source into glslang ... and stub the HLSL target. Fixes the building of shared libraries. This breaks the cyclic dependency between the `glslang` and `hlsl` targets (by essentially removing the `hlsl` target). The `BUILD.gn` and `BUILD.bazel` build rules already pull the `HLSL` source into the `glslang` target. `Android.mk` is the only remaining build config that has a dedicated `HLSL` target, but this is explicity static and does not suffer the same link-time issues with the cyclic dependency (we may wish to stub this target too). Related issue: KhronosGroup#1484, KhronosGroup#2147 Related PR: KhronosGroup#2267 * Bump version. * Move hlsl/ source to glslang/HLSL/ Now that the HLSL source files are part of the `glslang` target (KhronosGroup#2271), it makes sense for these to sit in the `glslang` directory. Changed the case of the directory from `hlsl` to `HLSL` to better match the sibling directories. * Bump version numbers. * Build: use better MSVC subfolder names for the previous build changes. * Add -g0 command line argument Analogous to gcc, -g0 would strip all debug info. This is done regardless of whether optimizations are enabled. Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com> * Switch ndk_test from gnustl_static to c++_static gnustl_static is no longer supported. * Add kokoro configs for android-ndk and cmake * Update README.md * Use OpFUnordNotEqual for floating-point != The normal IEEE not equal operation tests whether operands are unordered or not equal (so comparison with a NaN returns true). This corresponds to the SPIR-V OpFUnordNotEqual, so change to using that. * Update test results to expect OpFUnordNotEqual * Update SPIR-V generator version Change to 10 to reflect the change to generating unordered != operations. * Update test expected files with new magic number Updating the SPIR-V generator version number changes the output of all the SPIR-V tests. * Fixed msvc 2019 nmake compiler warnings with RTTI. By default cmake generates cxx_flags with `/GR` parameter. I updated CMAKE_CXX_FLAGS string and replaced `/GR` -> `/GR-` How to reproduce: Visual Studio 2019 x64 command port mkdir build-msvc2019 cd build-msvc2019 cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=install .. nmake COMPILATION BEFORE: Scanning dependencies of target OSDependent [ 1%] Building CXX object glslang/OSDependent/Windows/CMakeFiles/OSDependent.dir/ossource.cpp.obj cl : Command line warning D9025 : overriding '/GR' with '/GR-' ossource.cpp [ 3%] Linking CXX static library OSDependent.lib [ 3%] Built target OSDependent Scanning dependencies of target OGLCompiler [ 4%] Building CXX object OGLCompilersDLL/CMakeFiles/OGLCompiler.dir/InitializeDll.cpp.obj cl : Command line warning D9025 : overriding '/GR' with '/GR-' InitializeDll.cpp [ 6%] Linking CXX static library OGLCompiler.lib [ 6%] Built target OGLCompiler Scanning dependencies of target glslang [ 7%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/glslang_tab.cpp.obj cl : Command line warning D9025 : overriding '/GR' with '/GR-' glslang_tab.cpp [ 9%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/attribute.cpp.obj cl : Command line warning D9025 : overriding '/GR' with '/GR-' FLAGS BEFORE: -- CMAKE_C_FLAGS: /DWIN32 /D_WINDOWS /W3 -- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR /EHsc -- CMAKE_CXX_FLAGS_DEBUG: /MDd /Zi /Ob0 /Od /RTC1 -- CMAKE_CXX_FLAGS_RELEASE: /MD /O2 /Ob2 /DNDEBUG COMPILATION AFTER: [ 1%] Building CXX object glslang/OSDependent/Windows/CMakeFiles/OSDependent.dir/ossource.cpp.obj ossource.cpp [ 3%] Linking CXX static library OSDependent.lib [ 3%] Built target OSDependent [ 4%] Building CXX object OGLCompilersDLL/CMakeFiles/OGLCompiler.dir/InitializeDll.cpp.obj InitializeDll.cpp [ 6%] Linking CXX static library OGLCompiler.lib [ 6%] Built target OGLCompiler [ 7%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/glslang_tab.cpp.obj glslang_tab.cpp [ 9%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/attribute.cpp.obj FLAGS AFTER: -- CMAKE_C_FLAGS: /DWIN32 /D_WINDOWS /W3 -- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR- /EHsc -- CMAKE_CXX_FLAGS_DEBUG: /MDd /Zi /Ob0 /Od /RTC1 -- CMAKE_CXX_FLAGS_RELEASE: /MD /O2 /Ob2 /DNDEBUG * Kokoro: Split linux cmake cfgs into static/shared Allows for testing of generation of both static libraries and shared objects. The old configs are staying in place until I'm confident everything is working correctly. Issues: KhronosGroup#1421, KhronosGroup#1484, KhronosGroup#2283 * HLSL: Fix #pragma pack_matrix(row_major) not work on global uniforms * Add pack_matrix test * SPV: Partially address KhronosGroup#2293: correct "const in" precision matching. Track whether formal parameters declare reduced precision and match that with arguments, and if they differ, make a copy to promote the precision. * SPV: Fix KhronosGroup#2293: keep relaxed precision on arg passed to relaxed param When arguments are copied to make space for a writable formal parameter, and the formal parameter is relaxed precision, make the copy also relaxed precision. * Remove root kokoro/linux-*-cmake configs These have been superseded by the `static` and `shared` variants in the respective subdirectories. Issue: KhronosGroup#2283 * CMake: Error on unresolved symbols Issue: KhronosGroup#1484 * CMake: Compile with -fPIC when building SOs Without this embedding static libraries into shared libraries may result in link time errors. Issue: KhronosGroup#2283 * Fixed GCC -Wunused-parameter in hlslParseables.cpp. Warnings before fix: [3/7] Building CXX object glslang/CMakeFiles/glslang.dir/HLSL/hlslParseables.cpp.o ../glslang/HLSL/hlslParseables.cpp: In function ‘bool {anonymous}::IsValid(const char*, char, char, char, char, int, int)’: ../glslang/HLSL/hlslParseables.cpp:334:45: warning: unused parameter ‘retOrder’ [-Wunused-parameter] 334 | inline bool IsValid(const char* cname, char retOrder, char retType, char argOrder, char argType, int dim0, int dim1) | ~~~~~^~~~~~~~ ../glslang/HLSL/hlslParseables.cpp:334:60: warning: unused parameter ‘retType’ [-Wunused-parameter] 334 | inline bool IsValid(const char* cname, char retOrder, char retType, char argOrder, char argType, int dim0, int dim1) | ~~~~~^~~~~~~ ../glslang/HLSL/hlslParseables.cpp:334:89: warning: unused parameter ‘argType’ [-Wunused-parameter] 334 | inline bool IsValid(const char* cname, char retOrder, char retType, char argOrder, char argType, int dim0, int dim1) | ~~~~~^~~~~~~ ../glslang/HLSL/hlslParseables.cpp:334:112: warning: unused parameter ‘dim1’ [-Wunused-parameter] 334 | inline bool IsValid(const char* cname, char retOrder, char retType, char argOrder, char argType, int dim0, int dim1) | ~~~~^~~~ * SPV: RelaxedPrecision: Generalize fix KhronosGroup#2293 to cover more operations. This simplifies and enforces use of precision in many more places, to help avoid accidental loss of RelaxedPrecision through intermediate operations. Known fixes are: - ?: - function return values with mis-matched precision - precision of function return values when a copy was needed to fix types * SPV: RelaxedPrecision: use the result precision for texture sampling. Fix KhronosGroup#2298. The AST has two precisions, an operation precision and a result precision. Actual use of GLSL with mediump samplers wants the result precision, so pick that up instead of the operation precision. * CMake: break up glslang into smaller static libs Add `GenericCodeGen` and `MachineIndependent` static library targets. Privately import both of these into the `glslang` target. Privately import `MachineIndependent` into the `SPIRV` target. This is done to break the dependency of `libglslang.so` non-public APIs from `libspirv.so`, which will become problematic once `glslang` hides its non-public symbols. | File | Before | After | |---------------------------|-----------:|-----------:| | `libGenericCodeGen.a` | - | `527716` | | `libglslang.a` | `68175944` | `512938` | | `libHLSL.a` | `1428` | `1428` | | `libMachineIndependent.a` | - | `67132202` | | `libOGLCompiler.a` | `75908` | `75908` | | `libOSDependent.a` | `23768` | `23768` | | `libSPIRV.a` | `15710210` | `15710210` | | `libSPVRemapper.a` | `3250894` | `3250894` | | File | Before | After | |-----------------------------------------|-----------:|-----------:| | `libglslang-default-resource-limits.so` | `117032` | `117032` | | `libglslang.so` | `22380688` | `22368216` | | `libHLSL.so` | `7520` | `7520` | | `libOGLCompiler.a` | `75908` | `75908` | | `libOSDependent.a` | `23768` | `23768` | | `libSPIRV.so` | `7288336` | `28151016` | | `libSPVRemapper.so` | `1940208` | `1940208` | Issues: KhronosGroup#2283, KhronosGroup#1484 * glslang: Only export public interface for SOs Default to `-fvisibility=hidden`, and annotate the public glslang interface with `GLSLANG_EXPORT` to change the visibility of these cherry-picked symbols to default. This is also used by Windows builds for `__declspec(dllexport)`-ing the public DLL interface. This allows us to classify API changes into those that are publicly backwards compatible, and those that are not. Note that `libSPIRV` will likely need similar treatment. Issues: KhronosGroup#2283, KhronosGroup#1484 * HLSL: Catch error cases earlier, preventing a later assert. Related to KhronosGroup/SPIRV-Cross#1414. The real problem is either using DX10 semantics for DX9 or missing functionality in DX10 parsing. * Add additional licenses in use to LICENSE.txt Ideally we'd unify the licenses in use by changing the licenses in the file headers to BSD-3-clause. Until then, let's correctly list all the licenses currently in use. Issue: KhronosGroup#2305 * Tests: More broadly use automapping binding/location. This adds or changes binding/location decorations in 100s of shaders. It also allows more output (spv.register.autoassign.rangetest.frag) due to allowing ioMap() to fail. * SPIRV-Tools and tests: Update to location-validation in SPIRV-Tools. This introduces five new "Validation failures": - baseResults/hlsl.semantic.vert: issue with gl_ClipDistance/CullDistance - baseResults/spv.430.vert: issue gl_ClipDistance - baseResults/spv.450.tesc: still unknown - baseResults/spv.dataOut.frag: gl_FragData should not be supported, problem with front end - baseResults/spv.meshShaderPerViewUserDefined.mesh: seems okay, maybe a problem with SPIRV-Tools * Bump revision. * Add missing copyright headers Add copyright headers to build files and scripts. Simplifies automated scanning for bad license headers. * Fix GLSLANG_IS_SHARED_LIBRARY define It was incorrectly always being set, causing linker warnings for MSVC builds. Also simplify the preprocessor nesting in `glslang\Public\ShaderLang.h` * Add config for license-checker and Kokoro scripts. The `license-checker` is a tool that verifies each file has contains a permitted license header. See https://github.com/ben-clayton/license-checker for more information. * Kokoro: Correct the `build_file' path to build.sh * License headers: s/Google/The Khronos Group This was a copy-paste screwup, where the first line of the copyright had the company name was updated, but the company name mid way though was not. * Don't use add_link_options() on old CMake versions Fixes: KhronosGroup#2315 * gn: Optionally disable optimizations and HLSL To reduce the binary size of ANGLE, a gn override is added (glslang_angle) which: - Controls whether ENABLE_OPT=1 is set - Customizes the build for the Vulkan backend of ANGLE. As a first step, this removes HLSL functionality which together with no optimization shave ~2.5MB off of ANGLE's binary size. Upcoming changes will add a macro for GLSLANG_ANGLE similar to GLSLANG_WEB that will strip features from glslang to support only what ANGLE needs. Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com> * Add GLSLANG_BUILD_PIC CMake flag Enables `-fPIC` compiler flag even when building statically. This is helpful for statically linking a `glslang` target into a shared library. Simplifies the workarounds seen in google/shaderc#1093 to a `set(GLSLANG_BUILD_PIC 1)`. * gn: Fix `gn gen --check` by adding missing dependency Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com> * gn: Fix dawn tests in Chromium Dawn tests use shaderc, which assumes glslang has HLSL support. This change makes HLSL support also follow template arguments, and changes the target names such that glslang_sources will remain the "has all features" target and the new glslang_lib_sources would be what ANGLE would use. Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com> * Add --quiet option. Being quiet should have been the default, but I guess it's too late now to change it. * Add new rules to .gitignore `.vscode/` ignores Visual Studio Code user config files `bazel-*` ignores bazel build system symlinks. `out/` ignores the default output directory for Visual Studio generated files. * Add new static targets to VS solution folders `GenericCodeGen` and `MachineIndependent` were missing from the generated visual studio solutions. Add these. * Remove GLSLANG_BUILD_PIC flag On closer inspection, it appears that nearly all the targets use the `POSITION_INDEPENDENT_CODE` target option anyway. Simplify all this away by always being PIC. * Use CMake's builtin functionality for PCHs `glslang_pch()` did manual mangling of the compiler flags to enable pre-compiled headers. I couldn't get this approach to work with the `MachineIndependent` subdirectory, but fortunately CMake has added first-class support for precompiled headers in 3.16, which does work with subdirectories. Moved `glslang_pch()` to the other global function declarations. `glslang_pch()` is a no-op when using CMake earlier than `3.16`. CMake's PCH implementation does not need the `pch.cpp` files, so just remove them. * Make sure glslang_angle has a definition in BUILD.gn Set the value to false if the environment doesn't declare this variable. * Use GLSLANG_ANGLE to strip features to what ANGLE requires This change strips a few features similar to GLSLANG_WEB but doesn't remove every detail like the latter. It also hardcodes profile/version to core/450. In particular, TBuiltIns::initialize is specialized to remove most of what is not supported or won't be supported by ANGLE. The result of this function is parsed with TParseContext::parseShaderStrings which is a performance bottleneck. This change shaves about 300KB off of ANGLE's binary size and reduces the cost of SetupBuiltinSymbolTable to nearly a sixth. Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com> * Customize glslang.y to GLSLANG_ANGLE glslang.y is specialized to remove what is not supported or won't be supported by ANGLE. This change shaves about 125KB off of ANGLE's binary size with minor improvement to the cost of SetupBuiltinSymbolTable. Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com> * Generate build information from CHANGES.md This PR significantly reworks the way glslang is versioned. Instead of committing changes to the `GLSLANG_MINOR_VERSION` define in `glslang/Public/ShaderLang.h`, and using `make-revision` to generate `GLSLANG_PATCH_LEVEL` in `glslang/Include/revision.h`, all version information is now derived from the new `CHANGES.md` file. `CHANGES.md` acts as the single source of truth for glslang version information, along with a convenient place to put all release notes for each notable change made. `CHANGES.md` is parsed using the new `build_info.py` python script. This script can read basic template files to produce new source files, which it does to read the new `build_info.h.tmpl` to generate (at build time) a glslang private header at `<build-dir>/include/glslang/build_info.h`. I've written generators for each of the CMake, Bazel, gn, and `Android.mk` build scripts. The new version code conforms to the Semantic Versioning 2.0 spec. This new version is also used by the CMake rules to produce versioned shared objects, including a major-versioned SONAME. New APIs: --------- * `glslang::GetVersion()` returns a `Version` struct with the version major, minor, patch and flavor. Breaking API changes: --------------------- * The public defines `GLSLANG_MINOR_VERSION` and `GLSLANG_PATCH_LEVEL` have been entirely removed. * `glslang/Public/ShaderLang.h` and `glslang/Include/revision.h` have been deleted. * Instead, `<build-dir>/include/glslang/build_info.h` is created in the build directory, and `<build-dir>/include` is a CMake `PUBLIC` (dependee-inherited) include directory for the glslang targets. * `<build-dir>/include/glslang/build_info.h` contains the following new #defines: `GLSLANG_VERSION_MAJOR`, `GLSLANG_VERSION_MINOR`, `GLSLANG_VERSION_PATCH`, `GLSLANG_VERSION_FLAVOR`, `GLSLANG_VERSION_GREATER_THAN(major, minor, patch)`, `GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch)`, `GLSLANG_VERSION_LESS_THAN(major, minor, patch)`, `GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch)` * The CMake install output directory contains a copy of `build_info.h` at: `include/glslang/build_info.h` * Python3 is now always required to build glslang (likely always required for transitive dependency builds). * Attempt to fix chromium builds It would seem that `glslang_sources` has a private dependency on `glslang_build_info`, so `glslang_validator` cannot transitively `#include` the generated `glslang/build_info.h` header. Add `glslang_build_info` as a direct dependency to `glslang_validator`. Also remove the duplicate dependency on `glslang_build_info` in `glslang_sources_common` Note: This is a speculative fix as I can build Chromium fine without these changes. Not sure what's different between these configs. * Fix CMake rules when nesting CMake projects `${CMAKE_SOURCE_DIR}` points to the outer project root, not the current directory. Fixes building of `glslang` when included into another CMake project. * Common: include standard headers before doing any defines currently, due to ```c++ \#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API #include <basetsd.h> #ifndef snprintf #define snprintf sprintf_s #endif #define safe_vsprintf(buf,max,format,args) vsnprintf_s((buf), (max), (max), (format), (args)) ``` defining `snprintf` to `sprintf_s` essentially unconditionally, this will break the stdio.h+cstdio system header for mingw-w64 g++ in msys2 with shaderc google/shaderc#1065 an alternative change would be https://raw.githubusercontent.com/shinchiro/mpv-winbuild-cmake/master/packages/glslang-0001-fix-gcc-10.1-error.patch in which the `|| defined MINGW_HAS_SECURE_API` part is removed Signed-off-by: Christopher Degawa <ccom@randomderp.com> * Add missing comma from license-checker.cfg Fixes license checker presubmit. * Fix KhronosGroup#2329: don't use invalid initializers. * Fix a couple lines that were too long, to retrigger bots. * Revert "Merge pull request KhronosGroup#2330 from ShabbyX/optimize_for_angle" This reverts commit 1ee5d1c, reversing changes made to 906d48a. * Fix comma in licence checker. * Kokoro: Print test output to stdout * CMake: Move project() to top of CMakeLists.txt Also remove `NOTICE` from message() about PCHs - it seems to print this in the actual message, contrary to the documentation where it is used as a severity. * Add bison license to LICENSE.txt * Non-determinism: Remove test file that seems to trigger non-determinism. This problem needs to be fixed, but in parallel, we need to see master and any other changes to it passing all tests. The removed test is ray-tracing centric, and may indicate non-determinism in recent code added for that functionality. * Fix recently found non-determinism with gl_WorldToObject3x4EXT. * Give build_info.py the executable bit * runtests: Check error codes, set LD_LIBRARY_PATH `glslangValidator` will only return [the codes 0..6](https://github.com/KhronosGroup/glslang/blob/b481744aea1ecf52ee4591afaa0f5e270b9d1636/StandAlone/StandAlone.cpp#L117-L125). Fail the test if anything else is returned (like due to the exe crashing). Also set `LD_LIBRARY_PATH` to contain the `lib` directory before calling glslang. * GLSL/SPV: Propagaet precision qualifier from function to return value. When a return value's type has no precision qualification (e.g., the return expression is formed from a constructor), and the formal function return type has a precision qualification, back propagate that from the return type to the type of the return value's expression. * Add new rules for update of license-checker `license-checker` will be updated to support `**` based wildcards. As part of this, `license-checker` will now traverse into subdirectories that would previously be excluded when the parent directory is excluded. This change adds new rules that work with both the old version and new, to ease migration. * Update license-checker.cfg with simplified rules `license-checker` has been updated to support `**` wildcards simplifying the ruless, and multiple license configs. Add a new config for the bison generated files to ensure their licenses don't change. * build_info: Fix parsing of versions with no flavor * Finalize glslang 10.15.3847 * Start glslang 11.0.0 * Drop support for VS2013 This was scheduled for today - 20th July 2020. Updates Appveyor configs to use VS2015 instead. * also search global variables assignment for live variables when traversing the AST to find live UBOs etc, also traverse references to global module-level variables, incase they are being filled in from UBOs etc. * Simplify PoolAlloc with use of thread_local. glslang is using C++ 11, which has first class support for variables of the `thread_local` storage class. By dropping the use of the `OS_[GS]etTLSValue`, we can simplify the logic, and have it support a thread-local default allocator if none is provided. Issue: KhronosGroup#2346 * Deprecate InitializeDll functions These were only used for TThreadPool, which now uses `thread_local`. * SPV: Update to the latest SPIR-V headers. * Limit visibility of symbols for internal libraries Also remove `SPIRV/doc.cpp` from the `SPVRemapper` target as this is part of `SPIRV`, causing ODR violations. Instead have `SPVRemapper` link against `SPIRV`. Fixes ODR violations. * Add changes for SPV_EXT_shader_atomic_float_add * Update spirv-tools known-good to most recent stable Co-authored-by: Neslisah Torosdagli <neslisah.torosdagli@amd.com> Co-authored-by: Kai Ninomiya <kainino@chromium.org> Co-authored-by: John Kessenich <johnkslang@users.noreply.github.com> Co-authored-by: Geoffrey Martin-Noble <gcmn@google.com> Co-authored-by: Neslisah Torosdagli <neslimsah@yahoo.com> Co-authored-by: Greg Fischer <greg@lunarg.com> Co-authored-by: ntfs.hard <ntfs.hard@gmail.com> Co-authored-by: John Kessenich <cepheus@frii.com> Co-authored-by: dan sinclair <dsinclair@google.com> Co-authored-by: alelenv <alele@nvidia.com> Co-authored-by: Malcolm Bechard <mbechard@users.noreply.github.com> Co-authored-by: Ryan Harrison <rharrison@google.com> Co-authored-by: alelenv <40001162+alelenv@users.noreply.github.com> Co-authored-by: Malacath-92 <h.baensch.92@gmail.com> Co-authored-by: Cody Northrop <cnorthrop@google.com> Co-authored-by: pmistryNV <63069047+pmistryNV@users.noreply.github.com> Co-authored-by: MennoVink <mennovink20@hotmail.com> Co-authored-by: Phillip Stephens <antidote.crk@gmail.com> Co-authored-by: dan sinclair <dj2@everburning.com> Co-authored-by: Pankaj Mistry <pmistry@nvidia.com> Co-authored-by: Sebastian Neubauer <sebastian.neubauer@amd.com> Co-authored-by: Felix Maier <xilefmai@gmail.com> Co-authored-by: Jaebaek Seo <duke.acacia@gmail.com> Co-authored-by: Roy.li <lryer@msn.com> Co-authored-by: Chow <laddoc@outlook.com> Co-authored-by: nihui <shuizhuyuanluo@126.com> Co-authored-by: David Neto <dneto@google.com> Co-authored-by: alan-baker <alanbaker@google.com> Co-authored-by: rdb <rdb@users.noreply.github.com> Co-authored-by: Ricardo Garcia <47594367+rg3igalia@users.noreply.github.com> Co-authored-by: Alejandro Piñeiro <apinheiro@igalia.com> Co-authored-by: Neil Roberts <nroberts@igalia.com> Co-authored-by: Ben Clayton <bclayton@google.com> Co-authored-by: Shahbaz Youssefi <ShabbyX@gmail.com> Co-authored-by: Graeme Leese <gleese@broadcom.com> Co-authored-by: Evgeny Proydakov <e.proydakov@gmail.com> Co-authored-by: lriki <lriki.net@gmail.com> Co-authored-by: Marcin Ślusarz <marcin.slusarz@intel.com> Co-authored-by: Christopher Degawa <ccom@randomderp.com> Co-authored-by: Malcolm Bechard <malcolm@derivative.ca> Co-authored-by: johnkslang <john@johnkgo.com> Co-authored-by: Vikram Kushwaha <vkushwaha@nvidia.com>
1. Reserve unused std140 uniform block in reflection, and fix the uniform block struct member not affected by block matrix layout and memory layout.
We should reserve std140 block and shared block in reflection.
We need ensure all matrix block member been effect, include the member of a struct in this block.
2. 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.
2. Recursively layout packing to "block member".
Layout packing isn't set recursively, it causes TReflection::getOffsets doesn't work correctly.
3. Recursively layout matrix to "block member".
Layout matrix isn't set recursively, it causes a matrix layout incorrectly issue.
So, in reflecte time, we just only travers all function sequence. It make EShMsgKeepUncalled only work at linker, and can effect reflection.