platform/upstream/glslang.git
3 years agoMerge pull request #2546 from proydakov/msvc-noexcept-fix
greg-lunarg [Wed, 24 Feb 2021 19:02:07 +0000 (12:02 -0700)]
Merge pull request #2546 from proydakov/msvc-noexcept-fix

Fixed msvc 2019 nmake noexcept build.

3 years agoFixed msvc 2019 nmake noexcept build.
Evgeny Proydakov [Wed, 24 Jun 2020 17:01:18 +0000 (20:01 +0300)]
Fixed msvc 2019 nmake noexcept build.

By default cmake generates cxx_flags with /EHsc parameter.
I updated CMAKE_CXX_FLAGS string and removed /EHsc, also I added compile defenitions _HAS_EXCEPTIONS=0, it is mandatory for noexcept build with MSVC STL implementation.
Output files became smaller.

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

CXX 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
-- ENABLE_RTTI:       OFF
-- ENABLE_EXCEPTIONS: OFF

OUTPUT SIZE BEFORE:

Build folder size: 61,8 MB (64 808 580 bytes)

GLSLANG SIZE BEFORE:

glslang.lib 22,7 MB (23 887 150 bytes)

CXX FLAGS AFTER:

-- CMAKE_C_FLAGS:   /DWIN32 /D_WINDOWS /W3
-- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR-
-- CMAKE_CXX_FLAGS_DEBUG:   /MDd /Zi /Ob0 /Od /RTC1
-- CMAKE_CXX_FLAGS_RELEASE: /MD /O2 /Ob2 /DNDEBUG
-- ENABLE_RTTI:       OFF
-- ENABLE_EXCEPTIONS: OFF

OUTPUT SIZE AFTER:

Build folder size: 58,4 MB (61 331 179 bytes)

GLSLANG SIZE AFTER:

glslang.lib 21,6 MB (22 655 252 bytes)

3 years agoMerge pull request #2537 from proydakov/fixed-cmake-warning
greg-lunarg [Tue, 23 Feb 2021 17:23:12 +0000 (10:23 -0700)]
Merge pull request #2537 from proydakov/fixed-cmake-warning

Fixed cmake generation warning for regeneration project build files.

3 years agoCode review. Thx `greg-lunarg` for comments.
Evgeny Proydakov [Tue, 23 Feb 2021 14:14:12 +0000 (17:14 +0300)]
Code review. Thx `greg-lunarg` for comments.

3 years agoMerge pull request #2525 from ZhiqianXia/master
greg-lunarg [Tue, 23 Feb 2021 00:36:30 +0000 (17:36 -0700)]
Merge pull request #2525 from ZhiqianXia/master

Cannot specify atomic counter with location.

3 years agoMerge pull request #2540 from dgkoch/dgkoch_build_fix
greg-lunarg [Tue, 23 Feb 2021 00:07:33 +0000 (17:07 -0700)]
Merge pull request #2540 from dgkoch/dgkoch_build_fix

Fix warning in build

3 years agoMerge pull request #2543 from greg-lunarg/chg11.2.0
greg-lunarg [Mon, 22 Feb 2021 20:54:00 +0000 (13:54 -0700)]
Merge pull request #2543 from greg-lunarg/chg11.2.0

Update CHANGES.md to 11.2.0 to sync with current tagging.

3 years agoUpdate CHANGES.md to 11.2.0 to sync with current tagging.
Greg Fischer [Mon, 22 Feb 2021 19:11:47 +0000 (12:11 -0700)]
Update CHANGES.md to 11.2.0 to sync with current tagging.

3 years agoFix warning in build
Daniel Koch [Fri, 19 Feb 2021 21:48:50 +0000 (16:48 -0500)]
Fix warning in build

glslang/MachineIndependent/SymbolTable.h:892:41: error: comparison of integers of
different signs: 'int' and 'const uint32_t' (aka 'const unsigned int') [-Werror,-Wsign-compare]
            uint64_t level = currentLevel() > MaxLevelInUniqueID ? MaxLevelInUniqueID : currentLevel();
                             ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
1 error generated.

3 years agoFixed cmake generation warning for regeneration project build files.
Evgeny Proydakov [Thu, 18 Feb 2021 23:18:17 +0000 (02:18 +0300)]
Fixed cmake generation warning for regeneration project build files.

[BEFORE]:

% cmake ..
CMake Warning (dev) at CMakeLists.txt:35 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR
    CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

-- No build type selected, default to Debug
-- Found PythonInterp: /usr/local/bin/python3 (found version "3.9")
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.9", minimum required is "3")
-- optimizer enabled
-- Google Mock found - building tests
-- Configuring done

[AFTER]:

% cmake ..
-- No build type selected, default to Debug
-- Google Mock was not found - tests based on that will not build
-- Configuring done
-- Generating done

3 years agoMerge pull request #2536 from greg-lunarg/chg0
greg-lunarg [Thu, 18 Feb 2021 22:18:16 +0000 (15:18 -0700)]
Merge pull request #2536 from greg-lunarg/chg0

Update CHANGES for 11.1.0

3 years agoUpdate CHANGES for 11.1.0
Greg Fischer [Thu, 18 Feb 2021 19:04:17 +0000 (12:04 -0700)]
Update CHANGES for 11.1.0

3 years agoMerge pull request #2532 from juliusikkala/master
greg-lunarg [Mon, 15 Feb 2021 20:41:48 +0000 (13:41 -0700)]
Merge pull request #2532 from juliusikkala/master

Pass environment through PreprocessDeferred

3 years agoMerge pull request #2458 from ShchchowAMD/unique_id-fix
greg-lunarg [Mon, 15 Feb 2021 20:22:14 +0000 (13:22 -0700)]
Merge pull request #2458 from ShchchowAMD/unique_id-fix

Fix issue for new unique id system.

3 years agoFix issue for new unique id system. Add level bits to help verifying symbols and...
Chow [Thu, 12 Nov 2020 07:54:16 +0000 (15:54 +0800)]
Fix issue for new unique id system. Add level bits to help verifying symbols and split symbol tables.
For intermediates rebuilding, now need manually amending level bits for redeclaring built-ins.

3 years agoPass environment through PreprocessDeferred
Julius Ikkala [Sun, 14 Feb 2021 12:24:17 +0000 (14:24 +0200)]
Pass environment through PreprocessDeferred

3 years agoMerge pull request #2531 from greg-lunarg/kg116
greg-lunarg [Fri, 12 Feb 2021 00:30:24 +0000 (17:30 -0700)]
Merge pull request #2531 from greg-lunarg/kg116

Update spirv-tools and spirv-header known good.

3 years agoUpdate spirv-tools and spirv-header known good.
Greg Fischer [Thu, 11 Feb 2021 22:36:28 +0000 (15:36 -0700)]
Update spirv-tools and spirv-header known good.

This is being done to allow Vulkan validation layers to pick up
the new differentiated error code support in spirv-tools for
GPU-AV.

3 years agoMerge pull request #2526 from proydakov/regression-python3-is-required-even-without...
greg-lunarg [Tue, 9 Feb 2021 17:02:24 +0000 (10:02 -0700)]
Merge pull request #2526 from proydakov/regression-python3-is-required-even-without-using-SPIRV-Tools

Fixed issues 2496. Used option 4: parse_version.cmake to avoid python3 usage.

3 years agoCode review. Thx ben-clayton for comments.
Evgeny Proydakov [Sun, 7 Feb 2021 18:18:31 +0000 (21:18 +0300)]
Code review. Thx ben-clayton for comments.

3 years agoFixed issues 2496. Used option 4: parse_version.cmake to avoid python3 usage.
Evgeny Proydakov [Sun, 7 Feb 2021 12:37:03 +0000 (15:37 +0300)]
Fixed issues 2496. Used option 4: parse_version.cmake to avoid python3 usage.

https://github.com/KhronosGroup/glslang/issues/2496

3 years agoCannot specify atomic counter with location.
ZhiqianXia [Tue, 9 Feb 2021 01:42:48 +0000 (09:42 +0800)]
Cannot specify atomic counter with location.

Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
3 years agoCannot specify atomic counter with location.
ZhiqianXia [Tue, 9 Feb 2021 01:39:40 +0000 (09:39 +0800)]
Cannot specify atomic counter with location.

Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
3 years agoCannot specify atomic counter with location.
ZhiqianXia [Sun, 7 Feb 2021 09:20:14 +0000 (17:20 +0800)]
Cannot specify atomic counter with location.

Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
3 years agoMerge pull request #2523 from dneto0/remove-stray-semi
greg-lunarg [Wed, 3 Feb 2021 22:50:43 +0000 (15:50 -0700)]
Merge pull request #2523 from dneto0/remove-stray-semi

Remove useless semicolon

3 years agoRemove useless semicolon
David Neto [Wed, 3 Feb 2021 19:14:11 +0000 (14:14 -0500)]
Remove useless semicolon

The extra semicolon causes a build failure if warnings are turned up high, and
warnings-as-errors is on. (-Werror=extra-semi)

3 years agoMerge pull request #2517 from glebm/fix-ubsan-localintermediate
greg-lunarg [Mon, 1 Feb 2021 17:53:37 +0000 (10:53 -0700)]
Merge pull request #2517 from glebm/fix-ubsan-localintermediate

callGraph.push_front -> emplace_front to fix UBSAN

3 years agoMerge pull request #2512 from cmarcelo/GL_EXT_shared_memory_block
greg-lunarg [Mon, 1 Feb 2021 16:29:52 +0000 (09:29 -0700)]
Merge pull request #2512 from cmarcelo/GL_EXT_shared_memory_block

Add support for GL_EXT_shared_memory_block

3 years agocallGraph.push_front -> emplace_front to fix UBSAN
Gleb Mazovetskiy [Sat, 30 Jan 2021 15:58:29 +0000 (15:58 +0000)]
callGraph.push_front -> emplace_front to fix UBSAN

UBSAN rightly complains on `push_front` here:

    glslang/MachineIndependent/localintermediate.h:100:8: runtime error: load of value 160, which is not a valid value for type 'bool'
    #0 in glslang::TCall::TCall(glslang::TCall&&) glslang/MachineIndependent/localintermediate.h:100
    #1 in void __gnu_cxx::new_allocator<std::_List_node<glslang::TCall> >::construct<glslang::TCall, glslang::TCall>(glslang::TCall*, glslang::TCall&&) /usr/include/c++/10/ext/new_allocator.h:150
    #2 in void std::allocator_traits<std::allocator<std::_List_node<glslang::TCall> > >::construct<glslang::TCall, glslang::TCall>(std::allocator<std::_List_node<glslang::TCall> >&, glslang::TCall*, glslang::TCall&&) /usr/include/c++/10/bits/alloc_traits.h:512
    #3 in std::_List_node<glslang::TCall>* std::__cxx11::list<glslang::TCall, std::allocator<glslang::TCall> >::_M_create_node<glslang::TCall>(glslang::TCall&&) (...)
    #4 in void std::__cxx11::list<glslang::TCall, std::allocator<glslang::TCall> >::_M_insert<glslang::TCall>(std::_List_iterator<glslang::TCall>, glslang::TCall&&) /usr/include/c++/10/bits/stl_list.h:1911
    #5 in std::__cxx11::list<glslang::TCall, std::allocator<glslang::TCall> >::push_front(glslang::TCall&&) /usr/include/c++/10/bits/stl_list.h:1167
    #6 in glslang::TIntermediate::addToCallGraph(TInfoSink&, std::__cxx11::basic_string<char, std::char_traits<char>, glslang::pool_allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, glslang::pool_allocator<char> > const&) glslang/MachineIndependent/Intermediate.cpp:2860

What happens here:

1. TCall's bool fields are not initialized on construction.
2. `push_front` move the `TCall` passed into it.
3. The move constructor copies unitialized bool, which may have an
   out-of-range value.

What this fix does:

Calls `emplace_back` to ensure no copy/move constructor is called.

Fixes #2222
Refs #2112

3 years agoAdd support for GL_EXT_shared_memory_block
Caio Marcelo de Oliveira Filho [Tue, 2 Jun 2020 23:58:51 +0000 (16:58 -0700)]
Add support for GL_EXT_shared_memory_block

Uses SPV_KHR_workgroup_memory_explicit_layout.  Note that if
GL_EXT_scalar_block_layout is enabled, Workgroup blocks can also use
scalar layout.

3 years agoUpdate known_good.json to pick up SPV_KHR_workgroup_memory_explicit_layout
Caio Marcelo de Oliveira Filho [Tue, 12 May 2020 15:29:00 +0000 (08:29 -0700)]
Update known_good.json to pick up SPV_KHR_workgroup_memory_explicit_layout

Also update the test expectations regarding validation accordingly and
the in-tree spirv.hpp copy.

3 years agoConsider GL_EXT_scalar_block_layout when validating SPIR-V
Caio Marcelo de Oliveira Filho [Wed, 27 Jan 2021 08:30:59 +0000 (00:30 -0800)]
Consider GL_EXT_scalar_block_layout when validating SPIR-V

If GL_EXT_scalar_block_layout is requested by the shader, set the
option to allow scalar blocks in the SPIR-V validator.

Fix the existing tests using scalar layout to not expect "Validation
failed".

Fixes #2400.

3 years agoMerge pull request #2513 from jeffbolznv/missingcap
greg-lunarg [Thu, 28 Jan 2021 17:40:45 +0000 (10:40 -0700)]
Merge pull request #2513 from jeffbolznv/missingcap

Add missing capability when QueueFamily scope is used

3 years agoAdd missing capability when QueueFamily scope is used
Jeff Bolz [Wed, 27 Jan 2021 19:14:34 +0000 (13:14 -0600)]
Add missing capability when QueueFamily scope is used

Also, if this capability is added and the memory model is not
otherwise enabled by pragma, enable it as part of postprocessing.

3 years agoMerge pull request #2511 from alan-baker/GL_EXT_null_initializer
greg-lunarg [Tue, 26 Jan 2021 19:05:11 +0000 (12:05 -0700)]
Merge pull request #2511 from alan-baker/GL_EXT_null_initializer

Implement GL_EXT_null_initializer

3 years agoImplement GL_EXT_null_initializer
John Kessenich [Thu, 11 Jun 2020 14:30:03 +0000 (08:30 -0600)]
Implement GL_EXT_null_initializer

Adds null initializer syntax (empty braces)
Allows null initialization of shared variables

3 years agoMerge pull request #2508 from corporateshark/master
greg-lunarg [Thu, 21 Jan 2021 17:58:14 +0000 (10:58 -0700)]
Merge pull request #2508 from corporateshark/master

Fix missing enum values in the C-interface #2507

3 years agoFix missing enum values in the C-interface #2507
Sergey Kosarevsky [Wed, 20 Jan 2021 23:33:16 +0000 (02:33 +0300)]
Fix missing enum values in the C-interface #2507

3 years agoMerge pull request #2505 from ben-clayton/update-licnese-checker-cfg
greg-lunarg [Tue, 19 Jan 2021 18:05:02 +0000 (11:05 -0700)]
Merge pull request #2505 from ben-clayton/update-licnese-checker-cfg

license-checker.cfg: Update rules

3 years agoMerge pull request #2504 from cdotstout/fuchsia-cmake
greg-lunarg [Tue, 19 Jan 2021 17:59:05 +0000 (10:59 -0700)]
Merge pull request #2504 from cdotstout/fuchsia-cmake

Add CMake support for Fuchsia

3 years agolicense-checker.cfg: Update rules
Ben Clayton [Mon, 18 Jan 2021 12:27:00 +0000 (12:27 +0000)]
license-checker.cfg: Update rules

The license classification rules in github.com/google/licensecheck have been updated.

3 years agoAdd CMake support for Fuchsia
Craig Stout [Fri, 15 Jan 2021 18:30:23 +0000 (10:30 -0800)]
Add CMake support for Fuchsia

3 years agoMerge pull request #2498 from dezinjob/fix-option-replacement-vs
greg-lunarg [Thu, 7 Jan 2021 02:29:37 +0000 (19:29 -0700)]
Merge pull request #2498 from dezinjob/fix-option-replacement-vs

Fix option replacement when flags are empty

3 years agoMerge pull request #2500 from jeremy-lunarg/hayes-2497
greg-lunarg [Wed, 6 Jan 2021 17:48:00 +0000 (10:48 -0700)]
Merge pull request #2500 from jeremy-lunarg/hayes-2497

Prevent HLSL input under OpenGL semantics

3 years agoMerge pull request #2499 from greg-lunarg/i2494
greg-lunarg [Wed, 6 Jan 2021 01:38:50 +0000 (18:38 -0700)]
Merge pull request #2499 from greg-lunarg/i2494

Fix debugInfo test to target vulkan1.1 as intended

3 years agoPrevent HLSL input under OpenGL semantics
Jeremy Hayes [Tue, 5 Jan 2021 22:54:41 +0000 (15:54 -0700)]
Prevent HLSL input under OpenGL semantics

Fix #2497.

3 years agoFix debugInfo test to target vulkan1.1 as intended
Greg Fischer [Tue, 5 Jan 2021 18:21:20 +0000 (11:21 -0700)]
Fix debugInfo test to target vulkan1.1 as intended

Fixes #2494

3 years agoFix option replacement when flags are empty
Denis Zalevskiy [Tue, 5 Jan 2021 09:25:24 +0000 (11:25 +0200)]
Fix option replacement when flags are empty

For the scenario when cmake is executed from MSVC with empty CXX flags.

Signed-off-by: Denis Zalevskiy <denis.zalevskiy@basemark.com>
3 years agoMerge pull request #2393 from nihui/patch-3
greg-lunarg [Thu, 24 Dec 2020 19:53:39 +0000 (12:53 -0700)]
Merge pull request #2393 from nihui/patch-3

Fix build with android ndk r16b

3 years agoMerge remote-tracking branch 'upstream/master' into patch-3
nihuini [Thu, 24 Dec 2020 02:33:22 +0000 (10:33 +0800)]
Merge remote-tracking branch 'upstream/master' into patch-3

3 years agoUpdate ParseHelper.cpp
nihui [Wed, 23 Dec 2020 13:56:23 +0000 (21:56 +0800)]
Update ParseHelper.cpp

3 years agoMerge pull request #2490 from greg-lunarg/i2476
greg-lunarg [Fri, 18 Dec 2020 17:19:52 +0000 (10:19 -0700)]
Merge pull request #2490 from greg-lunarg/i2476

Fix tess factor cut and paste error

3 years agoFix cut and paste error
Greg Fischer [Thu, 17 Dec 2020 22:35:41 +0000 (15:35 -0700)]
Fix cut and paste error

Fixes #2476

3 years agoMerge pull request #2451 from rdb/dx9-round-semantics
greg-lunarg [Wed, 16 Dec 2020 20:55:00 +0000 (13:55 -0700)]
Merge pull request #2451 from rdb/dx9-round-semantics

Don't compile round() to roundEven in DX9 compatibility mode

3 years agoDon't use roundEven() to implement round() in DX9 compatibility mode
rdb [Thu, 5 Nov 2020 16:53:38 +0000 (17:53 +0100)]
Don't use roundEven() to implement round() in DX9 compatibility mode

3 years agoMerge pull request #2485 from proydakov/fixed-hlsl-off-compile-warning
John Kessenich [Tue, 15 Dec 2020 19:16:17 +0000 (12:16 -0700)]
Merge pull request #2485 from proydakov/fixed-hlsl-off-compile-warning

Fixed compile warning in reflection.cpp for ENABLE_HLSL = 0 build. [-Wunused-parameter]

3 years agoMerge pull request #2487 from dneto0/validate-imageread-result
John Kessenich [Tue, 15 Dec 2020 19:15:32 +0000 (12:15 -0700)]
Merge pull request #2487 from dneto0/validate-imageread-result

Update SPIRV-Tools known-good: validate OpImageRead result type

3 years agoTest updates for ImageRead result type validation
David Neto [Tue, 15 Dec 2020 17:19:00 +0000 (12:19 -0500)]
Test updates for ImageRead result type validation

See #2486

3 years agoUpdate known_good, pick up ImageRead result validation
David Neto [Tue, 15 Dec 2020 17:09:50 +0000 (12:09 -0500)]
Update known_good, pick up ImageRead result validation

Pick up https://github.com/KhronosGroup/SPIRV-Tools/pull/4072
which validates the result type of OpImageRead.

This also requires test expectation updates.

See #2486 tracks the needed upate to Glslang code generation.

3 years agoFixed compile warning in reflection.cpp for ENABLE_HLSL = 0 build. [-Wunused-parameter]
Evgeny Proydakov [Tue, 15 Dec 2020 15:05:32 +0000 (18:05 +0300)]
Fixed compile warning in reflection.cpp for ENABLE_HLSL = 0 build. [-Wunused-parameter]

3 years agoFix SPV return type of rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetE...
Daniel Koch [Sat, 12 Dec 2020 17:34:24 +0000 (12:34 -0500)]
Fix SPV return type of rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT (#2484)

Issue #2483

According to GLSL spec the prototype is:
        uint rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQueryEXT q, bool committed);

but that was incorrectly getting translated to SPIRV as an `int`, and this was
causing SPIR-V validation errors when used.

Added explicit testing for the return types of all the builtin functions in GL_EXT_ray_query

3 years agoMerge pull request #2482 from greg-lunarg/gtfix3
greg-lunarg [Fri, 11 Dec 2020 22:08:50 +0000 (15:08 -0700)]
Merge pull request #2482 from greg-lunarg/gtfix3

Update README to avoid googletest breakage

3 years agoUpdate README to avoid googletest breakage
Greg Fischer [Fri, 11 Dec 2020 18:27:09 +0000 (11:27 -0700)]
Update README to avoid googletest breakage

Additional fix for #2480

3 years agoFix Travis to use pre-breakage googletest (#2481)
greg-lunarg [Fri, 11 Dec 2020 17:46:44 +0000 (10:46 -0700)]
Fix Travis to use pre-breakage googletest (#2481)

3 years agoUpdate spirv-tools known-good #2 - Pick up ray tracing terminator fix (#2478)
greg-lunarg [Tue, 8 Dec 2020 01:20:27 +0000 (18:20 -0700)]
Update spirv-tools known-good #2 - Pick up ray tracing terminator fix (#2478)

3 years agoUpdate spirv-tools known-good (#2473)
greg-lunarg [Thu, 3 Dec 2020 20:07:33 +0000 (13:07 -0700)]
Update spirv-tools known-good (#2473)

3 years agoupdate spirv-headers and fix handling of gl_HitTEXT (#2471)
Daniel Koch [Mon, 30 Nov 2020 16:57:34 +0000 (11:57 -0500)]
update spirv-headers and fix handling of gl_HitTEXT (#2471)

* update spirv-headers and fix handling of gl_HitTEXT

Update spirv-headers known_good to f027d53ded7e230e008d37c8b47ede7cd308e19d
and update SPIRV/spirv.hpp to copy from that version as well.

In GLSL gl_HitTNV/gl_HitTEXT is defined as an alias of gl_RayTmaxNV/gl_RayTmaxEXT
SPV_NV_ray_tracing has a dedicated HitTNV which gl_HitTNV maps to.
For SPV_KHR_ray_tracing, gl_HitTEXT gets mapped to a RayTmaxKHR decoraged variable
to simplify the SPIRV consumer.
This change fixes the mapping for the GL_EXT_ray_tracing extension, and updates
the test results to match.

* update MissNV shader test to not use ObjectRay builtins

They shouldn't existing in the miss stage because there is no object intersected

3 years agoAdd ray query capability if acceleration structure or ray query types declared (...
Daniel Koch [Wed, 25 Nov 2020 04:06:16 +0000 (23:06 -0500)]
Add ray query capability if acceleration structure or ray query types declared (#2469)

* Add ray query capability if acceleration structure used

Fixes #2430

in non-ray tracing stages and the extension is enabled

* Add ray query capability if ray query declared

* Fix printing of TypeRayQueryKHR

It's no longer spelled with "Provisional"

3 years agoUpdates for final Vulkan ray tracing extensions (#2466)
Daniel Koch [Mon, 23 Nov 2020 20:41:27 +0000 (15:41 -0500)]
Updates for final Vulkan ray tracing extensions (#2466)

* Fix traceRay/executeCallable to have id instead of constant.

Update to final (non-provisional) SPIR-V capabilities
(includes review feedback)
- Change visibilty of findLinkerObjects.

See merge request GLSL/glslang!78

* Add support for OpConvertUToAccelerationStructureKHR.

GLSL : https://gitlab.khronos.org/GLSL/GLSL/-/merge_requests/60

SPV : https://gitlab.khronos.org/spirv/spirv-extensions/-/merge_requests/182

See merge request GLSL/glslang!77

* Add volatile qualifier to certain builtins for ray tracing.

See merge request GLSL/glslang!81

* make gl_RayTmaxEXT volatile in intersection shader

Vulkan Issue #2268

* Add testing for layouts on SBT

vulkan/vulkan#2230

- no layout specified should be same as std430
- explicitly test std140, std430, scalar layouts

See merge request GLSL/glslang!86

* Support for new opcodes OpIgnoreIntersectionKHR and OpTerminateRayKHR

vulkan/vulkan#2374

Add support for ignoreIntersectionEXT and terminateRayEXT as block
terminator statements.

See merge request GLSL/glslang!87

* Fix code-generation issues with global ray query variables

See merge request GLSL/glslang!88

* update dependencies for spirv-headers and tools

And update mesh shader results

* Fix indeterminate argument ordering

Authored-by: David Neto <dneto@google.com>
Co-authored-by: Ashwin Lele (NVIDIA Corporation) <alele@nvidia.com>
Co-authored-by: Neslisah <Neslisah.Torosdagli@amd.com>
3 years agoCompile out code for GL_EXT_shader_image_int64 for ANGLE (#2463)
Shahbaz Youssefi [Mon, 16 Nov 2020 17:22:34 +0000 (12:22 -0500)]
Compile out code for GL_EXT_shader_image_int64 for ANGLE (#2463)

Fixes a crash in ANGLE.

Closes: #2452

3 years agotweak local_size comparison a bit (#2456)
Malcolm Bechard [Thu, 12 Nov 2020 20:55:50 +0000 (15:55 -0500)]
tweak local_size comparison a bit (#2456)

no longer causes an incorrect error if the current unit has local_size
set, but the incoming unit does not

3 years agoAvoid spuriously adding Geometry capability for vert, tesc, tese (#2462)
David Neto [Thu, 12 Nov 2020 20:00:16 +0000 (15:00 -0500)]
Avoid spuriously adding Geometry capability for vert, tesc, tese (#2462)

Use of gl_Layer and gl_ViewportIndex in tessellation and vertex
shaders should not trigger the addition of the Geometry capability.

Fixes #2461

Added tests for use of gl_Layer and gl_ViewportIndex in a tessellation
evaluation shader.

Several tests for NVIDIA features for tessellation, vertex, or mesh
shaders now lose the Geometry or MultiViewport capabilities.
This is ok because the functionality is already covered by
the ShaderViewportIndexLayerNV capability.

The spv.meshShaderPerViewBuiltins.mesh test now fails validation
because the validator does not know that PrimitiveId (and possibly
other) builtins are enabled by the MeshShadingNV capability.
I filed https://github.com/KhronosGroup/SPIRV-Headers/issues/179 to
fix the grammar upstream.

3 years agoNew nonuniform analysis (#2457)
greg-lunarg [Thu, 12 Nov 2020 18:10:07 +0000 (11:10 -0700)]
New nonuniform analysis (#2457)

This implements a new nonunifom analysis suggested by @jbolz. This change
generates nonUniform decorations that were previously missing and avoids
generation of incorrect decorations. Most notably, it now generates
decorations for nonuniform functions and out params. It avoids generating
decorations for lvalues which themselves are not nonuniform.

3 years agoImplement GL_EXT_terminate_invocation (#2454)
Jesse Hall [Mon, 9 Nov 2020 16:30:01 +0000 (08:30 -0800)]
Implement GL_EXT_terminate_invocation (#2454)

* Implement GL_EXT_terminate_invocation.

* terminateInvocation: declare the SPV extension

* Update test results for spirv-tools and bison version bumps

Co-authored-by: John Kessenich <cepheus@frii.com>
3 years agoFix token-pasting macros not working in preprocessor directives. (#2453)
rdb [Fri, 6 Nov 2020 17:51:07 +0000 (18:51 +0100)]
Fix token-pasting macros not working in preprocessor directives. (#2453)

Fixes #2443

3 years agoFix warning in iomapper. (#2449)
Chow [Thu, 5 Nov 2020 17:33:45 +0000 (01:33 +0800)]
Fix warning in iomapper. (#2449)

ATT.

3 years agoAdd GL_EXT_shader_image_int64 support (#2409)
Tobski [Wed, 4 Nov 2020 16:24:23 +0000 (16:24 +0000)]
Add GL_EXT_shader_image_int64 support (#2409)

3 years ago8. io mapping refine & qualifier member check & resolver expand (#2396)
Chow [Tue, 3 Nov 2020 20:34:19 +0000 (04:34 +0800)]
8. io mapping refine & qualifier member check & resolver expand (#2396)

* Code refine and adding missing features

1. Add new level for built in symbols.
2. Fix issues for structure members' qualifiers.
3. Global qualifier fix.
4. IO Mapper refine. Add support for checking with mangle names.

* Additional missing features

* Invariant member. (Only check non-interface).

* Split block nesting level and struct nesting level. To fix issues of checking 'invariant' qualifier.

Current grammar would check block/struct member without its parent class's information.
So we split nesting level, and 'invariant' would only be checked within a struct.

* Format anonymous block names. Refine codes for symbols from all kinds of resouces.

* Fix writeonly check.

* Use LValueBase to find operator.

* Fix random null ptr issue.

* invariant check, stage in io mapping, reference parameter should be used and remove wrong codes introduced with ordering vector.

* Remained: to be fixed with double check link.vk.multiblocksValid

* Fix version error.

invariant

* Revert loc modification.

3 years agoFix build error with Chromium & ANGLE (#2446)
Courtney Goeltzenleuchter [Tue, 3 Nov 2020 04:22:55 +0000 (21:22 -0700)]
Fix build error with Chromium & ANGLE (#2446)

Getting error about undefined symbol (include_dir) at line 320.
Was trying to append to a non-existant variable.

Bug #2445

3 years agoAdd new SpirvToolsDisassemble API interface + Improve Doc on existing API interface...
pheonix [Mon, 2 Nov 2020 21:40:50 +0000 (13:40 -0800)]
Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2442)

* Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2408)

* Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output.
Improve documentation on existing SpirvToolsDisassemble interface.

* Update pre-processor check - following existing ENABLE_OPT checks.

* Fix not-found header paths for glslangValidator and glslangtests.

* Add spirv_tools/include path where there is an ENABLE_OPT=1 in the BUILD.gn configuration.

3 years agoSupport for CapabilityShaderViewportIndex and CapabilityShaderLayer (#2432)
Sidney Just [Mon, 2 Nov 2020 19:27:40 +0000 (11:27 -0800)]
Support for CapabilityShaderViewportIndex and CapabilityShaderLayer (#2432)

* When targeting SPIR-V 1.5, using gl_ViewportIndex will emit OpCapability ShaderViewportIndex and using gl_Layer will emit OpCapability CapabilityShaderLayer. OpCapability ShaderViewportIndexLayerEXT will only get emitted if the target < SPIR-V 1.5

* When using one of the viewport/layer arrays extensions, fallback to OpCapability ShaderViewportIndexLayerEXT, even when targeting SPIR-V 1.5

* Revert "When using one of the viewport/layer arrays extensions, fallback to OpCapability ShaderViewportIndexLayerEXT, even when targeting SPIR-V 1.5"

This reverts commit dccca82f4076ea6e2bc01dd6d1e5d290c59fab20.

* Using gl_Layer and gl_ViewportIndex outside of the geometry shader stage still requires one of the viewport extensions even when targeting SPIR-V 1.5
(Fixes a problem introduced by 670536b663f396815645b2f907f0ee92117b44f0)

3 years agoDo not use PropagateLineInfoPass and RedundantLineInfoElimPass (#2440)
Jaebaek Seo [Mon, 2 Nov 2020 17:49:31 +0000 (12:49 -0500)]
Do not use PropagateLineInfoPass and RedundantLineInfoElimPass (#2440)

* Do not use PropagateLineInfoPass and RedundantLineInfoElimPass

Since spirv-opt will remove PropagateLineInfoPass and
RedundantLineInfoElimPass, glslang should not use it. spirv-opt will
propagate the line instructions and eliminate the redundant lines by
default in IR loading/emission.

* Update known_good.json for spirv-tool

3 years agoMerge pull request #2387 from BNieuwenhuizen/nonuniform
John Kessenich [Fri, 30 Oct 2020 21:10:11 +0000 (15:10 -0600)]
Merge pull request #2387 from BNieuwenhuizen/nonuniform

NonUniform SPIR-V fixes.

3 years agoMerge pull request #2435 from amdrexu/feature
John Kessenich [Mon, 26 Oct 2020 20:29:10 +0000 (14:29 -0600)]
Merge pull request #2435 from amdrexu/feature

HLSL: Add support for printf().

3 years agoHLSL: Add support for printf().
Rex Xu [Fri, 23 Oct 2020 14:54:35 +0000 (22:54 +0800)]
HLSL: Add support for printf().

Translate printf() to what GL_EXT_debug_printf has done. HLSL could
define non-constant string variable and we don't have such features
in SPIR-V, so just support constant string variable.

3 years agoMerge pull request #2429 from ben-clayton/test-gn-presubmit
John Kessenich [Thu, 22 Oct 2020 16:35:16 +0000 (10:35 -0600)]
Merge pull request #2429 from ben-clayton/test-gn-presubmit

Fix GN build and presubmits

3 years agoFix GN build and presubmits
Ben Clayton [Wed, 21 Oct 2020 12:36:50 +0000 (13:36 +0100)]
Fix GN build and presubmits

Add missing `.cfg` files for GN presubmit.
Add missing `recursedeps` in the `DEPS` file.
Call `./update_glslang_sources.py` before attempting to build.
Add more GN spew to the `.gitignore` file.

3 years agoMerge pull request #2427 from ben-clayton/gn
John Kessenich [Tue, 20 Oct 2020 23:21:56 +0000 (17:21 -0600)]
Merge pull request #2427 from ben-clayton/gn

Kokoro: Add configurations for GN presubmit

3 years agoMerge pull request #2428 from Tobski/GL_EXT_fragment_shading_rate
John Kessenich [Tue, 20 Oct 2020 21:25:26 +0000 (15:25 -0600)]
Merge pull request #2428 from Tobski/GL_EXT_fragment_shading_rate

Add GL_EXT_fragment_shading_rate

3 years agoSPV: Update to the latest SPIR-V header, includes variable-rate shading
John Kessenich [Tue, 20 Oct 2020 20:46:15 +0000 (14:46 -0600)]
SPV: Update to the latest SPIR-V header, includes variable-rate shading

3 years agoAdd GL_EXT_fragment_shading_rate
Chow [Thu, 2 Jul 2020 07:50:36 +0000 (15:50 +0800)]
Add GL_EXT_fragment_shading_rate

3 years agoKokoro: Add configurations for GN presubmit
Ben Clayton [Tue, 20 Oct 2020 10:12:26 +0000 (11:12 +0100)]
Kokoro: Add configurations for GN presubmit

Issue: #2421

3 years agoMerge pull request #2422 from ben-clayton/gn
John Kessenich [Mon, 19 Oct 2020 23:29:18 +0000 (17:29 -0600)]
Merge pull request #2422 from ben-clayton/gn

Add basic GN configurations

3 years agoFix uninitialized use of TIntermediate::resource (#2424)
Ben Clayton [Mon, 19 Oct 2020 21:21:12 +0000 (22:21 +0100)]
Fix uninitialized use of TIntermediate::resource (#2424)

TIntermediate was constructed without initializing any of the `resources` fields,
and `TProgram::linkStage()` was not calling `TIntermediate::setLimits()`
after constructing new `TIntermediate`s for non-first stages.

Fields of `resources` were then read in `TIntermediate::finalCheck()`
triggering undefined behavior.

This CL makes three changes:
(1) `TIntermediate::setLimits()` is now called for non-first stages by
    copying the `firstIntermediate`'s limits. This ensures that the
    `resources` fields is initialized, fixing the bug.
(2) `TIntermediate::resources` is now wrapped in a `MustBeAssigned<>`
    helper struct, asserting in non-release builds that this field is
    always initialized before reading.
(3) `TIntermediate::resources` is now zero-initialized, so that if
    the `TIntermediate::resources` field is not set in a release build
    (and so the `assert()` will be disabled) behavior is still
    deterministic.

Fixes #2423

3 years agoAdd GN build instructions to README.md
Ben Clayton [Fri, 16 Oct 2020 13:26:05 +0000 (14:26 +0100)]
Add GN build instructions to README.md

3 years agoAdd basic GN configurations
Ben Clayton [Fri, 16 Oct 2020 11:47:38 +0000 (12:47 +0100)]
Add basic GN configurations

This allows glslang to be build standalone using the gn build system.

To build with gn:

```
gclient sync --gclientfile=standalone.gclient
gn gen out/default
cd out/default
ninja
```

3 years agoSPIR-V: Remove SpvTools.h include from disassemble.cpp (#2417)
Triang3l [Mon, 12 Oct 2020 16:33:01 +0000 (19:33 +0300)]
SPIR-V: Remove SpvTools.h include from disassemble.cpp (#2417)

disassemble.cpp appears not to be using anything from SpvTools.h, but the inclusion of it prevents standalone building of the SPIR-V portion (for instance, when needed purely for generation and disassembly) without SPIRV-Tools dependency.

3 years agoRemove executable bits from code/data files (#2420)
Rémi Verschelde [Mon, 12 Oct 2020 16:08:47 +0000 (18:08 +0200)]
Remove executable bits from code/data files (#2420)

3 years agoAdd test case for read-only storage texture passed to helper function (#2414)
David Neto [Wed, 7 Oct 2020 22:10:27 +0000 (18:10 -0400)]
Add test case for read-only storage texture passed to helper function (#2414)

This is based on spv.paramMemory.frag.out which exercises the
writeonly storage image case.

This appears to need desktop GLSL.

The generated SPIR-V fails validation because the image_write function
takes a parameter which is pointer to an OpTypeImage with Unknown format.
But the parameters passed in are pointer to OpTypeImage with formats Rgba32f
and Rgba16f. The validator rejects this, saying the parameter types must
match.

3 years agoDisable -Wno-conversion on MSVC compiler (#2410)
jonahryandavis [Wed, 7 Oct 2020 17:32:49 +0000 (13:32 -0400)]
Disable -Wno-conversion on MSVC compiler (#2410)