Skip to content
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

Add support for EXT_ray_flags_primitive_culling. #2173

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

alelenv
Copy link
Contributor

@alelenv alelenv commented Apr 6, 2020

Fixes issue #2169.

@@ -1448,6 +1448,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
builder.addExecutionMode(shaderEntry, spv::ExecutionModeXfb);
}

if (sourceExtensions.find("GL_EXT_ray_flags_primitive_culling") != sourceExtensions.end()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are semantics actually changed by declaring the extension, or is there some feature that must get used to truly need the capability?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, we are triggering capability need by use of the ability.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See for example TGlslangToSpvTraverser::TranslateBuiltInDecoration

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RayFlag values 256 and 512 become valid when this capability is enabled, but there are more ways that you could get the values 256 and 512 than by just using the gl_RayFlagsSkipAABBEXT and gl_RayFlagsSkipTrianglesEXT constants.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, on the one hand it sounds like we should be testing for emitting 256 and 512 as the reason to require the capability, but on the other hand I'm not clear if that's your position.

Speculating: If this can't be detected 100% by a feature use on translation, we also have Builder::postProcessFeatures() to detect what was needed after translation completed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately, there is no guaranteed way to know at compile time if this capability is needed.
The "Ray Flags" argument to OpTraceRayKHR is any Id. No requirement for it to be a constant. It could be loaded from memory, or passed in from another stage (as is done with the IncomingRayFlagsKHR builtin). This ultimately needs run-time validation, so we believe we need a separate extension to enable the shader author to specifically opt-in to using the capability.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. It's a feature that the compiler cannot tell is being used, so the extension does nothing except signal a run-time value might appear. Have we done this much?

The way to semantically guard such a feature would be, for example, to have the #extension declare a keyword/type/declaration/etc. that syntactically declares what is in use. These could turn into modes in SPIR-V rather than capabilities. There are choices in all those steps, but the point is that it is quite possible and common to still have a syntactic or semantically statically visible sign of what feature is in use.

Saying it more shortly, the #extension line by itself should not be what changes value semantics, it should be what enables a language feature that says what happens to semantics.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On re-reading the GLSL extension, the dynamic part really does not come through. It is focused on providing the two built-ins, not on adding a new mode that becomes present whether or not the new built-ins are consumed.

I think this deserves better documentation, if not actual language semantics.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can improve the documentation in the GLSL extension. I don't know that we have precedent for anything like this, and I'm not sure how any modes or other declarations would really be an improvement, but can you add further suggestions in https://gitlab.khronos.org/vulkan/vulkan/issues/2073 and we can consider changing that for final?
Right now we are blocked on actually being able to test these features until something is done here.

@johnkslang johnkslang merged commit 75de196 into KhronosGroup:master Apr 9, 2020
tangent-vector pushed a commit to shader-slang/glslang that referenced this pull request Jul 29, 2020
* 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 <[email protected]> (the code)
Signed-off-by: Alejandro Piñeiro <[email protected]> (the tests)
Signed-off-by: Arcady Goldmints-Orlov <[email protected]>

Co-authored-by: Neil Roberts <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Kai Ninomiya <[email protected]>
Co-authored-by: John Kessenich <[email protected]>
Co-authored-by: Geoffrey Martin-Noble <[email protected]>
Co-authored-by: Neslisah Torosdagli <[email protected]>
Co-authored-by: Greg Fischer <[email protected]>
Co-authored-by: ntfs.hard <[email protected]>
Co-authored-by: John Kessenich <[email protected]>
Co-authored-by: dan sinclair <[email protected]>
Co-authored-by: alelenv <[email protected]>
Co-authored-by: Malcolm Bechard <[email protected]>
Co-authored-by: Ryan Harrison <[email protected]>
Co-authored-by: alelenv <[email protected]>
Co-authored-by: Malacath-92 <[email protected]>
Co-authored-by: Cody Northrop <[email protected]>
Co-authored-by: pmistryNV <[email protected]>
Co-authored-by: MennoVink <[email protected]>
Co-authored-by: Phillip Stephens <[email protected]>
Co-authored-by: dan sinclair <[email protected]>
Co-authored-by: Pankaj Mistry <[email protected]>
Co-authored-by: Sebastian Neubauer <[email protected]>
Co-authored-by: Felix Maier <[email protected]>
Co-authored-by: Jaebaek Seo <[email protected]>
Co-authored-by: Roy.li <[email protected]>
Co-authored-by: Chow <[email protected]>
Co-authored-by: nihui <[email protected]>
Co-authored-by: David Neto <[email protected]>
Co-authored-by: alan-baker <[email protected]>
Co-authored-by: rdb <[email protected]>
Co-authored-by: Ricardo Garcia <[email protected]>
Co-authored-by: Alejandro Piñeiro <[email protected]>
Co-authored-by: Neil Roberts <[email protected]>
Co-authored-by: Ben Clayton <[email protected]>
Co-authored-by: Shahbaz Youssefi <[email protected]>
Co-authored-by: Graeme Leese <[email protected]>
Co-authored-by: Evgeny Proydakov <[email protected]>
Co-authored-by: lriki <[email protected]>
Co-authored-by: Marcin Ślusarz <[email protected]>
Co-authored-by: Christopher Degawa <[email protected]>
Co-authored-by: Malcolm Bechard <[email protected]>
Co-authored-by: johnkslang <[email protected]>
Co-authored-by: Vikram Kushwaha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants