platform/upstream/glslang.git
3 years agoMerge pull request #2311 from ben-clayton/license-checker
John Kessenich [Fri, 3 Jul 2020 11:24:45 +0000 (05:24 -0600)]
Merge pull request #2311 from ben-clayton/license-checker

Kokoro: Correct the `build_file' path to build.sh

3 years agoMerge pull request #2312 from ben-clayton/fix-copyright
John Kessenich [Fri, 3 Jul 2020 11:23:15 +0000 (05:23 -0600)]
Merge pull request #2312 from ben-clayton/fix-copyright

License headers: s/Google/The Khronos Group

3 years agoLicense headers: s/Google/The Khronos Group
Ben Clayton [Fri, 3 Jul 2020 11:21:01 +0000 (12:21 +0100)]
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.

3 years agoKokoro: Correct the `build_file' path to build.sh
Ben Clayton [Fri, 3 Jul 2020 10:07:32 +0000 (11:07 +0100)]
Kokoro: Correct the `build_file' path to build.sh

3 years agoMerge pull request #2310 from ben-clayton/license-checker
John Kessenich [Fri, 3 Jul 2020 05:33:30 +0000 (23:33 -0600)]
Merge pull request #2310 from ben-clayton/license-checker

Add license checking continuous and presubmit tests

3 years agoMerge pull request #2309 from ben-clayton/fix-msvc-linker-warnings
John Kessenich [Fri, 3 Jul 2020 05:32:01 +0000 (23:32 -0600)]
Merge pull request #2309 from ben-clayton/fix-msvc-linker-warnings

Fix GLSLANG_IS_SHARED_LIBRARY define

3 years agoAdd config for license-checker and Kokoro scripts.
Ben Clayton [Thu, 2 Jul 2020 15:05:41 +0000 (16:05 +0100)]
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.

3 years agoFix GLSLANG_IS_SHARED_LIBRARY define
Ben Clayton [Thu, 2 Jul 2020 14:54:40 +0000 (15:54 +0100)]
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`

3 years agoAdd missing copyright headers
Ben Clayton [Wed, 1 Jul 2020 14:43:36 +0000 (15:43 +0100)]
Add missing copyright headers

Add copyright headers to build files and scripts.
Simplifies automated scanning for bad license headers.

3 years agoMerge pull request #2268 from lriki/hlsl-pack_matrix
John Kessenich [Thu, 2 Jul 2020 11:21:45 +0000 (05:21 -0600)]
Merge pull request #2268 from lriki/hlsl-pack_matrix

HLSL: Fix #pragma pack_matrix(row_major) not work on global uniforms

3 years agoMerge pull request #2303 from ben-clayton/limit-public-2
John Kessenich [Thu, 2 Jul 2020 11:02:59 +0000 (05:02 -0600)]
Merge pull request #2303 from ben-clayton/limit-public-2

glslang: Only export public interface for SOs

3 years agoBump revision.
John Kessenich [Thu, 2 Jul 2020 11:02:17 +0000 (05:02 -0600)]
Bump revision.

4 years agoMerge pull request #2307 from KhronosGroup/location-validation
John Kessenich [Wed, 1 Jul 2020 15:52:18 +0000 (09:52 -0600)]
Merge pull request #2307 from KhronosGroup/location-validation

Location validation, with update to SPIR-V tools validating location

4 years agoSPIRV-Tools and tests: Update to location-validation in SPIRV-Tools.
John Kessenich [Wed, 1 Jul 2020 13:18:57 +0000 (07:18 -0600)]
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

4 years agoTests: More broadly use automapping binding/location.
John Kessenich [Wed, 1 Jul 2020 12:30:16 +0000 (06:30 -0600)]
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.

4 years agoMerge pull request #2306 from ben-clayton/licenses
John Kessenich [Wed, 1 Jul 2020 11:38:22 +0000 (05:38 -0600)]
Merge pull request #2306 from ben-clayton/licenses

Add additional licenses in use to LICENSE.txt

4 years agoAdd additional licenses in use to LICENSE.txt
Ben Clayton [Wed, 1 Jul 2020 09:48:27 +0000 (10:48 +0100)]
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: #2305

4 years agoHLSL: Catch error cases earlier, preventing a later assert.
John Kessenich [Wed, 1 Jul 2020 06:50:26 +0000 (00:50 -0600)]
HLSL: Catch error cases earlier, preventing a later assert.

Related to https://github.com/KhronosGroup/SPIRV-Cross/issues/1414.
The real problem is either using DX10 semantics for DX9 or missing
functionality in DX10 parsing.

4 years agoMerge pull request #2302 from KhronosGroup/fix-texture-precision
John Kessenich [Tue, 30 Jun 2020 18:41:15 +0000 (12:41 -0600)]
Merge pull request #2302 from KhronosGroup/fix-texture-precision

SPV: RelaxedPrecision: use the result precision for texture sampling.

4 years agoMerge pull request #2300 from KhronosGroup/generalize-precision
John Kessenich [Tue, 30 Jun 2020 16:57:16 +0000 (10:57 -0600)]
Merge pull request #2300 from KhronosGroup/generalize-precision

SPV: RelaxedPrecision: Generalize fix #2293 to cover more operations.

4 years agoglslang: Only export public interface for SOs
Ben Clayton [Mon, 29 Jun 2020 13:20:19 +0000 (14:20 +0100)]
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: #2283, #1484

4 years agoMerge pull request #2301 from ben-clayton/split-libs
John Kessenich [Tue, 30 Jun 2020 16:05:37 +0000 (10:05 -0600)]
Merge pull request #2301 from ben-clayton/split-libs

CMake: break up glslang into smaller static libs

4 years agoCMake: break up glslang into smaller static libs
Ben Clayton [Mon, 29 Jun 2020 13:18:02 +0000 (14:18 +0100)]
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: #2283, #1484

4 years agoMerge pull request #2297 from ben-clayton/fpic
John Kessenich [Tue, 30 Jun 2020 13:55:53 +0000 (07:55 -0600)]
Merge pull request #2297 from ben-clayton/fpic

CMake: Compile with -fPIC when building SOs

4 years agoSPV: RelaxedPrecision: use the result precision for texture sampling.
John Kessenich [Tue, 30 Jun 2020 13:52:05 +0000 (07:52 -0600)]
SPV: RelaxedPrecision: use the result precision for texture sampling.

Fix #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.

4 years agoMerge pull request #2296 from ben-clayton/err-unresolved
John Kessenich [Tue, 30 Jun 2020 11:27:14 +0000 (05:27 -0600)]
Merge pull request #2296 from ben-clayton/err-unresolved

CMake: Error on unresolved symbols

4 years agoSPV: RelaxedPrecision: Generalize fix #2293 to cover more operations.
John Kessenich [Tue, 30 Jun 2020 07:27:08 +0000 (01:27 -0600)]
SPV: RelaxedPrecision: Generalize fix #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

4 years agoMerge pull request #2295 from ben-clayton/rm-old-kokoro-cfgs
John Kessenich [Tue, 30 Jun 2020 04:07:40 +0000 (22:07 -0600)]
Merge pull request #2295 from ben-clayton/rm-old-kokoro-cfgs

Remove root kokoro/linux-*-cmake configs

4 years agoMerge pull request #2292 from proydakov/gcc-unused-parameter
John Kessenich [Tue, 30 Jun 2020 03:54:06 +0000 (21:54 -0600)]
Merge pull request #2292 from proydakov/gcc-unused-parameter

Fixed GCC -Wunused-parameter in hlslParseables.cpp.

4 years agoFixed GCC -Wunused-parameter in hlslParseables.cpp.
Evgeny Proydakov [Wed, 24 Jun 2020 20:56:12 +0000 (23:56 +0300)]
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)
      |                                                                                                            ~~~~^~~~

4 years agoCMake: Compile with -fPIC when building SOs
Ben Clayton [Mon, 29 Jun 2020 13:06:35 +0000 (14:06 +0100)]
CMake: Compile with -fPIC when building SOs

Without this embedding static libraries into shared libraries may result in link time errors.

Issue: #2283

4 years agoCMake: Error on unresolved symbols
Ben Clayton [Mon, 29 Jun 2020 12:46:26 +0000 (13:46 +0100)]
CMake: Error on unresolved symbols

Issue: #1484

4 years agoRemove root kokoro/linux-*-cmake configs
Ben Clayton [Mon, 29 Jun 2020 13:52:54 +0000 (14:52 +0100)]
Remove root kokoro/linux-*-cmake configs

These have been superseded by the `static` and `shared` variants in the respective subdirectories.

Issue: #2283

4 years agoMerge pull request #2286 from ben-clayton/kokoro-static-shared
John Kessenich [Mon, 29 Jun 2020 04:44:29 +0000 (22:44 -0600)]
Merge pull request #2286 from ben-clayton/kokoro-static-shared

Kokoro: Split linux cmake cfgs into static/shared

4 years agoMerge pull request #2294 from KhronosGroup/fix-arg-precision
John Kessenich [Sun, 28 Jun 2020 11:10:54 +0000 (05:10 -0600)]
Merge pull request #2294 from KhronosGroup/fix-arg-precision

Fix #2293: Get correct RelaxedPrecision settings for various ways of passing arguments to formal parameters.

4 years agoSPV: Fix #2293: keep relaxed precision on arg passed to relaxed param
John Kessenich [Fri, 26 Jun 2020 15:05:31 +0000 (09:05 -0600)]
SPV: Fix #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.

4 years agoSPV: Partially address #2293: correct "const in" precision matching.
John Kessenich [Fri, 26 Jun 2020 14:37:06 +0000 (08:37 -0600)]
SPV: Partially address #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.

4 years agoAdd pack_matrix test
lriki [Thu, 25 Jun 2020 03:27:28 +0000 (12:27 +0900)]
Add pack_matrix test

4 years agoHLSL: Fix #pragma pack_matrix(row_major) not work on global uniforms
lriki [Fri, 12 Jun 2020 12:26:48 +0000 (21:26 +0900)]
HLSL: Fix #pragma pack_matrix(row_major) not work on global uniforms

4 years agoKokoro: Split linux cmake cfgs into static/shared
Ben Clayton [Wed, 24 Jun 2020 13:16:17 +0000 (14:16 +0100)]
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: #1421, #1484, #2283

4 years agoMerge pull request #2285 from proydakov/msvc-rtti-compilation-warning-fix
John Kessenich [Wed, 24 Jun 2020 08:53:45 +0000 (02:53 -0600)]
Merge pull request #2285 from proydakov/msvc-rtti-compilation-warning-fix

Fixed msvc 2019 nmake compiler warnings with RTTI.

4 years agoFixed msvc 2019 nmake compiler warnings with RTTI.
Evgeny Proydakov [Tue, 23 Jun 2020 18:57:43 +0000 (21:57 +0300)]
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

4 years agoMerge pull request #2260 from gnl21/not-equal
John Kessenich [Mon, 22 Jun 2020 11:35:20 +0000 (05:35 -0600)]
Merge pull request #2260 from gnl21/not-equal

Use OpFUnordNotEqual for floating-point !=

4 years agoUpdate test expected files with new magic number
Graeme Leese [Mon, 22 Jun 2020 10:49:38 +0000 (11:49 +0100)]
Update test expected files with new magic number

Updating the SPIR-V generator version number changes the output of all
the SPIR-V tests.

4 years agoUpdate SPIR-V generator version
Graeme Leese [Mon, 22 Jun 2020 10:03:46 +0000 (11:03 +0100)]
Update SPIR-V generator version

Change to 10 to reflect the change to generating unordered !=
operations.

4 years agoUpdate test results to expect OpFUnordNotEqual
Graeme Leese [Fri, 5 Jun 2020 13:30:05 +0000 (14:30 +0100)]
Update test results to expect OpFUnordNotEqual

4 years agoUse OpFUnordNotEqual for floating-point !=
Graeme Leese [Fri, 5 Jun 2020 12:32:51 +0000 (13:32 +0100)]
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.

4 years agoUpdate README.md
John Kessenich [Mon, 22 Jun 2020 07:44:53 +0000 (01:44 -0600)]
Update README.md

4 years agoMerge pull request #2278 from ShabbyX/master
John Kessenich [Mon, 22 Jun 2020 07:08:52 +0000 (01:08 -0600)]
Merge pull request #2278 from ShabbyX/master

Add -g0 command line argument

4 years agoMerge pull request #2281 from ben-clayton/moar-kokoro
John Kessenich [Fri, 19 Jun 2020 15:43:49 +0000 (09:43 -0600)]
Merge pull request #2281 from ben-clayton/moar-kokoro

Add more Kokoro configurations

4 years agoAdd kokoro configs for android-ndk and cmake
Ben Clayton [Fri, 19 Jun 2020 11:14:02 +0000 (12:14 +0100)]
Add kokoro configs for android-ndk and cmake

4 years agoSwitch ndk_test from gnustl_static to c++_static
Ben Clayton [Fri, 19 Jun 2020 11:35:37 +0000 (12:35 +0100)]
Switch ndk_test from gnustl_static to c++_static

gnustl_static is no longer supported.

4 years agoAdd -g0 command line argument
Shahbaz Youssefi [Wed, 17 Jun 2020 16:47:44 +0000 (12:47 -0400)]
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>
4 years agoBuild: use better MSVC subfolder names for the previous build changes.
John Kessenich [Tue, 16 Jun 2020 13:47:48 +0000 (07:47 -0600)]
Build: use better MSVC subfolder names for the previous build changes.

4 years agoMerge pull request #2275 from ben-clayton/mv-hlsl
John Kessenich [Tue, 16 Jun 2020 12:26:17 +0000 (06:26 -0600)]
Merge pull request #2275 from ben-clayton/mv-hlsl

Move hlsl/ source to glslang/HLSL/

4 years agoBump version numbers.
John Kessenich [Tue, 16 Jun 2020 12:22:23 +0000 (06:22 -0600)]
Bump version numbers.

4 years agoMove hlsl/ source to glslang/HLSL/
Ben Clayton [Tue, 16 Jun 2020 10:54:34 +0000 (11:54 +0100)]
Move hlsl/ source to glslang/HLSL/

Now that the HLSL source files are part of the `glslang` target (#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.

4 years agoMerge pull request #2271 from ben-clayton/fold-hlsl
John Kessenich [Tue, 16 Jun 2020 10:20:32 +0000 (04:20 -0600)]
Merge pull request #2271 from ben-clayton/fold-hlsl

Untangle build target cyclic dependencies (approach #2)

4 years agoBump version.
John Kessenich [Tue, 16 Jun 2020 10:18:48 +0000 (04:18 -0600)]
Bump version.

4 years agoCMake: Fold HLSL source into glslang
Ben Clayton [Mon, 15 Jun 2020 12:54:55 +0000 (13:54 +0100)]
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: #1484, #2147
Related PR: #2267

4 years agoRemove unused variable. (#2273)
dan sinclair [Mon, 15 Jun 2020 18:10:44 +0000 (14:10 -0400)]
Remove unused variable. (#2273)

The `isMat` variable is no longer used in the HLSL parser. Removed.

4 years agoRemove unused function, BaseTypeName (#2272)
Ryan Harrison [Mon, 15 Jun 2020 16:58:02 +0000 (12:58 -0400)]
Remove unused function, BaseTypeName (#2272)

4 years agoHLSL: Remove support for having GLSL versions of HLSL intrinsics.
John Kessenich [Mon, 15 Jun 2020 15:09:22 +0000 (09:09 -0600)]
HLSL: Remove support for having GLSL versions of HLSL intrinsics.

Related to PR #2265.

4 years agoHLSL: Fix incorrect case in name of DX9-style cube sampler type (#2265)
rdb [Mon, 15 Jun 2020 12:39:43 +0000 (14:39 +0200)]
HLSL: Fix incorrect case in name of DX9-style cube sampler type (#2265)

4 years agoC Interface: Split SPIR-V C interface to own file
Ben Clayton [Wed, 10 Jun 2020 15:45:15 +0000 (16:45 +0100)]
C Interface: Split SPIR-V C interface to own file

This breaks a cyclic dependency between the SPIRV and glslang build targets.

4 years agoFix signed / unsigned mismatch warning (#2266)
Ben Clayton [Thu, 11 Jun 2020 03:41:47 +0000 (04:41 +0100)]
Fix signed / unsigned mismatch warning (#2266)

4 years agoBump code gen version, due to removal of OpEntryPoint operands.
John Kessenich [Wed, 10 Jun 2020 13:38:31 +0000 (07:38 -0600)]
Bump code gen version, due to removal of OpEntryPoint operands.

4 years agoFix #2264: OpEntryPoint incorrectly including function parameters.
John Kessenich [Wed, 10 Jun 2020 13:15:24 +0000 (07:15 -0600)]
Fix #2264: OpEntryPoint incorrectly including function parameters.

4 years agoUse correct type for var storing returned value (#2263)
Ryan Harrison [Tue, 9 Jun 2020 16:01:43 +0000 (12:01 -0400)]
Use correct type for var storing returned value (#2263)

4 years agoFix xfb stride limit issue (#2088)
Roy.li [Tue, 9 Jun 2020 08:30:14 +0000 (16:30 +0800)]
Fix xfb stride limit issue (#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.

4 years agoAdd Shared/Std140 SSBO process & top-level array elements related (#2231)
Chow [Thu, 4 Jun 2020 07:47:18 +0000 (15:47 +0800)]
Add Shared/Std140 SSBO process & top-level array elements related (#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.

4 years agospirv: Support initializers on uniforms (#1588)
Alejandro Piñeiro [Thu, 4 Jun 2020 07:39:31 +0000 (09:39 +0200)]
spirv: Support initializers on uniforms (#1588)

If a uniform has an initializer it will now be given as the optional
initializer operand to the OpVariable instruction.

Fixes: https://github.com/KhronosGroup/glslang/issues/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>
4 years agoAdd SPIR-V capabilities needed for spec constants (#2199)
Ricardo Garcia [Wed, 3 Jun 2020 13:52:55 +0000 (15:52 +0200)]
Add SPIR-V capabilities needed for spec constants (#2199)

Fixes #2198.

4 years agoHLSL: Add better diagnostic when using in/out qualifiers in global scope (#2258)
rdb [Tue, 2 Jun 2020 06:32:35 +0000 (08:32 +0200)]
HLSL: Add better diagnostic when using in/out qualifiers in global scope (#2258)

4 years agoHLSL: Recognize POSITION semantic et al in DX9 compatibility mode (#2255)
rdb [Tue, 2 Jun 2020 06:30:50 +0000 (08:30 +0200)]
HLSL: Recognize POSITION semantic et al in DX9 compatibility mode (#2255)

4 years agoHLSL: fix handling of uniform qualifier in entry point parameters (#2254)
rdb [Tue, 2 Jun 2020 06:30:07 +0000 (08:30 +0200)]
HLSL: fix handling of uniform qualifier in entry point parameters (#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 #2254

* HLSL: fix uniforms in function parameters for opaque types

4 years agoAdd default descriptorset decoration for acceleration structure (#2257)
alelenv [Tue, 2 Jun 2020 06:24:41 +0000 (23:24 -0700)]
Add default descriptorset decoration for acceleration structure (#2257)

variables.

4 years agoUpdate news for header location change and recommendation.
John Kessenich [Tue, 2 Jun 2020 05:24:37 +0000 (23:24 -0600)]
Update news for header location change and recommendation.

4 years agoRemove install to the SPIRV/ folder. (#2256)
dan sinclair [Tue, 2 Jun 2020 05:21:03 +0000 (01:21 -0400)]
Remove install to the SPIRV/ folder. (#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 #1964 #2216

4 years agoEXT_ray_tracing requires spv1.4 (#2237)
alelenv [Thu, 28 May 2020 15:18:07 +0000 (08:18 -0700)]
EXT_ray_tracing requires spv1.4 (#2237)

* EXT_ray_tracing requires spv1.4

* Fix typo.

* Add extension data table.

* Updated feedback #2.

4 years agofix warning unused parameter in release build (#2251)
nihui [Thu, 28 May 2020 12:12:01 +0000 (20:12 +0800)]
fix warning unused parameter in release build (#2251)

4 years agoFix missing patch decoration for TessFactor PCF arg (#2249)
greg-lunarg [Thu, 28 May 2020 04:12:42 +0000 (22:12 -0600)]
Fix missing patch decoration for TessFactor PCF arg (#2249)

Fixes #1553

4 years agoUpdate SPIRV-Tools to stable. Also SPIRV-Headers to TOT. (#2250)
greg-lunarg [Thu, 28 May 2020 04:10:36 +0000 (22:10 -0600)]
Update SPIRV-Tools to stable. Also SPIRV-Headers to TOT. (#2250)

4 years agoUpdate spirv tools (#2246)
alan-baker [Mon, 25 May 2020 16:18:42 +0000 (12:18 -0400)]
Update spirv tools (#2246)

* Update known good SPIRV-Tools

* Update test expectations

4 years agoReorder member init to match decl order (#2241)
David Neto [Thu, 21 May 2020 15:17:30 +0000 (08:17 -0700)]
Reorder member init to match decl order (#2241)

Fixes field reorder warning.

4 years agoAdd support for primitive culling layout qualifier. (#2220)
alelenv [Thu, 21 May 2020 11:38:41 +0000 (04:38 -0700)]
Add support for primitive culling layout qualifier. (#2220)

* Add support for primitive culling layout qualifier.

* Add error checks for primitive flags and negative test.

4 years agoReplace incorrect uint32_t with correct int vars (#2235)
Ryan Harrison [Thu, 21 May 2020 11:37:13 +0000 (07:37 -0400)]
Replace incorrect uint32_t with correct int vars (#2235)

4 years agoDo not build glslang-testsuite when ENABLE_CTEST is disabled (#2240)
nihui [Thu, 21 May 2020 11:33:17 +0000 (19:33 +0800)]
Do not build glslang-testsuite when ENABLE_CTEST is disabled (#2240)

4 years agofix incorrect error when multiple compilation units don't declare layouts (#2238)
Malcolm Bechard [Thu, 21 May 2020 06:10:33 +0000 (02:10 -0400)]
fix incorrect error when multiple compilation units don't declare layouts (#2238)

when using multiple compilation units, input/output layouts don't need
to be declared in every unit.

4 years agoAdd an option to make Exceptions enabled (#2239)
nihui [Thu, 21 May 2020 05:55:24 +0000 (13:55 +0800)]
Add an option to make Exceptions enabled (#2239)

* Add an option to make Exceptions enabled

* /EHsc enable exceptions since vs2003

4 years agoFix #2227, which was coded incorrectly, to be simpler/safer.
John Kessenich [Wed, 20 May 2020 07:56:11 +0000 (01:56 -0600)]
Fix #2227, which was coded incorrectly, to be simpler/safer.

4 years agoBuild: Fix #2228, by correcting the type used.
John Kessenich [Wed, 20 May 2020 04:23:07 +0000 (22:23 -0600)]
Build: Fix #2228, by correcting the type used.

4 years agoCode refine. (#2227)
Roy.li [Wed, 20 May 2020 04:11:12 +0000 (12:11 +0800)]
Code refine. (#2227)

4 years agoAdd check for DOUBLE in low versions (#2223)
Chow [Mon, 18 May 2020 09:41:52 +0000 (17:41 +0800)]
Add check for DOUBLE in low versions (#2223)

Add check for DOUBLE in low versions, fix issue #2206

4 years agoFlatten all interface variables (#2217)
greg-lunarg [Mon, 18 May 2020 08:13:10 +0000 (02:13 -0600)]
Flatten all interface variables (#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 #1660.

4 years agoBump version.
John Kessenich [Mon, 18 May 2020 08:12:35 +0000 (02:12 -0600)]
Bump version.

4 years agoReserve unused std140 uniform block in reflection, and fix uniform block matrix layou...
Roy.li [Fri, 15 May 2020 08:26:48 +0000 (16:26 +0800)]
Reserve unused std140 uniform block in reflection, and fix uniform block matrix layout (#2041)

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

we should reserve std140 block and shared block in reflection.

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

We need ensure all matrix block member been effect.

Support EShMsgKeepUncalled in reflection

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

Recursively layout packing to "block member"

layout packing isn't set recursively, it causes TReflection::getOffsets doesn't work correctly.

4 years agoBump version.
John Kessenich [Fri, 15 May 2020 08:02:50 +0000 (02:02 -0600)]
Bump version.

4 years agoMove to newer version of SPIRV-Tools
Jaebaek Seo [Thu, 14 May 2020 17:06:05 +0000 (13:06 -0400)]
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

4 years agoAddress #2211: Improve the copy constructor of TVarLivePair.
John Kessenich [Tue, 12 May 2020 08:48:00 +0000 (02:48 -0600)]
Address #2211: Improve the copy constructor of TVarLivePair.