diff --git a/third_party/glslang/.github/workflows/continuous_deployment.yml b/third_party/glslang/.github/workflows/continuous_deployment.yml index d297832aeb..fd91ca9e4f 100644 --- a/third_party/glslang/.github/workflows/continuous_deployment.yml +++ b/third_party/glslang/.github/workflows/continuous_deployment.yml @@ -17,7 +17,6 @@ on: - main paths-ignore: - 'README.md' - - 'README-spirv-remap.txt' - 'LICENSE.txt' - 'CODE_OF_CONDUCT.md' - 'BUILD.*' @@ -41,8 +40,7 @@ jobs: compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}] cmake_build_type: [Debug, Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - run: ./update_glslang_sources.py - name: Build env: @@ -73,14 +71,13 @@ jobs: lib/libMachineIndependent.a \ lib/libOSDependent.a \ lib/libSPIRV.a \ - lib/libSPVRemapper.a \ lib/libSPIRV-Tools.a \ lib/libSPIRV-Tools-opt.a - name: Deploy if: ${{ matrix.compiler.cc == 'clang' }} env: ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: | const script = require('.github/workflows/deploy.js') @@ -93,20 +90,20 @@ jobs: strategy: fail-fast: false matrix: - os: [{genus: macos-13, family: osx}] + os: [{genus: macos-latest, family: osx}] compiler: [{cc: clang, cxx: clang++}] cmake_build_type: [Debug, Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - run: ./update_glslang_sources.py - name: Build env: CC: ${{matrix.compiler.cc}} CXX: ${{matrix.compiler.cxx}} + MACOSX_DEPLOYMENT_TARGET: 11.0 run: | mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. + cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" .. make -j4 install - name: Test run: | @@ -128,13 +125,12 @@ jobs: lib/libMachineIndependent.a \ lib/libOSDependent.a \ lib/libSPIRV.a \ - lib/libSPVRemapper.a \ lib/libSPIRV-Tools.a \ lib/libSPIRV-Tools-opt.a - name: Deploy env: ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: | const script = require('.github/workflows/deploy.js') @@ -150,8 +146,7 @@ jobs: os: [{genus: windows-2022, family: windows}] cmake_build_type: [Debug, Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - run: python update_glslang_sources.py - name: Build run: | @@ -170,7 +165,6 @@ jobs: 7z a ${{env.ARCHIVE}} ` bin/glslang.exe ` bin/glslangValidator.exe ` - bin/spirv-remap.exe ` include/glslang/* ` lib/GenericCodeGend.lib ` lib/glslangd.lib ` @@ -178,7 +172,6 @@ jobs: lib/MachineIndependentd.lib ` lib/OSDependentd.lib ` lib/SPIRVd.lib ` - lib/SPVRemapperd.lib ` lib/SPIRV-Toolsd.lib ` lib/SPIRV-Tools-optd.lib - name: Zip @@ -190,7 +183,6 @@ jobs: 7z a ${{env.ARCHIVE}} ` bin/glslang.exe ` bin/glslangValidator.exe ` - bin/spirv-remap.exe ` include/glslang/* ` lib/GenericCodeGen.lib ` lib/glslang.lib ` @@ -198,13 +190,12 @@ jobs: lib/MachineIndependent.lib ` lib/OSDependent.lib ` lib/SPIRV.lib ` - lib/SPVRemapper.lib ` lib/SPIRV-Tools.lib ` lib/SPIRV-Tools-opt.lib - name: Deploy env: ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: | const script = require('.github/workflows/deploy.js') diff --git a/third_party/glslang/.github/workflows/continuous_integration.yml b/third_party/glslang/.github/workflows/continuous_integration.yml index a51d7db60b..704b40a6fd 100644 --- a/third_party/glslang/.github/workflows/continuous_integration.yml +++ b/third_party/glslang/.github/workflows/continuous_integration.yml @@ -17,10 +17,9 @@ jobs: compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}] cmake_build_type: [Debug, Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Setup ccache - uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20 with: key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}} - run: ./update_glslang_sources.py @@ -53,10 +52,9 @@ jobs: compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}] cmake_build_type: [Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Setup ccache - uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20 with: key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}} - run: ./update_glslang_sources.py @@ -88,10 +86,9 @@ jobs: cmake_build_type: [Debug] flags: ['-fsanitize=address', '-fsanitize=thread', '-fsanitize=undefined'] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Setup ccache - uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20 with: key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}}-${{matrix.flags}} # This is to combat a bug when using 6.6 linux kernels with thread/address sanitizer @@ -123,15 +120,15 @@ jobs: name: Linux Backcompat runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: python-version: '3.7' - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: lukka/get-cmake@9e07ecdcee1b12e5037e42f410b67f03e2f626e1 # v4.2.1 with: cmakeVersion: 3.22.1 - name: Setup ccache - uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20 with: key: linux_backcompat - run: ./update_glslang_sources.py @@ -156,17 +153,23 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-14, macos-13] + os: [macos-latest] compiler: [{cc: clang, cxx: clang++}] cmake_build_type: [Debug, Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - run: ./update_glslang_sources.py - - run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -G Ninja -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON + - run: | + cmake -S . -B build \ + -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \ + -G Ninja \ + -D BUILD_WERROR=ON \ + -D GLSLANG_TESTS=ON \ + -D "CMAKE_OSX_ARCHITECTURES=arm64;x86_64" env: CC: ${{matrix.compiler.cc}} CXX: ${{matrix.compiler.cxx}} + MACOSX_DEPLOYMENT_TARGET: 11.0 - run: cmake --build build - run: cmake --install build --prefix build/install - name: Test find_package support @@ -180,17 +183,24 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-14] + os: [macos-latest] compiler: [{cc: clang, cxx: clang++}] cmake_build_type: [Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - run: ./update_glslang_sources.py - - run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -G Ninja -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON -DBUILD_SHARED_LIBS=ON + - run: | + cmake -S . -B build \ + -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \ + -G Ninja \ + -D BUILD_WERROR=ON \ + -D GLSLANG_TESTS=ON \ + -DBUILD_SHARED_LIBS=ON \ + -D "CMAKE_OSX_ARCHITECTURES=arm64;x86_64" env: CC: ${{matrix.compiler.cc}} CXX: ${{matrix.compiler.cxx}} + MACOSX_DEPLOYMENT_TARGET: 11.0 - run: cmake --build build - run: cmake --install build --prefix build/install - name: Test find_package support @@ -209,8 +219,7 @@ jobs: os: [{genus: windows-2022, family: windows}] cmake_build_type: [Debug, Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - run: python update_glslang_sources.py - name: Build run: | @@ -233,8 +242,7 @@ jobs: os: [{genus: windows-2022, family: windows}] cmake_build_type: [Debug, Release] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - run: python update_glslang_sources.py - name: Build run: | @@ -248,12 +256,11 @@ jobs: run: ctest -C ${{matrix.cmake_build_type}} --output-on-failure --test-dir build iOS: - runs-on: macos-13 + runs-on: macos-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Setup ccache - uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20 with: key: IOS - run: ./update_glslang_sources.py @@ -279,10 +286,9 @@ jobs: # Test both to ensure we are compatible with either approach. LEGACY: [ON, OFF] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Setup ccache - uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20 with: key: android-${{ matrix.LEGACY }} - run: ./update_glslang_sources.py @@ -302,10 +308,9 @@ jobs: emscripten: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.0.3 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Setup ccache - uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20 with: key: ubuntu-emscripten - uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14 diff --git a/third_party/glslang/.github/workflows/scorecard.yml b/third_party/glslang/.github/workflows/scorecard.yml index e37e8eabe9..ab18292867 100644 --- a/third_party/glslang/.github/workflows/scorecard.yml +++ b/third_party/glslang/.github/workflows/scorecard.yml @@ -23,12 +23,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 with: results_file: results.sarif results_format: sarif @@ -40,7 +40,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: SARIF file path: results.sarif @@ -48,6 +48,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0 + uses: github/codeql-action/upload-sarif@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 with: sarif_file: results.sarif diff --git a/third_party/glslang/Android.mk b/third_party/glslang/Android.mk index 3cd88c829a..e0511ae0eb 100644 --- a/third_party/glslang/Android.mk +++ b/third_party/glslang/Android.mk @@ -118,7 +118,6 @@ LOCAL_SRC_FILES:= \ SPIRV/GlslangToSpv.cpp \ SPIRV/InReadableOrder.cpp \ SPIRV/Logger.cpp \ - SPIRV/SPVRemapper.cpp \ SPIRV/SpvBuilder.cpp \ SPIRV/SpvPostProcess.cpp \ SPIRV/SpvTools.cpp \ diff --git a/third_party/glslang/BUILD.gn b/third_party/glslang/BUILD.gn index 1806a2b4df..f3f241f000 100644 --- a/third_party/glslang/BUILD.gn +++ b/third_party/glslang/BUILD.gn @@ -131,8 +131,6 @@ template("glslang_sources_common") { "SPIRV/Logger.h", "SPIRV/NonSemanticDebugPrintf.h", "SPIRV/NonSemanticShaderDebugInfo100.h", - "SPIRV/SPVRemapper.cpp", - "SPIRV/SPVRemapper.h", "SPIRV/SpvBuilder.cpp", "SPIRV/SpvBuilder.h", "SPIRV/SpvPostProcess.cpp", @@ -338,18 +336,4 @@ executable("glslang_validator") { configs -= _configs_to_remove configs += _configs_to_add -} - -executable("spirv-remap") { - sources = [ "StandAlone/spirv-remap.cpp" ] - defines = [ - "ENABLE_OPT=1", - "ENABLE_SPIRV=1", - ] - deps = [ ":glslang_sources" ] - - include_dirs = [ "${spirv_tools_dir}/include" ] - - configs -= _configs_to_remove - configs += _configs_to_add -} +} \ No newline at end of file diff --git a/third_party/glslang/CHANGES.md b/third_party/glslang/CHANGES.md index 0184ee253b..a8777f7a5a 100644 --- a/third_party/glslang/CHANGES.md +++ b/third_party/glslang/CHANGES.md @@ -3,6 +3,58 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). +## 16.2.0 2026-01-22 +* Allow gl_FragDepth identifier to be redeclared +* Replace 'GL_TASK(MESH)_SHADER_NV' with 'GL_TASK(MESH)_SHADER_EXT' +* Scalarize swizzled MeshEXT stores +* Support GL_EXT_long_vector +* Add missing preamble #define for GL_EXT_nontemporal_keyword +* Support GL_NV_push_constant_bank +* Support GL_EXT_descriptor_heap + +## 16.1.0 2025-12-01 +* Avoid emitting OpCapability RuntimeDescriptorArray when unnecessary +* Improve compilation speed when debug infomation is enabled +* Fix Debug Info for Retargeted Builtins +* Support GL_EXT_shader_invocation_reorder +* Add checks to coopMatMulAdd +* Implement stringify operator +* Add ES support for depth layout qualifier +* Add debug info for hitObjectNV +* Emit a DebugGlobalVariable instead of DebugLocalVariable for rayQueryEXT +* Add debug info for constant variable +* Improve debug line to point declaration +* Fix bugs in buffer reference alignment +* Reject string operands in binary and select ops +* Support GL_EXT_shader_64bit_indexing +* Support GLSL_EXT_uniform_buffer_unsized_array +* Add semantic check for cooperative vector loads/stores +* Improve the debug info name of opaque (sampler) types +* Support IO mapping of combined samplers and acceleration structures +* Fix bug in debug info for bool types inside SSBO/UBO +* Fix bug in debug info for struct member names +* Add methods for entry point and invert-y to C interface + +## 16.0.0 2025-09-25 +### Breaking changes +* Remove spirv-remapper (ported to SPIRV-Tools as canonicalize-ids optimization pass) + +### Other changes +* Emit error for in/out structs containing booleans +* Fix contradictory layout link errors +* Improve error checks for float8 math +* Fix bug in cooperative matrix load/store handling of array slices +* Update memory semantic validation rules to match update to Vulkan specification +* Simplify glslang grammar for identifier lists +* Fix erroneous parse errors in variable declarations using existing struct names +* Fix type conversions for createTensorLayout/ViewNV +* Fix OpAccessChain signed index issue for small unsigned integers +* Support GLSL_QCOM_cooperative_matrix_conversion +* Allow spec constant matrix use +* Fix inconsistent labeling of capability strings +* Fix crash on unnamed function parameters under relaxed rules +* Fix exported member functions in ShaderLang.h + ## 15.4.0 2025-06-26 * Support GL_NV_gpu_shader5/GL_ARB_gpu_shader5 * Remove BUILD_SHARED_LIBS option (defer to built-in variable) diff --git a/third_party/glslang/CMakeLists.txt b/third_party/glslang/CMakeLists.txt index f26987d4e8..8b0d18e3ee 100644 --- a/third_party/glslang/CMakeLists.txt +++ b/third_party/glslang/CMakeLists.txt @@ -93,9 +93,8 @@ option(GLSLANG_TESTS "Enable glslang testing" ${GLSLANG_TESTS_DEFAULT}) option(GLSLANG_ENABLE_INSTALL "Enable glslang installation" ${GLSLANG_ENABLE_INSTALL_DEFAULT}) option(ENABLE_SPIRV "Enables SPIRV output support" ON) -option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON) -option(ENABLE_GLSLANG_BINARIES "Builds glslang and spirv-remap" ON) +option(ENABLE_GLSLANG_BINARIES "Builds glslang" ON) option(ENABLE_GLSLANG_JS "If using Emscripten, build glslang.js. Otherwise, builds a sample executable for binary-size testing.") cmake_dependent_option(ENABLE_EMSCRIPTEN_SINGLE_FILE @@ -174,6 +173,14 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC) endif() endif() elseif(MSVC) + # A unary minus operator was applied to an unsigned type, resulting in an unsigned result. + add_compile_options(/w14146) + # A negative integral constant converted to unsigned type, resulting in a possibly meaningless result. + add_compile_options(/w14308) + # Use of an uninitialized local variable. + add_compile_options(/w14700) + # Use of a potentially uninitialized local pointer variable. + add_compile_options(/w14703) if(NOT ENABLE_RTTI) add_compile_options(/GR-) # Disable RTTI endif() @@ -185,6 +192,12 @@ elseif(MSVC) endif() endif() +if (PROJECT_IS_TOP_LEVEL) + # enable parallel builds for msbuild + list(APPEND CMAKE_VS_GLOBALS UseMultiToolTask=true) + list(APPEND CMAKE_VS_GLOBALS EnforceProcessCountAcrossBuilds=true) +endif() + # NOTE we could potentially replace this logic with COMPILE_WARNING_AS_ERROR if cmake minimum is bumped to >= 3.24 if (BUILD_WERROR) if (NOT MSVC) @@ -330,11 +343,9 @@ if(GLSLANG_TESTS) if (isMultiConfig) set(RESULTS_PATH ${CMAKE_CURRENT_BINARY_DIR}/$/localResults) set(VALIDATOR_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/$/glslang) - set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/$/spirv-remap) else() set(RESULTS_PATH ${CMAKE_CURRENT_BINARY_DIR}/localResults) set(VALIDATOR_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/glslang) - set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/spirv-remap) endif() # The TARGET_RUNTIME_DLL_DIRS feature requires CMake 3.27 or greater. @@ -342,13 +353,12 @@ if(GLSLANG_TESTS) message(WARNING "The Windows shared library test configuration requires CMake 3.27 or greater") else() add_test(NAME glslang-testsuite - COMMAND bash ${IGNORE_CR_FLAG} runtests ${RESULTS_PATH} ${VALIDATOR_PATH} ${REMAP_PATH} + COMMAND bash ${IGNORE_CR_FLAG} runtests ${RESULTS_PATH} ${VALIDATOR_PATH} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Test/) # Prepend paths to shared libraries. if (BUILD_SHARED_LIBS) set_tests_properties(glslang-testsuite PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$,\;>") - set_tests_properties(glslang-testsuite PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$,\;>") endif() endif() endif() diff --git a/third_party/glslang/LICENSE.txt b/third_party/glslang/LICENSE.txt index 054e68a461..1ea89c03d7 100644 --- a/third_party/glslang/LICENSE.txt +++ b/third_party/glslang/LICENSE.txt @@ -13,9 +13,6 @@ Other parts, outside of glslang proper, include: - update_glslang_sources.py, which is not part of the project proper and does not need to be used. -- the SPIR-V "remapper", which is optional, but has the same license as - glslang proper - - Google tests and SPIR-V tools, and anything in the external subdirectory are external and optional; see them for their respective licenses. diff --git a/third_party/glslang/README-spirv-remap.txt b/third_party/glslang/README-spirv-remap.txt deleted file mode 100644 index 59938d86ec..0000000000 --- a/third_party/glslang/README-spirv-remap.txt +++ /dev/null @@ -1,136 +0,0 @@ - -VERSION --------------------------------------------------------------------------------- -spirv-remap 0.97 - -INTRO: --------------------------------------------------------------------------------- -spirv-remap is a utility to improve compression of SPIR-V binary files via -entropy reduction, plus optional stripping of debug information and -load/store optimization. It transforms SPIR-V to SPIR-V, remapping IDs. The -resulting modules have an increased ID range (IDs are not as tightly packed -around zero), but will compress better when multiple modules are compressed -together, since compressor's dictionary can find better cross module -commonality. - -Remapping is accomplished via canonicalization. Thus, modules can be -compressed one at a time with no loss of quality relative to operating on -many modules at once. The command line tool operates on multiple modules -only in the trivial repetition sense, for ease of use. The remapper API -only accepts a single module at a time. - -There are two modes of use: command line, and a C++11 API. Both are -described below. - -spirv-remap is currently in an alpha state. Although there are no known -remapping defects, it has only been exercised on one real world game shader -workload. - - -FEEDBACK ---------------------------------------------------------------------------------- -Report defects, enhancement requests, code improvements, etc by creating -issues in the glslang repository at https://github.com/KhronosGroup/glslang - -COMMAND LINE USAGE: --------------------------------------------------------------------------------- -Examples are given with a verbosity of one (-v), but more verbosity can be -had via -vv, -vvv, etc, or an integer parameter to --verbose, such as -"--verbose 4". With no verbosity, the command is silent and returns 0 on -success, and a positive integer error on failure. - -Pre-built binaries for several OSs are available. Examples presented are -for Linux. Command line arguments can be provided in any order. - -1. Basic ID remapping - -Perform ID remapping on all shaders in "*.spv", writing new files with -the same basenames to /tmp/out_dir. - - spirv-remap -v --map all --input *.spv --output /tmp/out_dir - -2. Perform all possible size reductions - - spirv-remap-linux-64 -v --do-everything --input *.spv --output /tmp/out_dir - -Note that --do-everything is a synonym for: - - --map all --dce all --opt all --strip all - -API USAGE: --------------------------------------------------------------------------------- - -The public interface to the remapper is defined in SPIRV/SPVRemapper.h as follows: - -namespace spv { - -class spirvbin_t -{ -public: - enum Options { ... }; - spirvbin_t(int verbose = 0); // construct - - // remap an existing binary in memory - void remap(std::vector& spv, std::uint32_t opts = DO_EVERYTHING); - - // Type for error/log handler functions - typedef std::function errorfn_t; - typedef std::function logfn_t; - - // Register error/log handling functions (can be c/c++ fn, lambda fn, or functor) - static void registerErrorHandler(errorfn_t handler) { errorHandler = handler; } - static void registerLogHandler(logfn_t handler) { logHandler = handler; } -}; - -} // namespace spv - -The class definition is in SPVRemapper.cpp. - -remap() accepts an std::vector of SPIR-V words, modifies them per the -request given in 'opts', and leaves the 'spv' container with the result. -It is safe to instantiate one spirvbin_t per thread and process a different -SPIR-V in each. - -The "opts" parameter to remap() accepts a bit mask of desired remapping -options. See REMAPPING AND OPTIMIZATION OPTIONS. - -On error, the function supplied to registerErrorHandler() will be invoked. -This can be a standard C/C++ function, a lambda function, or a functor. -The default handler simply calls exit(5); The error handler is a static -member, so need only be set up once, not once per spirvbin_t instance. - -Log messages are supplied to registerLogHandler(). By default, log -messages are eaten silently. The log handler is also a static member. - -BUILD DEPENDENCIES: --------------------------------------------------------------------------------- - 1. C++11 compatible compiler - 2. cmake - 3. glslang - - -BUILDING --------------------------------------------------------------------------------- -The standalone remapper is built along side glslang through its -normal build process. - - -REMAPPING AND OPTIMIZATION OPTIONS --------------------------------------------------------------------------------- -API: - These are bits defined under spv::spirvbin_t::, and can be - bitwise or-ed together as desired. - - MAP_TYPES = canonicalize type IDs - MAP_NAMES = canonicalize named data - MAP_FUNCS = canonicalize function bodies - DCE_FUNCS = remove dead functions - DCE_VARS = remove dead variables - DCE_TYPES = remove dead types - OPT_LOADSTORE = optimize unneeded load/stores - MAP_ALL = (MAP_TYPES | MAP_NAMES | MAP_FUNCS) - DCE_ALL = (DCE_FUNCS | DCE_VARS | DCE_TYPES) - OPT_ALL = (OPT_LOADSTORE) - ALL_BUT_STRIP = (MAP_ALL | DCE_ALL | OPT_ALL) - DO_EVERYTHING = (STRIP | ALL_BUT_STRIP) - diff --git a/third_party/glslang/README.md b/third_party/glslang/README.md index e712cc3d4e..ef447b8e41 100644 --- a/third_party/glslang/README.md +++ b/third_party/glslang/README.md @@ -4,13 +4,11 @@ # News -1. Building glslang as a DLL or shared library is now possible and supported. +1. The --shift-texture-binding\[s\] option no longer affects combined samplers. The new --shift-combined-sampler-binding\[s\] option should be used to control combined sampler bindings independently from separate textures. The old behavior can be achieved by setting both options to the same value. -2. The `GenericCodeGen`, `MachineIndependent`, `OSDependent`, and `SPIRV` libraries have been integrated into the main `glslang` library. The old separate libraries have replaced with empty stubs for a temporary compatibility period, and they will be removed entirely in the future. +2. The spirv-remap utility from glslang has been ported to the SPIRV-Tools repository as a new optimization pass called canonicalize-ids, available in spirv-opt. See spirv-opt --help for usage details. -3. A new CMake `ENABLE_SPIRV` option has been added to control whether glslang is built with SPIR-V support. Its default value is `ON`. - -4. `OGLCompiler` and `HLSL` stub libraries have been fully removed from the build. +3. Building glslang as a DLL or shared library is now possible and supported. # Glslang Components and Status diff --git a/third_party/glslang/SPIRV/CMakeLists.txt b/third_party/glslang/SPIRV/CMakeLists.txt index 91469d4f21..9bac0005aa 100644 --- a/third_party/glslang/SPIRV/CMakeLists.txt +++ b/third_party/glslang/SPIRV/CMakeLists.txt @@ -43,10 +43,6 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CInterface/spirv_c_interface.cpp PARENT_SCOPE) -set(SPVREMAP_SOURCES - SPVRemapper.cpp - doc.cpp) - set(SPIRV_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/bitutils.h ${CMAKE_CURRENT_SOURCE_DIR}/spirv.hpp11 @@ -70,16 +66,11 @@ set(SPIRV_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/NonSemanticShaderDebugInfo100.h PARENT_SCOPE) -set(SPVREMAP_HEADERS - SPVRemapper.h - doc.h) - set(PUBLIC_HEADERS GlslangToSpv.h disassemble.h Logger.h spirv.hpp11 - SPVRemapper.h SpvTools.h) add_library(SPIRV ${LIB_TYPE} ${CMAKE_CURRENT_SOURCE_DIR}/../glslang/stub.cpp) @@ -94,22 +85,8 @@ target_include_directories(SPIRV PUBLIC $) glslang_only_export_explicit_symbols(SPIRV) -if (ENABLE_SPVREMAPPER) - add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) - add_library(glslang::SPVRemapper ALIAS SPVRemapper) - set_target_properties(SPVRemapper PROPERTIES - FOLDER glslang - POSITION_INDEPENDENT_CODE ON - VERSION "${GLSLANG_VERSION}" - SOVERSION "${GLSLANG_VERSION_MAJOR}") - glslang_only_export_explicit_symbols(SPVRemapper) -endif() - if(WIN32 AND BUILD_SHARED_LIBS) set_target_properties(SPIRV PROPERTIES PREFIX "") - if (ENABLE_SPVREMAPPER) - set_target_properties(SPVRemapper PROPERTIES PREFIX "") - endif() endif() if(ENABLE_OPT) @@ -122,14 +99,9 @@ endif() if(WIN32) source_group("Source" FILES ${SOURCES} ${HEADERS}) - source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) endif() if(GLSLANG_ENABLE_INSTALL) - if (ENABLE_SPVREMAPPER) - install(TARGETS SPVRemapper EXPORT glslang-targets) - endif() - install(TARGETS SPIRV EXPORT glslang-targets) install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/) diff --git a/third_party/glslang/SPIRV/GLSL.ext.EXT.h b/third_party/glslang/SPIRV/GLSL.ext.EXT.h index 748d9c8832..bed1f07048 100644 --- a/third_party/glslang/SPIRV/GLSL.ext.EXT.h +++ b/third_party/glslang/SPIRV/GLSL.ext.EXT.h @@ -42,5 +42,8 @@ static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_in static const char* const E_SPV_EXT_shader_tile_image = "SPV_EXT_shader_tile_image"; static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader"; static const char* const E_SPV_EXT_float8 = "SPV_EXT_float8"; +static const char* const E_SPV_EXT_shader_64bit_indexing = "SPV_EXT_shader_64bit_indexing"; +static const char* const E_SPV_EXT_shader_invocation_reorder = "SPV_EXT_shader_invocation_reorder"; +static const char* const E_SPV_EXT_long_vector = "SPV_EXT_long_vector"; #endif // #ifndef GLSLextEXT_H diff --git a/third_party/glslang/SPIRV/GLSL.ext.KHR.h b/third_party/glslang/SPIRV/GLSL.ext.KHR.h index 25dd88ff27..de8896d16d 100644 --- a/third_party/glslang/SPIRV/GLSL.ext.KHR.h +++ b/third_party/glslang/SPIRV/GLSL.ext.KHR.h @@ -66,5 +66,6 @@ static const char* const E_SPV_KHR_relaxed_extended_instruction = "SPV_KHR_relax static const char* const E_SPV_KHR_integer_dot_product = "SPV_KHR_integer_dot_product"; static const char* const E_SPV_NV_cooperative_vector = "SPV_NV_cooperative_vector"; static const char* const E_SPV_KHR_bfloat16 = "SPV_KHR_bfloat16"; - +static const char* const E_SPV_EXT_descriptor_heap = "SPV_EXT_descriptor_heap"; +static const char* const E_SPV_KHR_untyped_pointers = "SPV_KHR_untyped_pointers"; #endif // #ifndef GLSLextKHR_H diff --git a/third_party/glslang/SPIRV/GLSL.ext.NV.h b/third_party/glslang/SPIRV/GLSL.ext.NV.h index 4516d2d546..3666cd88a2 100644 --- a/third_party/glslang/SPIRV/GLSL.ext.NV.h +++ b/third_party/glslang/SPIRV/GLSL.ext.NV.h @@ -101,4 +101,8 @@ const char* const E_SPV_NV_cluster_acceleration_structure = "SPV_NV_cluster_acce //SPV_NV_linear_swept_spheres const char* const E_SPV_NV_linear_swept_spheres = "SPV_NV_linear_swept_spheres"; + +//SPV_NV_push_constant_bank +const char* const E_SPV_NV_push_constant_bank = "SPV_NV_push_constant_bank"; + #endif // #ifndef GLSLextNV_H diff --git a/third_party/glslang/SPIRV/GLSL.ext.QCOM.h b/third_party/glslang/SPIRV/GLSL.ext.QCOM.h index a671d79a8c..7633d4079f 100644 --- a/third_party/glslang/SPIRV/GLSL.ext.QCOM.h +++ b/third_party/glslang/SPIRV/GLSL.ext.QCOM.h @@ -39,6 +39,8 @@ static const int GLSLextQCOMRevision = 1; const char* const E_SPV_QCOM_image_processing = "SPV_QCOM_image_processing"; //SPV_QCOM_image_processing2 const char* const E_SPV_QCOM_image_processing2 = "SPV_QCOM_image_processing2"; +//SPV_QCOM_cooperative_matrix_conversion +const char* const E_SPV_QCOM_cooperative_matrix_conversion = "SPV_QCOM_cooperative_matrix_conversion"; //SPV_QCOM_tile_shading const char* const E_SPV_QCOM_tile_shading = "SPV_QCOM_tile_shading"; diff --git a/third_party/glslang/SPIRV/GlslangToSpv.cpp b/third_party/glslang/SPIRV/GlslangToSpv.cpp index 060926018f..ff9c8b04a4 100644 --- a/third_party/glslang/SPIRV/GlslangToSpv.cpp +++ b/third_party/glslang/SPIRV/GlslangToSpv.cpp @@ -127,15 +127,16 @@ public: glslang::SpvOptions& options); virtual ~TGlslangToSpvTraverser() { } - bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate*); - bool visitBinary(glslang::TVisit, glslang::TIntermBinary*); - void visitConstantUnion(glslang::TIntermConstantUnion*); - bool visitSelection(glslang::TVisit, glslang::TIntermSelection*); - bool visitSwitch(glslang::TVisit, glslang::TIntermSwitch*); - void visitSymbol(glslang::TIntermSymbol* symbol); - bool visitUnary(glslang::TVisit, glslang::TIntermUnary*); - bool visitLoop(glslang::TVisit, glslang::TIntermLoop*); - bool visitBranch(glslang::TVisit visit, glslang::TIntermBranch*); + bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate*) override; + bool visitBinary(glslang::TVisit, glslang::TIntermBinary*) override; + void visitConstantUnion(glslang::TIntermConstantUnion*) override; + bool visitSelection(glslang::TVisit, glslang::TIntermSelection*) override; + bool visitSwitch(glslang::TVisit, glslang::TIntermSwitch*) override; + void visitSymbol(glslang::TIntermSymbol* symbol) override; + bool visitUnary(glslang::TVisit, glslang::TIntermUnary*) override; + bool visitLoop(glslang::TVisit, glslang::TIntermLoop*) override; + bool visitBranch(glslang::TVisit visit, glslang::TIntermBranch*) override; + bool visitVariableDecl(glslang::TVisit, glslang::TIntermVariableDecl*) override; void finishSpv(bool compileOnly); void dumpSpv(std::vector& out); @@ -173,6 +174,8 @@ protected: spv::Id convertGlslangStructToSpvType(const glslang::TType&, const glslang::TTypeList* glslangStruct, glslang::TLayoutPacking, const glslang::TQualifier&); spv::LinkageType convertGlslangLinkageToSpv(glslang::TLinkType glslangLinkType); + spv::Id decorateDescHeapType(const glslang::TType& type, spv::Id& memberBaseOffset, spv::Id& alignment, + int& maxPlainDataAlignment); void decorateStructType(const glslang::TType&, const glslang::TTypeList* glslangStruct, glslang::TLayoutPacking, const glslang::TQualifier&, spv::Id, const std::vector& spvMembers); spv::Id makeArraySizeId(const glslang::TArraySizes&, int dim, bool allowZero = false, bool boolType = false); @@ -194,7 +197,6 @@ protected: void makeGlobalInitializers(const glslang::TIntermSequence&); void collectRayTracingLinkerObjects(); void visitFunctions(const glslang::TIntermSequence&); - void handleFunctionEntry(const glslang::TIntermAggregate* node); void translateArguments(const glslang::TIntermAggregate& node, std::vector& arguments, spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags); void translateArguments(glslang::TIntermUnary& node, std::vector& arguments); @@ -243,6 +245,7 @@ protected: std::pair getForcedType(glslang::TBuiltInVariable builtIn, const glslang::TType&); spv::Id translateForcedType(spv::Id object); spv::Id createCompositeConstruct(spv::Id typeId, std::vector constituents); + void recordDescHeapAccessChainInfo(glslang::TIntermBinary* node); glslang::SpvOptions& options; spv::Function* shaderEntry; @@ -288,6 +291,15 @@ protected: // Used later for generating OpTraceKHR/OpExecuteCallableKHR/OpHitObjectRecordHit*/OpHitObjectGetShaderBindingTableData std::unordered_map locationToSymbol[4]; std::unordered_map > idToQCOMDecorations; + // For nested or inner resource heap structure's alignment and offset records. + typedef struct heapMetaData { + spv::Id typeStride; + spv::Id maxRsrcTypeAlignment; + int maxPlainDataAlignment; + } HeapMetaData; + std::unordered_map heapStructureTypeMetaData; + std::unordered_map heapStructureTypeSize; + std::vector heapStructureMemberOffsets; }; // @@ -390,6 +402,9 @@ spv::Decoration TranslateBlockDecoration(const glslang::TStorageQualifier storag case glslang::EvqCallableData: return spv::Decoration::Block; case glslang::EvqCallableDataIn: return spv::Decoration::Block; case glslang::EvqHitObjectAttrNV: return spv::Decoration::Block; + case glslang::EvqHitObjectAttrEXT: return spv::Decoration::Block; + case glslang::EvqResourceHeap: return spv::Decoration::Block; + case glslang::EvqSamplerHeap: return spv::Decoration::Block; default: assert(0); break; @@ -465,6 +480,9 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T case glslang::EvqCallableData: case glslang::EvqCallableDataIn: case glslang::EvqHitObjectAttrNV: + case glslang::EvqHitObjectAttrEXT: + case glslang::EvqResourceHeap: + case glslang::EvqSamplerHeap: return spv::Decoration::Max; default: assert(0); @@ -1158,6 +1176,38 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addExtension(spv::E_SPV_QCOM_tile_shading); return spv::BuiltIn::TileApronSizeQCOM; + // SPV_EXT_descriptor_heap + case glslang::EbvSamplerHeapEXT: + builder.addExtension(spv::E_SPV_EXT_descriptor_heap); + builder.addExtension(spv::E_SPV_KHR_untyped_pointers); + builder.addCapability(spv::Capability::DescriptorHeapEXT); + builder.addCapability(spv::Capability::UntypedPointersKHR); + // Add SamplerHeapEXT Symbol for spv level. + if (builtInVariableIds.find(uint32_t(spv::BuiltIn::SamplerHeapEXT)) == builtInVariableIds.end()) { + spv::Id samplerHeapEXT = + builder.createUntypedVariable(spv::NoPrecision, spv::StorageClass::UniformConstant, "sampler_heap"); + if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) + entryPoint->addIdOperand(samplerHeapEXT); + builder.addDecoration(samplerHeapEXT, spv::Decoration::BuiltIn, (int)spv::BuiltIn::SamplerHeapEXT); + builtInVariableIds.insert({uint32_t(spv::BuiltIn::SamplerHeapEXT), samplerHeapEXT}); + } + return spv::BuiltIn::SamplerHeapEXT; + case glslang::EbvResourceHeapEXT: + builder.addExtension(spv::E_SPV_EXT_descriptor_heap); + builder.addExtension(spv::E_SPV_KHR_untyped_pointers); + builder.addCapability(spv::Capability::DescriptorHeapEXT); + builder.addCapability(spv::Capability::UntypedPointersKHR); + // Add ResourceHeapEXT Symbol for spv level. + if (builtInVariableIds.find(uint32_t(spv::BuiltIn::ResourceHeapEXT)) == builtInVariableIds.end()) { + spv::Id resourceHeapEXT = + builder.createUntypedVariable(spv::NoPrecision, spv::StorageClass::UniformConstant, "resource_heap"); + if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) + entryPoint->addIdOperand(resourceHeapEXT); + builder.addDecoration(resourceHeapEXT, spv::Decoration::BuiltIn, (int)spv::BuiltIn::ResourceHeapEXT); + builtInVariableIds.insert({uint32_t(spv::BuiltIn::ResourceHeapEXT), resourceHeapEXT}); + } + return spv::BuiltIn::ResourceHeapEXT; + default: return spv::BuiltIn::Max; } @@ -1323,7 +1373,8 @@ spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(const glslang: // Translate glslang type to SPIR-V storage class. spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::TType& type) { - if (type.getBasicType() == glslang::EbtRayQuery || type.getBasicType() == glslang::EbtHitObjectNV) + if (type.getBasicType() == glslang::EbtRayQuery || type.getBasicType() == glslang::EbtHitObjectNV + || type.getBasicType() == glslang::EbtHitObjectEXT) return spv::StorageClass::Private; if (type.getQualifier().isSpirvByReference()) { if (type.getQualifier().isParamInput() || type.getQualifier().isParamOutput()) @@ -1349,8 +1400,13 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T type.getQualifier().storage == glslang::EvqUniform) { if (type.isAtomic()) return spv::StorageClass::AtomicCounter; - if (type.containsOpaque() && !glslangIntermediate->getBindlessMode()) - return spv::StorageClass::UniformConstant; + if (type.containsOpaque() && !glslangIntermediate->getBindlessMode()) { + if (type.getQualifier().storage == glslang::EvqResourceHeap || + type.getQualifier().storage == glslang::EvqSamplerHeap) + return spv::StorageClass::Uniform; + else + return spv::StorageClass::UniformConstant; + } } if (type.getQualifier().isUniformOrBuffer() && @@ -1366,7 +1422,8 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T if (type.getQualifier().isUniformOrBuffer()) { if (type.getQualifier().isPushConstant()) return spv::StorageClass::PushConstant; - if (type.getBasicType() == glslang::EbtBlock) + if (type.getBasicType() == glslang::EbtBlock || + type.getQualifier().layoutDescriptorHeap) return spv::StorageClass::Uniform; return spv::StorageClass::UniformConstant; } @@ -1389,6 +1446,7 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T case glslang::EvqCallableDataIn: return spv::StorageClass::IncomingCallableDataKHR; case glslang::EvqtaskPayloadSharedEXT : return spv::StorageClass::TaskPayloadWorkgroupEXT; case glslang::EvqHitObjectAttrNV: return spv::StorageClass::HitObjectAttributeNV; + case glslang::EvqHitObjectAttrEXT: return spv::StorageClass::HitObjectAttributeEXT; case glslang::EvqSpirvStorageClass: return static_cast(type.getQualifier().spirvStorageClass); default: assert(0); @@ -1713,6 +1771,13 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, builder.addExecutionMode(shaderEntry, spv::ExecutionMode::RequireFullQuadsKHR); } + if (glslangIntermediate->usingShader64BitIndexing()) + { + builder.addCapability(spv::Capability::Shader64BitIndexingEXT); + builder.addExtension(spv::E_SPV_EXT_shader_64bit_indexing); + builder.addExecutionMode(shaderEntry, spv::ExecutionMode::Shader64BitIndexingEXT); + } + spv::ExecutionMode mode; switch (glslangIntermediate->getStage()) { case EShLangVertex: @@ -2196,7 +2261,7 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) // C) R-Values from type translation, see above call to translateForcedType() glslang::TQualifier qualifier = symbol->getQualifier(); if (qualifier.isSpecConstant() || rValueParameters.find(symbol->getId()) != rValueParameters.end() || - !builder.isPointerType(builder.getTypeId(id))) + (!builder.isPointerType(builder.getTypeId(id)) && !builder.isUntypedPointer(id))) builder.setAccessChainRValue(id); else builder.setAccessChainLValue(id); @@ -2237,6 +2302,28 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) #endif } +// Create new untyped access chain instruction to descriptor heap, based on EXT_descriptor_heap extension. +void TGlslangToSpvTraverser::recordDescHeapAccessChainInfo(glslang::TIntermBinary* node) +{ + // EXT_descriptor_heap + glslang::TType* nodeTy = node->getWritableType().clone(); + // For buffer/structure type, using its basic structure type: + // data ptr will be first loaded into a BufferPointerType before finally gets chained accessed. + if (node->getLeft()->getQualifier().isUniformOrBuffer()) + nodeTy = node->getLeft()->getType().clone(); + if (nodeTy->isArray()) + nodeTy->clearArraySizes(); + spv::BuiltIn bt = spv::BuiltIn::Max; + unsigned int firstArrIndex = 0; + auto rsrcOffsetIdx = builder.isStructureHeapMember(builder.getTypeId(builder.getAccessChain().base), + builder.getAccessChain().indexChain, 0, &bt, &firstArrIndex); + spv::Id remappedBuiltin = bt == spv::BuiltIn::Max ? 0 : builtInVariableIds[unsigned(bt)]; + nodeTy->getQualifier().layoutDescriptorInnerBlock = false; + // Extra dimension is not needed when translate storage and type. Real loading type is based on orignal AST nodes. + builder.setAccessChainDescHeapInfo(TranslateStorageClass(*nodeTy), convertGlslangToSpvType(*nodeTy), + nodeTy->getQualifier().layoutDescriptorStride, rsrcOffsetIdx, remappedBuiltin, firstArrIndex); +} + bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node) { builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename()); @@ -2373,14 +2460,32 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T coherentFlags.nonUniform = 0; // normal case for indexing array or structure or block - builder.accessChainPush(builder.makeIntConstant(spvIndex), - coherentFlags, - node->getLeft()->getType().getBufferReferenceAlignment()); + if ((node->getRight()->getType().getBasicType() == glslang::EbtUint && glslangIntermediate->usingPromoteUint32Indices()) || + node->getRight()->getType().contains64BitInt()) { + int64_t idx = node->getRight()->getType().contains64BitInt() ? + node->getRight()->getAsConstantUnion()->getConstArray()[0].getI64Const() : + node->getRight()->getAsConstantUnion()->getConstArray()[0].getUConst(); + builder.accessChainPush(builder.makeInt64Constant(idx), + coherentFlags, + node->getLeft()->getType().getBufferReferenceAlignment()); + } else { + builder.accessChainPush(builder.makeIntConstant(spvIndex), + coherentFlags, + node->getLeft()->getType().getBufferReferenceAlignment()); + } // Add capabilities here for accessing PointSize and clip/cull distance. // We have deferred generation of associated capabilities until now. if (node->getLeft()->getType().isStruct() && ! node->getLeft()->getType().isArray()) declareUseOfStructMember(*(node->getLeft()->getType().getStruct()), glslangIndex); + + // EXT_descriptor_heap + // Record untyped descriptor heap access info. + if (node->getLeft()->getType().isBuiltIn() && + (node->getLeft()->getQualifier().builtIn == glslang::EbvResourceHeapEXT || + node->getLeft()->getQualifier().builtIn == glslang::EbvSamplerHeapEXT)) { + recordDescHeapAccessChainInfo(node); + } } } return false; @@ -2403,6 +2508,16 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T node->getRight()->traverse(this); spv::Id index = accessChainLoad(node->getRight()->getType()); + // Zero-extend smaller unsigned integer types for array indexing. + // SPIR-V OpAccessChain treats indices as signed, so we need to zero-extend + // unsigned types to preserve their values (signed types are fine as-is). + spv::Id indexType = builder.getTypeId(index); + if (builder.isUintType(indexType) && builder.getScalarTypeWidth(indexType) < 32) { + // Zero-extend unsigned types to preserve their values + spv::Id uintType = builder.makeUintType(32); + index = builder.createUnaryOp(spv::Op::OpUConvert, uintType, index); + } + addIndirectionIndexCapabilities(node->getLeft()->getType(), node->getRight()->getType()); // restore the saved access chain @@ -2419,9 +2534,23 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T index, convertGlslangToSpvType(node->getLeft()->getType()), coherent_flags, glslangIntermediate->getBaseAlignmentScalar(node->getLeft()->getType(), dummySize)); - } else + } else { + if (glslangIntermediate->usingPromoteUint32Indices() && + node->getRight()->getType().getBasicType() == glslang::EbtUint) { + index = createIntWidthConversion(index, 0, builder.makeIntegerType(64, true), glslang::EbtInt64, node->getRight()->getType().getBasicType()); + } + builder.accessChainPush(index, coherent_flags, node->getLeft()->getType().getBufferReferenceAlignment()); + } + + // EXT_descriptor_heap + // Record untyped descriptor heap access info. + if (node->getLeft()->getType().isBuiltIn() && + (node->getLeft()->getQualifier().builtIn == glslang::EbvResourceHeapEXT || + node->getLeft()->getQualifier().builtIn == glslang::EbvSamplerHeapEXT)) { + recordDescHeapAccessChainInfo(node); + } } return false; case glslang::EOpVectorSwizzle: @@ -2648,6 +2777,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI // So, this has to be block.lastMember.length(). // SPV wants "block" and member number as the operands, go get them. + uint32_t bits = node->getType().contains64BitInt() ? 64 : 32; + spv::Id length; if (node->getOperand()->getType().isCoopMat()) { spv::Id typeId = convertGlslangToSpvType(node->getOperand()->getType()); @@ -2659,15 +2790,19 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); length = builder.createCooperativeMatrixLengthNV(typeId); } - } else if (node->getOperand()->getType().isCoopVecNV()) { + } else if (node->getOperand()->getType().isCoopVecOrLongVector()) { spv::Id typeId = convertGlslangToSpvType(node->getOperand()->getType()); - length = builder.getCooperativeVectorNumComponents(typeId); + if (builder.isCooperativeVectorType(typeId)) { + length = builder.getCooperativeVectorNumComponents(typeId); + } else { + length = builder.makeIntConstant(builder.getNumTypeConstituents(typeId)); + } } else { glslang::TIntermTyped* block = node->getOperand()->getAsBinaryNode()->getLeft(); block->traverse(this); unsigned int member = node->getOperand()->getAsBinaryNode()->getRight()->getAsConstantUnion() ->getConstArray()[0].getUConst(); - length = builder.createArrayLength(builder.accessChainGetLValue(), member); + length = builder.createArrayLength(builder.accessChainGetLValue(), member, bits); } // GLSL semantics say the result of .length() is an int, while SPIR-V says @@ -2675,9 +2810,9 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI // AST expectation of a signed result. if (glslangIntermediate->getSource() == glslang::EShSourceGlsl) { if (builder.isInSpecConstCodeGenMode()) { - length = builder.createBinOp(spv::Op::OpIAdd, builder.makeIntType(32), length, builder.makeIntConstant(0)); + length = builder.createBinOp(spv::Op::OpIAdd, builder.makeIntType(bits), length, builder.makeIntConstant(0)); } else { - length = builder.createUnaryOp(spv::Op::OpBitcast, builder.makeIntType(32), length); + length = builder.createUnaryOp(spv::Op::OpBitcast, builder.makeIntType(bits), length); } } @@ -2746,6 +2881,28 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI case glslang::EOpHitObjectGetSphereRadiusNV: case glslang::EOpHitObjectIsSphereHitNV: case glslang::EOpHitObjectIsLSSHitNV: + case glslang::EOpReorderThreadEXT: + case glslang::EOpHitObjectGetCurrentTimeEXT: + case glslang::EOpHitObjectGetHitKindEXT: + case glslang::EOpHitObjectGetPrimitiveIndexEXT: + case glslang::EOpHitObjectGetGeometryIndexEXT: + case glslang::EOpHitObjectGetInstanceIdEXT: + case glslang::EOpHitObjectGetInstanceCustomIndexEXT: + case glslang::EOpHitObjectGetObjectRayDirectionEXT: + case glslang::EOpHitObjectGetObjectRayOriginEXT: + case glslang::EOpHitObjectGetWorldRayDirectionEXT: + case glslang::EOpHitObjectGetWorldRayOriginEXT: + case glslang::EOpHitObjectGetWorldToObjectEXT: + case glslang::EOpHitObjectGetObjectToWorldEXT: + case glslang::EOpHitObjectGetRayTMaxEXT: + case glslang::EOpHitObjectGetRayTMinEXT: + case glslang::EOpHitObjectGetRayFlagsEXT: + case glslang::EOpHitObjectIsEmptyEXT: + case glslang::EOpHitObjectIsHitEXT: + case glslang::EOpHitObjectIsMissEXT: + case glslang::EOpHitObjectRecordEmptyEXT: + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexEXT: + case glslang::EOpHitObjectGetShaderRecordBufferHandleEXT: return true; default: return false; @@ -2917,9 +3074,15 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI case glslang::EOpReorderThreadNV: builder.createNoResultOp(spv::Op::OpReorderThreadWithHitObjectNV, operand); return false; + case glslang::EOpReorderThreadEXT: + builder.createNoResultOp(spv::Op::OpReorderThreadWithHitObjectEXT, operand); + return false; case glslang::EOpHitObjectRecordEmptyNV: builder.createNoResultOp(spv::Op::OpHitObjectRecordEmptyNV, operand); return false; + case glslang::EOpHitObjectRecordEmptyEXT: + builder.createNoResultOp(spv::Op::OpHitObjectRecordEmptyEXT, operand); + return false; case glslang::EOpCreateTensorLayoutNV: result = builder.createOp(spv::Op::OpCreateTensorLayoutNV, resultType(), std::vector{}); @@ -3094,7 +3257,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.enterFunction(shaderEntry); currentFunction = shaderEntry; } else { - handleFunctionEntry(node); + // SPIR-V functions should already be in the functionMap from the prepass + // that called makeFunctions(). + currentFunction = functionMap[node->getName().c_str()]; + spv::Block* functionBlock = currentFunction->getEntryBlock(); + builder.setBuildPoint(functionBlock); + builder.enterFunction(currentFunction); } if (options.generateDebugInfo && !options.emitNonSemanticShaderDebugInfo) { const auto& loc = node->getLoc(); @@ -3103,6 +3271,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt currentFunction->setDebugLineInfo(sourceFileId, loc.line, loc.column); } } else { + // Here we have finished visiting the function (post-visit). Finalize it. if (options.generateDebugInfo) { if (glslangIntermediate->getSource() == glslang::EShSourceGlsl && node->getSequence().size() > 1) { auto endLoc = node->getSequence()[1]->getAsAggregate()->getEndLoc(); @@ -3113,6 +3282,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt entryPointTerminated = true; builder.leaveFunction(); inEntryPoint = false; + currentFunction = nullptr; } return true; @@ -3277,7 +3447,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.addCapability(spv::Capability::CooperativeMatrixConversionsNV); builder.addExtension(spv::E_SPV_NV_cooperative_matrix2); constructed = builder.createCooperativeMatrixConversion(resultType(), arguments[0]); - } else if (node->getOp() == glslang::EOpConstructCooperativeVectorNV && + } else if (node->getType().isCoopVecOrLongVector() && arguments.size() == 1 && builder.getTypeId(arguments[0]) == resultType()) { constructed = arguments[0]; @@ -3287,7 +3457,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt node->getType().isArray() || // Handle constructing coopvec from one component here, to avoid the component // getting smeared - (node->getOp() == glslang::EOpConstructCooperativeVectorNV && arguments.size() == 1 && builder.isScalar(arguments[0]))) { + (node->getType().hasSpecConstantVectorComponents() && arguments.size() == 1 && builder.isScalar(arguments[0]))) { std::vector constituents; for (int c = 0; c < (int)arguments.size(); ++c) constituents.push_back(arguments[c]); @@ -3349,7 +3519,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt { // for scalar dot product, use multiply glslang::TIntermSequence& glslangOperands = node->getSequence(); - if (glslangOperands[0]->getAsTyped()->getVectorSize() == 1) + if (!glslangOperands[0]->getAsTyped()->getType().isLongVector() && + glslangOperands[0]->getAsTyped()->getVectorSize() == 1) binOp = glslang::EOpMul; break; } @@ -3566,6 +3737,46 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.addCapability(spv::Capability::RayTracingLinearSweptSpheresGeometryNV); break; + case glslang::EOpHitObjectTraceRayEXT: + case glslang::EOpHitObjectTraceRayMotionEXT: + case glslang::EOpHitObjectGetAttributesEXT: + case glslang::EOpHitObjectExecuteShaderEXT: + case glslang::EOpHitObjectRecordEmptyEXT: + case glslang::EOpHitObjectRecordMissEXT: + case glslang::EOpHitObjectRecordMissMotionEXT: + case glslang::EOpReorderThreadEXT: + case glslang::EOpHitObjectSetShaderBindingTableRecordIndexEXT: + case glslang::EOpHitObjectReorderExecuteEXT: + case glslang::EOpHitObjectTraceReorderExecuteEXT: + case glslang::EOpHitObjectTraceMotionReorderExecuteEXT: + case glslang::EOpHitObjectRecordFromQueryEXT: + case glslang::EOpHitObjectGetIntersectionTriangleVertexPositionsEXT: + noReturnValue = true; + [[fallthrough]]; + case glslang::EOpHitObjectIsEmptyEXT: + case glslang::EOpHitObjectIsMissEXT: + case glslang::EOpHitObjectIsHitEXT: + case glslang::EOpHitObjectGetRayTMinEXT: + case glslang::EOpHitObjectGetRayTMaxEXT: + case glslang::EOpHitObjectGetRayFlagsEXT: + case glslang::EOpHitObjectGetObjectRayOriginEXT: + case glslang::EOpHitObjectGetObjectRayDirectionEXT: + case glslang::EOpHitObjectGetWorldRayOriginEXT: + case glslang::EOpHitObjectGetWorldRayDirectionEXT: + case glslang::EOpHitObjectGetObjectToWorldEXT: + case glslang::EOpHitObjectGetWorldToObjectEXT: + case glslang::EOpHitObjectGetInstanceCustomIndexEXT: + case glslang::EOpHitObjectGetInstanceIdEXT: + case glslang::EOpHitObjectGetGeometryIndexEXT: + case glslang::EOpHitObjectGetPrimitiveIndexEXT: + case glslang::EOpHitObjectGetHitKindEXT: + case glslang::EOpHitObjectGetCurrentTimeEXT: + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexEXT: + case glslang::EOpHitObjectGetShaderRecordBufferHandleEXT: + builder.addExtension(spv::E_SPV_EXT_shader_invocation_reorder); + builder.addCapability(spv::Capability::ShaderInvocationReorderEXT); + break; + case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: builder.addExtension(spv::E_SPV_KHR_ray_tracing_position_fetch); builder.addCapability(spv::Capability::RayQueryPositionFetchKHR); @@ -3673,6 +3884,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt + case glslang::EOpHitObjectRecordFromQueryEXT: + case glslang::EOpHitObjectGetIntersectionTriangleVertexPositionsEXT: + if (arg == 0 || arg == 1) + lvalue = true; + break; + case glslang::EOpHitObjectRecordHitNV: case glslang::EOpHitObjectRecordHitMotionNV: case glslang::EOpHitObjectRecordHitWithIndexNV: @@ -3684,6 +3901,16 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpHitObjectRecordMissMotionNV: case glslang::EOpHitObjectGetAttributesNV: case glslang::EOpHitObjectGetClusterIdNV: + case glslang::EOpHitObjectTraceRayEXT: + case glslang::EOpHitObjectTraceRayMotionEXT: + case glslang::EOpHitObjectExecuteShaderEXT: + case glslang::EOpHitObjectRecordMissEXT: + case glslang::EOpHitObjectRecordMissMotionEXT: + case glslang::EOpHitObjectGetAttributesEXT: + case glslang::EOpHitObjectSetShaderBindingTableRecordIndexEXT: + case glslang::EOpHitObjectReorderExecuteEXT: + case glslang::EOpHitObjectTraceReorderExecuteEXT: + case glslang::EOpHitObjectTraceMotionReorderExecuteEXT: if (arg == 0) lvalue = true; break; @@ -3827,6 +4054,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt lvalue = true; break; case glslang::EOpReorderThreadNV: + case glslang::EOpReorderThreadEXT: //Three variants of reorderThreadNV, two of them use hitObjectNV if (arg == 0 && glslangOperands.size() != 2) lvalue = true; @@ -3963,22 +4191,33 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt )) { bool cond = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getBConst(); operands.push_back(builder.makeIntConstant(cond ? 1 : 0)); - } else if ((arg == 10 && glslangOp == glslang::EOpTraceKHR) || - (arg == 11 && glslangOp == glslang::EOpTraceRayMotionNV) || - (arg == 1 && glslangOp == glslang::EOpExecuteCallableKHR) || - (arg == 1 && glslangOp == glslang::EOpHitObjectExecuteShaderNV) || - (arg == 11 && glslangOp == glslang::EOpHitObjectTraceRayNV) || - (arg == 12 && glslangOp == glslang::EOpHitObjectTraceRayMotionNV)) { - const int set = glslangOp == glslang::EOpExecuteCallableKHR ? 1 : 0; - const int location = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getUConst(); - auto itNode = locationToSymbol[set].find(location); - visitSymbol(itNode->second); - spv::Id symId = getSymbolId(itNode->second); - operands.push_back(symId); + } else if ((arg == 10 && glslangOp == glslang::EOpTraceKHR) || + (arg == 11 && glslangOp == glslang::EOpTraceRayMotionNV) || + (arg == 1 && glslangOp == glslang::EOpExecuteCallableKHR) || + (arg == 1 && glslangOp == glslang::EOpHitObjectExecuteShaderNV) || + (arg == 1 && glslangOp == glslang::EOpHitObjectExecuteShaderEXT) || + (arg == 11 && glslangOp == glslang::EOpHitObjectTraceRayNV) || + (arg == 11 && glslangOp == glslang::EOpHitObjectTraceRayEXT) || + (arg == 12 && glslangOp == glslang::EOpHitObjectTraceRayMotionNV) || + (arg == 12 && glslangOp == glslang::EOpHitObjectTraceRayMotionEXT) || + (arg == 12 && glslangOp == glslang::EOpHitObjectTraceMotionReorderExecuteEXT && glslangOperands.size() == 13) || + (arg == 14 && glslangOp == glslang::EOpHitObjectTraceMotionReorderExecuteEXT && glslangOperands.size() == 15) || + (arg == 11 && glslangOp == glslang::EOpHitObjectTraceReorderExecuteEXT && glslangOperands.size() == 12) || + (arg == 13 && glslangOp == glslang::EOpHitObjectTraceReorderExecuteEXT && glslangOperands.size() == 14) || + (arg == 1 && glslangOp == glslang::EOpHitObjectReorderExecuteEXT && glslangOperands.size() == 2) || + (arg == 3 && glslangOp == glslang::EOpHitObjectReorderExecuteEXT && glslangOperands.size() == 4)) { + const int set = glslangOp == glslang::EOpExecuteCallableKHR ? 1 : 0; + const int location = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getUConst(); + auto itNode = locationToSymbol[set].find(location); + visitSymbol(itNode->second); + spv::Id symId = getSymbolId(itNode->second); + operands.push_back(symId); } else if ((arg == 12 && glslangOp == glslang::EOpHitObjectRecordHitNV) || (arg == 13 && glslangOp == glslang::EOpHitObjectRecordHitMotionNV) || (arg == 11 && glslangOp == glslang::EOpHitObjectRecordHitWithIndexNV) || (arg == 12 && glslangOp == glslang::EOpHitObjectRecordHitWithIndexMotionNV) || + (arg == 3 && glslangOp == glslang::EOpHitObjectRecordFromQueryEXT) || + (arg == 1 && glslangOp == glslang::EOpHitObjectGetAttributesEXT) || (arg == 1 && glslangOp == glslang::EOpHitObjectGetAttributesNV)) { const int location = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getUConst(); const int set = 2; @@ -4188,7 +4427,19 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt // store the result to the pointer (out param 'm') builder.createStore(result, operands[1]); result = 0; + } else if (node->getOp() == glslang::EOpHitObjectGetIntersectionTriangleVertexPositionsEXT) { + std::vector idImmOps; + idImmOps.push_back(spv::IdImmediate(true, operands[0])); // hitObject + + spv::Op spvOp = spv::Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT; + spv::Id typeId = builder.makeArrayType(builder.makeVectorType(builder.makeFloatType(32), 3), + builder.makeUintConstant(3), 0); + + spv::Id result = builder.createOp(spvOp, typeId, idImmOps); + // store the result to the pointer (out param 'm') + builder.createStore(result, operands[1]); + result = 0; } else if (node->getOp() == glslang::EOpCooperativeMatrixMulAdd) { auto matrixOperands = spv::CooperativeMatrixOperandsMask::MaskNone; @@ -4252,6 +4503,24 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt // store the result to the pointer builder.createStore(result, operands[0]); result = 0; + } else if (node->getOp() == glslang::EOpBitCastArrayQCOM) { + builder.addCapability(spv::Capability::CooperativeMatrixConversionQCOM); + builder.addExtension(spv::E_SPV_QCOM_cooperative_matrix_conversion); + result = builder.createUnaryOp(spv::Op::OpBitCastArrayQCOM, resultType(), operands[0]); + } else if (node->getOp() == glslang::EOpCompositeConstructCoopMatQCOM) { + builder.addCapability(spv::Capability::CooperativeMatrixConversionQCOM); + builder.addExtension(spv::E_SPV_QCOM_cooperative_matrix_conversion); + result = builder.createUnaryOp(spv::Op::OpCompositeConstructCoopMatQCOM, resultType(), operands[0]); + } else if (node->getOp() == glslang::EOpCompositeExtractCoopMatQCOM) { + builder.addCapability(spv::Capability::CooperativeMatrixConversionQCOM); + builder.addExtension(spv::E_SPV_QCOM_cooperative_matrix_conversion); + result = builder.createUnaryOp(spv::Op::OpCompositeExtractCoopMatQCOM, resultType(), operands[0]); + } else if (node->getOp() == glslang::EOpExtractSubArrayQCOM) { + builder.addCapability(spv::Capability::CooperativeMatrixConversionQCOM); + builder.addExtension(spv::E_SPV_QCOM_cooperative_matrix_conversion); + + std::vector arguments { operands[0], operands[1] };; + result = builder.createOp(spv::Op::OpExtractSubArrayQCOM, resultType(), arguments); } else if (node->getOp() == glslang::EOpCooperativeVectorMatMulNV || node->getOp() == glslang::EOpCooperativeVectorMatMulAddNV) { auto matrixOperands = spv::CooperativeMatrixOperandsMask::MaskNone; @@ -4772,7 +5041,7 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn builder.setBuildPoint(&test); node->getTest()->traverse(this); - spv::Id condition = accessChainLoad(node->getTest()->getType()); + spv::Id condition = accessChainLoad(node->getTestExpr()->getType()); builder.createConditionalBranch(condition, &blocks.body, &blocks.merge); builder.setBuildPoint(&blocks.body); @@ -4803,7 +5072,7 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn if (node->getTest()) { node->getTest()->traverse(this); spv::Id condition = - accessChainLoad(node->getTest()->getType()); + accessChainLoad(node->getTestExpr()->getType()); builder.createConditionalBranch(condition, &blocks.head, &blocks.merge); } else { // TODO: unless there was a break/return/discard instruction @@ -4886,6 +5155,18 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T return false; } +bool TGlslangToSpvTraverser::visitVariableDecl(glslang::TVisit visit, glslang::TIntermVariableDecl* node) +{ + if (visit == glslang::EvPreVisit) { + builder.setDebugSourceLocation(node->getDeclSymbol()->getLoc().line, node->getDeclSymbol()->getLoc().getFilename()); + // We touch the symbol once here to create the debug info. + getSymbolId(node->getDeclSymbol()); + } + + return true; +} + + spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* node, spv::Id forcedType) { // First, steer off constants, which are not SPIR-V variables, but @@ -4893,8 +5174,12 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* // This includes specialization constants. if (node->getQualifier().isConstant()) { spv::Id result = createSpvConstant(*node); - if (result != spv::NoResult) + if (result != spv::NoResult) { + auto name = node->getAsSymbolNode()->getAccessName().c_str(); + auto typeId = convertGlslangToSpvType(node->getType()); + builder.createConstVariable(typeId, name, result, currentFunction == nullptr); return result; + } } // Now, handle actual variables @@ -4979,6 +5264,16 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* } spv::Id var = builder.createVariable(spv::NoPrecision, storageClass, spvType, name, initializer, false); + + if (options.emitNonSemanticShaderDebugInfo && storageClass != spv::StorageClass::Function) { + // Create variable alias for retargeted symbols if any. + // Notably, this is only applicable to built-in variables so that it is okay to only use name as the key. + auto [itBegin, itEnd] = glslangIntermediate->getBuiltinAliasLookup().equal_range(name); + for (auto it = itBegin; it != itEnd; ++it) { + builder.createDebugGlobalVariable(builder.getDebugType(spvType), it->second.c_str(), var); + } + } + std::vector topLevelDecorations; glslang::TQualifier typeQualifier = node->getType().getQualifier(); TranslateMemoryDecoration(typeQualifier, topLevelDecorations, glslangIntermediate->usingVulkanMemoryModel()); @@ -5181,18 +5476,50 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty case glslang::EbtSampler: { const glslang::TSampler& sampler = type.getSampler(); + std::string debugName; + if (sampler.isPureSampler()) { - spvType = builder.makeSamplerType(); + if (options.emitNonSemanticShaderDebugInfo) { + if (glslangIntermediate->getSource() == glslang::EShSourceGlsl) { + debugName = sampler.getString(); + } + else { + debugName = "type.sampler"; + } + } + spvType = builder.makeSamplerType(debugName.c_str()); } else { // an image is present, make its type + if (options.emitNonSemanticShaderDebugInfo) { + if (glslangIntermediate->getSource() == glslang::EShSourceGlsl) { + debugName = sampler.removeCombined().getString(); + } + else { + switch (sampler.dim) { + case glslang::Esd1D: debugName = "type.1d.image"; break; + case glslang::Esd2D: debugName = "type.2d.image"; break; + case glslang::Esd3D: debugName = "type.3d.image"; break; + case glslang::EsdCube: debugName = "type.cube.image"; break; + default: debugName = "type.image"; break; + } + } + } spvType = builder.makeImageType(getSampledType(sampler), TranslateDimensionality(sampler), sampler.isShadow(), sampler.isArrayed(), sampler.isMultiSample(), - sampler.isImageClass() ? 2 : 1, TranslateImageFormat(type)); + sampler.isImageClass() ? 2 : 1, TranslateImageFormat(type), debugName.c_str()); if (sampler.isCombined() && (!sampler.isBuffer() || glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_6)) { // Already has both image and sampler, make the combined type. Only combine sampler to // buffer if before SPIR-V 1.6. - spvType = builder.makeSampledImageType(spvType); + if (options.emitNonSemanticShaderDebugInfo) { + if (glslangIntermediate->getSource() == glslang::EShSourceGlsl) { + debugName = sampler.getString(); + } + else { + debugName = "type.sampled.image"; + } + } + spvType = builder.makeSampledImageType(spvType, debugName.c_str()); } } } @@ -5200,6 +5527,14 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty case glslang::EbtStruct: case glslang::EbtBlock: { + // If it's an inner declared heap buffer or uniform block, using OpTypeBufferEXT + // to convert it to an untyped type. + if (type.getQualifier().isUniformOrBuffer() && + type.getQualifier().layoutDescriptorHeap && type.getQualifier().layoutDescriptorInnerBlock) { + spvType = builder.makeUntypedPointer(TranslateStorageClass(type), true); + break; + } + // If we've seen this struct type, return it const glslang::TTypeList* glslangMembers = type.getStruct(); @@ -5226,6 +5561,13 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty spvType = builder.makeHitObjectNVType(); } break; + + case glslang::EbtHitObjectEXT: { + builder.addExtension(spv::E_SPV_EXT_shader_invocation_reorder); + builder.addCapability(spv::Capability::ShaderInvocationReorderEXT); + spvType = builder.makeHitObjectEXTType(); + } + break; case glslang::EbtSpirvType: { // GL_EXT_spirv_intrinsics const auto& spirvType = type.getSpirvType(); @@ -5371,7 +5713,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty spv::Id scope = makeArraySizeId(*type.getTypeParameters()->arraySizes, 0); spv::Id rows = makeArraySizeId(*type.getTypeParameters()->arraySizes, 1); spv::Id cols = makeArraySizeId(*type.getTypeParameters()->arraySizes, 2); - spv::Id use = builder.makeUintConstant(type.getCoopMatKHRuse()); + spv::Id use = makeArraySizeId(*type.getTypeParameters()->arraySizes, 3, true); spvType = builder.makeCooperativeMatrixTypeKHR(spvType, scope, rows, cols, use); } @@ -5410,6 +5752,24 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty spvType = builder.makeCooperativeVectorTypeNV(spvType, components); } + if (type.isLongVector()) { + builder.addCapability(spv::Capability::LongVectorEXT); + builder.addExtension(spv::E_SPV_EXT_long_vector); + + if (type.getBasicType() == glslang::EbtFloat16) + builder.addCapability(spv::Capability::Float16); + if (type.getBasicType() == glslang::EbtUint8 || type.getBasicType() == glslang::EbtInt8) { + builder.addCapability(spv::Capability::Int8); + } + + if (type.hasSpecConstantVectorComponents()) { + spv::Id components = makeArraySizeId(*type.getTypeParameters()->arraySizes, 0); + spvType = builder.makeCooperativeVectorTypeNV(spvType, components); + } else { + spvType = builder.makeVectorType(spvType, type.getTypeParameters()->arraySizes->getDimSize(0)); + } + } + if (type.isArray()) { int stride = 0; // keep this 0 unless doing an explicit layout; 0 will mean no decoration, no stride @@ -5443,12 +5803,19 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty stride = getArrayStride(type, explicitLayout, qualifier.layoutMatrix); } + if (type.getQualifier().storage == glslang::EvqResourceHeap || + type.getQualifier().storage == glslang::EvqSamplerHeap) { + auto structSize = heapStructureTypeSize[spvType]; + spvType = builder.makeRuntimeArray(spvType); + builder.addDecorationId(spvType, spv::Decoration::ArrayStrideIdEXT, structSize); + } // Do the outer dimension, which might not be known for a runtime-sized array. // (Unsized arrays that survive through linking will be runtime-sized arrays) - if (type.isSizedArray()) + else if (type.isSizedArray()) spvType = builder.makeArrayType(spvType, makeArraySizeId(*type.getArraySizes(), 0), stride); else { - if (!lastBufferBlockMember) { + // If we see an runtime array in a buffer_reference, it is not a descriptor + if (!lastBufferBlockMember && type.getBasicType() != glslang::EbtReference) { builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::Capability::RuntimeDescriptorArrayEXT); } @@ -5568,6 +5935,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy int memberDelta = 0; // how much the member's index changes from glslang to SPIR-V, normally 0, // except sometimes for blocks std::vector > deferredForwardPointers; + std::vector memberDebugInfo; for (int i = 0; i < (int)glslangMembers->size(); i++) { auto& glslangMember = (*glslangMembers)[i]; if (glslangMember.type->hiddenMember()) { @@ -5618,18 +5986,72 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy // + Not as clean as desired. Traverser queries/sets persistent state. This is fragile. // + Table lookup during creation of composite debug types. This really shouldn't be necessary. if(options.emitNonSemanticShaderDebugInfo) { - builder.debugTypeLocs[spvMember].name = glslangMember.type->getFieldName().c_str(); - builder.debugTypeLocs[spvMember].line = glslangMember.loc.line; - builder.debugTypeLocs[spvMember].column = glslangMember.loc.column; + spv::StructMemberDebugInfo debugInfo{}; + debugInfo.name = glslangMember.type->getFieldName(); + debugInfo.line = glslangMember.loc.line; + debugInfo.column = glslangMember.loc.column; + + // Per the GLSL spec, bool variables inside of a uniform or buffer block are generated as uint. + // But for debug info, we want to represent them as bool because that is the original type in + // the source code. The bool type can be nested within a vector or a multidimensional array, + // so we must construct the chain of types up from the scalar bool. + if (glslangIntermediate->getSource() == glslang::EShSourceGlsl && explicitLayout != glslang::ElpNone && + glslangMember.type->getBasicType() == glslang::EbtBool) { + auto typeId = builder.makeBoolType(); + if (glslangMember.type->isVector()) { + typeId = builder.makeVectorType(typeId, glslangMember.type->getVectorSize()); + } + if (glslangMember.type->isArray()) { + const auto* arraySizes = glslangMember.type->getArraySizes(); + int dims = arraySizes->getNumDims(); + for (int i = dims - 1; i >= 0; --i) { + spv::Id size = builder.makeIntConstant(arraySizes->getDimSize(i)); + typeId = builder.makeArrayType(typeId, size, 0); + } + } + debugInfo.debugTypeOverride = builder.getDebugType(typeId); + } + + memberDebugInfo.push_back(debugInfo); } } } + // For those whose storage is ResourceHeap or SamplerHeap, we needs to recursively add + // member decorator for inner structure member declaration with spec Constant. + spv::Id heapStructSize = 0; + if (qualifier.storage == glslang::EvqResourceHeap || qualifier.storage == glslang::EvqSamplerHeap || + qualifier.layoutDescriptorInnerBlock) { + auto memberBaseOffset = builder.makeUintConstant(0); + int maxPlainDataTypeAlignment = 0; + spv::Id descTypeMaxAlignment = 0; + auto structLastMemberSize = + decorateDescHeapType(type, memberBaseOffset, descTypeMaxAlignment, maxPlainDataTypeAlignment); + auto structureUnaligned = builder.createSpecConstantOp( + spv::Op::OpIAdd, builder.makeUintType(32), {memberBaseOffset, structLastMemberSize}, {}); + auto structurePadding = builder.createSpecConstantOp( + spv::Op::OpUMod, builder.makeUintType(32), {descTypeMaxAlignment, structureUnaligned}, {}); + heapStructSize = builder.createSpecConstantOp( + spv::Op::OpIAdd, builder.makeUintType(32), {structureUnaligned, structurePadding}, {}); + HeapMetaData meta = {heapStructSize, descTypeMaxAlignment, maxPlainDataTypeAlignment}; + heapStructureTypeMetaData[&type] = meta; + } + // Make the SPIR-V type - spv::Id spvType = builder.makeStructType(spvMembers, type.getTypeName().c_str(), false); + spv::Id spvType = builder.makeStructType(spvMembers, memberDebugInfo, type.getTypeName().c_str(), false); if (! HasNonLayoutQualifiers(type, qualifier)) structMap[explicitLayout][qualifier.layoutMatrix][glslangMembers] = spvType; + // Keep decoration data order after spv structure type. + if (qualifier.storage == glslang::EvqResourceHeap || qualifier.storage == glslang::EvqSamplerHeap || + qualifier.layoutDescriptorInnerBlock) { + heapStructureTypeSize[spvType] = heapStructSize; + for (unsigned int i = 0; i < spvMembers.size(); i++) { + builder.addMemberDecorationIdEXT(spvType, i, spv::Decoration::OffsetIdEXT, {heapStructureMemberOffsets[i]}); + } + heapStructureMemberOffsets.clear(); + } + // Decorate it decorateStructType(type, glslangMembers, explicitLayout, qualifier, spvType, spvMembers); @@ -5641,6 +6063,126 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy return spvType; } +// Return not aligned size of current type. +spv::Id TGlslangToSpvTraverser::decorateDescHeapType( + const glslang::TType& type, + spv::Id &memberBaseOffset, + spv::Id &descTypeAlignment, + int& maxPlainDataAlignment) +{ + glslang::TLayoutPacking explicitLayout = glslang::ElpScalar; + auto selectMaxRsrcTyAlign = [&](spv::Id typeSize) { + if (descTypeAlignment != 0) { + auto compareInst = builder.createSpecConstantOp(spv::Op::OpUGreaterThan, builder.makeBoolType(), + {descTypeAlignment, typeSize}, {}); + auto selectMaxAlign = builder.createSpecConstantOp(spv::Op::OpSelect, builder.makeUintType(32), + {compareInst, descTypeAlignment, typeSize}, {}); + descTypeAlignment = selectMaxAlign; + } else + descTypeAlignment = typeSize; + }; + + // Get or calculate following info ordered. + // Member Type | Type size | Type alignment within current structure | Type offset. + // PS. resource blocks declared within a structure will not be processed as a normal declaration before, + // and its' size is dependent on constantSizeOfEXT op, so we won't trigger it as a normal structure here. + bool isArray = type.isArray(); + if (type.isStruct() && !type.getQualifier().layoutDescriptorInnerBlock) { + // 1. Structure type is processed from inner to higher level. + // If member is a sturcture, it will be processed earlier, + // parent structure could just load early results. + if (heapStructureTypeMetaData.find(&type) != heapStructureTypeMetaData.end()) { + auto metadata = heapStructureTypeMetaData[&type]; + selectMaxRsrcTyAlign(metadata.maxRsrcTypeAlignment); + maxPlainDataAlignment = std::max(metadata.maxPlainDataAlignment, maxPlainDataAlignment); + return metadata.typeStride; + } + // For other nested structure, it would be declared before its parent, + // so it should be directly returned a result in above check. + const glslang::TTypeList* structTyList = type.getStruct(); + spv::Id previousTypeSize = 0; + auto currentOffset = memberBaseOffset; + for (int i = 0; i < (int)structTyList->size(); i++) { + // Get offset : + // OffsetsBase = default ? 0 : OffsetInLayout; + // OffsetsBase = OffsetsBase + previousOffset + previousPadding. + const glslang::TType& memberTy = *(*structTyList)[i].type; + spv::Id typeSize = decorateDescHeapType(memberTy, currentOffset, descTypeAlignment, maxPlainDataAlignment); + // 2. Get each member's unaligned offset, padding and aligned offset. + // As this function is processed recursively, from bottom to upper, so in here, + // non-structure member's alignment should have been known. + if (i != 0) { + auto offsetNotAligned = builder.createSpecConstantOp(spv::Op::OpIAdd, builder.makeUintType(32), + {currentOffset, previousTypeSize}, {}); + auto offsetPadding = builder.createSpecConstantOp(spv::Op::OpUMod, builder.makeUintType(32), + {typeSize, offsetNotAligned}, {}); + currentOffset = builder.createSpecConstantOp(spv::Op::OpIAdd, builder.makeUintType(32), + {offsetNotAligned, offsetPadding}, {}); + } + heapStructureMemberOffsets.push_back(currentOffset); + previousTypeSize = typeSize; + } + // 3. Structure level, get max resource type's alignment, max plain data alignment and final + // structure inner alignment. + // Get compared result for alignment within whole structure. + spv::Id maxPlainAlignmentSize = builder.makeIntConstant(maxPlainDataAlignment); + + // Select biggest alignemnt size between desc types and plain old types. + selectMaxRsrcTyAlign(maxPlainAlignmentSize); + memberBaseOffset = currentOffset; + + // Now, return generates size of the MaterialData type + // Get structure level unaligned offset, padding and final offset outside. + return previousTypeSize; + } + + // Following are normal types, structures/blocks have been processed in above part. + // Normal type or member type within a structure. + bool useConstantSizeOf = + ((type.getQualifier().isUniformOrBuffer() && type.getQualifier().layoutDescriptorHeap) || + type.isImage() || type.isTexture() || type.isTensorARM() || type.getBasicType() == glslang::EbtAccStruct); + + // Get single type and layout info. + int elemCurrentOffset, elemAlignedSize; + int memberSize, dummyStride, typeAlignment; + spv::Id spvType = 0; + if (isArray) { + glslang::TType elemTy(type, 0); + elemTy.clearArraySizes(); + if (!useConstantSizeOf) { + typeAlignment = glslangIntermediate->getMemberAlignment( + elemTy, memberSize, dummyStride, glslang::ElpScalar, elemTy.getQualifier().layoutMatrix == glslang::ElmRowMajor); + updateMemberOffset(elemTy, elemTy, elemCurrentOffset, elemAlignedSize, explicitLayout, elemTy.getQualifier().layoutMatrix); + elemAlignedSize *= type.getCumulativeArraySize(); + } + spvType = convertGlslangToSpvType(elemTy); + } else { + if (!useConstantSizeOf) { + typeAlignment = glslangIntermediate->getMemberAlignment( + type, memberSize, dummyStride, glslang::ElpScalar, type.getQualifier().layoutMatrix == glslang::ElmRowMajor); + updateMemberOffset(type, type, elemCurrentOffset, elemAlignedSize, explicitLayout, type.getQualifier().layoutMatrix); + } + spvType = convertGlslangToSpvType(type); + } + + // Get alignment and type size. + spv::Id typeSize = 0; + if (useConstantSizeOf) { + typeSize = builder.createConstantSizeOfEXT(spvType); + // For resource type, needs to check current's largest alignment to select. + // New parent structure's alignment is equal to: + // maxInnerAlignment = currentAlignment > maxInnerAlignment + // ? currentAlignment + // : maxInnerAlignment; + selectMaxRsrcTyAlign(typeSize); + } else { + typeSize = builder.makeIntConstant(elemAlignedSize); + maxPlainDataAlignment = std::max(typeAlignment, maxPlainDataAlignment); + } + + return typeSize; +} + void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, const glslang::TTypeList* glslangMembers, glslang::TLayoutPacking explicitLayout, @@ -5709,7 +6251,12 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, if (glslangMember.getQualifier().hasXfbOffset()) builder.addMemberDecoration(spvType, member, spv::Decoration::Offset, glslangMember.getQualifier().layoutXfbOffset); - else if (explicitLayout != glslang::ElpNone) { + else if (glslangMember.getQualifier().hasMemberOffset()) { + builder.addExtension(spv::E_SPV_NV_push_constant_bank); + builder.addCapability(spv::Capability::PushConstantBanksNV); + builder.addMemberDecoration(spvType, member, spv::Decoration::MemberOffsetNV, + glslangMember.getQualifier().layoutMemberOffset); + } else if (explicitLayout != glslang::ElpNone) { // figure out what to do with offset, which is accumulating int nextOffset; updateMemberOffset(type, glslangMember, offset, nextOffset, explicitLayout, memberQualifier.layoutMatrix); @@ -5724,7 +6271,9 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, // built-in variable decorations spv::BuiltIn builtIn = TranslateBuiltInDecoration(glslangMember.getQualifier().builtIn, true); - if (builtIn != spv::BuiltIn::Max) + // built-in decoration is used to detect AST nodes, but won't be decorated on member variables. + if (builtIn != spv::BuiltIn::Max && + builtIn != spv::BuiltIn::ResourceHeapEXT && builtIn != spv::BuiltIn::SamplerHeapEXT) builder.addMemberDecoration(spvType, member, spv::Decoration::BuiltIn, (int)builtIn); // nonuniform @@ -5777,6 +6326,15 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, if (qualifier.hasHitObjectShaderRecordNV()) builder.addDecoration(spvType, spv::Decoration::HitObjectShaderRecordBufferNV); + + if (qualifier.hasBank()) { + builder.addExtension(spv::E_SPV_NV_push_constant_bank); + builder.addCapability(spv::Capability::PushConstantBanksNV); + builder.addDecoration(spvType, spv::Decoration::BankNV, qualifier.layoutBank); + } + + if (qualifier.hasHitObjectShaderRecordEXT()) + builder.addDecoration(spvType, spv::Decoration::HitObjectShaderRecordBufferEXT); } // Turn the expression forming the array size into an id. @@ -5846,6 +6404,12 @@ spv::Id TGlslangToSpvTraverser::accessChainLoad(const glslang::TType& type) loadedId = convertLoadedBoolInUniformToUint(type, nominalTypeId, loadedId); } + if (!builder.getAccessChain().descHeapInfo.descHeapInstId.empty()) { + for (auto heapInst : builder.getAccessChain().descHeapInfo.descHeapInstId) + heapInst->setTypeId(convertGlslangToSpvType(type)); + builder.clearAccessChain(); + } + return loadedId; } @@ -6343,6 +6907,7 @@ void TGlslangToSpvTraverser::collectRayTracingLinkerObjects() break; case glslang::EvqHitObjectAttrNV: + case glslang::EvqHitObjectAttrEXT: set = 2; break; @@ -6365,16 +6930,6 @@ void TGlslangToSpvTraverser::visitFunctions(const glslang::TIntermSequence& glsl } } -void TGlslangToSpvTraverser::handleFunctionEntry(const glslang::TIntermAggregate* node) -{ - // SPIR-V functions should already be in the functionMap from the prepass - // that called makeFunctions(). - currentFunction = functionMap[node->getName().c_str()]; - spv::Block* functionBlock = currentFunction->getEntryBlock(); - builder.setBuildPoint(functionBlock); - builder.enterFunction(currentFunction); -} - void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& node, std::vector& arguments, spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags) { @@ -6826,7 +7381,18 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } else { resultTypeId = builder.makePointer(spv::StorageClass::Image, resultType()); } - spv::Id pointer = builder.createOp(spv::Op::OpImageTexelPointer, resultTypeId, operands); + + // EXT_descriptor_heap + // For image atomic parameter, using untyped image texel pointer to carry on type metadata. + spv::Op imgTexelOp = spv::Op::OpImageTexelPointer; + if (node->getQualifier().isUsedByAtomic() && + imageType.getQualifier().builtIn == glslang::EbvResourceHeapEXT) { + operands.insert(operands.begin(), {true, convertGlslangToSpvType(imageType)}); + imgTexelOp = spv::Op::OpUntypedImageTexelPointerEXT; + resultTypeId = builder.makeUntypedPointer(spv::StorageClass::Image); + } + + spv::Id pointer = builder.createOp(imgTexelOp, resultTypeId, operands); if (imageType.getQualifier().nonUniform) { builder.addDecoration(pointer, spv::Decoration::NonUniformEXT); } @@ -7045,7 +7611,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO for (int i = 0; i < 5; i++) { members.push_back(builder.getContainedTypeId(resultStructType, i)); } - spv::Id resType = builder.makeStructType(members, "ResType"); + spv::Id resType = builder.makeStructType(members, {}, "ResType"); //call ImageFootprintNV spv::Id res = builder.createTextureCall(precision, resType, sparse, cracked.fetch, cracked.proj, @@ -8022,74 +8588,150 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe unaryOp = spv::Op::OpHitObjectIsEmptyNV; break; + case glslang::EOpHitObjectIsEmptyEXT: + unaryOp = spv::Op::OpHitObjectIsEmptyEXT; + break; + case glslang::EOpHitObjectIsMissNV: unaryOp = spv::Op::OpHitObjectIsMissNV; break; + case glslang::EOpHitObjectIsMissEXT: + unaryOp = spv::Op::OpHitObjectIsMissEXT; + break; + case glslang::EOpHitObjectIsHitNV: unaryOp = spv::Op::OpHitObjectIsHitNV; break; + case glslang::EOpHitObjectIsHitEXT: + unaryOp = spv::Op::OpHitObjectIsHitEXT; + break; + case glslang::EOpHitObjectGetObjectRayOriginNV: unaryOp = spv::Op::OpHitObjectGetObjectRayOriginNV; break; + case glslang::EOpHitObjectGetObjectRayOriginEXT: + unaryOp = spv::Op::OpHitObjectGetObjectRayOriginEXT; + break; + case glslang::EOpHitObjectGetObjectRayDirectionNV: unaryOp = spv::Op::OpHitObjectGetObjectRayDirectionNV; break; + case glslang::EOpHitObjectGetObjectRayDirectionEXT: + unaryOp = spv::Op::OpHitObjectGetObjectRayDirectionEXT; + break; + case glslang::EOpHitObjectGetWorldRayOriginNV: unaryOp = spv::Op::OpHitObjectGetWorldRayOriginNV; break; + case glslang::EOpHitObjectGetWorldRayOriginEXT: + unaryOp = spv::Op::OpHitObjectGetWorldRayOriginEXT; + break; + case glslang::EOpHitObjectGetWorldRayDirectionNV: unaryOp = spv::Op::OpHitObjectGetWorldRayDirectionNV; break; + case glslang::EOpHitObjectGetWorldRayDirectionEXT: + unaryOp = spv::Op::OpHitObjectGetWorldRayDirectionEXT; + break; + case glslang::EOpHitObjectGetObjectToWorldNV: unaryOp = spv::Op::OpHitObjectGetObjectToWorldNV; break; + case glslang::EOpHitObjectGetObjectToWorldEXT: + unaryOp = spv::Op::OpHitObjectGetObjectToWorldEXT; + break; + case glslang::EOpHitObjectGetWorldToObjectNV: unaryOp = spv::Op::OpHitObjectGetWorldToObjectNV; break; + case glslang::EOpHitObjectGetWorldToObjectEXT: + unaryOp = spv::Op::OpHitObjectGetWorldToObjectEXT; + break; + case glslang::EOpHitObjectGetRayTMinNV: unaryOp = spv::Op::OpHitObjectGetRayTMinNV; break; + case glslang::EOpHitObjectGetRayTMinEXT: + unaryOp = spv::Op::OpHitObjectGetRayTMinEXT; + break; + case glslang::EOpHitObjectGetRayTMaxNV: unaryOp = spv::Op::OpHitObjectGetRayTMaxNV; break; + case glslang::EOpHitObjectGetRayTMaxEXT: + unaryOp = spv::Op::OpHitObjectGetRayTMaxEXT; + break; + + case glslang::EOpHitObjectGetRayFlagsEXT: + unaryOp = spv::Op::OpHitObjectGetRayFlagsEXT; + break; + case glslang::EOpHitObjectGetPrimitiveIndexNV: unaryOp = spv::Op::OpHitObjectGetPrimitiveIndexNV; break; + case glslang::EOpHitObjectGetPrimitiveIndexEXT: + unaryOp = spv::Op::OpHitObjectGetPrimitiveIndexEXT; + break; + case glslang::EOpHitObjectGetInstanceIdNV: unaryOp = spv::Op::OpHitObjectGetInstanceIdNV; break; + case glslang::EOpHitObjectGetInstanceIdEXT: + unaryOp = spv::Op::OpHitObjectGetInstanceIdEXT; + break; + case glslang::EOpHitObjectGetInstanceCustomIndexNV: unaryOp = spv::Op::OpHitObjectGetInstanceCustomIndexNV; break; + case glslang::EOpHitObjectGetInstanceCustomIndexEXT: + unaryOp = spv::Op::OpHitObjectGetInstanceCustomIndexEXT; + break; + case glslang::EOpHitObjectGetGeometryIndexNV: unaryOp = spv::Op::OpHitObjectGetGeometryIndexNV; break; + case glslang::EOpHitObjectGetGeometryIndexEXT: + unaryOp = spv::Op::OpHitObjectGetGeometryIndexEXT; + break; + case glslang::EOpHitObjectGetHitKindNV: unaryOp = spv::Op::OpHitObjectGetHitKindNV; break; + case glslang::EOpHitObjectGetHitKindEXT: + unaryOp = spv::Op::OpHitObjectGetHitKindEXT; + break; + case glslang::EOpHitObjectGetCurrentTimeNV: unaryOp = spv::Op::OpHitObjectGetCurrentTimeNV; break; + case glslang::EOpHitObjectGetCurrentTimeEXT: + unaryOp = spv::Op::OpHitObjectGetCurrentTimeEXT; + break; + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV: unaryOp = spv::Op::OpHitObjectGetShaderBindingTableRecordIndexNV; break; + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexEXT: + unaryOp = spv::Op::OpHitObjectGetShaderBindingTableRecordIndexEXT; + break; + case glslang::EOpHitObjectGetShaderRecordBufferHandleNV: unaryOp = spv::Op::OpHitObjectGetShaderRecordBufferHandleNV; break; @@ -8129,6 +8771,10 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe builder.addCapability(spv::Capability::RayTracingLinearSweptSpheresGeometryNV); break; + case glslang::EOpHitObjectGetShaderRecordBufferHandleEXT: + unaryOp = spv::Op::OpHitObjectGetShaderRecordBufferHandleEXT; + break; + case glslang::EOpFetchMicroTriangleVertexPositionNV: unaryOp = spv::Op::OpFetchMicroTriangleVertexPositionNV; break; @@ -9507,9 +10153,12 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16); if (builder.getNumComponents(operands[0]) == 1) frexpIntType = builder.makeIntegerType(width, true); + else if (builder.isCooperativeVector(operands[0])) + frexpIntType = builder.makeCooperativeVectorTypeNV(builder.makeIntegerType(width, true), + builder.getCooperativeVectorNumComponents(builder.getTypeId(operands[0]))); else frexpIntType = builder.makeVectorType(builder.makeIntegerType(width, true), - builder.getNumComponents(operands[0])); + builder.getNumComponents(operands[0])); typeId = builder.makeStructResultType(typeId0, frexpIntType); consumedOperands = 1; } @@ -9766,9 +10415,15 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpHitObjectTraceRayNV: builder.createNoResultOp(spv::Op::OpHitObjectTraceRayNV, operands); return 0; + case glslang::EOpHitObjectTraceRayEXT: + builder.createNoResultOp(spv::Op::OpHitObjectTraceRayEXT, operands); + return 0; case glslang::EOpHitObjectTraceRayMotionNV: builder.createNoResultOp(spv::Op::OpHitObjectTraceRayMotionNV, operands); return 0; + case glslang::EOpHitObjectTraceRayMotionEXT: + builder.createNoResultOp(spv::Op::OpHitObjectTraceRayMotionEXT, operands); + return 0; case glslang::EOpHitObjectRecordHitNV: builder.createNoResultOp(spv::Op::OpHitObjectRecordHitNV, operands); return 0; @@ -9784,20 +10439,37 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpHitObjectRecordMissNV: builder.createNoResultOp(spv::Op::OpHitObjectRecordMissNV, operands); return 0; + case glslang::EOpHitObjectRecordMissEXT: + builder.createNoResultOp(spv::Op::OpHitObjectRecordMissEXT, operands); + return 0; case glslang::EOpHitObjectRecordMissMotionNV: builder.createNoResultOp(spv::Op::OpHitObjectRecordMissMotionNV, operands); return 0; + case glslang::EOpHitObjectRecordMissMotionEXT: + builder.createNoResultOp(spv::Op::OpHitObjectRecordMissMotionEXT, operands); + return 0; case glslang::EOpHitObjectExecuteShaderNV: builder.createNoResultOp(spv::Op::OpHitObjectExecuteShaderNV, operands); return 0; + case glslang::EOpHitObjectExecuteShaderEXT: + builder.createNoResultOp(spv::Op::OpHitObjectExecuteShaderEXT, operands); + return 0; case glslang::EOpHitObjectIsEmptyNV: typeId = builder.makeBoolType(); opCode = spv::Op::OpHitObjectIsEmptyNV; break; + case glslang::EOpHitObjectIsEmptyEXT: + typeId = builder.makeBoolType(); + opCode = spv::Op::OpHitObjectIsEmptyEXT; + break; case glslang::EOpHitObjectIsMissNV: typeId = builder.makeBoolType(); opCode = spv::Op::OpHitObjectIsMissNV; break; + case glslang::EOpHitObjectIsMissEXT: + typeId = builder.makeBoolType(); + opCode = spv::Op::OpHitObjectIsMissEXT; + break; case glslang::EOpHitObjectIsHitNV: typeId = builder.makeBoolType(); opCode = spv::Op::OpHitObjectIsHitNV; @@ -9810,69 +10482,143 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: typeId = builder.makeBoolType(); opCode = spv::Op::OpHitObjectIsLSSHitNV; break; + case glslang::EOpHitObjectIsHitEXT: + typeId = builder.makeBoolType(); + opCode = spv::Op::OpHitObjectIsHitEXT; + break; case glslang::EOpHitObjectGetRayTMinNV: typeId = builder.makeFloatType(32); opCode = spv::Op::OpHitObjectGetRayTMinNV; break; + case glslang::EOpHitObjectGetRayTMinEXT: + typeId = builder.makeFloatType(32); + opCode = spv::Op::OpHitObjectGetRayTMinEXT; + break; case glslang::EOpHitObjectGetRayTMaxNV: typeId = builder.makeFloatType(32); opCode = spv::Op::OpHitObjectGetRayTMaxNV; break; + case glslang::EOpHitObjectGetRayTMaxEXT: + typeId = builder.makeFloatType(32); + opCode = spv::Op::OpHitObjectGetRayTMaxEXT; + break; + case glslang::EOpHitObjectGetRayFlagsEXT: + typeId = builder.makeIntegerType(32, 0); + opCode = spv::Op::OpHitObjectGetRayFlagsEXT; + break; case glslang::EOpHitObjectGetObjectRayOriginNV: typeId = builder.makeVectorType(builder.makeFloatType(32), 3); opCode = spv::Op::OpHitObjectGetObjectRayOriginNV; break; + case glslang::EOpHitObjectGetObjectRayOriginEXT: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::Op::OpHitObjectGetObjectRayOriginEXT; + break; case glslang::EOpHitObjectGetObjectRayDirectionNV: typeId = builder.makeVectorType(builder.makeFloatType(32), 3); opCode = spv::Op::OpHitObjectGetObjectRayDirectionNV; break; + case glslang::EOpHitObjectGetObjectRayDirectionEXT: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::Op::OpHitObjectGetObjectRayDirectionEXT; + break; case glslang::EOpHitObjectGetWorldRayOriginNV: typeId = builder.makeVectorType(builder.makeFloatType(32), 3); opCode = spv::Op::OpHitObjectGetWorldRayOriginNV; break; + case glslang::EOpHitObjectGetWorldRayOriginEXT: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::Op::OpHitObjectGetWorldRayOriginEXT; + break; case glslang::EOpHitObjectGetWorldRayDirectionNV: typeId = builder.makeVectorType(builder.makeFloatType(32), 3); opCode = spv::Op::OpHitObjectGetWorldRayDirectionNV; break; + case glslang::EOpHitObjectGetWorldRayDirectionEXT: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::Op::OpHitObjectGetWorldRayDirectionEXT; + break; case glslang::EOpHitObjectGetWorldToObjectNV: typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3); opCode = spv::Op::OpHitObjectGetWorldToObjectNV; break; + case glslang::EOpHitObjectGetWorldToObjectEXT: + typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3); + opCode = spv::Op::OpHitObjectGetWorldToObjectEXT; + break; case glslang::EOpHitObjectGetObjectToWorldNV: typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3); opCode = spv::Op::OpHitObjectGetObjectToWorldNV; break; + case glslang::EOpHitObjectGetObjectToWorldEXT: + typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3); + opCode = spv::Op::OpHitObjectGetObjectToWorldEXT; + break; case glslang::EOpHitObjectGetInstanceCustomIndexNV: typeId = builder.makeIntegerType(32, 1); opCode = spv::Op::OpHitObjectGetInstanceCustomIndexNV; break; + case glslang::EOpHitObjectGetInstanceCustomIndexEXT: + typeId = builder.makeIntegerType(32, 1); + opCode = spv::Op::OpHitObjectGetInstanceCustomIndexEXT; + break; case glslang::EOpHitObjectGetInstanceIdNV: typeId = builder.makeIntegerType(32, 1); opCode = spv::Op::OpHitObjectGetInstanceIdNV; break; + case glslang::EOpHitObjectGetInstanceIdEXT: + typeId = builder.makeIntegerType(32, 1); + opCode = spv::Op::OpHitObjectGetInstanceIdEXT; + break; case glslang::EOpHitObjectGetGeometryIndexNV: typeId = builder.makeIntegerType(32, 1); opCode = spv::Op::OpHitObjectGetGeometryIndexNV; break; + case glslang::EOpHitObjectGetGeometryIndexEXT: + typeId = builder.makeIntegerType(32, 1); + opCode = spv::Op::OpHitObjectGetGeometryIndexEXT; + break; case glslang::EOpHitObjectGetPrimitiveIndexNV: typeId = builder.makeIntegerType(32, 1); opCode = spv::Op::OpHitObjectGetPrimitiveIndexNV; break; + case glslang::EOpHitObjectGetPrimitiveIndexEXT: + typeId = builder.makeIntegerType(32, 1); + opCode = spv::Op::OpHitObjectGetPrimitiveIndexEXT; + break; case glslang::EOpHitObjectGetHitKindNV: typeId = builder.makeIntegerType(32, 0); opCode = spv::Op::OpHitObjectGetHitKindNV; break; + case glslang::EOpHitObjectGetHitKindEXT: + typeId = builder.makeIntegerType(32, 0); + opCode = spv::Op::OpHitObjectGetHitKindEXT; + break; case glslang::EOpHitObjectGetCurrentTimeNV: typeId = builder.makeFloatType(32); opCode = spv::Op::OpHitObjectGetCurrentTimeNV; break; + case glslang::EOpHitObjectGetCurrentTimeEXT: + typeId = builder.makeFloatType(32); + opCode = spv::Op::OpHitObjectGetCurrentTimeEXT; + break; case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV: typeId = builder.makeIntegerType(32, 0); opCode = spv::Op::OpHitObjectGetShaderBindingTableRecordIndexNV; return 0; + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexEXT: + typeId = builder.makeIntegerType(32, 0); + opCode = spv::Op::OpHitObjectGetShaderBindingTableRecordIndexEXT; + return 0; case glslang::EOpHitObjectGetAttributesNV: builder.createNoResultOp(spv::Op::OpHitObjectGetAttributesNV, operands); return 0; + case glslang::EOpHitObjectGetAttributesEXT: + builder.createNoResultOp(spv::Op::OpHitObjectGetAttributesEXT, operands); + return 0; + case glslang::EOpHitObjectRecordFromQueryEXT: + builder.createNoResultOp(spv::Op::OpHitObjectRecordFromQueryEXT, operands); + return 0; case glslang::EOpHitObjectGetShaderRecordBufferHandleNV: typeId = builder.makeVectorType(builder.makeUintType(32), 2); opCode = spv::Op::OpHitObjectGetShaderRecordBufferHandleNV; @@ -9881,6 +10627,13 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: typeId = builder.makeIntegerType(32, 1); opCode = spv::Op::OpHitObjectGetClusterIdNV; break; + case glslang::EOpHitObjectGetShaderRecordBufferHandleEXT: + typeId = builder.makeVectorType(builder.makeUintType(32), 2); + opCode = spv::Op::OpHitObjectGetShaderRecordBufferHandleEXT; + break; + case glslang::EOpHitObjectSetShaderBindingTableRecordIndexEXT: + builder.createNoResultOp(spv::Op::OpHitObjectSetShaderBindingTableRecordIndexEXT, operands); + return 0; case glslang::EOpReorderThreadNV: { if (operands.size() == 2) { builder.createNoResultOp(spv::Op::OpReorderThreadWithHintNV, operands); @@ -9888,9 +10641,54 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: builder.createNoResultOp(spv::Op::OpReorderThreadWithHitObjectNV, operands); } return 0; - + } + case glslang::EOpReorderThreadEXT: { + if (operands.size() == 2) { + builder.createNoResultOp(spv::Op::OpReorderThreadWithHintEXT, operands); + } else { + builder.createNoResultOp(spv::Op::OpReorderThreadWithHitObjectEXT, operands); + } + return 0; } + case glslang::EOpHitObjectReorderExecuteEXT: { + if (operands.size() == 2) { + builder.createNoResultOp(spv::Op::OpHitObjectReorderExecuteShaderEXT, operands); + } else { + // GLSL intrinsic is + // hitObjectReorderExecuteEXT(hitObjectEXT hitObject, uint hint, uint bits,int payload) while + // SPIRV is hitObject id , payload id, optional hint id, optional bits id hence reorder operands + builder.createNoResultOp(spv::Op::OpHitObjectReorderExecuteShaderEXT, {operands[0], operands[3], operands[1], operands[2]}); + } + return 0; + } + + case glslang::EOpHitObjectTraceReorderExecuteEXT: { + if (operands.size() == 12) { + builder.createNoResultOp(spv::Op::OpHitObjectTraceReorderExecuteEXT, operands); + } else { + std::vector argOperands; + std::copy(operands.begin(), operands.begin() + 11, std::back_inserter(argOperands)); + argOperands.push_back(operands[13]); + argOperands.push_back(operands[11]); + argOperands.push_back(operands[12]); + builder.createNoResultOp(spv::Op::OpHitObjectTraceReorderExecuteEXT, argOperands); + } + return 0; + } + case glslang::EOpHitObjectTraceMotionReorderExecuteEXT: { + if (operands.size() == 13) { + builder.createNoResultOp(spv::Op::OpHitObjectTraceMotionReorderExecuteEXT, operands); + } else { + std::vector argOperands; + std::copy(operands.begin(), operands.begin() + 12, std::back_inserter(argOperands)); + argOperands.push_back(operands[14]); + argOperands.push_back(operands[12]); + argOperands.push_back(operands[13]); + builder.createNoResultOp(spv::Op::OpHitObjectTraceMotionReorderExecuteEXT, argOperands); + } + return 0; + } case glslang::EOpImageSampleWeightedQCOM: typeId = builder.makeVectorType(builder.makeFloatType(32), 4); opCode = spv::Op::OpImageSampleWeightedQCOM; @@ -10270,7 +11068,11 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builtIn == spv::BuiltIn::ObjectToWorldKHR || builtIn == spv::BuiltIn::WorldToObjectKHR; - if (mayNeedToReuseBuiltIn) { + // EXT_descriptor_heap + const bool needToRemapDescHeap = + builtIn == spv::BuiltIn::ResourceHeapEXT || builtIn == spv::BuiltIn::SamplerHeapEXT; + + if (mayNeedToReuseBuiltIn || needToRemapDescHeap) { auto iter = builtInVariableIds.find(uint32_t(builtIn)); if (builtInVariableIds.end() != iter) { id = iter->second; @@ -10314,11 +11116,13 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol if (symbol->getQualifier().hasLocation()) { if (!(glslangIntermediate->isRayTracingStage() && (glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_ray_tracing) || - glslangIntermediate->IsRequestedExtension(glslang::E_GL_NV_shader_invocation_reorder)) + glslangIntermediate->IsRequestedExtension(glslang::E_GL_NV_shader_invocation_reorder) || + glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_shader_invocation_reorder)) && (builder.getStorageClass(id) == spv::StorageClass::RayPayloadKHR || builder.getStorageClass(id) == spv::StorageClass::IncomingRayPayloadKHR || builder.getStorageClass(id) == spv::StorageClass::CallableDataKHR || builder.getStorageClass(id) == spv::StorageClass::IncomingCallableDataKHR || + builder.getStorageClass(id) == spv::StorageClass::HitObjectAttributeEXT || builder.getStorageClass(id) == spv::StorageClass::HitObjectAttributeNV))) { // Location values are used to link TraceRayKHR/ExecuteCallableKHR/HitObjectGetAttributesNV // to corresponding variables but are not valid in SPIRV since they are supported only @@ -10442,6 +11246,18 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol if (symbol->getType().getQualifier().hasSpirvDecorate()) applySpirvDecorate(symbol->getType(), id, {}); + if (symbol->getQualifier().hasBank()) { + builder.addExtension(spv::E_SPV_NV_push_constant_bank); + builder.addCapability(spv::Capability::PushConstantBanksNV); + builder.addDecoration(id, spv::Decoration::BankNV, symbol->getQualifier().layoutBank); + } + + if (symbol->getQualifier().hasMemberOffset()) { + builder.addExtension(spv::E_SPV_NV_push_constant_bank); + builder.addCapability(spv::Capability::PushConstantBanksNV); + builder.addDecoration(id, spv::Decoration::MemberOffsetNV, symbol->getQualifier().layoutMemberOffset); + } + return id; } @@ -10619,7 +11435,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n int nextConst = 0; result = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true); } else { - logger->missingFunctionality("Invalid initializer for spec onstant."); + logger->missingFunctionality("Invalid initializer for spec constant."); return spv::NoResult; } builder.addName(result, sn->getName().c_str()); @@ -10662,8 +11478,8 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla glslang::TVector::const_iterator iter; for (iter = glslangType.getStruct()->begin(); iter != glslangType.getStruct()->end(); ++iter) spvConsts.push_back(createSpvConstantFromConstUnionArray(*iter->type, consts, nextConst, false)); - } else if (glslangType.getVectorSize() > 1 || glslangType.isCoopVecNV()) { - unsigned int numComponents = glslangType.isCoopVecNV() ? glslangType.getTypeParameters()->arraySizes->getDimSize(0) : glslangType.getVectorSize(); + } else if (glslangType.getVectorSize() > 1 || glslangType.isCoopVecOrLongVector()) { + unsigned int numComponents = glslangType.isCoopVecOrLongVector() ? glslangType.getTypeParameters()->arraySizes->getDimSize(0) : glslangType.getVectorSize(); for (unsigned int i = 0; i < numComponents; ++i) { bool zero = nextConst >= consts.size(); switch (glslangType.getBasicType()) { diff --git a/third_party/glslang/SPIRV/SPVRemapper.cpp b/third_party/glslang/SPIRV/SPVRemapper.cpp deleted file mode 100644 index 02ecb3c534..0000000000 --- a/third_party/glslang/SPIRV/SPVRemapper.cpp +++ /dev/null @@ -1,1563 +0,0 @@ -// -// Copyright (C) 2015 LunarG, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -#include "SPVRemapper.h" -#include "doc.h" -#include "spvUtil.h" - -#include -#include - -namespace spv { - - // By default, just abort on error. Can be overridden via RegisterErrorHandler - spirvbin_t::errorfn_t spirvbin_t::errorHandler = [](const std::string&) { exit(5); }; - // By default, eat log messages. Can be overridden via RegisterLogHandler - spirvbin_t::logfn_t spirvbin_t::logHandler = [](const std::string&) { }; - - // This can be overridden to provide other message behavior if needed - void spirvbin_t::msg(int minVerbosity, int indent, const std::string& txt) const - { - if (verbose >= minVerbosity) - logHandler(std::string(indent, ' ') + txt); - } - - // hash opcode, with special handling for OpExtInst - std::uint32_t spirvbin_t::asOpCodeHash(unsigned word) - { - const spv::Op opCode = asOpCode(word); - - std::uint32_t offset = 0; - - switch (opCode) { - case spv::Op::OpExtInst: - offset += asId(word + 4); break; - default: - break; - } - - return ((unsigned)opCode) * 19 + offset; // 19 = small prime - } - - spirvbin_t::range_t spirvbin_t::literalRange(spv::Op opCode) const - { - static const int maxCount = 1<<30; - - switch (opCode) { - case spv::Op::OpTypeFloat: // fall through... - case spv::Op::OpTypePointer: return range_t(2, 3); - case spv::Op::OpTypeInt: return range_t(2, 4); - // TODO: case spv::OpTypeImage: - // TODO: case spv::OpTypeSampledImage: - case spv::Op::OpTypeSampler: return range_t(3, 8); - case spv::Op::OpTypeVector: // fall through - case spv::Op::OpTypeMatrix: // ... - case spv::Op::OpTypePipe: return range_t(3, 4); - case spv::Op::OpConstant: return range_t(3, maxCount); - default: return range_t(0, 0); - } - } - - spirvbin_t::range_t spirvbin_t::typeRange(spv::Op opCode) const - { - static const int maxCount = 1<<30; - - if (isConstOp(opCode)) - return range_t(1, 2); - - switch (opCode) { - case spv::Op::OpTypeVector: // fall through - case spv::Op::OpTypeMatrix: // ... - case spv::Op::OpTypeSampler: // ... - case spv::Op::OpTypeArray: // ... - case spv::Op::OpTypeRuntimeArray: // ... - case spv::Op::OpTypePipe: return range_t(2, 3); - case spv::Op::OpTypeStruct: // fall through - case spv::Op::OpTypeFunction: return range_t(2, maxCount); - case spv::Op::OpTypePointer: return range_t(3, 4); - default: return range_t(0, 0); - } - } - - spirvbin_t::range_t spirvbin_t::constRange(spv::Op opCode) const - { - static const int maxCount = 1<<30; - - switch (opCode) { - case spv::Op::OpTypeArray: // fall through... - case spv::Op::OpTypeRuntimeArray: return range_t(3, 4); - case spv::Op::OpConstantComposite: return range_t(3, maxCount); - default: return range_t(0, 0); - } - } - - // Return the size of a type in 32-bit words. This currently only - // handles ints and floats, and is only invoked by queries which must be - // integer types. If ever needed, it can be generalized. - unsigned spirvbin_t::typeSizeInWords(spv::Id id) const - { - const unsigned typeStart = idPos(id); - const spv::Op opCode = asOpCode(typeStart); - - if (errorLatch) - return 0; - - switch (opCode) { - case spv::Op::OpTypeInt: // fall through... - case spv::Op::OpTypeFloat: return (spv[typeStart + 2] + 31) / 32; - default: - return 0; - } - } - - // Looks up the type of a given const or variable ID, and - // returns its size in 32-bit words. - unsigned spirvbin_t::idTypeSizeInWords(spv::Id id) const - { - const auto tid_it = idTypeSizeMap.find(id); - if (tid_it == idTypeSizeMap.end()) { - error("type size for ID not found"); - return 0; - } - - return tid_it->second; - } - - // Is this an opcode we should remove when using --strip? - bool spirvbin_t::isStripOp(spv::Op opCode, unsigned start) const - { - switch (opCode) { - case spv::Op::OpSource: - case spv::Op::OpSourceExtension: - case spv::Op::OpName: - case spv::Op::OpMemberName: - case spv::Op::OpLine: - { - const std::string name = literalString(start + 2); - - std::vector::const_iterator it; - for (it = stripWhiteList.begin(); it < stripWhiteList.end(); it++) - { - if (name.find(*it) != std::string::npos) { - return false; - } - } - - return true; - } - default : - return false; - } - } - - // Return true if this opcode is flow control - bool spirvbin_t::isFlowCtrl(spv::Op opCode) const - { - switch (opCode) { - case spv::Op::OpBranchConditional: - case spv::Op::OpBranch: - case spv::Op::OpSwitch: - case spv::Op::OpLoopMerge: - case spv::Op::OpSelectionMerge: - case spv::Op::OpLabel: - case spv::Op::OpFunction: - case spv::Op::OpFunctionEnd: return true; - default: return false; - } - } - - // Return true if this opcode defines a type - bool spirvbin_t::isTypeOp(spv::Op opCode) const - { - switch (opCode) { - case spv::Op::OpTypeVoid: - case spv::Op::OpTypeBool: - case spv::Op::OpTypeInt: - case spv::Op::OpTypeFloat: - case spv::Op::OpTypeVector: - case spv::Op::OpTypeMatrix: - case spv::Op::OpTypeImage: - case spv::Op::OpTypeSampler: - case spv::Op::OpTypeArray: - case spv::Op::OpTypeRuntimeArray: - case spv::Op::OpTypeStruct: - case spv::Op::OpTypeOpaque: - case spv::Op::OpTypePointer: - case spv::Op::OpTypeFunction: - case spv::Op::OpTypeEvent: - case spv::Op::OpTypeDeviceEvent: - case spv::Op::OpTypeReserveId: - case spv::Op::OpTypeQueue: - case spv::Op::OpTypeSampledImage: - case spv::Op::OpTypePipe: return true; - default: return false; - } - } - - // Return true if this opcode defines a constant - bool spirvbin_t::isConstOp(spv::Op opCode) const - { - switch (opCode) { - case spv::Op::OpConstantSampler: - error("unimplemented constant type"); - return true; - - case spv::Op::OpConstantNull: - case spv::Op::OpConstantTrue: - case spv::Op::OpConstantFalse: - case spv::Op::OpConstantComposite: - case spv::Op::OpConstant: - return true; - - default: - return false; - } - } - - const auto inst_fn_nop = [](spv::Op, unsigned) { return false; }; - const auto op_fn_nop = [](spv::Id&) { }; - - // g++ doesn't like these defined in the class proper in an anonymous namespace. - // Dunno why. Also MSVC doesn't like the constexpr keyword. Also dunno why. - // Defining them externally seems to please both compilers, so, here they are. - const spv::Id spirvbin_t::unmapped = spv::Id(-10000); - const spv::Id spirvbin_t::unused = spv::Id(-10001); - const int spirvbin_t::header_size = 5; - - spv::Id spirvbin_t::nextUnusedId(spv::Id id) - { - while (isNewIdMapped(id)) // search for an unused ID - ++id; - - return id; - } - - spv::Id spirvbin_t::localId(spv::Id id, spv::Id newId) - { - //assert(id != spv::NoResult && newId != spv::NoResult); - - if (id > bound()) { - error(std::string("ID out of range: ") + std::to_string(id)); - return spirvbin_t::unused; - } - - if (id >= idMapL.size()) - idMapL.resize(id+1, unused); - - if (newId != unmapped && newId != unused) { - if (isOldIdUnused(id)) { - error(std::string("ID unused in module: ") + std::to_string(id)); - return spirvbin_t::unused; - } - - if (!isOldIdUnmapped(id)) { - error(std::string("ID already mapped: ") + std::to_string(id) + " -> " - + std::to_string(localId(id))); - - return spirvbin_t::unused; - } - - if (isNewIdMapped(newId)) { - error(std::string("ID already used in module: ") + std::to_string(newId)); - return spirvbin_t::unused; - } - - msg(4, 4, std::string("map: ") + std::to_string(id) + " -> " + std::to_string(newId)); - setMapped(newId); - largestNewId = std::max(largestNewId, newId); - } - - return idMapL[id] = newId; - } - - // Parse a literal string from the SPIR binary and return it as an std::string - // Due to C++11 RValue references, this doesn't copy the result string. - std::string spirvbin_t::literalString(unsigned word) const - { - std::string literal; - const spirword_t * pos = spv.data() + word; - - literal.reserve(16); - - do { - spirword_t word = *pos; - for (int i = 0; i < 4; i++) { - char c = word & 0xff; - if (c == '\0') - return literal; - literal += c; - word >>= 8; - } - pos++; - } while (true); - } - - void spirvbin_t::applyMap() - { - msg(3, 2, std::string("Applying map: ")); - - // Map local IDs through the ID map - process(inst_fn_nop, // ignore instructions - [this](spv::Id& id) { - id = localId(id); - - if (errorLatch) - return; - - assert(id != unused && id != unmapped); - } - ); - } - - // Find free IDs for anything we haven't mapped - void spirvbin_t::mapRemainder() - { - msg(3, 2, std::string("Remapping remainder: ")); - - spv::Id unusedId = 1; // can't use 0: that's NoResult - spirword_t maxBound = 0; - - for (spv::Id id = 0; id < idMapL.size(); ++id) { - if (isOldIdUnused(id)) - continue; - - // Find a new mapping for any used but unmapped IDs - if (isOldIdUnmapped(id)) { - localId(id, unusedId = nextUnusedId(unusedId)); - if (errorLatch) - return; - } - - if (isOldIdUnmapped(id)) { - error(std::string("old ID not mapped: ") + std::to_string(id)); - return; - } - - // Track max bound - maxBound = std::max(maxBound, localId(id) + 1); - - if (errorLatch) - return; - } - - bound(maxBound); // reset header ID bound to as big as it now needs to be - } - - // Mark debug instructions for stripping - void spirvbin_t::stripDebug() - { - // Strip instructions in the stripOp set: debug info. - process( - [&](spv::Op opCode, unsigned start) { - // remember opcodes we want to strip later - if (isStripOp(opCode, start)) - stripInst(start); - return true; - }, - op_fn_nop); - } - - // Mark instructions that refer to now-removed IDs for stripping - void spirvbin_t::stripDeadRefs() - { - process( - [&](spv::Op opCode, unsigned start) { - // strip opcodes pointing to removed data - switch (opCode) { - case spv::Op::OpName: - case spv::Op::OpMemberName: - case spv::Op::OpDecorate: - case spv::Op::OpMemberDecorate: - if (idPosR.find(asId(start+1)) == idPosR.end()) - stripInst(start); - break; - default: - break; // leave it alone - } - - return true; - }, - op_fn_nop); - - strip(); - } - - // Update local maps of ID, type, etc positions - void spirvbin_t::buildLocalMaps() - { - msg(2, 2, std::string("build local maps: ")); - - mapped.clear(); - idMapL.clear(); -// preserve nameMap, so we don't clear that. - fnPos.clear(); - fnCalls.clear(); - typeConstPos.clear(); - idPosR.clear(); - entryPoint = spv::NoResult; - largestNewId = 0; - - idMapL.resize(bound(), unused); - - int fnStart = 0; - spv::Id fnRes = spv::NoResult; - - // build local Id and name maps - process( - [&](spv::Op opCode, unsigned start) { - unsigned word = start+1; - spv::Id typeId = spv::NoResult; - - if (spv::InstructionDesc[enumCast(opCode)].hasType()) - typeId = asId(word++); - - // If there's a result ID, remember the size of its type - if (spv::InstructionDesc[enumCast(opCode)].hasResult()) { - const spv::Id resultId = asId(word++); - idPosR[resultId] = start; - - if (typeId != spv::NoResult) { - const unsigned idTypeSize = typeSizeInWords(typeId); - - if (errorLatch) - return false; - - if (idTypeSize != 0) - idTypeSizeMap[resultId] = idTypeSize; - } - } - - if (opCode == spv::Op::OpName) { - const spv::Id target = asId(start+1); - const std::string name = literalString(start+2); - nameMap[name] = target; - - } else if (opCode == spv::Op::OpFunctionCall) { - ++fnCalls[asId(start + 3)]; - } else if (opCode == spv::Op::OpEntryPoint) { - entryPoint = asId(start + 2); - } else if (opCode == spv::Op::OpFunction) { - if (fnStart != 0) { - error("nested function found"); - return false; - } - - fnStart = start; - fnRes = asId(start + 2); - } else if (opCode == spv::Op::OpFunctionEnd) { - assert(fnRes != spv::NoResult); - if (fnStart == 0) { - error("function end without function start"); - return false; - } - - fnPos[fnRes] = range_t(fnStart, start + asWordCount(start)); - fnStart = 0; - } else if (isConstOp(opCode)) { - if (errorLatch) - return false; - - assert(asId(start + 2) != spv::NoResult); - typeConstPos.insert(start); - } else if (isTypeOp(opCode)) { - assert(asId(start + 1) != spv::NoResult); - typeConstPos.insert(start); - } - - return false; - }, - - [this](spv::Id& id) { localId(id, unmapped); } - ); - } - - // Validate the SPIR header - void spirvbin_t::validate() const - { - msg(2, 2, std::string("validating: ")); - - if (spv.size() < header_size) { - error("file too short: "); - return; - } - - if (magic() != spv::MagicNumber) { - error("bad magic number"); - return; - } - - // field 1 = version - // field 2 = generator magic - // field 3 = result bound - - if (schemaNum() != 0) { - error("bad schema, must be 0"); - return; - } - } - - int spirvbin_t::processInstruction(unsigned word, instfn_t instFn, idfn_t idFn) - { - const auto instructionStart = word; - const unsigned wordCount = asWordCount(instructionStart); - const int nextInst = word++ + wordCount; - spv::Op opCode = asOpCode(instructionStart); - - if (nextInst > int(spv.size())) { - error("spir instruction terminated too early"); - return -1; - } - - // Base for computing number of operands; will be updated as more is learned - unsigned numOperands = wordCount - 1; - - if (instFn(opCode, instructionStart)) - return nextInst; - - // Read type and result ID from instruction desc table - if (spv::InstructionDesc[enumCast(opCode)].hasType()) { - idFn(asId(word++)); - --numOperands; - } - - if (spv::InstructionDesc[enumCast(opCode)].hasResult()) { - idFn(asId(word++)); - --numOperands; - } - - // Extended instructions: currently, assume everything is an ID. - // TODO: add whatever data we need for exceptions to that - if (opCode == spv::Op::OpExtInst) { - - idFn(asId(word)); // Instruction set is an ID that also needs to be mapped - - word += 2; // instruction set, and instruction from set - numOperands -= 2; - - for (unsigned op=0; op < numOperands; ++op) - idFn(asId(word++)); // ID - - return nextInst; - } - - // Circular buffer so we can look back at previous unmapped values during the mapping pass. - static const unsigned idBufferSize = 4; - spv::Id idBuffer[idBufferSize]; - unsigned idBufferPos = 0; - - // Store IDs from instruction in our map - for (int op = 0; numOperands > 0; ++op, --numOperands) { - // SpecConstantOp is special: it includes the operands of another opcode which is - // given as a literal in the 3rd word. We will switch over to pretending that the - // opcode being processed is the literal opcode value of the SpecConstantOp. See the - // SPIRV spec for details. This way we will handle IDs and literals as appropriate for - // the embedded op. - if (opCode == spv::Op::OpSpecConstantOp) { - if (op == 0) { - opCode = asOpCode(word++); // this is the opcode embedded in the SpecConstantOp. - --numOperands; - } - } - - switch (spv::InstructionDesc[enumCast(opCode)].operands.getClass(op)) { - case spv::OperandId: - case spv::OperandScope: - case spv::OperandMemorySemantics: - idBuffer[idBufferPos] = asId(word); - idBufferPos = (idBufferPos + 1) % idBufferSize; - idFn(asId(word++)); - break; - - case spv::OperandVariableIds: - for (unsigned i = 0; i < numOperands; ++i) - idFn(asId(word++)); - return nextInst; - - case spv::OperandVariableLiterals: - // for clarity - // if (opCode == spv::OpDecorate && asDecoration(word - 1) == spv::DecorationBuiltIn) { - // ++word; - // --numOperands; - // } - // word += numOperands; - return nextInst; - - case spv::OperandVariableLiteralId: { - if (opCode == Op::OpSwitch) { - // word-2 is the position of the selector ID. OpSwitch Literals match its type. - // In case the IDs are currently being remapped, we get the word[-2] ID from - // the circular idBuffer. - const unsigned literalSizePos = (idBufferPos+idBufferSize-2) % idBufferSize; - const unsigned literalSize = idTypeSizeInWords(idBuffer[literalSizePos]); - const unsigned numLiteralIdPairs = (nextInst-word) / (1+literalSize); - - if (errorLatch) - return -1; - - for (unsigned arg=0; arg instPos; - instPos.reserve(unsigned(spv.size()) / 16); // initial estimate; can grow if needed. - - // Build local table of instruction start positions - process( - [&](spv::Op, unsigned start) { instPos.push_back(start); return true; }, - op_fn_nop); - - if (errorLatch) - return; - - // Window size for context-sensitive canonicalization values - // Empirical best size from a single data set. TODO: Would be a good tunable. - // We essentially perform a little convolution around each instruction, - // to capture the flavor of nearby code, to hopefully match to similar - // code in other modules. - static const unsigned windowSize = 2; - - for (unsigned entry = 0; entry < unsigned(instPos.size()); ++entry) { - const unsigned start = instPos[entry]; - const spv::Op opCode = asOpCode(start); - - if (opCode == spv::Op::OpFunction) - fnId = asId(start + 2); - - if (opCode == spv::Op::OpFunctionEnd) - fnId = spv::NoResult; - - if (fnId != spv::NoResult) { // if inside a function - if (spv::InstructionDesc[enumCast(opCode)].hasResult()) { - const unsigned word = start + (spv::InstructionDesc[enumCast(opCode)].hasType() ? 2 : 1); - const spv::Id resId = asId(word); - std::uint32_t hashval = fnId * 17; // small prime - - for (unsigned i = entry-1; i >= entry-windowSize; --i) { - if (asOpCode(instPos[i]) == spv::Op::OpFunction) - break; - hashval = hashval * 30103 + asOpCodeHash(instPos[i]); // 30103 = semiarbitrary prime - } - - for (unsigned i = entry; i <= entry + windowSize; ++i) { - if (asOpCode(instPos[i]) == spv::Op::OpFunctionEnd) - break; - hashval = hashval * 30103 + asOpCodeHash(instPos[i]); // 30103 = semiarbitrary prime - } - - if (isOldIdUnmapped(resId)) { - localId(resId, nextUnusedId(hashval % softTypeIdLimit + firstMappedID)); - if (errorLatch) - return; - } - - } - } - } - - spv::Op thisOpCode(spv::Op::OpNop); - std::unordered_map opCounter; - int idCounter(0); - fnId = spv::NoResult; - - process( - [&](spv::Op opCode, unsigned start) { - switch (opCode) { - case spv::Op::OpFunction: - // Reset counters at each function - idCounter = 0; - opCounter.clear(); - fnId = asId(start + 2); - break; - - case spv::Op::OpImageSampleImplicitLod: - case spv::Op::OpImageSampleExplicitLod: - case spv::Op::OpImageSampleDrefImplicitLod: - case spv::Op::OpImageSampleDrefExplicitLod: - case spv::Op::OpImageSampleProjImplicitLod: - case spv::Op::OpImageSampleProjExplicitLod: - case spv::Op::OpImageSampleProjDrefImplicitLod: - case spv::Op::OpImageSampleProjDrefExplicitLod: - case spv::Op::OpDot: - case spv::Op::OpCompositeExtract: - case spv::Op::OpCompositeInsert: - case spv::Op::OpVectorShuffle: - case spv::Op::OpLabel: - case spv::Op::OpVariable: - - case spv::Op::OpAccessChain: - case spv::Op::OpLoad: - case spv::Op::OpStore: - case spv::Op::OpCompositeConstruct: - case spv::Op::OpFunctionCall: - ++opCounter[enumCast(opCode)]; - idCounter = 0; - thisOpCode = opCode; - break; - default: - thisOpCode = spv::Op::OpNop; - } - - return false; - }, - - [&](spv::Id& id) { - if (thisOpCode != spv::Op::OpNop) { - ++idCounter; - const std::uint32_t hashval = - // Explicitly cast operands to unsigned int to avoid integer - // promotion to signed int followed by integer overflow, - // which would result in undefined behavior. - static_cast(opCounter[enumCast(thisOpCode)]) - * enumCast(thisOpCode) - * 50047 - + idCounter - + static_cast(fnId) * 117; - - if (isOldIdUnmapped(id)) - localId(id, nextUnusedId(hashval % softTypeIdLimit + firstMappedID)); - } - }); - } - - // EXPERIMENTAL: forward IO and uniform load/stores into operands - // This produces invalid Schema-0 SPIRV - void spirvbin_t::forwardLoadStores() - { - idset_t fnLocalVars; // set of function local vars - idmap_t idMap; // Map of load result IDs to what they load - - // EXPERIMENTAL: Forward input and access chain loads into consumptions - process( - [&](spv::Op opCode, unsigned start) { - // Add inputs and uniforms to the map - if ((opCode == spv::Op::OpVariable && asWordCount(start) == 4) && - (spv[start+3] == (unsigned)spv::StorageClass::Uniform || - spv[start+3] == (unsigned)spv::StorageClass::UniformConstant || - spv[start+3] == (unsigned)spv::StorageClass::Input)) - fnLocalVars.insert(asId(start+2)); - - if (opCode == spv::Op::OpAccessChain && fnLocalVars.count(asId(start+3)) > 0) - fnLocalVars.insert(asId(start+2)); - - if (opCode == spv::Op::OpLoad && fnLocalVars.count(asId(start+3)) > 0) { - idMap[asId(start+2)] = asId(start+3); - stripInst(start); - } - - return false; - }, - - [&](spv::Id& id) { if (idMap.find(id) != idMap.end()) id = idMap[id]; } - ); - - if (errorLatch) - return; - - // EXPERIMENTAL: Implicit output stores - fnLocalVars.clear(); - idMap.clear(); - - process( - [&](spv::Op opCode, unsigned start) { - // Add inputs and uniforms to the map - if ((opCode == spv::Op::OpVariable && asWordCount(start) == 4) && - (spv[start+3] == (int)spv::StorageClass::Output)) - fnLocalVars.insert(asId(start+2)); - - if (opCode == spv::Op::OpStore && fnLocalVars.count(asId(start+1)) > 0) { - idMap[asId(start+2)] = asId(start+1); - stripInst(start); - } - - return false; - }, - op_fn_nop); - - if (errorLatch) - return; - - process( - inst_fn_nop, - [&](spv::Id& id) { if (idMap.find(id) != idMap.end()) id = idMap[id]; } - ); - - if (errorLatch) - return; - - strip(); // strip out data we decided to eliminate - } - - // optimize loads and stores - void spirvbin_t::optLoadStore() - { - idset_t fnLocalVars; // candidates for removal (only locals) - idmap_t idMap; // Map of load result IDs to what they load - blockmap_t blockMap; // Map of IDs to blocks they first appear in - int blockNum = 0; // block count, to avoid crossing flow control - - // Find all the function local pointers stored at most once, and not via access chains - process( - [&](spv::Op opCode, unsigned start) { - const int wordCount = asWordCount(start); - - // Count blocks, so we can avoid crossing flow control - if (isFlowCtrl(opCode)) - ++blockNum; - - // Add local variables to the map - if ((opCode == spv::Op::OpVariable && spv[start+3] == (unsigned)spv::StorageClass::Function && asWordCount(start) == 4)) { - fnLocalVars.insert(asId(start+2)); - return true; - } - - // Ignore process vars referenced via access chain - if ((opCode == spv::Op::OpAccessChain || opCode == spv::Op::OpInBoundsAccessChain) && fnLocalVars.count(asId(start+3)) > 0) { - fnLocalVars.erase(asId(start+3)); - idMap.erase(asId(start+3)); - return true; - } - - if (opCode == spv::Op::OpLoad && fnLocalVars.count(asId(start + 3)) > 0) { - const spv::Id varId = asId(start+3); - - // Avoid loads before stores - if (idMap.find(varId) == idMap.end()) { - fnLocalVars.erase(varId); - idMap.erase(varId); - } - - // don't do for volatile references - if (wordCount > 4 && (spv[start+4] & spv::MemoryAccessMask::Volatile)) { - fnLocalVars.erase(varId); - idMap.erase(varId); - } - - // Handle flow control - if (blockMap.find(varId) == blockMap.end()) { - blockMap[varId] = blockNum; // track block we found it in. - } else if (blockMap[varId] != blockNum) { - fnLocalVars.erase(varId); // Ignore if crosses flow control - idMap.erase(varId); - } - - return true; - } - - if (opCode == spv::Op::OpStore && fnLocalVars.count(asId(start+1)) > 0) { - const spv::Id varId = asId(start+1); - - if (idMap.find(varId) == idMap.end()) { - idMap[varId] = asId(start+2); - } else { - // Remove if it has more than one store to the same pointer - fnLocalVars.erase(varId); - idMap.erase(varId); - } - - // don't do for volatile references - if (wordCount > 3 && (spv[start+3] & spv::MemoryAccessMask::Volatile)) { - fnLocalVars.erase(asId(start+3)); - idMap.erase(asId(start+3)); - } - - // Handle flow control - if (blockMap.find(varId) == blockMap.end()) { - blockMap[varId] = blockNum; // track block we found it in. - } else if (blockMap[varId] != blockNum) { - fnLocalVars.erase(varId); // Ignore if crosses flow control - idMap.erase(varId); - } - - return true; - } - - return false; - }, - - // If local var id used anywhere else, don't eliminate - [&](spv::Id& id) { - if (fnLocalVars.count(id) > 0) { - fnLocalVars.erase(id); - idMap.erase(id); - } - } - ); - - if (errorLatch) - return; - - process( - [&](spv::Op opCode, unsigned start) { - if (opCode == spv::Op::OpLoad && fnLocalVars.count(asId(start+3)) > 0) - idMap[asId(start+2)] = idMap[asId(start+3)]; - return false; - }, - op_fn_nop); - - if (errorLatch) - return; - - // Chase replacements to their origins, in case there is a chain such as: - // 2 = store 1 - // 3 = load 2 - // 4 = store 3 - // 5 = load 4 - // We want to replace uses of 5 with 1. - for (const auto& idPair : idMap) { - spv::Id id = idPair.first; - while (idMap.find(id) != idMap.end()) // Chase to end of chain - id = idMap[id]; - - idMap[idPair.first] = id; // replace with final result - } - - // Remove the load/store/variables for the ones we've discovered - process( - [&](spv::Op opCode, unsigned start) { - if ((opCode == spv::Op::OpLoad && fnLocalVars.count(asId(start+3)) > 0) || - (opCode == spv::Op::OpStore && fnLocalVars.count(asId(start+1)) > 0) || - (opCode == spv::Op::OpVariable && fnLocalVars.count(asId(start+2)) > 0)) { - - stripInst(start); - return true; - } - - return false; - }, - - [&](spv::Id& id) { - if (idMap.find(id) != idMap.end()) id = idMap[id]; - } - ); - - if (errorLatch) - return; - - strip(); // strip out data we decided to eliminate - } - - // remove bodies of uncalled functions - void spirvbin_t::dceFuncs() - { - msg(3, 2, std::string("Removing Dead Functions: ")); - - // TODO: There are more efficient ways to do this. - bool changed = true; - - while (changed) { - changed = false; - - for (auto fn = fnPos.begin(); fn != fnPos.end(); ) { - if (fn->first == entryPoint) { // don't DCE away the entry point! - ++fn; - continue; - } - - const auto call_it = fnCalls.find(fn->first); - - if (call_it == fnCalls.end() || call_it->second == 0) { - changed = true; - stripRange.push_back(fn->second); - - // decrease counts of called functions - process( - [&](spv::Op opCode, unsigned start) { - if (opCode == spv::Op::OpFunctionCall) { - const auto call_it = fnCalls.find(asId(start + 3)); - if (call_it != fnCalls.end()) { - if (--call_it->second <= 0) - fnCalls.erase(call_it); - } - } - - return true; - }, - op_fn_nop, - fn->second.first, - fn->second.second); - - if (errorLatch) - return; - - fn = fnPos.erase(fn); - } else ++fn; - } - } - } - - // remove unused function variables + decorations - void spirvbin_t::dceVars() - { - msg(3, 2, std::string("DCE Vars: ")); - - std::unordered_map varUseCount; - - // Count function variable use - process( - [&](spv::Op opCode, unsigned start) { - if (opCode == spv::Op::OpVariable) { - ++varUseCount[asId(start+2)]; - return true; - } else if (opCode == spv::Op::OpEntryPoint) { - const int wordCount = asWordCount(start); - for (int i = 4; i < wordCount; i++) { - ++varUseCount[asId(start+i)]; - } - return true; - } else - return false; - }, - - [&](spv::Id& id) { if (varUseCount[id]) ++varUseCount[id]; } - ); - - if (errorLatch) - return; - - // Remove single-use function variables + associated decorations and names - process( - [&](spv::Op opCode, unsigned start) { - spv::Id id = spv::NoResult; - if (opCode == spv::Op::OpVariable) - id = asId(start+2); - if (opCode == spv::Op::OpDecorate || opCode == spv::Op::OpName) - id = asId(start+1); - - if (id != spv::NoResult && varUseCount[id] == 1) - stripInst(start); - - return true; - }, - op_fn_nop); - } - - // remove unused types - void spirvbin_t::dceTypes() - { - std::vector isType(bound(), false); - - // for speed, make O(1) way to get to type query (map is log(n)) - for (const auto typeStart : typeConstPos) - isType[asTypeConstId(typeStart)] = true; - - std::unordered_map typeUseCount; - - // This is not the most efficient algorithm, but this is an offline tool, and - // it's easy to write this way. Can be improved opportunistically if needed. - bool changed = true; - while (changed) { - changed = false; - strip(); - typeUseCount.clear(); - - // Count total type usage - process(inst_fn_nop, - [&](spv::Id& id) { if (isType[id]) ++typeUseCount[id]; } - ); - - if (errorLatch) - return; - - // Remove single reference types - for (const auto typeStart : typeConstPos) { - const spv::Id typeId = asTypeConstId(typeStart); - if (typeUseCount[typeId] == 1) { - changed = true; - --typeUseCount[typeId]; - stripInst(typeStart); - } - } - - if (errorLatch) - return; - } - } - -#ifdef NOTDEF - bool spirvbin_t::matchType(const spirvbin_t::globaltypes_t& globalTypes, spv::Id lt, spv::Id gt) const - { - // Find the local type id "lt" and global type id "gt" - const auto lt_it = typeConstPosR.find(lt); - if (lt_it == typeConstPosR.end()) - return false; - - const auto typeStart = lt_it->second; - - // Search for entry in global table - const auto gtype = globalTypes.find(gt); - if (gtype == globalTypes.end()) - return false; - - const auto& gdata = gtype->second; - - // local wordcount and opcode - const int wordCount = asWordCount(typeStart); - const spv::Op opCode = asOpCode(typeStart); - - // no type match if opcodes don't match, or operand count doesn't match - if (opCode != opOpCode(gdata[0]) || wordCount != opWordCount(gdata[0])) - return false; - - const unsigned numOperands = wordCount - 2; // all types have a result - - const auto cmpIdRange = [&](range_t range) { - for (int x=range.first; xsecond; - } - - // Hash types to canonical values. This can return ID collisions (it's a bit - // inevitable): it's up to the caller to handle that gracefully. - std::uint32_t spirvbin_t::hashType(unsigned typeStart) const - { - const unsigned wordCount = asWordCount(typeStart); - const spv::Op opCode = asOpCode(typeStart); - - switch (opCode) { - case spv::Op::OpTypeVoid: return 0; - case spv::Op::OpTypeBool: return 1; - case spv::Op::OpTypeInt: return 3 + (spv[typeStart+3]); - case spv::Op::OpTypeFloat: return 5; - case spv::Op::OpTypeVector: - return 6 + hashType(idPos(spv[typeStart+2])) * (spv[typeStart+3] - 1); - case spv::Op::OpTypeMatrix: - return 30 + hashType(idPos(spv[typeStart+2])) * (spv[typeStart+3] - 1); - case spv::Op::OpTypeImage: - return 120 + hashType(idPos(spv[typeStart+2])) + - spv[typeStart+3] + // dimensionality - spv[typeStart+4] * 8 * 16 + // depth - spv[typeStart+5] * 4 * 16 + // arrayed - spv[typeStart+6] * 2 * 16 + // multisampled - spv[typeStart+7] * 1 * 16; // format - case spv::Op::OpTypeSampler: - return 500; - case spv::Op::OpTypeSampledImage: - return 502; - case spv::Op::OpTypeArray: - return 501 + hashType(idPos(spv[typeStart+2])) * spv[typeStart+3]; - case spv::Op::OpTypeRuntimeArray: - return 5000 + hashType(idPos(spv[typeStart+2])); - case spv::Op::OpTypeStruct: - { - std::uint32_t hash = 10000; - for (unsigned w=2; w < wordCount; ++w) - hash += w * hashType(idPos(spv[typeStart+w])); - return hash; - } - - case spv::Op::OpTypeOpaque: return 6000 + spv[typeStart+2]; - case spv::Op::OpTypePointer: return 100000 + hashType(idPos(spv[typeStart+3])); - case spv::Op::OpTypeFunction: - { - std::uint32_t hash = 200000; - for (unsigned w=2; w < wordCount; ++w) - hash += w * hashType(idPos(spv[typeStart+w])); - return hash; - } - - case spv::Op::OpTypeEvent: return 300000; - case spv::Op::OpTypeDeviceEvent: return 300001; - case spv::Op::OpTypeReserveId: return 300002; - case spv::Op::OpTypeQueue: return 300003; - case spv::Op::OpTypePipe: return 300004; - case spv::Op::OpConstantTrue: return 300007; - case spv::Op::OpConstantFalse: return 300008; - case spv::Op::OpTypeRayQueryKHR: return 300009; - case spv::Op::OpTypeAccelerationStructureKHR: return 300010; - case spv::Op::OpConstantComposite: - { - std::uint32_t hash = 300011 + hashType(idPos(spv[typeStart+1])); - for (unsigned w=3; w < wordCount; ++w) - hash += w * hashType(idPos(spv[typeStart+w])); - return hash; - } - case spv::Op::OpConstant: - { - std::uint32_t hash = 400011 + hashType(idPos(spv[typeStart+1])); - for (unsigned w=3; w < wordCount; ++w) - hash += w * spv[typeStart+w]; - return hash; - } - case spv::Op::OpConstantNull: - { - std::uint32_t hash = 500009 + hashType(idPos(spv[typeStart+1])); - return hash; - } - case spv::Op::OpConstantSampler: - { - std::uint32_t hash = 600011 + hashType(idPos(spv[typeStart+1])); - for (unsigned w=3; w < wordCount; ++w) - hash += w * spv[typeStart+w]; - return hash; - } - - default: - error("unknown type opcode"); - return 0; - } - } - - void spirvbin_t::mapTypeConst() - { - globaltypes_t globalTypeMap; - - msg(3, 2, std::string("Remapping Consts & Types: ")); - - static const std::uint32_t softTypeIdLimit = 3011; // small prime. TODO: get from options - static const std::uint32_t firstMappedID = 8; // offset into ID space - - for (auto& typeStart : typeConstPos) { - const spv::Id resId = asTypeConstId(typeStart); - const std::uint32_t hashval = hashType(typeStart); - - if (errorLatch) - return; - - if (isOldIdUnmapped(resId)) { - localId(resId, nextUnusedId(hashval % softTypeIdLimit + firstMappedID)); - if (errorLatch) - return; - } - } - } - - // Strip a single binary by removing ranges given in stripRange - void spirvbin_t::strip() - { - if (stripRange.empty()) // nothing to do - return; - - // Sort strip ranges in order of traversal - std::sort(stripRange.begin(), stripRange.end()); - - // Allocate a new binary big enough to hold old binary - // We'll step this iterator through the strip ranges as we go through the binary - auto strip_it = stripRange.begin(); - - int strippedPos = 0; - for (unsigned word = 0; word < unsigned(spv.size()); ++word) { - while (strip_it != stripRange.end() && word >= strip_it->second) - ++strip_it; - - if (strip_it == stripRange.end() || word < strip_it->first || word >= strip_it->second) - spv[strippedPos++] = spv[word]; - } - - spv.resize(strippedPos); - stripRange.clear(); - - buildLocalMaps(); - } - - // Strip a single binary by removing ranges given in stripRange - void spirvbin_t::remap(std::uint32_t opts) - { - options = opts; - - // Set up opcode tables from SpvDoc - spv::Parameterize(); - - validate(); // validate header - buildLocalMaps(); // build ID maps - - msg(3, 4, std::string("ID bound: ") + std::to_string(bound())); - - if (options & STRIP) stripDebug(); - if (errorLatch) return; - - strip(); // strip out data we decided to eliminate - if (errorLatch) return; - - if (options & OPT_LOADSTORE) optLoadStore(); - if (errorLatch) return; - - if (options & OPT_FWD_LS) forwardLoadStores(); - if (errorLatch) return; - - if (options & DCE_FUNCS) dceFuncs(); - if (errorLatch) return; - - if (options & DCE_VARS) dceVars(); - if (errorLatch) return; - - if (options & DCE_TYPES) dceTypes(); - if (errorLatch) return; - - strip(); // strip out data we decided to eliminate - if (errorLatch) return; - - stripDeadRefs(); // remove references to things we DCEed - if (errorLatch) return; - - // after the last strip, we must clean any debug info referring to now-deleted data - - if (options & MAP_TYPES) mapTypeConst(); - if (errorLatch) return; - - if (options & MAP_NAMES) mapNames(); - if (errorLatch) return; - - if (options & MAP_FUNCS) mapFnBodies(); - if (errorLatch) return; - - if (options & MAP_ALL) { - mapRemainder(); // map any unmapped IDs - if (errorLatch) return; - - applyMap(); // Now remap each shader to the new IDs we've come up with - if (errorLatch) return; - } - } - - // remap from a memory image - void spirvbin_t::remap(std::vector& in_spv, const std::vector& whiteListStrings, - std::uint32_t opts) - { - stripWhiteList = whiteListStrings; - spv.swap(in_spv); - remap(opts); - spv.swap(in_spv); - } - - // remap from a memory image - legacy interface without white list - void spirvbin_t::remap(std::vector& in_spv, std::uint32_t opts) - { - stripWhiteList.clear(); - spv.swap(in_spv); - remap(opts); - spv.swap(in_spv); - } - -} // namespace SPV - diff --git a/third_party/glslang/SPIRV/SPVRemapper.h b/third_party/glslang/SPIRV/SPVRemapper.h deleted file mode 100644 index d4c2295c9c..0000000000 --- a/third_party/glslang/SPIRV/SPVRemapper.h +++ /dev/null @@ -1,300 +0,0 @@ -// -// Copyright (C) 2015 LunarG, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -#ifndef SPIRVREMAPPER_H -#define SPIRVREMAPPER_H - -#include -#include -#include -#include - -#ifdef GLSLANG_IS_SHARED_LIBRARY - #ifdef _WIN32 - #ifdef GLSLANG_EXPORTING - #define GLSLANG_EXPORT __declspec(dllexport) - #else - #define GLSLANG_EXPORT __declspec(dllimport) - #endif - #elif __GNUC__ >= 4 - #define GLSLANG_EXPORT __attribute__((visibility("default"))) - #endif -#endif // GLSLANG_IS_SHARED_LIBRARY -#ifndef GLSLANG_EXPORT -#define GLSLANG_EXPORT -#endif - -namespace spv { - -class spirvbin_base_t -{ -public: - enum Options { - NONE = 0, - STRIP = (1<<0), - MAP_TYPES = (1<<1), - MAP_NAMES = (1<<2), - MAP_FUNCS = (1<<3), - DCE_FUNCS = (1<<4), - DCE_VARS = (1<<5), - DCE_TYPES = (1<<6), - OPT_LOADSTORE = (1<<7), - OPT_FWD_LS = (1<<8), // EXPERIMENTAL: PRODUCES INVALID SCHEMA-0 SPIRV - MAP_ALL = (MAP_TYPES | MAP_NAMES | MAP_FUNCS), - DCE_ALL = (DCE_FUNCS | DCE_VARS | DCE_TYPES), - OPT_ALL = (OPT_LOADSTORE), - - ALL_BUT_STRIP = (MAP_ALL | DCE_ALL | OPT_ALL), - DO_EVERYTHING = (STRIP | ALL_BUT_STRIP) - }; -}; - -} // namespace SPV - -#include -#include -#include -#include -#include -#include -#include - -#include "spirv.hpp11" - -namespace spv { - -static inline constexpr Id NoResult = 0; - -// class to hold SPIR-V binary data for remapping, DCE, and debug stripping -class GLSLANG_EXPORT spirvbin_t : public spirvbin_base_t -{ -public: - spirvbin_t(int verbose = 0) : entryPoint(spv::NoResult), largestNewId(0), verbose(verbose), errorLatch(false) - { } - - virtual ~spirvbin_t() { } - - // remap on an existing binary in memory - void remap(std::vector& spv, const std::vector& whiteListStrings, - std::uint32_t opts = DO_EVERYTHING); - - // remap on an existing binary in memory - legacy interface without white list - void remap(std::vector& spv, std::uint32_t opts = DO_EVERYTHING); - - // Type for error/log handler functions - typedef std::function errorfn_t; - typedef std::function logfn_t; - - // Register error/log handling functions (can be lambda fn / functor / etc) - static void registerErrorHandler(errorfn_t handler) { errorHandler = handler; } - static void registerLogHandler(logfn_t handler) { logHandler = handler; } - -protected: - // This can be overridden to provide other message behavior if needed - virtual void msg(int minVerbosity, int indent, const std::string& txt) const; - -private: - // Local to global, or global to local ID map - typedef std::unordered_map idmap_t; - typedef std::unordered_set idset_t; - typedef std::unordered_map blockmap_t; - - void remap(std::uint32_t opts = DO_EVERYTHING); - - // Map of names to IDs - typedef std::unordered_map namemap_t; - - typedef std::uint32_t spirword_t; - - typedef std::pair range_t; - typedef std::function idfn_t; - typedef std::function instfn_t; - - // Special Values for ID map: - static const spv::Id unmapped; // unchanged from default value - static const spv::Id unused; // unused ID - static const int header_size; // SPIR header = 5 words - - class id_iterator_t; - - // For mapping type entries between different shaders - typedef std::vector typeentry_t; - typedef std::map globaltypes_t; - - // A set that preserves position order, and a reverse map - typedef std::set posmap_t; - typedef std::unordered_map posmap_rev_t; - - // Maps and ID to the size of its base type, if known. - typedef std::unordered_map typesize_map_t; - - // handle error - void error(const std::string& txt) const { errorLatch = true; errorHandler(txt); } - - bool isConstOp(spv::Op opCode) const; - bool isTypeOp(spv::Op opCode) const; - bool isStripOp(spv::Op opCode) const; - bool isFlowCtrl(spv::Op opCode) const; - range_t literalRange(spv::Op opCode) const; - range_t typeRange(spv::Op opCode) const; - range_t constRange(spv::Op opCode) const; - unsigned typeSizeInWords(spv::Id id) const; - unsigned idTypeSizeInWords(spv::Id id) const; - - bool isStripOp(spv::Op opCode, unsigned start) const; - - spv::Id& asId(unsigned word) { return spv[word]; } - const spv::Id& asId(unsigned word) const { return spv[word]; } - spv::Op asOpCode(unsigned word) const { return opOpCode(spv[word]); } - std::uint32_t asOpCodeHash(unsigned word); - spv::Decoration asDecoration(unsigned word) const { return spv::Decoration(spv[word]); } - unsigned asWordCount(unsigned word) const { return opWordCount(spv[word]); } - spv::Id asTypeConstId(unsigned word) const { return asId(word + (isTypeOp(asOpCode(word)) ? 1 : 2)); } - unsigned idPos(spv::Id id) const; - - static unsigned opWordCount(spirword_t data) { return data >> spv::WordCountShift; } - static spv::Op opOpCode(spirword_t data) { return spv::Op(data & spv::OpCodeMask); } - - // Header access & set methods - spirword_t magic() const { return spv[0]; } // return magic number - spirword_t bound() const { return spv[3]; } // return Id bound from header - spirword_t bound(spirword_t b) { return spv[3] = b; } - spirword_t genmagic() const { return spv[2]; } // generator magic - spirword_t genmagic(spirword_t m) { return spv[2] = m; } - spirword_t schemaNum() const { return spv[4]; } // schema number from header - - // Mapping fns: get - spv::Id localId(spv::Id id) const { return idMapL[id]; } - - // Mapping fns: set - inline spv::Id localId(spv::Id id, spv::Id newId); - void countIds(spv::Id id); - - // Return next unused new local ID. - // NOTE: boost::dynamic_bitset would be more efficient due to find_next(), - // which std::vector doens't have. - inline spv::Id nextUnusedId(spv::Id id); - - void buildLocalMaps(); - std::string literalString(unsigned word) const; // Return literal as a std::string - int literalStringWords(const std::string& str) const { return (int(str.size())+4)/4; } - - bool isNewIdMapped(spv::Id newId) const { return isMapped(newId); } - bool isOldIdUnmapped(spv::Id oldId) const { return localId(oldId) == unmapped; } - bool isOldIdUnused(spv::Id oldId) const { return localId(oldId) == unused; } - bool isOldIdMapped(spv::Id oldId) const { return !isOldIdUnused(oldId) && !isOldIdUnmapped(oldId); } - bool isFunction(spv::Id oldId) const { return fnPos.find(oldId) != fnPos.end(); } - - // bool matchType(const globaltypes_t& globalTypes, spv::Id lt, spv::Id gt) const; - // spv::Id findType(const globaltypes_t& globalTypes, spv::Id lt) const; - std::uint32_t hashType(unsigned typeStart) const; - - spirvbin_t& process(instfn_t, idfn_t, unsigned begin = 0, unsigned end = 0); - int processInstruction(unsigned word, instfn_t, idfn_t); - - void validate() const; - void mapTypeConst(); - void mapFnBodies(); - void optLoadStore(); - void dceFuncs(); - void dceVars(); - void dceTypes(); - void mapNames(); - void foldIds(); // fold IDs to smallest space - void forwardLoadStores(); // load store forwarding (EXPERIMENTAL) - void offsetIds(); // create relative offset IDs - - void applyMap(); // remap per local name map - void mapRemainder(); // map any IDs we haven't touched yet - void stripDebug(); // strip all debug info - void stripDeadRefs(); // strips debug info for now-dead references after DCE - void strip(); // remove debug symbols - - std::vector spv; // SPIR words - - std::vector stripWhiteList; - - namemap_t nameMap; // ID names from OpName - - // Since we want to also do binary ops, we can't use std::vector. we could use - // boost::dynamic_bitset, but we're trying to avoid a boost dependency. - typedef std::uint64_t bits_t; - std::vector mapped; // which new IDs have been mapped - static const int mBits = sizeof(bits_t) * 4; - - bool isMapped(spv::Id id) const { return id < maxMappedId() && ((mapped[id/mBits] & (1LL<<(id%mBits))) != 0); } - void setMapped(spv::Id id) { resizeMapped(id); mapped[id/mBits] |= (1LL<<(id%mBits)); } - void resizeMapped(spv::Id id) { if (id >= maxMappedId()) mapped.resize(id/mBits+1, 0); } - size_t maxMappedId() const { return mapped.size() * mBits; } - - // Add a strip range for a given instruction starting at 'start' - // Note: avoiding brace initializers to please older versions os MSVC. - void stripInst(unsigned start) { stripRange.push_back(range_t(start, start + asWordCount(start))); } - - // Function start and end. use unordered_map because we'll have - // many fewer functions than IDs. - std::unordered_map fnPos; - - // Which functions are called, anywhere in the module, with a call count - std::unordered_map fnCalls; - - posmap_t typeConstPos; // word positions that define types & consts (ordered) - posmap_rev_t idPosR; // reverse map from IDs to positions - typesize_map_t idTypeSizeMap; // maps each ID to its type size, if known. - - std::vector idMapL; // ID {M}ap from {L}ocal to {G}lobal IDs - - spv::Id entryPoint; // module entry point - spv::Id largestNewId; // biggest new ID we have mapped anything to - - // Sections of the binary to strip, given as [begin,end) - std::vector stripRange; - - // processing options: - std::uint32_t options; - int verbose; // verbosity level - - // Error latch: this is set if the error handler is ever executed. It would be better to - // use a try/catch block and throw, but that's not desired for certain environments, so - // this is the alternative. - mutable bool errorLatch; - - static errorfn_t errorHandler; - static logfn_t logHandler; -}; - -} // namespace SPV - -#endif // SPIRVREMAPPER_H diff --git a/third_party/glslang/SPIRV/SpvBuilder.cpp b/third_party/glslang/SPIRV/SpvBuilder.cpp index 5a5affacd4..52e484c260 100644 --- a/third_party/glslang/SPIRV/SpvBuilder.cpp +++ b/third_party/glslang/SPIRV/SpvBuilder.cpp @@ -97,7 +97,7 @@ Id Builder::makeVoidType() module.mapInstruction(type); // Core OpTypeVoid used for debug void type if (emitNonSemanticShaderDebugInfo) - debugId[typeId] = typeId; + debugTypeIdLookup[typeId] = typeId; } else type = groupedTypes[enumCast(Op::OpTypeVoid)].back(); @@ -115,7 +115,7 @@ Id Builder::makeBoolType() if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeBoolDebugType(32); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } } else @@ -125,7 +125,7 @@ Id Builder::makeBoolType() return type->getResultId(); } -Id Builder::makeSamplerType() +Id Builder::makeSamplerType(const char* debugName) { Instruction* type; if (groupedTypes[enumCast(Op::OpTypeSampler)].size() == 0) { @@ -138,8 +138,8 @@ Id Builder::makeSamplerType() if (emitNonSemanticShaderDebugInfo) { - auto const debugResultId = makeCompositeDebugType({}, "type.sampler", NonSemanticShaderDebugInfo100Structure, true); - debugId[type->getResultId()] = debugResultId; + auto const debugResultId = makeOpaqueDebugType(debugName); + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -167,7 +167,7 @@ Id Builder::makePointer(StorageClass storageClass, Id pointee) if (emitNonSemanticShaderDebugInfo) { const Id debugResultId = makePointerDebugType(storageClass, pointee); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -185,11 +185,32 @@ Id Builder::makeForwardPointer(StorageClass storageClass) if (emitNonSemanticShaderDebugInfo) { const Id debugResultId = makeForwardPointerDebugType(storageClass); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); } +Id Builder::makeUntypedPointer(StorageClass storageClass, bool setBufferPointer) +{ + // try to find it + Instruction* type; + // both typeBufferEXT and UntypedPointer only contains storage class info. + spv::Op typeOp = setBufferPointer ? Op::OpTypeBufferEXT : Op::OpTypeUntypedPointerKHR; + for (int t = 0; t < (int)groupedTypes[enumCast(typeOp)].size(); ++t) { + type = groupedTypes[enumCast(typeOp)][t]; + if (type->getImmediateOperand(0) == (unsigned)storageClass) + return type->getResultId(); + } + + // not found, make it + type = new Instruction(getUniqueId(), NoType, typeOp); + type->addImmediateOperand(storageClass); + groupedTypes[enumCast(typeOp)].push_back(type); + constantsTypesGlobals.push_back(std::unique_ptr(type)); + module.mapInstruction(type); + return type->getResultId(); +} + Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardPointerType, Id pointee) { // try to find it @@ -213,9 +234,9 @@ Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardP // that was emitted alongside the forward pointer, now that we have a pointee debug // type for it to point to. if (emitNonSemanticShaderDebugInfo) { - Instruction *debugForwardPointer = module.getInstruction(debugId[forwardPointerType]); - assert(debugId[pointee]); - debugForwardPointer->setIdOperand(2, debugId[pointee]); + Instruction *debugForwardPointer = module.getInstruction(getDebugType(forwardPointerType)); + assert(getDebugType(pointee)); + debugForwardPointer->setIdOperand(2, getDebugType(pointee)); } return type->getResultId(); @@ -257,7 +278,7 @@ Id Builder::makeIntegerType(int width, bool hasSign) if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeIntegerDebugType(width, hasSign); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -298,7 +319,7 @@ Id Builder::makeFloatType(int width) if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeFloatDebugType(width); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -334,7 +355,7 @@ Id Builder::makeBFloat16Type() if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeFloatDebugType(width); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } #endif @@ -371,7 +392,7 @@ Id Builder::makeFloatE5M2Type() if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeFloatDebugType(width); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } #endif @@ -408,7 +429,7 @@ Id Builder::makeFloatE4M3Type() if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeFloatDebugType(width); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } #endif @@ -419,7 +440,9 @@ Id Builder::makeFloatE4M3Type() // See makeStructResultType() for non-decorated structs // needed as the result of some instructions, which does // check for duplicates. -Id Builder::makeStructType(const std::vector& members, const char* name, bool const compilerGenerated) +// For compiler-generated structs, debug info is ignored. +Id Builder::makeStructType(const std::vector& members, const std::vector& memberDebugInfo, + const char* name, bool const compilerGenerated) { // Don't look for previous one, because in the general case, // structs can be duplicated except for decorations. @@ -433,10 +456,11 @@ Id Builder::makeStructType(const std::vector& members, const char* name, boo module.mapInstruction(type); addName(type->getResultId(), name); - if (emitNonSemanticShaderDebugInfo && !compilerGenerated) - { - auto const debugResultId = makeCompositeDebugType(members, name, NonSemanticShaderDebugInfo100Structure); - debugId[type->getResultId()] = debugResultId; + if (emitNonSemanticShaderDebugInfo && !compilerGenerated) { + assert(members.size() == memberDebugInfo.size()); + auto const debugResultId = + makeCompositeDebugType(members, memberDebugInfo, name, NonSemanticShaderDebugInfo100Structure); + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -463,7 +487,7 @@ Id Builder::makeStructResultType(Id type0, Id type1) members.push_back(type0); members.push_back(type1); - return makeStructType(members, "ResType"); + return makeStructType(members, {}, "ResType"); } Id Builder::makeVectorType(Id component, int size) @@ -489,7 +513,7 @@ Id Builder::makeVectorType(Id component, int size) if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeVectorDebugType(component, size); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -522,7 +546,7 @@ Id Builder::makeMatrixType(Id component, int cols, int rows) if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeMatrixDebugType(column, cols); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -559,7 +583,7 @@ Id Builder::makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id col // Find a name for one of the parameters. It can either come from debuginfo for another // type, or an OpName from a constant. auto const findName = [&](Id id) { - Id id2 = debugId[id]; + Id id2 = getDebugType(id); for (auto &t : groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic]) { if (t->getResultId() == id2) { for (auto &s : strings) { @@ -587,8 +611,8 @@ Id Builder::makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id col debugName += std::string(findName(cols)) + ">"; // There's no nonsemantic debug info instruction for cooperative matrix types, // use opaque composite instead. - auto const debugResultId = makeCompositeDebugType({}, debugName.c_str(), NonSemanticShaderDebugInfo100Structure, true); - debugId[type->getResultId()] = debugResultId; + auto const debugResultId = makeOpaqueDebugType(debugName.c_str()); + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -739,7 +763,7 @@ Id Builder::makeArrayType(Id element, Id sizeId, int stride) if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeArrayDebugType(element, sizeId); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -755,7 +779,7 @@ Id Builder::makeRuntimeArray(Id element) if (emitNonSemanticShaderDebugInfo) { auto const debugResultId = makeArrayDebugType(element, makeUintConstant(0)); - debugId[type->getResultId()] = debugResultId; + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -782,12 +806,12 @@ Id Builder::makeFunctionType(Id returnType, const std::vector& paramTypes) // function type is created for the wrapper function. However, nonsemantic shader debug information is disabled // while creating the HLSL wrapper. Consequently, if we encounter another void(void) function, we need to create // the associated debug function type if it hasn't been created yet. - if(emitNonSemanticShaderDebugInfo && debugId[type->getResultId()] == 0) { + if(emitNonSemanticShaderDebugInfo && getDebugType(type->getResultId()) == NoType) { assert(sourceLang == spv::SourceLanguage::HLSL); assert(getTypeClass(returnType) == Op::OpTypeVoid && paramTypes.size() == 0); - Id debugTypeId = makeDebugFunctionType(returnType, {}); - debugId[type->getResultId()] = debugTypeId; + Id id = makeDebugFunctionType(returnType, {}); + debugTypeIdLookup[type->getResultId()] = id; } return type->getResultId(); } @@ -807,7 +831,7 @@ Id Builder::makeFunctionType(Id returnType, const std::vector& paramTypes) // make debug type and map it if (emitNonSemanticShaderDebugInfo) { Id debugTypeId = makeDebugFunctionType(returnType, paramTypes); - debugId[typeId] = debugTypeId; + debugTypeIdLookup[typeId] = debugTypeId; } return type->getResultId(); @@ -815,7 +839,7 @@ Id Builder::makeFunctionType(Id returnType, const std::vector& paramTypes) Id Builder::makeDebugFunctionType(Id returnType, const std::vector& paramTypes) { - assert(debugId[returnType] != 0); + assert(getDebugType(returnType) != NoType); Id typeId = getUniqueId(); auto type = new Instruction(typeId, makeVoidType(), Op::OpExtInst); @@ -823,13 +847,13 @@ Id Builder::makeDebugFunctionType(Id returnType, const std::vector& paramTyp type->addIdOperand(nonSemanticShaderDebugInfo); type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeFunction); type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); - type->addIdOperand(debugId[returnType]); + type->addIdOperand(getDebugType(returnType)); for (auto const paramType : paramTypes) { if (isPointerType(paramType) || isArrayType(paramType)) { - type->addIdOperand(debugId[getContainedTypeId(paramType)]); + type->addIdOperand(getDebugType(getContainedTypeId(paramType))); } else { - type->addIdOperand(debugId[paramType]); + type->addIdOperand(getDebugType(paramType)); } } constantsTypesGlobals.push_back(std::unique_ptr(type)); @@ -838,7 +862,7 @@ Id Builder::makeDebugFunctionType(Id returnType, const std::vector& paramTyp } Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled, - ImageFormat format) + ImageFormat format, const char* debugName) { assert(sampled == 1 || sampled == 2); @@ -919,24 +943,14 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo if (emitNonSemanticShaderDebugInfo) { - auto TypeName = [&dim]() -> char const* { - switch (dim) { - case Dim::Dim1D: return "type.1d.image"; - case Dim::Dim2D: return "type.2d.image"; - case Dim::Dim3D: return "type.3d.image"; - case Dim::Cube: return "type.cube.image"; - default: return "type.image"; - } - }; - - auto const debugResultId = makeCompositeDebugType({}, TypeName(), NonSemanticShaderDebugInfo100Class, true); - debugId[type->getResultId()] = debugResultId; + auto const debugResultId = makeOpaqueDebugType(debugName); + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); } -Id Builder::makeSampledImageType(Id imageType) +Id Builder::makeSampledImageType(Id imageType, const char* debugName) { // try to find it Instruction* type; @@ -956,8 +970,8 @@ Id Builder::makeSampledImageType(Id imageType) if (emitNonSemanticShaderDebugInfo) { - auto const debugResultId = makeCompositeDebugType({}, "type.sampled.image", NonSemanticShaderDebugInfo100Class, true); - debugId[type->getResultId()] = debugResultId; + auto const debugResultId = makeOpaqueDebugType(debugName); + debugTypeIdLookup[type->getResultId()] = debugResultId; } return type->getResultId(); @@ -1106,7 +1120,7 @@ Id Builder::makeSequentialDebugType(Id const baseType, Id const componentCount, type->reserveOperands(4); type->addIdOperand(nonSemanticShaderDebugInfo); type->addImmediateOperand(sequenceType); - type->addIdOperand(debugId[baseType]); // base type + type->addIdOperand(getDebugType(baseType)); // base type type->addIdOperand(componentCount); // component count groupedDebugTypes[sequenceType].push_back(type); @@ -1142,7 +1156,7 @@ Id Builder::makeMatrixDebugType(Id const vectorType, int const vectorCount, bool type->reserveOperands(5); type->addIdOperand(nonSemanticShaderDebugInfo); type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeMatrix); - type->addIdOperand(debugId[vectorType]); // vector type id + type->addIdOperand(getDebugType(vectorType)); // vector type id type->addIdOperand(makeUintConstant(vectorCount)); // component count id type->addIdOperand(makeBoolConstant(columnMajor)); // column-major id @@ -1153,21 +1167,22 @@ Id Builder::makeMatrixDebugType(Id const vectorType, int const vectorCount, bool return type->getResultId(); } -Id Builder::makeMemberDebugType(Id const memberType, DebugTypeLoc const& debugTypeLoc) +Id Builder::makeMemberDebugType(Id const memberType, StructMemberDebugInfo const& debugTypeLoc) { - assert(debugId[memberType] != 0); + assert(getDebugType(memberType) != NoType); Instruction* type = new Instruction(getUniqueId(), makeVoidType(), Op::OpExtInst); type->reserveOperands(10); type->addIdOperand(nonSemanticShaderDebugInfo); type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeMember); type->addIdOperand(getStringId(debugTypeLoc.name)); // name id - type->addIdOperand(debugId[memberType]); // type id - type->addIdOperand(makeDebugSource(currentFileId)); // source id - type->addIdOperand(makeUintConstant(debugTypeLoc.line)); // line id TODO: currentLine is always zero + type->addIdOperand(debugTypeLoc.debugTypeOverride != 0 ? debugTypeLoc.debugTypeOverride + : getDebugType(memberType)); // type id + type->addIdOperand(makeDebugSource(currentFileId)); // source id + type->addIdOperand(makeUintConstant(debugTypeLoc.line)); // line id TODO: currentLine is always zero type->addIdOperand(makeUintConstant(debugTypeLoc.column)); // TODO: column id - type->addIdOperand(makeUintConstant(0)); // TODO: offset id - type->addIdOperand(makeUintConstant(0)); // TODO: size id + type->addIdOperand(makeUintConstant(0)); // TODO: offset id + type->addIdOperand(makeUintConstant(0)); // TODO: size id type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); // flags id groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeMember].push_back(type); @@ -1177,23 +1192,16 @@ Id Builder::makeMemberDebugType(Id const memberType, DebugTypeLoc const& debugTy return type->getResultId(); } -// Note: To represent a source language opaque type, this instruction must have no Members operands, Size operand must be -// DebugInfoNone, and Name must start with @ to avoid clashes with user defined names. -Id Builder::makeCompositeDebugType(std::vector const& memberTypes, char const*const name, - NonSemanticShaderDebugInfo100DebugCompositeType const tag, bool const isOpaqueType) +Id Builder::makeCompositeDebugType(std::vector const& memberTypes, std::vector const& memberDebugInfo, + char const* const name, NonSemanticShaderDebugInfo100DebugCompositeType const tag) { // Create the debug member types. std::vector memberDebugTypes; - for(auto const memberType : memberTypes) { - assert(debugTypeLocs.find(memberType) != debugTypeLocs.end()); - - // There _should_ be debug types for all the member types but currently buffer references - // do not have member debug info generated. - if (debugId[memberType]) - memberDebugTypes.emplace_back(makeMemberDebugType(memberType, debugTypeLocs[memberType])); - - // TODO: Need to rethink this method of passing location information. - // debugTypeLocs.erase(memberType); + assert(memberTypes.size() == memberDebugInfo.size()); + for (size_t i = 0; i < memberTypes.size(); i++) { + if (getDebugType(memberTypes[i]) != NoType) { + memberDebugTypes.emplace_back(makeMemberDebugType(memberTypes[i], memberDebugInfo[i])); + } } // Create The structure debug type. @@ -1207,16 +1215,9 @@ Id Builder::makeCompositeDebugType(std::vector const& memberTypes, char cons type->addIdOperand(makeUintConstant(currentLine)); // line id TODO: currentLine always zero? type->addIdOperand(makeUintConstant(0)); // TODO: column id type->addIdOperand(makeDebugCompilationUnit()); // scope id - if(isOpaqueType == true) { - // Prepend '@' to opaque types. - type->addIdOperand(getStringId('@' + std::string(name))); // linkage name id - type->addIdOperand(makeDebugInfoNone()); // size id - } else { - type->addIdOperand(getStringId(name)); // linkage name id - type->addIdOperand(makeUintConstant(0)); // TODO: size id - } + type->addIdOperand(getStringId(name)); // linkage name id + type->addIdOperand(makeUintConstant(0)); // TODO: size id type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); // flags id - assert(isOpaqueType == false || (isOpaqueType == true && memberDebugTypes.empty())); for(auto const memberDebugType : memberDebugTypes) { type->addIdOperand(memberDebugType); } @@ -1228,9 +1229,37 @@ Id Builder::makeCompositeDebugType(std::vector const& memberTypes, char cons return type->getResultId(); } +// The NonSemantic Shader Debug Info doesn't really have a dedicated opcode for opaque types. Instead, we use DebugTypeComposite. +// To represent a source language opaque type, this instruction must have no Members operands, Size operand must be +// DebugInfoNone, and Name must start with @ to avoid clashes with user defined names. +Id Builder::makeOpaqueDebugType(char const* const name) +{ + // Create The structure debug type. + Instruction* type = new Instruction(getUniqueId(), makeVoidType(), Op::OpExtInst); + type->reserveOperands(11); + type->addIdOperand(nonSemanticShaderDebugInfo); + type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeComposite); + type->addIdOperand(getStringId(name)); // name id + type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100Structure)); // tag id + type->addIdOperand(makeDebugSource(currentFileId)); // source id + type->addIdOperand(makeUintConstant(currentLine)); // line id TODO: currentLine always zero? + type->addIdOperand(makeUintConstant(0)); // TODO: column id + type->addIdOperand(makeDebugCompilationUnit()); // scope id + // Prepend '@' to opaque types. + type->addIdOperand(getStringId('@' + std::string(name))); // linkage name id + type->addIdOperand(makeDebugInfoNone()); // size id + type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); // flags id + + groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeComposite].push_back(type); + constantsTypesGlobals.push_back(std::unique_ptr(type)); + module.mapInstruction(type); + + return type->getResultId(); +} + Id Builder::makePointerDebugType(StorageClass storageClass, Id const baseType) { - const Id debugBaseType = debugId[baseType]; + const Id debugBaseType = getDebugType(baseType); if (!debugBaseType) { return makeDebugInfoNone(); } @@ -1401,7 +1430,7 @@ Id Builder::createDebugLocalVariable(Id type, char const*const name, size_t cons inst->addIdOperand(currentDebugScopeId.top()); // scope id inst->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsLocal)); // flags id if(argNumber != 0) { - inst->addIdOperand(makeUintConstant(argNumber)); + inst->addIdOperand(makeUintConstant(static_cast(argNumber))); } constantsTypesGlobals.push_back(std::unique_ptr(inst)); @@ -1465,8 +1494,8 @@ Id Builder::makeAccelerationStructureType() constantsTypesGlobals.push_back(std::unique_ptr(type)); module.mapInstruction(type); if (emitNonSemanticShaderDebugInfo) { - spv::Id debugType = makeCompositeDebugType({}, "accelerationStructure", NonSemanticShaderDebugInfo100Structure, true); - debugId[type->getResultId()] = debugType; + spv::Id debugType = makeOpaqueDebugType("accelerationStructure"); + debugTypeIdLookup[type->getResultId()] = debugType; } } else { type = groupedTypes[enumCast(Op::OpTypeAccelerationStructureKHR)].back(); @@ -1484,8 +1513,8 @@ Id Builder::makeRayQueryType() constantsTypesGlobals.push_back(std::unique_ptr(type)); module.mapInstruction(type); if (emitNonSemanticShaderDebugInfo) { - spv::Id debugType = makeCompositeDebugType({}, "rayQuery", NonSemanticShaderDebugInfo100Structure, true); - debugId[type->getResultId()] = debugType; + spv::Id debugType = makeOpaqueDebugType("rayQuery"); + debugTypeIdLookup[type->getResultId()] = debugType; } } else { type = groupedTypes[enumCast(Op::OpTypeRayQueryKHR)].back(); @@ -1494,6 +1523,20 @@ Id Builder::makeRayQueryType() return type->getResultId(); } +Id Builder::makeHitObjectEXTType() +{ + Instruction *type; + if (groupedTypes[enumCast(Op::OpTypeHitObjectEXT)].size() == 0) { + type = new Instruction(getUniqueId(), NoType, Op::OpTypeHitObjectEXT); + groupedTypes[enumCast(Op::OpTypeHitObjectEXT)].push_back(type); + constantsTypesGlobals.push_back(std::unique_ptr(type)); + module.mapInstruction(type); + } else { + type = groupedTypes[enumCast(Op::OpTypeHitObjectEXT)].back(); + } + + return type->getResultId(); +} Id Builder::makeHitObjectNVType() { Instruction *type; @@ -1502,6 +1545,10 @@ Id Builder::makeHitObjectNVType() groupedTypes[enumCast(Op::OpTypeHitObjectNV)].push_back(type); constantsTypesGlobals.push_back(std::unique_ptr(type)); module.mapInstruction(type); + if (emitNonSemanticShaderDebugInfo) { + spv::Id debugType = makeOpaqueDebugType("hitObjectNV"); + debugTypeIdLookup[type->getResultId()] = debugType; + } } else { type = groupedTypes[enumCast(Op::OpTypeHitObjectNV)].back(); } @@ -1708,32 +1755,17 @@ bool Builder::containsPhysicalStorageBufferOrArray(Id typeId) const // can be reused rather than duplicated. (Required by the specification). Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) { - Instruction* constant; - for (int i = 0; i < (int)groupedConstants[enumCast(typeClass)].size(); ++i) { - constant = groupedConstants[enumCast(typeClass)][i]; - if (constant->getOpCode() == opcode && - constant->getTypeId() == typeId && - constant->getImmediateOperand(0) == value) - return constant->getResultId(); - } - - return 0; + ScalarConstantKey key{ enumCast(typeClass), enumCast(opcode), typeId, value, 0 }; + auto it = groupedScalarConstantResultIDs.find(key); + return (it != groupedScalarConstantResultIDs.end()) ? it->second : 0; } // Version of findScalarConstant (see above) for scalars that take two operands (e.g. a 'double' or 'int64'). Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) { - Instruction* constant; - for (int i = 0; i < (int)groupedConstants[enumCast(typeClass)].size(); ++i) { - constant = groupedConstants[enumCast(typeClass)][i]; - if (constant->getOpCode() == opcode && - constant->getTypeId() == typeId && - constant->getImmediateOperand(0) == v1 && - constant->getImmediateOperand(1) == v2) - return constant->getResultId(); - } - - return 0; + ScalarConstantKey key{ enumCast(typeClass), enumCast(opcode), typeId, v1, v2 }; + auto it = groupedScalarConstantResultIDs.find(key); + return (it != groupedScalarConstantResultIDs.end()) ? it->second : 0; } // Return true if consuming 'opcode' means consuming a constant. @@ -1756,6 +1788,7 @@ bool Builder::isConstantOpCode(Op opcode) const case Op::OpSpecConstantComposite: case Op::OpSpecConstantCompositeReplicateEXT: case Op::OpSpecConstantOp: + case Op::OpConstantSizeOfEXT: return true; default: return false; @@ -1805,19 +1838,12 @@ Id Builder::makeNullConstant(Id typeId) Id Builder::makeBoolConstant(bool b, bool specConstant) { Id typeId = makeBoolType(); - Instruction* constant; Op opcode = specConstant ? (b ? Op::OpSpecConstantTrue : Op::OpSpecConstantFalse) : (b ? Op::OpConstantTrue : Op::OpConstantFalse); // See if we already made it. Applies only to regular constants, because specialization constants // must remain distinct for the purpose of applying a SpecId decoration. - if (! specConstant) { - Id existing = 0; - for (int i = 0; i < (int)groupedConstants[enumCast(Op::OpTypeBool)].size(); ++i) { - constant = groupedConstants[enumCast(Op::OpTypeBool)][i]; - if (constant->getTypeId() == typeId && constant->getOpCode() == opcode) - existing = constant->getResultId(); - } - + if (!specConstant) { + Id existing = findScalarConstant(Op::OpTypeBool, opcode, typeId, 0); if (existing) return existing; } @@ -1825,10 +1851,14 @@ Id Builder::makeBoolConstant(bool b, bool specConstant) // Make it Instruction* c = new Instruction(getUniqueId(), typeId, opcode); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeBool)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{enumCast(Op::OpTypeBool), enumCast(opcode), typeId, 0, 0}; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeIntConstant(Id typeId, unsigned value, bool specConstant) @@ -1846,10 +1876,14 @@ Id Builder::makeIntConstant(Id typeId, unsigned value, bool specConstant) Instruction* c = new Instruction(getUniqueId(), typeId, opcode); c->addImmediateOperand(value); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeInt)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{ enumCast(Op::OpTypeInt), enumCast(opcode), typeId, value, 0 }; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeInt64Constant(Id typeId, unsigned long long value, bool specConstant) @@ -1872,10 +1906,14 @@ Id Builder::makeInt64Constant(Id typeId, unsigned long long value, bool specCons c->addImmediateOperand(op1); c->addImmediateOperand(op2); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeInt)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{ enumCast(Op::OpTypeInt), enumCast(opcode), typeId, op1, op2 }; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeFloatConstant(float f, bool specConstant) @@ -1897,10 +1935,14 @@ Id Builder::makeFloatConstant(float f, bool specConstant) Instruction* c = new Instruction(getUniqueId(), typeId, opcode); c->addImmediateOperand(value); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeFloat)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{ enumCast(Op::OpTypeFloat), enumCast(opcode), typeId, value, 0 }; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeDoubleConstant(double d, bool specConstant) @@ -1926,10 +1968,14 @@ Id Builder::makeDoubleConstant(double d, bool specConstant) c->addImmediateOperand(op1); c->addImmediateOperand(op2); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeFloat)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{ enumCast(Op::OpTypeFloat), enumCast(opcode), typeId, op1, op2 }; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeFloat16Constant(float f16, bool specConstant) @@ -1954,10 +2000,14 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant) Instruction* c = new Instruction(getUniqueId(), typeId, opcode); c->addImmediateOperand(value); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeFloat)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{ enumCast(Op::OpTypeFloat), enumCast(opcode), typeId, value, 0 }; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeBFloat16Constant(float bf16, bool specConstant) @@ -1985,10 +2035,14 @@ Id Builder::makeBFloat16Constant(float bf16, bool specConstant) Instruction* c = new Instruction(getUniqueId(), typeId, opcode); c->addImmediateOperand(value); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeFloat)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{ enumCast(Op::OpTypeFloat), enumCast(opcode), typeId, value, 0 }; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeFloatE5M2Constant(float fe5m2, bool specConstant) @@ -2013,10 +2067,14 @@ Id Builder::makeFloatE5M2Constant(float fe5m2, bool specConstant) Instruction* c = new Instruction(getUniqueId(), typeId, opcode); c->addImmediateOperand(value); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeFloat)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{enumCast(Op::OpTypeFloat), enumCast(opcode), typeId, value, 0}; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeFloatE4M3Constant(float fe4m3, bool specConstant) @@ -2041,10 +2099,14 @@ Id Builder::makeFloatE4M3Constant(float fe4m3, bool specConstant) Instruction* c = new Instruction(getUniqueId(), typeId, opcode); c->addImmediateOperand(value); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[enumCast(Op::OpTypeFloat)].push_back(c); module.mapInstruction(c); - return c->getResultId(); + Id resultId = c->getResultId(); + if (!specConstant) { + ScalarConstantKey key{enumCast(Op::OpTypeFloat), enumCast(opcode), typeId, value, 0}; + groupedScalarConstantResultIDs[key] = resultId; + } + return resultId; } Id Builder::makeFpConstant(Id type, double d, bool specConstant) @@ -2085,8 +2147,8 @@ Id Builder::findCompositeConstant(Op typeClass, Op opcode, Id typeId, const std: { Instruction* constant = nullptr; bool found = false; - for (int i = 0; i < (int)groupedConstants[enumCast(typeClass)].size(); ++i) { - constant = groupedConstants[enumCast(typeClass)][i]; + for (int i = 0; i < (int)groupedCompositeConstants[enumCast(typeClass)].size(); ++i) { + constant = groupedCompositeConstants[enumCast(typeClass)][i]; if (constant->getTypeId() != typeId) continue; @@ -2196,7 +2258,7 @@ Id Builder::makeCompositeConstant(Id typeId, const std::vector& members, boo if (typeClass == Op::OpTypeStruct) groupedStructConstants[typeId].push_back(c); else - groupedConstants[enumCast(typeClass)].push_back(c); + groupedCompositeConstants[enumCast(typeClass)].push_back(c); module.mapInstruction(c); return c->getResultId(); @@ -2389,6 +2451,23 @@ void Builder::addDecorationId(Id id, Decoration decoration, const std::vector(dec)); } +void Builder::addMemberDecorationIdEXT(Id id, unsigned int member, Decoration decoration, + const std::vector& operands) +{ + if (decoration == spv::Decoration::Max) + return; + + Instruction* dec = new Instruction(Op::OpMemberDecorateIdEXT); + dec->reserveOperands(operands.size() + 3); + dec->addIdOperand(id); + dec->addImmediateOperand(member); + dec->addImmediateOperand(decoration); + for (auto operand : operands) + dec->addIdOperand(operand); + + decorations.insert(std::unique_ptr(dec)); +} + void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, int num) { if (decoration == spv::Decoration::Max) @@ -2577,14 +2656,14 @@ void Builder::setupFunctionDebugInfo(Function* function, const char* name, const Id nameId = getStringId(unmangleFunctionName(name)); Id funcTypeId = function->getFuncTypeId(); - assert(debugId[funcTypeId] != 0); + assert(getDebugType(funcTypeId) != NoType); Id funcId = function->getId(); assert(funcId != 0); // Make the debug function instruction Id debugFuncId = makeDebugFunction(function, nameId, funcTypeId); - debugId[funcId] = debugFuncId; + debugFuncIdLookup[funcId] = debugFuncId; currentDebugScopeId.push(debugFuncId); // DebugScope and DebugLine for parameter DebugDeclares @@ -2603,9 +2682,8 @@ void Builder::setupFunctionDebugInfo(Function* function, const char* name, const } auto const& paramName = paramNames[p]; - auto const debugLocalVariableId = createDebugLocalVariable(debugId[paramTypeId], paramName, p + 1); + auto const debugLocalVariableId = createDebugLocalVariable(getDebugType(paramTypeId), paramName, p + 1); auto const paramId = static_cast(firstParamId + p); - debugId[paramId] = debugLocalVariableId; if (passByRef) { makeDebugDeclare(debugLocalVariableId, paramId); @@ -2625,7 +2703,7 @@ Id Builder::makeDebugFunction([[maybe_unused]] Function* function, Id nameId, Id assert(function != nullptr); assert(nameId != 0); assert(funcTypeId != 0); - assert(debugId[funcTypeId] != 0); + assert(getDebugType(funcTypeId) != NoType); Id funcId = getUniqueId(); auto type = new Instruction(funcId, makeVoidType(), Op::OpExtInst); @@ -2633,14 +2711,14 @@ Id Builder::makeDebugFunction([[maybe_unused]] Function* function, Id nameId, Id type->addIdOperand(nonSemanticShaderDebugInfo); type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugFunction); type->addIdOperand(nameId); - type->addIdOperand(debugId[funcTypeId]); + type->addIdOperand(getDebugType(funcTypeId)); type->addIdOperand(makeDebugSource(currentFileId)); // TODO: This points to file of definition instead of declaration type->addIdOperand(makeUintConstant(currentLine)); // TODO: This points to line of definition instead of declaration type->addIdOperand(makeUintConstant(0)); // column type->addIdOperand(makeDebugCompilationUnit()); // scope type->addIdOperand(nameId); // linkage name type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); - type->addIdOperand(makeUintConstant(currentLine)); + type->addIdOperand(makeUintConstant(currentLine)); constantsTypesGlobals.push_back(std::unique_ptr(type)); module.mapInstruction(type); return funcId; @@ -2716,6 +2794,8 @@ void Builder::leaveLexicalBlock() // Comments in header void Builder::enterFunction(Function const* function) { + currentFunction = function; + // Save and disable debugInfo for HLSL entry point function. It is a wrapper // function with no user code in it. restoreNonSemanticShaderDebugInfo = emitNonSemanticShaderDebugInfo; @@ -2726,14 +2806,15 @@ void Builder::enterFunction(Function const* function) if (emitNonSemanticShaderDebugInfo) { // Initialize scope state Id funcId = function->getFuncId(); - currentDebugScopeId.push(debugId[funcId]); + Id debugFuncId = getDebugFunction(funcId); + currentDebugScopeId.push(debugFuncId); // Create DebugFunctionDefinition spv::Id resultId = getUniqueId(); Instruction* defInst = new Instruction(resultId, makeVoidType(), Op::OpExtInst); defInst->reserveOperands(4); defInst->addIdOperand(nonSemanticShaderDebugInfo); defInst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugFunctionDefinition); - defInst->addIdOperand(debugId[funcId]); + defInst->addIdOperand(debugFuncId); defInst->addIdOperand(funcId); addInstruction(std::unique_ptr(defInst)); } @@ -2766,6 +2847,9 @@ void Builder::leaveFunction() currentDebugScopeId.pop(); emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo; + + // Clear current function record + currentFunction = nullptr; } // Comments in header @@ -2785,6 +2869,52 @@ void Builder::makeStatementTerminator(spv::Op opcode, const std::vector& ope createAndSetNoPredecessorBlock(name); } +void Builder::createConstVariable(Id type, const char* name, Id constant, bool isGlobal) +{ + if (emitNonSemanticShaderDebugInfo) { + Id debugType = getDebugType(type); + if (isGlobal) { + createDebugGlobalVariable(debugType, name, constant); + } + else { + auto debugLocal = createDebugLocalVariable(debugType, name); + makeDebugValue(debugLocal, constant); + } + } +} + +// Comments in header +Id Builder::createUntypedVariable(Decoration precision, StorageClass storageClass, const char* name, Id dataType, + Id initializer) +{ + Id resultUntypedPointerType = makeUntypedPointer(storageClass); + Instruction* inst = new Instruction(getUniqueId(), resultUntypedPointerType, Op::OpUntypedVariableKHR); + inst->addImmediateOperand(storageClass); + if (dataType != NoResult) { + Id dataPointerType = makePointer(storageClass, dataType); + inst->addIdOperand(dataPointerType); + } + if (initializer != NoResult) + inst->addIdOperand(initializer); + + switch (storageClass) { + case StorageClass::Function: + // Validation rules require the declaration in the entry block + buildPoint->getParent().addLocalVariable(std::unique_ptr(inst)); + break; + default: + constantsTypesGlobals.push_back(std::unique_ptr(inst)); + module.mapInstruction(inst); + break; + } + + if (name) + addName(inst->getResultId(), name); + setPrecision(inst->getResultId(), precision); + + return inst->getResultId(); +} + // Comments in header Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name, Id initializer, bool const compilerGenerated) @@ -2795,31 +2925,27 @@ Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id t if (initializer != NoResult) inst->addIdOperand(initializer); - switch (storageClass) { - case StorageClass::Function: + if (storageClass == StorageClass::Function) { // Validation rules require the declaration in the entry block buildPoint->getParent().addLocalVariable(std::unique_ptr(inst)); - - if (emitNonSemanticShaderDebugInfo && !compilerGenerated) - { - auto const debugLocalVariableId = createDebugLocalVariable(debugId[type], name); - debugId[inst->getResultId()] = debugLocalVariableId; - - makeDebugDeclare(debugLocalVariableId, inst->getResultId()); - } - - break; - - default: + } + else { constantsTypesGlobals.push_back(std::unique_ptr(inst)); module.mapInstruction(inst); + } - if (emitNonSemanticShaderDebugInfo) - { - auto const debugResultId = createDebugGlobalVariable(debugId[type], name, inst->getResultId()); - debugId[inst->getResultId()] = debugResultId; + if (emitNonSemanticShaderDebugInfo && !compilerGenerated) + { + // For debug info, we prefer respecting how the variable is declared in source code. + // We may emulate some local variables as global variable with private storage in SPIR-V, but we still want to + // treat them as local variables in debug info. + if (storageClass == StorageClass::Function || (currentFunction && storageClass == StorageClass::Private)) { + auto const debugLocalVariableId = createDebugLocalVariable(getDebugType(type), name); + makeDebugDeclare(debugLocalVariableId, inst->getResultId()); + } + else { + createDebugGlobalVariable(getDebugType(type), name, inst->getResultId()); } - break; } if (name) @@ -2861,9 +2987,14 @@ spv::MemoryAccessMask Builder::sanitizeMemoryAccessForStorageClass(spv::MemoryAc void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment) { - Instruction* store = new Instruction(Op::OpStore); - store->reserveOperands(2); - store->addIdOperand(lValue); + Instruction* store = nullptr; + if (isUntypedPointer(lValue)) + store = createDescHeapLoadStoreBaseRemap(lValue, Op::OpStore); + else { + store = new Instruction(Op::OpStore); + store->reserveOperands(2); + store->addIdOperand(lValue); + } store->addIdOperand(rValue); memoryAccess = sanitizeMemoryAccessForStorageClass(memoryAccess, getStorageClass(lValue)); @@ -2885,8 +3016,13 @@ void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAcce Id Builder::createLoad(Id lValue, spv::Decoration precision, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment) { - Instruction* load = new Instruction(getUniqueId(), getDerefTypeId(lValue), Op::OpLoad); - load->addIdOperand(lValue); + Instruction* load = nullptr; + if (isUntypedPointer(lValue)) + load = createDescHeapLoadStoreBaseRemap(lValue, Op::OpLoad); + else { + load = new Instruction(getUniqueId(), getDerefTypeId(lValue), Op::OpLoad); + load->addIdOperand(lValue); + } memoryAccess = sanitizeMemoryAccessForStorageClass(memoryAccess, getStorageClass(lValue)); @@ -2906,6 +3042,172 @@ Id Builder::createLoad(Id lValue, spv::Decoration precision, spv::MemoryAccessMa return load->getResultId(); } +Instruction* Builder::createDescHeapLoadStoreBaseRemap(Id baseId, Op op) +{ + // could only be untypedAccessChain or BufferPointerEXT op. + spv::Op instOp = module.getInstruction(baseId)->getOpCode(); + spv::Id baseVal = baseId; + // base type (from run time array) + spv::Id resultTy = getIdOperand(baseId, 0); + // Descriptor heap using run time array. + if (accessChain.descHeapInfo.descHeapStorageClass != StorageClass::Max) + resultTy = getIdOperand(resultTy, 0); + if (instOp == Op::OpBufferPointerEXT) { + // get base structure type from run time array of buffer structure type. + // create an extra untyped access chain for buffer pointer. + resultTy = accessChain.descHeapInfo.descHeapBaseTy; + Instruction* chain = new Instruction(getUniqueId(), getTypeId(baseId), Op::OpUntypedAccessChainKHR); + // base type. + chain->addIdOperand(resultTy); + // base + chain->addIdOperand(baseId); + // index + for (int i = 0; i < (int)accessChain.indexChain.size(); ++i) { + chain->addIdOperand(accessChain.indexChain[i]); + } + addInstruction(std::unique_ptr(chain)); + baseVal = chain->getResultId(); + clearAccessChain(); + } else if (instOp != Op::OpUntypedAccessChainKHR) { + assert("Not a untyped load type"); + } + + Instruction* inst = nullptr; + if (op == Op::OpStore) + inst = new Instruction(Op::OpStore); + else { + inst = new Instruction(getUniqueId(), resultTy, Op::OpLoad); + accessChain.descHeapInfo.descHeapInstId.push_back(inst); + } + inst->addIdOperand(baseVal); + return inst; +} + +uint32_t Builder::isStructureHeapMember(Id id, std::vector indexChain, + unsigned int idx, spv::BuiltIn* bt, uint32_t* firstArrIndex) +{ + unsigned currentIdx = idx; + // Process types, only array types could contain no constant id operands. + Id baseId = id; + if (baseId == NoType) + return 0; + if (isPointerType(baseId)) + baseId = getContainedTypeId(baseId); + auto baseInst = module.getInstruction(baseId); + if (baseInst->getOpCode() == spv::Op::OpTypeArray || + baseInst->getOpCode() == spv::Op::OpTypeRuntimeArray) { + if (firstArrIndex) + *firstArrIndex = currentIdx; + baseId = getContainedTypeId(baseId); + baseInst = module.getInstruction(baseId); + currentIdx++; + } + if (currentIdx >= indexChain.size()) + return 0; + // Process index op. + auto indexInst = module.getInstruction(indexChain[currentIdx]); + if (indexInst->getOpCode() != spv::Op::OpConstant) + return 0; + auto index = indexInst->getImmediateOperand(0); + for (auto dec = decorations.begin(); dec != decorations.end(); dec++) { + if (dec->get()->getOpCode() == spv::Op::OpMemberDecorate && dec->get()->getIdOperand(0) == baseId && + dec->get()->getImmediateOperand(1) == index && + dec->get()->getImmediateOperand(2) == spv::Decoration::BuiltIn && + (dec->get()->getImmediateOperand(3) == (unsigned)spv::BuiltIn::ResourceHeapEXT || + dec->get()->getImmediateOperand(3) == (unsigned)spv::BuiltIn::SamplerHeapEXT)) { + if (bt) + *bt = (spv::BuiltIn)dec->get()->getImmediateOperand(3); + return currentIdx; + } + } + // New base. + if (baseInst->getOpCode() == spv::Op::OpTypeStruct) { + if (!baseInst->isIdOperand(index) || idx == indexChain.size() - 1) + return 0; + return isStructureHeapMember(baseInst->getIdOperand(index), indexChain, currentIdx + 1, bt, firstArrIndex); + } + + return 0; +} + +// Comments in header +Id Builder::createDescHeapAccessChain() +{ + uint32_t rsrcOffsetIdx = accessChain.descHeapInfo.structRsrcTyOffsetCount; + if (rsrcOffsetIdx != 0) + accessChain.base = accessChain.descHeapInfo.structRemappedBase; + Id base = accessChain.base; + Id untypedResultTy = accessChain.descHeapInfo.descHeapBaseTy; + uint32_t explicitArrayStride = accessChain.descHeapInfo.descHeapBaseArrayStride; + std::vector& offsets = accessChain.indexChain; + uint32_t firstArrIndex = accessChain.descHeapInfo.structRsrcTyFirstArrIndex; + // both typeBufferEXT and UntypedPointer only contains storage class info. + StorageClass storageClass = (StorageClass)accessChain.descHeapInfo.descHeapStorageClass; + Id resultTy = makeUntypedPointer(storageClass == spv::StorageClass::StorageBuffer ? spv::StorageClass::StorageBuffer + : spv::StorageClass::Uniform); + + // Make the untyped access chain instruction + Instruction* chain = new Instruction(getUniqueId(), makeUntypedPointer(getStorageClass(base)), Op::OpUntypedAccessChainKHR); + + if (storageClass == spv::StorageClass::Uniform || storageClass == spv::StorageClass::StorageBuffer) { + // For buffer and uniform heap, split first index as heap array index + // Insert BufferPointer op and construct another access chain with following indexes. + Id bufferTy = makeUntypedPointer(storageClass, true); + Id strideId = NoResult; + if (explicitArrayStride == 0) { + strideId = createConstantSizeOfEXT(bufferTy); + } else { + strideId = makeUintConstant(explicitArrayStride); + } + Id runtimeArrTy = makeRuntimeArray(bufferTy); + addDecorationId(runtimeArrTy, spv::Decoration::ArrayStrideIdEXT, strideId); + chain->addIdOperand(runtimeArrTy); + chain->addIdOperand(base); + // We would only re-target current member resource directly to resource/sampler heap base. + // So the previous access chain index towards final resource type is not needed? + // In current draft, only keep the first 'array index' into last access chain index. + // As those resource can't be declared as an array, in current first draft, array index will + // be the second index. This will be refined later. + chain->addIdOperand(offsets[firstArrIndex]); + if (rsrcOffsetIdx != 0) { + for (uint32_t i = 0; i < rsrcOffsetIdx + 1; i++) { + if (rsrcOffsetIdx + i + 1 < offsets.size()) + offsets[i] = offsets[i + rsrcOffsetIdx + 1]; + } + } else { + for (uint32_t i = 0; i < offsets.size() - 1; i++) { + offsets[i] = offsets[i + 1]; + } + } + for (uint32_t i = 0; i < rsrcOffsetIdx + 1; i++) + offsets.pop_back(); + addInstruction(std::unique_ptr(chain)); + // Create OpBufferPointer for loading target buffer descriptor. + Instruction* bufferUntypedDataPtr = new Instruction(getUniqueId(), resultTy, Op::OpBufferPointerEXT); + bufferUntypedDataPtr->addIdOperand(chain->getResultId()); + addInstruction(std::unique_ptr(bufferUntypedDataPtr)); + // Final/Second untyped access chain loading will be created during loading, current results only + // refer to the loading 'base'. + return bufferUntypedDataPtr->getResultId(); + } else { + // image/sampler heap + Id strideId = NoResult; + if (explicitArrayStride == 0) { + strideId = createConstantSizeOfEXT(untypedResultTy); + } else { + strideId = makeUintConstant(explicitArrayStride); + } + Id runtimeArrTy = makeRuntimeArray(untypedResultTy); + addDecorationId(runtimeArrTy, spv::Decoration::ArrayStrideIdEXT, strideId); + chain->addIdOperand(runtimeArrTy); + chain->addIdOperand(base); + for (int i = 0; i < (int)offsets.size(); ++i) + chain->addIdOperand(offsets[i]); + addInstruction(std::unique_ptr(chain)); + return chain->getResultId(); + } +} + // Comments in header Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vector& offsets) { @@ -2924,9 +3226,9 @@ Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vec return chain->getResultId(); } -Id Builder::createArrayLength(Id base, unsigned int member) +Id Builder::createArrayLength(Id base, unsigned int member, unsigned int bits) { - spv::Id intType = makeUintType(32); + spv::Id intType = makeUintType(bits); Instruction* length = new Instruction(getUniqueId(), intType, Op::OpArrayLength); length->reserveOperands(2); length->addIdOperand(base); @@ -3289,12 +3591,21 @@ Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, const std::vect // Comments in header void Builder::promoteScalar(Decoration precision, Id& left, Id& right) { - int direction = getNumComponents(right) - getNumComponents(left); + // choose direction of promotion (+1 for left to right, -1 for right to left) + int direction = !isScalar(right) - !isScalar(left); + + auto const &makeVec = [&](Id component, Id other) { + if (isCooperativeVector(other)) { + return makeCooperativeVectorTypeNV(getTypeId(component), getCooperativeVectorNumComponents(getTypeId(other))); + } else { + return makeVectorType(getTypeId(component), getNumComponents(other)); + } + }; if (direction > 0) - left = smearScalar(precision, left, makeVectorType(getTypeId(left), getNumComponents(right))); + left = smearScalar(precision, left, makeVec(left, right)); else if (direction < 0) - right = smearScalar(precision, right, makeVectorType(getTypeId(right), getNumComponents(left))); + right = smearScalar(precision, right, makeVec(right, left)); return; } @@ -3306,7 +3617,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType) assert(getTypeId(scalar) == getScalarTypeId(vectorType)); int numComponents = getNumTypeComponents(vectorType); - if (numComponents == 1 && !isCooperativeVectorType(vectorType)) + if (numComponents == 1 && !isCooperativeVectorType(vectorType) && !isVectorType(vectorType)) return scalar; Instruction* smear = nullptr; @@ -3718,7 +4029,7 @@ Id Builder::createCompositeConstruct(Id typeId, const std::vector& constitue { assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 && getNumTypeConstituents(typeId) == constituents.size()) || - (isCooperativeVectorType(typeId) && constituents.size() == 1)); + ((isCooperativeVectorType(typeId) || isVectorType(typeId)) && constituents.size() == 1)); if (generatingOpCodeForSpecConst) { // Sometime, even in spec-constant-op mode, the constant composite to be @@ -3807,9 +4118,16 @@ Id Builder::createConstructor(Decoration precision, const std::vector& sourc return smearScalar(precision, sources[0], resultTypeId); // Special case: 2 vectors of equal size - if (sources.size() == 1 && isVector(sources[0]) && numTargetComponents == getNumComponents(sources[0])) { - assert(resultTypeId == getTypeId(sources[0])); - return sources[0]; + if (sources.size() == 1 && + (isVector(sources[0]) || isCooperativeVector(sources[0])) && + numTargetComponents == getNumComponents(sources[0])) { + if (isCooperativeVector(sources[0]) != isCooperativeVectorType(resultTypeId)) { + assert(isVector(sources[0]) != isVectorType(resultTypeId)); + return createUnaryOp(spv::Op::OpBitcast, resultTypeId, sources[0]); + } else { + assert(resultTypeId == getTypeId(sources[0])); + return sources[0]; + } } // accumulate the arguments for OpCompositeConstruct @@ -3818,7 +4136,7 @@ Id Builder::createConstructor(Decoration precision, const std::vector& sourc // lambda to store the result of visiting an argument component const auto latchResult = [&](Id comp) { - if (numTargetComponents > 1) + if (numTargetComponents > 1 || isVectorType(resultTypeId)) constituents.push_back(comp); else result = comp; @@ -4196,6 +4514,13 @@ void Builder::clearAccessChain() accessChain.isRValue = false; accessChain.coherentFlags.clear(); accessChain.alignment = 0; + accessChain.descHeapInfo.descHeapBaseTy = NoResult; + accessChain.descHeapInfo.descHeapStorageClass = StorageClass::Max; + accessChain.descHeapInfo.descHeapInstId.clear(); + accessChain.descHeapInfo.descHeapBaseArrayStride = NoResult; + accessChain.descHeapInfo.structRemappedBase = NoResult; + accessChain.descHeapInfo.structRsrcTyOffsetCount = 0; + accessChain.descHeapInfo.structRsrcTyFirstArrIndex = 0; } // Comments in header @@ -4232,10 +4557,13 @@ void Builder::accessChainStore(Id rvalue, Decoration nonUniform, spv::MemoryAcce transferAccessChainSwizzle(true); + // MeshShadingEXT outputs don't support loads, so split swizzled stores + bool isMeshOutput = getStorageClass(accessChain.base) == StorageClass::Output && + capabilities.find(spv::Capability::MeshShadingEXT) != capabilities.end(); + // If a swizzle exists and is not full and is not dynamic, then the swizzle will be broken into individual stores. if (accessChain.swizzle.size() > 0 && - getNumTypeComponents(getResultingAccessChainType()) != accessChain.swizzle.size() && - accessChain.component == NoResult) { + ((getNumTypeComponents(getResultingAccessChainType()) != accessChain.swizzle.size() && accessChain.component == NoResult) || isMeshOutput)) { for (unsigned int i = 0; i < accessChain.swizzle.size(); ++i) { accessChain.indexChain.push_back(makeUintConstant(accessChain.swizzle[i])); accessChain.instr = NoResult; @@ -4314,7 +4642,7 @@ Id Builder::accessChainLoad(Decoration precision, Decoration l_nonUniform, if (constant) { id = createCompositeExtract(accessChain.base, swizzleBase, indexes); setPrecision(id, precision); - } else if (isCooperativeVector(accessChain.base)) { + } else if (isVector(accessChain.base) || isCooperativeVector(accessChain.base)) { assert(accessChain.indexChain.size() == 1); id = createVectorExtractDynamic(accessChain.base, resultType, accessChain.indexChain[0]); } else { @@ -4403,10 +4731,13 @@ Id Builder::accessChainGetLValue() Id Builder::accessChainGetInferredType() { // anything to operate on? - if (accessChain.base == NoResult) + // for untyped pointer, it may be remapped to a descriptor heap. + // for descriptor heap, its base data type will be determined later, + // according to load/store results' types. + if (accessChain.base == NoResult || isUntypedPointer(accessChain.base) || + isStructureHeapMember(getTypeId(accessChain.base), accessChain.indexChain, 0) != 0) return NoType; Id type = getTypeId(accessChain.base); - // do initial dereference if (! accessChain.isRValue) type = getContainedTypeId(type); @@ -4524,7 +4855,13 @@ Id Builder::collapseAccessChain() // emit the access chain StorageClass storageClass = (StorageClass)module.getStorageClass(getTypeId(accessChain.base)); - accessChain.instr = createAccessChain(storageClass, accessChain.base, accessChain.indexChain); + // when descHeap info is set, use another access chain process. + if ((isUntypedPointer(accessChain.base) || accessChain.descHeapInfo.structRsrcTyOffsetCount!= 0) && + accessChain.descHeapInfo.descHeapStorageClass != StorageClass::Max) { + accessChain.instr = createDescHeapAccessChain(); + } else { + accessChain.instr = createAccessChain(storageClass, accessChain.base, accessChain.indexChain); + } return accessChain.instr; } @@ -4633,6 +4970,16 @@ void Builder::createBranch(bool implicit, Block* block) block->addPredecessor(buildPoint); } +// Create OpConstantSizeOfEXT +Id Builder::createConstantSizeOfEXT(Id typeId) +{ + Instruction* inst = new Instruction(getUniqueId(), makeIntType(32), Op::OpConstantSizeOfEXT); + inst->addIdOperand(typeId); + constantsTypesGlobals.push_back(std::unique_ptr(inst)); + module.mapInstruction(inst); + return inst->getResultId(); +} + void Builder::createSelectionMerge(Block* mergeBlock, SelectionControlMask control) { Instruction* merge = new Instruction(Op::OpSelectionMerge); diff --git a/third_party/glslang/SPIRV/SpvBuilder.h b/third_party/glslang/SPIRV/SpvBuilder.h index 9b5bc9e41a..abfec52efc 100644 --- a/third_party/glslang/SPIRV/SpvBuilder.h +++ b/third_party/glslang/SPIRV/SpvBuilder.h @@ -82,6 +82,14 @@ typedef enum { Spv_1_6 = (1 << 16) | (6 << 8), } SpvVersion; +struct StructMemberDebugInfo { + std::string name {}; + int line {0}; + int column {0}; + // Set if the caller knows a better debug type than what is associated with the functional SPIR-V type. + spv::Id debugTypeOverride {0}; +}; + class Builder { public: Builder(unsigned int spvVersion, unsigned int userNumber, SpvBuildLogger* logger); @@ -130,7 +138,7 @@ public: if (trackDebugInfo) { dirtyLineTracker = true; if (line != 0) { - // TODO: This is special handling of some AST nodes having (untracked) line 0. + // TODO: This is special handling of some AST nodes having (untracked) line 0. // But they should have a valid line number. currentLine = line; if (filename) { @@ -198,12 +206,31 @@ public: return id; } + // Maps the given OpType Id to a Non-Semantic DebugType Id. + Id getDebugType(Id type) { + if (auto it = debugTypeIdLookup.find(type); it != debugTypeIdLookup.end()) { + return it->second; + } + + return NoType; + } + + // Maps the given OpFunction Id to a Non-Semantic DebugFunction Id. + Id getDebugFunction(Id func) { + if (auto it = debugFuncIdLookup.find(func); it != debugFuncIdLookup.end()) { + return it->second; + } + + return NoResult; + } + // For creating new types (will return old type if the requested one was already made). Id makeVoidType(); Id makeBoolType(); Id makePointer(StorageClass, Id pointee); Id makeForwardPointer(StorageClass); Id makePointerFromForwardPointer(StorageClass, Id forwardPointerType, Id pointee); + Id makeUntypedPointer(StorageClass storageClass, bool setBufferPointer = false); Id makeIntegerType(int width, bool hasSign); // generic Id makeIntType(int width) { return makeIntegerType(width, true); } Id makeUintType(int width) { return makeIntegerType(width, false); } @@ -211,16 +238,17 @@ public: Id makeBFloat16Type(); Id makeFloatE5M2Type(); Id makeFloatE4M3Type(); - Id makeStructType(const std::vector& members, const char* name, bool const compilerGenerated = true); + Id makeStructType(const std::vector& members, const std::vector& memberDebugInfo, + const char* name, bool const compilerGenerated = true); Id makeStructResultType(Id type0, Id type1); Id makeVectorType(Id component, int size); Id makeMatrixType(Id component, int cols, int rows); Id makeArrayType(Id element, Id sizeId, int stride); // 0 stride means no stride decoration Id makeRuntimeArray(Id element); Id makeFunctionType(Id returnType, const std::vector& paramTypes); - Id makeImageType(Id sampledType, Dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format); - Id makeSamplerType(); - Id makeSampledImageType(Id imageType); + Id makeImageType(Id sampledType, Dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format, const char* debugNames); + Id makeSamplerType(const char* debugName); + Id makeSampledImageType(Id imageType, const char* debugName); Id makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id cols, Id use); Id makeCooperativeMatrixTypeNV(Id component, Id scope, Id rows, Id cols); Id makeCooperativeMatrixTypeWithSameShape(Id component, Id otherType); @@ -229,12 +257,6 @@ public: Id makeGenericType(spv::Op opcode, std::vector& operands); // SPIR-V NonSemantic Shader DebugInfo Instructions - struct DebugTypeLoc { - std::string name {}; - int line {0}; - int column {0}; - }; - std::unordered_map debugTypeLocs; Id makeDebugInfoNone(); Id makeBoolDebugType(int const size); Id makeIntegerDebugType(int const width, bool const hasSign); @@ -243,9 +265,10 @@ public: Id makeArrayDebugType(Id const baseType, Id const componentCount); Id makeVectorDebugType(Id const baseType, int const componentCount); Id makeMatrixDebugType(Id const vectorType, int const vectorCount, bool columnMajor = true); - Id makeMemberDebugType(Id const memberType, DebugTypeLoc const& debugTypeLoc); - Id makeCompositeDebugType(std::vector const& memberTypes, char const*const name, - NonSemanticShaderDebugInfo100DebugCompositeType const tag, bool const isOpaqueType = false); + Id makeMemberDebugType(Id const memberType, StructMemberDebugInfo const& debugTypeLoc); + Id makeCompositeDebugType(std::vector const& memberTypes, std::vector const& memberDebugInfo, + char const* const name, NonSemanticShaderDebugInfo100DebugCompositeType const tag); + Id makeOpaqueDebugType(char const* const name); Id makePointerDebugType(StorageClass storageClass, Id const baseType); Id makeForwardPointerDebugType(StorageClass storageClass); Id makeDebugSource(const Id fileName); @@ -272,6 +295,8 @@ public: Id makeRayQueryType(); // hitObjectNV type Id makeHitObjectNVType(); + // hitObjectEXT type + Id makeHitObjectEXTType(); // For querying about types. Id getTypeId(Id resultId) const { return module.getTypeId(resultId); } @@ -293,6 +318,14 @@ public: Id getCooperativeVectorNumComponents(Id typeId) const { return module.getInstruction(typeId)->getIdOperand(1); } bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); } + bool isUntypedPointer(Id resultId) const + { + const Id tid = getTypeId(resultId); + // Expect that OpString have no type + if (tid == 0) + return false; + return isUntypedPointerType(tid); + } bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); } bool isVector(Id resultId) const { return isVectorType(getTypeId(resultId)); } bool isMatrix(Id resultId) const { return isMatrixType(getTypeId(resultId)); } @@ -310,6 +343,7 @@ public: { return getTypeClass(typeId) == Op::OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) == 0; } bool isFloatType(Id typeId) const { return getTypeClass(typeId) == Op::OpTypeFloat; } bool isPointerType(Id typeId) const { return getTypeClass(typeId) == Op::OpTypePointer; } + bool isUntypedPointerType(Id typeId) const { return getTypeClass(typeId) == Op::OpTypeUntypedPointerKHR; } bool isScalarType(Id typeId) const { return getTypeClass(typeId) == Op::OpTypeFloat || getTypeClass(typeId) == Op::OpTypeInt || getTypeClass(typeId) == Op::OpTypeBool; } @@ -445,6 +479,7 @@ public: void addMemberDecoration(Id, unsigned int member, Decoration, const char*); void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector& literals); void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector& strings); + void addMemberDecorationIdEXT(Id, unsigned int member, Decoration, const std::vector& operands); // At the end of what block do the next create*() instructions go? // Also reset current last DebugScope and current source line to unknown @@ -499,13 +534,24 @@ public: // such as OpEmitMeshTasksEXT void makeStatementTerminator(spv::Op opcode, const std::vector& operands, const char* name); + // Create a global/local constant. Because OpConstant is automatically emitted by getting the constant + // ids, this function only handles debug info. + void createConstVariable(Id type, const char* name, Id constant, bool isGlobal); + // Create a global or function local or IO variable. Id createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name = nullptr, Id initializer = NoResult, bool const compilerGenerated = true); + // Create an untyped global or function local or IO variable. + Id createUntypedVariable(Decoration precision, StorageClass storageClass, const char* name = nullptr, + Id dataType = NoResult, Id initializer = NoResult); + // Create an intermediate with an undefined value. Id createUndefined(Id type); + // Create load/store instruction with a remapped descriptor heap base. + Instruction* createDescHeapLoadStoreBaseRemap(Id base, Op op); + // Store into an Id and return the l-value void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMask::MaskNone, spv::Scope scope = spv::Scope::Max, unsigned int alignment = 0); @@ -519,7 +565,7 @@ public: Id createAccessChain(StorageClass, Id base, const std::vector& offsets); // Create an OpArrayLength instruction - Id createArrayLength(Id base, unsigned int member); + Id createArrayLength(Id base, unsigned int member, unsigned int bits); // Create an OpCooperativeMatrixLengthKHR instruction Id createCooperativeMatrixLengthKHR(Id type); @@ -762,6 +808,18 @@ public: unsigned int alignment; // bitwise OR of alignment values passed in. Accumulates worst alignment. // Only tracks base and (optional) component selection alignment. + struct DescHeapInfo { + Id descHeapBaseTy; // for descriptor heap, record its base data type. + StorageClass descHeapStorageClass; // for descriptor heap, record its basic storage class. + uint32_t descHeapBaseArrayStride; // for descriptor heap, record its explicit array stride. + std::vector descHeapInstId; + // for descriptor heap, record its data type for loading/store results. + uint32_t structRsrcTyOffsetCount; + uint32_t structRsrcTyFirstArrIndex; + Id structRemappedBase; + }; + DescHeapInfo descHeapInfo; + // Accumulate whether anything in the chain of structures has coherent decorations. struct CoherentFlags { CoherentFlags() { clear(); } @@ -828,10 +886,15 @@ public: // clear accessChain void clearAccessChain(); + Id createDescHeapAccessChain(); + Id createConstantSizeOfEXT(Id typeId); + uint32_t isStructureHeapMember(Id id, std::vector indexChain, unsigned int idx, spv::BuiltIn* bt = nullptr, + uint32_t* firstArrIndex = nullptr); + // set new base as an l-value base void setAccessChainLValue(Id lValue) { - assert(isPointer(lValue)); + assert(isPointer(lValue) || isUntypedPointer(lValue)); accessChain.base = lValue; } @@ -842,6 +905,25 @@ public: accessChain.base = rValue; } + // set access chain info for untyped descriptor heap variable + void setAccessChainDescHeapInfo(StorageClass storageClass = StorageClass::Max, Id baseTy = NoResult, + uint32_t explicitArrayStride = NoResult, uint32_t structRsrcTyOffsetCount = 0, + spv::Id structRemappedBase = NoResult, uint32_t firstArrIndex = NoResult) + { + if (accessChain.descHeapInfo.descHeapStorageClass == StorageClass::Max) + accessChain.descHeapInfo.descHeapStorageClass = storageClass; + if (accessChain.descHeapInfo.descHeapBaseTy == NoResult) + accessChain.descHeapInfo.descHeapBaseTy = baseTy; + if (accessChain.descHeapInfo.descHeapBaseArrayStride == NoResult) + accessChain.descHeapInfo.descHeapBaseArrayStride = explicitArrayStride; + if (accessChain.descHeapInfo.structRemappedBase == NoResult) + accessChain.descHeapInfo.structRemappedBase = structRemappedBase; + if (accessChain.descHeapInfo.structRsrcTyOffsetCount == 0) + accessChain.descHeapInfo.structRsrcTyOffsetCount = structRsrcTyOffsetCount; + if (accessChain.descHeapInfo.structRsrcTyFirstArrIndex == 0) + accessChain.descHeapInfo.structRsrcTyFirstArrIndex = firstArrIndex; + } + // push offset onto the end of the chain void accessChainPush(Id offset, AccessChain::CoherentFlags coherentFlags, unsigned int alignment) { @@ -924,7 +1006,11 @@ public: void setUseReplicatedComposites(bool use) { useReplicatedComposites = use; } - protected: +private: + // Helper to get size of a scalar (in bytes) + unsigned int postProcessGetLargestScalarSize(const Instruction& type); + +protected: Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value); Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2); Id findCompositeConstant(Op typeClass, Op opcode, Id typeId, const std::vector& comps, size_t numMembers); @@ -990,6 +1076,8 @@ public: Block* buildPoint; Id uniqueId; Function* entryPointFunction; + // This tracks the current function being built, or nullptr if not in a function. + Function const* currentFunction { nullptr }; bool generatingOpCodeForSpecConst; bool useReplicatedComposites { false }; AccessChain accessChain; @@ -1007,8 +1095,58 @@ public: // not output, internally used for quick & dirty canonical (unique) creation + // Key for scalar constants (handles both 32-bit and 64-bit) + struct ScalarConstantKey { + unsigned int typeClass; // OpTypeInt, OpTypeFloat, OpTypeBool + unsigned int opcode; // OpConstant, OpSpecConstant, OpConstantTrue, etc. + Id typeId; // The specific type + unsigned value1; // First operand (or only operand) + unsigned value2; // Second operand (0 for single-operand constants) + + bool operator==(const ScalarConstantKey& other) const { + return typeClass == other.typeClass && + opcode == other.opcode && + typeId == other.typeId && + value1 == other.value1 && + value2 == other.value2; + } + }; + + struct ScalarConstantKeyHash { + // 64/32 bit mix function from MurmurHash3 + inline std::size_t hash_mix(std::size_t h) const { + if constexpr (sizeof(std::size_t) == 8) { + h ^= h >> 33; + h *= UINT64_C(0xff51afd7ed558ccd); + h ^= h >> 33; + h *= UINT64_C(0xc4ceb9fe1a85ec53); + h ^= h >> 33; + return h; + } else { + h ^= h >> 16; + h *= UINT32_C(0x85ebca6b); + h ^= h >> 13; + h *= UINT32_C(0xc2b2ae35); + h ^= h >> 16; + return h; + } + } + + // Hash combine from boost + inline std::size_t hash_combine(std::size_t seed, std::size_t v) const { + return hash_mix(seed + 0x9e3779b9 + v); + } + + std::size_t operator()(const ScalarConstantKey& k) const { + size_t hash1 = hash_combine(std::hash{}(k.typeClass), std::hash{}(k.opcode)); + size_t hash2 = hash_combine(std::hash{}(k.value1), std::hash{}(k.value2)); + size_t hash3 = hash_combine(hash1, hash2); + return hash_combine(hash3, std::hash{}(k.typeId)); + } + }; + // map type opcodes to constant inst. - std::unordered_map> groupedConstants; + std::unordered_map> groupedCompositeConstants; // map struct-id to constant instructions std::unordered_map> groupedStructConstants; // map type opcodes to type instructions @@ -1017,6 +1155,8 @@ public: std::unordered_map> groupedDebugTypes; // list of OpConstantNull instructions std::vector nullConstants; + // map scalar constants to result IDs + std::unordered_map groupedScalarConstantResultIDs; // Track which types have explicit layouts, to avoid reusing in storage classes without layout. // Currently only tracks array types. @@ -1034,8 +1174,11 @@ public: // map from include file name ids to their contents std::map includeFiles; - // map from core id to debug id - std::map debugId; + // maps from OpTypeXXX id to DebugTypeXXX id + std::unordered_map debugTypeIdLookup; + + // maps from OpFunction id to DebugFunction id + std::unordered_map debugFuncIdLookup; // map from file name string id to DebugSource id std::unordered_map debugSourceId; diff --git a/third_party/glslang/SPIRV/SpvPostProcess.cpp b/third_party/glslang/SPIRV/SpvPostProcess.cpp index 4f61864a8a..2d5c320995 100644 --- a/third_party/glslang/SPIRV/SpvPostProcess.cpp +++ b/third_party/glslang/SPIRV/SpvPostProcess.cpp @@ -43,6 +43,7 @@ #include #include +#include "SPIRV/spvIR.h" #include "SpvBuilder.h" #include "spirv.hpp11" #include "spvUtil.h" @@ -82,7 +83,10 @@ void Builder::postProcessType(const Instruction& inst, Id typeId) if (containsType(typeId, Op::OpTypeFloat, 16)) addCapability(Capability::Float16); } else { - StorageClass storageClass = getStorageClass(inst.getIdOperand(0)); + StorageClass storageClass = StorageClass::Max; + if (module.getInstruction(inst.getIdOperand(0))->getOpCode() != Op::OpUntypedAccessChainKHR) { + storageClass = getStorageClass(inst.getIdOperand(0)); + } if (width == 8) { switch (storageClass) { case StorageClass::PhysicalStorageBufferEXT: @@ -201,6 +205,37 @@ void Builder::postProcessType(const Instruction& inst, Id typeId) } } +unsigned int Builder::postProcessGetLargestScalarSize(const Instruction& type) +{ + switch (type.getOpCode()) { + case Op::OpTypeBool: + return 1; + case Op::OpTypeInt: + case Op::OpTypeFloat: + return type.getImmediateOperand(0) / 8; + case Op::OpTypePointer: + return 8; + case Op::OpTypeVector: + case Op::OpTypeMatrix: + case Op::OpTypeArray: + case Op::OpTypeRuntimeArray: { + const Instruction* elem_type = module.getInstruction(type.getIdOperand(0)); + return postProcessGetLargestScalarSize(*elem_type); + } + case Op::OpTypeStruct: { + unsigned int largest = 0; + for (int i = 0; i < type.getNumOperands(); ++i) { + const Instruction* elem_type = module.getInstruction(type.getIdOperand(i)); + unsigned int elem_size = postProcessGetLargestScalarSize(*elem_type); + largest = std::max(largest, elem_size); + } + return largest; + } + default: + return 0; + } +} + // Called for each instruction that resides in a block. void Builder::postProcess(Instruction& inst) { @@ -249,12 +284,12 @@ void Builder::postProcess(Instruction& inst) // and this function computes the rest from the SPIR-V Offset decorations. Instruction *accessChain = module.getInstruction(inst.getIdOperand(0)); if (accessChain->getOpCode() == Op::OpAccessChain) { - Instruction *base = module.getInstruction(accessChain->getIdOperand(0)); + const Instruction* base = module.getInstruction(accessChain->getIdOperand(0)); // Get the type of the base of the access chain. It must be a pointer type. Id typeId = base->getTypeId(); Instruction *type = module.getInstruction(typeId); assert(type->getOpCode() == Op::OpTypePointer); - if (type->getImmediateOperand(0) != StorageClass::PhysicalStorageBufferEXT) { + if (type->getImmediateOperand(0) != StorageClass::PhysicalStorageBuffer) { break; } // Get the pointee type. @@ -265,6 +300,7 @@ void Builder::postProcess(Instruction& inst) // Offset/ArrayStride/MatrixStride decorations, and bitwise OR them all // together. int alignment = 0; + bool first_struct_elem = false; for (int i = 1; i < accessChain->getNumOperands(); ++i) { Instruction *idx = module.getInstruction(accessChain->getIdOperand(i)); if (type->getOpCode() == Op::OpTypeStruct) { @@ -277,7 +313,12 @@ void Builder::postProcess(Instruction& inst) decoration.get()->getImmediateOperand(1) == c && (decoration.get()->getImmediateOperand(2) == Decoration::Offset || decoration.get()->getImmediateOperand(2) == Decoration::MatrixStride)) { - alignment |= decoration.get()->getImmediateOperand(3); + unsigned int opernad_value = decoration.get()->getImmediateOperand(3); + alignment |= opernad_value; + if (opernad_value == 0 && + decoration.get()->getImmediateOperand(2) == Decoration::Offset) { + first_struct_elem = true; + } } }; std::for_each(decorations.begin(), decorations.end(), function); @@ -303,18 +344,51 @@ void Builder::postProcess(Instruction& inst) } } assert(inst.getNumOperands() >= 3); - auto const memoryAccess = (MemoryAccessMask)inst.getImmediateOperand((inst.getOpCode() == Op::OpStore) ? 2 : 1); + const bool is_store = inst.getOpCode() == Op::OpStore; + auto const memoryAccess = (MemoryAccessMask)inst.getImmediateOperand(is_store ? 2 : 1); assert(anySet(memoryAccess, MemoryAccessMask::Aligned)); static_cast(memoryAccess); + // Compute the index of the alignment operand. int alignmentIdx = 2; - if (inst.getOpCode() == Op::OpStore) + if (is_store) alignmentIdx++; // Merge new and old (mis)alignment alignment |= inst.getImmediateOperand(alignmentIdx); + + if (!is_store) { + Instruction* inst_type = module.getInstruction(inst.getTypeId()); + if (inst_type->getOpCode() == Op::OpTypePointer && + inst_type->getImmediateOperand(0) == StorageClass::PhysicalStorageBuffer) { + // This means we are loading a pointer which means need to ensure it is at least 8-byte aligned + // See https://github.com/KhronosGroup/glslang/issues/4084 + // In case the alignment is currently 4, need to ensure it is 8 before grabbing the LSB + alignment |= 8; + alignment &= 8; + } + } + // Pick the LSB alignment = alignment & ~(alignment & (alignment-1)); + + // The edge case we find is when copying a struct to another struct, we never find the alignment anywhere, + // so in this case, fallback to doing a full size lookup on the type + if (alignment == 0 && first_struct_elem) { + // Quick get the struct type back + const Instruction* pointer_type = module.getInstruction(base->getTypeId()); + const Instruction* struct_type = module.getInstruction(pointer_type->getIdOperand(1)); + assert(struct_type->getOpCode() == Op::OpTypeStruct); + + const Instruction* elem_type = module.getInstruction(struct_type->getIdOperand(0)); + unsigned int largest_scalar = postProcessGetLargestScalarSize(*elem_type); + if (largest_scalar != 0) { + alignment = largest_scalar; + } else { + alignment = 16; // fallback if can't determine a godo alignment + } + } // update the Aligned operand + assert(alignment != 0); inst.setImmediateOperand(alignmentIdx, alignment); } break; diff --git a/third_party/glslang/SPIRV/SpvTools.cpp b/third_party/glslang/SPIRV/SpvTools.cpp index d1b411f29a..bf82692827 100644 --- a/third_party/glslang/SPIRV/SpvTools.cpp +++ b/third_party/glslang/SPIRV/SpvTools.cpp @@ -166,6 +166,7 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector< spvValidatorOptionsSetScalarBlockLayout(options, intermediate.usingScalarBlockLayout()); spvValidatorOptionsSetWorkgroupScalarBlockLayout(options, intermediate.usingScalarBlockLayout()); spvValidatorOptionsSetAllowOffsetTextureOperand(options, intermediate.usingTextureOffsetNonConst()); + spvValidatorOptionsSetAllowVulkan32BitBitwise(options, true); spvValidateWithOptions(context, options, &binary, &diagnostic); // report diff --git a/third_party/glslang/SPIRV/disassemble.cpp b/third_party/glslang/SPIRV/disassemble.cpp index 248df0ac70..3889695134 100644 --- a/third_party/glslang/SPIRV/disassemble.cpp +++ b/third_party/glslang/SPIRV/disassemble.cpp @@ -61,7 +61,7 @@ namespace spv { #include "GLSL.ext.QCOM.h" } } -const char* GlslStd450DebugNames[spv::GLSLstd450Count]; +static const char* GlslStd450DebugNames[spv::GLSLstd450Count]; namespace spv { @@ -414,6 +414,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, idDescriptor[resultId] = "struct"; break; case Op::OpTypePointer: + case Op::OpTypeUntypedPointerKHR: idDescriptor[resultId] = "ptr"; break; case Op::OpTypeVector: diff --git a/third_party/glslang/SPIRV/doc.cpp b/third_party/glslang/SPIRV/doc.cpp index 53f495ef4a..f81faefabd 100644 --- a/third_party/glslang/SPIRV/doc.cpp +++ b/third_party/glslang/SPIRV/doc.cpp @@ -231,6 +231,8 @@ const char* ExecutionModeString(int mode) case (int)ExecutionMode::NonCoherentDepthAttachmentReadEXT: return "NonCoherentDepthAttachmentReadEXT"; case (int)ExecutionMode::NonCoherentStencilAttachmentReadEXT: return "NonCoherentStencilAttachmentReadEXT"; + case (int)ExecutionMode::Shader64BitIndexingEXT: return "Shader64BitIndexingEXT"; + case ExecutionModeCeiling: default: return "Bad"; } @@ -265,6 +267,7 @@ const char* StorageClassString(int StorageClass) case (int)StorageClass::TaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT"; case (int)StorageClass::HitObjectAttributeNV: return "HitObjectAttributeNV"; case (int)StorageClass::TileImageEXT: return "TileImageEXT"; + case (int)StorageClass::HitObjectAttributeEXT: return "HitObjectAttributeEXT"; default: return "Bad"; } } @@ -344,8 +347,15 @@ const char* DecorationString(int decoration) case (int)Decoration::AliasedPointerEXT: return "DecorationAliasedPointerEXT"; case (int)Decoration::HitObjectShaderRecordBufferNV: return "DecorationHitObjectShaderRecordBufferNV"; + case (int)Decoration::HitObjectShaderRecordBufferEXT: return "DecorationHitObjectShaderRecordBufferEXT"; case (int)Decoration::SaturatedToLargestFloat8NormalConversionEXT: return "DecorationSaturatedToLargestFloat8NormalConversionEXT"; + + case (int)Decoration::BankNV: return "BankNV"; + case (int)Decoration::MemberOffsetNV: return "MemberOffsetNV"; + + case (int)Decoration::ArrayStrideIdEXT: return "DecorationArrayStrideIdEXT"; + case (int)Decoration::OffsetIdEXT: return "DecorationOffsetIdEXT"; } } @@ -487,6 +497,8 @@ const char* BuiltInString(int builtIn) case (int)BuiltIn::CoreMaxIDARM: return "CoreMaxIDARM"; case (int)BuiltIn::WarpIDARM: return "WarpIDARM"; case (int)BuiltIn::WarpMaxIDARM: return "BuiltInWarpMaxIDARM"; + case (int)BuiltIn::SamplerHeapEXT: return "SamplerHeapEXT"; + case (int)BuiltIn::ResourceHeapEXT: return "ResourceHeapEXT"; default: return "Bad"; } @@ -977,7 +989,7 @@ const char* CapabilityString(int info) case (int)Capability::SubgroupBallotKHR: return "SubgroupBallotKHR"; case (int)Capability::DrawParameters: return "DrawParameters"; case (int)Capability::SubgroupVoteKHR: return "SubgroupVoteKHR"; - case (int)Capability::GroupNonUniformRotateKHR: return "CapabilityGroupNonUniformRotateKHR"; + case (int)Capability::GroupNonUniformRotateKHR: return "GroupNonUniformRotateKHR"; case (int)Capability::StorageUniformBufferBlock16: return "StorageUniformBufferBlock16"; case (int)Capability::StorageUniform16: return "StorageUniform16"; @@ -1023,7 +1035,7 @@ const char* CapabilityString(int info) case (int)Capability::RayTracingPositionFetchKHR: return "RayTracingPositionFetchKHR"; case (int)Capability::DisplacementMicromapNV: return "DisplacementMicromapNV"; case (int)Capability::RayTracingOpacityMicromapEXT: return "RayTracingOpacityMicromapEXT"; - case (int)Capability::RayTracingDisplacementMicromapNV: return "CapabilityRayTracingDisplacementMicromapNV"; + case (int)Capability::RayTracingDisplacementMicromapNV: return "RayTracingDisplacementMicromapNV"; case (int)Capability::RayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR"; case (int)Capability::ComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV"; case (int)Capability::ComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV"; @@ -1071,9 +1083,9 @@ const char* CapabilityString(int info) case (int)Capability::CooperativeVectorNV: return "CooperativeVectorNV"; case (int)Capability::CooperativeVectorTrainingNV: return "CooperativeVectorTrainingNV"; - case (int)Capability::FragmentShaderSampleInterlockEXT: return "CapabilityFragmentShaderSampleInterlockEXT"; - case (int)Capability::FragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT"; - case (int)Capability::FragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT"; + case (int)Capability::FragmentShaderSampleInterlockEXT: return "FragmentShaderSampleInterlockEXT"; + case (int)Capability::FragmentShaderPixelInterlockEXT: return "FragmentShaderPixelInterlockEXT"; + case (int)Capability::FragmentShaderShadingRateInterlockEXT: return "FragmentShaderShadingRateInterlockEXT"; case (int)Capability::TileImageColorReadAccessEXT: return "TileImageColorReadAccessEXT"; case (int)Capability::TileImageDepthReadAccessEXT: return "TileImageDepthReadAccessEXT"; @@ -1089,8 +1101,10 @@ const char* CapabilityString(int info) case (int)Capability::ShaderClockKHR: return "ShaderClockKHR"; case (int)Capability::QuadControlKHR: return "QuadControlKHR"; case (int)Capability::Int64ImageEXT: return "Int64ImageEXT"; + case (int)Capability::DescriptorHeapEXT: return "DescriptorHeapEXT"; + case (int)Capability::UntypedPointersKHR: return "UntypedPointersKHR"; - case (int)Capability::IntegerFunctions2INTEL: return "CapabilityIntegerFunctions2INTEL"; + case (int)Capability::IntegerFunctions2INTEL: return "IntegerFunctions2INTEL"; case (int)Capability::ExpectAssumeKHR: return "ExpectAssumeKHR"; @@ -1101,12 +1115,13 @@ const char* CapabilityString(int info) case (int)Capability::AtomicFloat32MinMaxEXT: return "AtomicFloat32MinMaxEXT"; case (int)Capability::AtomicFloat64MinMaxEXT: return "AtomicFloat64MinMaxEXT"; - case (int)Capability::WorkgroupMemoryExplicitLayoutKHR: return "CapabilityWorkgroupMemoryExplicitLayoutKHR"; - case (int)Capability::WorkgroupMemoryExplicitLayout8BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR"; - case (int)Capability::WorkgroupMemoryExplicitLayout16BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR"; + case (int)Capability::WorkgroupMemoryExplicitLayoutKHR: return "WorkgroupMemoryExplicitLayoutKHR"; + case (int)Capability::WorkgroupMemoryExplicitLayout8BitAccessKHR: return "WorkgroupMemoryExplicitLayout8BitAccessKHR"; + case (int)Capability::WorkgroupMemoryExplicitLayout16BitAccessKHR: return "WorkgroupMemoryExplicitLayout16BitAccessKHR"; case (int)Capability::CoreBuiltinsARM: return "CoreBuiltinsARM"; case (int)Capability::ShaderInvocationReorderNV: return "ShaderInvocationReorderNV"; + case (int)Capability::ShaderInvocationReorderEXT: return "ShaderInvocationReorderEXT"; case (int)Capability::TextureSampleWeightedQCOM: return "TextureSampleWeightedQCOM"; case (int)Capability::TextureBoxFilterQCOM: return "TextureBoxFilterQCOM"; @@ -1114,7 +1129,9 @@ const char* CapabilityString(int info) case (int)Capability::TileShadingQCOM: return "TileShadingQCOM"; case (int)Capability::TextureBlockMatch2QCOM: return "TextureBlockMatch2QCOM"; - case (int)Capability::ReplicatedCompositesEXT: return "CapabilityReplicatedCompositesEXT"; + case (int)Capability::CooperativeMatrixConversionQCOM: return "CooperativeMatrixConversionQCOM"; + + case (int)Capability::ReplicatedCompositesEXT: return "ReplicatedCompositesEXT"; case (int)Capability::DotProductKHR: return "DotProductKHR"; case (int)Capability::DotProductInputAllKHR: return "DotProductInputAllKHR"; @@ -1126,12 +1143,17 @@ const char* CapabilityString(int info) case (int)Capability::RayTracingSpheresGeometryNV: return "RayTracingSpheresGeometryNV"; case (int)Capability::RayTracingLinearSweptSpheresGeometryNV: return "RayTracingLinearSweptSpheresGeometryNV"; - case (int)Capability::BFloat16TypeKHR: return "CapabilityBFloat16TypeKHR"; - case (int)Capability::BFloat16DotProductKHR: return "CapabilityBFloat16DotProductKHR"; - case (int)Capability::BFloat16CooperativeMatrixKHR: return "CapabilityBFloat16CooperativeMatrixKHR"; + case (int)Capability::BFloat16TypeKHR: return "BFloat16TypeKHR"; + case (int)Capability::BFloat16DotProductKHR: return "BFloat16DotProductKHR"; + case (int)Capability::BFloat16CooperativeMatrixKHR: return "BFloat16CooperativeMatrixKHR"; - case (int)Capability::Float8EXT: return "CapabilityFloat8EXT"; - case (int)Capability::Float8CooperativeMatrixEXT: return "CapabilityFloat8CooperativeMatrixEXT"; + case (int)Capability::Float8EXT: return "Float8EXT"; + case (int)Capability::Float8CooperativeMatrixEXT: return "Float8CooperativeMatrixEXT"; + + case (int)Capability::PushConstantBanksNV: return "PushConstantBanksNV"; + + case (int)Capability::Shader64BitIndexingEXT: return "CapabilityShader64BitIndexingEXT"; + case (int)Capability::LongVectorEXT: return "LongVectorEXT"; default: return "Bad"; } @@ -1514,6 +1536,14 @@ const char* OpcodeString(int op) case (int)Op::OpGroupNonUniformQuadAllKHR: return "OpGroupNonUniformQuadAllKHR"; case (int)Op::OpGroupNonUniformQuadAnyKHR: return "OpGroupNonUniformQuadAnyKHR"; + case (int)Op::OpBufferPointerEXT: return "OpBufferPointerEXT"; + case (int)Op::OpConstantSizeOfEXT: return "OpConstantSizeOfEXT"; + case (int)Op::OpTypeBufferEXT: return "OpTypeBufferEXT"; + case (int)Op::OpUntypedAccessChainKHR: return "OpUntypedAccessChainKHR"; + case (int)Op::OpUntypedVariableKHR: return "OpUntypedVariableKHR"; + case (int)Op::OpTypeUntypedPointerKHR: return "OpTypeUntypedPointerKHR"; + case (int)Op::OpMemberDecorateIdEXT: return "OpMemberDecorateIdEXT"; + case (int)Op::OpUntypedImageTexelPointerEXT: return "OpUntypedImageTexelPointerEXT"; case (int)Op::OpAtomicFAddEXT: return "OpAtomicFAddEXT"; case (int)Op::OpAtomicFMinEXT: return "OpAtomicFMinEXT"; @@ -1700,6 +1730,11 @@ const char* OpcodeString(int op) case (int)Op::OpImageBlockMatchGatherSSDQCOM: return "OpImageBlockMatchGatherSSDQCOM"; case (int)Op::OpImageBlockMatchGatherSADQCOM: return "OpImageBlockMatchGatherSADQCOM"; + case (int)Op::OpBitCastArrayQCOM: return "OpBitCastArrayQCOM"; + case (int)Op::OpCompositeConstructCoopMatQCOM: return "OpCompositeConstructCoopMatQCOM"; + case (int)Op::OpCompositeExtractCoopMatQCOM: return "OpCompositeExtractCoopMatQCOM"; + case (int)Op::OpExtractSubArrayQCOM: return "OpExtractSubArrayQCOM"; + case (int)Op::OpConstantCompositeReplicateEXT: return "OpConstantCompositeReplicateEXT"; case (int)Op::OpSpecConstantCompositeReplicateEXT: return "OpSpecConstantCompositeReplicateEXT"; case (int)Op::OpCompositeConstructReplicateEXT: return "OpCompositeConstructReplicateEXT"; @@ -1711,6 +1746,43 @@ const char* OpcodeString(int op) case (int)Op::OpUDotAccSatKHR: return "OpUDotAccSatKHR"; case (int)Op::OpSUDotAccSatKHR: return "OpSUDotAccSatKHR"; + case (int)Op::OpTypeHitObjectEXT: return "OpTypeHitObjectEXT"; + case (int)Op::OpHitObjectTraceRayEXT: return "OpHitObjectTraceRayEXT"; + case (int)Op::OpHitObjectTraceRayMotionEXT: return "OpHitObjectTraceRayMotionEXT"; + case (int)Op::OpHitObjectRecordMissEXT: return "OpHitObjectRecordMissEXT"; + case (int)Op::OpHitObjectRecordMissMotionEXT: return "OpHitObjectRecordMissMotionEXT"; + case (int)Op::OpHitObjectRecordEmptyEXT: return "OpHitObjectRecordEmptyEXT"; + case (int)Op::OpHitObjectExecuteShaderEXT: return "OpHitObjectExecuteShaderEXT"; + case (int)Op::OpReorderThreadWithHintEXT: return "OpReorderThreadWithHintEXT"; + case (int)Op::OpReorderThreadWithHitObjectEXT: return "OpReorderThreadWithHitObjectEXT"; + case (int)Op::OpHitObjectGetCurrentTimeEXT: return "OpHitObjectGetCurrentTimeEXT"; + case (int)Op::OpHitObjectGetAttributesEXT: return "OpHitObjectGetAttributesEXT"; + case (int)Op::OpHitObjectGetHitKindEXT: return "OpHitObjectGetHitKindEXT"; + case (int)Op::OpHitObjectGetPrimitiveIndexEXT: return "OpHitObjectGetPrimitiveIndexEXT"; + case (int)Op::OpHitObjectGetGeometryIndexEXT: return "OpHitObjectGetGeometryIndexEXT"; + case (int)Op::OpHitObjectGetInstanceIdEXT: return "OpHitObjectGetInstanceIdEXT"; + case (int)Op::OpHitObjectGetInstanceCustomIndexEXT: return "OpHitObjectGetInstanceCustomIndexEXT"; + case (int)Op::OpHitObjectGetObjectRayDirectionEXT: return "OpHitObjectGetObjectRayDirectionEXT"; + case (int)Op::OpHitObjectGetObjectRayOriginEXT: return "OpHitObjectGetObjectRayOriginEXT"; + case (int)Op::OpHitObjectGetWorldRayDirectionEXT: return "OpHitObjectGetWorldRayDirectionEXT"; + case (int)Op::OpHitObjectGetWorldRayOriginEXT: return "OpHitObjectGetWorldRayOriginEXT"; + case (int)Op::OpHitObjectGetWorldToObjectEXT: return "OpHitObjectGetWorldToObjectEXT"; + case (int)Op::OpHitObjectGetObjectToWorldEXT: return "OpHitObjectGetObjectToWorldEXT"; + case (int)Op::OpHitObjectGetRayTMaxEXT: return "OpHitObjectGetRayTMaxEXT"; + case (int)Op::OpHitObjectGetRayTMinEXT: return "OpHitObjectGetRayTMinEXT"; + case (int)Op::OpHitObjectGetRayFlagsEXT: return "OpHitObjectGetRayFlagsEXT"; + case (int)Op::OpHitObjectIsEmptyEXT: return "OpHitObjectIsEmptyEXT"; + case (int)Op::OpHitObjectIsHitEXT: return "OpHitObjectIsHitEXT"; + case (int)Op::OpHitObjectIsMissEXT: return "OpHitObjectIsMissEXT"; + case (int)Op::OpHitObjectGetShaderBindingTableRecordIndexEXT: return "OpHitObjectGetShaderBindingTableRecordIndexEXT"; + case (int)Op::OpHitObjectGetShaderRecordBufferHandleEXT: return "OpHitObjectGetShaderRecordBufferHandleEXT"; + case (int)Op::OpHitObjectSetShaderBindingTableRecordIndexEXT: return "OpHitObjectSetShaderBindingTableRecordIndexEXT"; + case (int)Op::OpHitObjectReorderExecuteShaderEXT: return "OpHitObjectReorderExecuteEXT"; + case (int)Op::OpHitObjectTraceReorderExecuteEXT: return "OpHitObjectTraceReorderExecuteEXT"; + case (int)Op::OpHitObjectTraceMotionReorderExecuteEXT: return "OpHitObjectTraceMotionReorderExecuteEXT"; + case (int)Op::OpHitObjectRecordFromQueryEXT: return "OpHitObjectRecordFromQueryEXT"; + case (int)Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT: return "OpHitObjectGetIntersectionTriangleVertexPositionsEXT"; + default: return "Bad"; } @@ -1768,6 +1840,7 @@ void Parameterize() InstructionDesc[enumCast(Op::OpTypeStruct)].setResultAndType(true, false); InstructionDesc[enumCast(Op::OpTypeOpaque)].setResultAndType(true, false); InstructionDesc[enumCast(Op::OpTypePointer)].setResultAndType(true, false); + InstructionDesc[enumCast(Op::OpTypeUntypedPointerKHR)].setResultAndType(true, false); InstructionDesc[enumCast(Op::OpTypeForwardPointer)].setResultAndType(false, false); InstructionDesc[enumCast(Op::OpTypeFunction)].setResultAndType(true, false); InstructionDesc[enumCast(Op::OpTypeEvent)].setResultAndType(true, false); @@ -1838,6 +1911,7 @@ void Parameterize() InstructionDesc[enumCast(Op::OpCooperativeVectorStoreNV)].setResultAndType(false, false); InstructionDesc[enumCast(Op::OpCooperativeVectorOuterProductAccumulateNV)].setResultAndType(false, false); InstructionDesc[enumCast(Op::OpCooperativeVectorReduceSumAccumulateNV)].setResultAndType(false, false); + InstructionDesc[enumCast(Op::OpMemberDecorateIdEXT)].setResultAndType(false, false); InstructionDesc[enumCast(Op::OpTypeTensorARM)].setResultAndType(true, false); InstructionDesc[enumCast(Op::OpTensorReadARM)].setResultAndType(true, true); @@ -1992,6 +2066,7 @@ void Parameterize() InstructionDesc[enumCast(Op::OpTypeStruct)].operands.push(OperandVariableIds, "'Member 0 type', +\n'member 1 type', +\n..."); InstructionDesc[enumCast(Op::OpTypeOpaque)].operands.push(OperandLiteralString, "The name of the opaque type."); + InstructionDesc[enumCast(Op::OpTypeUntypedPointerKHR)].operands.push(OperandStorage, ""); InstructionDesc[enumCast(Op::OpTypePointer)].operands.push(OperandStorage, ""); InstructionDesc[enumCast(Op::OpTypePointer)].operands.push(OperandId, "'Type'"); @@ -2019,6 +2094,9 @@ void Parameterize() InstructionDesc[enumCast(Op::OpSpecConstantOp)].operands.push(OperandLiteralNumber, "'Opcode'"); InstructionDesc[enumCast(Op::OpSpecConstantOp)].operands.push(OperandVariableIds, "'Operands'"); + InstructionDesc[enumCast(Op::OpUntypedVariableKHR)].operands.push(OperandStorage, ""); + InstructionDesc[enumCast(Op::OpUntypedVariableKHR)].operands.push(OperandId, "'Type'", true); + InstructionDesc[enumCast(Op::OpUntypedVariableKHR)].operands.push(OperandId, "'Initializer'", true); InstructionDesc[enumCast(Op::OpVariable)].operands.push(OperandStorage, ""); InstructionDesc[enumCast(Op::OpVariable)].operands.push(OperandId, "'Initializer'", true); @@ -2066,6 +2144,11 @@ void Parameterize() InstructionDesc[enumCast(Op::OpMemberDecorate)].operands.push(OperandDecoration, ""); InstructionDesc[enumCast(Op::OpMemberDecorate)].operands.push(OperandVariableLiterals, "See <>."); + InstructionDesc[enumCast(Op::OpMemberDecorateIdEXT)].operands.push(OperandId, "'Structure Type'"); + InstructionDesc[enumCast(Op::OpMemberDecorateIdEXT)].operands.push(OperandLiteralNumber, "'Member'"); + InstructionDesc[enumCast(Op::OpMemberDecorateIdEXT)].operands.push(OperandDecoration, ""); + InstructionDesc[enumCast(Op::OpMemberDecorateIdEXT)].operands.push(OperandVariableIds, "See <>."); + InstructionDesc[enumCast(Op::OpMemberDecorateStringGOOGLE)].operands.push(OperandId, "'Structure Type'"); InstructionDesc[enumCast(Op::OpMemberDecorateStringGOOGLE)].operands.push(OperandLiteralNumber, "'Member'"); InstructionDesc[enumCast(Op::OpMemberDecorateStringGOOGLE)].operands.push(OperandDecoration, ""); @@ -2272,6 +2355,9 @@ void Parameterize() InstructionDesc[enumCast(Op::OpAccessChain)].operands.push(OperandId, "'Base'"); InstructionDesc[enumCast(Op::OpAccessChain)].operands.push(OperandVariableIds, "'Indexes'"); + InstructionDesc[enumCast(Op::OpUntypedAccessChainKHR)].operands.push(OperandId, "'Base Type'"); + InstructionDesc[enumCast(Op::OpUntypedAccessChainKHR)].operands.push(OperandId, "'Base'"); + InstructionDesc[enumCast(Op::OpUntypedAccessChainKHR)].operands.push(OperandVariableIds, "'Indexes'"); InstructionDesc[enumCast(Op::OpInBoundsAccessChain)].operands.push(OperandId, "'Base'"); InstructionDesc[enumCast(Op::OpInBoundsAccessChain)].operands.push(OperandVariableIds, "'Indexes'"); @@ -3109,6 +3195,19 @@ void Parameterize() InstructionDesc[enumCast(Op::OpFragmentFetchAMD)].operands.push(OperandId, "'Coordinate'"); InstructionDesc[enumCast(Op::OpFragmentFetchAMD)].operands.push(OperandId, "'Fragment Index'"); + + InstructionDesc[enumCast(Op::OpTypeBufferEXT)].operands.push(OperandStorage, ""); + InstructionDesc[enumCast(Op::OpTypeBufferEXT)].setResultAndType(true, false); + + InstructionDesc[enumCast(Op::OpConstantSizeOfEXT)].operands.push(OperandId, "'Type'"); + + InstructionDesc[enumCast(Op::OpBufferPointerEXT)].operands.push(OperandId, "'Buffer'"); + + InstructionDesc[enumCast(Op::OpUntypedImageTexelPointerEXT)].operands.push(OperandId, "'ImageType'"); + InstructionDesc[enumCast(Op::OpUntypedImageTexelPointerEXT)].operands.push(OperandId, "'Image'"); + InstructionDesc[enumCast(Op::OpUntypedImageTexelPointerEXT)].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[enumCast(Op::OpUntypedImageTexelPointerEXT)].operands.push(OperandId, "'Sample'"); + InstructionDesc[enumCast(Op::OpGroupNonUniformPartitionNV)].operands.push(OperandId, "X"); InstructionDesc[enumCast(Op::OpGroupNonUniformQuadAllKHR)].operands.push(OperandId, "'Predicate'"); @@ -3724,6 +3823,19 @@ void Parameterize() InstructionDesc[enumCast(Op::OpImageBlockMatchGatherSADQCOM)].operands.push(OperandImageOperands, "", true); InstructionDesc[enumCast(Op::OpImageBlockMatchGatherSADQCOM)].setResultAndType(true, true); + InstructionDesc[enumCast(Op::OpBitCastArrayQCOM)].operands.push(OperandId, "'source array'"); + InstructionDesc[enumCast(Op::OpBitCastArrayQCOM)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpCompositeConstructCoopMatQCOM)].operands.push(OperandId, "'source array'"); + InstructionDesc[enumCast(Op::OpCompositeConstructCoopMatQCOM)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpCompositeExtractCoopMatQCOM)].operands.push(OperandId, "'source cooperative matrix'"); + InstructionDesc[enumCast(Op::OpCompositeExtractCoopMatQCOM)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpExtractSubArrayQCOM)].operands.push(OperandId, "'source array'"); + InstructionDesc[enumCast(Op::OpExtractSubArrayQCOM)].operands.push(OperandId, "'start index'"); + InstructionDesc[enumCast(Op::OpExtractSubArrayQCOM)].setResultAndType(true, true); + InstructionDesc[enumCast(Op::OpConstantCompositeReplicateEXT)].operands.push(OperandId, "'Value'"); InstructionDesc[enumCast(Op::OpSpecConstantCompositeReplicateEXT)].operands.push(OperandId, "'Value'"); InstructionDesc[enumCast(Op::OpCompositeConstructReplicateEXT)].operands.push(OperandId, "'Value'"); @@ -3833,6 +3945,191 @@ void Parameterize() InstructionDesc[enumCast(Op::OpTensorQuerySizeARM)].operands.push(OperandId, "'Tensor'"); InstructionDesc[enumCast(Op::OpTensorQuerySizeARM)].operands.push(OperandId, "'Dimension'", true); + InstructionDesc[enumCast(Op::OpTypeHitObjectEXT)].setResultAndType(true, false); + + InstructionDesc[enumCast(Op::OpHitObjectGetShaderRecordBufferHandleNV)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetShaderRecordBufferHandleNV)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetShaderRecordBufferHandleEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetShaderRecordBufferHandleEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpReorderThreadWithHintEXT)].operands.push(OperandId, "'Hint'"); + InstructionDesc[enumCast(Op::OpReorderThreadWithHintEXT)].operands.push(OperandId, "'Bits'"); + InstructionDesc[enumCast(Op::OpReorderThreadWithHintEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpReorderThreadWithHitObjectEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpReorderThreadWithHitObjectEXT)].operands.push(OperandId, "'Hint'"); + InstructionDesc[enumCast(Op::OpReorderThreadWithHitObjectEXT)].operands.push(OperandId, "'Bits'"); + InstructionDesc[enumCast(Op::OpReorderThreadWithHitObjectEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectGetCurrentTimeEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetCurrentTimeEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetHitKindEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetHitKindEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetPrimitiveIndexEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetPrimitiveIndexEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetGeometryIndexEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetGeometryIndexEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetInstanceIdEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetInstanceIdEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetInstanceCustomIndexEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetInstanceCustomIndexEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetObjectRayDirectionEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetObjectRayDirectionEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetObjectRayOriginEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetObjectRayOriginEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetWorldRayDirectionEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetWorldRayDirectionEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetWorldRayOriginEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetWorldRayOriginEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetWorldToObjectEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetWorldToObjectEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetObjectToWorldEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetObjectToWorldEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetRayTMaxEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetRayTMaxEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetRayTMinEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetRayTMinEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetRayFlagsEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetRayFlagsEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetShaderBindingTableRecordIndexEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetShaderBindingTableRecordIndexEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectIsEmptyEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectIsEmptyEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectIsHitEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectIsHitEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectIsMissEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectIsMissEXT)].setResultAndType(true, true); + + InstructionDesc[enumCast(Op::OpHitObjectGetAttributesEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetAttributesEXT)].operands.push(OperandId, "'HitObjectAttribute'"); + InstructionDesc[enumCast(Op::OpHitObjectGetAttributesEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectExecuteShaderEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectExecuteShaderEXT)].operands.push(OperandId, "'Payload'"); + InstructionDesc[enumCast(Op::OpHitObjectExecuteShaderEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectRecordMissEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissEXT)].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissEXT)].operands.push(OperandId, "'SBT Index'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissEXT)].operands.push(OperandId, "'Origin'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissEXT)].operands.push(OperandId, "'TMin'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissEXT)].operands.push(OperandId, "'Direction'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissEXT)].operands.push(OperandId, "'TMax'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].operands.push(OperandId, "'SBT Index'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].operands.push(OperandId, "'Origin'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].operands.push(OperandId, "'TMin'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].operands.push(OperandId, "'Direction'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].operands.push(OperandId, "'TMax'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].operands.push(OperandId, "'Current Time'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordMissMotionEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectRecordEmptyEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordEmptyEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'Cullmask'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'Origin'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'TMin'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'Direction'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'TMax'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].operands.push(OperandId, "'Payload'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'Cullmask'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'Origin'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'TMin'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'Direction'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'TMax'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'Time'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].operands.push(OperandId, "'Payload'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceRayMotionEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectSetShaderBindingTableRecordIndexEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectSetShaderBindingTableRecordIndexEXT)].operands.push(OperandId, "'SBT Record Index'"); + InstructionDesc[enumCast(Op::OpHitObjectSetShaderBindingTableRecordIndexEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectReorderExecuteShaderEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectReorderExecuteShaderEXT)].operands.push(OperandId, "'Payload'"); + InstructionDesc[enumCast(Op::OpHitObjectReorderExecuteShaderEXT)].operands.push(OperandId, "'Hint'"); + InstructionDesc[enumCast(Op::OpHitObjectReorderExecuteShaderEXT)].operands.push(OperandId, "'Bits'"); + InstructionDesc[enumCast(Op::OpHitObjectReorderExecuteShaderEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'Cullmask'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'Origin'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'TMin'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'Direction'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'TMax'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'Payload'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'Hint'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].operands.push(OperandId, "'Bits'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceReorderExecuteEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Cullmask'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Origin'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'TMin'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Direction'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'TMax'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Time'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Payload'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Hint'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].operands.push(OperandId, "'Bits'"); + InstructionDesc[enumCast(Op::OpHitObjectTraceMotionReorderExecuteEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectRecordFromQueryEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordFromQueryEXT)].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordFromQueryEXT)].operands.push(OperandId, "'SBT Record Index'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordFromQueryEXT)].operands.push(OperandId, "'HitObjectAttribute'"); + InstructionDesc[enumCast(Op::OpHitObjectRecordFromQueryEXT)].setResultAndType(false, false); + + InstructionDesc[enumCast(Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT)].operands.push(OperandId, "'HitObject'"); + InstructionDesc[enumCast(Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT)].setResultAndType(true, true); + }); } diff --git a/third_party/glslang/SPIRV/spirv.hpp11 b/third_party/glslang/SPIRV/spirv.hpp11 index 32d5cd29b6..36a82e7a39 100644 --- a/third_party/glslang/SPIRV/spirv.hpp11 +++ b/third_party/glslang/SPIRV/spirv.hpp11 @@ -207,6 +207,7 @@ enum class ExecutionMode : unsigned { SampleInterlockUnorderedEXT = 5369, ShadingRateInterlockOrderedEXT = 5370, ShadingRateInterlockUnorderedEXT = 5371, + Shader64BitIndexingEXT = 5427, SharedLocalMemorySizeINTEL = 5618, RoundingModeRTPINTEL = 5620, RoundingModeRTNINTEL = 5621, @@ -261,6 +262,7 @@ enum class StorageClass : unsigned { PhysicalStorageBufferEXT = 5349, HitObjectAttributeNV = 5385, TaskPayloadWorkgroupEXT = 5402, + HitObjectAttributeEXT = 5411, CodeSectionINTEL = 5605, DeviceOnlyINTEL = 5936, HostOnlyINTEL = 5937, @@ -546,7 +548,7 @@ enum class Decoration : unsigned { Alignment = 44, MaxByteOffset = 45, AlignmentId = 46, - MaxByteOffsetId = 47, + MaxByteOffsetId = 47, SaturatedToLargestFloat8NormalConversionEXT = 4216, NoSignedWrap = 4469, NoUnsignedWrap = 4470, @@ -562,6 +564,8 @@ enum class Decoration : unsigned { PayloadNodeSparseArrayAMDX = 5099, PayloadNodeArraySizeAMDX = 5100, PayloadDispatchIndirectAMDX = 5105, + ArrayStrideIdEXT = 5124, + OffsetIdEXT = 5125, OverrideCoverageNV = 5248, PassthroughNV = 5250, ViewportRelativeNV = 5252, @@ -578,7 +582,10 @@ enum class Decoration : unsigned { RestrictPointerEXT = 5355, AliasedPointer = 5356, AliasedPointerEXT = 5356, + MemberOffsetNV = 5358, HitObjectShaderRecordBufferNV = 5386, + HitObjectShaderRecordBufferEXT = 5389, + BankNV = 5397, BindlessSamplerNV = 5398, BindlessImageNV = 5399, BoundSamplerNV = 5400, @@ -730,6 +737,8 @@ enum class BuiltIn : unsigned { FragStencilRefEXT = 5014, RemainingRecursionLevelsAMDX = 5021, ShaderIndexAMDX = 5073, + SamplerHeapEXT = 5122, + ResourceHeapEXT = 5123, ViewportMaskNV = 5253, SecondaryPositionNV = 5257, SecondaryViewportMaskNV = 5258, @@ -1110,6 +1119,7 @@ enum class Capability : unsigned { TextureBoxFilterQCOM = 4485, TextureBlockMatchQCOM = 4486, TileShadingQCOM = 4495, + CooperativeMatrixConversionQCOM = 4496, TextureBlockMatch2QCOM = 4498, Float16ImageAMD = 5008, ImageGatherBiasLodAMD = 5009, @@ -1123,6 +1133,7 @@ enum class Capability : unsigned { BFloat16TypeKHR = 5116, BFloat16DotProductKHR = 5117, BFloat16CooperativeMatrixKHR = 5118, + DescriptorHeapEXT = 5128, SampleMaskOverrideCoverageNV = 5249, GeometryShaderPassthroughNV = 5251, ShaderViewportIndexLayerEXT = 5254, @@ -1187,6 +1198,7 @@ enum class Capability : unsigned { DisplacementMicromapNV = 5380, RayTracingOpacityMicromapEXT = 5381, ShaderInvocationReorderNV = 5383, + ShaderInvocationReorderEXT = 5388, BindlessTextureNV = 5390, RayQueryPositionFetchKHR = 5391, CooperativeVectorNV = 5394, @@ -1195,6 +1207,9 @@ enum class Capability : unsigned { RawAccessChainsNV = 5414, RayTracingSpheresGeometryNV = 5418, RayTracingLinearSweptSpheresGeometryNV = 5419, + PushConstantBanksNV = 5423, + LongVectorEXT = 5425, + Shader64BitIndexingEXT = 5426, CooperativeMatrixReductionsNV = 5430, CooperativeMatrixConversionsNV = 5431, CooperativeMatrixPerElementOperationsNV = 5432, @@ -1559,8 +1574,8 @@ enum class RawAccessChainOperandsMask : unsigned { enum class FPEncoding : unsigned { BFloat16KHR = 0, - Float8E4M3EXT = 4214, - Float8E5M2EXT = 4215, + Float8E4M3EXT = 4214, + Float8E5M2EXT = 4215, Max = 0x7fffffff, }; @@ -1996,10 +2011,14 @@ enum class Op : unsigned { OpImageBoxFilterQCOM = 4481, OpImageBlockMatchSSDQCOM = 4482, OpImageBlockMatchSADQCOM = 4483, + OpBitCastArrayQCOM = 4497, OpImageBlockMatchWindowSSDQCOM = 4500, OpImageBlockMatchWindowSADQCOM = 4501, OpImageBlockMatchGatherSSDQCOM = 4502, OpImageBlockMatchGatherSADQCOM = 4503, + OpCompositeConstructCoopMatQCOM = 4540, + OpCompositeExtractCoopMatQCOM = 4541, + OpExtractSubArrayQCOM = 4542, OpGroupIAddNonUniformAMD = 5000, OpGroupFAddNonUniformAMD = 5001, OpGroupFMinNonUniformAMD = 5002, @@ -2021,6 +2040,11 @@ enum class Op : unsigned { OpSpecConstantStringAMDX = 5104, OpGroupNonUniformQuadAllKHR = 5110, OpGroupNonUniformQuadAnyKHR = 5111, + OpTypeBufferEXT = 5115, + OpBufferPointerEXT = 5119, + OpUntypedImageTexelPointerEXT = 5126, + OpMemberDecorateIdEXT = 5127, + OpConstantSizeOfEXT = 5129, OpHitObjectRecordHitMotionNV = 5249, OpHitObjectRecordHitWithIndexMotionNV = 5250, OpHitObjectRecordMissMotionNV = 5251, @@ -2056,6 +2080,7 @@ enum class Op : unsigned { OpTypeHitObjectNV = 5281, OpImageSampleFootprintNV = 5283, OpTypeCooperativeVectorNV = 5288, + OpTypeVectorIdEXT = 5288, OpCooperativeVectorMatrixMulNV = 5289, OpCooperativeVectorOuterProductAccumulateNV = 5290, OpCooperativeVectorReduceSumAccumulateNV = 5291, @@ -2069,6 +2094,36 @@ enum class Op : unsigned { OpFetchMicroTriangleVertexBarycentricNV = 5301, OpCooperativeVectorLoadNV = 5302, OpCooperativeVectorStoreNV = 5303, + OpHitObjectRecordFromQueryEXT = 5304, + OpHitObjectRecordMissEXT = 5305, + OpHitObjectRecordMissMotionEXT = 5306, + OpHitObjectGetIntersectionTriangleVertexPositionsEXT = 5307, + OpHitObjectGetRayFlagsEXT = 5308, + OpHitObjectSetShaderBindingTableRecordIndexEXT = 5309, + OpHitObjectReorderExecuteShaderEXT = 5310, + OpHitObjectTraceReorderExecuteEXT = 5311, + OpHitObjectTraceMotionReorderExecuteEXT = 5312, + OpTypeHitObjectEXT = 5313, + OpReorderThreadWithHintEXT = 5314, + OpReorderThreadWithHitObjectEXT = 5315, + OpHitObjectTraceRayEXT = 5316, + OpHitObjectTraceRayMotionEXT = 5317, + OpHitObjectRecordEmptyEXT = 5318, + OpHitObjectExecuteShaderEXT = 5319, + OpHitObjectGetCurrentTimeEXT = 5320, + OpHitObjectGetAttributesEXT = 5321, + OpHitObjectGetHitKindEXT = 5322, + OpHitObjectGetPrimitiveIndexEXT = 5323, + OpHitObjectGetGeometryIndexEXT = 5324, + OpHitObjectGetInstanceIdEXT = 5325, + OpHitObjectGetInstanceCustomIndexEXT = 5326, + OpHitObjectGetObjectRayOriginEXT = 5327, + OpHitObjectGetObjectRayDirectionEXT = 5328, + OpHitObjectGetWorldRayDirectionEXT = 5329, + OpHitObjectGetWorldRayOriginEXT = 5330, + OpHitObjectGetObjectToWorldEXT = 5331, + OpHitObjectGetWorldToObjectEXT = 5332, + OpHitObjectGetRayTMaxEXT = 5333, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, @@ -2082,6 +2137,12 @@ enum class Op : unsigned { OpExecuteCallableNV = 5344, OpRayQueryGetClusterIdNV = 5345, OpHitObjectGetClusterIdNV = 5346, + OpHitObjectGetRayTMinEXT = 5347, + OpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, + OpHitObjectGetShaderRecordBufferHandleEXT = 5349, + OpHitObjectIsEmptyEXT = 5350, + OpHitObjectIsHitEXT = 5351, + OpHitObjectIsMissEXT = 5352, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixStoreNV = 5360, @@ -2770,6 +2831,11 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; case Op::OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; case Op::OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpBufferPointerEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpUntypedImageTexelPointerEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpMemberDecorateIdEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpConstantSizeOfEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpTypeBufferEXT: *hasResult = true; *hasResultType = false; break; case Op::OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; case Op::OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; case Op::OpExtInstWithForwardRefsKHR: *hasResult = true; *hasResultType = true; break; @@ -2803,10 +2869,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break; case Op::OpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break; case Op::OpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break; + case Op::OpBitCastArrayQCOM: *hasResult = true; *hasResultType = true; break; case Op::OpImageBlockMatchWindowSSDQCOM: *hasResult = true; *hasResultType = true; break; case Op::OpImageBlockMatchWindowSADQCOM: *hasResult = true; *hasResultType = true; break; case Op::OpImageBlockMatchGatherSSDQCOM: *hasResult = true; *hasResultType = true; break; case Op::OpImageBlockMatchGatherSADQCOM: *hasResult = true; *hasResultType = true; break; + case Op::OpCompositeConstructCoopMatQCOM: *hasResult = true; *hasResultType = true; break; + case Op::OpCompositeExtractCoopMatQCOM: *hasResult = true; *hasResultType = true; break; + case Op::OpExtractSubArrayQCOM: *hasResult = true; *hasResultType = true; break; case Op::OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case Op::OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case Op::OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; @@ -2876,6 +2946,36 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpFetchMicroTriangleVertexBarycentricNV: *hasResult = true; *hasResultType = true; break; case Op::OpCooperativeVectorLoadNV: *hasResult = true; *hasResultType = true; break; case Op::OpCooperativeVectorStoreNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordFromQueryEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordMissEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordMissMotionEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetRayFlagsEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectSetShaderBindingTableRecordIndexEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectReorderExecuteShaderEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceReorderExecuteEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceMotionReorderExecuteEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpTypeHitObjectEXT: *hasResult = true; *hasResultType = false; break; + case Op::OpReorderThreadWithHintEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpReorderThreadWithHitObjectEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceRayEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceRayMotionEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordEmptyEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectExecuteShaderEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetCurrentTimeEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetAttributesEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetHitKindEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetPrimitiveIndexEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetGeometryIndexEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetInstanceIdEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetInstanceCustomIndexEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectRayOriginEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectRayDirectionEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetWorldRayDirectionEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetWorldRayOriginEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectToWorldEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetWorldToObjectEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetRayTMaxEXT: *hasResult = true; *hasResultType = true; break; case Op::OpReportIntersectionKHR: *hasResult = true; *hasResultType = true; break; case Op::OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break; case Op::OpTerminateRayNV: *hasResult = false; *hasResultType = false; break; @@ -2887,6 +2987,12 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; case Op::OpRayQueryGetClusterIdNV: *hasResult = true; *hasResultType = true; break; case Op::OpHitObjectGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetRayTMinEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetShaderBindingTableRecordIndexEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetShaderRecordBufferHandleEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsEmptyEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsHitEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsMissEXT: *hasResult = true; *hasResultType = true; break; case Op::OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; case Op::OpCooperativeMatrixLoadNV: *hasResult = true; *hasResultType = true; break; case Op::OpCooperativeMatrixStoreNV: *hasResult = false; *hasResultType = false; break; @@ -3341,6 +3447,7 @@ inline const char* ExecutionModeToString(ExecutionMode value) { case ExecutionMode::SampleInterlockUnorderedEXT: return "SampleInterlockUnorderedEXT"; case ExecutionMode::ShadingRateInterlockOrderedEXT: return "ShadingRateInterlockOrderedEXT"; case ExecutionMode::ShadingRateInterlockUnorderedEXT: return "ShadingRateInterlockUnorderedEXT"; + case ExecutionMode::Shader64BitIndexingEXT: return "Shader64BitIndexingEXT"; case ExecutionMode::SharedLocalMemorySizeINTEL: return "SharedLocalMemorySizeINTEL"; case ExecutionMode::RoundingModeRTPINTEL: return "RoundingModeRTPINTEL"; case ExecutionMode::RoundingModeRTNINTEL: return "RoundingModeRTNINTEL"; @@ -3390,6 +3497,7 @@ inline const char* StorageClassToString(StorageClass value) { case StorageClass::PhysicalStorageBuffer: return "PhysicalStorageBuffer"; case StorageClass::HitObjectAttributeNV: return "HitObjectAttributeNV"; case StorageClass::TaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT"; + case StorageClass::HitObjectAttributeEXT: return "HitObjectAttributeEXT"; case StorageClass::CodeSectionINTEL: return "CodeSectionINTEL"; case StorageClass::DeviceOnlyINTEL: return "DeviceOnlyINTEL"; case StorageClass::HostOnlyINTEL: return "HostOnlyINTEL"; @@ -3621,7 +3729,7 @@ inline const char* DecorationToString(Decoration value) { case Decoration::Alignment: return "Alignment"; case Decoration::MaxByteOffset: return "MaxByteOffset"; case Decoration::AlignmentId: return "AlignmentId"; - case Decoration::MaxByteOffsetId: return "MaxByteOffsetId"; + case Decoration::MaxByteOffsetId: return "MaxByteOffsetId"; case Decoration::SaturatedToLargestFloat8NormalConversionEXT: return "SaturatedToLargestFloat8NormalConversionEXT"; case Decoration::NoSignedWrap: return "NoSignedWrap"; case Decoration::NoUnsignedWrap: return "NoUnsignedWrap"; @@ -3648,7 +3756,10 @@ inline const char* DecorationToString(Decoration value) { case Decoration::NonUniform: return "NonUniform"; case Decoration::RestrictPointer: return "RestrictPointer"; case Decoration::AliasedPointer: return "AliasedPointer"; + case Decoration::MemberOffsetNV: return "MemberOffsetNV"; case Decoration::HitObjectShaderRecordBufferNV: return "HitObjectShaderRecordBufferNV"; + case Decoration::BankNV: return "BankNV"; + case Decoration::HitObjectShaderRecordBufferEXT: return "HitObjectShaderRecordBufferEXT"; case Decoration::BindlessSamplerNV: return "BindlessSamplerNV"; case Decoration::BindlessImageNV: return "BindlessImageNV"; case Decoration::BoundSamplerNV: return "BoundSamplerNV"; @@ -3967,8 +4078,8 @@ inline const char* CapabilityToString(Capability value) { case Capability::TileImageStencilReadAccessEXT: return "TileImageStencilReadAccessEXT"; case Capability::TensorsARM: return "TensorsARM"; case Capability::CooperativeMatrixLayoutsARM: return "CooperativeMatrixLayoutsARM"; - case Capability::Float8EXT: return "Float8EXT"; - case Capability::Float8CooperativeMatrixEXT: return "Float8CooperativeMatrixEXT"; + case Capability::Float8EXT: return "Float8EXT"; + case Capability::Float8CooperativeMatrixEXT: return "Float8CooperativeMatrixEXT"; case Capability::FragmentShadingRateKHR: return "FragmentShadingRateKHR"; case Capability::SubgroupBallotKHR: return "SubgroupBallotKHR"; case Capability::DrawParameters: return "DrawParameters"; @@ -4003,6 +4114,7 @@ inline const char* CapabilityToString(Capability value) { case Capability::TextureBoxFilterQCOM: return "TextureBoxFilterQCOM"; case Capability::TextureBlockMatchQCOM: return "TextureBlockMatchQCOM"; case Capability::TileShadingQCOM: return "TileShadingQCOM"; + case Capability::CooperativeMatrixConversionQCOM: return "CooperativeMatrixConversionQCOM"; case Capability::TextureBlockMatch2QCOM: return "TextureBlockMatch2QCOM"; case Capability::Float16ImageAMD: return "Float16ImageAMD"; case Capability::ImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD"; @@ -4059,6 +4171,7 @@ inline const char* CapabilityToString(Capability value) { case Capability::DisplacementMicromapNV: return "DisplacementMicromapNV"; case Capability::RayTracingOpacityMicromapEXT: return "RayTracingOpacityMicromapEXT"; case Capability::ShaderInvocationReorderNV: return "ShaderInvocationReorderNV"; + case Capability::ShaderInvocationReorderEXT: return "ShaderInvocationReorderEXT"; case Capability::BindlessTextureNV: return "BindlessTextureNV"; case Capability::RayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR"; case Capability::CooperativeVectorNV: return "CooperativeVectorNV"; @@ -4067,6 +4180,9 @@ inline const char* CapabilityToString(Capability value) { case Capability::RawAccessChainsNV: return "RawAccessChainsNV"; case Capability::RayTracingSpheresGeometryNV: return "RayTracingSpheresGeometryNV"; case Capability::RayTracingLinearSweptSpheresGeometryNV: return "RayTracingLinearSweptSpheresGeometryNV"; + case Capability::PushConstantBanksNV: return "PushConstantBanksNV"; + case Capability::LongVectorEXT: return "LongVectorEXT"; + case Capability::Shader64BitIndexingEXT: return "Shader64BitIndexingEXT"; case Capability::CooperativeMatrixReductionsNV: return "CooperativeMatrixReductionsNV"; case Capability::CooperativeMatrixConversionsNV: return "CooperativeMatrixConversionsNV"; case Capability::CooperativeMatrixPerElementOperationsNV: return "CooperativeMatrixPerElementOperationsNV"; @@ -4307,8 +4423,8 @@ inline const char* NamedMaximumNumberOfRegistersToString(NamedMaximumNumberOfReg inline const char* FPEncodingToString(FPEncoding value) { switch (value) { case FPEncoding::BFloat16KHR: return "BFloat16KHR"; - case FPEncoding::Float8E4M3EXT: return "Float8E4M3EXT"; - case FPEncoding::Float8E5M2EXT: return "Float8E5M2EXT"; + case FPEncoding::Float8E4M3EXT: return "Float8E4M3EXT"; + case FPEncoding::Float8E5M2EXT: return "Float8E5M2EXT"; default: return "Unknown"; } } @@ -4711,6 +4827,11 @@ inline const char* OpToString(Op value) { case Op::OpSubgroupAllKHR: return "OpSubgroupAllKHR"; case Op::OpSubgroupAnyKHR: return "OpSubgroupAnyKHR"; case Op::OpSubgroupAllEqualKHR: return "OpSubgroupAllEqualKHR"; + case Op::OpBufferPointerEXT: return "OpBufferPointerEXT"; + case Op::OpUntypedImageTexelPointerEXT: return "OpUntypedImageTexelPointerEXT"; + case Op::OpMemberDecorateIdEXT: return "OpMemberDecorateIdEXT"; + case Op::OpConstantSizeOfEXT: return "OpConstantSizeOfEXT"; + case Op::OpTypeBufferEXT: return "OpTypeBufferEXT"; case Op::OpGroupNonUniformRotateKHR: return "OpGroupNonUniformRotateKHR"; case Op::OpSubgroupReadInvocationKHR: return "OpSubgroupReadInvocationKHR"; case Op::OpExtInstWithForwardRefsKHR: return "OpExtInstWithForwardRefsKHR"; @@ -4744,10 +4865,14 @@ inline const char* OpToString(Op value) { case Op::OpImageBoxFilterQCOM: return "OpImageBoxFilterQCOM"; case Op::OpImageBlockMatchSSDQCOM: return "OpImageBlockMatchSSDQCOM"; case Op::OpImageBlockMatchSADQCOM: return "OpImageBlockMatchSADQCOM"; + case Op::OpBitCastArrayQCOM: return "OpBitCastArrayQCOM"; case Op::OpImageBlockMatchWindowSSDQCOM: return "OpImageBlockMatchWindowSSDQCOM"; case Op::OpImageBlockMatchWindowSADQCOM: return "OpImageBlockMatchWindowSADQCOM"; case Op::OpImageBlockMatchGatherSSDQCOM: return "OpImageBlockMatchGatherSSDQCOM"; case Op::OpImageBlockMatchGatherSADQCOM: return "OpImageBlockMatchGatherSADQCOM"; + case Op::OpCompositeConstructCoopMatQCOM: return "OpCompositeConstructCoopMatQCOM"; + case Op::OpCompositeExtractCoopMatQCOM: return "OpCompositeExtractCoopMatQCOM"; + case Op::OpExtractSubArrayQCOM: return "OpExtractSubArrayQCOM"; case Op::OpGroupIAddNonUniformAMD: return "OpGroupIAddNonUniformAMD"; case Op::OpGroupFAddNonUniformAMD: return "OpGroupFAddNonUniformAMD"; case Op::OpGroupFMinNonUniformAMD: return "OpGroupFMinNonUniformAMD"; @@ -4817,6 +4942,36 @@ inline const char* OpToString(Op value) { case Op::OpFetchMicroTriangleVertexBarycentricNV: return "OpFetchMicroTriangleVertexBarycentricNV"; case Op::OpCooperativeVectorLoadNV: return "OpCooperativeVectorLoadNV"; case Op::OpCooperativeVectorStoreNV: return "OpCooperativeVectorStoreNV"; + case Op::OpHitObjectRecordFromQueryEXT: return "OpHitObjectRecordFromQueryEXT"; + case Op::OpHitObjectRecordMissEXT: return "OpHitObjectRecordMissEXT"; + case Op::OpHitObjectRecordMissMotionEXT: return "OpHitObjectRecordMissMotionEXT"; + case Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT: return "OpHitObjectGetIntersectionTriangleVertexPositionsEXT"; + case Op::OpHitObjectGetRayFlagsEXT: return "OpHitObjectGetRayFlagsEXT"; + case Op::OpHitObjectSetShaderBindingTableRecordIndexEXT: return "OpHitObjectSetShaderBindingTableRecordIndexEXT"; + case Op::OpHitObjectReorderExecuteShaderEXT: return "OpHitObjectReorderExecuteShaderEXT"; + case Op::OpHitObjectTraceReorderExecuteEXT: return "OpHitObjectTraceReorderExecuteEXT"; + case Op::OpHitObjectTraceMotionReorderExecuteEXT: return "OpHitObjectTraceMotionReorderExecuteEXT"; + case Op::OpTypeHitObjectEXT: return "OpTypeHitObjectEXT"; + case Op::OpReorderThreadWithHintEXT: return "OpReorderThreadWithHintEXT"; + case Op::OpReorderThreadWithHitObjectEXT: return "OpReorderThreadWithHitObjectEXT"; + case Op::OpHitObjectTraceRayEXT: return "OpHitObjectTraceRayEXT"; + case Op::OpHitObjectTraceRayMotionEXT: return "OpHitObjectTraceRayMotionEXT"; + case Op::OpHitObjectRecordEmptyEXT: return "OpHitObjectRecordEmptyEXT"; + case Op::OpHitObjectExecuteShaderEXT: return "OpHitObjectExecuteShaderEXT"; + case Op::OpHitObjectGetCurrentTimeEXT: return "OpHitObjectGetCurrentTimeEXT"; + case Op::OpHitObjectGetAttributesEXT: return "OpHitObjectGetAttributesEXT"; + case Op::OpHitObjectGetHitKindEXT: return "OpHitObjectGetHitKindEXT"; + case Op::OpHitObjectGetPrimitiveIndexEXT: return "OpHitObjectGetPrimitiveIndexEXT"; + case Op::OpHitObjectGetGeometryIndexEXT: return "OpHitObjectGetGeometryIndexEXT"; + case Op::OpHitObjectGetInstanceIdEXT: return "OpHitObjectGetInstanceIdEXT"; + case Op::OpHitObjectGetInstanceCustomIndexEXT: return "OpHitObjectGetInstanceCustomIndexEXT"; + case Op::OpHitObjectGetObjectRayOriginEXT: return "OpHitObjectGetObjectRayOriginEXT"; + case Op::OpHitObjectGetObjectRayDirectionEXT: return "OpHitObjectGetObjectRayDirectionEXT"; + case Op::OpHitObjectGetWorldRayDirectionEXT: return "OpHitObjectGetWorldRayDirectionEXT"; + case Op::OpHitObjectGetWorldRayOriginEXT: return "OpHitObjectGetWorldRayOriginEXT"; + case Op::OpHitObjectGetObjectToWorldEXT: return "OpHitObjectGetObjectToWorldEXT"; + case Op::OpHitObjectGetWorldToObjectEXT: return "OpHitObjectGetWorldToObjectEXT"; + case Op::OpHitObjectGetRayTMaxEXT: return "OpHitObjectGetRayTMaxEXT"; case Op::OpReportIntersectionKHR: return "OpReportIntersectionKHR"; case Op::OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV"; case Op::OpTerminateRayNV: return "OpTerminateRayNV"; @@ -4828,6 +4983,12 @@ inline const char* OpToString(Op value) { case Op::OpExecuteCallableNV: return "OpExecuteCallableNV"; case Op::OpRayQueryGetClusterIdNV: return "OpRayQueryGetClusterIdNV"; case Op::OpHitObjectGetClusterIdNV: return "OpHitObjectGetClusterIdNV"; + case Op::OpHitObjectGetRayTMinEXT: return "OpHitObjectGetRayTMinEXT"; + case Op::OpHitObjectGetShaderBindingTableRecordIndexEXT: return "OpHitObjectGetShaderBindingTableRecordIndexEXT"; + case Op::OpHitObjectGetShaderRecordBufferHandleEXT: return "OpHitObjectGetShaderRecordBufferHandleEXT"; + case Op::OpHitObjectIsEmptyEXT: return "OpHitObjectIsEmptyEXT"; + case Op::OpHitObjectIsHitEXT: return "OpHitObjectIsHitEXT"; + case Op::OpHitObjectIsMissEXT: return "OpHitObjectIsMissEXT"; case Op::OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV"; case Op::OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV"; case Op::OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV"; diff --git a/third_party/glslang/SPIRV/spvIR.h b/third_party/glslang/SPIRV/spvIR.h index f1039cfdb3..ce7afbcce5 100644 --- a/third_party/glslang/SPIRV/spvIR.h +++ b/third_party/glslang/SPIRV/spvIR.h @@ -222,6 +222,7 @@ public: } Id getResultId() const { return resultId; } Id getTypeId() const { return typeId; } + void setTypeId(Id tId) { typeId = tId; } Id getIdOperand(int op) const { assert(idOperand[op]); return operands[op]; @@ -574,7 +575,8 @@ public: } StorageClass getStorageClass(Id typeId) const { - assert(idToInstruction[typeId]->getOpCode() == spv::Op::OpTypePointer); + assert(idToInstruction[typeId]->getOpCode() == spv::Op::OpTypePointer || + idToInstruction[typeId]->getOpCode() == spv::Op::OpTypeUntypedPointerKHR); return (StorageClass)idToInstruction[typeId]->getImmediateOperand(0); } diff --git a/third_party/glslang/SPIRV/tnt/CMakeLists.txt b/third_party/glslang/SPIRV/tnt/CMakeLists.txt index 24a7f48a3b..b82368a8fb 100644 --- a/third_party/glslang/SPIRV/tnt/CMakeLists.txt +++ b/third_party/glslang/SPIRV/tnt/CMakeLists.txt @@ -4,7 +4,6 @@ set(SOURCES ../Logger.cpp ../SpvBuilder.cpp ../SpvPostProcess.cpp - ../SPVRemapper.cpp ../doc.cpp ../disassemble.cpp) @@ -21,7 +20,6 @@ set(HEADERS ../SpvBuilder.h ../spvIR.h ../doc.h - ../SPVRemapper.h ../disassemble.h) if(ENABLE_AMD_EXTENSIONS) diff --git a/third_party/glslang/StandAlone/CMakeLists.txt b/third_party/glslang/StandAlone/CMakeLists.txt index 18a24ce3ff..e7707524e5 100644 --- a/third_party/glslang/StandAlone/CMakeLists.txt +++ b/third_party/glslang/StandAlone/CMakeLists.txt @@ -74,16 +74,6 @@ target_link_libraries(glslang-standalone ${LIBRARIES}) target_include_directories(glslang-standalone PUBLIC $) -if(ENABLE_SPIRV) - if(ENABLE_SPVREMAPPER) - set(REMAPPER_SOURCES spirv-remap.cpp) - add_executable(spirv-remap ${REMAPPER_SOURCES}) - set_property(TARGET spirv-remap PROPERTY FOLDER tools) - glslang_set_link_args(spirv-remap) - target_link_libraries(spirv-remap SPVRemapper ${LIBRARIES}) - endif() -endif() - if(WIN32) source_group("Source" FILES ${SOURCES}) endif() @@ -114,9 +104,4 @@ if(GLSLANG_ENABLE_INSTALL) ) ") - if(ENABLE_SPIRV) - if(ENABLE_SPVREMAPPER) - install(TARGETS spirv-remap EXPORT glslang-targets) - endif() - endif() endif() diff --git a/third_party/glslang/StandAlone/StandAlone.cpp b/third_party/glslang/StandAlone/StandAlone.cpp index b1853b024b..c98551c4ab 100644 --- a/third_party/glslang/StandAlone/StandAlone.cpp +++ b/third_party/glslang/StandAlone/StandAlone.cpp @@ -113,6 +113,7 @@ enum TOptions : uint64_t { EOptionDisplayErrorColumn = (1ull << 33), EOptionLinkTimeOptimization = (1ull << 34), EOptionValidateCrossStageIO = (1ull << 35), + EOptionBindingsPerResourceType = (1ull << 36), }; bool targetHlslFunctionality1 = false; bool SpvToolsDisassembler = false; @@ -815,6 +816,14 @@ void ProcessArguments(std::vector>& workItem lowerword == "shift-ssbo-binding" || lowerword == "sbb") { ProcessBindingBase(argc, argv, glslang::EResSsbo); + } else if (lowerword == "shift-combined-sampler-bindings" || + lowerword == "shift-combined-sampler-binding" || + lowerword == "scsb") { + ProcessBindingBase(argc, argv, glslang::EResCombinedSampler); + } else if (lowerword == "shift-as-bindings" || + lowerword == "shift-as-binding" || + lowerword == "sab") { + ProcessBindingBase(argc, argv, glslang::EResAs); } else if (lowerword == "source-entrypoint" || // synonyms lowerword == "sep") { if (argc <= 1) @@ -874,7 +883,7 @@ void ProcessArguments(std::vector>& workItem TargetVersion = glslang::EShTargetSpv_1_6; } else Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2,\n" - "vulkan1.3, opengl, spirv1.0, spirv1.1, spirv1.2, spirv1.3,\n" + "vulkan1.3, vulkan1.4, opengl, spirv1.0, spirv1.1, spirv1.2, spirv1.3,\n" "spirv1.4, spirv1.5 or spirv1.6"); } bumpArg(); @@ -910,6 +919,8 @@ void ProcessArguments(std::vector>& workItem Options |= EOptionLinkTimeOptimization; } else if (lowerword == "validate-io") { Options |= EOptionValidateCrossStageIO; + } else if (lowerword == "bindings-per-resource-type") { + Options |= EOptionBindingsPerResourceType; } else if (lowerword == "help") { usage(); break; @@ -1457,6 +1468,9 @@ void CompileAndLinkShaderUnits(std::vector compUnits) if (emitNonSemanticShaderDebugInfo) shader->setDebugInfo(true); + if (Options & EOptionBindingsPerResourceType) + shader->setBindingsPerResourceType(); + // Set up the environment, some subsettings take precedence over earlier // ways of setting things. if (Options & EOptionSpv) { @@ -1972,47 +1986,45 @@ void usage() " rcall for a ray callable shader\n" "2) ..glsl or ..hlsl compound suffix, where stage options are\n" " described above\n" - "3) .conf, to provide a config file that replaces the default configuration\n" - " (see -c option below for generating a template)\n" + "3) .conf, to provide a config file that replaces the default configuration (see\n" + " -c option below for generating a template)\n" "\n" "Options:\n" " -C cascading errors; risk crash from accumulation of error recoveries\n" " -D input is HLSL (this is the default when any suffix is .hlsl)\n" - " -D | --define-macro | --D \n" + " -D | --D | --define-macro \n" " define a pre-processor macro\n" - " -E print pre-processed GLSL; cannot be used with -l;\n" - " errors will appear on stderr\n" - " -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;\n" - " default file name is .spv (-o overrides this);\n" - " 'ver', when present, is the version of the input semantics,\n" - " which will appear in #define GL_SPIRV ver;\n" - " '--client opengl100' is the same as -G100;\n" - " a '--target-env' for OpenGL will also imply '-G';\n" - " currently only supports GLSL\n" + " -E print pre-processed GLSL; cannot be used with -l; errors will\n" + " appear on stderr\n" + " -G[ver] create SPIR-V binary under OpenGL semantics; turns on -l; default\n" + " file name is .spv (-o overrides this); ver, when present,\n" + " is the version of the input semantics which will appear in\n" + " '#define GL_SPIRV ver'; --client opengl100 is the same as -G100; a\n" + " --target-env for OpenGL will also imply -G; currently only\n" + " supports GLSL\n" " -H print human readable form of SPIR-V; turns on -V\n" - " -I add dir to the include search path; includer's directory\n" - " is searched first, followed by left-to-right order of -I\n" + " -I add to the include search path; includer's directory is\n" + " searched first, followed by left-to-right order of -I\n" " -Od disables optimization; may cause illegal SPIR-V for HLSL\n" " -Os optimizes SPIR-V to minimize size\n" - " -P | --preamble-text | --P \n" - " inject custom preamble text, which is treated as if it\n" - " appeared immediately after the version declaration (if any).\n" + " -P | --P | --preamble-text \n" + " inject custom preamble text which is treated as if it appeared\n" + " immediately after the version declaration (if any)\n" " -R use relaxed verification rules for generating Vulkan SPIR-V,\n" - " allowing the use of default uniforms, atomic_uints, and\n" - " gl_VertexID and gl_InstanceID keywords.\n" - " -S uses specified stage rather than parsing the file extension\n" - " choices for include vert, tesc, tese, geom, frag, comp.\n" - " A full list of options is given above." + " allowing the use of default uniforms, atomic_uints, and the\n" + " gl_VertexID and gl_InstanceID keywords\n" + " -S uses the specified rather than parsing the file extension;\n" + " choices for include vert, tesc, tese, geom, frag, and\n" + " comp; a full list of options is given above\n" " -U | --undef-macro | --U \n" " undefine a pre-processor macro\n" - " -V[ver] create SPIR-V binary, under Vulkan semantics; turns on -l;\n" - " default file name is .spv (-o overrides this)\n" - " 'ver', when present, is the version of the input semantics,\n" - " which will appear in #define VULKAN ver\n" - " '--client vulkan100' is the same as -V100\n" - " a '--target-env' for Vulkan will also imply '-V'\n" - " -c configuration dump;\n" - " creates the default configuration file (redirect to a .conf file)\n" + " -V[ver] create SPIR-V binary under Vulkan semantics; turns on -l; default\n" + " file name is .spv (-o overrides this); ver, when present,\n" + " is the version of the input semantics which will appear in\n" + " '#define VULKAN ver'; --client vulkan100 is the same as -V100; a\n" + " '--target-env' for Vulkan will also imply '-V'\n" + " -c configuration dump; creates the default configuration file\n" + " (redirect to a .conf file)\n" " -d default to desktop (#version 110) when there is no shader #version\n" " (default is ES version 100)\n" " -e | --entry-point \n" @@ -2024,149 +2036,172 @@ void usage() " -g0 strip debug information\n" " -gV generate nonsemantic shader debug information\n" " -gVS generate nonsemantic shader debug information with source\n" - " -h print this usage message\n" + " -h | --help print this usage message\n" " -i intermediate tree (glslang AST) is printed out\n" " -l link all input files together to form a single module\n" " -m memory leak mode\n" - " -o save binary to , requires a binary option (e.g., -V)\n" + " -o save binary to ; requires a binary option (e.g., -V)\n" " -q dump reflection query database; requires -l for linking\n" " -r | --relaxed-errors\n" " relaxed GLSL semantic error-checking mode\n" " -s silence syntax and semantic error reporting\n" " -t multi-threaded mode\n" + " -u:\n" + " specify a uniform location override for --aml\n" " -v | --version\n" " print version strings\n" " -w | --suppress-warnings\n" - " suppress GLSL warnings, except as required by \"#extension : warn\"\n" + " suppress GLSL warnings, except as required by '#extension : warn'\n" " -x save binary output as text-based 32-bit hexadecimal numbers\n" - " -u: specify a uniform location override for --aml\n" - " --uniform-base set a base to use for generated uniform locations\n" - " --auto-map-bindings | --amb automatically bind uniform variables\n" - " without explicit bindings\n" + " --absolute-path prints absolute path for messages\n" + " --auto-map-binding | --auto-map-bindings | --amb\n" + " automatically bind uniform variables without\n" + " explicit bindings\n" " --auto-map-locations | --aml automatically locate input/output lacking\n" " 'location' (fragile, not cross stage)\n" - " --absolute-path Prints absolute path for messages\n" - " --auto-sampled-textures Removes sampler variables and converts\n" + " --auto-sampled-textures removes sampler variables and converts\n" " existing textures to sampled textures\n" - " --client {vulkan|opengl} see -V and -G\n" + " --client {vulkan | opengl}\n" + " see -V and -G\n" " --depfile writes depfile for build systems\n" - " --dump-builtin-symbols prints builtin symbol table prior each compile\n" + " --dump-builtin-symbols prints builtin symbol table prior each\n" + " compile\n" " -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n" - " --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n" + " --enhanced-msgs print more readable error messages (GLSL\n" + " only)\n" + " --error-column display the column of the error along the\n" + " line\n" + " --flatten-uniform-array | --flatten-uniform-arrays | --fua\n" + " flatten uniform texture/sampler arrays to\n" " scalars\n" " --glsl-version {100 | 110 | 120 | 130 | 140 | 150 |\n" - " 300es | 310es | 320es | 330\n" + " 300es | 310es | 320es | 330 |\n" " 400 | 410 | 420 | 430 | 440 | 450 | 460}\n" - " set GLSL version, overrides #version\n" - " in shader source\n" - " --hlsl-offsets allow block offsets to follow HLSL rules\n" - " works independently of source language\n" - " --hlsl-iomap perform IO mapping in HLSL register space\n" - " --hlsl-enable-16bit-types allow 16-bit types in SPIR-V for HLSL\n" + " set GLSL version; overrides #version in\n" + " shader source\n" + " --hlsl-dx-position-w W component of SV_Position in HLSL fragment\n" + " shaders compatible with DirectX\n" " --hlsl-dx9-compatible interprets sampler declarations as a\n" " texture/sampler combo like DirectX9 would,\n" " and recognizes DirectX9-specific semantics\n" - " --hlsl-dx-position-w W component of SV_Position in HLSL fragment\n" - " shaders compatible with DirectX\n" + " --hlsl-enable-16bit-types allow 16-bit types in SPIR-V for HLSL\n" + " --hlsl-iomap | --hlsl-iomapper | --hlsl-iomapping\n" + " perform IO mapping in HLSL register space\n" + " --hlsl-offsets allow block offsets to follow HLSL rules;\n" + " works independently of source language\n" " --invert-y | --iy invert position.Y output in vertex shader\n" - " --enhanced-msgs print more readable error messages (GLSL only)\n" - " --error-column display the column of the error along the line\n" " --keep-uncalled | --ku don't eliminate uncalled functions\n" + " --lto perform link time optimization\n" " --nan-clamp favor non-NaN operand in min, max, and clamp\n" + " --no-link only compile shader; do not link (GLSL only)\n" + " NOTE: this option will set the export\n" + " linkage attribute on all functions\n" " --no-storage-format | --nsf use Unknown image format\n" - " --quiet do not print anything to stdout, unless\n" + " --quiet do not print anything to stdout unless\n" " requested by another option\n" - " --reflect-strict-array-suffix use strict array suffix rules when\n" - " reflecting\n" + " --reflect-all-block-variables reflect all variables in blocks, whether\n" + " inactive or active\n" " --reflect-basic-array-suffix arrays of basic types will have trailing [0]\n" " --reflect-intermediate-io reflection includes inputs/outputs of linked\n" " shaders rather than just vertex/fragment\n" " --reflect-separate-buffers reflect buffer variables and blocks\n" " separately to uniforms\n" - " --reflect-all-block-variables reflect all variables in blocks, whether\n" - " inactive or active\n" + " --reflect-strict-array-suffix use strict array suffix rules when\n" + " reflecting\n" " --reflect-unwrap-io-blocks unwrap input/output blocks the same as\n" " uniform blocks\n" - " --resource-set-binding [stage] name set binding\n" + " --resource-set-binding [name] [binding]...\n" " set descriptor set and binding for\n" " individual resources\n" - " --resource-set-binding [stage] set\n" + " --resource-set-binding [stage] \n" " set descriptor set for all resources\n" - " --rsb synonym for --resource-set-binding\n" - " --set-block-backing name {uniform|buffer|push_constant}\n" - " changes the backing type of a uniform, buffer,\n" - " or push_constant block declared in\n" - " in the program, when using -R option.\n" - " This can be used to change the backing\n" - " for existing blocks as well as implicit ones\n" - " such as 'gl_DefaultUniformBlock'.\n" - " --sbs synonym for set-block-storage\n" - " --set-atomic-counter-block name set\n" - " set name, and descriptor set for\n" - " atomic counter blocks, with -R opt\n" + " --resource-set-bindings | --rsb synonyms for --resource-set-binding\n" + " --set-atomic-counter-block \n" + " set name and descriptor set for atomic\n" + " counter blocks with -R opt\n" " --sacb synonym for set-atomic-counter-block\n" - " --set-default-uniform-block name set binding\n" + " --set-block-backing name {uniform | buffer | push_constant}\n" + " changes the backing type of a uniform,\n" + " buffer, or push_constant block declared in\n" + " the program when using the -R option; this\n" + " can be used to change the backing for\n" + " existing blocks as well as implicit ones\n" + " such as 'gl_DefaultUniformBlock'\n" + " --set-default-uniform-block \n" " set name, descriptor set, and binding for\n" - " global default-uniform-block, with -R opt\n" + " global default-uniform-block with -R opt\n" " --sdub synonym for set-default-uniform-block\n" - " --shift-image-binding [stage] num\n" - " base binding number for images (uav)\n" - " --shift-image-binding [stage] [num set]...\n" + " --shift-image-binding [stage] \n" + " base binding number for images (UAV)\n" + " --shift-image-binding [stage] ...\n" " per-descriptor-set shift values\n" - " --sib synonym for --shift-image-binding\n" - " --shift-sampler-binding [stage] num\n" + " --shift-image-bindings | --sib synonyms for --shift-image-binding\n" + " --shift-sampler-binding [stage] \n" " base binding number for samplers\n" - " --shift-sampler-binding [stage] [num set]...\n" + " --shift-sampler-binding [stage] ...\n" " per-descriptor-set shift values\n" - " --ssb synonym for --shift-sampler-binding\n" - " --shift-ssbo-binding [stage] num base binding number for SSBOs\n" - " --shift-ssbo-binding [stage] [num set]...\n" + " --shift-sampler-bindings | --ssb synonyms for --shift-sampler-binding\n" + " --shift-ssbo-binding [stage] \n" + " base binding number for SSBOs\n" + " --shift-ssbo-binding [stage] ...\n" " per-descriptor-set shift values\n" - " --sbb synonym for --shift-ssbo-binding\n" - " --shift-texture-binding [stage] num\n" + " --shift-ssbo-bindings | --sbb synonyms for --shift-ssbo-binding\n" + " --shift-texture-binding [stage] \n" " base binding number for textures\n" - " --shift-texture-binding [stage] [num set]...\n" + " --shift-texture-binding [stage] ...\n" " per-descriptor-set shift values\n" - " --stb synonym for --shift-texture-binding\n" - " --shift-uav-binding [stage] num base binding number for UAVs\n" - " --shift-uav-binding [stage] [num set]...\n" + " --shift-texture-bindings | --stb synonyms for --shift-texture-binding\n" + " --shift-uav-binding [stage] base binding number for UAVs\n" + " --shift-uav-binding [stage] ...\n" " per-descriptor-set shift values\n" - " --suavb synonym for --shift-uav-binding\n" - " --shift-UBO-binding [stage] num base binding number for UBOs\n" - " --shift-UBO-binding [stage] [num set]...\n" + " --shift-uav-bindings | --suavb synonyms for --shift-uav-binding\n" + " --shift-ubo-binding [stage] base binding number for UBOs\n" + " --shift-ubo-binding [stage] ...\n" " per-descriptor-set shift values\n" - " --sub synonym for --shift-UBO-binding\n" - " --shift-cbuffer-binding | --scb synonyms for --shift-UBO-binding\n" + " --shift-ubo-bindings | --sub |\n" + " --shift-cbuffer-binding | --shift-cbuffer-bindings | --scb\n" + " synonyms for --shift-ubo-binding\n" + " --shift-combined-sampler-binding [stage] \n" + " base binding number for combined samplers\n" + " --shift-combined-sampler-binding [stage] ...\n" + " per-descriptor-set shift values\n" + " --shift-combined-sampler-bindings | --scsb\n" + " synonyms for --shift-combined-sampler-binding\n" + " --shift-as-binding [stage] \n" + " base binding number for acceleration structures\n" + " --shift-as-binding [stage] ...\n" + " per-descriptor-set shift values\n" + " --shift-as-bindings | --sab\n" + " synonyms for --shift-as-binding\n" " --spirv-dis output standard-form disassembly; works only\n" " when a SPIR-V generation option is also used\n" " --spirv-val execute the SPIRV-Tools validator\n" - " --source-entrypoint the given shader source function is\n" - " renamed to be the given in -e\n" - " --sep synonym for --source-entrypoint\n" + " --source-entrypoint | --sep \n" + " the given shader source function is renamed\n" + " to be the given in -e\n" " --stdin read from stdin instead of from a file;\n" " requires providing the shader stage using -S\n" - " --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | vulkan1.3 | opengl |\n" - " spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 |\n" - " spirv1.5 | spirv1.6}\n" - " Set the execution environment that the\n" - " generated code will be executed in.\n" - " Defaults to:\n" + " --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | vulkan1.3 | vulkan1.4 |\n" + " opengl | spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 |\n" + " spirv1.4 | spirv1.5 | spirv1.6}\n" + " set the execution environment the generated\n" + " code will be executed in; defaults to:\n" " * vulkan1.0 under --client vulkan\n" " * opengl under --client opengl\n" " * spirv1.0 under --target-env vulkan1.0\n" " * spirv1.3 under --target-env vulkan1.1\n" " * spirv1.5 under --target-env vulkan1.2\n" " * spirv1.6 under --target-env vulkan1.3\n" - " Multiple --target-env can be specified.\n" - " --variable-name \n" - " --vn creates a C header file that contains a\n" - " uint32_t array named \n" - " initialized with the shader binary code\n" - " --no-link Only compile shader; do not link (GLSL-only)\n" - " NOTE: this option will set the export linkage\n" - " attribute on all functions\n" - " --lto perform link time optimization\n" - " --validate-io validate cross stage IO\n"); + " * spirv1.6 under --target-env vulkan1.4\n" + " multiple --target-env can be specified\n" + " --uniform-base set a base to use for generated uniform\n" + " locations\n" + " --variable-name | --vn \n" + " creates a C header file that contains a\n" + " uint32_t array named initialized with\n" + " the shader binary code\n" + " --validate-io validate cross stage IO\n" + " --bindings-per-resource-type\n"); exit(EFailUsage); } diff --git a/third_party/glslang/StandAlone/spirv-remap.cpp b/third_party/glslang/StandAlone/spirv-remap.cpp deleted file mode 100644 index b1f0326646..0000000000 --- a/third_party/glslang/StandAlone/spirv-remap.cpp +++ /dev/null @@ -1,402 +0,0 @@ -// -// Copyright (C) 2015 LunarG, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -#include -#include -#include -#include -#include - -// -// Include remapper -// -#include "../SPIRV/SPVRemapper.h" - -namespace { - - typedef unsigned int SpvWord; - - // Poor man's basename: given a complete path, return file portion. - // E.g: - // Linux: /foo/bar/test -> test - // Win: c:\foo\bar\test -> test - // It's not very efficient, but that doesn't matter for our minimal-duty use. - // Using boost::filesystem would be better in many ways, but want to avoid that dependency. - - // OS dependent path separator (avoiding boost::filesystem dependency) -#if defined(_WIN32) - char path_sep_char() { return '\\'; } -#else - char path_sep_char() { return '/'; } -#endif - - std::string basename(const std::string filename) - { - const size_t sepLoc = filename.find_last_of(path_sep_char()); - - return (sepLoc == filename.npos) ? filename : filename.substr(sepLoc+1); - } - - void errHandler(const std::string& str) { - std::cout << str << std::endl; - exit(5); - } - - void logHandler(const std::string& str) { - std::cout << str << std::endl; - } - - // Read word stream from disk - void read(std::vector& spv, const std::string& inFilename, int verbosity) - { - std::ifstream fp; - - if (verbosity > 0) - logHandler(std::string(" reading: ") + inFilename); - - spv.clear(); - fp.open(inFilename, std::fstream::in | std::fstream::binary); - - if (fp.fail()) - errHandler("error opening file for read: "); - - // Reserve space (for efficiency, not for correctness) - fp.seekg(0, fp.end); - spv.reserve(size_t(fp.tellg()) / sizeof(SpvWord)); - fp.seekg(0, fp.beg); - - while (!fp.eof()) { - SpvWord inWord; - fp.read((char *)&inWord, sizeof(inWord)); - - if (!fp.eof()) { - spv.push_back(inWord); - if (fp.fail()) - errHandler(std::string("error reading file: ") + inFilename); - } - } - } - - // Read strings from a file - void read(std::vector& strings, const std::string& inFilename, int verbosity) - { - std::ifstream fp; - - if (verbosity > 0) - logHandler(std::string(" reading: ") + inFilename); - - strings.clear(); - fp.open(inFilename, std::fstream::in); - - if (fp.fail()) - errHandler("error opening file for read: "); - - std::string line; - while (std::getline(fp, line)) - { - // Ignore empty lines and lines starting with the comment marker '#'. - if (line.length() == 0 || line[0] == '#') { - continue; - } - - strings.push_back(line); - } - } - - void write(std::vector& spv, const std::string& outFile, int verbosity) - { - if (outFile.empty()) - errHandler("missing output filename."); - - std::ofstream fp; - - if (verbosity > 0) - logHandler(std::string(" writing: ") + outFile); - - fp.open(outFile, std::fstream::out | std::fstream::binary); - - if (fp.fail()) - errHandler(std::string("error opening file for write: ") + outFile); - - for (auto it = spv.cbegin(); it != spv.cend(); ++it) { - SpvWord word = *it; - fp.write((char *)&word, sizeof(word)); - if (fp.fail()) - errHandler(std::string("error writing file: ") + outFile); - } - - // file is closed by destructor - } - - // Print helpful usage message to stdout, and exit - void usage(const char* const name, const char* const msg = nullptr) - { - if (msg) - std::cout << msg << std::endl << std::endl; - - std::cout << "Usage: " << std::endl; - - std::cout << " " << basename(name) - << " [-v[v[...]] | --verbose [int]]" - << " [--map (all|types|names|funcs)]" - << " [--dce (all|types|funcs)]" - << " [--opt (all|loadstore)]" - << " [--strip-all | --strip all | -s]" - << " [--strip-white-list]" - << " [--do-everything]" - << " --input | -i file1 [file2...] --output|-o DESTDIR | destfile1 [destfile2...]" - << std::endl; - - std::cout << " " << basename(name) << " [--version | -V]" << std::endl; - std::cout << " " << basename(name) << " [--help | -?]" << std::endl; - - exit(0); - } - - // grind through each SPIR in turn - void execute(const std::vector& inputFiles, - const std::vector& outputDirOrFiles, - const bool isSingleOutputDir, - const std::string& whiteListFile, - int opts, - int verbosity) - { - std::vector whiteListStrings; - if (!whiteListFile.empty()) - read(whiteListStrings, whiteListFile, verbosity); - - for (std::size_t ii=0; ii spv; - read(spv, inputFiles[ii], verbosity); - - spv::spirvbin_t(verbosity).remap(spv, whiteListStrings, opts); - - if (isSingleOutputDir) { - // write all outputs to same directory - const std::string outFile = outputDirOrFiles[0] + path_sep_char() + basename(inputFiles[ii]); - write(spv, outFile, verbosity); - } else { - // write each input to its associated output - write(spv, outputDirOrFiles[ii], verbosity); - } - } - - if (verbosity > 0) - std::cout << "Done: " << inputFiles.size() << " file(s) processed" << std::endl; - } - - // Parse command line options - void parseCmdLine(int argc, - char** argv, - std::vector& inputFiles, - std::vector& outputDirOrFiles, - std::string& stripWhiteListFile, - int& options, - int& verbosity) - { - if (argc < 2) - usage(argv[0]); - - verbosity = 0; - options = spv::spirvbin_t::NONE; - - // Parse command line. - // boost::program_options would be quite a bit nicer, but we don't want to - // introduce a dependency on boost. - for (int a=1; a inputFiles; - std::vector outputDirOrFiles; - std::string whiteListFile; - int opts; - int verbosity; - - // handle errors by exiting - spv::spirvbin_t::registerErrorHandler(errHandler); - - // Log messages to std::cout - spv::spirvbin_t::registerLogHandler(logHandler); - - if (argc < 2) - usage(argv[0]); - - parseCmdLine(argc, argv, inputFiles, outputDirOrFiles, whiteListFile, opts, verbosity); - - if (outputDirOrFiles.empty()) - usage(argv[0], "Output directory or file(s) required."); - - const bool isMultiInput = inputFiles.size() > 1; - const bool isMultiOutput = outputDirOrFiles.size() > 1; - const bool isSingleOutputDir = !isMultiOutput && std::filesystem::is_directory(outputDirOrFiles[0]); - - if (isMultiInput && !isMultiOutput && !isSingleOutputDir) - usage(argv[0], "Output is not a directory."); - - - if (isMultiInput && isMultiOutput && (outputDirOrFiles.size() != inputFiles.size())) - usage(argv[0], "Output must be either a single directory or one output file per input."); - - // Main operations: read, remap, and write. - execute(inputFiles, outputDirOrFiles, isSingleOutputDir, whiteListFile, opts, verbosity); - - // If we get here, everything went OK! Nothing more to be done. -} diff --git a/third_party/glslang/Test/330.frag b/third_party/glslang/Test/330.frag index cf22d7a4af..b1fa41475e 100644 --- a/third_party/glslang/Test/330.frag +++ b/third_party/glslang/Test/330.frag @@ -77,7 +77,7 @@ struct S2 { }; layout(location = 28) in inblock2 { - bool b1; + bool b1; // ERROR float f1; layout(location = 25) float f2; vec4 f3; diff --git a/third_party/glslang/Test/430.vert b/third_party/glslang/Test/430.vert index 84c322083b..db94c9c627 100644 --- a/third_party/glslang/Test/430.vert +++ b/third_party/glslang/Test/430.vert @@ -115,7 +115,7 @@ const int start2 = 5; layout(location = start2 * start2 - 2 - 4) in vec4 v6; layout(location = 28) in inblock2 { // ERROR, input block in vertex shader, other errors are valid checks still... - bool b1; + bool b1; // ERROR float f1; layout(location = 25) float f2; } ininst2; diff --git a/third_party/glslang/Test/440.vert b/third_party/glslang/Test/440.vert index 4ab6f2ee21..a4008d5bf2 100644 --- a/third_party/glslang/Test/440.vert +++ b/third_party/glslang/Test/440.vert @@ -146,7 +146,7 @@ struct T { }; // total size = 36 out layout(xfb_buffer=0, xfb_offset=0, xfb_stride=92) bblck8 { // ERROR, stride not multiple of 8 - bool b; // offset 0 + bool b; // offset 0 // ERROR, out block containing bool T t; // offset 8, size 40 int i; // offset 40 + 4 = 48 mat3x3 m3; // offset 52 diff --git a/third_party/glslang/Test/baseResults/100.frag.out b/third_party/glslang/Test/baseResults/100.frag.out index 2ac60541ab..03bf83ca94 100644 --- a/third_party/glslang/Test/baseResults/100.frag.out +++ b/third_party/glslang/Test/baseResults/100.frag.out @@ -89,7 +89,7 @@ ERROR: 0:227: 'non-constant global initializer (needs GL_EXT_shader_non_constant ERROR: 0:235: '#define' : names containing consecutive underscores are reserved, and an error if version < 300: A__B ERROR: 0:236: 'a__b' : identifiers containing consecutive underscores ("__") are reserved, and an error if version < 300 ERROR: 0:3000: '#error' : line of this error should be 3000 -ERROR: 0:3002: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 0:3002: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 82 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/100samplerExternal.frag.out b/third_party/glslang/Test/baseResults/100samplerExternal.frag.out index 8b689c7619..0ec883267e 100644 --- a/third_party/glslang/Test/baseResults/100samplerExternal.frag.out +++ b/third_party/glslang/Test/baseResults/100samplerExternal.frag.out @@ -12,7 +12,7 @@ ERROR: 0:30: 'texture2DProjLod' : no matching overloaded function found ERROR: 0:31: 'texture' : no matching overloaded function found ERROR: 0:32: 'textureProjLod' : no matching overloaded function found ERROR: 0:38: 'samplerExternalOES' : required extension not requested: GL_OES_EGL_image_external -ERROR: 0:41: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 0:41: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 14 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/120.vert.out b/third_party/glslang/Test/baseResults/120.vert.out index fcfffe9b27..c7bd553cec 100644 --- a/third_party/glslang/Test/baseResults/120.vert.out +++ b/third_party/glslang/Test/baseResults/120.vert.out @@ -78,8 +78,8 @@ ERROR: 0:192: 'gl_ClipDistance' : undeclared identifier ERROR: 0:192: 'gl_ClipDistance' : left of '[' is not of type array, matrix, or vector ERROR: 0:192: 'assign' : l-value required (can't modify a const) ERROR: 0:195: 'gl_ModelViewMatrix' : identifiers starting with "gl_" are reserved -ERROR: 0:200: 'token pasting (##)' : not supported for this version or the enabled extensions -ERROR: 0:203: 'token pasting (##)' : not supported for this version or the enabled extensions +ERROR: 0:199: 'token pasting (##)' : not supported for this version or the enabled extensions +ERROR: 0:202: 'token pasting (##)' : not supported for this version or the enabled extensions ERROR: 0:205: '' : syntax error, unexpected IDENTIFIER ERROR: 82 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/140.frag.out b/third_party/glslang/Test/baseResults/140.frag.out index 702718a297..ee4c856214 100644 --- a/third_party/glslang/Test/baseResults/140.frag.out +++ b/third_party/glslang/Test/baseResults/140.frag.out @@ -8,7 +8,7 @@ ERROR: 0:27: 'location' : not supported for this version or the enabled extensio ERROR: 0:27: 'location qualifier on output' : not supported for this version or the enabled extensions ERROR: 0:41: 'assign' : l-value required "v" (can't modify shader input) ERROR: 0:41: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters. -ERROR: 0:56: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 0:56: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 9 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/150.tesc.out b/third_party/glslang/Test/baseResults/150.tesc.out index f29665536a..b2a2cc0028 100644 --- a/third_party/glslang/Test/baseResults/150.tesc.out +++ b/third_party/glslang/Test/baseResults/150.tesc.out @@ -962,8 +962,6 @@ ERROR: Linking tessellation evaluation stage: can't handle multiple entry points ERROR: Linking tessellation evaluation stage: Multiple function bodies in multiple compilation units for the same signature in the same stage: main( ERROR: Linking tessellation evaluation stage: can't handle multiple entry points per stage -ERROR: Linking tessellation evaluation stage: Contradictory input vertex spacing -ERROR: Linking tessellation evaluation stage: Contradictory triangle ordering ERROR: Linking tessellation evaluation stage: Multiple function bodies in multiple compilation units for the same signature in the same stage: main( ERROR: Linking tessellation evaluation stage: Multiple function bodies in multiple compilation units for the same signature in the same stage: diff --git a/third_party/glslang/Test/baseResults/300samplerExternal.frag.out b/third_party/glslang/Test/baseResults/300samplerExternal.frag.out index 9074552e89..49a8e0b2c5 100644 --- a/third_party/glslang/Test/baseResults/300samplerExternal.frag.out +++ b/third_party/glslang/Test/baseResults/300samplerExternal.frag.out @@ -9,7 +9,7 @@ ERROR: 0:30: 'texture2DProjLod' : no matching overloaded function found ERROR: 0:31: 'texture' : no matching overloaded function found ERROR: 0:32: 'textureProjLod' : no matching overloaded function found ERROR: 0:38: 'samplerExternalOES' : required extension not requested: GL_OES_EGL_image_external_essl3 -ERROR: 0:41: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 0:41: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 11 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/300samplerExternalYUV.frag.out b/third_party/glslang/Test/baseResults/300samplerExternalYUV.frag.out index b76e706fd8..df6ddeef47 100644 --- a/third_party/glslang/Test/baseResults/300samplerExternalYUV.frag.out +++ b/third_party/glslang/Test/baseResults/300samplerExternalYUV.frag.out @@ -8,7 +8,7 @@ ERROR: 0:29: 'texture3D' : no matching overloaded function found ERROR: 0:30: 'texture2DProjLod' : no matching overloaded function found ERROR: 0:31: 'texture' : no matching overloaded function found ERROR: 0:32: 'textureProjLod' : no matching overloaded function found -ERROR: 0:37: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 0:37: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 10 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/310.frag.out b/third_party/glslang/Test/baseResults/310.frag.out index 3def2ac08d..84bc940103 100644 --- a/third_party/glslang/Test/baseResults/310.frag.out +++ b/third_party/glslang/Test/baseResults/310.frag.out @@ -58,7 +58,7 @@ ERROR: 0:159: 'vAnon' : redefinition ERROR: 0:173: 'origin_upper_left' : not supported with this profile: es ERROR: 0:173: 'pixel_center_integer' : not supported with this profile: es ERROR: 0:173: 'redeclaration' : cannot redeclare with different qualification: gl_FragCoord -ERROR: 0:177: 'depth layout qualifier' : not supported with this profile: es +ERROR: 0:177: 'depth layout qualifier' : not supported for this version or the enabled extensions ERROR: 0:181: 'assign' : l-value required "gl_FragDepth" (can't modify gl_FragDepth if using early_fragment_tests) ERROR: 0:182: 'gl_Layer' : required extension not requested: Possible extensions include: GL_EXT_geometry_shader diff --git a/third_party/glslang/Test/baseResults/320.frag.out b/third_party/glslang/Test/baseResults/320.frag.out index 73b5fb2739..1555880e57 100644 --- a/third_party/glslang/Test/baseResults/320.frag.out +++ b/third_party/glslang/Test/baseResults/320.frag.out @@ -10,7 +10,7 @@ ERROR: 0:29: 'vAnon' : redefinition ERROR: 0:43: 'origin_upper_left' : not supported with this profile: es ERROR: 0:43: 'pixel_center_integer' : not supported with this profile: es ERROR: 0:43: 'redeclaration' : cannot redeclare with different qualification: gl_FragCoord -ERROR: 0:47: 'depth layout qualifier' : not supported with this profile: es +ERROR: 0:47: 'depth layout qualifier' : not supported for this version or the enabled extensions ERROR: 0:51: 'assign' : l-value required "gl_FragDepth" (can't modify gl_FragDepth if using early_fragment_tests) ERROR: 0:79: 'textureGatherOffsets(...)' : must be a compile-time constant: offsets argument ERROR: 0:124: 'rgba32f' : format requires readonly or writeonly memory qualifier diff --git a/third_party/glslang/Test/baseResults/330.frag.out b/third_party/glslang/Test/baseResults/330.frag.out index d95cd30758..c78b17f2db 100644 --- a/third_party/glslang/Test/baseResults/330.frag.out +++ b/third_party/glslang/Test/baseResults/330.frag.out @@ -20,6 +20,7 @@ ERROR: 0:60: 'location' : cannot apply to uniform or buffer block ERROR: 0:68: 'layout-id value' : cannot be negative ERROR: 0:69: 'layout-id value' : cannot be negative ERROR: 0:76: 'f2' : cannot use layout qualifiers on structure members +ERROR: 0:79: 'in' : cannot contain bool ERROR: 0:91: 'location on block member' : can only use in an in/out block ERROR: 0:91: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions ERROR: 0:91: 'location' : overlapping use of location 3 @@ -38,7 +39,7 @@ ERROR: 0:128: 'output block' : not supported in this stage: fragment ERROR: 0:138: 'index' : value must be 0 or 1 ERROR: 0:140: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions ERROR: 0:146: 'location' : cannot apply to uniform or buffer block -ERROR: 39 compilation errors. No code generated. +ERROR: 40 compilation errors. No code generated. Shader version: 330 diff --git a/third_party/glslang/Test/baseResults/420.frag.out b/third_party/glslang/Test/baseResults/420.frag.out index 19b5c9b93f..126e10153d 100644 --- a/third_party/glslang/Test/baseResults/420.frag.out +++ b/third_party/glslang/Test/baseResults/420.frag.out @@ -5,7 +5,7 @@ ERROR: 0:12: 'gl_FragDepth' : cannot redeclare after use ERROR: 0:14: 'atomic_uint' : array must be explicitly sized ERROR: 0:17: 'imageSize' : required extension not requested: GL_ARB_shader_image_size ERROR: 0:54: 'std430' : not supported for this version or the enabled extensions -ERROR: 0:54: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 0:54: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 7 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/430.vert.out b/third_party/glslang/Test/baseResults/430.vert.out index db56eab9b1..e8139c7cca 100644 --- a/third_party/glslang/Test/baseResults/430.vert.out +++ b/third_party/glslang/Test/baseResults/430.vert.out @@ -50,6 +50,7 @@ ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or the enabled extensions ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or the enabled extensions ERROR: 0:117: 'input block' : not supported in this stage: vertex +ERROR: 0:117: 'in' : cannot contain bool ERROR: 0:123: 'input block' : not supported in this stage: vertex ERROR: 0:146: 'shared' : not supported in this stage: vertex ERROR: 0:150: 'barrier' : no matching overloaded function found @@ -64,7 +65,7 @@ ERROR: 0:221: 'textureQueryLevels' : no matching overloaded function found ERROR: 0:221: 'assign' : cannot convert from ' const float' to ' temp int' ERROR: 0:222: 'textureQueryLevels' : no matching overloaded function found ERROR: 0:222: 'assign' : cannot convert from ' const float' to ' temp int' -ERROR: 65 compilation errors. No code generated. +ERROR: 66 compilation errors. No code generated. Shader version: 430 diff --git a/third_party/glslang/Test/baseResults/440.vert.out b/third_party/glslang/Test/baseResults/440.vert.out index f341548523..7b8d021e28 100644 --- a/third_party/glslang/Test/baseResults/440.vert.out +++ b/third_party/glslang/Test/baseResults/440.vert.out @@ -42,11 +42,13 @@ ERROR: 0:129: 'xfb_stride' : all stride settings must match for xfb buffer 3 ERROR: 0:133: 'xfb_stride' : all stride settings must match for xfb buffer 3 ERROR: 0:131: 'xfb_stride' : all stride settings must match for xfb buffer 3 ERROR: 0:152: 'xfb_offset' : overlapping offsets at offset 64 in buffer 0 +ERROR: 0:148: 'out' : cannot contain bool ERROR: 0:157: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4 ERROR: 0:158: 'xfb_offset' : must be a multiple of size of first component ERROR: 0:159: 'xfb_offset' : type contains double or 64-bit integer; xfb_offset must be a multiple of 8 ERROR: 0:161: 'xfb_offset' : must be a multiple of size of first component ERROR: 0:162: 'xfb_offset' : type contains double or 64-bit integer; xfb_offset must be a multiple of 8 +ERROR: 0:157: 'out' : cannot contain bool ERROR: 0:166: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4 ERROR: 0:169: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4 ERROR: 0:169: 'xfb_stride' : 1/4 stride is too large: gl_MaxTransformFeedbackInterleavedComponents is 64 @@ -61,7 +63,7 @@ ERROR: 0:193: 'assign' : l-value required "gl_BaseVertexARB" (can't modify shad ERROR: 0:194: 'assign' : l-value required "gl_BaseInstanceARB" (can't modify shader input) ERROR: 0:195: 'assign' : l-value required "gl_DrawIDARB" (can't modify shader input) ERROR: 0:196: 'glBaseInstanceARB' : undeclared identifier -ERROR: 62 compilation errors. No code generated. +ERROR: 64 compilation errors. No code generated. Shader version: 440 diff --git a/third_party/glslang/Test/baseResults/boolinput.error.frag.out b/third_party/glslang/Test/baseResults/boolinput.error.frag.out new file mode 100644 index 0000000000..aefc47c1e9 --- /dev/null +++ b/third_party/glslang/Test/baseResults/boolinput.error.frag.out @@ -0,0 +1,29 @@ +boolinput.error.frag +ERROR: 0:3: 'in' : cannot be bool +ERROR: 0:9: 'in' : cannot contain bool +ERROR: 0:11: 'in' : cannot contain bool +ERROR: 3 compilation errors. No code generated. + + +Shader version: 460 +ERROR: node is still EOpNull! +0:15 Function Definition: main( ( global void) +0:15 Function Parameters: +0:? Linker Objects +0:? 'a' ( smooth in bool) +0:? 's' ( smooth in structure{ global bool b}) +0:? 'anon@0' ( in block{ in bool c}) + + +Linked fragment stage: + + +Shader version: 460 +ERROR: node is still EOpNull! +0:15 Function Definition: main( ( global void) +0:15 Function Parameters: +0:? Linker Objects +0:? 'a' ( smooth in bool) +0:? 's' ( smooth in structure{ global bool b}) +0:? 'anon@0' ( in block{ in bool c}) + diff --git a/third_party/glslang/Test/baseResults/booloutput.error.vert.out b/third_party/glslang/Test/baseResults/booloutput.error.vert.out new file mode 100644 index 0000000000..9d1d9f76a0 --- /dev/null +++ b/third_party/glslang/Test/baseResults/booloutput.error.vert.out @@ -0,0 +1,33 @@ +booloutput.error.vert +ERROR: 0:3: 'out' : cannot be bool +ERROR: 0:9: 'out' : cannot contain bool +ERROR: 0:11: 'out' : cannot contain bool +ERROR: 3 compilation errors. No code generated. + + +Shader version: 460 +ERROR: node is still EOpNull! +0:15 Function Definition: main( ( global void) +0:15 Function Parameters: +0:? Linker Objects +0:? 'a' ( smooth out bool) +0:? 's' ( smooth out structure{ global bool b}) +0:? 'anon@0' ( out block{ out bool c}) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + + +Linked vertex stage: + + +Shader version: 460 +ERROR: node is still EOpNull! +0:15 Function Definition: main( ( global void) +0:15 Function Parameters: +0:? Linker Objects +0:? 'a' ( smooth out bool) +0:? 's' ( smooth out structure{ global bool b}) +0:? 'anon@0' ( out block{ out bool c}) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + diff --git a/third_party/glslang/Test/baseResults/conservativeDepth.frag.out b/third_party/glslang/Test/baseResults/conservativeDepth.frag.out new file mode 100644 index 0000000000..d65368107b --- /dev/null +++ b/third_party/glslang/Test/baseResults/conservativeDepth.frag.out @@ -0,0 +1,33 @@ +conservativeDepth.frag +Shader version: 300 +Requested GL_EXT_conservative_depth +using depth_any +0:? Sequence +0:4 Function Definition: main( ( global void) +0:4 Function Parameters: +0:5 Sequence +0:5 move second child to first child ( temp highp float) +0:5 'gl_FragDepth' ( gl_FragDepth highp float FragDepth) +0:5 Constant: +0:5 1.000000 +0:? Linker Objects +0:? 'gl_FragDepth' ( gl_FragDepth highp float FragDepth) + + +Linked fragment stage: + + +Shader version: 300 +Requested GL_EXT_conservative_depth +using depth_any +0:? Sequence +0:4 Function Definition: main( ( global void) +0:4 Function Parameters: +0:5 Sequence +0:5 move second child to first child ( temp highp float) +0:5 'gl_FragDepth' ( gl_FragDepth highp float FragDepth) +0:5 Constant: +0:5 1.000000 +0:? Linker Objects +0:? 'gl_FragDepth' ( gl_FragDepth highp float FragDepth) + diff --git a/third_party/glslang/Test/baseResults/cppBad.vert.out b/third_party/glslang/Test/baseResults/cppBad.vert.out index e0a1504a30..c36ae4dfa6 100644 --- a/third_party/glslang/Test/baseResults/cppBad.vert.out +++ b/third_party/glslang/Test/baseResults/cppBad.vert.out @@ -1,15 +1,14 @@ cppBad.vert WARNING: 0:1: '#define' : missing space after macro name -ERROR: 0:1: '#' : (#) can be preceded in its line only by spaces or horizontal tabs -ERROR: 0:2: '#' : (#) can be preceded in its line only by spaces or horizontal tabs -ERROR: 0:3: 'preprocessor evaluation' : bad expression -ERROR: 0:3: '#if' : unexpected tokens following directive +ERROR: 0:2: 'stringify (#)' : not supported with this profile: es +ERROR: 0:2: '#' : '#' is not followed by a macro parameter. +ERROR: 0:3: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile m ERROR: 0:6: 'string' : End of line in string ERROR: 0:6: 'string literal' : required extension not requested: Possible extensions include: GL_EXT_debug_printf GL_EXT_spirv_intrinsics ERROR: 0:6: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON -ERROR: 7 compilation errors. No code generated. +ERROR: 6 compilation errors. No code generated. Shader version: 100 diff --git a/third_party/glslang/Test/baseResults/cppBad4.vert.out b/third_party/glslang/Test/baseResults/cppBad4.vert.out index 23f149db69..e305084769 100644 --- a/third_party/glslang/Test/baseResults/cppBad4.vert.out +++ b/third_party/glslang/Test/baseResults/cppBad4.vert.out @@ -1,6 +1,6 @@ cppBad4.vert -ERROR: 0:2: '#' : (#) can be preceded in its line only by spaces or horizontal tabs -ERROR: 0:4: 'macro expansion' : unexpected '#' g +ERROR: 0:2: 'stringify (#)' : not supported with this profile: es +ERROR: 0:2: '#' : '#' is not followed by a macro parameter. ERROR: 0:5: '' : syntax error, unexpected SEMICOLON, expecting LEFT_PAREN ERROR: 3 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/glspv.frag.out b/third_party/glslang/Test/baseResults/glspv.frag.out index db752133c1..bb6450ca0a 100644 --- a/third_party/glslang/Test/baseResults/glspv.frag.out +++ b/third_party/glslang/Test/baseResults/glspv.frag.out @@ -8,7 +8,7 @@ ERROR: 0:23: 'noise3' : no matching overloaded function found ERROR: 0:24: 'noise4' : no matching overloaded function found ERROR: 0:27: 'atomic_uint' : layout(binding=X) is required ERROR: 0:28: 'input_attachment_index' : only allowed when using GLSL for Vulkan -ERROR: 0:28: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 0:28: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 10 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/glspv.vert.out b/third_party/glslang/Test/baseResults/glspv.vert.out index d51926284e..862716d25f 100644 --- a/third_party/glslang/Test/baseResults/glspv.vert.out +++ b/third_party/glslang/Test/baseResults/glspv.vert.out @@ -8,7 +8,7 @@ ERROR: 0:9: 'binding' : uniform/buffer blocks require layout(binding=X) ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier -ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 10 compilation errors. No code generated. diff --git a/third_party/glslang/Test/baseResults/hlsl.round.dx9.frag.out b/third_party/glslang/Test/baseResults/hlsl.round.dx9.frag.out index 4e0a7918dd..52af74a8c7 100644 --- a/third_party/glslang/Test/baseResults/hlsl.round.dx9.frag.out +++ b/third_party/glslang/Test/baseResults/hlsl.round.dx9.frag.out @@ -5,7 +5,7 @@ gl_FragCoord origin is upper left 0:2 Function Definition: PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:2 Function Parameters: 0:2 'input' ( in 4-component vector of float) -0:? Scope +0:? Sequence 0:3 Branch: Return with expression 0:3 round ( temp 4-component vector of float) 0:3 'input' ( in 4-component vector of float) @@ -22,7 +22,7 @@ gl_FragCoord origin is upper left 0:2 Function Definition: PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:2 Function Parameters: 0:2 'input' ( in 4-component vector of float) -0:? Scope +0:? Sequence 0:3 Branch: Return with expression 0:3 round ( temp 4-component vector of float) 0:3 'input' ( in 4-component vector of float) @@ -30,43 +30,31 @@ gl_FragCoord origin is upper left // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 18 +// Id's are bound by 17 Capability Shader - 2: ExtInstImport "GLSL.std.450" + 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 5 "main" - ExecutionMode 5 OriginUpperLeft - 1: String "" - Source HLSL 500 1 "// OpModuleProcessed auto-map-locations -// OpModuleProcessed auto-map-bindings -// OpModuleProcessed entry-point main -// OpModuleProcessed client vulkan100 -// OpModuleProcessed target-env vulkan1.0 -// OpModuleProcessed keep-uncalled -// OpModuleProcessed hlsl-offsets -#line 1 -" - Name 5 "main" - Name 12 "PixelShaderFunction(vf4;" - Name 11 "input" - 3: TypeVoid - 4: TypeFunction 3 - 7: TypeFloat 32 - 8: TypeVector 7(float) 4 - 9: TypePointer Function 8(fvec4) - 10: TypeFunction 8(fvec4) 9(ptr) - 5(main): 3 Function None 4 - 6: Label - Line 1 3 0 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 11 "PixelShaderFunction(vf4;" + Name 10 "input" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypeFunction 7(fvec4) 8(ptr) + 4(main): 2 Function None 3 + 5: Label Return FunctionEnd - Line 1 2 1 -12(PixelShaderFunction(vf4;): 8(fvec4) Function None 10 - 11(input): 9(ptr) FunctionParameter - 13: Label - Line 1 3 0 - 14: 8(fvec4) Load 11(input) - 15: 8(fvec4) ExtInst 2(GLSL.std.450) 1(Round) 14 - ReturnValue 15 +11(PixelShaderFunction(vf4;): 7(fvec4) Function None 9 + 10(input): 8(ptr) FunctionParameter + 12: Label + 13: 7(fvec4) Load 10(input) + 14: 7(fvec4) ExtInst 1(GLSL.std.450) 1(Round) 13 + ReturnValue 14 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/hlsl.sample.dx9.frag.out b/third_party/glslang/Test/baseResults/hlsl.sample.dx9.frag.out index 1d1924ccd2..f5dd3764b6 100644 --- a/third_party/glslang/Test/baseResults/hlsl.sample.dx9.frag.out +++ b/third_party/glslang/Test/baseResults/hlsl.sample.dx9.frag.out @@ -5,10 +5,7 @@ using depth_any 0:? Sequence 0:15 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:15 Function Parameters: -0:? Scope -0:16 Sequence -0:16 Declare ( temp void) -0:16 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:? Sequence 0:18 Sequence 0:18 move second child to first child ( temp 4-component vector of float) 0:18 'ColorOut' ( temp 4-component vector of float) @@ -199,10 +196,7 @@ using depth_any 0:? Sequence 0:15 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:15 Function Parameters: -0:? Scope -0:16 Sequence -0:16 Declare ( temp void) -0:16 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:? Sequence 0:18 Sequence 0:18 move second child to first child ( temp 4-component vector of float) 0:18 'ColorOut' ( temp 4-component vector of float) @@ -385,216 +379,190 @@ using depth_any // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 135 +// Id's are bound by 134 Capability Shader Capability Sampled1D - 2: ExtInstImport "GLSL.std.450" + 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 5 "main" 128 132 - ExecutionMode 5 OriginUpperLeft - ExecutionMode 5 DepthReplacing - 1: String "" - Source HLSL 500 1 "// OpModuleProcessed auto-map-locations -// OpModuleProcessed auto-map-bindings -// OpModuleProcessed entry-point main -// OpModuleProcessed client vulkan100 -// OpModuleProcessed target-env vulkan1.0 -// OpModuleProcessed keep-uncalled -// OpModuleProcessed hlsl-offsets -#line 1 -" - Name 5 "main" - Name 9 "PS_OUTPUT" - MemberName 9(PS_OUTPUT) 0 "Color" - MemberName 9(PS_OUTPUT) 1 "Depth" - Name 11 "@main(" - Name 14 "psout" - Name 16 "ColorOut" - Name 22 "g_sam" - Name 34 "g_sam1D" - Name 40 "g_sam2D" - Name 50 "g_sam3D" - Name 60 "g_samCube" - Name 125 "flattenTemp" - Name 128 "@entryPointOutput.Color" - Name 132 "@entryPointOutput.Depth" - Decorate 22(g_sam) Binding 0 - Decorate 22(g_sam) DescriptorSet 0 - Decorate 34(g_sam1D) Binding 1 - Decorate 34(g_sam1D) DescriptorSet 0 - Decorate 40(g_sam2D) Binding 2 - Decorate 40(g_sam2D) DescriptorSet 0 - Decorate 50(g_sam3D) Binding 3 - Decorate 50(g_sam3D) DescriptorSet 0 - Decorate 60(g_samCube) Binding 4 - Decorate 60(g_samCube) DescriptorSet 0 - Decorate 128(@entryPointOutput.Color) Location 0 - Decorate 132(@entryPointOutput.Depth) BuiltIn FragDepth - 3: TypeVoid - 4: TypeFunction 3 - 7: TypeFloat 32 - 8: TypeVector 7(float) 4 - 9(PS_OUTPUT): TypeStruct 8(fvec4) 7(float) - 10: TypeFunction 9(PS_OUTPUT) - 13: TypePointer Function 9(PS_OUTPUT) - 15: TypePointer Function 8(fvec4) - 17: 7(float) Constant 0 - 18: 8(fvec4) ConstantComposite 17 17 17 17 - 19: TypeImage 7(float) 2D sampled format:Unknown - 20: TypeSampledImage 19 - 21: TypePointer UniformConstant 20 - 22(g_sam): 21(ptr) Variable UniformConstant - 24: TypeVector 7(float) 2 - 25: 7(float) Constant 1053609165 - 26: 7(float) Constant 1050253722 - 27: 24(fvec2) ConstantComposite 25 26 - 31: TypeImage 7(float) 1D sampled format:Unknown - 32: TypeSampledImage 31 - 33: TypePointer UniformConstant 32 - 34(g_sam1D): 33(ptr) Variable UniformConstant - 36: 7(float) Constant 1056964608 - 40(g_sam2D): 21(ptr) Variable UniformConstant - 42: 7(float) Constant 1058642330 - 43: 24(fvec2) ConstantComposite 36 42 - 47: TypeImage 7(float) 3D sampled format:Unknown - 48: TypeSampledImage 47 - 49: TypePointer UniformConstant 48 - 50(g_sam3D): 49(ptr) Variable UniformConstant - 52: TypeVector 7(float) 3 - 53: 52(fvec3) ConstantComposite 36 42 25 - 57: TypeImage 7(float) Cube sampled format:Unknown - 58: TypeSampledImage 57 - 59: TypePointer UniformConstant 58 - 60(g_samCube): 59(ptr) Variable UniformConstant - 66: 8(fvec4) ConstantComposite 25 26 17 17 - 70: TypeInt 32 0 - 71: 70(int) Constant 3 - 77: 8(fvec4) ConstantComposite 36 17 17 17 - 84: 8(fvec4) ConstantComposite 36 42 17 17 - 93: 8(fvec4) ConstantComposite 36 42 25 17 - 111: TypeInt 32 1 - 112: 111(int) Constant 0 - 114: 7(float) Constant 1092616192 - 118: 111(int) Constant 1 - 119: 7(float) Constant 1065353216 - 120: TypePointer Function 7(float) - 127: TypePointer Output 8(fvec4) -128(@entryPointOutput.Color): 127(ptr) Variable Output - 131: TypePointer Output 7(float) -132(@entryPointOutput.Depth): 131(ptr) Variable Output - Line 1 15 1 - 5(main): 3 Function None 4 - 6: Label -125(flattenTemp): 13(ptr) Variable Function - Line 1 15 0 - 126:9(PS_OUTPUT) FunctionCall 11(@main() - Store 125(flattenTemp) 126 - 129: 15(ptr) AccessChain 125(flattenTemp) 112 - 130: 8(fvec4) Load 129 - Store 128(@entryPointOutput.Color) 130 - 133: 120(ptr) AccessChain 125(flattenTemp) 118 - 134: 7(float) Load 133 - Store 132(@entryPointOutput.Depth) 134 + EntryPoint Fragment 4 "main" 127 131 + ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing + Source HLSL 500 + Name 4 "main" + Name 8 "PS_OUTPUT" + MemberName 8(PS_OUTPUT) 0 "Color" + MemberName 8(PS_OUTPUT) 1 "Depth" + Name 10 "@main(" + Name 13 "ColorOut" + Name 19 "g_sam" + Name 31 "g_sam1D" + Name 37 "g_sam2D" + Name 47 "g_sam3D" + Name 57 "g_samCube" + Name 109 "psout" + Name 124 "flattenTemp" + Name 127 "@entryPointOutput.Color" + Name 131 "@entryPointOutput.Depth" + Decorate 19(g_sam) Binding 0 + Decorate 19(g_sam) DescriptorSet 0 + Decorate 31(g_sam1D) Binding 1 + Decorate 31(g_sam1D) DescriptorSet 0 + Decorate 37(g_sam2D) Binding 2 + Decorate 37(g_sam2D) DescriptorSet 0 + Decorate 47(g_sam3D) Binding 3 + Decorate 47(g_sam3D) DescriptorSet 0 + Decorate 57(g_samCube) Binding 4 + Decorate 57(g_samCube) DescriptorSet 0 + Decorate 127(@entryPointOutput.Color) Location 0 + Decorate 131(@entryPointOutput.Depth) BuiltIn FragDepth + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(PS_OUTPUT): TypeStruct 7(fvec4) 6(float) + 9: TypeFunction 8(PS_OUTPUT) + 12: TypePointer Function 7(fvec4) + 14: 6(float) Constant 0 + 15: 7(fvec4) ConstantComposite 14 14 14 14 + 16: TypeImage 6(float) 2D sampled format:Unknown + 17: TypeSampledImage 16 + 18: TypePointer UniformConstant 17 + 19(g_sam): 18(ptr) Variable UniformConstant + 21: TypeVector 6(float) 2 + 22: 6(float) Constant 1053609165 + 23: 6(float) Constant 1050253722 + 24: 21(fvec2) ConstantComposite 22 23 + 28: TypeImage 6(float) 1D sampled format:Unknown + 29: TypeSampledImage 28 + 30: TypePointer UniformConstant 29 + 31(g_sam1D): 30(ptr) Variable UniformConstant + 33: 6(float) Constant 1056964608 + 37(g_sam2D): 18(ptr) Variable UniformConstant + 39: 6(float) Constant 1058642330 + 40: 21(fvec2) ConstantComposite 33 39 + 44: TypeImage 6(float) 3D sampled format:Unknown + 45: TypeSampledImage 44 + 46: TypePointer UniformConstant 45 + 47(g_sam3D): 46(ptr) Variable UniformConstant + 49: TypeVector 6(float) 3 + 50: 49(fvec3) ConstantComposite 33 39 22 + 54: TypeImage 6(float) Cube sampled format:Unknown + 55: TypeSampledImage 54 + 56: TypePointer UniformConstant 55 + 57(g_samCube): 56(ptr) Variable UniformConstant + 63: 7(fvec4) ConstantComposite 22 23 14 14 + 67: TypeInt 32 0 + 68: 67(int) Constant 3 + 74: 7(fvec4) ConstantComposite 33 14 14 14 + 81: 7(fvec4) ConstantComposite 33 39 14 14 + 90: 7(fvec4) ConstantComposite 33 39 22 14 + 108: TypePointer Function 8(PS_OUTPUT) + 110: TypeInt 32 1 + 111: 110(int) Constant 0 + 113: 6(float) Constant 1092616192 + 117: 110(int) Constant 1 + 118: 6(float) Constant 1065353216 + 119: TypePointer Function 6(float) + 126: TypePointer Output 7(fvec4) +127(@entryPointOutput.Color): 126(ptr) Variable Output + 130: TypePointer Output 6(float) +131(@entryPointOutput.Depth): 130(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label +124(flattenTemp): 108(ptr) Variable Function + 125:8(PS_OUTPUT) FunctionCall 10(@main() + Store 124(flattenTemp) 125 + 128: 12(ptr) AccessChain 124(flattenTemp) 111 + 129: 7(fvec4) Load 128 + Store 127(@entryPointOutput.Color) 129 + 132: 119(ptr) AccessChain 124(flattenTemp) 117 + 133: 6(float) Load 132 + Store 131(@entryPointOutput.Depth) 133 Return FunctionEnd - Line 1 15 1 - 11(@main():9(PS_OUTPUT) Function None 10 - 12: Label - 14(psout): 13(ptr) Variable Function - 16(ColorOut): 15(ptr) Variable Function - Line 1 18 0 - Store 16(ColorOut) 18 - Line 1 20 0 - 23: 20 Load 22(g_sam) - 28: 8(fvec4) ImageSampleImplicitLod 23 27 - 29: 8(fvec4) Load 16(ColorOut) - 30: 8(fvec4) FAdd 29 28 - Store 16(ColorOut) 30 - Line 1 21 0 - 35: 32 Load 34(g_sam1D) - 37: 8(fvec4) ImageSampleImplicitLod 35 36 - 38: 8(fvec4) Load 16(ColorOut) - 39: 8(fvec4) FAdd 38 37 - Store 16(ColorOut) 39 - Line 1 22 0 - 41: 20 Load 40(g_sam2D) - 44: 8(fvec4) ImageSampleImplicitLod 41 43 - 45: 8(fvec4) Load 16(ColorOut) - 46: 8(fvec4) FAdd 45 44 - Store 16(ColorOut) 46 - Line 1 23 0 - 51: 48 Load 50(g_sam3D) - 54: 8(fvec4) ImageSampleImplicitLod 51 53 - 55: 8(fvec4) Load 16(ColorOut) - 56: 8(fvec4) FAdd 55 54 - Store 16(ColorOut) 56 - Line 1 24 0 - 61: 58 Load 60(g_samCube) - 62: 8(fvec4) ImageSampleImplicitLod 61 53 - 63: 8(fvec4) Load 16(ColorOut) - 64: 8(fvec4) FAdd 63 62 - Store 16(ColorOut) 64 - Line 1 26 0 - 65: 20 Load 22(g_sam) - 67: 7(float) CompositeExtract 66 0 - 68: 7(float) CompositeExtract 66 1 - 69: 24(fvec2) CompositeConstruct 67 68 - 72: 7(float) CompositeExtract 66 3 - 73: 8(fvec4) ImageSampleExplicitLod 65 69 Lod 72 - 74: 8(fvec4) Load 16(ColorOut) - 75: 8(fvec4) FAdd 74 73 - Store 16(ColorOut) 75 - Line 1 27 0 - 76: 32 Load 34(g_sam1D) - 78: 7(float) CompositeExtract 77 0 - 79: 7(float) CompositeExtract 77 3 - 80: 8(fvec4) ImageSampleExplicitLod 76 78 Lod 79 - 81: 8(fvec4) Load 16(ColorOut) - 82: 8(fvec4) FAdd 81 80 - Store 16(ColorOut) 82 - Line 1 28 0 - 83: 20 Load 40(g_sam2D) - 85: 7(float) CompositeExtract 84 0 - 86: 7(float) CompositeExtract 84 1 - 87: 24(fvec2) CompositeConstruct 85 86 - 88: 7(float) CompositeExtract 84 3 - 89: 8(fvec4) ImageSampleExplicitLod 83 87 Lod 88 - 90: 8(fvec4) Load 16(ColorOut) - 91: 8(fvec4) FAdd 90 89 - Store 16(ColorOut) 91 - Line 1 29 0 - 92: 48 Load 50(g_sam3D) - 94: 7(float) CompositeExtract 93 0 - 95: 7(float) CompositeExtract 93 1 - 96: 7(float) CompositeExtract 93 2 - 97: 52(fvec3) CompositeConstruct 94 95 96 - 98: 7(float) CompositeExtract 93 3 - 99: 8(fvec4) ImageSampleExplicitLod 92 97 Lod 98 - 100: 8(fvec4) Load 16(ColorOut) - 101: 8(fvec4) FAdd 100 99 - Store 16(ColorOut) 101 - Line 1 30 0 - 102: 58 Load 60(g_samCube) - 103: 7(float) CompositeExtract 93 0 - 104: 7(float) CompositeExtract 93 1 - 105: 7(float) CompositeExtract 93 2 - 106: 52(fvec3) CompositeConstruct 103 104 105 - 107: 7(float) CompositeExtract 93 3 - 108: 8(fvec4) ImageSampleExplicitLod 102 106 Lod 107 - 109: 8(fvec4) Load 16(ColorOut) - 110: 8(fvec4) FAdd 109 108 - Store 16(ColorOut) 110 - Line 1 32 0 - 113: 8(fvec4) Load 16(ColorOut) - 115: 8(fvec4) CompositeConstruct 114 114 114 114 - 116: 8(fvec4) FDiv 113 115 - 117: 15(ptr) AccessChain 14(psout) 112 - Store 117 116 - Line 1 33 0 - 121: 120(ptr) AccessChain 14(psout) 118 - Store 121 119 - Line 1 35 0 - 122:9(PS_OUTPUT) Load 14(psout) - ReturnValue 122 + 10(@main():8(PS_OUTPUT) Function None 9 + 11: Label + 13(ColorOut): 12(ptr) Variable Function + 109(psout): 108(ptr) Variable Function + Store 13(ColorOut) 15 + 20: 17 Load 19(g_sam) + 25: 7(fvec4) ImageSampleImplicitLod 20 24 + 26: 7(fvec4) Load 13(ColorOut) + 27: 7(fvec4) FAdd 26 25 + Store 13(ColorOut) 27 + 32: 29 Load 31(g_sam1D) + 34: 7(fvec4) ImageSampleImplicitLod 32 33 + 35: 7(fvec4) Load 13(ColorOut) + 36: 7(fvec4) FAdd 35 34 + Store 13(ColorOut) 36 + 38: 17 Load 37(g_sam2D) + 41: 7(fvec4) ImageSampleImplicitLod 38 40 + 42: 7(fvec4) Load 13(ColorOut) + 43: 7(fvec4) FAdd 42 41 + Store 13(ColorOut) 43 + 48: 45 Load 47(g_sam3D) + 51: 7(fvec4) ImageSampleImplicitLod 48 50 + 52: 7(fvec4) Load 13(ColorOut) + 53: 7(fvec4) FAdd 52 51 + Store 13(ColorOut) 53 + 58: 55 Load 57(g_samCube) + 59: 7(fvec4) ImageSampleImplicitLod 58 50 + 60: 7(fvec4) Load 13(ColorOut) + 61: 7(fvec4) FAdd 60 59 + Store 13(ColorOut) 61 + 62: 17 Load 19(g_sam) + 64: 6(float) CompositeExtract 63 0 + 65: 6(float) CompositeExtract 63 1 + 66: 21(fvec2) CompositeConstruct 64 65 + 69: 6(float) CompositeExtract 63 3 + 70: 7(fvec4) ImageSampleExplicitLod 62 66 Lod 69 + 71: 7(fvec4) Load 13(ColorOut) + 72: 7(fvec4) FAdd 71 70 + Store 13(ColorOut) 72 + 73: 29 Load 31(g_sam1D) + 75: 6(float) CompositeExtract 74 0 + 76: 6(float) CompositeExtract 74 3 + 77: 7(fvec4) ImageSampleExplicitLod 73 75 Lod 76 + 78: 7(fvec4) Load 13(ColorOut) + 79: 7(fvec4) FAdd 78 77 + Store 13(ColorOut) 79 + 80: 17 Load 37(g_sam2D) + 82: 6(float) CompositeExtract 81 0 + 83: 6(float) CompositeExtract 81 1 + 84: 21(fvec2) CompositeConstruct 82 83 + 85: 6(float) CompositeExtract 81 3 + 86: 7(fvec4) ImageSampleExplicitLod 80 84 Lod 85 + 87: 7(fvec4) Load 13(ColorOut) + 88: 7(fvec4) FAdd 87 86 + Store 13(ColorOut) 88 + 89: 45 Load 47(g_sam3D) + 91: 6(float) CompositeExtract 90 0 + 92: 6(float) CompositeExtract 90 1 + 93: 6(float) CompositeExtract 90 2 + 94: 49(fvec3) CompositeConstruct 91 92 93 + 95: 6(float) CompositeExtract 90 3 + 96: 7(fvec4) ImageSampleExplicitLod 89 94 Lod 95 + 97: 7(fvec4) Load 13(ColorOut) + 98: 7(fvec4) FAdd 97 96 + Store 13(ColorOut) 98 + 99: 55 Load 57(g_samCube) + 100: 6(float) CompositeExtract 90 0 + 101: 6(float) CompositeExtract 90 1 + 102: 6(float) CompositeExtract 90 2 + 103: 49(fvec3) CompositeConstruct 100 101 102 + 104: 6(float) CompositeExtract 90 3 + 105: 7(fvec4) ImageSampleExplicitLod 99 103 Lod 104 + 106: 7(fvec4) Load 13(ColorOut) + 107: 7(fvec4) FAdd 106 105 + Store 13(ColorOut) 107 + 112: 7(fvec4) Load 13(ColorOut) + 114: 7(fvec4) CompositeConstruct 113 113 113 113 + 115: 7(fvec4) FDiv 112 114 + 116: 12(ptr) AccessChain 109(psout) 111 + Store 116 115 + 120: 119(ptr) AccessChain 109(psout) 117 + Store 120 118 + 121:8(PS_OUTPUT) Load 109(psout) + ReturnValue 121 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/hlsl.sample.dx9.vert.out b/third_party/glslang/Test/baseResults/hlsl.sample.dx9.vert.out index 96e7143fd8..3b5432a6af 100644 --- a/third_party/glslang/Test/baseResults/hlsl.sample.dx9.vert.out +++ b/third_party/glslang/Test/baseResults/hlsl.sample.dx9.vert.out @@ -3,10 +3,7 @@ Shader version: 500 0:? Sequence 0:11 Function Definition: @main( ( temp structure{ temp 4-component vector of float Pos}) 0:11 Function Parameters: -0:? Scope -0:12 Sequence -0:12 Declare ( temp void) -0:12 'vsout' ( temp structure{ temp 4-component vector of float Pos}) +0:? Sequence 0:14 Sequence 0:14 move second child to first child ( temp 4-component vector of float) 0:14 'PosOut' ( temp 4-component vector of float) @@ -85,10 +82,7 @@ Shader version: 500 0:? Sequence 0:11 Function Definition: @main( ( temp structure{ temp 4-component vector of float Pos}) 0:11 Function Parameters: -0:? Scope -0:12 Sequence -0:12 Declare ( temp void) -0:12 'vsout' ( temp structure{ temp 4-component vector of float Pos}) +0:? Sequence 0:14 Sequence 0:14 move second child to first child ( temp 4-component vector of float) 0:14 'PosOut' ( temp 4-component vector of float) @@ -161,109 +155,92 @@ Shader version: 500 // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 64 +// Id's are bound by 63 Capability Shader - 2: ExtInstImport "GLSL.std.450" + 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 5 "main" 61 - 1: String "" - Source HLSL 500 1 "// OpModuleProcessed auto-map-locations -// OpModuleProcessed auto-map-bindings -// OpModuleProcessed entry-point main -// OpModuleProcessed client vulkan100 -// OpModuleProcessed target-env vulkan1.0 -// OpModuleProcessed keep-uncalled -// OpModuleProcessed hlsl-offsets -#line 1 -" - Name 5 "main" - Name 9 "VS_OUTPUT" - MemberName 9(VS_OUTPUT) 0 "Pos" - Name 11 "@main(" - Name 14 "vsout" - Name 16 "PosOut" - Name 22 "g_sam" - Name 38 "g_sam2D" - Name 61 "@entryPointOutput.Pos" - Decorate 22(g_sam) Binding 0 - Decorate 22(g_sam) DescriptorSet 0 - Decorate 38(g_sam2D) Binding 1 - Decorate 38(g_sam2D) DescriptorSet 0 - Decorate 61(@entryPointOutput.Pos) BuiltIn Position - 3: TypeVoid - 4: TypeFunction 3 - 7: TypeFloat 32 - 8: TypeVector 7(float) 4 - 9(VS_OUTPUT): TypeStruct 8(fvec4) - 10: TypeFunction 9(VS_OUTPUT) - 13: TypePointer Function 9(VS_OUTPUT) - 15: TypePointer Function 8(fvec4) - 17: 7(float) Constant 0 - 18: 8(fvec4) ConstantComposite 17 17 17 17 - 19: TypeImage 7(float) 2D sampled format:Unknown - 20: TypeSampledImage 19 - 21: TypePointer UniformConstant 20 - 22(g_sam): 21(ptr) Variable UniformConstant - 24: 7(float) Constant 1050253722 - 25: 7(float) Constant 1053609165 - 26: 7(float) Constant 1065353216 - 27: 8(fvec4) ConstantComposite 24 25 17 26 - 28: TypeVector 7(float) 2 - 32: TypeInt 32 0 - 33: 32(int) Constant 3 - 38(g_sam2D): 21(ptr) Variable UniformConstant - 40: 7(float) Constant 1056964608 - 41: 7(float) Constant 1058642330 - 42: 8(fvec4) ConstantComposite 40 41 17 26 - 50: TypeInt 32 1 - 51: 50(int) Constant 0 - 53: 7(float) Constant 1073741824 - 60: TypePointer Output 8(fvec4) -61(@entryPointOutput.Pos): 60(ptr) Variable Output - Line 1 11 1 - 5(main): 3 Function None 4 - 6: Label - Line 1 11 0 - 62:9(VS_OUTPUT) FunctionCall 11(@main() - 63: 8(fvec4) CompositeExtract 62 0 - Store 61(@entryPointOutput.Pos) 63 + EntryPoint Vertex 4 "main" 60 + Source HLSL 500 + Name 4 "main" + Name 8 "VS_OUTPUT" + MemberName 8(VS_OUTPUT) 0 "Pos" + Name 10 "@main(" + Name 13 "PosOut" + Name 19 "g_sam" + Name 35 "g_sam2D" + Name 48 "vsout" + Name 60 "@entryPointOutput.Pos" + Decorate 19(g_sam) Binding 0 + Decorate 19(g_sam) DescriptorSet 0 + Decorate 35(g_sam2D) Binding 1 + Decorate 35(g_sam2D) DescriptorSet 0 + Decorate 60(@entryPointOutput.Pos) BuiltIn Position + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(VS_OUTPUT): TypeStruct 7(fvec4) + 9: TypeFunction 8(VS_OUTPUT) + 12: TypePointer Function 7(fvec4) + 14: 6(float) Constant 0 + 15: 7(fvec4) ConstantComposite 14 14 14 14 + 16: TypeImage 6(float) 2D sampled format:Unknown + 17: TypeSampledImage 16 + 18: TypePointer UniformConstant 17 + 19(g_sam): 18(ptr) Variable UniformConstant + 21: 6(float) Constant 1050253722 + 22: 6(float) Constant 1053609165 + 23: 6(float) Constant 1065353216 + 24: 7(fvec4) ConstantComposite 21 22 14 23 + 25: TypeVector 6(float) 2 + 29: TypeInt 32 0 + 30: 29(int) Constant 3 + 35(g_sam2D): 18(ptr) Variable UniformConstant + 37: 6(float) Constant 1056964608 + 38: 6(float) Constant 1058642330 + 39: 7(fvec4) ConstantComposite 37 38 14 23 + 47: TypePointer Function 8(VS_OUTPUT) + 49: TypeInt 32 1 + 50: 49(int) Constant 0 + 52: 6(float) Constant 1073741824 + 59: TypePointer Output 7(fvec4) +60(@entryPointOutput.Pos): 59(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 61:8(VS_OUTPUT) FunctionCall 10(@main() + 62: 7(fvec4) CompositeExtract 61 0 + Store 60(@entryPointOutput.Pos) 62 Return FunctionEnd - Line 1 11 1 - 11(@main():9(VS_OUTPUT) Function None 10 - 12: Label - 14(vsout): 13(ptr) Variable Function - 16(PosOut): 15(ptr) Variable Function - Line 1 14 0 - Store 16(PosOut) 18 - Line 1 16 0 - 23: 20 Load 22(g_sam) - 29: 7(float) CompositeExtract 27 0 - 30: 7(float) CompositeExtract 27 1 - 31: 28(fvec2) CompositeConstruct 29 30 - 34: 7(float) CompositeExtract 27 3 - 35: 8(fvec4) ImageSampleExplicitLod 23 31 Lod 34 - 36: 8(fvec4) Load 16(PosOut) - 37: 8(fvec4) FAdd 36 35 - Store 16(PosOut) 37 - Line 1 17 0 - 39: 20 Load 38(g_sam2D) - 43: 7(float) CompositeExtract 42 0 - 44: 7(float) CompositeExtract 42 1 - 45: 28(fvec2) CompositeConstruct 43 44 - 46: 7(float) CompositeExtract 42 3 - 47: 8(fvec4) ImageSampleExplicitLod 39 45 Lod 46 - 48: 8(fvec4) Load 16(PosOut) - 49: 8(fvec4) FAdd 48 47 - Store 16(PosOut) 49 - Line 1 19 0 - 52: 8(fvec4) Load 16(PosOut) - 54: 8(fvec4) CompositeConstruct 53 53 53 53 - 55: 8(fvec4) FDiv 52 54 - 56: 15(ptr) AccessChain 14(vsout) 51 - Store 56 55 - Line 1 21 0 - 57:9(VS_OUTPUT) Load 14(vsout) - ReturnValue 57 + 10(@main():8(VS_OUTPUT) Function None 9 + 11: Label + 13(PosOut): 12(ptr) Variable Function + 48(vsout): 47(ptr) Variable Function + Store 13(PosOut) 15 + 20: 17 Load 19(g_sam) + 26: 6(float) CompositeExtract 24 0 + 27: 6(float) CompositeExtract 24 1 + 28: 25(fvec2) CompositeConstruct 26 27 + 31: 6(float) CompositeExtract 24 3 + 32: 7(fvec4) ImageSampleExplicitLod 20 28 Lod 31 + 33: 7(fvec4) Load 13(PosOut) + 34: 7(fvec4) FAdd 33 32 + Store 13(PosOut) 34 + 36: 17 Load 35(g_sam2D) + 40: 6(float) CompositeExtract 39 0 + 41: 6(float) CompositeExtract 39 1 + 42: 25(fvec2) CompositeConstruct 40 41 + 43: 6(float) CompositeExtract 39 3 + 44: 7(fvec4) ImageSampleExplicitLod 36 42 Lod 43 + 45: 7(fvec4) Load 13(PosOut) + 46: 7(fvec4) FAdd 45 44 + Store 13(PosOut) 46 + 51: 7(fvec4) Load 13(PosOut) + 53: 7(fvec4) CompositeConstruct 52 52 52 52 + 54: 7(fvec4) FDiv 51 53 + 55: 12(ptr) AccessChain 48(vsout) 50 + Store 55 54 + 56:8(VS_OUTPUT) Load 48(vsout) + ReturnValue 56 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/iomap.bindingPerResourceType.vert.out b/third_party/glslang/Test/baseResults/iomap.bindingPerResourceType.vert.out new file mode 100644 index 0000000000..14d74592ba --- /dev/null +++ b/third_party/glslang/Test/baseResults/iomap.bindingPerResourceType.vert.out @@ -0,0 +1,745 @@ +iomap.bindingPerResourceType.vert +Shader version: 460 +0:? Sequence +0:27 Function Definition: main( ( global void) +0:27 Function Parameters: +0:29 Sequence +0:29 Sequence +0:29 move second child to first child ( temp 4-component vector of float) +0:29 'result' ( temp 4-component vector of float) +0:29 Constant: +0:29 0.000000 +0:29 0.000000 +0:29 0.000000 +0:29 0.000000 +0:30 add second child into first child ( temp 4-component vector of float) +0:30 'result' ( temp 4-component vector of float) +0:30 a: direct index for structure (layout( column_major std140 offset=0) uniform 4-component vector of float) +0:30 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float a}) +0:30 Constant: +0:30 0 (const uint) +0:31 add second child into first child ( temp 4-component vector of float) +0:31 'result' ( temp 4-component vector of float) +0:31 b: direct index for structure (layout( column_major std140 offset=0) uniform 4-component vector of float) +0:31 'anon@2' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float b}) +0:31 Constant: +0:31 0 (const uint) +0:32 add second child into first child ( temp float) +0:32 direct index ( temp float) +0:32 'result' ( temp 4-component vector of float) +0:32 Constant: +0:32 0 (const int) +0:32 direct index (layout( column_major std430 offset=0) temp float) +0:32 c: direct index for structure (layout( column_major std430 offset=0) buffer 40-element array of float) +0:32 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer 40-element array of float c}) +0:32 Constant: +0:32 0 (const uint) +0:32 Constant: +0:32 5 (const int) +0:33 add second child into first child ( temp 2-component vector of float) +0:33 vector swizzle ( temp 2-component vector of float) +0:33 'result' ( temp 4-component vector of float) +0:33 Sequence +0:33 Constant: +0:33 1 (const int) +0:33 Constant: +0:33 2 (const int) +0:33 direct index (layout( column_major std430 offset=0) temp 2-component vector of float) +0:33 d: direct index for structure (layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float) +0:33 'anon@3' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float d}) +0:33 Constant: +0:33 0 (const uint) +0:33 Constant: +0:33 5 (const int) +0:34 add second child into first child ( temp 4-component vector of float) +0:34 'result' ( temp 4-component vector of float) +0:34 imageLoad ( global 4-component vector of float) +0:34 'Image1' (layout( rgba8) uniform image2D) +0:34 Constant: +0:34 5 (const int) +0:34 10 (const int) +0:35 add second child into first child ( temp 4-component vector of float) +0:35 'result' ( temp 4-component vector of float) +0:35 imageLoad ( global 4-component vector of float) +0:35 'Image2' (layout( rgba8) uniform image2D) +0:35 Constant: +0:35 5 (const int) +0:35 10 (const int) +0:36 add second child into first child ( temp 4-component vector of float) +0:36 'result' ( temp 4-component vector of float) +0:36 texture ( global 4-component vector of float) +0:36 'Sampler1' ( uniform sampler2D) +0:36 Constant: +0:36 0.500000 +0:36 0.500000 +0:37 add second child into first child ( temp 4-component vector of float) +0:37 'result' ( temp 4-component vector of float) +0:37 texture ( global 4-component vector of float) +0:37 'Sampler2' ( uniform sampler2D) +0:37 Constant: +0:37 0.500000 +0:37 0.500000 +0:38 move second child to first child ( temp 4-component vector of float) +0:38 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:38 'anon@4' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance}) +0:38 Constant: +0:38 0 (const uint) +0:38 'result' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float a}) +0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer 40-element array of float c}) +0:? 'Image1' (layout( rgba8) uniform image2D) +0:? 'Sampler1' ( uniform sampler2D) +0:? 'anon@2' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float b}) +0:? 'anon@3' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float d}) +0:? 'Image2' (layout( rgba8) uniform image2D) +0:? 'Sampler2' ( uniform sampler2D) +0:? 'anon@4' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance}) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + +iomap.bindingPerResourceType.frag +Shader version: 460 +0:? Sequence +0:29 Function Definition: main( ( global void) +0:29 Function Parameters: +0:31 Sequence +0:31 Sequence +0:31 move second child to first child ( temp 4-component vector of float) +0:31 'result' ( temp 4-component vector of float) +0:31 Constant: +0:31 0.000000 +0:31 0.000000 +0:31 0.000000 +0:31 0.000000 +0:32 add second child into first child ( temp 4-component vector of float) +0:32 'result' ( temp 4-component vector of float) +0:32 a: direct index for structure (layout( column_major std140 offset=0) uniform 4-component vector of float) +0:32 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float a}) +0:32 Constant: +0:32 0 (const uint) +0:33 add second child into first child ( temp 4-component vector of float) +0:33 'result' ( temp 4-component vector of float) +0:33 b: direct index for structure (layout( column_major std140 offset=0) uniform 4-component vector of float) +0:33 'anon@2' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float b}) +0:33 Constant: +0:33 0 (const uint) +0:34 add second child into first child ( temp float) +0:34 direct index ( temp float) +0:34 'result' ( temp 4-component vector of float) +0:34 Constant: +0:34 0 (const int) +0:34 direct index (layout( column_major std430 offset=0) temp float) +0:34 c: direct index for structure (layout( column_major std430 offset=0) buffer 40-element array of float) +0:34 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer 40-element array of float c}) +0:34 Constant: +0:34 0 (const uint) +0:34 Constant: +0:34 5 (const int) +0:35 add second child into first child ( temp 2-component vector of float) +0:35 vector swizzle ( temp 2-component vector of float) +0:35 'result' ( temp 4-component vector of float) +0:35 Sequence +0:35 Constant: +0:35 1 (const int) +0:35 Constant: +0:35 2 (const int) +0:35 direct index (layout( column_major std430 offset=0) temp 2-component vector of float) +0:35 d: direct index for structure (layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float) +0:35 'anon@3' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float d}) +0:35 Constant: +0:35 0 (const uint) +0:35 Constant: +0:35 5 (const int) +0:36 add second child into first child ( temp 4-component vector of float) +0:36 'result' ( temp 4-component vector of float) +0:36 imageLoad ( global 4-component vector of float) +0:36 'Image1' (layout( rgba8) uniform image2D) +0:36 Constant: +0:36 5 (const int) +0:36 10 (const int) +0:37 add second child into first child ( temp 4-component vector of float) +0:37 'result' ( temp 4-component vector of float) +0:37 imageLoad ( global 4-component vector of float) +0:37 'Image2' (layout( rgba8) uniform image2D) +0:37 Constant: +0:37 5 (const int) +0:37 10 (const int) +0:38 add second child into first child ( temp 4-component vector of float) +0:38 'result' ( temp 4-component vector of float) +0:38 texture ( global 4-component vector of float) +0:38 'Sampler1' ( uniform sampler2D) +0:38 Constant: +0:38 0.500000 +0:38 0.500000 +0:39 add second child into first child ( temp 4-component vector of float) +0:39 'result' ( temp 4-component vector of float) +0:39 texture ( global 4-component vector of float) +0:39 'Sampler2' ( uniform sampler2D) +0:39 Constant: +0:39 0.500000 +0:39 0.500000 +0:40 move second child to first child ( temp 4-component vector of float) +0:40 'Output' (layout( location=0) out 4-component vector of float) +0:40 'result' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float a}) +0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer 40-element array of float c}) +0:? 'Image1' (layout( rgba8) uniform image2D) +0:? 'Sampler1' ( uniform sampler2D) +0:? 'anon@2' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float b}) +0:? 'anon@3' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float d}) +0:? 'Image2' (layout( rgba8) uniform image2D) +0:? 'Sampler2' ( uniform sampler2D) +0:? 'Output' (layout( location=0) out 4-component vector of float) + + +Linked vertex stage: + + +Linked fragment stage: + + +Shader version: 460 +0:? Sequence +0:27 Function Definition: main( ( global void) +0:27 Function Parameters: +0:29 Sequence +0:29 Sequence +0:29 move second child to first child ( temp 4-component vector of float) +0:29 'result' ( temp 4-component vector of float) +0:29 Constant: +0:29 0.000000 +0:29 0.000000 +0:29 0.000000 +0:29 0.000000 +0:30 add second child into first child ( temp 4-component vector of float) +0:30 'result' ( temp 4-component vector of float) +0:30 a: direct index for structure (layout( column_major std140 offset=0) uniform 4-component vector of float) +0:30 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float a}) +0:30 Constant: +0:30 0 (const uint) +0:31 add second child into first child ( temp 4-component vector of float) +0:31 'result' ( temp 4-component vector of float) +0:31 b: direct index for structure (layout( column_major std140 offset=0) uniform 4-component vector of float) +0:31 'anon@2' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float b}) +0:31 Constant: +0:31 0 (const uint) +0:32 add second child into first child ( temp float) +0:32 direct index ( temp float) +0:32 'result' ( temp 4-component vector of float) +0:32 Constant: +0:32 0 (const int) +0:32 direct index (layout( column_major std430 offset=0) temp float) +0:32 c: direct index for structure (layout( column_major std430 offset=0) buffer 40-element array of float) +0:32 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer 40-element array of float c}) +0:32 Constant: +0:32 0 (const uint) +0:32 Constant: +0:32 5 (const int) +0:33 add second child into first child ( temp 2-component vector of float) +0:33 vector swizzle ( temp 2-component vector of float) +0:33 'result' ( temp 4-component vector of float) +0:33 Sequence +0:33 Constant: +0:33 1 (const int) +0:33 Constant: +0:33 2 (const int) +0:33 direct index (layout( column_major std430 offset=0) temp 2-component vector of float) +0:33 d: direct index for structure (layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float) +0:33 'anon@3' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float d}) +0:33 Constant: +0:33 0 (const uint) +0:33 Constant: +0:33 5 (const int) +0:34 add second child into first child ( temp 4-component vector of float) +0:34 'result' ( temp 4-component vector of float) +0:34 imageLoad ( global 4-component vector of float) +0:34 'Image1' (layout( rgba8) uniform image2D) +0:34 Constant: +0:34 5 (const int) +0:34 10 (const int) +0:35 add second child into first child ( temp 4-component vector of float) +0:35 'result' ( temp 4-component vector of float) +0:35 imageLoad ( global 4-component vector of float) +0:35 'Image2' (layout( rgba8) uniform image2D) +0:35 Constant: +0:35 5 (const int) +0:35 10 (const int) +0:36 add second child into first child ( temp 4-component vector of float) +0:36 'result' ( temp 4-component vector of float) +0:36 texture ( global 4-component vector of float) +0:36 'Sampler1' ( uniform sampler2D) +0:36 Constant: +0:36 0.500000 +0:36 0.500000 +0:37 add second child into first child ( temp 4-component vector of float) +0:37 'result' ( temp 4-component vector of float) +0:37 texture ( global 4-component vector of float) +0:37 'Sampler2' ( uniform sampler2D) +0:37 Constant: +0:37 0.500000 +0:37 0.500000 +0:38 move second child to first child ( temp 4-component vector of float) +0:38 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:38 'anon@4' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance, out 1-element array of float CullDistance gl_CullDistance}) +0:38 Constant: +0:38 0 (const uint) +0:38 'result' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float a}) +0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer 40-element array of float c}) +0:? 'Image1' (layout( rgba8) uniform image2D) +0:? 'Sampler1' ( uniform sampler2D) +0:? 'anon@2' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float b}) +0:? 'anon@3' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float d}) +0:? 'Image2' (layout( rgba8) uniform image2D) +0:? 'Sampler2' ( uniform sampler2D) +0:? 'anon@4' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance, out 1-element array of float CullDistance gl_CullDistance}) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) +Shader version: 460 +0:? Sequence +0:29 Function Definition: main( ( global void) +0:29 Function Parameters: +0:31 Sequence +0:31 Sequence +0:31 move second child to first child ( temp 4-component vector of float) +0:31 'result' ( temp 4-component vector of float) +0:31 Constant: +0:31 0.000000 +0:31 0.000000 +0:31 0.000000 +0:31 0.000000 +0:32 add second child into first child ( temp 4-component vector of float) +0:32 'result' ( temp 4-component vector of float) +0:32 a: direct index for structure (layout( column_major std140 offset=0) uniform 4-component vector of float) +0:32 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float a}) +0:32 Constant: +0:32 0 (const uint) +0:33 add second child into first child ( temp 4-component vector of float) +0:33 'result' ( temp 4-component vector of float) +0:33 b: direct index for structure (layout( column_major std140 offset=0) uniform 4-component vector of float) +0:33 'anon@2' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float b}) +0:33 Constant: +0:33 0 (const uint) +0:34 add second child into first child ( temp float) +0:34 direct index ( temp float) +0:34 'result' ( temp 4-component vector of float) +0:34 Constant: +0:34 0 (const int) +0:34 direct index (layout( column_major std430 offset=0) temp float) +0:34 c: direct index for structure (layout( column_major std430 offset=0) buffer 40-element array of float) +0:34 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer 40-element array of float c}) +0:34 Constant: +0:34 0 (const uint) +0:34 Constant: +0:34 5 (const int) +0:35 add second child into first child ( temp 2-component vector of float) +0:35 vector swizzle ( temp 2-component vector of float) +0:35 'result' ( temp 4-component vector of float) +0:35 Sequence +0:35 Constant: +0:35 1 (const int) +0:35 Constant: +0:35 2 (const int) +0:35 direct index (layout( column_major std430 offset=0) temp 2-component vector of float) +0:35 d: direct index for structure (layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float) +0:35 'anon@3' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float d}) +0:35 Constant: +0:35 0 (const uint) +0:35 Constant: +0:35 5 (const int) +0:36 add second child into first child ( temp 4-component vector of float) +0:36 'result' ( temp 4-component vector of float) +0:36 imageLoad ( global 4-component vector of float) +0:36 'Image1' (layout( rgba8) uniform image2D) +0:36 Constant: +0:36 5 (const int) +0:36 10 (const int) +0:37 add second child into first child ( temp 4-component vector of float) +0:37 'result' ( temp 4-component vector of float) +0:37 imageLoad ( global 4-component vector of float) +0:37 'Image2' (layout( rgba8) uniform image2D) +0:37 Constant: +0:37 5 (const int) +0:37 10 (const int) +0:38 add second child into first child ( temp 4-component vector of float) +0:38 'result' ( temp 4-component vector of float) +0:38 texture ( global 4-component vector of float) +0:38 'Sampler1' ( uniform sampler2D) +0:38 Constant: +0:38 0.500000 +0:38 0.500000 +0:39 add second child into first child ( temp 4-component vector of float) +0:39 'result' ( temp 4-component vector of float) +0:39 texture ( global 4-component vector of float) +0:39 'Sampler2' ( uniform sampler2D) +0:39 Constant: +0:39 0.500000 +0:39 0.500000 +0:40 move second child to first child ( temp 4-component vector of float) +0:40 'Output' (layout( location=0) out 4-component vector of float) +0:40 'result' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float a}) +0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer 40-element array of float c}) +0:? 'Image1' (layout( rgba8) uniform image2D) +0:? 'Sampler1' ( uniform sampler2D) +0:? 'anon@2' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform 4-component vector of float b}) +0:? 'anon@3' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer unsized 6-element array of 2-component vector of float d}) +0:? 'Image2' (layout( rgba8) uniform image2D) +0:? 'Sampler2' ( uniform sampler2D) +0:? 'Output' (layout( location=0) out 4-component vector of float) + +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 102 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 95 100 101 + Source GLSL 460 + Name 4 "main" + Name 9 "result" + Name 12 "UBO1" + MemberName 12(UBO1) 0 "a" + Name 14 "" + Name 22 "UBO2" + MemberName 22(UBO2) 0 "b" + Name 24 "" + Name 32 "SSBO1" + MemberName 32(SSBO1) 0 "c" + Name 34 "" + Name 47 "SSBO2" + MemberName 47(SSBO2) 0 "d" + Name 49 "" + Name 64 "Image1" + Name 72 "Image2" + Name 80 "Sampler1" + Name 87 "Sampler2" + Name 93 "gl_PerVertex" + MemberName 93(gl_PerVertex) 0 "gl_Position" + MemberName 93(gl_PerVertex) 1 "gl_PointSize" + MemberName 93(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 93(gl_PerVertex) 3 "gl_CullDistance" + Name 95 "" + Name 100 "gl_VertexID" + Name 101 "gl_InstanceID" + Decorate 12(UBO1) Block + MemberDecorate 12(UBO1) 0 Offset 0 + Decorate 14 Binding 0 + Decorate 14 DescriptorSet 0 + Decorate 22(UBO2) Block + MemberDecorate 22(UBO2) 0 Offset 0 + Decorate 24 Binding 1 + Decorate 24 DescriptorSet 0 + Decorate 31 ArrayStride 4 + Decorate 32(SSBO1) BufferBlock + MemberDecorate 32(SSBO1) 0 Offset 0 + Decorate 34 Binding 0 + Decorate 34 DescriptorSet 0 + Decorate 46 ArrayStride 8 + Decorate 47(SSBO2) BufferBlock + MemberDecorate 47(SSBO2) 0 Offset 0 + Decorate 49 Binding 1 + Decorate 49 DescriptorSet 0 + Decorate 64(Image1) Location 0 + Decorate 64(Image1) Binding 0 + Decorate 64(Image1) DescriptorSet 0 + Decorate 72(Image2) Location 2 + Decorate 72(Image2) Binding 1 + Decorate 72(Image2) DescriptorSet 0 + Decorate 80(Sampler1) Location 1 + Decorate 80(Sampler1) Binding 0 + Decorate 80(Sampler1) DescriptorSet 0 + Decorate 87(Sampler2) Location 3 + Decorate 87(Sampler2) Binding 1 + Decorate 87(Sampler2) DescriptorSet 0 + Decorate 93(gl_PerVertex) Block + MemberDecorate 93(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 93(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 93(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 93(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 100(gl_VertexID) BuiltIn VertexId + Decorate 101(gl_InstanceID) BuiltIn InstanceId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 10: 6(float) Constant 0 + 11: 7(fvec4) ConstantComposite 10 10 10 10 + 12(UBO1): TypeStruct 7(fvec4) + 13: TypePointer Uniform 12(UBO1) + 14: 13(ptr) Variable Uniform + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Uniform 7(fvec4) + 22(UBO2): TypeStruct 7(fvec4) + 23: TypePointer Uniform 22(UBO2) + 24: 23(ptr) Variable Uniform + 29: TypeInt 32 0 + 30: 29(int) Constant 40 + 31: TypeArray 6(float) 30 + 32(SSBO1): TypeStruct 31 + 33: TypePointer Uniform 32(SSBO1) + 34: 33(ptr) Variable Uniform + 35: 15(int) Constant 5 + 36: TypePointer Uniform 6(float) + 39: 29(int) Constant 0 + 40: TypePointer Function 6(float) + 45: TypeVector 6(float) 2 + 46: TypeRuntimeArray 45(fvec2) + 47(SSBO2): TypeStruct 46 + 48: TypePointer Uniform 47(SSBO2) + 49: 48(ptr) Variable Uniform + 50: TypePointer Uniform 45(fvec2) + 56: 29(int) Constant 1 + 59: 29(int) Constant 2 + 62: TypeImage 6(float) 2D nonsampled format:Rgba8 + 63: TypePointer UniformConstant 62 + 64(Image1): 63(ptr) Variable UniformConstant + 66: TypeVector 15(int) 2 + 67: 15(int) Constant 10 + 68: 66(ivec2) ConstantComposite 35 67 + 72(Image2): 63(ptr) Variable UniformConstant + 77: TypeImage 6(float) 2D sampled format:Unknown + 78: TypeSampledImage 77 + 79: TypePointer UniformConstant 78 + 80(Sampler1): 79(ptr) Variable UniformConstant + 82: 6(float) Constant 1056964608 + 83: 45(fvec2) ConstantComposite 82 82 + 87(Sampler2): 79(ptr) Variable UniformConstant + 92: TypeArray 6(float) 56 +93(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 92 92 + 94: TypePointer Output 93(gl_PerVertex) + 95: 94(ptr) Variable Output + 97: TypePointer Output 7(fvec4) + 99: TypePointer Input 15(int) +100(gl_VertexID): 99(ptr) Variable Input +101(gl_InstanceID): 99(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 9(result): 8(ptr) Variable Function + Store 9(result) 11 + 18: 17(ptr) AccessChain 14 16 + 19: 7(fvec4) Load 18 + 20: 7(fvec4) Load 9(result) + 21: 7(fvec4) FAdd 20 19 + Store 9(result) 21 + 25: 17(ptr) AccessChain 24 16 + 26: 7(fvec4) Load 25 + 27: 7(fvec4) Load 9(result) + 28: 7(fvec4) FAdd 27 26 + Store 9(result) 28 + 37: 36(ptr) AccessChain 34 16 35 + 38: 6(float) Load 37 + 41: 40(ptr) AccessChain 9(result) 39 + 42: 6(float) Load 41 + 43: 6(float) FAdd 42 38 + 44: 40(ptr) AccessChain 9(result) 39 + Store 44 43 + 51: 50(ptr) AccessChain 49 16 35 + 52: 45(fvec2) Load 51 + 53: 7(fvec4) Load 9(result) + 54: 45(fvec2) VectorShuffle 53 53 1 2 + 55: 45(fvec2) FAdd 54 52 + 57: 40(ptr) AccessChain 9(result) 56 + 58: 6(float) CompositeExtract 55 0 + Store 57 58 + 60: 40(ptr) AccessChain 9(result) 59 + 61: 6(float) CompositeExtract 55 1 + Store 60 61 + 65: 62 Load 64(Image1) + 69: 7(fvec4) ImageRead 65 68 + 70: 7(fvec4) Load 9(result) + 71: 7(fvec4) FAdd 70 69 + Store 9(result) 71 + 73: 62 Load 72(Image2) + 74: 7(fvec4) ImageRead 73 68 + 75: 7(fvec4) Load 9(result) + 76: 7(fvec4) FAdd 75 74 + Store 9(result) 76 + 81: 78 Load 80(Sampler1) + 84: 7(fvec4) ImageSampleExplicitLod 81 83 Lod 10 + 85: 7(fvec4) Load 9(result) + 86: 7(fvec4) FAdd 85 84 + Store 9(result) 86 + 88: 78 Load 87(Sampler2) + 89: 7(fvec4) ImageSampleExplicitLod 88 83 Lod 10 + 90: 7(fvec4) Load 9(result) + 91: 7(fvec4) FAdd 90 89 + Store 9(result) 91 + 96: 7(fvec4) Load 9(result) + 98: 97(ptr) AccessChain 95 16 + Store 98 96 + Return + FunctionEnd +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 95 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 93 + ExecutionMode 4 OriginLowerLeft + Source GLSL 460 + Name 4 "main" + Name 9 "result" + Name 12 "UBO1" + MemberName 12(UBO1) 0 "a" + Name 14 "" + Name 22 "UBO2" + MemberName 22(UBO2) 0 "b" + Name 24 "" + Name 32 "SSBO1" + MemberName 32(SSBO1) 0 "c" + Name 34 "" + Name 47 "SSBO2" + MemberName 47(SSBO2) 0 "d" + Name 49 "" + Name 64 "Image1" + Name 72 "Image2" + Name 80 "Sampler1" + Name 87 "Sampler2" + Name 93 "Output" + Decorate 12(UBO1) Block + MemberDecorate 12(UBO1) 0 Offset 0 + Decorate 14 Binding 0 + Decorate 14 DescriptorSet 0 + Decorate 22(UBO2) Block + MemberDecorate 22(UBO2) 0 Offset 0 + Decorate 24 Binding 1 + Decorate 24 DescriptorSet 0 + Decorate 31 ArrayStride 4 + Decorate 32(SSBO1) BufferBlock + MemberDecorate 32(SSBO1) 0 Offset 0 + Decorate 34 Binding 0 + Decorate 34 DescriptorSet 0 + Decorate 46 ArrayStride 8 + Decorate 47(SSBO2) BufferBlock + MemberDecorate 47(SSBO2) 0 Offset 0 + Decorate 49 Binding 1 + Decorate 49 DescriptorSet 0 + Decorate 64(Image1) Location 0 + Decorate 64(Image1) Binding 0 + Decorate 64(Image1) DescriptorSet 0 + Decorate 72(Image2) Location 2 + Decorate 72(Image2) Binding 1 + Decorate 72(Image2) DescriptorSet 0 + Decorate 80(Sampler1) Location 1 + Decorate 80(Sampler1) Binding 0 + Decorate 80(Sampler1) DescriptorSet 0 + Decorate 87(Sampler2) Location 3 + Decorate 87(Sampler2) Binding 1 + Decorate 87(Sampler2) DescriptorSet 0 + Decorate 93(Output) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 10: 6(float) Constant 0 + 11: 7(fvec4) ConstantComposite 10 10 10 10 + 12(UBO1): TypeStruct 7(fvec4) + 13: TypePointer Uniform 12(UBO1) + 14: 13(ptr) Variable Uniform + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Uniform 7(fvec4) + 22(UBO2): TypeStruct 7(fvec4) + 23: TypePointer Uniform 22(UBO2) + 24: 23(ptr) Variable Uniform + 29: TypeInt 32 0 + 30: 29(int) Constant 40 + 31: TypeArray 6(float) 30 + 32(SSBO1): TypeStruct 31 + 33: TypePointer Uniform 32(SSBO1) + 34: 33(ptr) Variable Uniform + 35: 15(int) Constant 5 + 36: TypePointer Uniform 6(float) + 39: 29(int) Constant 0 + 40: TypePointer Function 6(float) + 45: TypeVector 6(float) 2 + 46: TypeRuntimeArray 45(fvec2) + 47(SSBO2): TypeStruct 46 + 48: TypePointer Uniform 47(SSBO2) + 49: 48(ptr) Variable Uniform + 50: TypePointer Uniform 45(fvec2) + 56: 29(int) Constant 1 + 59: 29(int) Constant 2 + 62: TypeImage 6(float) 2D nonsampled format:Rgba8 + 63: TypePointer UniformConstant 62 + 64(Image1): 63(ptr) Variable UniformConstant + 66: TypeVector 15(int) 2 + 67: 15(int) Constant 10 + 68: 66(ivec2) ConstantComposite 35 67 + 72(Image2): 63(ptr) Variable UniformConstant + 77: TypeImage 6(float) 2D sampled format:Unknown + 78: TypeSampledImage 77 + 79: TypePointer UniformConstant 78 + 80(Sampler1): 79(ptr) Variable UniformConstant + 82: 6(float) Constant 1056964608 + 83: 45(fvec2) ConstantComposite 82 82 + 87(Sampler2): 79(ptr) Variable UniformConstant + 92: TypePointer Output 7(fvec4) + 93(Output): 92(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 9(result): 8(ptr) Variable Function + Store 9(result) 11 + 18: 17(ptr) AccessChain 14 16 + 19: 7(fvec4) Load 18 + 20: 7(fvec4) Load 9(result) + 21: 7(fvec4) FAdd 20 19 + Store 9(result) 21 + 25: 17(ptr) AccessChain 24 16 + 26: 7(fvec4) Load 25 + 27: 7(fvec4) Load 9(result) + 28: 7(fvec4) FAdd 27 26 + Store 9(result) 28 + 37: 36(ptr) AccessChain 34 16 35 + 38: 6(float) Load 37 + 41: 40(ptr) AccessChain 9(result) 39 + 42: 6(float) Load 41 + 43: 6(float) FAdd 42 38 + 44: 40(ptr) AccessChain 9(result) 39 + Store 44 43 + 51: 50(ptr) AccessChain 49 16 35 + 52: 45(fvec2) Load 51 + 53: 7(fvec4) Load 9(result) + 54: 45(fvec2) VectorShuffle 53 53 1 2 + 55: 45(fvec2) FAdd 54 52 + 57: 40(ptr) AccessChain 9(result) 56 + 58: 6(float) CompositeExtract 55 0 + Store 57 58 + 60: 40(ptr) AccessChain 9(result) 59 + 61: 6(float) CompositeExtract 55 1 + Store 60 61 + 65: 62 Load 64(Image1) + 69: 7(fvec4) ImageRead 65 68 + 70: 7(fvec4) Load 9(result) + 71: 7(fvec4) FAdd 70 69 + Store 9(result) 71 + 73: 62 Load 72(Image2) + 74: 7(fvec4) ImageRead 73 68 + 75: 7(fvec4) Load 9(result) + 76: 7(fvec4) FAdd 75 74 + Store 9(result) 76 + 81: 78 Load 80(Sampler1) + 84: 7(fvec4) ImageSampleImplicitLod 81 83 + 85: 7(fvec4) Load 9(result) + 86: 7(fvec4) FAdd 85 84 + Store 9(result) 86 + 88: 78 Load 87(Sampler2) + 89: 7(fvec4) ImageSampleImplicitLod 88 83 + 90: 7(fvec4) Load 9(result) + 91: 7(fvec4) FAdd 90 89 + Store 9(result) 91 + 94: 7(fvec4) Load 9(result) + Store 93(Output) 94 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/lineContinuation.vert.out b/third_party/glslang/Test/baseResults/lineContinuation.vert.out index 9faa420b36..ceb4c029c6 100644 --- a/third_party/glslang/Test/baseResults/lineContinuation.vert.out +++ b/third_party/glslang/Test/baseResults/lineContinuation.vert.out @@ -67,7 +67,7 @@ ERROR: node is still EOpNull! 0:74 'funkyf' ( global highp float) 0:75 Constant: 0:75 1.2300000000000e+16 -0:85 Sequence +0:84 Sequence 0:84 move second child to first child ( temp highp int) 0:84 'funkyh' ( global highp int) 0:86 Constant: @@ -201,7 +201,7 @@ ERROR: node is still EOpNull! 0:74 'funkyf' ( global highp float) 0:75 Constant: 0:75 1.2300000000000e+16 -0:85 Sequence +0:84 Sequence 0:84 move second child to first child ( temp highp int) 0:84 'funkyh' ( global highp int) 0:86 Constant: diff --git a/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.frag.out b/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.frag.out new file mode 100644 index 0000000000..81402b6505 --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.frag.out @@ -0,0 +1,64 @@ +link.multiUnitLayout.0.frag +Shader version: 450 +using depth_greater +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Function Call: outputColor(vf4; ( global void) +0:9 Constant: +0:9 1.000000 +0:9 0.000000 +0:9 0.000000 +0:9 1.000000 +0:10 move second child to first child ( temp float) +0:10 'gl_FragDepth' ( gl_FragDepth float FragDepth) +0:10 Constant: +0:10 0.500000 +0:? Linker Objects +0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth) + +link.multiUnitLayout.1.frag +Shader version: 450 +0:? Sequence +0:5 Function Definition: outputColor(vf4; ( global void) +0:5 Function Parameters: +0:5 'color' ( in 4-component vector of float) +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 'FragColor' (layout( location=0) out 4-component vector of float) +0:7 'color' ( in 4-component vector of float) +0:? Linker Objects +0:? 'FragColor' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 450 +using depth_greater +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Function Call: outputColor(vf4; ( global void) +0:9 Constant: +0:9 1.000000 +0:9 0.000000 +0:9 0.000000 +0:9 1.000000 +0:10 move second child to first child ( temp float) +0:10 'gl_FragDepth' ( gl_FragDepth float FragDepth) +0:10 Constant: +0:10 0.500000 +0:5 Function Definition: outputColor(vf4; ( global void) +0:5 Function Parameters: +0:5 'color' ( in 4-component vector of float) +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 'FragColor' (layout( location=0) out 4-component vector of float) +0:7 'color' ( in 4-component vector of float) +0:? Linker Objects +0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth) +0:? 'FragColor' (layout( location=0) out 4-component vector of float) + diff --git a/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.mesh.out b/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.mesh.out new file mode 100644 index 0000000000..e04290c73a --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.mesh.out @@ -0,0 +1,93 @@ +link.multiUnitLayout.0.mesh +ERROR: 0:2: 'GL_EXT_mesh_shader' : not supported for current targeted SPIR-V version +ERROR: 1 compilation errors. No code generated. + + +Shader version: 460 +Requested GL_EXT_mesh_shader +max_vertices = 81 +max_primitives = 32 +output primitive = triangles +local_size = (1, 1, 1) +ERROR: node is still EOpNull! +0:11 Function Definition: main( ( global void) +0:11 Function Parameters: +0:13 Sequence +0:13 Function Call: do_process( ( global void) +0:? Linker Objects +0:? 'gl_WorkGroupSize' ( const 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) + +link.multiUnitLayout.1.mesh +ERROR: 0:2: 'GL_EXT_mesh_shader' : not supported for current targeted SPIR-V version +ERROR: 1 compilation errors. No code generated. + + +Shader version: 460 +Requested GL_EXT_mesh_shader +max_vertices = -1 +max_primitives = -1 +output primitive = none +local_size = (1, 1, 1) +ERROR: node is still EOpNull! +0:9 Function Definition: do_process( ( global void) +0:9 Function Parameters: +0:11 Sequence +0:11 move second child to first child ( temp uint) +0:11 indirect index (layout( column_major std430 offset=0) temp uint) +0:11 data: direct index for structure (layout( column_major std430 offset=0) buffer runtime-sized array of uint) +0:11 'dataBuffer' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer runtime-sized array of uint data}) +0:11 Constant: +0:11 0 (const int) +0:11 direct index ( temp uint) +0:11 'gl_LocalInvocationID' ( in 3-component vector of uint LocalInvocationID) +0:11 Constant: +0:11 0 (const int) +0:11 direct index ( temp uint) +0:11 'gl_WorkGroupID' ( in 3-component vector of uint WorkGroupID) +0:11 Constant: +0:11 0 (const int) +0:? Linker Objects +0:? 'dataBuffer' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer runtime-sized array of uint data}) + + +Linked mesh stage: + + +Shader version: 460 +Requested GL_EXT_mesh_shader +max_vertices = 81 +max_primitives = 32 +output primitive = triangles +local_size = (1, 1, 1) +ERROR: node is still EOpNull! +0:11 Function Definition: main( ( global void) +0:11 Function Parameters: +0:13 Sequence +0:13 Function Call: do_process( ( global void) +0:9 Function Definition: do_process( ( global void) +0:9 Function Parameters: +0:11 Sequence +0:11 move second child to first child ( temp uint) +0:11 indirect index (layout( column_major std430 offset=0) temp uint) +0:11 data: direct index for structure (layout( column_major std430 offset=0) buffer runtime-sized array of uint) +0:11 'dataBuffer' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer runtime-sized array of uint data}) +0:11 Constant: +0:11 0 (const int) +0:11 direct index ( temp uint) +0:11 'gl_LocalInvocationID' ( in 3-component vector of uint LocalInvocationID) +0:11 Constant: +0:11 0 (const int) +0:11 direct index ( temp uint) +0:11 'gl_WorkGroupID' ( in 3-component vector of uint WorkGroupID) +0:11 Constant: +0:11 0 (const int) +0:? Linker Objects +0:? 'gl_WorkGroupSize' ( const 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 'dataBuffer' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer runtime-sized array of uint data}) + diff --git a/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.tese.out b/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.tese.out new file mode 100644 index 0000000000..d429c865c8 --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.tese.out @@ -0,0 +1,165 @@ +link.multiUnitLayout.0.tese +Shader version: 410 +input primitive = triangles +vertex spacing = equal_spacing +triangle order = cw +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Sequence +0:9 move second child to first child ( temp 4-component vector of float) +0:9 'p0' ( temp 4-component vector of float) +0:9 vector-scale ( temp 4-component vector of float) +0:9 direct index ( temp float) +0:9 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:9 Constant: +0:9 0 (const int) +0:9 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:9 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:9 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:9 Constant: +0:9 0 (const int) +0:9 Constant: +0:9 0 (const int) +0:10 Sequence +0:10 move second child to first child ( temp 4-component vector of float) +0:10 'p1' ( temp 4-component vector of float) +0:10 vector-scale ( temp 4-component vector of float) +0:10 direct index ( temp float) +0:10 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:10 Constant: +0:10 1 (const int) +0:10 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:10 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:10 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:10 Constant: +0:10 1 (const int) +0:10 Constant: +0:10 0 (const int) +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 'p2' ( temp 4-component vector of float) +0:11 vector-scale ( temp 4-component vector of float) +0:11 direct index ( temp float) +0:11 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:11 Constant: +0:11 2 (const int) +0:11 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:11 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:11 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:11 Constant: +0:11 2 (const int) +0:11 Constant: +0:11 0 (const int) +0:12 move second child to first child ( temp 4-component vector of float) +0:12 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:12 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:12 Constant: +0:12 0 (const uint) +0:12 Function Call: transformPosition(vf4; ( global 4-component vector of float) +0:12 add ( temp 4-component vector of float) +0:12 add ( temp 4-component vector of float) +0:12 'p0' ( temp 4-component vector of float) +0:12 'p1' ( temp 4-component vector of float) +0:12 'p2' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance}) + +link.multiUnitLayout.1.tese +Shader version: 410 +input primitive = none +vertex spacing = none +triangle order = none +0:? Sequence +0:3 Function Definition: transformPosition(vf4; ( global 4-component vector of float) +0:3 Function Parameters: +0:3 'position' ( in 4-component vector of float) +0:5 Sequence +0:5 Branch: Return with expression +0:5 vector-scale ( temp 4-component vector of float) +0:5 Constant: +0:5 2.000000 +0:5 'position' ( in 4-component vector of float) +0:? Linker Objects + + +Linked tessellation evaluation stage: + + +Shader version: 410 +input primitive = triangles +vertex spacing = equal_spacing +triangle order = cw +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Sequence +0:9 move second child to first child ( temp 4-component vector of float) +0:9 'p0' ( temp 4-component vector of float) +0:9 vector-scale ( temp 4-component vector of float) +0:9 direct index ( temp float) +0:9 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:9 Constant: +0:9 0 (const int) +0:9 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:9 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:9 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:9 Constant: +0:9 0 (const int) +0:9 Constant: +0:9 0 (const int) +0:10 Sequence +0:10 move second child to first child ( temp 4-component vector of float) +0:10 'p1' ( temp 4-component vector of float) +0:10 vector-scale ( temp 4-component vector of float) +0:10 direct index ( temp float) +0:10 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:10 Constant: +0:10 1 (const int) +0:10 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:10 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:10 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:10 Constant: +0:10 1 (const int) +0:10 Constant: +0:10 0 (const int) +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 'p2' ( temp 4-component vector of float) +0:11 vector-scale ( temp 4-component vector of float) +0:11 direct index ( temp float) +0:11 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:11 Constant: +0:11 2 (const int) +0:11 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:11 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:11 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:11 Constant: +0:11 2 (const int) +0:11 Constant: +0:11 0 (const int) +0:12 move second child to first child ( temp 4-component vector of float) +0:12 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:12 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:12 Constant: +0:12 0 (const uint) +0:12 Function Call: transformPosition(vf4; ( global 4-component vector of float) +0:12 add ( temp 4-component vector of float) +0:12 add ( temp 4-component vector of float) +0:12 'p0' ( temp 4-component vector of float) +0:12 'p1' ( temp 4-component vector of float) +0:12 'p2' ( temp 4-component vector of float) +0:3 Function Definition: transformPosition(vf4; ( global 4-component vector of float) +0:3 Function Parameters: +0:3 'position' ( in 4-component vector of float) +0:5 Sequence +0:5 Branch: Return with expression +0:5 vector-scale ( temp 4-component vector of float) +0:5 Constant: +0:5 2.000000 +0:5 'position' ( in 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) + diff --git a/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.vert.out b/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.vert.out new file mode 100644 index 0000000000..bb2eb6eaa4 --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.multiUnitLayout.0.vert.out @@ -0,0 +1,80 @@ +link.multiUnitLayout.0.vert +Shader version: 450 +in xfb mode +0:? Sequence +0:9 Function Definition: main( ( global void) +0:9 Function Parameters: +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:11 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance}) +0:11 Constant: +0:11 0 (const uint) +0:11 Function Call: computePosition(vf4; ( global 4-component vector of float) +0:11 'in_position' (layout( location=0) in 4-component vector of float) +0:? Linker Objects +0:? 'in_position' (layout( location=0) in 4-component vector of float) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance}) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + +link.multiUnitLayout.1.vert +Shader version: 450 +0:? Sequence +0:3 Function Definition: computePosition(vf4; ( global 4-component vector of float) +0:3 Function Parameters: +0:3 'position' ( in 4-component vector of float) +0:5 Sequence +0:5 Branch: Return with expression +0:5 add ( temp 4-component vector of float) +0:5 Constant: +0:5 1.000000 +0:5 1.000000 +0:5 1.000000 +0:5 1.000000 +0:5 vector-scale ( temp 4-component vector of float) +0:5 Constant: +0:5 2.000000 +0:5 'position' ( in 4-component vector of float) +0:? Linker Objects +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + + +Linked vertex stage: + + +Shader version: 450 +in xfb mode +0:? Sequence +0:9 Function Definition: main( ( global void) +0:9 Function Parameters: +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:11 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance, out 1-element array of float CullDistance gl_CullDistance}) +0:11 Constant: +0:11 0 (const uint) +0:11 Function Call: computePosition(vf4; ( global 4-component vector of float) +0:11 'in_position' (layout( location=0) in 4-component vector of float) +0:3 Function Definition: computePosition(vf4; ( global 4-component vector of float) +0:3 Function Parameters: +0:3 'position' ( in 4-component vector of float) +0:5 Sequence +0:5 Branch: Return with expression +0:5 add ( temp 4-component vector of float) +0:5 Constant: +0:5 1.000000 +0:5 1.000000 +0:5 1.000000 +0:5 1.000000 +0:5 vector-scale ( temp 4-component vector of float) +0:5 Constant: +0:5 2.000000 +0:5 'position' ( in 4-component vector of float) +0:? Linker Objects +0:? 'in_position' (layout( location=0) in 4-component vector of float) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance, out 1-element array of float CullDistance gl_CullDistance}) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + diff --git a/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.frag.out b/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.frag.out new file mode 100644 index 0000000000..fa8b1dda4e --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.frag.out @@ -0,0 +1,67 @@ +link.multiUnitLayout.2.frag +Shader version: 450 +using depth_less +0:? Sequence +0:8 Function Definition: outputColor(vf4; ( global void) +0:8 Function Parameters: +0:8 'color' ( in 4-component vector of float) +0:10 Sequence +0:10 move second child to first child ( temp 4-component vector of float) +0:10 'FragColor' (layout( location=0) out 4-component vector of float) +0:10 'color' ( in 4-component vector of float) +0:? Linker Objects +0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth) +0:? 'FragColor' (layout( location=0) out 4-component vector of float) + +link.multiUnitLayout.0.frag +Shader version: 450 +using depth_greater +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Function Call: outputColor(vf4; ( global void) +0:9 Constant: +0:9 1.000000 +0:9 0.000000 +0:9 0.000000 +0:9 1.000000 +0:10 move second child to first child ( temp float) +0:10 'gl_FragDepth' ( gl_FragDepth float FragDepth) +0:10 Constant: +0:10 0.500000 +0:? Linker Objects +0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth) + + +Linked fragment stage: + +ERROR: Linking fragment stage: Contradictory depth layouts + +Shader version: 450 +using depth_less +0:? Sequence +0:8 Function Definition: outputColor(vf4; ( global void) +0:8 Function Parameters: +0:8 'color' ( in 4-component vector of float) +0:10 Sequence +0:10 move second child to first child ( temp 4-component vector of float) +0:10 'FragColor' (layout( location=0) out 4-component vector of float) +0:10 'color' ( in 4-component vector of float) +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Function Call: outputColor(vf4; ( global void) +0:9 Constant: +0:9 1.000000 +0:9 0.000000 +0:9 0.000000 +0:9 1.000000 +0:10 move second child to first child ( temp float) +0:10 'gl_FragDepth' ( gl_FragDepth float FragDepth) +0:10 Constant: +0:10 0.500000 +0:? Linker Objects +0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth) +0:? 'FragColor' (layout( location=0) out 4-component vector of float) + diff --git a/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.mesh.out b/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.mesh.out new file mode 100644 index 0000000000..4043cdc800 --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.mesh.out @@ -0,0 +1,94 @@ +link.multiUnitLayout.2.mesh +ERROR: 0:2: 'GL_EXT_mesh_shader' : not supported for current targeted SPIR-V version +ERROR: 1 compilation errors. No code generated. + + +Shader version: 460 +Requested GL_EXT_mesh_shader +max_vertices = -1 +max_primitives = 34 +output primitive = none +local_size = (1, 1, 1) +ERROR: node is still EOpNull! +0:12 Function Definition: do_process( ( global void) +0:12 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp uint) +0:14 indirect index (layout( column_major std430 offset=0) temp uint) +0:14 data: direct index for structure (layout( column_major std430 offset=0) buffer runtime-sized array of uint) +0:14 'dataBuffer' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer runtime-sized array of uint data}) +0:14 Constant: +0:14 0 (const int) +0:14 direct index ( temp uint) +0:14 'gl_LocalInvocationID' ( in 3-component vector of uint LocalInvocationID) +0:14 Constant: +0:14 0 (const int) +0:14 direct index ( temp uint) +0:14 'gl_WorkGroupID' ( in 3-component vector of uint WorkGroupID) +0:14 Constant: +0:14 0 (const int) +0:? Linker Objects +0:? 'dataBuffer' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer runtime-sized array of uint data}) + +link.multiUnitLayout.0.mesh +ERROR: 0:2: 'GL_EXT_mesh_shader' : not supported for current targeted SPIR-V version +ERROR: 1 compilation errors. No code generated. + + +Shader version: 460 +Requested GL_EXT_mesh_shader +max_vertices = 81 +max_primitives = 32 +output primitive = triangles +local_size = (1, 1, 1) +ERROR: node is still EOpNull! +0:11 Function Definition: main( ( global void) +0:11 Function Parameters: +0:13 Sequence +0:13 Function Call: do_process( ( global void) +0:? Linker Objects +0:? 'gl_WorkGroupSize' ( const 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) + + +Linked mesh stage: + +ERROR: Linking mesh stage: Contradictory layout max_primitives values + +Shader version: 460 +Requested GL_EXT_mesh_shader +max_vertices = 81 +max_primitives = 34 +output primitive = triangles +local_size = (1, 1, 1) +ERROR: node is still EOpNull! +0:12 Function Definition: do_process( ( global void) +0:12 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp uint) +0:14 indirect index (layout( column_major std430 offset=0) temp uint) +0:14 data: direct index for structure (layout( column_major std430 offset=0) buffer runtime-sized array of uint) +0:14 'dataBuffer' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer runtime-sized array of uint data}) +0:14 Constant: +0:14 0 (const int) +0:14 direct index ( temp uint) +0:14 'gl_LocalInvocationID' ( in 3-component vector of uint LocalInvocationID) +0:14 Constant: +0:14 0 (const int) +0:14 direct index ( temp uint) +0:14 'gl_WorkGroupID' ( in 3-component vector of uint WorkGroupID) +0:14 Constant: +0:14 0 (const int) +0:11 Function Definition: main( ( global void) +0:11 Function Parameters: +0:13 Sequence +0:13 Function Call: do_process( ( global void) +0:? Linker Objects +0:? 'dataBuffer' (layout( column_major std430) buffer block{layout( column_major std430 offset=0) buffer runtime-sized array of uint data}) +0:? 'gl_WorkGroupSize' ( const 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) + diff --git a/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.tese.out b/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.tese.out new file mode 100644 index 0000000000..4813890797 --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.tese.out @@ -0,0 +1,167 @@ +link.multiUnitLayout.2.tese +Shader version: 410 +input primitive = triangles +vertex spacing = fractional_even_spacing +triangle order = ccw +0:? Sequence +0:6 Function Definition: transformPosition(vf4; ( global 4-component vector of float) +0:6 Function Parameters: +0:6 'position' ( in 4-component vector of float) +0:8 Sequence +0:8 Branch: Return with expression +0:8 vector-scale ( temp 4-component vector of float) +0:8 Constant: +0:8 2.000000 +0:8 'position' ( in 4-component vector of float) +0:? Linker Objects + +link.multiUnitLayout.0.tese +Shader version: 410 +input primitive = triangles +vertex spacing = equal_spacing +triangle order = cw +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Sequence +0:9 move second child to first child ( temp 4-component vector of float) +0:9 'p0' ( temp 4-component vector of float) +0:9 vector-scale ( temp 4-component vector of float) +0:9 direct index ( temp float) +0:9 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:9 Constant: +0:9 0 (const int) +0:9 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:9 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:9 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:9 Constant: +0:9 0 (const int) +0:9 Constant: +0:9 0 (const int) +0:10 Sequence +0:10 move second child to first child ( temp 4-component vector of float) +0:10 'p1' ( temp 4-component vector of float) +0:10 vector-scale ( temp 4-component vector of float) +0:10 direct index ( temp float) +0:10 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:10 Constant: +0:10 1 (const int) +0:10 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:10 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:10 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:10 Constant: +0:10 1 (const int) +0:10 Constant: +0:10 0 (const int) +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 'p2' ( temp 4-component vector of float) +0:11 vector-scale ( temp 4-component vector of float) +0:11 direct index ( temp float) +0:11 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:11 Constant: +0:11 2 (const int) +0:11 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:11 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:11 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:11 Constant: +0:11 2 (const int) +0:11 Constant: +0:11 0 (const int) +0:12 move second child to first child ( temp 4-component vector of float) +0:12 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:12 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:12 Constant: +0:12 0 (const uint) +0:12 Function Call: transformPosition(vf4; ( global 4-component vector of float) +0:12 add ( temp 4-component vector of float) +0:12 add ( temp 4-component vector of float) +0:12 'p0' ( temp 4-component vector of float) +0:12 'p1' ( temp 4-component vector of float) +0:12 'p2' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance}) + + +Linked tessellation evaluation stage: + +ERROR: Linking tessellation evaluation stage: Contradictory input vertex spacing +ERROR: Linking tessellation evaluation stage: Contradictory triangle ordering + +Shader version: 410 +input primitive = triangles +vertex spacing = fractional_even_spacing +triangle order = ccw +0:? Sequence +0:6 Function Definition: transformPosition(vf4; ( global 4-component vector of float) +0:6 Function Parameters: +0:6 'position' ( in 4-component vector of float) +0:8 Sequence +0:8 Branch: Return with expression +0:8 vector-scale ( temp 4-component vector of float) +0:8 Constant: +0:8 2.000000 +0:8 'position' ( in 4-component vector of float) +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Sequence +0:9 move second child to first child ( temp 4-component vector of float) +0:9 'p0' ( temp 4-component vector of float) +0:9 vector-scale ( temp 4-component vector of float) +0:9 direct index ( temp float) +0:9 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:9 Constant: +0:9 0 (const int) +0:9 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:9 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:9 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:9 Constant: +0:9 0 (const int) +0:9 Constant: +0:9 0 (const int) +0:10 Sequence +0:10 move second child to first child ( temp 4-component vector of float) +0:10 'p1' ( temp 4-component vector of float) +0:10 vector-scale ( temp 4-component vector of float) +0:10 direct index ( temp float) +0:10 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:10 Constant: +0:10 1 (const int) +0:10 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:10 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:10 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:10 Constant: +0:10 1 (const int) +0:10 Constant: +0:10 0 (const int) +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 'p2' ( temp 4-component vector of float) +0:11 vector-scale ( temp 4-component vector of float) +0:11 direct index ( temp float) +0:11 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:11 Constant: +0:11 2 (const int) +0:11 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:11 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:11 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:11 Constant: +0:11 2 (const int) +0:11 Constant: +0:11 0 (const int) +0:12 move second child to first child ( temp 4-component vector of float) +0:12 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:12 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:12 Constant: +0:12 0 (const uint) +0:12 Function Call: transformPosition(vf4; ( global 4-component vector of float) +0:12 add ( temp 4-component vector of float) +0:12 add ( temp 4-component vector of float) +0:12 'p0' ( temp 4-component vector of float) +0:12 'p1' ( temp 4-component vector of float) +0:12 'p2' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance}) + diff --git a/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.vert.out b/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.vert.out new file mode 100644 index 0000000000..5542ccbf9b --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.multiUnitLayout.2.vert.out @@ -0,0 +1,82 @@ +link.multiUnitLayout.2.vert +Shader version: 450 +in xfb mode +0:? Sequence +0:6 Function Definition: computePosition(vf4; ( global 4-component vector of float) +0:6 Function Parameters: +0:6 'position' ( in 4-component vector of float) +0:8 Sequence +0:8 Branch: Return with expression +0:8 add ( temp 4-component vector of float) +0:8 Constant: +0:8 1.000000 +0:8 1.000000 +0:8 1.000000 +0:8 1.000000 +0:8 vector-scale ( temp 4-component vector of float) +0:8 Constant: +0:8 2.000000 +0:8 'position' ( in 4-component vector of float) +0:? Linker Objects +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + +link.multiUnitLayout.0.vert +Shader version: 450 +in xfb mode +0:? Sequence +0:9 Function Definition: main( ( global void) +0:9 Function Parameters: +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:11 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance}) +0:11 Constant: +0:11 0 (const uint) +0:11 Function Call: computePosition(vf4; ( global 4-component vector of float) +0:11 'in_position' (layout( location=0) in 4-component vector of float) +0:? Linker Objects +0:? 'in_position' (layout( location=0) in 4-component vector of float) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance}) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + + +Linked vertex stage: + +ERROR: Linking vertex stage: Contradictory xfb_stride + +Shader version: 450 +in xfb mode +0:? Sequence +0:6 Function Definition: computePosition(vf4; ( global 4-component vector of float) +0:6 Function Parameters: +0:6 'position' ( in 4-component vector of float) +0:8 Sequence +0:8 Branch: Return with expression +0:8 add ( temp 4-component vector of float) +0:8 Constant: +0:8 1.000000 +0:8 1.000000 +0:8 1.000000 +0:8 1.000000 +0:8 vector-scale ( temp 4-component vector of float) +0:8 Constant: +0:8 2.000000 +0:8 'position' ( in 4-component vector of float) +0:9 Function Definition: main( ( global void) +0:9 Function Parameters: +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:11 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance}) +0:11 Constant: +0:11 0 (const uint) +0:11 Function Call: computePosition(vf4; ( global 4-component vector of float) +0:11 'in_position' (layout( location=0) in 4-component vector of float) +0:? Linker Objects +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) +0:? 'in_position' (layout( location=0) in 4-component vector of float) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance}) + diff --git a/third_party/glslang/Test/baseResults/link.vk.multiUnitLayout.0.comp.out b/third_party/glslang/Test/baseResults/link.vk.multiUnitLayout.0.comp.out new file mode 100644 index 0000000000..9cd445e658 --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.vk.multiUnitLayout.0.comp.out @@ -0,0 +1,151 @@ +link.vk.multiUnitLayout.0.comp +Shader version: 450 +local_size = (1, 1, 1) +local_size ids = (0, -1, -1) +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Function Call: do_compute(u1; ( global void) +0:9 direct index ( temp highp uint) +0:9 'gl_GlobalInvocationID' ( in highp 3-component vector of uint GlobalInvocationID) +0:9 Constant: +0:9 0 (const int) +0:? Linker Objects +0:? 'gl_WorkGroupSize' ( specialization-constant const highp 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) + +link.vk.multiUnitLayout.1.comp +Shader version: 450 +local_size = (1, 1, 1) +0:? Sequence +0:7 Function Definition: do_compute(u1; ( global void) +0:7 Function Parameters: +0:7 'index' ( in highp uint) +0:9 Sequence +0:9 add second child into first child ( temp highp 4-component vector of float) +0:9 indirect index (layout( column_major std430) temp highp 4-component vector of float) +0:9 data: direct index for structure (layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float) +0:9 'dataBuf' (layout( set=0 binding=0 column_major std430) buffer block{layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float data}) +0:9 Constant: +0:9 0 (const int) +0:9 'index' ( in highp uint) +0:9 Constant: +0:9 1.000000 +0:9 1.000000 +0:9 1.000000 +0:9 1.000000 +0:? Linker Objects +0:? 'dataBuf' (layout( set=0 binding=0 column_major std430) buffer block{layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float data}) + + +Linked compute stage: + + +Shader version: 450 +local_size = (1, 1, 1) +local_size ids = (0, -1, -1) +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Function Call: do_compute(u1; ( global void) +0:9 direct index ( temp highp uint) +0:9 'gl_GlobalInvocationID' ( in highp 3-component vector of uint GlobalInvocationID) +0:9 Constant: +0:9 0 (const int) +0:7 Function Definition: do_compute(u1; ( global void) +0:7 Function Parameters: +0:7 'index' ( in highp uint) +0:9 Sequence +0:9 add second child into first child ( temp highp 4-component vector of float) +0:9 indirect index (layout( column_major std430) temp highp 4-component vector of float) +0:9 data: direct index for structure (layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float) +0:9 'dataBuf' (layout( set=0 binding=0 column_major std430) buffer block{layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float data}) +0:9 Constant: +0:9 0 (const int) +0:9 'index' ( in highp uint) +0:9 Constant: +0:9 1.000000 +0:9 1.000000 +0:9 1.000000 +0:9 1.000000 +0:? Linker Objects +0:? 'gl_WorkGroupSize' ( specialization-constant const highp 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 'dataBuf' (layout( set=0 binding=0 column_major std430) buffer block{layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float data}) + +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 40 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 14 + ExecutionMode 4 LocalSize 1 1 1 + Source GLSL 450 + Name 4 "main" + Name 10 "do_compute(u1;" + Name 9 "index" + Name 14 "gl_GlobalInvocationID" + Name 15 "param" + Name 24 "DataBuf" + MemberName 24(DataBuf) 0 "data" + Name 26 "dataBuf" + Decorate 14(gl_GlobalInvocationID) BuiltIn GlobalInvocationId + Decorate 23 ArrayStride 16 + Decorate 24(DataBuf) BufferBlock + MemberDecorate 24(DataBuf) 0 Offset 0 + Decorate 26(dataBuf) Binding 0 + Decorate 26(dataBuf) DescriptorSet 0 + Decorate 37 SpecId 0 + Decorate 39 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 8: TypeFunction 2 7(ptr) + 12: TypeVector 6(int) 3 + 13: TypePointer Input 12(ivec3) +14(gl_GlobalInvocationID): 13(ptr) Variable Input + 16: 6(int) Constant 0 + 17: TypePointer Input 6(int) + 21: TypeFloat 32 + 22: TypeVector 21(float) 4 + 23: TypeRuntimeArray 22(fvec4) + 24(DataBuf): TypeStruct 23 + 25: TypePointer Uniform 24(DataBuf) + 26(dataBuf): 25(ptr) Variable Uniform + 27: TypeInt 32 1 + 28: 27(int) Constant 0 + 30: 21(float) Constant 1065353216 + 31: 22(fvec4) ConstantComposite 30 30 30 30 + 32: TypePointer Uniform 22(fvec4) + 37: 6(int) SpecConstant 1 + 38: 6(int) Constant 1 + 39: 12(ivec3) SpecConstantComposite 37 38 38 + 4(main): 2 Function None 3 + 5: Label + 15(param): 7(ptr) Variable Function + 18: 17(ptr) AccessChain 14(gl_GlobalInvocationID) 16 + 19: 6(int) Load 18 + Store 15(param) 19 + 20: 2 FunctionCall 10(do_compute(u1;) 15(param) + Return + FunctionEnd +10(do_compute(u1;): 2 Function None 8 + 9(index): 7(ptr) FunctionParameter + 11: Label + 29: 6(int) Load 9(index) + 33: 32(ptr) AccessChain 26(dataBuf) 28 29 + 34: 22(fvec4) Load 33 + 35: 22(fvec4) FAdd 34 31 + 36: 32(ptr) AccessChain 26(dataBuf) 28 29 + Store 36 35 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/link.vk.multiUnitLayout.2.comp.out b/third_party/glslang/Test/baseResults/link.vk.multiUnitLayout.2.comp.out new file mode 100644 index 0000000000..f637687eef --- /dev/null +++ b/third_party/glslang/Test/baseResults/link.vk.multiUnitLayout.2.comp.out @@ -0,0 +1,89 @@ +link.vk.multiUnitLayout.2.comp +Shader version: 450 +local_size = (1, 1, 1) +local_size ids = (1, -1, -1) +0:? Sequence +0:10 Function Definition: do_compute(u1; ( global void) +0:10 Function Parameters: +0:10 'index' ( in highp uint) +0:12 Sequence +0:12 add second child into first child ( temp highp 4-component vector of float) +0:12 indirect index (layout( column_major std430) temp highp 4-component vector of float) +0:12 data: direct index for structure (layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float) +0:12 'dataBuf' (layout( set=0 binding=0 column_major std430) buffer block{layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float data}) +0:12 Constant: +0:12 0 (const int) +0:12 'index' ( in highp uint) +0:12 Constant: +0:12 1.000000 +0:12 1.000000 +0:12 1.000000 +0:12 1.000000 +0:? Linker Objects +0:? 'gl_WorkGroupSize' ( specialization-constant const highp 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 'dataBuf' (layout( set=0 binding=0 column_major std430) buffer block{layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float data}) + +link.vk.multiUnitLayout.0.comp +Shader version: 450 +local_size = (1, 1, 1) +local_size ids = (0, -1, -1) +0:? Sequence +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Function Call: do_compute(u1; ( global void) +0:9 direct index ( temp highp uint) +0:9 'gl_GlobalInvocationID' ( in highp 3-component vector of uint GlobalInvocationID) +0:9 Constant: +0:9 0 (const int) +0:? Linker Objects +0:? 'gl_WorkGroupSize' ( specialization-constant const highp 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) + + +Linked compute stage: + +ERROR: Linking compute stage: Contradictory local size specialization ids + +Shader version: 450 +local_size = (1, 1, 1) +local_size ids = (1, -1, -1) +0:? Sequence +0:10 Function Definition: do_compute(u1; ( global void) +0:10 Function Parameters: +0:10 'index' ( in highp uint) +0:12 Sequence +0:12 add second child into first child ( temp highp 4-component vector of float) +0:12 indirect index (layout( column_major std430) temp highp 4-component vector of float) +0:12 data: direct index for structure (layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float) +0:12 'dataBuf' (layout( set=0 binding=0 column_major std430) buffer block{layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float data}) +0:12 Constant: +0:12 0 (const int) +0:12 'index' ( in highp uint) +0:12 Constant: +0:12 1.000000 +0:12 1.000000 +0:12 1.000000 +0:12 1.000000 +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Function Call: do_compute(u1; ( global void) +0:9 direct index ( temp highp uint) +0:9 'gl_GlobalInvocationID' ( in highp 3-component vector of uint GlobalInvocationID) +0:9 Constant: +0:9 0 (const int) +0:? Linker Objects +0:? 'gl_WorkGroupSize' ( specialization-constant const highp 3-component vector of uint WorkGroupSize) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) +0:? 'dataBuf' (layout( set=0 binding=0 column_major std430) buffer block{layout( column_major std430) buffer runtime-sized array of highp 4-component vector of float data}) + +Validation failed +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/preprocessor.paste_stringify.vert.err b/third_party/glslang/Test/baseResults/preprocessor.paste_stringify.vert.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/third_party/glslang/Test/baseResults/preprocessor.paste_stringify.vert.out b/third_party/glslang/Test/baseResults/preprocessor.paste_stringify.vert.out new file mode 100644 index 0000000000..b7cb121128 --- /dev/null +++ b/third_party/glslang/Test/baseResults/preprocessor.paste_stringify.vert.out @@ -0,0 +1,36 @@ +#version 450 +#extension GL_EXT_debug_printf : enable + + + + + + + + + + + + + + + +bool before, after; + +void main() { + 8 == 9 ? 9 : 8; + "12 3"; + debugPrintfEXT("%d", (before, "letters_too", "letters_too", after, 1)); + debugPrintfEXT("aaa1"); + + int pasted_symbol; + float pasted_symbol2; + debugPrintfEXT("string"); + "3 == 4 ? 4 :3"; + "3 == 4 ? 4 :3"; + "aaa"; + "hello"; + debugPrintfEXT("regular string"); + debugPrintfEXT(""); +} + diff --git a/third_party/glslang/Test/baseResults/preprocessor.stringify_invalid.vert.err b/third_party/glslang/Test/baseResults/preprocessor.stringify_invalid.vert.err new file mode 100644 index 0000000000..7eba1d088a --- /dev/null +++ b/third_party/glslang/Test/baseResults/preprocessor.stringify_invalid.vert.err @@ -0,0 +1,4 @@ +ERROR: 0:4: '#' : Illegal sequence of paste (##) and stringify (#). +ERROR: 1 compilation errors. No code generated. + + diff --git a/third_party/glslang/Test/baseResults/preprocessor.stringify_invalid.vert.out b/third_party/glslang/Test/baseResults/preprocessor.stringify_invalid.vert.out new file mode 100644 index 0000000000..e69de29bb2 diff --git a/third_party/glslang/Test/baseResults/remap.basic.dcefunc.frag.out b/third_party/glslang/Test/baseResults/remap.basic.dcefunc.frag.out deleted file mode 100644 index f5c9a71aa4..0000000000 --- a/third_party/glslang/Test/baseResults/remap.basic.dcefunc.frag.out +++ /dev/null @@ -1,35 +0,0 @@ -remap.basic.dcefunc.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 22 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 17 19 - ExecutionMode 4 OriginUpperLeft - Source GLSL 450 - Name 4 "main" - Name 17 "outf4" - Name 19 "inf" - Decorate 17(outf4) Location 0 - Decorate 19(inf) Location 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypeVector 6(float) 3 - 8: TypeFunction 7(fvec3) - 11: 6(float) Constant 0 - 12: 7(fvec3) ConstantComposite 11 11 11 - 15: TypeVector 6(float) 4 - 16: TypePointer Output 15(fvec4) - 17(outf4): 16(ptr) Variable Output - 18: TypePointer Input 6(float) - 19(inf): 18(ptr) Variable Input - 4(main): 2 Function None 3 - 5: Label - 20: 6(float) Load 19(inf) - 21: 15(fvec4) CompositeConstruct 20 20 20 20 - Store 17(outf4) 21 - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.basic.dcevartype.frag.out b/third_party/glslang/Test/baseResults/remap.basic.dcevartype.frag.out deleted file mode 100644 index dd03946d2c..0000000000 --- a/third_party/glslang/Test/baseResults/remap.basic.dcevartype.frag.out +++ /dev/null @@ -1,12 +0,0 @@ -remap.basic.dcevartype.frag -ERROR: #version: ES shaders for Vulkan SPIR-V require version 310 or higher -Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. -ERROR: 1 compilation errors. No code generated. - - - -Linked fragment stage: - -ERROR: Linking fragment stage: Missing entry point: Each stage requires one "void main()" entry point - -SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/remap.basic.everything.frag.out b/third_party/glslang/Test/baseResults/remap.basic.everything.frag.out deleted file mode 100644 index 6c73e595b1..0000000000 --- a/third_party/glslang/Test/baseResults/remap.basic.everything.frag.out +++ /dev/null @@ -1,27 +0,0 @@ -remap.basic.everything.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 24969 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 5663 "main" 4539 3773 - ExecutionMode 5663 OriginUpperLeft - Decorate 4539 Location 0 - Decorate 3773 Location 0 - 8: TypeVoid - 1282: TypeFunction 8 - 13: TypeFloat 32 - 29: TypeVector 13(float) 4 - 666: TypePointer Output 29(fvec4) - 4539: 666(ptr) Variable Output - 650: TypePointer Input 13(float) - 3773: 650(ptr) Variable Input - 5663: 8 Function None 1282 - 24968: Label - 17486: 13(float) Load 3773 - 17691: 29(fvec4) CompositeConstruct 17486 17486 17486 17486 - Store 4539 17691 - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.basic.none.frag.out b/third_party/glslang/Test/baseResults/remap.basic.none.frag.out deleted file mode 100644 index 3cff65b659..0000000000 --- a/third_party/glslang/Test/baseResults/remap.basic.none.frag.out +++ /dev/null @@ -1,40 +0,0 @@ -remap.basic.none.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 22 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 17 19 - ExecutionMode 4 OriginUpperLeft - Source GLSL 450 - Name 4 "main" - Name 9 "dead_fn(" - Name 17 "outf4" - Name 19 "inf" - Decorate 17(outf4) Location 0 - Decorate 19(inf) Location 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypeVector 6(float) 3 - 8: TypeFunction 7(fvec3) - 11: 6(float) Constant 0 - 12: 7(fvec3) ConstantComposite 11 11 11 - 15: TypeVector 6(float) 4 - 16: TypePointer Output 15(fvec4) - 17(outf4): 16(ptr) Variable Output - 18: TypePointer Input 6(float) - 19(inf): 18(ptr) Variable Input - 4(main): 2 Function None 3 - 5: Label - 20: 6(float) Load 19(inf) - 21: 15(fvec4) CompositeConstruct 20 20 20 20 - Store 17(outf4) 21 - Return - FunctionEnd - 9(dead_fn(): 7(fvec3) Function None 8 - 10: Label - ReturnValue 12 - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.basic.strip.frag.out b/third_party/glslang/Test/baseResults/remap.basic.strip.frag.out deleted file mode 100644 index 030877ddaf..0000000000 --- a/third_party/glslang/Test/baseResults/remap.basic.strip.frag.out +++ /dev/null @@ -1,35 +0,0 @@ -remap.basic.strip.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 22 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 17 19 - ExecutionMode 4 OriginUpperLeft - Decorate 17 Location 0 - Decorate 19 Location 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypeVector 6(float) 3 - 8: TypeFunction 7(fvec3) - 11: 6(float) Constant 0 - 12: 7(fvec3) ConstantComposite 11 11 11 - 15: TypeVector 6(float) 4 - 16: TypePointer Output 15(fvec4) - 17: 16(ptr) Variable Output - 18: TypePointer Input 6(float) - 19: 18(ptr) Variable Input - 4: 2 Function None 3 - 5: Label - 20: 6(float) Load 19 - 21: 15(fvec4) CompositeConstruct 20 20 20 20 - Store 17 21 - Return - FunctionEnd - 9: 7(fvec3) Function None 8 - 10: Label - ReturnValue 12 - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out deleted file mode 100644 index a15675ea8f..0000000000 --- a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out +++ /dev/null @@ -1,240 +0,0 @@ -remap.hlsl.sample.basic.everything.frag -WARNING: 0:4: 'immediate sampler state' : unimplemented - -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 24878 - - Capability Shader - Capability Sampled1D - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 5663 "main" 4253 3709 - ExecutionMode 5663 OriginUpperLeft - ExecutionMode 5663 DepthReplacing - Decorate 4727 Binding 0 - Decorate 4727 DescriptorSet 0 - Decorate 3305 Binding 0 - Decorate 3305 DescriptorSet 0 - Decorate 4743 Binding 2 - Decorate 4743 DescriptorSet 0 - Decorate 4807 Binding 3 - Decorate 4807 DescriptorSet 0 - Decorate 5042 Binding 4 - Decorate 5042 DescriptorSet 0 - Decorate 5058 Binding 5 - Decorate 5058 DescriptorSet 0 - Decorate 5122 Binding 6 - Decorate 5122 DescriptorSet 0 - Decorate 3967 Binding 7 - Decorate 3967 DescriptorSet 0 - Decorate 3983 Binding 8 - Decorate 3983 DescriptorSet 0 - Decorate 4047 Binding 9 - Decorate 4047 DescriptorSet 0 - Decorate 3789 Binding 10 - Decorate 3789 DescriptorSet 0 - Decorate 3805 Binding 11 - Decorate 3805 DescriptorSet 0 - Decorate 3869 Binding 12 - Decorate 3869 DescriptorSet 0 - Decorate 4253 Location 0 - Decorate 3709 BuiltIn FragDepth - 8: TypeVoid - 1282: TypeFunction 8 - 13: TypeFloat 32 - 29: TypeVector 13(float) 4 - 1032: TypeStruct 29(fvec4) 13(float) - 319: TypeFunction 1032(struct) - 12: TypeInt 32 1 - 1335: TypeStruct 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) - 1972: TypePointer Function 1335(struct) - 2574: 12(int) Constant 1 - 649: TypePointer Function 12(int) - 2577: 12(int) Constant 2 - 2580: 12(int) Constant 3 - 2583: 12(int) Constant 4 - 2586: 12(int) Constant 5 - 2589: 12(int) Constant 6 - 2571: 12(int) Constant 0 - 2592: 12(int) Constant 7 - 2595: 12(int) Constant 8 - 2598: 12(int) Constant 9 - 2601: 12(int) Constant 10 - 2604: 12(int) Constant 11 - 666: TypePointer Function 29(fvec4) - 149: TypeImage 13(float) 1D sampled format:Unknown - 786: TypePointer UniformConstant 149 - 4727: 786(ptr) Variable UniformConstant - 508: TypeSampler - 1145: TypePointer UniformConstant 508 - 3305: 1145(ptr) Variable UniformConstant - 510: TypeSampledImage 149 - 2935: 13(float) Constant 1036831949 - 26: TypeVector 12(int) 4 - 148: TypeImage 12(int) 1D sampled format:Unknown - 785: TypePointer UniformConstant 148 - 4743: 785(ptr) Variable UniformConstant - 511: TypeSampledImage 148 - 2821: 13(float) Constant 1045220557 - 11: TypeInt 32 0 - 23: TypeVector 11(int) 4 - 147: TypeImage 11(int) 1D sampled format:Unknown - 784: TypePointer UniformConstant 147 - 4807: 784(ptr) Variable UniformConstant - 512: TypeSampledImage 147 - 2151: 13(float) Constant 1050253722 - 150: TypeImage 13(float) 2D sampled format:Unknown - 787: TypePointer UniformConstant 150 - 5042: 787(ptr) Variable UniformConstant - 513: TypeSampledImage 150 - 19: TypeVector 13(float) 2 - 1825: 19(fvec2) ConstantComposite 2935 2821 - 151: TypeImage 12(int) 2D sampled format:Unknown - 788: TypePointer UniformConstant 151 - 5058: 788(ptr) Variable UniformConstant - 514: TypeSampledImage 151 - 2707: 13(float) Constant 1053609165 - 2028: 19(fvec2) ConstantComposite 2151 2707 - 152: TypeImage 11(int) 2D sampled format:Unknown - 789: TypePointer UniformConstant 152 - 5122: 789(ptr) Variable UniformConstant - 515: TypeSampledImage 152 - 252: 13(float) Constant 1056964608 - 2037: 13(float) Constant 1058642330 - 2684: 19(fvec2) ConstantComposite 252 2037 - 153: TypeImage 13(float) 3D sampled format:Unknown - 790: TypePointer UniformConstant 153 - 3967: 790(ptr) Variable UniformConstant - 516: TypeSampledImage 153 - 24: TypeVector 13(float) 3 - 1660: 24(fvec3) ConstantComposite 2935 2821 2151 - 154: TypeImage 12(int) 3D sampled format:Unknown - 791: TypePointer UniformConstant 154 - 3983: 791(ptr) Variable UniformConstant - 517: TypeSampledImage 154 - 2174: 24(fvec3) ConstantComposite 2707 252 2037 - 155: TypeImage 11(int) 3D sampled format:Unknown - 792: TypePointer UniformConstant 155 - 4047: 792(ptr) Variable UniformConstant - 518: TypeSampledImage 155 - 808: 13(float) Constant 1060320051 - 2593: 13(float) Constant 1061997773 - 1364: 13(float) Constant 1063675494 - 2476: 24(fvec3) ConstantComposite 808 2593 1364 - 156: TypeImage 13(float) Cube sampled format:Unknown - 793: TypePointer UniformConstant 156 - 3789: 793(ptr) Variable UniformConstant - 519: TypeSampledImage 156 - 157: TypeImage 12(int) Cube sampled format:Unknown - 794: TypePointer UniformConstant 157 - 3805: 794(ptr) Variable UniformConstant - 520: TypeSampledImage 157 - 158: TypeImage 11(int) Cube sampled format:Unknown - 795: TypePointer UniformConstant 158 - 3869: 795(ptr) Variable UniformConstant - 521: TypeSampledImage 158 - 1669: TypePointer Function 1032(struct) - 138: 13(float) Constant 1065353216 - 1284: 29(fvec4) ConstantComposite 138 138 138 138 - 650: TypePointer Function 13(float) - 667: TypePointer Output 29(fvec4) - 4253: 667(ptr) Variable Output - 651: TypePointer Output 13(float) - 3709: 651(ptr) Variable Output - 5663: 8 Function None 1282 - 24877: Label - 4104: 1669(ptr) Variable Function - 18803:1032(struct) FunctionCall 3317 - Store 4104 18803 - 13396: 666(ptr) AccessChain 4104 2571 - 7967: 29(fvec4) Load 13396 - Store 4253 7967 - 16622: 650(ptr) AccessChain 4104 2574 - 11539: 13(float) Load 16622 - Store 3709 11539 - Return - FunctionEnd - 3317:1032(struct) Function None 319 - 12442: Label - 5830: 1972(ptr) Variable Function - 5072: 1669(ptr) Variable Function - 22671: 649(ptr) AccessChain 5830 2574 - Store 22671 2574 - 20306: 649(ptr) AccessChain 5830 2577 - Store 20306 2574 - 20307: 649(ptr) AccessChain 5830 2580 - Store 20307 2574 - 20308: 649(ptr) AccessChain 5830 2583 - Store 20308 2574 - 20309: 649(ptr) AccessChain 5830 2586 - Store 20309 2574 - 20310: 649(ptr) AccessChain 5830 2589 - Store 20310 2574 - 20311: 649(ptr) AccessChain 5830 2571 - Store 20311 2574 - 20312: 649(ptr) AccessChain 5830 2592 - Store 20312 2574 - 20313: 649(ptr) AccessChain 5830 2595 - Store 20313 2574 - 20314: 649(ptr) AccessChain 5830 2598 - Store 20314 2574 - 20315: 649(ptr) AccessChain 5830 2601 - Store 20315 2574 - 20230: 649(ptr) AccessChain 5830 2604 - Store 20230 2574 - 15508: 149 Load 4727 - 12260: 508 Load 3305 - 12514: 510 SampledImage 15508 12260 - 21065: 29(fvec4) ImageSampleImplicitLod 12514 2935 - 9477: 148 Load 4743 - 16280: 508 Load 3305 - 12515: 511 SampledImage 9477 16280 - 21066: 26(ivec4) ImageSampleImplicitLod 12515 2821 - 9478: 147 Load 4807 - 16281: 508 Load 3305 - 12516: 512 SampledImage 9478 16281 - 21067: 23(ivec4) ImageSampleImplicitLod 12516 2151 - 9479: 150 Load 5042 - 16282: 508 Load 3305 - 12517: 513 SampledImage 9479 16282 - 21068: 29(fvec4) ImageSampleImplicitLod 12517 1825 - 9480: 151 Load 5058 - 16283: 508 Load 3305 - 12518: 514 SampledImage 9480 16283 - 21069: 26(ivec4) ImageSampleImplicitLod 12518 2028 - 9481: 152 Load 5122 - 16284: 508 Load 3305 - 12519: 515 SampledImage 9481 16284 - 21070: 23(ivec4) ImageSampleImplicitLod 12519 2684 - 9482: 153 Load 3967 - 16285: 508 Load 3305 - 12520: 516 SampledImage 9482 16285 - 21071: 29(fvec4) ImageSampleImplicitLod 12520 1660 - 9483: 154 Load 3983 - 16286: 508 Load 3305 - 12521: 517 SampledImage 9483 16286 - 21072: 26(ivec4) ImageSampleImplicitLod 12521 2174 - 9484: 155 Load 4047 - 16287: 508 Load 3305 - 12522: 518 SampledImage 9484 16287 - 21073: 23(ivec4) ImageSampleImplicitLod 12522 2476 - 9485: 156 Load 3789 - 16288: 508 Load 3305 - 12523: 519 SampledImage 9485 16288 - 21074: 29(fvec4) ImageSampleImplicitLod 12523 1660 - 9486: 157 Load 3805 - 16289: 508 Load 3305 - 12524: 520 SampledImage 9486 16289 - 21075: 26(ivec4) ImageSampleImplicitLod 12524 2174 - 9487: 158 Load 3869 - 16290: 508 Load 3305 - 12590: 521 SampledImage 9487 16290 - 20392: 23(ivec4) ImageSampleImplicitLod 12590 2476 - 14275: 666(ptr) AccessChain 5072 2571 - Store 14275 1284 - 20231: 650(ptr) AccessChain 5072 2574 - Store 20231 138 - 8692:1032(struct) Load 5072 - ReturnValue 8692 - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out deleted file mode 100644 index 5e61daae33..0000000000 --- a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out +++ /dev/null @@ -1,327 +0,0 @@ -remap.hlsl.sample.basic.none.frag -WARNING: 0:4: 'immediate sampler state' : unimplemented - -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 198 - - Capability Shader - Capability Sampled1D - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 188 192 - ExecutionMode 4 OriginUpperLeft - ExecutionMode 4 DepthReplacing - Source HLSL 500 - Name 4 "main" - Name 8 "PS_OUTPUT" - MemberName 8(PS_OUTPUT) 0 "Color" - MemberName 8(PS_OUTPUT) 1 "Depth" - Name 10 "@main(" - Name 13 "MemberTest" - MemberName 13(MemberTest) 0 "Sample" - MemberName 13(MemberTest) 1 "CalculateLevelOfDetail" - MemberName 13(MemberTest) 2 "CalculateLevelOfDetailUnclamped" - MemberName 13(MemberTest) 3 "Gather" - MemberName 13(MemberTest) 4 "GetDimensions" - MemberName 13(MemberTest) 5 "GetSamplePosition" - MemberName 13(MemberTest) 6 "Load" - MemberName 13(MemberTest) 7 "SampleBias" - MemberName 13(MemberTest) 8 "SampleCmp" - MemberName 13(MemberTest) 9 "SampleCmpLevelZero" - MemberName 13(MemberTest) 10 "SampleGrad" - MemberName 13(MemberTest) 11 "SampleLevel" - Name 15 "mtest" - Name 42 "txval10" - Name 45 "g_tTex1df4" - Name 49 "g_sSamp" - Name 57 "txval11" - Name 60 "g_tTex1di4" - Name 70 "txval12" - Name 73 "g_tTex1du4" - Name 80 "txval20" - Name 83 "g_tTex2df4" - Name 91 "txval21" - Name 94 "g_tTex2di4" - Name 102 "txval22" - Name 105 "g_tTex2du4" - Name 114 "txval30" - Name 117 "g_tTex3df4" - Name 125 "txval31" - Name 128 "g_tTex3di4" - Name 135 "txval32" - Name 138 "g_tTex3du4" - Name 148 "txval40" - Name 151 "g_tTexcdf4" - Name 157 "txval41" - Name 160 "g_tTexcdi4" - Name 166 "txval42" - Name 169 "g_tTexcdu4" - Name 176 "psout" - Name 185 "flattenTemp" - Name 188 "@entryPointOutput.Color" - Name 192 "@entryPointOutput.Depth" - Name 195 "g_sSamp2d" - Name 196 "g_sSamp2D_b" - Name 197 "g_tTex1df4a" - Decorate 45(g_tTex1df4) Binding 0 - Decorate 45(g_tTex1df4) DescriptorSet 0 - Decorate 49(g_sSamp) Binding 0 - Decorate 49(g_sSamp) DescriptorSet 0 - Decorate 60(g_tTex1di4) Binding 2 - Decorate 60(g_tTex1di4) DescriptorSet 0 - Decorate 73(g_tTex1du4) Binding 3 - Decorate 73(g_tTex1du4) DescriptorSet 0 - Decorate 83(g_tTex2df4) Binding 4 - Decorate 83(g_tTex2df4) DescriptorSet 0 - Decorate 94(g_tTex2di4) Binding 5 - Decorate 94(g_tTex2di4) DescriptorSet 0 - Decorate 105(g_tTex2du4) Binding 6 - Decorate 105(g_tTex2du4) DescriptorSet 0 - Decorate 117(g_tTex3df4) Binding 7 - Decorate 117(g_tTex3df4) DescriptorSet 0 - Decorate 128(g_tTex3di4) Binding 8 - Decorate 128(g_tTex3di4) DescriptorSet 0 - Decorate 138(g_tTex3du4) Binding 9 - Decorate 138(g_tTex3du4) DescriptorSet 0 - Decorate 151(g_tTexcdf4) Binding 10 - Decorate 151(g_tTexcdf4) DescriptorSet 0 - Decorate 160(g_tTexcdi4) Binding 11 - Decorate 160(g_tTexcdi4) DescriptorSet 0 - Decorate 169(g_tTexcdu4) Binding 12 - Decorate 169(g_tTexcdu4) DescriptorSet 0 - Decorate 188(@entryPointOutput.Color) Location 0 - Decorate 192(@entryPointOutput.Depth) BuiltIn FragDepth - Decorate 195(g_sSamp2d) Binding 0 - Decorate 195(g_sSamp2d) DescriptorSet 0 - Decorate 196(g_sSamp2D_b) Binding 0 - Decorate 196(g_sSamp2D_b) DescriptorSet 0 - Decorate 197(g_tTex1df4a) Binding 1 - Decorate 197(g_tTex1df4a) DescriptorSet 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypeVector 6(float) 4 - 8(PS_OUTPUT): TypeStruct 7(fvec4) 6(float) - 9: TypeFunction 8(PS_OUTPUT) - 12: TypeInt 32 1 - 13(MemberTest): TypeStruct 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) - 14: TypePointer Function 13(MemberTest) - 16: 12(int) Constant 1 - 17: TypePointer Function 12(int) - 19: 12(int) Constant 2 - 21: 12(int) Constant 3 - 23: 12(int) Constant 4 - 25: 12(int) Constant 5 - 27: 12(int) Constant 6 - 29: 12(int) Constant 0 - 31: 12(int) Constant 7 - 33: 12(int) Constant 8 - 35: 12(int) Constant 9 - 37: 12(int) Constant 10 - 39: 12(int) Constant 11 - 41: TypePointer Function 7(fvec4) - 43: TypeImage 6(float) 1D sampled format:Unknown - 44: TypePointer UniformConstant 43 - 45(g_tTex1df4): 44(ptr) Variable UniformConstant - 47: TypeSampler - 48: TypePointer UniformConstant 47 - 49(g_sSamp): 48(ptr) Variable UniformConstant - 51: TypeSampledImage 43 - 53: 6(float) Constant 1036831949 - 55: TypeVector 12(int) 4 - 56: TypePointer Function 55(ivec4) - 58: TypeImage 12(int) 1D sampled format:Unknown - 59: TypePointer UniformConstant 58 - 60(g_tTex1di4): 59(ptr) Variable UniformConstant - 63: TypeSampledImage 58 - 65: 6(float) Constant 1045220557 - 67: TypeInt 32 0 - 68: TypeVector 67(int) 4 - 69: TypePointer Function 68(ivec4) - 71: TypeImage 67(int) 1D sampled format:Unknown - 72: TypePointer UniformConstant 71 - 73(g_tTex1du4): 72(ptr) Variable UniformConstant - 76: TypeSampledImage 71 - 78: 6(float) Constant 1050253722 - 81: TypeImage 6(float) 2D sampled format:Unknown - 82: TypePointer UniformConstant 81 - 83(g_tTex2df4): 82(ptr) Variable UniformConstant - 86: TypeSampledImage 81 - 88: TypeVector 6(float) 2 - 89: 88(fvec2) ConstantComposite 53 65 - 92: TypeImage 12(int) 2D sampled format:Unknown - 93: TypePointer UniformConstant 92 - 94(g_tTex2di4): 93(ptr) Variable UniformConstant - 97: TypeSampledImage 92 - 99: 6(float) Constant 1053609165 - 100: 88(fvec2) ConstantComposite 78 99 - 103: TypeImage 67(int) 2D sampled format:Unknown - 104: TypePointer UniformConstant 103 - 105(g_tTex2du4): 104(ptr) Variable UniformConstant - 108: TypeSampledImage 103 - 110: 6(float) Constant 1056964608 - 111: 6(float) Constant 1058642330 - 112: 88(fvec2) ConstantComposite 110 111 - 115: TypeImage 6(float) 3D sampled format:Unknown - 116: TypePointer UniformConstant 115 - 117(g_tTex3df4): 116(ptr) Variable UniformConstant - 120: TypeSampledImage 115 - 122: TypeVector 6(float) 3 - 123: 122(fvec3) ConstantComposite 53 65 78 - 126: TypeImage 12(int) 3D sampled format:Unknown - 127: TypePointer UniformConstant 126 - 128(g_tTex3di4): 127(ptr) Variable UniformConstant - 131: TypeSampledImage 126 - 133: 122(fvec3) ConstantComposite 99 110 111 - 136: TypeImage 67(int) 3D sampled format:Unknown - 137: TypePointer UniformConstant 136 - 138(g_tTex3du4): 137(ptr) Variable UniformConstant - 141: TypeSampledImage 136 - 143: 6(float) Constant 1060320051 - 144: 6(float) Constant 1061997773 - 145: 6(float) Constant 1063675494 - 146: 122(fvec3) ConstantComposite 143 144 145 - 149: TypeImage 6(float) Cube sampled format:Unknown - 150: TypePointer UniformConstant 149 - 151(g_tTexcdf4): 150(ptr) Variable UniformConstant - 154: TypeSampledImage 149 - 158: TypeImage 12(int) Cube sampled format:Unknown - 159: TypePointer UniformConstant 158 - 160(g_tTexcdi4): 159(ptr) Variable UniformConstant - 163: TypeSampledImage 158 - 167: TypeImage 67(int) Cube sampled format:Unknown - 168: TypePointer UniformConstant 167 - 169(g_tTexcdu4): 168(ptr) Variable UniformConstant - 172: TypeSampledImage 167 - 175: TypePointer Function 8(PS_OUTPUT) - 177: 6(float) Constant 1065353216 - 178: 7(fvec4) ConstantComposite 177 177 177 177 - 180: TypePointer Function 6(float) - 187: TypePointer Output 7(fvec4) -188(@entryPointOutput.Color): 187(ptr) Variable Output - 191: TypePointer Output 6(float) -192(@entryPointOutput.Depth): 191(ptr) Variable Output - 195(g_sSamp2d): 48(ptr) Variable UniformConstant -196(g_sSamp2D_b): 48(ptr) Variable UniformConstant -197(g_tTex1df4a): 44(ptr) Variable UniformConstant - 4(main): 2 Function None 3 - 5: Label -185(flattenTemp): 175(ptr) Variable Function - 186:8(PS_OUTPUT) FunctionCall 10(@main() - Store 185(flattenTemp) 186 - 189: 41(ptr) AccessChain 185(flattenTemp) 29 - 190: 7(fvec4) Load 189 - Store 188(@entryPointOutput.Color) 190 - 193: 180(ptr) AccessChain 185(flattenTemp) 16 - 194: 6(float) Load 193 - Store 192(@entryPointOutput.Depth) 194 - Return - FunctionEnd - 10(@main():8(PS_OUTPUT) Function None 9 - 11: Label - 15(mtest): 14(ptr) Variable Function - 42(txval10): 41(ptr) Variable Function - 57(txval11): 56(ptr) Variable Function - 70(txval12): 69(ptr) Variable Function - 80(txval20): 41(ptr) Variable Function - 91(txval21): 56(ptr) Variable Function - 102(txval22): 69(ptr) Variable Function - 114(txval30): 41(ptr) Variable Function - 125(txval31): 56(ptr) Variable Function - 135(txval32): 69(ptr) Variable Function - 148(txval40): 41(ptr) Variable Function - 157(txval41): 56(ptr) Variable Function - 166(txval42): 69(ptr) Variable Function - 176(psout): 175(ptr) Variable Function - 18: 17(ptr) AccessChain 15(mtest) 16 - Store 18 16 - 20: 17(ptr) AccessChain 15(mtest) 19 - Store 20 16 - 22: 17(ptr) AccessChain 15(mtest) 21 - Store 22 16 - 24: 17(ptr) AccessChain 15(mtest) 23 - Store 24 16 - 26: 17(ptr) AccessChain 15(mtest) 25 - Store 26 16 - 28: 17(ptr) AccessChain 15(mtest) 27 - Store 28 16 - 30: 17(ptr) AccessChain 15(mtest) 29 - Store 30 16 - 32: 17(ptr) AccessChain 15(mtest) 31 - Store 32 16 - 34: 17(ptr) AccessChain 15(mtest) 33 - Store 34 16 - 36: 17(ptr) AccessChain 15(mtest) 35 - Store 36 16 - 38: 17(ptr) AccessChain 15(mtest) 37 - Store 38 16 - 40: 17(ptr) AccessChain 15(mtest) 39 - Store 40 16 - 46: 43 Load 45(g_tTex1df4) - 50: 47 Load 49(g_sSamp) - 52: 51 SampledImage 46 50 - 54: 7(fvec4) ImageSampleImplicitLod 52 53 - Store 42(txval10) 54 - 61: 58 Load 60(g_tTex1di4) - 62: 47 Load 49(g_sSamp) - 64: 63 SampledImage 61 62 - 66: 55(ivec4) ImageSampleImplicitLod 64 65 - Store 57(txval11) 66 - 74: 71 Load 73(g_tTex1du4) - 75: 47 Load 49(g_sSamp) - 77: 76 SampledImage 74 75 - 79: 68(ivec4) ImageSampleImplicitLod 77 78 - Store 70(txval12) 79 - 84: 81 Load 83(g_tTex2df4) - 85: 47 Load 49(g_sSamp) - 87: 86 SampledImage 84 85 - 90: 7(fvec4) ImageSampleImplicitLod 87 89 - Store 80(txval20) 90 - 95: 92 Load 94(g_tTex2di4) - 96: 47 Load 49(g_sSamp) - 98: 97 SampledImage 95 96 - 101: 55(ivec4) ImageSampleImplicitLod 98 100 - Store 91(txval21) 101 - 106: 103 Load 105(g_tTex2du4) - 107: 47 Load 49(g_sSamp) - 109: 108 SampledImage 106 107 - 113: 68(ivec4) ImageSampleImplicitLod 109 112 - Store 102(txval22) 113 - 118: 115 Load 117(g_tTex3df4) - 119: 47 Load 49(g_sSamp) - 121: 120 SampledImage 118 119 - 124: 7(fvec4) ImageSampleImplicitLod 121 123 - Store 114(txval30) 124 - 129: 126 Load 128(g_tTex3di4) - 130: 47 Load 49(g_sSamp) - 132: 131 SampledImage 129 130 - 134: 55(ivec4) ImageSampleImplicitLod 132 133 - Store 125(txval31) 134 - 139: 136 Load 138(g_tTex3du4) - 140: 47 Load 49(g_sSamp) - 142: 141 SampledImage 139 140 - 147: 68(ivec4) ImageSampleImplicitLod 142 146 - Store 135(txval32) 147 - 152: 149 Load 151(g_tTexcdf4) - 153: 47 Load 49(g_sSamp) - 155: 154 SampledImage 152 153 - 156: 7(fvec4) ImageSampleImplicitLod 155 123 - Store 148(txval40) 156 - 161: 158 Load 160(g_tTexcdi4) - 162: 47 Load 49(g_sSamp) - 164: 163 SampledImage 161 162 - 165: 55(ivec4) ImageSampleImplicitLod 164 133 - Store 157(txval41) 165 - 170: 167 Load 169(g_tTexcdu4) - 171: 47 Load 49(g_sSamp) - 173: 172 SampledImage 170 171 - 174: 68(ivec4) ImageSampleImplicitLod 173 146 - Store 166(txval42) 174 - 179: 41(ptr) AccessChain 176(psout) 29 - Store 179 178 - 181: 180(ptr) AccessChain 176(psout) 16 - Store 181 177 - 182:8(PS_OUTPUT) Load 176(psout) - ReturnValue 182 - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out deleted file mode 100644 index a9d041a85a..0000000000 --- a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out +++ /dev/null @@ -1,275 +0,0 @@ -remap.hlsl.sample.basic.strip.frag -WARNING: 0:4: 'immediate sampler state' : unimplemented - -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 198 - - Capability Shader - Capability Sampled1D - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 188 192 - ExecutionMode 4 OriginUpperLeft - ExecutionMode 4 DepthReplacing - Decorate 45 Binding 0 - Decorate 45 DescriptorSet 0 - Decorate 49 Binding 0 - Decorate 49 DescriptorSet 0 - Decorate 60 Binding 2 - Decorate 60 DescriptorSet 0 - Decorate 73 Binding 3 - Decorate 73 DescriptorSet 0 - Decorate 83 Binding 4 - Decorate 83 DescriptorSet 0 - Decorate 94 Binding 5 - Decorate 94 DescriptorSet 0 - Decorate 105 Binding 6 - Decorate 105 DescriptorSet 0 - Decorate 117 Binding 7 - Decorate 117 DescriptorSet 0 - Decorate 128 Binding 8 - Decorate 128 DescriptorSet 0 - Decorate 138 Binding 9 - Decorate 138 DescriptorSet 0 - Decorate 151 Binding 10 - Decorate 151 DescriptorSet 0 - Decorate 160 Binding 11 - Decorate 160 DescriptorSet 0 - Decorate 169 Binding 12 - Decorate 169 DescriptorSet 0 - Decorate 188 Location 0 - Decorate 192 BuiltIn FragDepth - Decorate 195 Binding 0 - Decorate 195 DescriptorSet 0 - Decorate 196 Binding 0 - Decorate 196 DescriptorSet 0 - Decorate 197 Binding 1 - Decorate 197 DescriptorSet 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypeVector 6(float) 4 - 8: TypeStruct 7(fvec4) 6(float) - 9: TypeFunction 8(struct) - 12: TypeInt 32 1 - 13: TypeStruct 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) 12(int) - 14: TypePointer Function 13(struct) - 16: 12(int) Constant 1 - 17: TypePointer Function 12(int) - 19: 12(int) Constant 2 - 21: 12(int) Constant 3 - 23: 12(int) Constant 4 - 25: 12(int) Constant 5 - 27: 12(int) Constant 6 - 29: 12(int) Constant 0 - 31: 12(int) Constant 7 - 33: 12(int) Constant 8 - 35: 12(int) Constant 9 - 37: 12(int) Constant 10 - 39: 12(int) Constant 11 - 41: TypePointer Function 7(fvec4) - 43: TypeImage 6(float) 1D sampled format:Unknown - 44: TypePointer UniformConstant 43 - 45: 44(ptr) Variable UniformConstant - 47: TypeSampler - 48: TypePointer UniformConstant 47 - 49: 48(ptr) Variable UniformConstant - 51: TypeSampledImage 43 - 53: 6(float) Constant 1036831949 - 55: TypeVector 12(int) 4 - 56: TypePointer Function 55(ivec4) - 58: TypeImage 12(int) 1D sampled format:Unknown - 59: TypePointer UniformConstant 58 - 60: 59(ptr) Variable UniformConstant - 63: TypeSampledImage 58 - 65: 6(float) Constant 1045220557 - 67: TypeInt 32 0 - 68: TypeVector 67(int) 4 - 69: TypePointer Function 68(ivec4) - 71: TypeImage 67(int) 1D sampled format:Unknown - 72: TypePointer UniformConstant 71 - 73: 72(ptr) Variable UniformConstant - 76: TypeSampledImage 71 - 78: 6(float) Constant 1050253722 - 81: TypeImage 6(float) 2D sampled format:Unknown - 82: TypePointer UniformConstant 81 - 83: 82(ptr) Variable UniformConstant - 86: TypeSampledImage 81 - 88: TypeVector 6(float) 2 - 89: 88(fvec2) ConstantComposite 53 65 - 92: TypeImage 12(int) 2D sampled format:Unknown - 93: TypePointer UniformConstant 92 - 94: 93(ptr) Variable UniformConstant - 97: TypeSampledImage 92 - 99: 6(float) Constant 1053609165 - 100: 88(fvec2) ConstantComposite 78 99 - 103: TypeImage 67(int) 2D sampled format:Unknown - 104: TypePointer UniformConstant 103 - 105: 104(ptr) Variable UniformConstant - 108: TypeSampledImage 103 - 110: 6(float) Constant 1056964608 - 111: 6(float) Constant 1058642330 - 112: 88(fvec2) ConstantComposite 110 111 - 115: TypeImage 6(float) 3D sampled format:Unknown - 116: TypePointer UniformConstant 115 - 117: 116(ptr) Variable UniformConstant - 120: TypeSampledImage 115 - 122: TypeVector 6(float) 3 - 123: 122(fvec3) ConstantComposite 53 65 78 - 126: TypeImage 12(int) 3D sampled format:Unknown - 127: TypePointer UniformConstant 126 - 128: 127(ptr) Variable UniformConstant - 131: TypeSampledImage 126 - 133: 122(fvec3) ConstantComposite 99 110 111 - 136: TypeImage 67(int) 3D sampled format:Unknown - 137: TypePointer UniformConstant 136 - 138: 137(ptr) Variable UniformConstant - 141: TypeSampledImage 136 - 143: 6(float) Constant 1060320051 - 144: 6(float) Constant 1061997773 - 145: 6(float) Constant 1063675494 - 146: 122(fvec3) ConstantComposite 143 144 145 - 149: TypeImage 6(float) Cube sampled format:Unknown - 150: TypePointer UniformConstant 149 - 151: 150(ptr) Variable UniformConstant - 154: TypeSampledImage 149 - 158: TypeImage 12(int) Cube sampled format:Unknown - 159: TypePointer UniformConstant 158 - 160: 159(ptr) Variable UniformConstant - 163: TypeSampledImage 158 - 167: TypeImage 67(int) Cube sampled format:Unknown - 168: TypePointer UniformConstant 167 - 169: 168(ptr) Variable UniformConstant - 172: TypeSampledImage 167 - 175: TypePointer Function 8(struct) - 177: 6(float) Constant 1065353216 - 178: 7(fvec4) ConstantComposite 177 177 177 177 - 180: TypePointer Function 6(float) - 187: TypePointer Output 7(fvec4) - 188: 187(ptr) Variable Output - 191: TypePointer Output 6(float) - 192: 191(ptr) Variable Output - 195: 48(ptr) Variable UniformConstant - 196: 48(ptr) Variable UniformConstant - 197: 44(ptr) Variable UniformConstant - 4: 2 Function None 3 - 5: Label - 185: 175(ptr) Variable Function - 186: 8(struct) FunctionCall 10 - Store 185 186 - 189: 41(ptr) AccessChain 185 29 - 190: 7(fvec4) Load 189 - Store 188 190 - 193: 180(ptr) AccessChain 185 16 - 194: 6(float) Load 193 - Store 192 194 - Return - FunctionEnd - 10: 8(struct) Function None 9 - 11: Label - 15: 14(ptr) Variable Function - 42: 41(ptr) Variable Function - 57: 56(ptr) Variable Function - 70: 69(ptr) Variable Function - 80: 41(ptr) Variable Function - 91: 56(ptr) Variable Function - 102: 69(ptr) Variable Function - 114: 41(ptr) Variable Function - 125: 56(ptr) Variable Function - 135: 69(ptr) Variable Function - 148: 41(ptr) Variable Function - 157: 56(ptr) Variable Function - 166: 69(ptr) Variable Function - 176: 175(ptr) Variable Function - 18: 17(ptr) AccessChain 15 16 - Store 18 16 - 20: 17(ptr) AccessChain 15 19 - Store 20 16 - 22: 17(ptr) AccessChain 15 21 - Store 22 16 - 24: 17(ptr) AccessChain 15 23 - Store 24 16 - 26: 17(ptr) AccessChain 15 25 - Store 26 16 - 28: 17(ptr) AccessChain 15 27 - Store 28 16 - 30: 17(ptr) AccessChain 15 29 - Store 30 16 - 32: 17(ptr) AccessChain 15 31 - Store 32 16 - 34: 17(ptr) AccessChain 15 33 - Store 34 16 - 36: 17(ptr) AccessChain 15 35 - Store 36 16 - 38: 17(ptr) AccessChain 15 37 - Store 38 16 - 40: 17(ptr) AccessChain 15 39 - Store 40 16 - 46: 43 Load 45 - 50: 47 Load 49 - 52: 51 SampledImage 46 50 - 54: 7(fvec4) ImageSampleImplicitLod 52 53 - Store 42 54 - 61: 58 Load 60 - 62: 47 Load 49 - 64: 63 SampledImage 61 62 - 66: 55(ivec4) ImageSampleImplicitLod 64 65 - Store 57 66 - 74: 71 Load 73 - 75: 47 Load 49 - 77: 76 SampledImage 74 75 - 79: 68(ivec4) ImageSampleImplicitLod 77 78 - Store 70 79 - 84: 81 Load 83 - 85: 47 Load 49 - 87: 86 SampledImage 84 85 - 90: 7(fvec4) ImageSampleImplicitLod 87 89 - Store 80 90 - 95: 92 Load 94 - 96: 47 Load 49 - 98: 97 SampledImage 95 96 - 101: 55(ivec4) ImageSampleImplicitLod 98 100 - Store 91 101 - 106: 103 Load 105 - 107: 47 Load 49 - 109: 108 SampledImage 106 107 - 113: 68(ivec4) ImageSampleImplicitLod 109 112 - Store 102 113 - 118: 115 Load 117 - 119: 47 Load 49 - 121: 120 SampledImage 118 119 - 124: 7(fvec4) ImageSampleImplicitLod 121 123 - Store 114 124 - 129: 126 Load 128 - 130: 47 Load 49 - 132: 131 SampledImage 129 130 - 134: 55(ivec4) ImageSampleImplicitLod 132 133 - Store 125 134 - 139: 136 Load 138 - 140: 47 Load 49 - 142: 141 SampledImage 139 140 - 147: 68(ivec4) ImageSampleImplicitLod 142 146 - Store 135 147 - 152: 149 Load 151 - 153: 47 Load 49 - 155: 154 SampledImage 152 153 - 156: 7(fvec4) ImageSampleImplicitLod 155 123 - Store 148 156 - 161: 158 Load 160 - 162: 47 Load 49 - 164: 163 SampledImage 161 162 - 165: 55(ivec4) ImageSampleImplicitLod 164 133 - Store 157 165 - 170: 167 Load 169 - 171: 47 Load 49 - 173: 172 SampledImage 170 171 - 174: 68(ivec4) ImageSampleImplicitLod 173 146 - Store 166 174 - 179: 41(ptr) AccessChain 176 29 - Store 179 178 - 181: 180(ptr) AccessChain 176 16 - Store 181 177 - 182: 8(struct) Load 176 - ReturnValue 182 - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out deleted file mode 100644 index 22acbadc8e..0000000000 --- a/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out +++ /dev/null @@ -1,38 +0,0 @@ -remap.hlsl.templatetypes.everything.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 24954 - - Capability Shader - Capability Float64 - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 5663 "main" 4872 4045 - ExecutionMode 5663 OriginUpperLeft - Decorate 4872 Location 0 - Decorate 4045 Location 0 - 8: TypeVoid - 1282: TypeFunction 8 - 13: TypeFloat 32 - 29: TypeVector 13(float) 4 - 666: TypePointer Function 29(fvec4) - 255: TypeFunction 13(float) 666(ptr) - 2572: 13(float) Constant 0 - 667: TypePointer Input 29(fvec4) - 4872: 667(ptr) Variable Input - 650: TypePointer Output 13(float) - 4045: 650(ptr) Variable Output - 5663: 8 Function None 1282 - 24953: Label - 5786: 666(ptr) Variable Function - 24021: 29(fvec4) Load 4872 - Store 5786 24021 - 9338: 13(float) FunctionCall 3917 5786 - Store 4045 9338 - Return - FunctionEnd - 3917: 13(float) Function None 255 - 10636: 666(ptr) FunctionParameter - 10637: Label - ReturnValue 2572 - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out deleted file mode 100644 index 7e653a12ac..0000000000 --- a/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out +++ /dev/null @@ -1,240 +0,0 @@ -remap.hlsl.templatetypes.none.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 160 - - Capability Shader - Capability Float64 - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 153 156 - ExecutionMode 4 OriginUpperLeft - Source HLSL 500 - Name 4 "main" - Name 11 "@main(vf4;" - Name 10 "input" - Name 13 "r00" - Name 19 "r01" - Name 24 "r12" - Name 28 "r13" - Name 31 "r14" - Name 34 "r15" - Name 38 "r16" - Name 42 "r20" - Name 47 "r21" - Name 52 "r22" - Name 56 "r23" - Name 61 "r24" - Name 66 "r30" - Name 70 "r31" - Name 75 "r32" - Name 79 "r33" - Name 84 "r34" - Name 89 "r40" - Name 93 "r41" - Name 96 "r42" - Name 99 "r43" - Name 104 "r44" - Name 109 "r50" - Name 126 "r51" - Name 129 "r61" - Name 134 "r62" - Name 140 "r65" - Name 145 "r66" - Name 151 "input" - Name 153 "input" - Name 156 "@entryPointOutput" - Name 157 "param" - Decorate 153(input) Location 0 - Decorate 156(@entryPointOutput) Location 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypeVector 6(float) 4 - 8: TypePointer Function 7(fvec4) - 9: TypeFunction 6(float) 8(ptr) - 14: 6(float) Constant 1065353216 - 15: 6(float) Constant 1073741824 - 16: 6(float) Constant 1077936128 - 17: 6(float) Constant 1082130432 - 18: 7(fvec4) ConstantComposite 14 15 16 17 - 20: 6(float) Constant 1084227584 - 21: 7(fvec4) ConstantComposite 15 16 17 20 - 22: TypeBool - 23: TypePointer Function 22(bool) - 25: 22(bool) ConstantFalse - 26: TypeInt 32 1 - 27: TypePointer Function 26(int) - 29: 26(int) Constant 1 - 30: TypePointer Function 6(float) - 32: TypeFloat 64 - 33: TypePointer Function 32(float64_t) - 35:32(float64_t) Constant 0 1072693248 - 36: TypeInt 32 0 - 37: TypePointer Function 36(int) - 39: 36(int) Constant 1 - 40: TypeVector 22(bool) 2 - 41: TypePointer Function 40(bvec2) - 43: 22(bool) ConstantTrue - 44: 40(bvec2) ConstantComposite 25 43 - 45: TypeVector 26(int) 2 - 46: TypePointer Function 45(ivec2) - 48: 26(int) Constant 2 - 49: 45(ivec2) ConstantComposite 29 48 - 50: TypeVector 6(float) 2 - 51: TypePointer Function 50(fvec2) - 53: 50(fvec2) ConstantComposite 14 15 - 54: TypeVector 32(float64_t) 2 - 55: TypePointer Function 54(f64vec2) - 57:32(float64_t) Constant 0 1073741824 - 58: 54(f64vec2) ConstantComposite 35 57 - 59: TypeVector 36(int) 2 - 60: TypePointer Function 59(ivec2) - 62: 36(int) Constant 2 - 63: 59(ivec2) ConstantComposite 39 62 - 64: TypeVector 22(bool) 3 - 65: TypePointer Function 64(bvec3) - 67: 64(bvec3) ConstantComposite 25 43 43 - 68: TypeVector 26(int) 3 - 69: TypePointer Function 68(ivec3) - 71: 26(int) Constant 3 - 72: 68(ivec3) ConstantComposite 29 48 71 - 73: TypeVector 6(float) 3 - 74: TypePointer Function 73(fvec3) - 76: 73(fvec3) ConstantComposite 14 15 16 - 77: TypeVector 32(float64_t) 3 - 78: TypePointer Function 77(f64vec3) - 80:32(float64_t) Constant 0 1074266112 - 81: 77(f64vec3) ConstantComposite 35 57 80 - 82: TypeVector 36(int) 3 - 83: TypePointer Function 82(ivec3) - 85: 36(int) Constant 3 - 86: 82(ivec3) ConstantComposite 39 62 85 - 87: TypeVector 22(bool) 4 - 88: TypePointer Function 87(bvec4) - 90: 87(bvec4) ConstantComposite 25 43 43 25 - 91: TypeVector 26(int) 4 - 92: TypePointer Function 91(ivec4) - 94: 26(int) Constant 4 - 95: 91(ivec4) ConstantComposite 29 48 71 94 - 97: TypeVector 32(float64_t) 4 - 98: TypePointer Function 97(f64vec4) - 100:32(float64_t) Constant 0 1074790400 - 101: 97(f64vec4) ConstantComposite 35 57 80 100 - 102: TypeVector 36(int) 4 - 103: TypePointer Function 102(ivec4) - 105: 36(int) Constant 4 - 106: 102(ivec4) ConstantComposite 39 62 85 105 - 107: TypeMatrix 7(fvec4) 4 - 108: TypePointer Function 107 - 110: 6(float) Constant 0 - 111: 7(fvec4) ConstantComposite 110 14 15 16 - 112: 6(float) Constant 1086324736 - 113: 6(float) Constant 1088421888 - 114: 7(fvec4) ConstantComposite 17 20 112 113 - 115: 6(float) Constant 1090519040 - 116: 6(float) Constant 1091567616 - 117: 6(float) Constant 1092616192 - 118: 6(float) Constant 1093664768 - 119: 7(fvec4) ConstantComposite 115 116 117 118 - 120: 6(float) Constant 1094713344 - 121: 6(float) Constant 1095761920 - 122: 6(float) Constant 1096810496 - 123: 6(float) Constant 1097859072 - 124: 7(fvec4) ConstantComposite 120 121 122 123 - 125: 107 ConstantComposite 111 114 119 124 - 127: TypeMatrix 73(fvec3) 2 - 128: TypePointer Function 127 - 130: 73(fvec3) ConstantComposite 17 20 112 - 131: 127 ConstantComposite 76 130 - 132: TypeMatrix 50(fvec2) 3 - 133: TypePointer Function 132 - 135: 50(fvec2) ConstantComposite 16 17 - 136: 50(fvec2) ConstantComposite 20 112 - 137: 132 ConstantComposite 53 135 136 - 138: TypeMatrix 50(fvec2) 4 - 139: TypePointer Function 138 - 141: 50(fvec2) ConstantComposite 113 115 - 142: 138 ConstantComposite 53 135 136 141 - 143: TypeMatrix 73(fvec3) 4 - 144: TypePointer Function 143 - 146: 73(fvec3) ConstantComposite 113 115 116 - 147: 73(fvec3) ConstantComposite 117 118 120 - 148: 143 ConstantComposite 76 130 146 147 - 152: TypePointer Input 7(fvec4) - 153(input): 152(ptr) Variable Input - 155: TypePointer Output 6(float) -156(@entryPointOutput): 155(ptr) Variable Output - 4(main): 2 Function None 3 - 5: Label - 151(input): 8(ptr) Variable Function - 157(param): 8(ptr) Variable Function - 154: 7(fvec4) Load 153(input) - Store 151(input) 154 - 158: 7(fvec4) Load 151(input) - Store 157(param) 158 - 159: 6(float) FunctionCall 11(@main(vf4;) 157(param) - Store 156(@entryPointOutput) 159 - Return - FunctionEnd - 11(@main(vf4;): 6(float) Function None 9 - 10(input): 8(ptr) FunctionParameter - 12: Label - 13(r00): 8(ptr) Variable Function - 19(r01): 8(ptr) Variable Function - 24(r12): 23(ptr) Variable Function - 28(r13): 27(ptr) Variable Function - 31(r14): 30(ptr) Variable Function - 34(r15): 33(ptr) Variable Function - 38(r16): 37(ptr) Variable Function - 42(r20): 41(ptr) Variable Function - 47(r21): 46(ptr) Variable Function - 52(r22): 51(ptr) Variable Function - 56(r23): 55(ptr) Variable Function - 61(r24): 60(ptr) Variable Function - 66(r30): 65(ptr) Variable Function - 70(r31): 69(ptr) Variable Function - 75(r32): 74(ptr) Variable Function - 79(r33): 78(ptr) Variable Function - 84(r34): 83(ptr) Variable Function - 89(r40): 88(ptr) Variable Function - 93(r41): 92(ptr) Variable Function - 96(r42): 8(ptr) Variable Function - 99(r43): 98(ptr) Variable Function - 104(r44): 103(ptr) Variable Function - 109(r50): 108(ptr) Variable Function - 126(r51): 108(ptr) Variable Function - 129(r61): 128(ptr) Variable Function - 134(r62): 133(ptr) Variable Function - 140(r65): 139(ptr) Variable Function - 145(r66): 144(ptr) Variable Function - Store 13(r00) 18 - Store 19(r01) 21 - Store 24(r12) 25 - Store 28(r13) 29 - Store 31(r14) 14 - Store 34(r15) 35 - Store 38(r16) 39 - Store 42(r20) 44 - Store 47(r21) 49 - Store 52(r22) 53 - Store 56(r23) 58 - Store 61(r24) 63 - Store 66(r30) 67 - Store 70(r31) 72 - Store 75(r32) 76 - Store 79(r33) 81 - Store 84(r34) 86 - Store 89(r40) 90 - Store 93(r41) 95 - Store 96(r42) 18 - Store 99(r43) 101 - Store 104(r44) 106 - Store 109(r50) 125 - Store 126(r51) 125 - Store 129(r61) 131 - Store 134(r62) 137 - Store 140(r65) 142 - Store 145(r66) 148 - ReturnValue 110 - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.if.everything.frag.out b/third_party/glslang/Test/baseResults/remap.if.everything.frag.out deleted file mode 100644 index e7e73696d8..0000000000 --- a/third_party/glslang/Test/baseResults/remap.if.everything.frag.out +++ /dev/null @@ -1,43 +0,0 @@ -remap.if.everything.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 22855 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 5663 "main" 3773 4539 - ExecutionMode 5663 OriginUpperLeft - Decorate 3773 Location 0 - Decorate 4539 Location 0 - 8: TypeVoid - 1282: TypeFunction 8 - 13: TypeFloat 32 - 650: TypePointer Input 13(float) - 3773: 650(ptr) Variable Input - 24: 13(float) Constant 1073741824 - 9: TypeBool - 29: TypeVector 13(float) 4 - 666: TypePointer Output 29(fvec4) - 4539: 666(ptr) Variable Output - 947: 13(float) Constant 3204448256 - 5663: 8 Function None 1282 - 7911: Label - 21734: 13(float) Load 3773 - 13508: 9(bool) FOrdGreaterThan 21734 24 - SelectionMerge 19578 None - BranchConditional 13508 13182 10142 - 13182: Label - 9496: 13(float) Load 3773 - 17615: 29(fvec4) CompositeConstruct 9496 9496 9496 9496 - Store 4539 17615 - Branch 19578 - 10142: Label - 22854: 13(float) Load 3773 - 9982: 13(float) FAdd 22854 947 - 12421: 29(fvec4) CompositeConstruct 9982 9982 9982 9982 - Store 4539 12421 - Branch 19578 - 19578: Label - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.if.none.frag.out b/third_party/glslang/Test/baseResults/remap.if.none.frag.out deleted file mode 100644 index d239492c8b..0000000000 --- a/third_party/glslang/Test/baseResults/remap.if.none.frag.out +++ /dev/null @@ -1,47 +0,0 @@ -remap.if.none.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 25 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 8 17 - ExecutionMode 4 OriginUpperLeft - Source GLSL 450 - Name 4 "main" - Name 8 "inf" - Name 17 "outf4" - Decorate 8(inf) Location 0 - Decorate 17(outf4) Location 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypePointer Input 6(float) - 8(inf): 7(ptr) Variable Input - 10: 6(float) Constant 1073741824 - 11: TypeBool - 15: TypeVector 6(float) 4 - 16: TypePointer Output 15(fvec4) - 17(outf4): 16(ptr) Variable Output - 22: 6(float) Constant 3204448256 - 4(main): 2 Function None 3 - 5: Label - 9: 6(float) Load 8(inf) - 12: 11(bool) FOrdGreaterThan 9 10 - SelectionMerge 14 None - BranchConditional 12 13 20 - 13: Label - 18: 6(float) Load 8(inf) - 19: 15(fvec4) CompositeConstruct 18 18 18 18 - Store 17(outf4) 19 - Branch 14 - 20: Label - 21: 6(float) Load 8(inf) - 23: 6(float) FAdd 21 22 - 24: 15(fvec4) CompositeConstruct 23 23 23 23 - Store 17(outf4) 24 - Branch 14 - 14: Label - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.invalid-spirv-1.out b/third_party/glslang/Test/baseResults/remap.invalid-spirv-1.out deleted file mode 100644 index 91b4b6d90c..0000000000 --- a/third_party/glslang/Test/baseResults/remap.invalid-spirv-1.out +++ /dev/null @@ -1 +0,0 @@ -ID out of range: 4160749568 diff --git a/third_party/glslang/Test/baseResults/remap.invalid-spirv-2.out b/third_party/glslang/Test/baseResults/remap.invalid-spirv-2.out deleted file mode 100644 index 808b9b870b..0000000000 --- a/third_party/glslang/Test/baseResults/remap.invalid-spirv-2.out +++ /dev/null @@ -1 +0,0 @@ -ID not found diff --git a/third_party/glslang/Test/baseResults/remap.literal64.everything.spv.out b/third_party/glslang/Test/baseResults/remap.literal64.everything.spv.out deleted file mode 100644 index 7a4f37ba1e..0000000000 --- a/third_party/glslang/Test/baseResults/remap.literal64.everything.spv.out +++ /dev/null @@ -1,7 +0,0 @@ -remap.literal64.everything.spv -// Module Version 10100 -// Generated by (magic number): 70000 -// Id's are bound by 0 - - Capability Shader - MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/remap.literal64.none.spv.out b/third_party/glslang/Test/baseResults/remap.literal64.none.spv.out deleted file mode 100644 index d88992fc11..0000000000 --- a/third_party/glslang/Test/baseResults/remap.literal64.none.spv.out +++ /dev/null @@ -1,25 +0,0 @@ -remap.literal64.none.spv -// Module Version 10100 -// Generated by (magic number): 70000 -// Id's are bound by 10 - - Capability Shader - MemoryModel Logical GLSL450 - 1: TypeVoid - 2: TypeInt 64 1 - 3: TypeFunction 1 - 4: 2(int64_t) Constant 0 0 - 5: 1 Function None 3 - 6: Label - SelectionMerge 7 None - Switch 4 7 - case 0: 0 - case 8: 1 - case 0: 9 - 8: Label - Branch 7 - 9: Label - Branch 7 - 7: Label - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.similar_1a.everything.frag.out b/third_party/glslang/Test/baseResults/remap.similar_1a.everything.frag.out deleted file mode 100644 index 6de9cb9213..0000000000 --- a/third_party/glslang/Test/baseResults/remap.similar_1a.everything.frag.out +++ /dev/null @@ -1,117 +0,0 @@ -remap.similar_1a.everything.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 24916 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 5663 "main" 4201 4539 3773 - ExecutionMode 5663 OriginUpperLeft - Decorate 4201 Flat - Decorate 4201 Location 1 - Decorate 4539 Location 0 - Decorate 3773 Location 0 - 8: TypeVoid - 1282: TypeFunction 8 - 12: TypeInt 32 1 - 649: TypePointer Function 12(int) - 13: TypeFloat 32 - 204: TypeFunction 13(float) 649(ptr) - 650: TypePointer Function 13(float) - 2572: 13(float) Constant 0 - 2571: 12(int) Constant 0 - 9: TypeBool - 252: 13(float) Constant 1056964608 - 2574: 12(int) Constant 1 - 2577: 12(int) Constant 2 - 26: TypeVector 12(int) 4 - 663: TypePointer Input 26(ivec4) - 4201: 663(ptr) Variable Input - 11: TypeInt 32 0 - 2573: 11(int) Constant 1 - 651: TypePointer Input 12(int) - 2576: 11(int) Constant 2 - 2570: 11(int) Constant 0 - 29: TypeVector 13(float) 4 - 666: TypePointer Output 29(fvec4) - 4539: 666(ptr) Variable Output - 652: TypePointer Input 13(float) - 3773: 652(ptr) Variable Input - 5663: 8 Function None 1282 - 24915: Label - 18415: 649(ptr) Variable Function - 5786: 649(ptr) Variable Function - 8366: 13(float) Load 3773 - 8654: 12(int) ConvertFToS 8366 - Store 18415 8654 - 17256: 13(float) FunctionCall 3782 18415 - 14512: 13(float) Load 3773 - 7041: 12(int) ConvertFToS 14512 - Store 5786 7041 - 23993: 13(float) FunctionCall 3836 5786 - 9180: 13(float) FAdd 17256 23993 - 15728: 29(fvec4) CompositeConstruct 9180 9180 9180 9180 - Store 4539 15728 - Return - FunctionEnd - 3782: 13(float) Function None 204 - 6931: 649(ptr) FunctionParameter - 12220: Label - 4292: 650(ptr) Variable Function - 4298: 649(ptr) Variable Function - Store 4292 2572 - Store 4298 2571 - Branch 14924 - 14924: Label - LoopMerge 8882 6488 None - Branch 11857 - 11857: Label - 13755: 12(int) Load 4298 - 22731: 12(int) Load 6931 - 20007: 9(bool) SLessThan 13755 22731 - BranchConditional 20007 24750 8882 - 24750: Label - 22912: 13(float) Load 4292 - 19471: 13(float) FAdd 22912 252 - Store 4292 19471 - Branch 6488 - 6488: Label - 19050: 12(int) Load 4298 - 8593: 12(int) IAdd 19050 2574 - Store 4298 8593 - Branch 14924 - 8882: Label - 11601: 13(float) Load 4292 - ReturnValue 11601 - FunctionEnd - 3836: 13(float) Function None 204 - 4408: 649(ptr) FunctionParameter - 12143: Label - 22102: 649(ptr) Variable Function - 24151: 12(int) Load 4408 - 13868: 9(bool) SGreaterThan 24151 2577 - SelectionMerge 14966 None - BranchConditional 13868 9492 17416 - 9492: Label - 15624: 12(int) Load 4408 - Store 22102 15624 - 17278: 13(float) FunctionCall 3782 22102 - ReturnValue 17278 - 17416: Label - 19506: 12(int) Load 4408 - 22773: 12(int) IMul 19506 2577 - 13472: 651(ptr) AccessChain 4201 2573 - 15280: 12(int) Load 13472 - 18079: 651(ptr) AccessChain 4201 2576 - 15199: 12(int) Load 18079 - 9343: 12(int) IMul 15280 15199 - 11462: 12(int) IAdd 22773 9343 - 11885: 651(ptr) AccessChain 4201 2570 - 21176: 12(int) Load 11885 - 10505: 12(int) IAdd 11462 21176 - 14626: 13(float) ConvertSToF 10505 - ReturnValue 14626 - 14966: Label - Unreachable - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.similar_1a.none.frag.out b/third_party/glslang/Test/baseResults/remap.similar_1a.none.frag.out deleted file mode 100644 index 682344815a..0000000000 --- a/third_party/glslang/Test/baseResults/remap.similar_1a.none.frag.out +++ /dev/null @@ -1,131 +0,0 @@ -remap.similar_1a.none.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 86 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 53 73 75 - ExecutionMode 4 OriginUpperLeft - Source GLSL 450 - Name 4 "main" - Name 11 "Test1(i1;" - Name 10 "bound" - Name 14 "Test2(i1;" - Name 13 "bound" - Name 17 "r" - Name 19 "x" - Name 44 "param" - Name 53 "ini4" - Name 73 "outf4" - Name 75 "inf" - Name 78 "param" - Name 82 "param" - Decorate 53(ini4) Flat - Decorate 53(ini4) Location 1 - Decorate 73(outf4) Location 0 - Decorate 75(inf) Location 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeInt 32 1 - 7: TypePointer Function 6(int) - 8: TypeFloat 32 - 9: TypeFunction 8(float) 7(ptr) - 16: TypePointer Function 8(float) - 18: 8(float) Constant 0 - 20: 6(int) Constant 0 - 28: TypeBool - 30: 8(float) Constant 1056964608 - 34: 6(int) Constant 1 - 40: 6(int) Constant 2 - 51: TypeVector 6(int) 4 - 52: TypePointer Input 51(ivec4) - 53(ini4): 52(ptr) Variable Input - 54: TypeInt 32 0 - 55: 54(int) Constant 1 - 56: TypePointer Input 6(int) - 59: 54(int) Constant 2 - 64: 54(int) Constant 0 - 71: TypeVector 8(float) 4 - 72: TypePointer Output 71(fvec4) - 73(outf4): 72(ptr) Variable Output - 74: TypePointer Input 8(float) - 75(inf): 74(ptr) Variable Input - 4(main): 2 Function None 3 - 5: Label - 78(param): 7(ptr) Variable Function - 82(param): 7(ptr) Variable Function - 76: 8(float) Load 75(inf) - 77: 6(int) ConvertFToS 76 - Store 78(param) 77 - 79: 8(float) FunctionCall 11(Test1(i1;) 78(param) - 80: 8(float) Load 75(inf) - 81: 6(int) ConvertFToS 80 - Store 82(param) 81 - 83: 8(float) FunctionCall 14(Test2(i1;) 82(param) - 84: 8(float) FAdd 79 83 - 85: 71(fvec4) CompositeConstruct 84 84 84 84 - Store 73(outf4) 85 - Return - FunctionEnd - 11(Test1(i1;): 8(float) Function None 9 - 10(bound): 7(ptr) FunctionParameter - 12: Label - 17(r): 16(ptr) Variable Function - 19(x): 7(ptr) Variable Function - Store 17(r) 18 - Store 19(x) 20 - Branch 21 - 21: Label - LoopMerge 23 24 None - Branch 25 - 25: Label - 26: 6(int) Load 19(x) - 27: 6(int) Load 10(bound) - 29: 28(bool) SLessThan 26 27 - BranchConditional 29 22 23 - 22: Label - 31: 8(float) Load 17(r) - 32: 8(float) FAdd 31 30 - Store 17(r) 32 - Branch 24 - 24: Label - 33: 6(int) Load 19(x) - 35: 6(int) IAdd 33 34 - Store 19(x) 35 - Branch 21 - 23: Label - 36: 8(float) Load 17(r) - ReturnValue 36 - FunctionEnd - 14(Test2(i1;): 8(float) Function None 9 - 13(bound): 7(ptr) FunctionParameter - 15: Label - 44(param): 7(ptr) Variable Function - 39: 6(int) Load 13(bound) - 41: 28(bool) SGreaterThan 39 40 - SelectionMerge 43 None - BranchConditional 41 42 48 - 42: Label - 45: 6(int) Load 13(bound) - Store 44(param) 45 - 46: 8(float) FunctionCall 11(Test1(i1;) 44(param) - ReturnValue 46 - 48: Label - 49: 6(int) Load 13(bound) - 50: 6(int) IMul 49 40 - 57: 56(ptr) AccessChain 53(ini4) 55 - 58: 6(int) Load 57 - 60: 56(ptr) AccessChain 53(ini4) 59 - 61: 6(int) Load 60 - 62: 6(int) IMul 58 61 - 63: 6(int) IAdd 50 62 - 65: 56(ptr) AccessChain 53(ini4) 64 - 66: 6(int) Load 65 - 67: 6(int) IAdd 63 66 - 68: 8(float) ConvertSToF 67 - ReturnValue 68 - 43: Label - Unreachable - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.similar_1b.everything.frag.out b/third_party/glslang/Test/baseResults/remap.similar_1b.everything.frag.out deleted file mode 100644 index 86e5ac75ea..0000000000 --- a/third_party/glslang/Test/baseResults/remap.similar_1b.everything.frag.out +++ /dev/null @@ -1,123 +0,0 @@ -remap.similar_1b.everything.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 24916 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 5663 "main" 4201 4539 3773 - ExecutionMode 5663 OriginUpperLeft - Decorate 4201 Flat - Decorate 4201 Location 0 - Decorate 4539 Location 0 - Decorate 3773 Location 1 - 8: TypeVoid - 1282: TypeFunction 8 - 12: TypeInt 32 1 - 649: TypePointer Function 12(int) - 13: TypeFloat 32 - 204: TypeFunction 13(float) 649(ptr) - 650: TypePointer Function 13(float) - 2572: 13(float) Constant 0 - 2571: 12(int) Constant 0 - 9: TypeBool - 252: 13(float) Constant 1056964608 - 2574: 12(int) Constant 1 - 2821: 13(float) Constant 1045220557 - 2577: 12(int) Constant 2 - 2583: 12(int) Constant 4 - 26: TypeVector 12(int) 4 - 663: TypePointer Input 26(ivec4) - 4201: 663(ptr) Variable Input - 11: TypeInt 32 0 - 2573: 11(int) Constant 1 - 651: TypePointer Input 12(int) - 2576: 11(int) Constant 2 - 2570: 11(int) Constant 0 - 29: TypeVector 13(float) 4 - 666: TypePointer Output 29(fvec4) - 4539: 666(ptr) Variable Output - 652: TypePointer Input 13(float) - 3773: 652(ptr) Variable Input - 5663: 8 Function None 1282 - 24915: Label - 18415: 649(ptr) Variable Function - 5786: 649(ptr) Variable Function - 8366: 13(float) Load 3773 - 8654: 12(int) ConvertFToS 8366 - Store 18415 8654 - 17256: 13(float) FunctionCall 3782 18415 - 14512: 13(float) Load 3773 - 7041: 12(int) ConvertFToS 14512 - Store 5786 7041 - 23993: 13(float) FunctionCall 3836 5786 - 9180: 13(float) FAdd 17256 23993 - 15728: 29(fvec4) CompositeConstruct 9180 9180 9180 9180 - Store 4539 15728 - Return - FunctionEnd - 3782: 13(float) Function None 204 - 6931: 649(ptr) FunctionParameter - 12220: Label - 4292: 650(ptr) Variable Function - 4298: 649(ptr) Variable Function - Store 4292 2572 - Store 4298 2571 - Branch 14924 - 14924: Label - LoopMerge 6507 6488 None - Branch 11857 - 11857: Label - 13755: 12(int) Load 4298 - 22731: 12(int) Load 6931 - 20007: 9(bool) SLessThan 13755 22731 - BranchConditional 20007 24750 6507 - 24750: Label - 22912: 13(float) Load 4292 - 19471: 13(float) FAdd 22912 252 - Store 4292 19471 - Branch 6488 - 6488: Label - 19050: 12(int) Load 4298 - 8593: 12(int) IAdd 19050 2574 - Store 4298 8593 - Branch 14924 - 6507: Label - 18877: 13(float) Load 4292 - 15899: 13(float) FAdd 18877 2821 - Store 4292 15899 - 20342: 13(float) Load 4292 - ReturnValue 20342 - FunctionEnd - 3836: 13(float) Function None 204 - 4408: 649(ptr) FunctionParameter - 12143: Label - 22102: 649(ptr) Variable Function - 24151: 12(int) Load 4408 - 13868: 9(bool) SGreaterThan 24151 2577 - SelectionMerge 14966 None - BranchConditional 13868 10822 17416 - 10822: Label - 22680: 12(int) Load 4408 - 23216: 12(int) IMul 22680 2577 - Store 22102 23216 - 7042: 13(float) FunctionCall 3782 22102 - ReturnValue 7042 - 17416: Label - 19506: 12(int) Load 4408 - 22773: 12(int) IMul 19506 2583 - 13472: 651(ptr) AccessChain 4201 2573 - 15280: 12(int) Load 13472 - 18079: 651(ptr) AccessChain 4201 2576 - 15199: 12(int) Load 18079 - 9343: 12(int) IMul 15280 15199 - 11462: 12(int) IAdd 22773 9343 - 11885: 651(ptr) AccessChain 4201 2570 - 21176: 12(int) Load 11885 - 10505: 12(int) IAdd 11462 21176 - 14626: 13(float) ConvertSToF 10505 - ReturnValue 14626 - 14966: Label - Unreachable - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.similar_1b.none.frag.out b/third_party/glslang/Test/baseResults/remap.similar_1b.none.frag.out deleted file mode 100644 index 2433820414..0000000000 --- a/third_party/glslang/Test/baseResults/remap.similar_1b.none.frag.out +++ /dev/null @@ -1,137 +0,0 @@ -remap.similar_1b.none.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 91 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 58 78 80 - ExecutionMode 4 OriginUpperLeft - Source GLSL 450 - Name 4 "main" - Name 11 "Test1(i1;" - Name 10 "bound" - Name 14 "Test2(i1;" - Name 13 "bound" - Name 17 "r" - Name 19 "x" - Name 49 "param" - Name 58 "ini4" - Name 78 "outf4" - Name 80 "inf" - Name 83 "param" - Name 87 "param" - Decorate 58(ini4) Flat - Decorate 58(ini4) Location 0 - Decorate 78(outf4) Location 0 - Decorate 80(inf) Location 1 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeInt 32 1 - 7: TypePointer Function 6(int) - 8: TypeFloat 32 - 9: TypeFunction 8(float) 7(ptr) - 16: TypePointer Function 8(float) - 18: 8(float) Constant 0 - 20: 6(int) Constant 0 - 28: TypeBool - 30: 8(float) Constant 1056964608 - 34: 6(int) Constant 1 - 36: 8(float) Constant 1045220557 - 43: 6(int) Constant 2 - 54: 6(int) Constant 4 - 56: TypeVector 6(int) 4 - 57: TypePointer Input 56(ivec4) - 58(ini4): 57(ptr) Variable Input - 59: TypeInt 32 0 - 60: 59(int) Constant 1 - 61: TypePointer Input 6(int) - 64: 59(int) Constant 2 - 69: 59(int) Constant 0 - 76: TypeVector 8(float) 4 - 77: TypePointer Output 76(fvec4) - 78(outf4): 77(ptr) Variable Output - 79: TypePointer Input 8(float) - 80(inf): 79(ptr) Variable Input - 4(main): 2 Function None 3 - 5: Label - 83(param): 7(ptr) Variable Function - 87(param): 7(ptr) Variable Function - 81: 8(float) Load 80(inf) - 82: 6(int) ConvertFToS 81 - Store 83(param) 82 - 84: 8(float) FunctionCall 11(Test1(i1;) 83(param) - 85: 8(float) Load 80(inf) - 86: 6(int) ConvertFToS 85 - Store 87(param) 86 - 88: 8(float) FunctionCall 14(Test2(i1;) 87(param) - 89: 8(float) FAdd 84 88 - 90: 76(fvec4) CompositeConstruct 89 89 89 89 - Store 78(outf4) 90 - Return - FunctionEnd - 11(Test1(i1;): 8(float) Function None 9 - 10(bound): 7(ptr) FunctionParameter - 12: Label - 17(r): 16(ptr) Variable Function - 19(x): 7(ptr) Variable Function - Store 17(r) 18 - Store 19(x) 20 - Branch 21 - 21: Label - LoopMerge 23 24 None - Branch 25 - 25: Label - 26: 6(int) Load 19(x) - 27: 6(int) Load 10(bound) - 29: 28(bool) SLessThan 26 27 - BranchConditional 29 22 23 - 22: Label - 31: 8(float) Load 17(r) - 32: 8(float) FAdd 31 30 - Store 17(r) 32 - Branch 24 - 24: Label - 33: 6(int) Load 19(x) - 35: 6(int) IAdd 33 34 - Store 19(x) 35 - Branch 21 - 23: Label - 37: 8(float) Load 17(r) - 38: 8(float) FAdd 37 36 - Store 17(r) 38 - 39: 8(float) Load 17(r) - ReturnValue 39 - FunctionEnd - 14(Test2(i1;): 8(float) Function None 9 - 13(bound): 7(ptr) FunctionParameter - 15: Label - 49(param): 7(ptr) Variable Function - 42: 6(int) Load 13(bound) - 44: 28(bool) SGreaterThan 42 43 - SelectionMerge 46 None - BranchConditional 44 45 52 - 45: Label - 47: 6(int) Load 13(bound) - 48: 6(int) IMul 47 43 - Store 49(param) 48 - 50: 8(float) FunctionCall 11(Test1(i1;) 49(param) - ReturnValue 50 - 52: Label - 53: 6(int) Load 13(bound) - 55: 6(int) IMul 53 54 - 62: 61(ptr) AccessChain 58(ini4) 60 - 63: 6(int) Load 62 - 65: 61(ptr) AccessChain 58(ini4) 64 - 66: 6(int) Load 65 - 67: 6(int) IMul 63 66 - 68: 6(int) IAdd 55 67 - 70: 61(ptr) AccessChain 58(ini4) 69 - 71: 6(int) Load 70 - 72: 6(int) IAdd 68 71 - 73: 8(float) ConvertSToF 72 - ReturnValue 73 - 46: Label - Unreachable - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.specconst.comp.out b/third_party/glslang/Test/baseResults/remap.specconst.comp.out deleted file mode 100644 index 905d85b3a9..0000000000 --- a/third_party/glslang/Test/baseResults/remap.specconst.comp.out +++ /dev/null @@ -1,31 +0,0 @@ -remap.specconst.comp -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 16104 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint GLCompute 5663 "main" - ExecutionMode 5663 LocalSize 1 1 1 - Decorate 2 SpecId 0 - Decorate 3 SpecId 1 - Decorate 4 SpecId 2 - Decorate 5 BuiltIn WorkgroupSize - 8: TypeVoid - 1282: TypeFunction 8 - 11: TypeInt 32 0 - 2: 11(int) SpecConstant 1 - 3: 11(int) SpecConstant 1 - 4: 11(int) SpecConstant 1 - 20: TypeVector 11(int) 3 - 5: 20(ivec3) SpecConstantComposite 2 3 4 - 6: 11(int) SpecConstantOp 81 5 0 - 7: 11(int) SpecConstantOp 81 5 1(GLSL.std.450) - 9: 11(int) SpecConstantOp 81 5 2 - 10: 11(int) SpecConstantOp 132 7 9 - 12: 11(int) SpecConstantOp 128 6 10 - 5663: 8 Function None 1282 - 16103: Label - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.switch.everything.frag.out b/third_party/glslang/Test/baseResults/remap.switch.everything.frag.out deleted file mode 100644 index d257093679..0000000000 --- a/third_party/glslang/Test/baseResults/remap.switch.everything.frag.out +++ /dev/null @@ -1,76 +0,0 @@ -remap.switch.everything.frag -WARNING: 0:5: '' : all default precisions are highp; use precision statements to quiet warning, e.g.: - "precision mediump int; precision highp float;" - -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 23990 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 5663 "main" 3719 3994 - ExecutionMode 5663 OriginUpperLeft - Decorate 3719 Location 0 - Decorate 3994 RelaxedPrecision - Decorate 3994 Location 0 - Decorate 12421 RelaxedPrecision - Decorate 12422 RelaxedPrecision - Decorate 12423 RelaxedPrecision - 8: TypeVoid - 1282: TypeFunction 8 - 13: TypeFloat 32 - 29: TypeVector 13(float) 4 - 666: TypePointer Input 29(fvec4) - 3719: 666(ptr) Variable Input - 11: TypeInt 32 0 - 2579: 11(int) Constant 3 - 650: TypePointer Input 13(float) - 12: TypeInt 32 1 - 667: TypePointer Output 29(fvec4) - 3994: 667(ptr) Variable Output - 2570: 11(int) Constant 0 - 2572: 13(float) Constant 0 - 2573: 11(int) Constant 1 - 138: 13(float) Constant 1065353216 - 2576: 11(int) Constant 2 - 24: 13(float) Constant 1073741824 - 833: 13(float) Constant 3212836864 - 1284: 29(fvec4) ConstantComposite 833 833 833 833 - 5663: 8 Function None 1282 - 23915: Label - 7984: 650(ptr) AccessChain 3719 2579 - 11376: 13(float) Load 7984 - 16859: 12(int) ConvertFToS 11376 - SelectionMerge 19578 None - Switch 16859 15971 - case 0: 8158 - case 1: 8159 - case 2: 8160 - 15971: Label - Store 3994 1284 - Branch 19578 - 8158: Label - 21848: 650(ptr) AccessChain 3719 2570 - 23987: 13(float) Load 21848 - 19989: 13(float) FAdd 23987 2572 - 12421: 29(fvec4) CompositeConstruct 19989 19989 19989 19989 - Store 3994 12421 - Branch 19578 - 8159: Label - 21849: 650(ptr) AccessChain 3719 2573 - 23988: 13(float) Load 21849 - 19990: 13(float) FAdd 23988 138 - 12422: 29(fvec4) CompositeConstruct 19990 19990 19990 19990 - Store 3994 12422 - Branch 19578 - 8160: Label - 21850: 650(ptr) AccessChain 3719 2576 - 23989: 13(float) Load 21850 - 19991: 13(float) FAdd 23989 24 - 12423: 29(fvec4) CompositeConstruct 19991 19991 19991 19991 - Store 3994 12423 - Branch 19578 - 19578: Label - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.switch.none.frag.out b/third_party/glslang/Test/baseResults/remap.switch.none.frag.out deleted file mode 100644 index 53d2739594..0000000000 --- a/third_party/glslang/Test/baseResults/remap.switch.none.frag.out +++ /dev/null @@ -1,80 +0,0 @@ -remap.switch.none.frag -WARNING: 0:5: '' : all default precisions are highp; use precision statements to quiet warning, e.g.: - "precision mediump int; precision highp float;" - -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 48 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 9 23 - ExecutionMode 4 OriginUpperLeft - Source GLSL 450 - Name 4 "main" - Name 9 "in0" - Name 23 "FragColor" - Decorate 9(in0) Location 0 - Decorate 23(FragColor) RelaxedPrecision - Decorate 23(FragColor) Location 0 - Decorate 29 RelaxedPrecision - Decorate 36 RelaxedPrecision - Decorate 43 RelaxedPrecision - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypeVector 6(float) 4 - 8: TypePointer Input 7(fvec4) - 9(in0): 8(ptr) Variable Input - 10: TypeInt 32 0 - 11: 10(int) Constant 3 - 12: TypePointer Input 6(float) - 15: TypeInt 32 1 - 22: TypePointer Output 7(fvec4) - 23(FragColor): 22(ptr) Variable Output - 24: 10(int) Constant 0 - 27: 6(float) Constant 0 - 31: 10(int) Constant 1 - 34: 6(float) Constant 1065353216 - 38: 10(int) Constant 2 - 41: 6(float) Constant 1073741824 - 45: 6(float) Constant 3212836864 - 46: 7(fvec4) ConstantComposite 45 45 45 45 - 4(main): 2 Function None 3 - 5: Label - 13: 12(ptr) AccessChain 9(in0) 11 - 14: 6(float) Load 13 - 16: 15(int) ConvertFToS 14 - SelectionMerge 21 None - Switch 16 20 - case 0: 17 - case 1: 18 - case 2: 19 - 20: Label - Store 23(FragColor) 46 - Branch 21 - 17: Label - 25: 12(ptr) AccessChain 9(in0) 24 - 26: 6(float) Load 25 - 28: 6(float) FAdd 26 27 - 29: 7(fvec4) CompositeConstruct 28 28 28 28 - Store 23(FragColor) 29 - Branch 21 - 18: Label - 32: 12(ptr) AccessChain 9(in0) 31 - 33: 6(float) Load 32 - 35: 6(float) FAdd 33 34 - 36: 7(fvec4) CompositeConstruct 35 35 35 35 - Store 23(FragColor) 36 - Branch 21 - 19: Label - 39: 12(ptr) AccessChain 9(in0) 38 - 40: 6(float) Load 39 - 42: 6(float) FAdd 40 41 - 43: 7(fvec4) CompositeConstruct 42 42 42 42 - Store 23(FragColor) 43 - Branch 21 - 21: Label - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.uniformarray.everything.frag.out b/third_party/glslang/Test/baseResults/remap.uniformarray.everything.frag.out deleted file mode 100644 index 902b597af4..0000000000 --- a/third_party/glslang/Test/baseResults/remap.uniformarray.everything.frag.out +++ /dev/null @@ -1,76 +0,0 @@ -remap.uniformarray.everything.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 25030 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 5663 "main" 3608 4957 4339 5139 - ExecutionMode 5663 OriginUpperLeft - Decorate 3608 Location 1 - Decorate 4957 Location 0 - Decorate 4339 Location 7 - Decorate 5139 Location 0 - 8: TypeVoid - 1282: TypeFunction 8 - 13: TypeFloat 32 - 29: TypeVector 13(float) 4 - 666: TypePointer Function 29(fvec4) - 11: TypeInt 32 0 - 2588: 11(int) Constant 6 - 740: TypeArray 29(fvec4) 2588 - 1377: TypePointer Input 740 - 3608: 1377(ptr) Variable Input - 12: TypeInt 32 1 - 2574: 12(int) Constant 1 - 667: TypePointer Input 29(fvec4) - 24: TypeVector 13(float) 3 - 661: TypePointer Input 24(fvec3) - 4957: 661(ptr) Variable Input - 2570: 11(int) Constant 0 - 650: TypePointer Function 13(float) - 2573: 11(int) Constant 1 - 2576: 11(int) Constant 2 - 2618: 11(int) Constant 16 - 709: TypeArray 13(float) 2618 - 1346: TypePointer Input 709 - 4339: 1346(ptr) Variable Input - 2607: 12(int) Constant 12 - 651: TypePointer Input 13(float) - 2579: 11(int) Constant 3 - 668: TypePointer Output 29(fvec4) - 5139: 668(ptr) Variable Output - 5663: 8 Function None 1282 - 25029: Label - 4902: 666(ptr) Variable Function - 10645: 667(ptr) AccessChain 3608 2574 - 8181: 29(fvec4) Load 10645 - 21370: 667(ptr) AccessChain 3608 2574 - 11355: 29(fvec4) Load 21370 - 23084: 29(fvec4) FAdd 8181 11355 - Store 4902 23084 - 21218: 24(fvec3) Load 4957 - 13695: 29(fvec4) Load 4902 - 23959: 24(fvec3) VectorShuffle 13695 13695 0 1 2 - 14937: 24(fvec3) FAdd 23959 21218 - 15653: 650(ptr) AccessChain 4902 2570 - 21354: 13(float) CompositeExtract 14937 0 - Store 15653 21354 - 16378: 650(ptr) AccessChain 4902 2573 - 15746: 13(float) CompositeExtract 14937 1 - Store 16378 15746 - 16379: 650(ptr) AccessChain 4902 2576 - 15747: 13(float) CompositeExtract 14937 2 - Store 16379 15747 - 19895: 651(ptr) AccessChain 4339 2607 - 7372: 13(float) Load 19895 - 21371: 650(ptr) AccessChain 4902 2579 - 11412: 13(float) Load 21371 - 22584: 13(float) FAdd 11412 7372 - 17318: 650(ptr) AccessChain 4902 2579 - Store 17318 22584 - 17934: 29(fvec4) Load 4902 - Store 5139 17934 - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/remap.uniformarray.none.frag.out b/third_party/glslang/Test/baseResults/remap.uniformarray.none.frag.out deleted file mode 100644 index 458d8c78a2..0000000000 --- a/third_party/glslang/Test/baseResults/remap.uniformarray.none.frag.out +++ /dev/null @@ -1,90 +0,0 @@ -remap.uniformarray.none.frag -// Module Version 10000 -// Generated by (magic number): 8000b -// Id's are bound by 60 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 14 25 43 54 - ExecutionMode 4 OriginUpperLeft - Source GLSL 140 - Name 4 "main" - Name 9 "texColor" - Name 14 "color" - Name 25 "inColor" - Name 43 "alpha" - Name 54 "gl_FragColor" - Name 59 "texSampler2D" - Decorate 14(color) Location 1 - Decorate 25(inColor) Location 0 - Decorate 43(alpha) Location 7 - Decorate 54(gl_FragColor) Location 0 - Decorate 59(texSampler2D) Binding 0 - Decorate 59(texSampler2D) DescriptorSet 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeFloat 32 - 7: TypeVector 6(float) 4 - 8: TypePointer Function 7(fvec4) - 10: TypeInt 32 0 - 11: 10(int) Constant 6 - 12: TypeArray 7(fvec4) 11 - 13: TypePointer Input 12 - 14(color): 13(ptr) Variable Input - 15: TypeInt 32 1 - 16: 15(int) Constant 1 - 17: TypePointer Input 7(fvec4) - 23: TypeVector 6(float) 3 - 24: TypePointer Input 23(fvec3) - 25(inColor): 24(ptr) Variable Input - 30: 10(int) Constant 0 - 31: TypePointer Function 6(float) - 34: 10(int) Constant 1 - 37: 10(int) Constant 2 - 40: 10(int) Constant 16 - 41: TypeArray 6(float) 40 - 42: TypePointer Input 41 - 43(alpha): 42(ptr) Variable Input - 44: 15(int) Constant 12 - 45: TypePointer Input 6(float) - 48: 10(int) Constant 3 - 53: TypePointer Output 7(fvec4) -54(gl_FragColor): 53(ptr) Variable Output - 56: TypeImage 6(float) 2D sampled format:Unknown - 57: TypeSampledImage 56 - 58: TypePointer UniformConstant 57 -59(texSampler2D): 58(ptr) Variable UniformConstant - 4(main): 2 Function None 3 - 5: Label - 9(texColor): 8(ptr) Variable Function - 18: 17(ptr) AccessChain 14(color) 16 - 19: 7(fvec4) Load 18 - 20: 17(ptr) AccessChain 14(color) 16 - 21: 7(fvec4) Load 20 - 22: 7(fvec4) FAdd 19 21 - Store 9(texColor) 22 - 26: 23(fvec3) Load 25(inColor) - 27: 7(fvec4) Load 9(texColor) - 28: 23(fvec3) VectorShuffle 27 27 0 1 2 - 29: 23(fvec3) FAdd 28 26 - 32: 31(ptr) AccessChain 9(texColor) 30 - 33: 6(float) CompositeExtract 29 0 - Store 32 33 - 35: 31(ptr) AccessChain 9(texColor) 34 - 36: 6(float) CompositeExtract 29 1 - Store 35 36 - 38: 31(ptr) AccessChain 9(texColor) 37 - 39: 6(float) CompositeExtract 29 2 - Store 38 39 - 46: 45(ptr) AccessChain 43(alpha) 44 - 47: 6(float) Load 46 - 49: 31(ptr) AccessChain 9(texColor) 48 - 50: 6(float) Load 49 - 51: 6(float) FAdd 50 47 - 52: 31(ptr) AccessChain 9(texColor) 48 - Store 52 51 - 55: 7(fvec4) Load 9(texColor) - Store 54(gl_FragColor) 55 - Return - FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.460.subgroupEXT.mesh.out b/third_party/glslang/Test/baseResults/spv.460.subgroupEXT.mesh.out index 112d50d294..a7eb6d6018 100644 --- a/third_party/glslang/Test/baseResults/spv.460.subgroupEXT.mesh.out +++ b/third_party/glslang/Test/baseResults/spv.460.subgroupEXT.mesh.out @@ -1,7 +1,7 @@ spv.460.subgroupEXT.mesh // Module Version 10400 // Generated by (magic number): 8000b -// Id's are bound by 279 +// Id's are bound by 228 Capability ClipDistance Capability CullDistance @@ -17,7 +17,7 @@ spv.460.subgroupEXT.mesh Extension "SPV_EXT_mesh_shader" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint MeshEXT 4 "main" 35 41 57 109 147 161 162 167 168 171 172 173 174 175 + EntryPoint MeshEXT 4 "main" 35 41 57 85 102 110 111 116 117 120 121 122 123 124 ExecutionMode 4 LocalSize 32 1 1 ExecutionMode 4 OutputVertices 81 ExecutionMode 4 OutputPrimitivesNV 32 @@ -58,25 +58,25 @@ spv.460.subgroupEXT.mesh MemberName 54(gl_MeshPerVertexEXT) 2 "gl_ClipDistance" MemberName 54(gl_MeshPerVertexEXT) 3 "gl_CullDistance" Name 57 "gl_MeshVerticesEXT" - Name 106 "gl_MeshPerPrimitiveEXT" - MemberName 106(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID" - MemberName 106(gl_MeshPerPrimitiveEXT) 1 "gl_Layer" - MemberName 106(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex" - MemberName 106(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT" - Name 109 "gl_MeshPrimitivesEXT" - Name 147 "gl_PrimitiveTriangleIndicesEXT" - Name 161 "gl_SubgroupSize" - Name 162 "gl_SubgroupInvocationID" - Name 167 "gl_NumSubgroups" - Name 168 "gl_SubgroupID" - Name 171 "gl_SubgroupEqMask" - Name 172 "gl_SubgroupGeMask" - Name 173 "gl_SubgroupGtMask" - Name 174 "gl_SubgroupLeMask" - Name 175 "gl_SubgroupLtMask" - Name 181 "ballot" - Name 218 "ballot" - Name 253 "ballot" + Name 82 "gl_MeshPerPrimitiveEXT" + MemberName 82(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID" + MemberName 82(gl_MeshPerPrimitiveEXT) 1 "gl_Layer" + MemberName 82(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex" + MemberName 82(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT" + Name 85 "gl_MeshPrimitivesEXT" + Name 102 "gl_PrimitiveTriangleIndicesEXT" + Name 110 "gl_SubgroupSize" + Name 111 "gl_SubgroupInvocationID" + Name 116 "gl_NumSubgroups" + Name 117 "gl_SubgroupID" + Name 120 "gl_SubgroupEqMask" + Name 121 "gl_SubgroupGeMask" + Name 122 "gl_SubgroupGtMask" + Name 123 "gl_SubgroupLeMask" + Name 124 "gl_SubgroupLtMask" + Name 130 "ballot" + Name 167 "ballot" + Name 202 "ballot" Decorate 35(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 41(gl_WorkGroupID) BuiltIn WorkgroupId Decorate 54(gl_MeshPerVertexEXT) Block @@ -84,28 +84,28 @@ spv.460.subgroupEXT.mesh MemberDecorate 54(gl_MeshPerVertexEXT) 1 BuiltIn PointSize MemberDecorate 54(gl_MeshPerVertexEXT) 2 BuiltIn ClipDistance MemberDecorate 54(gl_MeshPerVertexEXT) 3 BuiltIn CullDistance - Decorate 106(gl_MeshPerPrimitiveEXT) Block - MemberDecorate 106(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId - MemberDecorate 106(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV - MemberDecorate 106(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer - MemberDecorate 106(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV - MemberDecorate 106(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex - MemberDecorate 106(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV - MemberDecorate 106(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT - MemberDecorate 106(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV - Decorate 147(gl_PrimitiveTriangleIndicesEXT) BuiltIn PrimitiveTriangleIndicesEXT - Decorate 161(gl_SubgroupSize) RelaxedPrecision - Decorate 161(gl_SubgroupSize) BuiltIn SubgroupSize - Decorate 162(gl_SubgroupInvocationID) RelaxedPrecision - Decorate 162(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId - Decorate 167(gl_NumSubgroups) BuiltIn NumSubgroups - Decorate 168(gl_SubgroupID) BuiltIn SubgroupId - Decorate 171(gl_SubgroupEqMask) BuiltIn SubgroupEqMaskKHR - Decorate 172(gl_SubgroupGeMask) BuiltIn SubgroupGeMaskKHR - Decorate 173(gl_SubgroupGtMask) BuiltIn SubgroupGtMaskKHR - Decorate 174(gl_SubgroupLeMask) BuiltIn SubgroupLeMaskKHR - Decorate 175(gl_SubgroupLtMask) BuiltIn SubgroupLtMaskKHR - Decorate 278 BuiltIn WorkgroupSize + Decorate 82(gl_MeshPerPrimitiveEXT) Block + MemberDecorate 82(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId + MemberDecorate 82(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV + MemberDecorate 82(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer + MemberDecorate 82(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV + MemberDecorate 82(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex + MemberDecorate 82(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV + MemberDecorate 82(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT + MemberDecorate 82(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV + Decorate 102(gl_PrimitiveTriangleIndicesEXT) BuiltIn PrimitiveTriangleIndicesEXT + Decorate 110(gl_SubgroupSize) RelaxedPrecision + Decorate 110(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 111(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 111(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 116(gl_NumSubgroups) BuiltIn NumSubgroups + Decorate 117(gl_SubgroupID) BuiltIn SubgroupId + Decorate 120(gl_SubgroupEqMask) BuiltIn SubgroupEqMaskKHR + Decorate 121(gl_SubgroupGeMask) BuiltIn SubgroupGeMaskKHR + Decorate 122(gl_SubgroupGtMask) BuiltIn SubgroupGtMaskKHR + Decorate 123(gl_SubgroupLeMask) BuiltIn SubgroupLeMaskKHR + Decorate 124(gl_SubgroupLtMask) BuiltIn SubgroupLtMaskKHR + Decorate 227 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 8: TypeFloat 32 @@ -145,43 +145,43 @@ spv.460.subgroupEXT.mesh 78: 30(int) Constant 1 79: 30(int) Constant 264 80: 30(int) Constant 2 - 105: TypeBool -106(gl_MeshPerPrimitiveEXT): TypeStruct 59(int) 59(int) 59(int) 105(bool) - 107: TypeArray 106(gl_MeshPerPrimitiveEXT) 47 - 108: TypePointer Output 107 -109(gl_MeshPrimitivesEXT): 108(ptr) Variable Output - 111: 59(int) Constant 6 - 112: TypePointer Output 59(int) - 115: 59(int) Constant 7 - 118: 59(int) Constant 8 - 121: 105(bool) ConstantFalse - 122: TypePointer Output 105(bool) - 145: TypeArray 33(ivec3) 47 - 146: TypePointer Output 145 -147(gl_PrimitiveTriangleIndicesEXT): 146(ptr) Variable Output - 148: 33(ivec3) ConstantComposite 78 78 78 - 149: TypePointer Output 33(ivec3) - 153: 33(ivec3) ConstantComposite 80 80 80 -161(gl_SubgroupSize): 37(ptr) Variable Input -162(gl_SubgroupInvocationID): 37(ptr) Variable Input - 163: 30(int) Constant 3400 - 164: 30(int) Constant 72 - 165: 30(int) Constant 2056 -167(gl_NumSubgroups): 37(ptr) Variable Input -168(gl_SubgroupID): 37(ptr) Variable Input - 169: TypeVector 30(int) 4 - 170: TypePointer Input 169(ivec4) -171(gl_SubgroupEqMask): 170(ptr) Variable Input -172(gl_SubgroupGeMask): 170(ptr) Variable Input -173(gl_SubgroupGtMask): 170(ptr) Variable Input -174(gl_SubgroupLeMask): 170(ptr) Variable Input -175(gl_SubgroupLtMask): 170(ptr) Variable Input - 180: TypePointer Function 169(ivec4) - 183: 169(ivec4) ConstantComposite 78 78 78 78 - 197: 105(bool) ConstantTrue - 254: 30(int) Constant 85 - 255: 169(ivec4) ConstantComposite 254 36 36 36 - 278: 33(ivec3) ConstantComposite 47 78 78 + 81: TypeBool +82(gl_MeshPerPrimitiveEXT): TypeStruct 59(int) 59(int) 59(int) 81(bool) + 83: TypeArray 82(gl_MeshPerPrimitiveEXT) 47 + 84: TypePointer Output 83 +85(gl_MeshPrimitivesEXT): 84(ptr) Variable Output + 87: 59(int) Constant 6 + 88: TypePointer Output 59(int) + 91: 59(int) Constant 7 + 94: 59(int) Constant 8 + 97: 81(bool) ConstantFalse + 98: TypePointer Output 81(bool) + 100: TypeArray 33(ivec3) 47 + 101: TypePointer Output 100 +102(gl_PrimitiveTriangleIndicesEXT): 101(ptr) Variable Output + 103: 33(ivec3) ConstantComposite 78 78 78 + 104: TypePointer Output 33(ivec3) + 108: 33(ivec3) ConstantComposite 80 80 80 +110(gl_SubgroupSize): 37(ptr) Variable Input +111(gl_SubgroupInvocationID): 37(ptr) Variable Input + 112: 30(int) Constant 3400 + 113: 30(int) Constant 72 + 114: 30(int) Constant 2056 +116(gl_NumSubgroups): 37(ptr) Variable Input +117(gl_SubgroupID): 37(ptr) Variable Input + 118: TypeVector 30(int) 4 + 119: TypePointer Input 118(ivec4) +120(gl_SubgroupEqMask): 119(ptr) Variable Input +121(gl_SubgroupGeMask): 119(ptr) Variable Input +122(gl_SubgroupGtMask): 119(ptr) Variable Input +123(gl_SubgroupLeMask): 119(ptr) Variable Input +124(gl_SubgroupLtMask): 119(ptr) Variable Input + 129: TypePointer Function 118(ivec4) + 132: 118(ivec4) ConstantComposite 78 78 78 78 + 146: 81(bool) ConstantTrue + 203: 30(int) Constant 85 + 204: 118(ivec4) ConstantComposite 203 36 36 36 + 227: 33(ivec3) ConstantComposite 47 78 78 4(main): 2 Function None 3 5: Label 32(iid): 31(ptr) Variable Function @@ -213,230 +213,166 @@ spv.460.subgroupEXT.mesh Store 77 76 MemoryBarrier 78 79 ControlBarrier 80 80 79 - 81: 30(int) Load 32(iid) - 82: 30(int) IAdd 81 78 - 83: 30(int) Load 32(iid) - 84: 63(ptr) AccessChain 57(gl_MeshVerticesEXT) 83 60 - 85: 9(fvec4) Load 84 - 86: 63(ptr) AccessChain 57(gl_MeshVerticesEXT) 82 60 - Store 86 85 - 87: 30(int) Load 32(iid) - 88: 30(int) IAdd 87 78 - 89: 30(int) Load 32(iid) - 90: 68(ptr) AccessChain 57(gl_MeshVerticesEXT) 89 66 - 91: 8(float) Load 90 - 92: 68(ptr) AccessChain 57(gl_MeshVerticesEXT) 88 66 + 86: 30(int) Load 32(iid) + 89: 88(ptr) AccessChain 85(gl_MeshPrimitivesEXT) 86 60 + Store 89 87 + 90: 30(int) Load 32(iid) + 92: 88(ptr) AccessChain 85(gl_MeshPrimitivesEXT) 90 66 Store 92 91 93: 30(int) Load 32(iid) - 94: 30(int) IAdd 93 78 - 95: 30(int) Load 32(iid) - 96: 68(ptr) AccessChain 57(gl_MeshVerticesEXT) 95 71 72 - 97: 8(float) Load 96 - 98: 68(ptr) AccessChain 57(gl_MeshVerticesEXT) 94 71 72 - Store 98 97 - 99: 30(int) Load 32(iid) - 100: 30(int) IAdd 99 78 - 101: 30(int) Load 32(iid) - 102: 68(ptr) AccessChain 57(gl_MeshVerticesEXT) 101 72 71 - 103: 8(float) Load 102 - 104: 68(ptr) AccessChain 57(gl_MeshVerticesEXT) 100 72 71 - Store 104 103 + 95: 88(ptr) AccessChain 85(gl_MeshPrimitivesEXT) 93 71 + Store 95 94 + 96: 30(int) Load 32(iid) + 99: 98(ptr) AccessChain 85(gl_MeshPrimitivesEXT) 96 72 + Store 99 97 MemoryBarrier 78 79 ControlBarrier 80 80 79 - 110: 30(int) Load 32(iid) - 113: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 110 60 - Store 113 111 - 114: 30(int) Load 32(iid) - 116: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 114 66 - Store 116 115 - 117: 30(int) Load 32(iid) - 119: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 117 71 - Store 119 118 - 120: 30(int) Load 32(iid) - 123: 122(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 120 72 - Store 123 121 - MemoryBarrier 78 79 - ControlBarrier 80 80 79 - 124: 30(int) Load 32(iid) - 125: 30(int) IAdd 124 78 - 126: 30(int) Load 32(iid) - 127: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 126 60 - 128: 59(int) Load 127 - 129: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 125 60 - Store 129 128 - 130: 30(int) Load 32(iid) - 131: 30(int) IAdd 130 78 - 132: 30(int) Load 32(iid) - 133: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 132 66 - 134: 59(int) Load 133 - 135: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 131 66 - Store 135 134 - 136: 30(int) Load 32(iid) - 137: 30(int) IAdd 136 78 - 138: 30(int) Load 32(iid) - 139: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 138 71 - 140: 59(int) Load 139 - 141: 112(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 137 71 - Store 141 140 - 142: 30(int) Load 32(iid) - 143: 30(int) IAdd 142 78 - 144: 122(ptr) AccessChain 109(gl_MeshPrimitivesEXT) 143 72 - Store 144 121 - MemoryBarrier 78 79 - ControlBarrier 80 80 79 - 150: 149(ptr) AccessChain 147(gl_PrimitiveTriangleIndicesEXT) 60 - Store 150 148 - 151: 30(int) Load 46(primitiveCount) - 152: 30(int) ISub 151 78 - 154: 149(ptr) AccessChain 147(gl_PrimitiveTriangleIndicesEXT) 152 - Store 154 153 - 155: 30(int) Load 40(gid) - 156: 30(int) Load 40(gid) - 157: 30(int) ISub 156 78 - 158: 149(ptr) AccessChain 147(gl_PrimitiveTriangleIndicesEXT) 157 - 159: 33(ivec3) Load 158 - 160: 149(ptr) AccessChain 147(gl_PrimitiveTriangleIndicesEXT) 155 - Store 160 159 + 105: 104(ptr) AccessChain 102(gl_PrimitiveTriangleIndicesEXT) 60 + Store 105 103 + 106: 30(int) Load 46(primitiveCount) + 107: 30(int) ISub 106 78 + 109: 104(ptr) AccessChain 102(gl_PrimitiveTriangleIndicesEXT) 107 + Store 109 108 MemoryBarrier 78 79 ControlBarrier 80 80 79 Return FunctionEnd 6(basic_works(): 2 Function None 3 7: Label - ControlBarrier 52 52 163 - MemoryBarrier 52 163 - MemoryBarrier 52 164 - MemoryBarrier 52 165 - 166: 105(bool) GroupNonUniformElect 52 + ControlBarrier 52 52 112 + MemoryBarrier 52 112 + MemoryBarrier 52 113 + MemoryBarrier 52 114 + 115: 81(bool) GroupNonUniformElect 52 MemoryBarrier 52 79 Return FunctionEnd 13(ballot_works(vf4;): 2 Function None 11 12(f4): 10(ptr) FunctionParameter 14: Label - 181(ballot): 180(ptr) Variable Function - 176: 9(fvec4) Load 12(f4) - 177: 9(fvec4) GroupNonUniformBroadcast 52 176 36 - 178: 9(fvec4) Load 12(f4) - 179: 9(fvec4) GroupNonUniformBroadcastFirst 52 178 - 182: 169(ivec4) GroupNonUniformBallot 52 121 - Store 181(ballot) 182 - 184: 105(bool) GroupNonUniformInverseBallot 52 183 - 185: 169(ivec4) Load 181(ballot) - 186: 105(bool) GroupNonUniformBallotBitExtract 52 185 36 - 187: 169(ivec4) Load 181(ballot) - 188: 30(int) GroupNonUniformBallotBitCount 52 Reduce 187 - 189: 169(ivec4) Load 181(ballot) - 190: 30(int) GroupNonUniformBallotBitCount 52 InclusiveScan 189 - 191: 169(ivec4) Load 181(ballot) - 192: 30(int) GroupNonUniformBallotBitCount 52 ExclusiveScan 191 - 193: 169(ivec4) Load 181(ballot) - 194: 30(int) GroupNonUniformBallotFindLSB 52 193 - 195: 169(ivec4) Load 181(ballot) - 196: 30(int) GroupNonUniformBallotFindMSB 52 195 + 130(ballot): 129(ptr) Variable Function + 125: 9(fvec4) Load 12(f4) + 126: 9(fvec4) GroupNonUniformBroadcast 52 125 36 + 127: 9(fvec4) Load 12(f4) + 128: 9(fvec4) GroupNonUniformBroadcastFirst 52 127 + 131: 118(ivec4) GroupNonUniformBallot 52 97 + Store 130(ballot) 131 + 133: 81(bool) GroupNonUniformInverseBallot 52 132 + 134: 118(ivec4) Load 130(ballot) + 135: 81(bool) GroupNonUniformBallotBitExtract 52 134 36 + 136: 118(ivec4) Load 130(ballot) + 137: 30(int) GroupNonUniformBallotBitCount 52 Reduce 136 + 138: 118(ivec4) Load 130(ballot) + 139: 30(int) GroupNonUniformBallotBitCount 52 InclusiveScan 138 + 140: 118(ivec4) Load 130(ballot) + 141: 30(int) GroupNonUniformBallotBitCount 52 ExclusiveScan 140 + 142: 118(ivec4) Load 130(ballot) + 143: 30(int) GroupNonUniformBallotFindLSB 52 142 + 144: 118(ivec4) Load 130(ballot) + 145: 30(int) GroupNonUniformBallotFindMSB 52 144 Return FunctionEnd 16(vote_works(vf4;): 2 Function None 11 15(f4): 10(ptr) FunctionParameter 17: Label - 198: 105(bool) GroupNonUniformAll 52 197 - 199: 105(bool) GroupNonUniformAny 52 121 - 200: 9(fvec4) Load 15(f4) - 201: 105(bool) GroupNonUniformAllEqual 52 200 + 147: 81(bool) GroupNonUniformAll 52 146 + 148: 81(bool) GroupNonUniformAny 52 97 + 149: 9(fvec4) Load 15(f4) + 150: 81(bool) GroupNonUniformAllEqual 52 149 Return FunctionEnd 19(shuffle_works(vf4;): 2 Function None 11 18(f4): 10(ptr) FunctionParameter 20: Label - 202: 9(fvec4) Load 18(f4) - 203: 9(fvec4) GroupNonUniformShuffle 52 202 36 - 204: 9(fvec4) Load 18(f4) - 205: 9(fvec4) GroupNonUniformShuffleXor 52 204 78 - 206: 9(fvec4) Load 18(f4) - 207: 9(fvec4) GroupNonUniformShuffleUp 52 206 78 - 208: 9(fvec4) Load 18(f4) - 209: 9(fvec4) GroupNonUniformShuffleDown 52 208 78 + 151: 9(fvec4) Load 18(f4) + 152: 9(fvec4) GroupNonUniformShuffle 52 151 36 + 153: 9(fvec4) Load 18(f4) + 154: 9(fvec4) GroupNonUniformShuffleXor 52 153 78 + 155: 9(fvec4) Load 18(f4) + 156: 9(fvec4) GroupNonUniformShuffleUp 52 155 78 + 157: 9(fvec4) Load 18(f4) + 158: 9(fvec4) GroupNonUniformShuffleDown 52 157 78 Return FunctionEnd 22(arith_works(vf4;): 2 Function None 11 21(f4): 10(ptr) FunctionParameter 23: Label - 218(ballot): 180(ptr) Variable Function - 210: 9(fvec4) Load 21(f4) - 211: 9(fvec4) GroupNonUniformFAdd 52 Reduce 210 - 212: 9(fvec4) Load 21(f4) - 213: 9(fvec4) GroupNonUniformFMul 52 Reduce 212 - 214: 9(fvec4) Load 21(f4) - 215: 9(fvec4) GroupNonUniformFMin 52 Reduce 214 - 216: 9(fvec4) Load 21(f4) - 217: 9(fvec4) GroupNonUniformFMax 52 Reduce 216 - 219: 169(ivec4) Load 218(ballot) - 220: 169(ivec4) GroupNonUniformBitwiseAnd 52 Reduce 219 - 221: 169(ivec4) Load 218(ballot) - 222: 169(ivec4) GroupNonUniformBitwiseOr 52 Reduce 221 - 223: 169(ivec4) Load 218(ballot) - 224: 169(ivec4) GroupNonUniformBitwiseXor 52 Reduce 223 - 225: 9(fvec4) Load 21(f4) - 226: 9(fvec4) GroupNonUniformFAdd 52 InclusiveScan 225 - 227: 9(fvec4) Load 21(f4) - 228: 9(fvec4) GroupNonUniformFMul 52 InclusiveScan 227 - 229: 9(fvec4) Load 21(f4) - 230: 9(fvec4) GroupNonUniformFMin 52 InclusiveScan 229 - 231: 9(fvec4) Load 21(f4) - 232: 9(fvec4) GroupNonUniformFMax 52 InclusiveScan 231 - 233: 169(ivec4) Load 218(ballot) - 234: 169(ivec4) GroupNonUniformBitwiseAnd 52 InclusiveScan 233 - 235: 169(ivec4) Load 218(ballot) - 236: 169(ivec4) GroupNonUniformBitwiseOr 52 InclusiveScan 235 - 237: 169(ivec4) Load 218(ballot) - 238: 169(ivec4) GroupNonUniformBitwiseXor 52 InclusiveScan 237 - 239: 9(fvec4) Load 21(f4) - 240: 9(fvec4) GroupNonUniformFAdd 52 ExclusiveScan 239 - 241: 9(fvec4) Load 21(f4) - 242: 9(fvec4) GroupNonUniformFMul 52 ExclusiveScan 241 - 243: 9(fvec4) Load 21(f4) - 244: 9(fvec4) GroupNonUniformFMin 52 ExclusiveScan 243 - 245: 9(fvec4) Load 21(f4) - 246: 9(fvec4) GroupNonUniformFMax 52 ExclusiveScan 245 - 247: 169(ivec4) Load 218(ballot) - 248: 169(ivec4) GroupNonUniformBitwiseAnd 52 ExclusiveScan 247 - 249: 169(ivec4) Load 218(ballot) - 250: 169(ivec4) GroupNonUniformBitwiseOr 52 ExclusiveScan 249 - 251: 169(ivec4) Load 218(ballot) - 252: 169(ivec4) GroupNonUniformBitwiseXor 52 ExclusiveScan 251 + 167(ballot): 129(ptr) Variable Function + 159: 9(fvec4) Load 21(f4) + 160: 9(fvec4) GroupNonUniformFAdd 52 Reduce 159 + 161: 9(fvec4) Load 21(f4) + 162: 9(fvec4) GroupNonUniformFMul 52 Reduce 161 + 163: 9(fvec4) Load 21(f4) + 164: 9(fvec4) GroupNonUniformFMin 52 Reduce 163 + 165: 9(fvec4) Load 21(f4) + 166: 9(fvec4) GroupNonUniformFMax 52 Reduce 165 + 168: 118(ivec4) Load 167(ballot) + 169: 118(ivec4) GroupNonUniformBitwiseAnd 52 Reduce 168 + 170: 118(ivec4) Load 167(ballot) + 171: 118(ivec4) GroupNonUniformBitwiseOr 52 Reduce 170 + 172: 118(ivec4) Load 167(ballot) + 173: 118(ivec4) GroupNonUniformBitwiseXor 52 Reduce 172 + 174: 9(fvec4) Load 21(f4) + 175: 9(fvec4) GroupNonUniformFAdd 52 InclusiveScan 174 + 176: 9(fvec4) Load 21(f4) + 177: 9(fvec4) GroupNonUniformFMul 52 InclusiveScan 176 + 178: 9(fvec4) Load 21(f4) + 179: 9(fvec4) GroupNonUniformFMin 52 InclusiveScan 178 + 180: 9(fvec4) Load 21(f4) + 181: 9(fvec4) GroupNonUniformFMax 52 InclusiveScan 180 + 182: 118(ivec4) Load 167(ballot) + 183: 118(ivec4) GroupNonUniformBitwiseAnd 52 InclusiveScan 182 + 184: 118(ivec4) Load 167(ballot) + 185: 118(ivec4) GroupNonUniformBitwiseOr 52 InclusiveScan 184 + 186: 118(ivec4) Load 167(ballot) + 187: 118(ivec4) GroupNonUniformBitwiseXor 52 InclusiveScan 186 + 188: 9(fvec4) Load 21(f4) + 189: 9(fvec4) GroupNonUniformFAdd 52 ExclusiveScan 188 + 190: 9(fvec4) Load 21(f4) + 191: 9(fvec4) GroupNonUniformFMul 52 ExclusiveScan 190 + 192: 9(fvec4) Load 21(f4) + 193: 9(fvec4) GroupNonUniformFMin 52 ExclusiveScan 192 + 194: 9(fvec4) Load 21(f4) + 195: 9(fvec4) GroupNonUniformFMax 52 ExclusiveScan 194 + 196: 118(ivec4) Load 167(ballot) + 197: 118(ivec4) GroupNonUniformBitwiseAnd 52 ExclusiveScan 196 + 198: 118(ivec4) Load 167(ballot) + 199: 118(ivec4) GroupNonUniformBitwiseOr 52 ExclusiveScan 198 + 200: 118(ivec4) Load 167(ballot) + 201: 118(ivec4) GroupNonUniformBitwiseXor 52 ExclusiveScan 200 Return FunctionEnd 25(clustered_works(vf4;): 2 Function None 11 24(f4): 10(ptr) FunctionParameter 26: Label - 253(ballot): 180(ptr) Variable Function - Store 253(ballot) 255 - 256: 9(fvec4) Load 24(f4) - 257: 9(fvec4) GroupNonUniformFAdd 52 ClusteredReduce 256 80 - 258: 9(fvec4) Load 24(f4) - 259: 9(fvec4) GroupNonUniformFMul 52 ClusteredReduce 258 80 - 260: 9(fvec4) Load 24(f4) - 261: 9(fvec4) GroupNonUniformFMin 52 ClusteredReduce 260 80 - 262: 9(fvec4) Load 24(f4) - 263: 9(fvec4) GroupNonUniformFMax 52 ClusteredReduce 262 80 - 264: 169(ivec4) Load 253(ballot) - 265: 169(ivec4) GroupNonUniformBitwiseAnd 52 ClusteredReduce 264 80 - 266: 169(ivec4) Load 253(ballot) - 267: 169(ivec4) GroupNonUniformBitwiseOr 52 ClusteredReduce 266 80 - 268: 169(ivec4) Load 253(ballot) - 269: 169(ivec4) GroupNonUniformBitwiseXor 52 ClusteredReduce 268 80 + 202(ballot): 129(ptr) Variable Function + Store 202(ballot) 204 + 205: 9(fvec4) Load 24(f4) + 206: 9(fvec4) GroupNonUniformFAdd 52 ClusteredReduce 205 80 + 207: 9(fvec4) Load 24(f4) + 208: 9(fvec4) GroupNonUniformFMul 52 ClusteredReduce 207 80 + 209: 9(fvec4) Load 24(f4) + 210: 9(fvec4) GroupNonUniformFMin 52 ClusteredReduce 209 80 + 211: 9(fvec4) Load 24(f4) + 212: 9(fvec4) GroupNonUniformFMax 52 ClusteredReduce 211 80 + 213: 118(ivec4) Load 202(ballot) + 214: 118(ivec4) GroupNonUniformBitwiseAnd 52 ClusteredReduce 213 80 + 215: 118(ivec4) Load 202(ballot) + 216: 118(ivec4) GroupNonUniformBitwiseOr 52 ClusteredReduce 215 80 + 217: 118(ivec4) Load 202(ballot) + 218: 118(ivec4) GroupNonUniformBitwiseXor 52 ClusteredReduce 217 80 Return FunctionEnd 28(quad_works(vf4;): 2 Function None 11 27(f4): 10(ptr) FunctionParameter 29: Label - 270: 9(fvec4) Load 27(f4) - 271: 9(fvec4) GroupNonUniformQuadBroadcast 52 270 36 - 272: 9(fvec4) Load 27(f4) - 273: 9(fvec4) GroupNonUniformQuadSwap 52 272 36 - 274: 9(fvec4) Load 27(f4) - 275: 9(fvec4) GroupNonUniformQuadSwap 52 274 78 - 276: 9(fvec4) Load 27(f4) - 277: 9(fvec4) GroupNonUniformQuadSwap 52 276 80 + 219: 9(fvec4) Load 27(f4) + 220: 9(fvec4) GroupNonUniformQuadBroadcast 52 219 36 + 221: 9(fvec4) Load 27(f4) + 222: 9(fvec4) GroupNonUniformQuadSwap 52 221 36 + 223: 9(fvec4) Load 27(f4) + 224: 9(fvec4) GroupNonUniformQuadSwap 52 223 78 + 225: 9(fvec4) Load 27(f4) + 226: 9(fvec4) GroupNonUniformQuadSwap 52 225 80 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.64bit_indexing.comp.out b/third_party/glslang/Test/baseResults/spv.64bit_indexing.comp.out new file mode 100644 index 0000000000..318135c50d --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.64bit_indexing.comp.out @@ -0,0 +1,150 @@ +spv.64bit_indexing.comp +// Module Version 10600 +// Generated by (magic number): 8000b +// Id's are bound by 88 + + Capability Shader + Capability Float16 + Capability Int64 + Capability VulkanMemoryModelKHR + Capability PhysicalStorageBufferAddressesEXT + Capability CooperativeVectorNV + Capability CapabilityShader64BitIndexingEXT + Capability CooperativeVectorTrainingNV + Capability CooperativeMatrixKHR + Extension "SPV_EXT_shader_64bit_indexing" + Extension "SPV_KHR_cooperative_matrix" + Extension "SPV_NV_cooperative_vector" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT VulkanKHR + EntryPoint GLCompute 4 "main" 22 + ExecutionMode 4 Shader64BitIndexingEXT + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_shader_64bit_indexing" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_cooperative_matrix" + SourceExtension "GL_KHR_memory_scope_semantics" + SourceExtension "GL_NV_cooperative_vector" + Name 4 "main" + Name 8 "element" + Name 17 "m" + Name 20 "Block" + MemberName 20(Block) 0 "x" + Name 22 "block" + Name 37 "tempArg" + Name 38 "vec" + Name 49 "tempArg" + Name 55 "tempArg" + Name 71 "y" + Name 76 "len" + Name 81 "len64" + Decorate 19 ArrayStride 4 + Decorate 20(Block) Block + MemberDecorate 20(Block) 0 Offset 0 + Decorate 22(block) Binding 0 + Decorate 22(block) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 64 0 + 7: TypePointer Function 6(int64_t) + 9: 6(int64_t) Constant 0 0 + 10: TypeFloat 16 + 11: TypeInt 32 0 + 12: 11(int) Constant 3 + 13: 11(int) Constant 16 + 14: 11(int) Constant 0 + 15: TypeCooperativeMatrixKHR 10(float16_t) 12 13 13 14 + 16: TypePointer Function 15 + 18: TypeFloat 32 + 19: TypeRuntimeArray 18(float) + 20(Block): TypeStruct 19 + 21: TypePointer StorageBuffer 20(Block) + 22(block): 21(ptr) Variable StorageBuffer + 23: TypeInt 32 1 + 24: 23(int) Constant 0 + 26: 11(int) Constant 5 + 27: TypePointer StorageBuffer 18(float) + 29: 11(int) Constant 128 + 34: 11(int) Constant 2 + 35: TypeCooperativeVectorNV 10(float16_t) 34 + 36: TypePointer Function 35 + 40: TypePointer StorageBuffer 19 + 45: TypeBool + 46: 45(bool) ConstantFalse + 70: TypePointer Function 18(float) + 75: TypePointer Function 23(int) + 79: TypeInt 64 1 + 80: TypePointer Function 79(int64_t) + 84: TypeVector 11(int) 3 + 85: 11(int) Constant 64 + 86: 11(int) Constant 1 + 87: 84(ivec3) ConstantComposite 85 86 86 + 4(main): 2 Function None 3 + 5: Label + 8(element): 7(ptr) Variable Function + 17(m): 16(ptr) Variable Function + 37(tempArg): 36(ptr) Variable Function + 38(vec): 36(ptr) Variable Function + 49(tempArg): 36(ptr) Variable Function + 55(tempArg): 36(ptr) Variable Function + 71(y): 70(ptr) Variable Function + 76(len): 75(ptr) Variable Function + 81(len64): 80(ptr) Variable Function + Store 8(element) 9 + 25: 6(int64_t) Load 8(element) + 28: 27(ptr) AccessChain 22(block) 24 25 + 30: 15 CooperativeMatrixLoadKHR 28 24 29 MakePointerVisibleKHR NonPrivatePointerKHR 26 + Store 17(m) 30 + 31: 15 Load 17(m) + 32: 6(int64_t) Load 8(element) + 33: 27(ptr) AccessChain 22(block) 24 32 + CooperativeMatrixStoreKHR 33 31 24 29 MakePointerAvailableKHR NonPrivatePointerKHR 26 + 39: 35 Load 38(vec) + 41: 40(ptr) AccessChain 22(block) 24 + 42: 6(int64_t) Load 8(element) + 43: 40(ptr) AccessChain 22(block) 24 + 44: 6(int64_t) Load 8(element) + 47: 35 CooperativeVectorMatrixMulAddNV 39 24 41 42 24 43 44 24 34 34 24 46 14 + Store 37(tempArg) 47 + 48: 35 Load 37(tempArg) + Store 38(vec) 48 + 50: 35 Load 38(vec) + 51: 40(ptr) AccessChain 22(block) 24 + 52: 6(int64_t) Load 8(element) + 53: 35 CooperativeVectorMatrixMulNV 50 24 51 52 24 34 34 24 46 14 + Store 49(tempArg) 53 + 54: 35 Load 49(tempArg) + Store 38(vec) 54 + 56: 40(ptr) AccessChain 22(block) 24 + 57: 6(int64_t) Load 8(element) + 58: 35 CooperativeVectorLoadNV 56 57 MakePointerVisibleKHR NonPrivatePointerKHR 26 + Store 55(tempArg) 58 + 59: 35 Load 55(tempArg) + Store 38(vec) 59 + 60: 35 Load 38(vec) + 61: 40(ptr) AccessChain 22(block) 24 + 62: 6(int64_t) Load 8(element) + CooperativeVectorStoreNV 61 62 60 MakePointerAvailableKHR NonPrivatePointerKHR 26 + 63: 35 Load 38(vec) + 64: 35 Load 38(vec) + 65: 40(ptr) AccessChain 22(block) 24 + 66: 6(int64_t) Load 8(element) + CooperativeVectorOuterProductAccumulateNV 65 66 63 64 24 24 14 + 67: 35 Load 38(vec) + 68: 40(ptr) AccessChain 22(block) 24 + 69: 6(int64_t) Load 8(element) + CooperativeVectorReduceSumAccumulateNV 68 69 67 + 72: 6(int64_t) Load 8(element) + 73: 27(ptr) AccessChain 22(block) 24 72 + 74: 18(float) Load 73 MakePointerVisibleKHR NonPrivatePointerKHR 26 + Store 71(y) 74 + 77: 11(int) ArrayLength 22(block) 0 + 78: 23(int) Bitcast 77 + Store 76(len) 78 + 82: 6(int64_t) ArrayLength 22(block) 0 + 83: 79(int64_t) Bitcast 82 + Store 81(len64) 83 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.64bit_indexing_error.comp.out b/third_party/glslang/Test/baseResults/spv.64bit_indexing_error.comp.out new file mode 100644 index 0000000000..e65e82ab9d --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.64bit_indexing_error.comp.out @@ -0,0 +1,15 @@ +spv.64bit_indexing_error.comp +ERROR: 0:20: 'coopMatLoad' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 0:21: 'coopMatStore' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 0:24: 'coopVecMatMulAddNV' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 0:25: 'coopVecMatMulNV' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 0:26: 'coopVecLoadNV' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 0:27: 'coopVecStoreNV' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 0:28: 'coopVecOuterProductAccumulateNV' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 0:29: 'coopVecReduceSumAccumulateNV' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 0:31: '[]' : scalar integer expression required +ERROR: 0:33: 'length64' : required extension not requested: GL_EXT_shader_64bit_indexing +ERROR: 10 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.16BitAccess.comp.out b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.16BitAccess.comp.out index e5496d320c..9bdc90ee87 100644 --- a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.16BitAccess.comp.out +++ b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.16BitAccess.comp.out @@ -6,8 +6,8 @@ spv.WorkgroupMemoryExplicitLayout.16BitAccess.comp Capability Shader Capability Float16 Capability Int16 - Capability CapabilityWorkgroupMemoryExplicitLayoutKHR - Capability CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR + Capability WorkgroupMemoryExplicitLayoutKHR + Capability WorkgroupMemoryExplicitLayout16BitAccessKHR Extension "SPV_KHR_workgroup_memory_explicit_layout" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.8BitAccess.comp.out b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.8BitAccess.comp.out index a3f16954b8..f7129ee26a 100644 --- a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.8BitAccess.comp.out +++ b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.8BitAccess.comp.out @@ -5,8 +5,8 @@ spv.WorkgroupMemoryExplicitLayout.8BitAccess.comp Capability Shader Capability Int8 - Capability CapabilityWorkgroupMemoryExplicitLayoutKHR - Capability CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR + Capability WorkgroupMemoryExplicitLayoutKHR + Capability WorkgroupMemoryExplicitLayout8BitAccessKHR Extension "SPV_KHR_workgroup_memory_explicit_layout" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.MultiBlock.comp.out b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.MultiBlock.comp.out index 33cae8b54c..2600a72aa5 100644 --- a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.MultiBlock.comp.out +++ b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.MultiBlock.comp.out @@ -4,7 +4,7 @@ spv.WorkgroupMemoryExplicitLayout.MultiBlock.comp // Id's are bound by 24 Capability Shader - Capability CapabilityWorkgroupMemoryExplicitLayoutKHR + Capability WorkgroupMemoryExplicitLayoutKHR Extension "SPV_KHR_workgroup_memory_explicit_layout" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.SingleBlock.comp.out b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.SingleBlock.comp.out index 2d484770e7..6f1176f284 100644 --- a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.SingleBlock.comp.out +++ b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.SingleBlock.comp.out @@ -4,7 +4,7 @@ spv.WorkgroupMemoryExplicitLayout.SingleBlock.comp // Id's are bound by 19 Capability Shader - Capability CapabilityWorkgroupMemoryExplicitLayoutKHR + Capability WorkgroupMemoryExplicitLayoutKHR Extension "SPV_KHR_workgroup_memory_explicit_layout" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.scalar.comp.out b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.scalar.comp.out index a651b6352b..4a24e5cb43 100644 --- a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.scalar.comp.out +++ b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.scalar.comp.out @@ -4,7 +4,7 @@ spv.WorkgroupMemoryExplicitLayout.scalar.comp // Id's are bound by 29 Capability Shader - Capability CapabilityWorkgroupMemoryExplicitLayoutKHR + Capability WorkgroupMemoryExplicitLayoutKHR Extension "SPV_KHR_workgroup_memory_explicit_layout" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.std140.comp.out b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.std140.comp.out index bc8a5f64aa..228b33679c 100644 --- a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.std140.comp.out +++ b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.std140.comp.out @@ -4,7 +4,7 @@ spv.WorkgroupMemoryExplicitLayout.std140.comp // Id's are bound by 29 Capability Shader - Capability CapabilityWorkgroupMemoryExplicitLayoutKHR + Capability WorkgroupMemoryExplicitLayoutKHR Extension "SPV_KHR_workgroup_memory_explicit_layout" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.std430.comp.out b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.std430.comp.out index a60209d93b..8c4a206916 100644 --- a/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.std430.comp.out +++ b/third_party/glslang/Test/baseResults/spv.WorkgroupMemoryExplicitLayout.std430.comp.out @@ -4,7 +4,7 @@ spv.WorkgroupMemoryExplicitLayout.std430.comp // Id's are bound by 29 Capability Shader - Capability CapabilityWorkgroupMemoryExplicitLayoutKHR + Capability WorkgroupMemoryExplicitLayoutKHR Extension "SPV_KHR_workgroup_memory_explicit_layout" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.atomicFloat.comp.out b/third_party/glslang/Test/baseResults/spv.atomicFloat.comp.out index a19291afce..f59689b8d5 100644 --- a/third_party/glslang/Test/baseResults/spv.atomicFloat.comp.out +++ b/third_party/glslang/Test/baseResults/spv.atomicFloat.comp.out @@ -2,7 +2,7 @@ spv.atomicFloat.comp Validation failed // Module Version 10300 // Generated by (magic number): 8000b -// Id's are bound by 470 +// Id's are bound by 476 Capability Shader Capability Float64 @@ -29,38 +29,38 @@ Validation failed MemberName 25(Buffer) 0 "dataf" MemberName 25(Buffer) 1 "datad" Name 27 "buf" - Name 34 "resultd" - Name 37 "atomd" - Name 143 "fimage1D" - Name 189 "fimage1DArray" - Name 232 "fimage2D" - Name 270 "fimage2DRect" - Name 308 "fimage2DArray" - Name 352 "fimageCube" - Name 392 "fimageCubeArray" - Name 430 "fimage3D" + Name 35 "resultd" + Name 38 "atomd" + Name 148 "fimage1D" + Name 195 "fimage1DArray" + Name 238 "fimage2D" + Name 276 "fimage2DRect" + Name 314 "fimage2DArray" + Name 358 "fimageCube" + Name 398 "fimageCubeArray" + Name 436 "fimage3D" Decorate 25(Buffer) Block MemberDecorate 25(Buffer) 0 Offset 0 MemberDecorate 25(Buffer) 1 Offset 8 Decorate 27(buf) Binding 0 Decorate 27(buf) DescriptorSet 0 - Decorate 143(fimage1D) Binding 0 - Decorate 143(fimage1D) DescriptorSet 0 - Decorate 189(fimage1DArray) Binding 1 - Decorate 189(fimage1DArray) DescriptorSet 0 - Decorate 232(fimage2D) Binding 2 - Decorate 232(fimage2D) DescriptorSet 0 - Decorate 270(fimage2DRect) Binding 4 - Decorate 270(fimage2DRect) DescriptorSet 0 - Decorate 308(fimage2DArray) Binding 3 - Decorate 308(fimage2DArray) DescriptorSet 0 - Decorate 352(fimageCube) Binding 5 - Decorate 352(fimageCube) DescriptorSet 0 - Decorate 392(fimageCubeArray) Binding 6 - Decorate 392(fimageCubeArray) DescriptorSet 0 - Decorate 430(fimage3D) Binding 9 - Decorate 430(fimage3D) DescriptorSet 0 - Decorate 469 BuiltIn WorkgroupSize + Decorate 148(fimage1D) Binding 0 + Decorate 148(fimage1D) DescriptorSet 0 + Decorate 195(fimage1DArray) Binding 1 + Decorate 195(fimage1DArray) DescriptorSet 0 + Decorate 238(fimage2D) Binding 2 + Decorate 238(fimage2D) DescriptorSet 0 + Decorate 276(fimage2DRect) Binding 4 + Decorate 276(fimage2DRect) DescriptorSet 0 + Decorate 314(fimage2DArray) Binding 3 + Decorate 314(fimage2DArray) DescriptorSet 0 + Decorate 358(fimageCube) Binding 5 + Decorate 358(fimageCube) DescriptorSet 0 + Decorate 398(fimageCubeArray) Binding 6 + Decorate 398(fimageCubeArray) DescriptorSet 0 + Decorate 436(fimage3D) Binding 9 + Decorate 436(fimage3D) DescriptorSet 0 + Decorate 475 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -76,576 +76,582 @@ Validation failed 18: TypeInt 32 1 19: 18(int) Constant 1 20: 18(int) Constant 64 - 21: 18(int) Constant 0 - 22: 13(int) Constant 64 + 21: 18(int) Constant 8 + 22: 13(int) Constant 72 24: TypeFloat 64 25(Buffer): TypeStruct 6(float) 24(float64_t) 26: TypePointer StorageBuffer 25(Buffer) 27(buf): 26(ptr) Variable StorageBuffer - 28: TypePointer StorageBuffer 6(float) - 33: TypePointer Function 24(float64_t) - 35:24(float64_t) Constant 0 0 - 36: TypePointer Workgroup 24(float64_t) - 37(atomd): 36(ptr) Variable Workgroup - 38:24(float64_t) Constant 0 1074266112 - 40:24(float64_t) Constant 0 1074921472 - 42: TypePointer StorageBuffer 24(float64_t) - 57: 18(int) Constant 256 - 58: 13(int) Constant 256 - 141: TypeImage 6(float) 1D nonsampled format:R32f - 142: TypePointer UniformConstant 141 - 143(fimage1D): 142(ptr) Variable UniformConstant - 144: 6(float) Constant 1073741824 - 145: TypePointer Image 6(float) - 147: 13(int) Constant 32768 - 149: 13(int) Constant 2 - 155: 18(int) Constant 2048 - 157: 13(int) Constant 2048 - 164: 6(float) Constant 1082130432 - 179: 18(int) Constant 2 - 187: TypeImage 6(float) 1D array nonsampled format:R32f - 188: TypePointer UniformConstant 187 -189(fimage1DArray): 188(ptr) Variable UniformConstant - 190: TypeVector 18(int) 2 - 191: 190(ivec2) ConstantComposite 21 21 - 199: 190(ivec2) ConstantComposite 19 19 - 207: 190(ivec2) ConstantComposite 19 21 - 222: 190(ivec2) ConstantComposite 179 179 - 230: TypeImage 6(float) 2D nonsampled format:R32f - 231: TypePointer UniformConstant 230 - 232(fimage2D): 231(ptr) Variable UniformConstant - 268: TypeImage 6(float) Rect nonsampled format:R32f - 269: TypePointer UniformConstant 268 -270(fimage2DRect): 269(ptr) Variable UniformConstant - 306: TypeImage 6(float) 2D array nonsampled format:R32f - 307: TypePointer UniformConstant 306 -308(fimage2DArray): 307(ptr) Variable UniformConstant - 309: TypeVector 18(int) 3 - 310: 309(ivec3) ConstantComposite 21 21 21 - 318: 309(ivec3) ConstantComposite 19 19 21 - 326: 309(ivec3) ConstantComposite 19 21 19 - 334: 309(ivec3) ConstantComposite 19 19 19 - 342: 309(ivec3) ConstantComposite 179 179 21 - 350: TypeImage 6(float) Cube nonsampled format:R32f - 351: TypePointer UniformConstant 350 - 352(fimageCube): 351(ptr) Variable UniformConstant - 367: 309(ivec3) ConstantComposite 19 21 21 - 382: 309(ivec3) ConstantComposite 179 179 19 - 390: TypeImage 6(float) Cube array nonsampled format:R32f - 391: TypePointer UniformConstant 390 -392(fimageCubeArray): 391(ptr) Variable UniformConstant - 428: TypeImage 6(float) 3D nonsampled format:R32f - 429: TypePointer UniformConstant 428 - 430(fimage3D): 429(ptr) Variable UniformConstant - 466: TypeVector 13(int) 3 - 467: 13(int) Constant 16 - 468: 13(int) Constant 1 - 469: 466(ivec3) ConstantComposite 467 467 468 + 28: 18(int) Constant 0 + 29: TypePointer StorageBuffer 6(float) + 34: TypePointer Function 24(float64_t) + 36:24(float64_t) Constant 0 0 + 37: TypePointer Workgroup 24(float64_t) + 38(atomd): 37(ptr) Variable Workgroup + 39:24(float64_t) Constant 0 1074266112 + 41:24(float64_t) Constant 0 1074921472 + 43: TypePointer StorageBuffer 24(float64_t) + 58: 18(int) Constant 256 + 59: 13(int) Constant 264 + 111: 18(int) Constant 2 + 112: 13(int) Constant 258 + 116: 18(int) Constant 4 + 117: 13(int) Constant 260 + 146: TypeImage 6(float) 1D nonsampled format:R32f + 147: TypePointer UniformConstant 146 + 148(fimage1D): 147(ptr) Variable UniformConstant + 149: 6(float) Constant 1073741824 + 150: TypePointer Image 6(float) + 152: 13(int) Constant 32768 + 154: 13(int) Constant 2 + 160: 18(int) Constant 2048 + 162: 13(int) Constant 2056 + 169: 6(float) Constant 1082130432 + 178: 13(int) Constant 2050 + 187: 13(int) Constant 2052 + 193: TypeImage 6(float) 1D array nonsampled format:R32f + 194: TypePointer UniformConstant 193 +195(fimage1DArray): 194(ptr) Variable UniformConstant + 196: TypeVector 18(int) 2 + 197: 196(ivec2) ConstantComposite 28 28 + 205: 196(ivec2) ConstantComposite 19 19 + 213: 196(ivec2) ConstantComposite 19 28 + 228: 196(ivec2) ConstantComposite 111 111 + 236: TypeImage 6(float) 2D nonsampled format:R32f + 237: TypePointer UniformConstant 236 + 238(fimage2D): 237(ptr) Variable UniformConstant + 274: TypeImage 6(float) Rect nonsampled format:R32f + 275: TypePointer UniformConstant 274 +276(fimage2DRect): 275(ptr) Variable UniformConstant + 312: TypeImage 6(float) 2D array nonsampled format:R32f + 313: TypePointer UniformConstant 312 +314(fimage2DArray): 313(ptr) Variable UniformConstant + 315: TypeVector 18(int) 3 + 316: 315(ivec3) ConstantComposite 28 28 28 + 324: 315(ivec3) ConstantComposite 19 19 28 + 332: 315(ivec3) ConstantComposite 19 28 19 + 340: 315(ivec3) ConstantComposite 19 19 19 + 348: 315(ivec3) ConstantComposite 111 111 28 + 356: TypeImage 6(float) Cube nonsampled format:R32f + 357: TypePointer UniformConstant 356 + 358(fimageCube): 357(ptr) Variable UniformConstant + 373: 315(ivec3) ConstantComposite 19 28 28 + 388: 315(ivec3) ConstantComposite 111 111 19 + 396: TypeImage 6(float) Cube array nonsampled format:R32f + 397: TypePointer UniformConstant 396 +398(fimageCubeArray): 397(ptr) Variable UniformConstant + 434: TypeImage 6(float) 3D nonsampled format:R32f + 435: TypePointer UniformConstant 434 + 436(fimage3D): 435(ptr) Variable UniformConstant + 472: TypeVector 13(int) 3 + 473: 13(int) Constant 16 + 474: 13(int) Constant 1 + 475: 472(ivec3) ConstantComposite 473 473 474 4(main): 2 Function None 3 5: Label 8(resultf): 7(ptr) Variable Function - 34(resultd): 33(ptr) Variable Function + 35(resultd): 34(ptr) Variable Function Store 8(resultf) 9 16: 6(float) AtomicFAddEXT 11(atomf) 14 15 12 Store 8(resultf) 16 23: 6(float) AtomicFAddEXT 11(atomf) 19 22 17 Store 8(resultf) 23 - 29: 28(ptr) AccessChain 27(buf) 21 - 30: 6(float) AtomicFAddEXT 29 14 15 12 - Store 8(resultf) 30 - 31: 28(ptr) AccessChain 27(buf) 21 - 32: 6(float) AtomicFAddEXT 31 19 22 17 - Store 8(resultf) 32 - Store 34(resultd) 35 - 39:24(float64_t) AtomicFAddEXT 37(atomd) 14 15 38 - Store 34(resultd) 39 - 41:24(float64_t) AtomicFAddEXT 37(atomd) 19 22 40 - Store 34(resultd) 41 - 43: 42(ptr) AccessChain 27(buf) 19 - 44:24(float64_t) AtomicFAddEXT 43 14 15 38 - Store 34(resultd) 44 - 45: 42(ptr) AccessChain 27(buf) 19 - 46:24(float64_t) AtomicFAddEXT 45 19 22 40 - Store 34(resultd) 46 - 47: 28(ptr) AccessChain 27(buf) 21 - 48: 6(float) Load 8(resultf) - 49: 6(float) AtomicExchange 47 14 15 48 - Store 8(resultf) 49 - 50: 6(float) Load 8(resultf) - 51: 28(ptr) AccessChain 27(buf) 21 - 52: 6(float) Load 51 - 53: 6(float) FAdd 52 50 - 54: 28(ptr) AccessChain 27(buf) 21 - Store 54 53 - 55: 28(ptr) AccessChain 27(buf) 21 - 56: 6(float) Load 8(resultf) - 59: 6(float) AtomicExchange 55 19 58 56 - Store 8(resultf) 59 - 60: 6(float) Load 8(resultf) - 61: 28(ptr) AccessChain 27(buf) 21 - 62: 6(float) Load 61 - 63: 6(float) FAdd 62 60 - 64: 28(ptr) AccessChain 27(buf) 21 - Store 64 63 - 65: 6(float) Load 8(resultf) - 66: 6(float) AtomicExchange 11(atomf) 14 15 65 - Store 8(resultf) 66 - 67: 6(float) Load 8(resultf) - 68: 28(ptr) AccessChain 27(buf) 21 - 69: 6(float) Load 68 - 70: 6(float) FAdd 69 67 - 71: 28(ptr) AccessChain 27(buf) 21 - Store 71 70 - 72: 6(float) Load 8(resultf) - 73: 6(float) AtomicExchange 11(atomf) 19 58 72 - Store 8(resultf) 73 - 74: 6(float) Load 8(resultf) - 75: 28(ptr) AccessChain 27(buf) 21 - 76: 6(float) Load 75 - 77: 6(float) FAdd 76 74 - 78: 28(ptr) AccessChain 27(buf) 21 - Store 78 77 - 79: 42(ptr) AccessChain 27(buf) 19 - 80:24(float64_t) Load 34(resultd) - 81:24(float64_t) AtomicExchange 79 14 15 80 - Store 34(resultd) 81 - 82:24(float64_t) Load 34(resultd) - 83: 42(ptr) AccessChain 27(buf) 19 - 84:24(float64_t) Load 83 - 85:24(float64_t) FAdd 84 82 - 86: 42(ptr) AccessChain 27(buf) 19 - Store 86 85 - 87: 42(ptr) AccessChain 27(buf) 19 - 88:24(float64_t) Load 34(resultd) - 89:24(float64_t) AtomicExchange 87 19 58 88 - Store 34(resultd) 89 - 90:24(float64_t) Load 34(resultd) - 91: 42(ptr) AccessChain 27(buf) 19 - 92:24(float64_t) Load 91 - 93:24(float64_t) FAdd 92 90 - 94: 42(ptr) AccessChain 27(buf) 19 - Store 94 93 - 95:24(float64_t) Load 34(resultd) - 96:24(float64_t) AtomicExchange 37(atomd) 14 15 95 - Store 34(resultd) 96 - 97:24(float64_t) Load 34(resultd) - 98: 42(ptr) AccessChain 27(buf) 19 - 99:24(float64_t) Load 98 - 100:24(float64_t) FAdd 99 97 - 101: 42(ptr) AccessChain 27(buf) 19 - Store 101 100 - 102:24(float64_t) Load 34(resultd) - 103:24(float64_t) AtomicExchange 37(atomd) 19 58 102 - Store 34(resultd) 103 - 104:24(float64_t) Load 34(resultd) - 105: 42(ptr) AccessChain 27(buf) 19 - 106:24(float64_t) Load 105 - 107:24(float64_t) FAdd 106 104 - 108: 42(ptr) AccessChain 27(buf) 19 - Store 108 107 - 109: 28(ptr) AccessChain 27(buf) 21 - 110: 6(float) AtomicLoad 109 19 58 - Store 8(resultf) 110 - 111: 28(ptr) AccessChain 27(buf) 21 - 112: 6(float) Load 8(resultf) - AtomicStore 111 19 58 112 - 113: 6(float) Load 8(resultf) - 114: 28(ptr) AccessChain 27(buf) 21 - 115: 6(float) Load 114 - 116: 6(float) FAdd 115 113 - 117: 28(ptr) AccessChain 27(buf) 21 - Store 117 116 - 118: 6(float) AtomicLoad 11(atomf) 19 58 - Store 8(resultf) 118 - 119: 6(float) Load 8(resultf) - AtomicStore 11(atomf) 19 58 119 - 120: 6(float) Load 8(resultf) - 121: 28(ptr) AccessChain 27(buf) 21 - 122: 6(float) Load 121 - 123: 6(float) FAdd 122 120 - 124: 28(ptr) AccessChain 27(buf) 21 - Store 124 123 - 125: 42(ptr) AccessChain 27(buf) 19 - 126:24(float64_t) AtomicLoad 125 19 58 - Store 34(resultd) 126 - 127: 42(ptr) AccessChain 27(buf) 19 - 128:24(float64_t) Load 34(resultd) - AtomicStore 127 19 58 128 - 129:24(float64_t) Load 34(resultd) - 130: 42(ptr) AccessChain 27(buf) 19 - 131:24(float64_t) Load 130 - 132:24(float64_t) FAdd 131 129 - 133: 42(ptr) AccessChain 27(buf) 19 - Store 133 132 - 134:24(float64_t) AtomicLoad 37(atomd) 19 58 - Store 34(resultd) 134 - 135:24(float64_t) Load 34(resultd) - AtomicStore 37(atomd) 19 58 135 - 136:24(float64_t) Load 34(resultd) - 137: 42(ptr) AccessChain 27(buf) 19 - 138:24(float64_t) Load 137 - 139:24(float64_t) FAdd 138 136 - 140: 42(ptr) AccessChain 27(buf) 19 - Store 140 139 - 146: 145(ptr) ImageTexelPointer 143(fimage1D) 21 15 - 148: 6(float) AtomicFAddEXT 146 14 147 144 - Store 11(atomf) 148 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 150: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 151: 28(ptr) AccessChain 27(buf) 21 - 152: 6(float) Load 151 - 153: 6(float) FAdd 152 150 - 154: 28(ptr) AccessChain 27(buf) 21 - Store 154 153 - 156: 145(ptr) ImageTexelPointer 143(fimage1D) 19 15 - 158: 6(float) AtomicFAddEXT 156 19 157 12 - Store 11(atomf) 158 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 159: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 160: 28(ptr) AccessChain 27(buf) 21 - 161: 6(float) Load 160 - 162: 6(float) FAdd 161 159 - 163: 28(ptr) AccessChain 27(buf) 21 - Store 163 162 - 165: 145(ptr) ImageTexelPointer 143(fimage1D) 19 15 - 166: 6(float) AtomicExchange 165 19 157 164 - Store 11(atomf) 166 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 167: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 168: 28(ptr) AccessChain 27(buf) 21 - 169: 6(float) Load 168 - 170: 6(float) FAdd 169 167 - 171: 28(ptr) AccessChain 27(buf) 21 - Store 171 170 - 172: 145(ptr) ImageTexelPointer 143(fimage1D) 19 15 - 173: 6(float) AtomicLoad 172 19 157 - Store 11(atomf) 173 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 174: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 175: 28(ptr) AccessChain 27(buf) 21 - 176: 6(float) Load 175 - 177: 6(float) FAdd 176 174 - 178: 28(ptr) AccessChain 27(buf) 21 - Store 178 177 - 180: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 181: 145(ptr) ImageTexelPointer 143(fimage1D) 179 15 - AtomicStore 181 19 157 180 - 182: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 183: 28(ptr) AccessChain 27(buf) 21 - 184: 6(float) Load 183 - 185: 6(float) FAdd 184 182 - 186: 28(ptr) AccessChain 27(buf) 21 - Store 186 185 - 192: 145(ptr) ImageTexelPointer 189(fimage1DArray) 191 15 - 193: 6(float) AtomicFAddEXT 192 14 147 144 - Store 11(atomf) 193 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 194: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 195: 28(ptr) AccessChain 27(buf) 21 - 196: 6(float) Load 195 - 197: 6(float) FAdd 196 194 - 198: 28(ptr) AccessChain 27(buf) 21 - Store 198 197 - 200: 145(ptr) ImageTexelPointer 189(fimage1DArray) 199 15 - 201: 6(float) AtomicFAddEXT 200 19 157 12 - Store 11(atomf) 201 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 202: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 203: 28(ptr) AccessChain 27(buf) 21 - 204: 6(float) Load 203 - 205: 6(float) FAdd 204 202 - 206: 28(ptr) AccessChain 27(buf) 21 - Store 206 205 - 208: 145(ptr) ImageTexelPointer 189(fimage1DArray) 207 15 - 209: 6(float) AtomicExchange 208 19 157 164 - Store 11(atomf) 209 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 210: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 211: 28(ptr) AccessChain 27(buf) 21 - 212: 6(float) Load 211 - 213: 6(float) FAdd 212 210 - 214: 28(ptr) AccessChain 27(buf) 21 - Store 214 213 - 215: 145(ptr) ImageTexelPointer 189(fimage1DArray) 199 15 - 216: 6(float) AtomicLoad 215 19 157 - Store 11(atomf) 216 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 217: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 218: 28(ptr) AccessChain 27(buf) 21 - 219: 6(float) Load 218 - 220: 6(float) FAdd 219 217 - 221: 28(ptr) AccessChain 27(buf) 21 - Store 221 220 - 223: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 224: 145(ptr) ImageTexelPointer 189(fimage1DArray) 222 15 - AtomicStore 224 19 157 223 - 225: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 226: 28(ptr) AccessChain 27(buf) 21 - 227: 6(float) Load 226 - 228: 6(float) FAdd 227 225 - 229: 28(ptr) AccessChain 27(buf) 21 - Store 229 228 - 233: 145(ptr) ImageTexelPointer 232(fimage2D) 191 15 - 234: 6(float) AtomicFAddEXT 233 14 147 144 - Store 11(atomf) 234 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 235: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 236: 28(ptr) AccessChain 27(buf) 21 - 237: 6(float) Load 236 - 238: 6(float) FAdd 237 235 - 239: 28(ptr) AccessChain 27(buf) 21 - Store 239 238 - 240: 145(ptr) ImageTexelPointer 232(fimage2D) 199 15 - 241: 6(float) AtomicFAddEXT 240 19 157 12 - Store 11(atomf) 241 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 242: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 243: 28(ptr) AccessChain 27(buf) 21 - 244: 6(float) Load 243 - 245: 6(float) FAdd 244 242 - 246: 28(ptr) AccessChain 27(buf) 21 - Store 246 245 - 247: 145(ptr) ImageTexelPointer 232(fimage2D) 207 15 - 248: 6(float) AtomicExchange 247 19 157 164 - Store 11(atomf) 248 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 249: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 250: 28(ptr) AccessChain 27(buf) 21 - 251: 6(float) Load 250 - 252: 6(float) FAdd 251 249 - 253: 28(ptr) AccessChain 27(buf) 21 - Store 253 252 - 254: 145(ptr) ImageTexelPointer 232(fimage2D) 199 15 - 255: 6(float) AtomicLoad 254 19 157 - Store 11(atomf) 255 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 256: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 257: 28(ptr) AccessChain 27(buf) 21 - 258: 6(float) Load 257 - 259: 6(float) FAdd 258 256 - 260: 28(ptr) AccessChain 27(buf) 21 - Store 260 259 - 261: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 262: 145(ptr) ImageTexelPointer 232(fimage2D) 222 15 - AtomicStore 262 19 157 261 - 263: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 264: 28(ptr) AccessChain 27(buf) 21 - 265: 6(float) Load 264 - 266: 6(float) FAdd 265 263 - 267: 28(ptr) AccessChain 27(buf) 21 - Store 267 266 - 271: 145(ptr) ImageTexelPointer 270(fimage2DRect) 191 15 - 272: 6(float) AtomicFAddEXT 271 14 147 144 - Store 11(atomf) 272 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 273: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 274: 28(ptr) AccessChain 27(buf) 21 - 275: 6(float) Load 274 - 276: 6(float) FAdd 275 273 - 277: 28(ptr) AccessChain 27(buf) 21 - Store 277 276 - 278: 145(ptr) ImageTexelPointer 270(fimage2DRect) 199 15 - 279: 6(float) AtomicFAddEXT 278 19 157 12 - Store 11(atomf) 279 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 280: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 281: 28(ptr) AccessChain 27(buf) 21 - 282: 6(float) Load 281 - 283: 6(float) FAdd 282 280 - 284: 28(ptr) AccessChain 27(buf) 21 - Store 284 283 - 285: 145(ptr) ImageTexelPointer 270(fimage2DRect) 207 15 - 286: 6(float) AtomicExchange 285 19 157 164 - Store 11(atomf) 286 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 287: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 288: 28(ptr) AccessChain 27(buf) 21 - 289: 6(float) Load 288 - 290: 6(float) FAdd 289 287 - 291: 28(ptr) AccessChain 27(buf) 21 - Store 291 290 - 292: 145(ptr) ImageTexelPointer 270(fimage2DRect) 199 15 - 293: 6(float) AtomicLoad 292 19 157 - Store 11(atomf) 293 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 294: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 295: 28(ptr) AccessChain 27(buf) 21 - 296: 6(float) Load 295 - 297: 6(float) FAdd 296 294 - 298: 28(ptr) AccessChain 27(buf) 21 - Store 298 297 - 299: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 300: 145(ptr) ImageTexelPointer 270(fimage2DRect) 222 15 - AtomicStore 300 19 157 299 - 301: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 302: 28(ptr) AccessChain 27(buf) 21 - 303: 6(float) Load 302 - 304: 6(float) FAdd 303 301 - 305: 28(ptr) AccessChain 27(buf) 21 - Store 305 304 - 311: 145(ptr) ImageTexelPointer 308(fimage2DArray) 310 15 - 312: 6(float) AtomicFAddEXT 311 14 147 144 - Store 11(atomf) 312 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 313: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 314: 28(ptr) AccessChain 27(buf) 21 - 315: 6(float) Load 314 - 316: 6(float) FAdd 315 313 - 317: 28(ptr) AccessChain 27(buf) 21 - Store 317 316 - 319: 145(ptr) ImageTexelPointer 308(fimage2DArray) 318 15 - 320: 6(float) AtomicFAddEXT 319 19 157 12 - Store 11(atomf) 320 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 321: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 322: 28(ptr) AccessChain 27(buf) 21 - 323: 6(float) Load 322 - 324: 6(float) FAdd 323 321 - 325: 28(ptr) AccessChain 27(buf) 21 - Store 325 324 - 327: 145(ptr) ImageTexelPointer 308(fimage2DArray) 326 15 - 328: 6(float) AtomicExchange 327 19 157 164 - Store 11(atomf) 328 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 329: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 330: 28(ptr) AccessChain 27(buf) 21 - 331: 6(float) Load 330 - 332: 6(float) FAdd 331 329 - 333: 28(ptr) AccessChain 27(buf) 21 - Store 333 332 - 335: 145(ptr) ImageTexelPointer 308(fimage2DArray) 334 15 - 336: 6(float) AtomicLoad 335 19 157 - Store 11(atomf) 336 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 337: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 338: 28(ptr) AccessChain 27(buf) 21 - 339: 6(float) Load 338 - 340: 6(float) FAdd 339 337 - 341: 28(ptr) AccessChain 27(buf) 21 - Store 341 340 - 343: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 344: 145(ptr) ImageTexelPointer 308(fimage2DArray) 342 15 - AtomicStore 344 19 157 343 - 345: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 346: 28(ptr) AccessChain 27(buf) 21 - 347: 6(float) Load 346 - 348: 6(float) FAdd 347 345 - 349: 28(ptr) AccessChain 27(buf) 21 - Store 349 348 - 353: 145(ptr) ImageTexelPointer 352(fimageCube) 310 15 - 354: 6(float) AtomicFAddEXT 353 14 147 144 - Store 11(atomf) 354 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 355: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 356: 28(ptr) AccessChain 27(buf) 21 - 357: 6(float) Load 356 - 358: 6(float) FAdd 357 355 - 359: 28(ptr) AccessChain 27(buf) 21 - Store 359 358 - 360: 145(ptr) ImageTexelPointer 352(fimageCube) 318 15 - 361: 6(float) AtomicFAddEXT 360 19 157 12 - Store 11(atomf) 361 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 362: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 363: 28(ptr) AccessChain 27(buf) 21 - 364: 6(float) Load 363 - 365: 6(float) FAdd 364 362 - 366: 28(ptr) AccessChain 27(buf) 21 - Store 366 365 - 368: 145(ptr) ImageTexelPointer 352(fimageCube) 367 15 - 369: 6(float) AtomicExchange 368 19 157 164 - Store 11(atomf) 369 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 370: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 371: 28(ptr) AccessChain 27(buf) 21 - 372: 6(float) Load 371 - 373: 6(float) FAdd 372 370 - 374: 28(ptr) AccessChain 27(buf) 21 - Store 374 373 - 375: 145(ptr) ImageTexelPointer 352(fimageCube) 334 15 - 376: 6(float) AtomicLoad 375 19 157 - Store 11(atomf) 376 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 377: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 378: 28(ptr) AccessChain 27(buf) 21 - 379: 6(float) Load 378 - 380: 6(float) FAdd 379 377 - 381: 28(ptr) AccessChain 27(buf) 21 - Store 381 380 - 383: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 384: 145(ptr) ImageTexelPointer 352(fimageCube) 382 15 - AtomicStore 384 19 157 383 - 385: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 386: 28(ptr) AccessChain 27(buf) 21 - 387: 6(float) Load 386 - 388: 6(float) FAdd 387 385 - 389: 28(ptr) AccessChain 27(buf) 21 - Store 389 388 - 393: 145(ptr) ImageTexelPointer 392(fimageCubeArray) 310 15 - 394: 6(float) AtomicFAddEXT 393 14 147 144 - Store 11(atomf) 394 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 395: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 396: 28(ptr) AccessChain 27(buf) 21 - 397: 6(float) Load 396 - 398: 6(float) FAdd 397 395 - 399: 28(ptr) AccessChain 27(buf) 21 - Store 399 398 - 400: 145(ptr) ImageTexelPointer 392(fimageCubeArray) 318 15 - 401: 6(float) AtomicFAddEXT 400 19 157 12 - Store 11(atomf) 401 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 402: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 403: 28(ptr) AccessChain 27(buf) 21 - 404: 6(float) Load 403 - 405: 6(float) FAdd 404 402 - 406: 28(ptr) AccessChain 27(buf) 21 - Store 406 405 - 407: 145(ptr) ImageTexelPointer 392(fimageCubeArray) 326 15 - 408: 6(float) AtomicExchange 407 19 157 164 - Store 11(atomf) 408 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 409: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 410: 28(ptr) AccessChain 27(buf) 21 - 411: 6(float) Load 410 - 412: 6(float) FAdd 411 409 - 413: 28(ptr) AccessChain 27(buf) 21 - Store 413 412 - 414: 145(ptr) ImageTexelPointer 392(fimageCubeArray) 334 15 - 415: 6(float) AtomicLoad 414 19 157 - Store 11(atomf) 415 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 416: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 417: 28(ptr) AccessChain 27(buf) 21 - 418: 6(float) Load 417 - 419: 6(float) FAdd 418 416 - 420: 28(ptr) AccessChain 27(buf) 21 - Store 420 419 - 421: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 422: 145(ptr) ImageTexelPointer 392(fimageCubeArray) 342 15 - AtomicStore 422 19 157 421 - 423: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 424: 28(ptr) AccessChain 27(buf) 21 - 425: 6(float) Load 424 - 426: 6(float) FAdd 425 423 - 427: 28(ptr) AccessChain 27(buf) 21 - Store 427 426 - 431: 145(ptr) ImageTexelPointer 430(fimage3D) 310 15 - 432: 6(float) AtomicFAddEXT 431 14 147 144 - Store 11(atomf) 432 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 433: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 434: 28(ptr) AccessChain 27(buf) 21 - 435: 6(float) Load 434 - 436: 6(float) FAdd 435 433 - 437: 28(ptr) AccessChain 27(buf) 21 - Store 437 436 - 438: 145(ptr) ImageTexelPointer 430(fimage3D) 318 15 - 439: 6(float) AtomicFAddEXT 438 19 157 12 - Store 11(atomf) 439 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 440: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 441: 28(ptr) AccessChain 27(buf) 21 - 442: 6(float) Load 441 - 443: 6(float) FAdd 442 440 - 444: 28(ptr) AccessChain 27(buf) 21 - Store 444 443 - 445: 145(ptr) ImageTexelPointer 430(fimage3D) 326 15 - 446: 6(float) AtomicExchange 445 19 157 164 - Store 11(atomf) 446 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 447: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 448: 28(ptr) AccessChain 27(buf) 21 - 449: 6(float) Load 448 - 450: 6(float) FAdd 449 447 - 451: 28(ptr) AccessChain 27(buf) 21 - Store 451 450 - 452: 145(ptr) ImageTexelPointer 430(fimage3D) 334 15 - 453: 6(float) AtomicLoad 452 19 157 - Store 11(atomf) 453 MakePointerAvailableKHR NonPrivatePointerKHR 149 - 454: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 455: 28(ptr) AccessChain 27(buf) 21 - 456: 6(float) Load 455 - 457: 6(float) FAdd 456 454 - 458: 28(ptr) AccessChain 27(buf) 21 - Store 458 457 - 459: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 460: 145(ptr) ImageTexelPointer 430(fimage3D) 342 15 - AtomicStore 460 19 157 459 - 461: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 149 - 462: 28(ptr) AccessChain 27(buf) 21 - 463: 6(float) Load 462 - 464: 6(float) FAdd 463 461 - 465: 28(ptr) AccessChain 27(buf) 21 - Store 465 464 + 30: 29(ptr) AccessChain 27(buf) 28 + 31: 6(float) AtomicFAddEXT 30 14 15 12 + Store 8(resultf) 31 + 32: 29(ptr) AccessChain 27(buf) 28 + 33: 6(float) AtomicFAddEXT 32 19 22 17 + Store 8(resultf) 33 + Store 35(resultd) 36 + 40:24(float64_t) AtomicFAddEXT 38(atomd) 14 15 39 + Store 35(resultd) 40 + 42:24(float64_t) AtomicFAddEXT 38(atomd) 19 22 41 + Store 35(resultd) 42 + 44: 43(ptr) AccessChain 27(buf) 19 + 45:24(float64_t) AtomicFAddEXT 44 14 15 39 + Store 35(resultd) 45 + 46: 43(ptr) AccessChain 27(buf) 19 + 47:24(float64_t) AtomicFAddEXT 46 19 22 41 + Store 35(resultd) 47 + 48: 29(ptr) AccessChain 27(buf) 28 + 49: 6(float) Load 8(resultf) + 50: 6(float) AtomicExchange 48 14 15 49 + Store 8(resultf) 50 + 51: 6(float) Load 8(resultf) + 52: 29(ptr) AccessChain 27(buf) 28 + 53: 6(float) Load 52 + 54: 6(float) FAdd 53 51 + 55: 29(ptr) AccessChain 27(buf) 28 + Store 55 54 + 56: 29(ptr) AccessChain 27(buf) 28 + 57: 6(float) Load 8(resultf) + 60: 6(float) AtomicExchange 56 19 59 57 + Store 8(resultf) 60 + 61: 6(float) Load 8(resultf) + 62: 29(ptr) AccessChain 27(buf) 28 + 63: 6(float) Load 62 + 64: 6(float) FAdd 63 61 + 65: 29(ptr) AccessChain 27(buf) 28 + Store 65 64 + 66: 6(float) Load 8(resultf) + 67: 6(float) AtomicExchange 11(atomf) 14 15 66 + Store 8(resultf) 67 + 68: 6(float) Load 8(resultf) + 69: 29(ptr) AccessChain 27(buf) 28 + 70: 6(float) Load 69 + 71: 6(float) FAdd 70 68 + 72: 29(ptr) AccessChain 27(buf) 28 + Store 72 71 + 73: 6(float) Load 8(resultf) + 74: 6(float) AtomicExchange 11(atomf) 19 59 73 + Store 8(resultf) 74 + 75: 6(float) Load 8(resultf) + 76: 29(ptr) AccessChain 27(buf) 28 + 77: 6(float) Load 76 + 78: 6(float) FAdd 77 75 + 79: 29(ptr) AccessChain 27(buf) 28 + Store 79 78 + 80: 43(ptr) AccessChain 27(buf) 19 + 81:24(float64_t) Load 35(resultd) + 82:24(float64_t) AtomicExchange 80 14 15 81 + Store 35(resultd) 82 + 83:24(float64_t) Load 35(resultd) + 84: 43(ptr) AccessChain 27(buf) 19 + 85:24(float64_t) Load 84 + 86:24(float64_t) FAdd 85 83 + 87: 43(ptr) AccessChain 27(buf) 19 + Store 87 86 + 88: 43(ptr) AccessChain 27(buf) 19 + 89:24(float64_t) Load 35(resultd) + 90:24(float64_t) AtomicExchange 88 19 59 89 + Store 35(resultd) 90 + 91:24(float64_t) Load 35(resultd) + 92: 43(ptr) AccessChain 27(buf) 19 + 93:24(float64_t) Load 92 + 94:24(float64_t) FAdd 93 91 + 95: 43(ptr) AccessChain 27(buf) 19 + Store 95 94 + 96:24(float64_t) Load 35(resultd) + 97:24(float64_t) AtomicExchange 38(atomd) 14 15 96 + Store 35(resultd) 97 + 98:24(float64_t) Load 35(resultd) + 99: 43(ptr) AccessChain 27(buf) 19 + 100:24(float64_t) Load 99 + 101:24(float64_t) FAdd 100 98 + 102: 43(ptr) AccessChain 27(buf) 19 + Store 102 101 + 103:24(float64_t) Load 35(resultd) + 104:24(float64_t) AtomicExchange 38(atomd) 19 59 103 + Store 35(resultd) 104 + 105:24(float64_t) Load 35(resultd) + 106: 43(ptr) AccessChain 27(buf) 19 + 107:24(float64_t) Load 106 + 108:24(float64_t) FAdd 107 105 + 109: 43(ptr) AccessChain 27(buf) 19 + Store 109 108 + 110: 29(ptr) AccessChain 27(buf) 28 + 113: 6(float) AtomicLoad 110 19 112 + Store 8(resultf) 113 + 114: 29(ptr) AccessChain 27(buf) 28 + 115: 6(float) Load 8(resultf) + AtomicStore 114 19 117 115 + 118: 6(float) Load 8(resultf) + 119: 29(ptr) AccessChain 27(buf) 28 + 120: 6(float) Load 119 + 121: 6(float) FAdd 120 118 + 122: 29(ptr) AccessChain 27(buf) 28 + Store 122 121 + 123: 6(float) AtomicLoad 11(atomf) 19 112 + Store 8(resultf) 123 + 124: 6(float) Load 8(resultf) + AtomicStore 11(atomf) 19 117 124 + 125: 6(float) Load 8(resultf) + 126: 29(ptr) AccessChain 27(buf) 28 + 127: 6(float) Load 126 + 128: 6(float) FAdd 127 125 + 129: 29(ptr) AccessChain 27(buf) 28 + Store 129 128 + 130: 43(ptr) AccessChain 27(buf) 19 + 131:24(float64_t) AtomicLoad 130 19 112 + Store 35(resultd) 131 + 132: 43(ptr) AccessChain 27(buf) 19 + 133:24(float64_t) Load 35(resultd) + AtomicStore 132 19 117 133 + 134:24(float64_t) Load 35(resultd) + 135: 43(ptr) AccessChain 27(buf) 19 + 136:24(float64_t) Load 135 + 137:24(float64_t) FAdd 136 134 + 138: 43(ptr) AccessChain 27(buf) 19 + Store 138 137 + 139:24(float64_t) AtomicLoad 38(atomd) 19 112 + Store 35(resultd) 139 + 140:24(float64_t) Load 35(resultd) + AtomicStore 38(atomd) 19 117 140 + 141:24(float64_t) Load 35(resultd) + 142: 43(ptr) AccessChain 27(buf) 19 + 143:24(float64_t) Load 142 + 144:24(float64_t) FAdd 143 141 + 145: 43(ptr) AccessChain 27(buf) 19 + Store 145 144 + 151: 150(ptr) ImageTexelPointer 148(fimage1D) 28 15 + 153: 6(float) AtomicFAddEXT 151 14 152 149 + Store 11(atomf) 153 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 155: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 156: 29(ptr) AccessChain 27(buf) 28 + 157: 6(float) Load 156 + 158: 6(float) FAdd 157 155 + 159: 29(ptr) AccessChain 27(buf) 28 + Store 159 158 + 161: 150(ptr) ImageTexelPointer 148(fimage1D) 19 15 + 163: 6(float) AtomicFAddEXT 161 19 162 12 + Store 11(atomf) 163 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 164: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 165: 29(ptr) AccessChain 27(buf) 28 + 166: 6(float) Load 165 + 167: 6(float) FAdd 166 164 + 168: 29(ptr) AccessChain 27(buf) 28 + Store 168 167 + 170: 150(ptr) ImageTexelPointer 148(fimage1D) 19 15 + 171: 6(float) AtomicExchange 170 19 162 169 + Store 11(atomf) 171 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 172: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 173: 29(ptr) AccessChain 27(buf) 28 + 174: 6(float) Load 173 + 175: 6(float) FAdd 174 172 + 176: 29(ptr) AccessChain 27(buf) 28 + Store 176 175 + 177: 150(ptr) ImageTexelPointer 148(fimage1D) 19 15 + 179: 6(float) AtomicLoad 177 19 178 + Store 11(atomf) 179 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 180: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 181: 29(ptr) AccessChain 27(buf) 28 + 182: 6(float) Load 181 + 183: 6(float) FAdd 182 180 + 184: 29(ptr) AccessChain 27(buf) 28 + Store 184 183 + 185: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 186: 150(ptr) ImageTexelPointer 148(fimage1D) 111 15 + AtomicStore 186 19 187 185 + 188: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 189: 29(ptr) AccessChain 27(buf) 28 + 190: 6(float) Load 189 + 191: 6(float) FAdd 190 188 + 192: 29(ptr) AccessChain 27(buf) 28 + Store 192 191 + 198: 150(ptr) ImageTexelPointer 195(fimage1DArray) 197 15 + 199: 6(float) AtomicFAddEXT 198 14 152 149 + Store 11(atomf) 199 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 200: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 201: 29(ptr) AccessChain 27(buf) 28 + 202: 6(float) Load 201 + 203: 6(float) FAdd 202 200 + 204: 29(ptr) AccessChain 27(buf) 28 + Store 204 203 + 206: 150(ptr) ImageTexelPointer 195(fimage1DArray) 205 15 + 207: 6(float) AtomicFAddEXT 206 19 162 12 + Store 11(atomf) 207 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 208: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 209: 29(ptr) AccessChain 27(buf) 28 + 210: 6(float) Load 209 + 211: 6(float) FAdd 210 208 + 212: 29(ptr) AccessChain 27(buf) 28 + Store 212 211 + 214: 150(ptr) ImageTexelPointer 195(fimage1DArray) 213 15 + 215: 6(float) AtomicExchange 214 19 162 169 + Store 11(atomf) 215 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 216: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 217: 29(ptr) AccessChain 27(buf) 28 + 218: 6(float) Load 217 + 219: 6(float) FAdd 218 216 + 220: 29(ptr) AccessChain 27(buf) 28 + Store 220 219 + 221: 150(ptr) ImageTexelPointer 195(fimage1DArray) 205 15 + 222: 6(float) AtomicLoad 221 19 178 + Store 11(atomf) 222 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 223: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 224: 29(ptr) AccessChain 27(buf) 28 + 225: 6(float) Load 224 + 226: 6(float) FAdd 225 223 + 227: 29(ptr) AccessChain 27(buf) 28 + Store 227 226 + 229: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 230: 150(ptr) ImageTexelPointer 195(fimage1DArray) 228 15 + AtomicStore 230 19 187 229 + 231: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 232: 29(ptr) AccessChain 27(buf) 28 + 233: 6(float) Load 232 + 234: 6(float) FAdd 233 231 + 235: 29(ptr) AccessChain 27(buf) 28 + Store 235 234 + 239: 150(ptr) ImageTexelPointer 238(fimage2D) 197 15 + 240: 6(float) AtomicFAddEXT 239 14 152 149 + Store 11(atomf) 240 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 241: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 242: 29(ptr) AccessChain 27(buf) 28 + 243: 6(float) Load 242 + 244: 6(float) FAdd 243 241 + 245: 29(ptr) AccessChain 27(buf) 28 + Store 245 244 + 246: 150(ptr) ImageTexelPointer 238(fimage2D) 205 15 + 247: 6(float) AtomicFAddEXT 246 19 162 12 + Store 11(atomf) 247 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 248: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 249: 29(ptr) AccessChain 27(buf) 28 + 250: 6(float) Load 249 + 251: 6(float) FAdd 250 248 + 252: 29(ptr) AccessChain 27(buf) 28 + Store 252 251 + 253: 150(ptr) ImageTexelPointer 238(fimage2D) 213 15 + 254: 6(float) AtomicExchange 253 19 162 169 + Store 11(atomf) 254 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 255: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 256: 29(ptr) AccessChain 27(buf) 28 + 257: 6(float) Load 256 + 258: 6(float) FAdd 257 255 + 259: 29(ptr) AccessChain 27(buf) 28 + Store 259 258 + 260: 150(ptr) ImageTexelPointer 238(fimage2D) 205 15 + 261: 6(float) AtomicLoad 260 19 178 + Store 11(atomf) 261 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 262: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 263: 29(ptr) AccessChain 27(buf) 28 + 264: 6(float) Load 263 + 265: 6(float) FAdd 264 262 + 266: 29(ptr) AccessChain 27(buf) 28 + Store 266 265 + 267: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 268: 150(ptr) ImageTexelPointer 238(fimage2D) 228 15 + AtomicStore 268 19 187 267 + 269: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 270: 29(ptr) AccessChain 27(buf) 28 + 271: 6(float) Load 270 + 272: 6(float) FAdd 271 269 + 273: 29(ptr) AccessChain 27(buf) 28 + Store 273 272 + 277: 150(ptr) ImageTexelPointer 276(fimage2DRect) 197 15 + 278: 6(float) AtomicFAddEXT 277 14 152 149 + Store 11(atomf) 278 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 279: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 280: 29(ptr) AccessChain 27(buf) 28 + 281: 6(float) Load 280 + 282: 6(float) FAdd 281 279 + 283: 29(ptr) AccessChain 27(buf) 28 + Store 283 282 + 284: 150(ptr) ImageTexelPointer 276(fimage2DRect) 205 15 + 285: 6(float) AtomicFAddEXT 284 19 162 12 + Store 11(atomf) 285 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 286: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 287: 29(ptr) AccessChain 27(buf) 28 + 288: 6(float) Load 287 + 289: 6(float) FAdd 288 286 + 290: 29(ptr) AccessChain 27(buf) 28 + Store 290 289 + 291: 150(ptr) ImageTexelPointer 276(fimage2DRect) 213 15 + 292: 6(float) AtomicExchange 291 19 162 169 + Store 11(atomf) 292 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 293: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 294: 29(ptr) AccessChain 27(buf) 28 + 295: 6(float) Load 294 + 296: 6(float) FAdd 295 293 + 297: 29(ptr) AccessChain 27(buf) 28 + Store 297 296 + 298: 150(ptr) ImageTexelPointer 276(fimage2DRect) 205 15 + 299: 6(float) AtomicLoad 298 19 178 + Store 11(atomf) 299 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 300: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 301: 29(ptr) AccessChain 27(buf) 28 + 302: 6(float) Load 301 + 303: 6(float) FAdd 302 300 + 304: 29(ptr) AccessChain 27(buf) 28 + Store 304 303 + 305: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 306: 150(ptr) ImageTexelPointer 276(fimage2DRect) 228 15 + AtomicStore 306 19 187 305 + 307: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 308: 29(ptr) AccessChain 27(buf) 28 + 309: 6(float) Load 308 + 310: 6(float) FAdd 309 307 + 311: 29(ptr) AccessChain 27(buf) 28 + Store 311 310 + 317: 150(ptr) ImageTexelPointer 314(fimage2DArray) 316 15 + 318: 6(float) AtomicFAddEXT 317 14 152 149 + Store 11(atomf) 318 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 319: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 320: 29(ptr) AccessChain 27(buf) 28 + 321: 6(float) Load 320 + 322: 6(float) FAdd 321 319 + 323: 29(ptr) AccessChain 27(buf) 28 + Store 323 322 + 325: 150(ptr) ImageTexelPointer 314(fimage2DArray) 324 15 + 326: 6(float) AtomicFAddEXT 325 19 162 12 + Store 11(atomf) 326 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 327: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 328: 29(ptr) AccessChain 27(buf) 28 + 329: 6(float) Load 328 + 330: 6(float) FAdd 329 327 + 331: 29(ptr) AccessChain 27(buf) 28 + Store 331 330 + 333: 150(ptr) ImageTexelPointer 314(fimage2DArray) 332 15 + 334: 6(float) AtomicExchange 333 19 162 169 + Store 11(atomf) 334 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 335: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 336: 29(ptr) AccessChain 27(buf) 28 + 337: 6(float) Load 336 + 338: 6(float) FAdd 337 335 + 339: 29(ptr) AccessChain 27(buf) 28 + Store 339 338 + 341: 150(ptr) ImageTexelPointer 314(fimage2DArray) 340 15 + 342: 6(float) AtomicLoad 341 19 178 + Store 11(atomf) 342 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 343: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 344: 29(ptr) AccessChain 27(buf) 28 + 345: 6(float) Load 344 + 346: 6(float) FAdd 345 343 + 347: 29(ptr) AccessChain 27(buf) 28 + Store 347 346 + 349: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 350: 150(ptr) ImageTexelPointer 314(fimage2DArray) 348 15 + AtomicStore 350 19 187 349 + 351: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 352: 29(ptr) AccessChain 27(buf) 28 + 353: 6(float) Load 352 + 354: 6(float) FAdd 353 351 + 355: 29(ptr) AccessChain 27(buf) 28 + Store 355 354 + 359: 150(ptr) ImageTexelPointer 358(fimageCube) 316 15 + 360: 6(float) AtomicFAddEXT 359 14 152 149 + Store 11(atomf) 360 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 361: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 362: 29(ptr) AccessChain 27(buf) 28 + 363: 6(float) Load 362 + 364: 6(float) FAdd 363 361 + 365: 29(ptr) AccessChain 27(buf) 28 + Store 365 364 + 366: 150(ptr) ImageTexelPointer 358(fimageCube) 324 15 + 367: 6(float) AtomicFAddEXT 366 19 162 12 + Store 11(atomf) 367 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 368: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 369: 29(ptr) AccessChain 27(buf) 28 + 370: 6(float) Load 369 + 371: 6(float) FAdd 370 368 + 372: 29(ptr) AccessChain 27(buf) 28 + Store 372 371 + 374: 150(ptr) ImageTexelPointer 358(fimageCube) 373 15 + 375: 6(float) AtomicExchange 374 19 162 169 + Store 11(atomf) 375 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 376: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 377: 29(ptr) AccessChain 27(buf) 28 + 378: 6(float) Load 377 + 379: 6(float) FAdd 378 376 + 380: 29(ptr) AccessChain 27(buf) 28 + Store 380 379 + 381: 150(ptr) ImageTexelPointer 358(fimageCube) 340 15 + 382: 6(float) AtomicLoad 381 19 178 + Store 11(atomf) 382 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 383: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 384: 29(ptr) AccessChain 27(buf) 28 + 385: 6(float) Load 384 + 386: 6(float) FAdd 385 383 + 387: 29(ptr) AccessChain 27(buf) 28 + Store 387 386 + 389: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 390: 150(ptr) ImageTexelPointer 358(fimageCube) 388 15 + AtomicStore 390 19 187 389 + 391: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 392: 29(ptr) AccessChain 27(buf) 28 + 393: 6(float) Load 392 + 394: 6(float) FAdd 393 391 + 395: 29(ptr) AccessChain 27(buf) 28 + Store 395 394 + 399: 150(ptr) ImageTexelPointer 398(fimageCubeArray) 316 15 + 400: 6(float) AtomicFAddEXT 399 14 152 149 + Store 11(atomf) 400 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 401: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 402: 29(ptr) AccessChain 27(buf) 28 + 403: 6(float) Load 402 + 404: 6(float) FAdd 403 401 + 405: 29(ptr) AccessChain 27(buf) 28 + Store 405 404 + 406: 150(ptr) ImageTexelPointer 398(fimageCubeArray) 324 15 + 407: 6(float) AtomicFAddEXT 406 19 162 12 + Store 11(atomf) 407 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 408: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 409: 29(ptr) AccessChain 27(buf) 28 + 410: 6(float) Load 409 + 411: 6(float) FAdd 410 408 + 412: 29(ptr) AccessChain 27(buf) 28 + Store 412 411 + 413: 150(ptr) ImageTexelPointer 398(fimageCubeArray) 332 15 + 414: 6(float) AtomicExchange 413 19 162 169 + Store 11(atomf) 414 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 415: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 416: 29(ptr) AccessChain 27(buf) 28 + 417: 6(float) Load 416 + 418: 6(float) FAdd 417 415 + 419: 29(ptr) AccessChain 27(buf) 28 + Store 419 418 + 420: 150(ptr) ImageTexelPointer 398(fimageCubeArray) 340 15 + 421: 6(float) AtomicLoad 420 19 178 + Store 11(atomf) 421 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 422: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 423: 29(ptr) AccessChain 27(buf) 28 + 424: 6(float) Load 423 + 425: 6(float) FAdd 424 422 + 426: 29(ptr) AccessChain 27(buf) 28 + Store 426 425 + 427: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 428: 150(ptr) ImageTexelPointer 398(fimageCubeArray) 348 15 + AtomicStore 428 19 187 427 + 429: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 430: 29(ptr) AccessChain 27(buf) 28 + 431: 6(float) Load 430 + 432: 6(float) FAdd 431 429 + 433: 29(ptr) AccessChain 27(buf) 28 + Store 433 432 + 437: 150(ptr) ImageTexelPointer 436(fimage3D) 316 15 + 438: 6(float) AtomicFAddEXT 437 14 152 149 + Store 11(atomf) 438 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 439: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 440: 29(ptr) AccessChain 27(buf) 28 + 441: 6(float) Load 440 + 442: 6(float) FAdd 441 439 + 443: 29(ptr) AccessChain 27(buf) 28 + Store 443 442 + 444: 150(ptr) ImageTexelPointer 436(fimage3D) 324 15 + 445: 6(float) AtomicFAddEXT 444 19 162 12 + Store 11(atomf) 445 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 446: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 447: 29(ptr) AccessChain 27(buf) 28 + 448: 6(float) Load 447 + 449: 6(float) FAdd 448 446 + 450: 29(ptr) AccessChain 27(buf) 28 + Store 450 449 + 451: 150(ptr) ImageTexelPointer 436(fimage3D) 332 15 + 452: 6(float) AtomicExchange 451 19 162 169 + Store 11(atomf) 452 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 453: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 454: 29(ptr) AccessChain 27(buf) 28 + 455: 6(float) Load 454 + 456: 6(float) FAdd 455 453 + 457: 29(ptr) AccessChain 27(buf) 28 + Store 457 456 + 458: 150(ptr) ImageTexelPointer 436(fimage3D) 340 15 + 459: 6(float) AtomicLoad 458 19 178 + Store 11(atomf) 459 MakePointerAvailableKHR NonPrivatePointerKHR 154 + 460: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 461: 29(ptr) AccessChain 27(buf) 28 + 462: 6(float) Load 461 + 463: 6(float) FAdd 462 460 + 464: 29(ptr) AccessChain 27(buf) 28 + Store 464 463 + 465: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 466: 150(ptr) ImageTexelPointer 436(fimage3D) 348 15 + AtomicStore 466 19 187 465 + 467: 6(float) Load 11(atomf) MakePointerVisibleKHR NonPrivatePointerKHR 154 + 468: 29(ptr) AccessChain 27(buf) 28 + 469: 6(float) Load 468 + 470: 6(float) FAdd 469 467 + 471: 29(ptr) AccessChain 27(buf) 28 + Store 471 470 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.atomicStoreInt64.comp.out b/third_party/glslang/Test/baseResults/spv.atomicStoreInt64.comp.out index 9114bc3497..c3c6e72ee7 100644 --- a/third_party/glslang/Test/baseResults/spv.atomicStoreInt64.comp.out +++ b/third_party/glslang/Test/baseResults/spv.atomicStoreInt64.comp.out @@ -1,7 +1,7 @@ spv.atomicStoreInt64.comp // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 25 +// Id's are bound by 26 Capability Shader Capability Int64 @@ -43,15 +43,16 @@ spv.atomicStoreInt64.comp 16: 15(ptr) Variable Uniform 19: 10(int) Constant 1 20: 10(int) Constant 64 - 21: TypeInt 32 0 - 22: 21(int) Constant 1 - 23: 21(int) Constant 0 - 24: 21(int) Constant 64 + 21: 10(int) Constant 4 + 22: TypeInt 32 0 + 23: 22(int) Constant 1 + 24: 22(int) Constant 0 + 25: 22(int) Constant 68 4(main): 2 Function None 3 5: Label 13: 12(ptr) AccessChain 9 11 17: 12(ptr) AccessChain 16 11 18: 6(int64_t) Load 17 - AtomicStore 13 19 24 18 + AtomicStore 13 19 25 18 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.bfloat16.comp.out b/third_party/glslang/Test/baseResults/spv.bfloat16.comp.out index 1232d8e0b6..150f60b2d9 100644 --- a/third_party/glslang/Test/baseResults/spv.bfloat16.comp.out +++ b/third_party/glslang/Test/baseResults/spv.bfloat16.comp.out @@ -9,9 +9,9 @@ spv.bfloat16.comp Capability Int64 Capability Int16 Capability Int8 - Capability CapabilityBFloat16TypeKHR - Capability CapabilityBFloat16DotProductKHR - Capability CapabilityBFloat16CooperativeMatrixKHR + Capability BFloat16TypeKHR + Capability BFloat16DotProductKHR + Capability BFloat16CooperativeMatrixKHR Capability VulkanMemoryModelKHR Capability CooperativeMatrixKHR Extension "SPV_KHR_bfloat16" diff --git a/third_party/glslang/Test/baseResults/spv.bufferhandle20.frag.out b/third_party/glslang/Test/baseResults/spv.bufferhandle20.frag.out new file mode 100644 index 0000000000..518a297ec0 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.bufferhandle20.frag.out @@ -0,0 +1,122 @@ +spv.bufferhandle20.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 47 + + Capability Shader + Capability Int64 + Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_KHR_storage_buffer_storage_class" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_buffer_reference2" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int64" + Name 4 "main" + Name 7 "SSBO_0" + MemberName 7(SSBO_0) 0 "address" + Name 9 "" + Name 17 "Data" + MemberName 17(Data) 0 "a" + MemberName 17(Data) 1 "b" + MemberName 17(Data) 2 "c" + MemberName 17(Data) 3 "d" + MemberName 17(Data) 4 "e" + Name 19 "MyBuffer" + MemberName 19(MyBuffer) 0 "data" + Name 21 "Data" + MemberName 21(Data) 0 "a" + MemberName 21(Data) 1 "b" + MemberName 21(Data) 2 "c" + MemberName 21(Data) 3 "d" + MemberName 21(Data) 4 "e" + Name 23 "SSBO_1" + MemberName 23(SSBO_1) 0 "data" + Name 25 "InBuffer" + Decorate 7(SSBO_0) Block + MemberDecorate 7(SSBO_0) 0 Restrict + MemberDecorate 7(SSBO_0) 0 NonWritable + MemberDecorate 7(SSBO_0) 0 Offset 0 + Decorate 9 Restrict + Decorate 9 NonWritable + Decorate 9 Binding 0 + Decorate 9 DescriptorSet 0 + MemberDecorate 17(Data) 0 Offset 0 + MemberDecorate 17(Data) 1 Offset 4 + MemberDecorate 17(Data) 2 Offset 8 + MemberDecorate 17(Data) 3 Offset 12 + MemberDecorate 17(Data) 4 Offset 16 + Decorate 18 ArrayStride 20 + Decorate 19(MyBuffer) Block + MemberDecorate 19(MyBuffer) 0 Offset 0 + MemberDecorate 21(Data) 0 Offset 0 + MemberDecorate 21(Data) 1 Offset 4 + MemberDecorate 21(Data) 2 Offset 8 + MemberDecorate 21(Data) 3 Offset 12 + MemberDecorate 21(Data) 4 Offset 16 + Decorate 22 ArrayStride 20 + Decorate 23(SSBO_1) Block + MemberDecorate 23(SSBO_1) 0 Restrict + MemberDecorate 23(SSBO_1) 0 NonWritable + MemberDecorate 23(SSBO_1) 0 Offset 0 + Decorate 25(InBuffer) Restrict + Decorate 25(InBuffer) NonWritable + Decorate 25(InBuffer) Binding 1 + Decorate 25(InBuffer) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 64 0 + 7(SSBO_0): TypeStruct 6(int64_t) + 8: TypePointer StorageBuffer 7(SSBO_0) + 9: 8(ptr) Variable StorageBuffer + 10: TypeInt 32 1 + 11: 10(int) Constant 0 + 12: TypePointer StorageBuffer 6(int64_t) + TypeForwardPointer 15 PhysicalStorageBufferEXT + 16: TypeInt 32 0 + 17(Data): TypeStruct 16(int) 16(int) 16(int) 10(int) 16(int) + 18: TypeRuntimeArray 17(Data) + 19(MyBuffer): TypeStruct 18 + 15: TypePointer PhysicalStorageBufferEXT 19(MyBuffer) + 21(Data): TypeStruct 16(int) 16(int) 16(int) 10(int) 16(int) + 22: TypeRuntimeArray 21(Data) + 23(SSBO_1): TypeStruct 22 + 24: TypePointer StorageBuffer 23(SSBO_1) + 25(InBuffer): 24(ptr) Variable StorageBuffer + 26: TypePointer StorageBuffer 21(Data) + 29: TypePointer PhysicalStorageBufferEXT 17(Data) + 32: TypePointer PhysicalStorageBufferEXT 16(int) + 35: 10(int) Constant 1 + 38: 10(int) Constant 2 + 41: 10(int) Constant 3 + 42: TypePointer PhysicalStorageBufferEXT 10(int) + 45: 10(int) Constant 4 + 4(main): 2 Function None 3 + 5: Label + 13: 12(ptr) AccessChain 9 11 + 14: 6(int64_t) Load 13 + 20: 15(ptr) ConvertUToPtr 14 + 27: 26(ptr) AccessChain 25(InBuffer) 11 11 + 28: 21(Data) Load 27 + 30: 29(ptr) AccessChain 20 11 11 + 31: 16(int) CompositeExtract 28 0 + 33: 32(ptr) AccessChain 30 11 + Store 33 31 Aligned 4 + 34: 16(int) CompositeExtract 28 1 + 36: 32(ptr) AccessChain 30 35 + Store 36 34 Aligned 4 + 37: 16(int) CompositeExtract 28 2 + 39: 32(ptr) AccessChain 30 38 + Store 39 37 Aligned 8 + 40: 10(int) CompositeExtract 28 3 + 43: 42(ptr) AccessChain 30 41 + Store 43 40 Aligned 4 + 44: 16(int) CompositeExtract 28 4 + 46: 32(ptr) AccessChain 30 45 + Store 46 44 Aligned 16 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.bufferhandle21.frag.out b/third_party/glslang/Test/baseResults/spv.bufferhandle21.frag.out new file mode 100644 index 0000000000..b1d22860fc --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.bufferhandle21.frag.out @@ -0,0 +1,103 @@ +spv.bufferhandle21.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 40 + + Capability Shader + Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_KHR_storage_buffer_storage_class" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_buffer_reference2" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int64" + Name 4 "main" + Name 9 "Data" + MemberName 9(Data) 0 "a" + MemberName 9(Data) 1 "b" + MemberName 9(Data) 2 "c" + MemberName 9(Data) 3 "d" + MemberName 9(Data) 4 "e" + Name 10 "MyBuffer" + MemberName 10(MyBuffer) 0 "data" + Name 12 "x" + Name 15 "Data" + MemberName 15(Data) 0 "a" + MemberName 15(Data) 1 "b" + MemberName 15(Data) 2 "c" + MemberName 15(Data) 3 "d" + MemberName 15(Data) 4 "e" + Name 16 "SSBO_1" + MemberName 16(SSBO_1) 0 "data" + Name 18 "InBuffer" + MemberDecorate 9(Data) 0 Offset 0 + MemberDecorate 9(Data) 1 Offset 4 + MemberDecorate 9(Data) 2 Offset 8 + MemberDecorate 9(Data) 3 Offset 12 + MemberDecorate 9(Data) 4 Offset 16 + Decorate 10(MyBuffer) Block + MemberDecorate 10(MyBuffer) 0 Offset 0 + Decorate 12(x) DecorationAliasedPointerEXT + MemberDecorate 15(Data) 0 Offset 0 + MemberDecorate 15(Data) 1 Offset 4 + MemberDecorate 15(Data) 2 Offset 8 + MemberDecorate 15(Data) 3 Offset 12 + MemberDecorate 15(Data) 4 Offset 16 + Decorate 16(SSBO_1) Block + MemberDecorate 16(SSBO_1) 0 Restrict + MemberDecorate 16(SSBO_1) 0 NonWritable + MemberDecorate 16(SSBO_1) 0 Offset 0 + Decorate 18(InBuffer) Restrict + Decorate 18(InBuffer) NonWritable + Decorate 18(InBuffer) Binding 1 + Decorate 18(InBuffer) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + TypeForwardPointer 6 PhysicalStorageBufferEXT + 7: TypeInt 32 0 + 8: TypeInt 32 1 + 9(Data): TypeStruct 7(int) 7(int) 7(int) 8(int) 7(int) + 10(MyBuffer): TypeStruct 9(Data) + 6: TypePointer PhysicalStorageBufferEXT 10(MyBuffer) + 11: TypePointer Function 6(ptr) + 14: 8(int) Constant 0 + 15(Data): TypeStruct 7(int) 7(int) 7(int) 8(int) 7(int) + 16(SSBO_1): TypeStruct 15(Data) + 17: TypePointer StorageBuffer 16(SSBO_1) + 18(InBuffer): 17(ptr) Variable StorageBuffer + 19: TypePointer StorageBuffer 15(Data) + 22: TypePointer PhysicalStorageBufferEXT 9(Data) + 25: TypePointer PhysicalStorageBufferEXT 7(int) + 28: 8(int) Constant 1 + 31: 8(int) Constant 2 + 34: 8(int) Constant 3 + 35: TypePointer PhysicalStorageBufferEXT 8(int) + 38: 8(int) Constant 4 + 4(main): 2 Function None 3 + 5: Label + 12(x): 11(ptr) Variable Function + 13: 6(ptr) Load 12(x) + 20: 19(ptr) AccessChain 18(InBuffer) 14 + 21: 15(Data) Load 20 + 23: 22(ptr) AccessChain 13 14 + 24: 7(int) CompositeExtract 21 0 + 26: 25(ptr) AccessChain 23 14 + Store 26 24 Aligned 4 + 27: 7(int) CompositeExtract 21 1 + 29: 25(ptr) AccessChain 23 28 + Store 29 27 Aligned 4 + 30: 7(int) CompositeExtract 21 2 + 32: 25(ptr) AccessChain 23 31 + Store 32 30 Aligned 8 + 33: 8(int) CompositeExtract 21 3 + 36: 35(ptr) AccessChain 23 34 + Store 36 33 Aligned 4 + 37: 7(int) CompositeExtract 21 4 + 39: 25(ptr) AccessChain 23 38 + Store 39 37 Aligned 16 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.bufferhandle22.frag.out b/third_party/glslang/Test/baseResults/spv.bufferhandle22.frag.out new file mode 100644 index 0000000000..18fecf4307 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.bufferhandle22.frag.out @@ -0,0 +1,489 @@ +spv.bufferhandle22.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 301 + + Capability Shader + Capability Int64 + Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_KHR_storage_buffer_storage_class" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_buffer_reference2" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int64" + Name 4 "main" + Name 8 "S1" + MemberName 8(S1) 0 "x" + Name 10 "S2" + MemberName 10(S2) 0 "x" + Name 13 "S3" + MemberName 13(S3) 0 "x" + Name 22 "S4" + MemberName 22(S4) 0 "x" + Name 25 "S5" + MemberName 25(S5) 0 "x" + Name 26 "S6" + MemberName 26(S6) 0 "x" + Name 27 "A" + MemberName 27(A) 0 "a" + MemberName 27(A) 1 "b" + Name 28 "B" + MemberName 28(B) 0 "a" + Name 29 "S7" + MemberName 29(S7) 0 "x" + Name 30 "MyBuffer" + MemberName 30(MyBuffer) 0 "s1" + MemberName 30(MyBuffer) 1 "s2" + MemberName 30(MyBuffer) 2 "s3" + MemberName 30(MyBuffer) 3 "s4" + MemberName 30(MyBuffer) 4 "s5" + MemberName 30(MyBuffer) 5 "s6" + MemberName 30(MyBuffer) 6 "s7" + Name 32 "payload" + Name 36 "S1" + MemberName 36(S1) 0 "x" + Name 37 "S2" + MemberName 37(S2) 0 "x" + Name 38 "S3" + MemberName 38(S3) 0 "x" + Name 44 "S4" + MemberName 44(S4) 0 "x" + Name 45 "S5" + MemberName 45(S5) 0 "x" + Name 46 "S6" + MemberName 46(S6) 0 "x" + Name 47 "A" + MemberName 47(A) 0 "a" + MemberName 47(A) 1 "b" + Name 48 "B" + MemberName 48(B) 0 "a" + Name 49 "S7" + MemberName 49(S7) 0 "x" + Name 50 "SSBO" + MemberName 50(SSBO) 0 "s1" + MemberName 50(SSBO) 1 "s2" + MemberName 50(SSBO) 2 "s3" + MemberName 50(SSBO) 3 "s4" + MemberName 50(SSBO) 4 "s5" + MemberName 50(SSBO) 5 "s6" + MemberName 50(SSBO) 6 "s7" + Name 52 "InBuffer" + MemberDecorate 8(S1) 0 Offset 0 + MemberDecorate 10(S2) 0 Offset 0 + MemberDecorate 13(S3) 0 Offset 0 + Decorate 15 ArrayStride 16 + Decorate 17 ArrayStride 32 + Decorate 18 ArrayStride 32 + Decorate 20 ArrayStride 64 + Decorate 21 ArrayStride 192 + MemberDecorate 22(S4) 0 Offset 0 + MemberDecorate 25(S5) 0 ColMajor + MemberDecorate 25(S5) 0 MatrixStride 16 + MemberDecorate 25(S5) 0 Offset 0 + MemberDecorate 26(S6) 0 Offset 0 + MemberDecorate 27(A) 0 Offset 0 + MemberDecorate 27(A) 1 Offset 8 + MemberDecorate 28(B) 0 Offset 0 + MemberDecorate 29(S7) 0 Offset 0 + Decorate 30(MyBuffer) Block + MemberDecorate 30(MyBuffer) 0 Offset 0 + MemberDecorate 30(MyBuffer) 1 Offset 8 + MemberDecorate 30(MyBuffer) 2 Offset 16 + MemberDecorate 30(MyBuffer) 3 Offset 32 + MemberDecorate 30(MyBuffer) 4 Offset 608 + MemberDecorate 30(MyBuffer) 5 Offset 656 + MemberDecorate 30(MyBuffer) 6 Offset 664 + Decorate 32(payload) DecorationAliasedPointerEXT + MemberDecorate 36(S1) 0 Offset 0 + MemberDecorate 37(S2) 0 Offset 0 + MemberDecorate 38(S3) 0 Offset 0 + Decorate 39 ArrayStride 16 + Decorate 40 ArrayStride 32 + Decorate 41 ArrayStride 32 + Decorate 42 ArrayStride 64 + Decorate 43 ArrayStride 192 + MemberDecorate 44(S4) 0 Offset 0 + MemberDecorate 45(S5) 0 ColMajor + MemberDecorate 45(S5) 0 MatrixStride 16 + MemberDecorate 45(S5) 0 Offset 0 + MemberDecorate 46(S6) 0 Offset 0 + MemberDecorate 47(A) 0 Offset 0 + MemberDecorate 47(A) 1 Offset 8 + MemberDecorate 48(B) 0 Offset 0 + MemberDecorate 49(S7) 0 Offset 0 + Decorate 50(SSBO) Block + MemberDecorate 50(SSBO) 0 Restrict + MemberDecorate 50(SSBO) 0 NonWritable + MemberDecorate 50(SSBO) 0 Offset 0 + MemberDecorate 50(SSBO) 1 Restrict + MemberDecorate 50(SSBO) 1 NonWritable + MemberDecorate 50(SSBO) 1 Offset 8 + MemberDecorate 50(SSBO) 2 Restrict + MemberDecorate 50(SSBO) 2 NonWritable + MemberDecorate 50(SSBO) 2 Offset 16 + MemberDecorate 50(SSBO) 3 Restrict + MemberDecorate 50(SSBO) 3 NonWritable + MemberDecorate 50(SSBO) 3 Offset 32 + MemberDecorate 50(SSBO) 4 Restrict + MemberDecorate 50(SSBO) 4 NonWritable + MemberDecorate 50(SSBO) 4 Offset 608 + MemberDecorate 50(SSBO) 5 Restrict + MemberDecorate 50(SSBO) 5 NonWritable + MemberDecorate 50(SSBO) 5 Offset 656 + MemberDecorate 50(SSBO) 6 Restrict + MemberDecorate 50(SSBO) 6 NonWritable + MemberDecorate 50(SSBO) 6 Offset 664 + Decorate 52(InBuffer) Restrict + Decorate 52(InBuffer) NonWritable + Decorate 52(InBuffer) Binding 1 + Decorate 52(InBuffer) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + TypeForwardPointer 6 PhysicalStorageBufferEXT + 7: TypeInt 64 0 + 8(S1): TypeStruct 7(int64_t) + 9: TypeFloat 32 + 10(S2): TypeStruct 9(float) + 11: TypeInt 32 0 + 12: TypeVector 11(int) 3 + 13(S3): TypeStruct 12(ivec3) + 14: 11(int) Constant 2 + 15: TypeArray 12(ivec3) 14 + 16: 11(int) Constant 1 + 17: TypeArray 15 16 + 18: TypeArray 17 14 + 19: 11(int) Constant 3 + 20: TypeArray 18 19 + 21: TypeArray 20 19 + 22(S4): TypeStruct 21 + 23: TypeVector 9(float) 3 + 24: TypeMatrix 23(fvec3) 3 + 25(S5): TypeStruct 24 + 26(S6): TypeStruct 6 + 27(A): TypeStruct 7(int64_t) 11(int) + 28(B): TypeStruct 27(A) + 29(S7): TypeStruct 28(B) + 30(MyBuffer): TypeStruct 8(S1) 10(S2) 13(S3) 22(S4) 25(S5) 26(S6) 29(S7) + 6: TypePointer PhysicalStorageBufferEXT 30(MyBuffer) + 31: TypePointer Function 6(ptr) + 34: TypeInt 32 1 + 35: 34(int) Constant 0 + 36(S1): TypeStruct 7(int64_t) + 37(S2): TypeStruct 9(float) + 38(S3): TypeStruct 12(ivec3) + 39: TypeArray 12(ivec3) 14 + 40: TypeArray 39 16 + 41: TypeArray 40 14 + 42: TypeArray 41 19 + 43: TypeArray 42 19 + 44(S4): TypeStruct 43 + 45(S5): TypeStruct 24 + 46(S6): TypeStruct 6(ptr) + 47(A): TypeStruct 7(int64_t) 11(int) + 48(B): TypeStruct 47(A) + 49(S7): TypeStruct 48(B) + 50(SSBO): TypeStruct 36(S1) 37(S2) 38(S3) 44(S4) 45(S5) 46(S6) 49(S7) + 51: TypePointer StorageBuffer 50(SSBO) + 52(InBuffer): 51(ptr) Variable StorageBuffer + 53: TypePointer StorageBuffer 36(S1) + 56: TypePointer PhysicalStorageBufferEXT 8(S1) + 59: TypePointer PhysicalStorageBufferEXT 7(int64_t) + 62: 34(int) Constant 1 + 63: TypePointer StorageBuffer 37(S2) + 66: TypePointer PhysicalStorageBufferEXT 10(S2) + 69: TypePointer PhysicalStorageBufferEXT 9(float) + 72: 34(int) Constant 2 + 73: TypePointer StorageBuffer 38(S3) + 76: TypePointer PhysicalStorageBufferEXT 13(S3) + 79: TypePointer PhysicalStorageBufferEXT 12(ivec3) + 82: 34(int) Constant 3 + 83: TypePointer StorageBuffer 44(S4) + 86: TypePointer PhysicalStorageBufferEXT 22(S4) + 89: TypePointer PhysicalStorageBufferEXT 21 + 92: TypePointer PhysicalStorageBufferEXT 20 + 95: TypePointer PhysicalStorageBufferEXT 18 + 98: TypePointer PhysicalStorageBufferEXT 17 + 101: TypePointer PhysicalStorageBufferEXT 15 + 264: 34(int) Constant 4 + 265: TypePointer StorageBuffer 45(S5) + 268: TypePointer PhysicalStorageBufferEXT 25(S5) + 271: TypePointer PhysicalStorageBufferEXT 24 + 274: 34(int) Constant 5 + 275: TypePointer StorageBuffer 46(S6) + 278: TypePointer PhysicalStorageBufferEXT 26(S6) + 281: TypePointer PhysicalStorageBufferEXT 6(ptr) + 284: 34(int) Constant 6 + 285: TypePointer StorageBuffer 49(S7) + 288: TypePointer PhysicalStorageBufferEXT 29(S7) + 291: TypePointer PhysicalStorageBufferEXT 28(B) + 294: TypePointer PhysicalStorageBufferEXT 27(A) + 299: TypePointer PhysicalStorageBufferEXT 11(int) + 4(main): 2 Function None 3 + 5: Label + 32(payload): 31(ptr) Variable Function + 33: 6(ptr) Load 32(payload) + 54: 53(ptr) AccessChain 52(InBuffer) 35 + 55: 36(S1) Load 54 + 57: 56(ptr) AccessChain 33 35 + 58: 7(int64_t) CompositeExtract 55 0 + 60: 59(ptr) AccessChain 57 35 + Store 60 58 Aligned 8 + 61: 6(ptr) Load 32(payload) + 64: 63(ptr) AccessChain 52(InBuffer) 62 + 65: 37(S2) Load 64 + 67: 66(ptr) AccessChain 61 62 + 68: 9(float) CompositeExtract 65 0 + 70: 69(ptr) AccessChain 67 35 + Store 70 68 Aligned 4 + 71: 6(ptr) Load 32(payload) + 74: 73(ptr) AccessChain 52(InBuffer) 72 + 75: 38(S3) Load 74 + 77: 76(ptr) AccessChain 71 72 + 78: 12(ivec3) CompositeExtract 75 0 + 80: 79(ptr) AccessChain 77 35 + Store 80 78 Aligned 4 + 81: 6(ptr) Load 32(payload) + 84: 83(ptr) AccessChain 52(InBuffer) 82 + 85: 44(S4) Load 84 + 87: 86(ptr) AccessChain 81 82 + 88: 43 CompositeExtract 85 0 + 90: 89(ptr) AccessChain 87 35 + 91: 42 CompositeExtract 88 0 + 93: 92(ptr) AccessChain 90 35 + 94: 41 CompositeExtract 91 0 + 96: 95(ptr) AccessChain 93 35 + 97: 40 CompositeExtract 94 0 + 99: 98(ptr) AccessChain 96 35 + 100: 39 CompositeExtract 97 0 + 102: 101(ptr) AccessChain 99 35 + 103: 12(ivec3) CompositeExtract 100 0 + 104: 79(ptr) AccessChain 102 35 + Store 104 103 Aligned 16 + 105: 12(ivec3) CompositeExtract 100 1 + 106: 79(ptr) AccessChain 102 62 + Store 106 105 Aligned 16 + 107: 40 CompositeExtract 94 1 + 108: 98(ptr) AccessChain 96 62 + 109: 39 CompositeExtract 107 0 + 110: 101(ptr) AccessChain 108 35 + 111: 12(ivec3) CompositeExtract 109 0 + 112: 79(ptr) AccessChain 110 35 + Store 112 111 Aligned 16 + 113: 12(ivec3) CompositeExtract 109 1 + 114: 79(ptr) AccessChain 110 62 + Store 114 113 Aligned 16 + 115: 41 CompositeExtract 91 1 + 116: 95(ptr) AccessChain 93 62 + 117: 40 CompositeExtract 115 0 + 118: 98(ptr) AccessChain 116 35 + 119: 39 CompositeExtract 117 0 + 120: 101(ptr) AccessChain 118 35 + 121: 12(ivec3) CompositeExtract 119 0 + 122: 79(ptr) AccessChain 120 35 + Store 122 121 Aligned 16 + 123: 12(ivec3) CompositeExtract 119 1 + 124: 79(ptr) AccessChain 120 62 + Store 124 123 Aligned 16 + 125: 40 CompositeExtract 115 1 + 126: 98(ptr) AccessChain 116 62 + 127: 39 CompositeExtract 125 0 + 128: 101(ptr) AccessChain 126 35 + 129: 12(ivec3) CompositeExtract 127 0 + 130: 79(ptr) AccessChain 128 35 + Store 130 129 Aligned 16 + 131: 12(ivec3) CompositeExtract 127 1 + 132: 79(ptr) AccessChain 128 62 + Store 132 131 Aligned 16 + 133: 41 CompositeExtract 91 2 + 134: 95(ptr) AccessChain 93 72 + 135: 40 CompositeExtract 133 0 + 136: 98(ptr) AccessChain 134 35 + 137: 39 CompositeExtract 135 0 + 138: 101(ptr) AccessChain 136 35 + 139: 12(ivec3) CompositeExtract 137 0 + 140: 79(ptr) AccessChain 138 35 + Store 140 139 Aligned 16 + 141: 12(ivec3) CompositeExtract 137 1 + 142: 79(ptr) AccessChain 138 62 + Store 142 141 Aligned 16 + 143: 40 CompositeExtract 133 1 + 144: 98(ptr) AccessChain 134 62 + 145: 39 CompositeExtract 143 0 + 146: 101(ptr) AccessChain 144 35 + 147: 12(ivec3) CompositeExtract 145 0 + 148: 79(ptr) AccessChain 146 35 + Store 148 147 Aligned 16 + 149: 12(ivec3) CompositeExtract 145 1 + 150: 79(ptr) AccessChain 146 62 + Store 150 149 Aligned 16 + 151: 42 CompositeExtract 88 1 + 152: 92(ptr) AccessChain 90 62 + 153: 41 CompositeExtract 151 0 + 154: 95(ptr) AccessChain 152 35 + 155: 40 CompositeExtract 153 0 + 156: 98(ptr) AccessChain 154 35 + 157: 39 CompositeExtract 155 0 + 158: 101(ptr) AccessChain 156 35 + 159: 12(ivec3) CompositeExtract 157 0 + 160: 79(ptr) AccessChain 158 35 + Store 160 159 Aligned 16 + 161: 12(ivec3) CompositeExtract 157 1 + 162: 79(ptr) AccessChain 158 62 + Store 162 161 Aligned 16 + 163: 40 CompositeExtract 153 1 + 164: 98(ptr) AccessChain 154 62 + 165: 39 CompositeExtract 163 0 + 166: 101(ptr) AccessChain 164 35 + 167: 12(ivec3) CompositeExtract 165 0 + 168: 79(ptr) AccessChain 166 35 + Store 168 167 Aligned 16 + 169: 12(ivec3) CompositeExtract 165 1 + 170: 79(ptr) AccessChain 166 62 + Store 170 169 Aligned 16 + 171: 41 CompositeExtract 151 1 + 172: 95(ptr) AccessChain 152 62 + 173: 40 CompositeExtract 171 0 + 174: 98(ptr) AccessChain 172 35 + 175: 39 CompositeExtract 173 0 + 176: 101(ptr) AccessChain 174 35 + 177: 12(ivec3) CompositeExtract 175 0 + 178: 79(ptr) AccessChain 176 35 + Store 178 177 Aligned 16 + 179: 12(ivec3) CompositeExtract 175 1 + 180: 79(ptr) AccessChain 176 62 + Store 180 179 Aligned 16 + 181: 40 CompositeExtract 171 1 + 182: 98(ptr) AccessChain 172 62 + 183: 39 CompositeExtract 181 0 + 184: 101(ptr) AccessChain 182 35 + 185: 12(ivec3) CompositeExtract 183 0 + 186: 79(ptr) AccessChain 184 35 + Store 186 185 Aligned 16 + 187: 12(ivec3) CompositeExtract 183 1 + 188: 79(ptr) AccessChain 184 62 + Store 188 187 Aligned 16 + 189: 41 CompositeExtract 151 2 + 190: 95(ptr) AccessChain 152 72 + 191: 40 CompositeExtract 189 0 + 192: 98(ptr) AccessChain 190 35 + 193: 39 CompositeExtract 191 0 + 194: 101(ptr) AccessChain 192 35 + 195: 12(ivec3) CompositeExtract 193 0 + 196: 79(ptr) AccessChain 194 35 + Store 196 195 Aligned 16 + 197: 12(ivec3) CompositeExtract 193 1 + 198: 79(ptr) AccessChain 194 62 + Store 198 197 Aligned 16 + 199: 40 CompositeExtract 189 1 + 200: 98(ptr) AccessChain 190 62 + 201: 39 CompositeExtract 199 0 + 202: 101(ptr) AccessChain 200 35 + 203: 12(ivec3) CompositeExtract 201 0 + 204: 79(ptr) AccessChain 202 35 + Store 204 203 Aligned 16 + 205: 12(ivec3) CompositeExtract 201 1 + 206: 79(ptr) AccessChain 202 62 + Store 206 205 Aligned 16 + 207: 42 CompositeExtract 88 2 + 208: 92(ptr) AccessChain 90 72 + 209: 41 CompositeExtract 207 0 + 210: 95(ptr) AccessChain 208 35 + 211: 40 CompositeExtract 209 0 + 212: 98(ptr) AccessChain 210 35 + 213: 39 CompositeExtract 211 0 + 214: 101(ptr) AccessChain 212 35 + 215: 12(ivec3) CompositeExtract 213 0 + 216: 79(ptr) AccessChain 214 35 + Store 216 215 Aligned 16 + 217: 12(ivec3) CompositeExtract 213 1 + 218: 79(ptr) AccessChain 214 62 + Store 218 217 Aligned 16 + 219: 40 CompositeExtract 209 1 + 220: 98(ptr) AccessChain 210 62 + 221: 39 CompositeExtract 219 0 + 222: 101(ptr) AccessChain 220 35 + 223: 12(ivec3) CompositeExtract 221 0 + 224: 79(ptr) AccessChain 222 35 + Store 224 223 Aligned 16 + 225: 12(ivec3) CompositeExtract 221 1 + 226: 79(ptr) AccessChain 222 62 + Store 226 225 Aligned 16 + 227: 41 CompositeExtract 207 1 + 228: 95(ptr) AccessChain 208 62 + 229: 40 CompositeExtract 227 0 + 230: 98(ptr) AccessChain 228 35 + 231: 39 CompositeExtract 229 0 + 232: 101(ptr) AccessChain 230 35 + 233: 12(ivec3) CompositeExtract 231 0 + 234: 79(ptr) AccessChain 232 35 + Store 234 233 Aligned 16 + 235: 12(ivec3) CompositeExtract 231 1 + 236: 79(ptr) AccessChain 232 62 + Store 236 235 Aligned 16 + 237: 40 CompositeExtract 227 1 + 238: 98(ptr) AccessChain 228 62 + 239: 39 CompositeExtract 237 0 + 240: 101(ptr) AccessChain 238 35 + 241: 12(ivec3) CompositeExtract 239 0 + 242: 79(ptr) AccessChain 240 35 + Store 242 241 Aligned 16 + 243: 12(ivec3) CompositeExtract 239 1 + 244: 79(ptr) AccessChain 240 62 + Store 244 243 Aligned 16 + 245: 41 CompositeExtract 207 2 + 246: 95(ptr) AccessChain 208 72 + 247: 40 CompositeExtract 245 0 + 248: 98(ptr) AccessChain 246 35 + 249: 39 CompositeExtract 247 0 + 250: 101(ptr) AccessChain 248 35 + 251: 12(ivec3) CompositeExtract 249 0 + 252: 79(ptr) AccessChain 250 35 + Store 252 251 Aligned 16 + 253: 12(ivec3) CompositeExtract 249 1 + 254: 79(ptr) AccessChain 250 62 + Store 254 253 Aligned 16 + 255: 40 CompositeExtract 245 1 + 256: 98(ptr) AccessChain 246 62 + 257: 39 CompositeExtract 255 0 + 258: 101(ptr) AccessChain 256 35 + 259: 12(ivec3) CompositeExtract 257 0 + 260: 79(ptr) AccessChain 258 35 + Store 260 259 Aligned 16 + 261: 12(ivec3) CompositeExtract 257 1 + 262: 79(ptr) AccessChain 258 62 + Store 262 261 Aligned 16 + 263: 6(ptr) Load 32(payload) + 266: 265(ptr) AccessChain 52(InBuffer) 264 + 267: 45(S5) Load 266 + 269: 268(ptr) AccessChain 263 264 + 270: 24 CompositeExtract 267 0 + 272: 271(ptr) AccessChain 269 35 + Store 272 270 Aligned 16 + 273: 6(ptr) Load 32(payload) + 276: 275(ptr) AccessChain 52(InBuffer) 274 + 277: 46(S6) Load 276 + 279: 278(ptr) AccessChain 273 274 + 280: 6(ptr) CompositeExtract 277 0 + 282: 281(ptr) AccessChain 279 35 + Store 282 280 Aligned 16 + 283: 6(ptr) Load 32(payload) + 286: 285(ptr) AccessChain 52(InBuffer) 284 + 287: 49(S7) Load 286 + 289: 288(ptr) AccessChain 283 284 + 290: 48(B) CompositeExtract 287 0 + 292: 291(ptr) AccessChain 289 35 + 293: 47(A) CompositeExtract 290 0 + 295: 294(ptr) AccessChain 292 35 + 296: 7(int64_t) CompositeExtract 293 0 + 297: 59(ptr) AccessChain 295 35 + Store 297 296 Aligned 8 + 298: 11(int) CompositeExtract 293 1 + 300: 299(ptr) AccessChain 295 62 + Store 300 298 Aligned 8 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.bufferhandle23.frag.out b/third_party/glslang/Test/baseResults/spv.bufferhandle23.frag.out new file mode 100644 index 0000000000..65c9ea8d3e --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.bufferhandle23.frag.out @@ -0,0 +1,54 @@ +spv.bufferhandle23.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 21 + + Capability Shader + Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_KHR_physical_storage_buffer" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_scalar_block_layout" + Name 4 "main" + Name 8 "S4" + MemberName 8(S4) 0 "f" + Name 10 "y" + Name 12 "S3" + MemberName 12(S3) 0 "e" + Name 14 "x" + Decorate 8(S4) Block + MemberDecorate 8(S4) 0 NonWritable + MemberDecorate 8(S4) 0 Offset 0 + Decorate 10(y) DecorationAliasedPointerEXT + Decorate 12(S3) Block + MemberDecorate 12(S3) 0 NonWritable + MemberDecorate 12(S3) 0 Offset 0 + Decorate 14(x) DecorationAliasedPointerEXT + 2: TypeVoid + 3: TypeFunction 2 + TypeForwardPointer 6 PhysicalStorageBufferEXT + 7: TypeInt 32 0 + 8(S4): TypeStruct 7(int) + 6: TypePointer PhysicalStorageBufferEXT 8(S4) + 9: TypePointer Function 6(ptr) + TypeForwardPointer 11 PhysicalStorageBufferEXT + 12(S3): TypeStruct 6(ptr) + 11: TypePointer PhysicalStorageBufferEXT 12(S3) + 13: TypePointer Function 11(ptr) + 16: TypeInt 32 1 + 17: 16(int) Constant 0 + 18: TypePointer PhysicalStorageBufferEXT 6(ptr) + 4(main): 2 Function None 3 + 5: Label + 10(y): 9(ptr) Variable Function + 14(x): 13(ptr) Variable Function + 15: 11(ptr) Load 14(x) + 19: 18(ptr) AccessChain 15 17 + 20: 6(ptr) Load 19 Aligned 8 + Store 10(y) 20 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.bufferhandle24.frag.out b/third_party/glslang/Test/baseResults/spv.bufferhandle24.frag.out new file mode 100644 index 0000000000..dd05779647 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.bufferhandle24.frag.out @@ -0,0 +1,59 @@ +spv.bufferhandle24.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 25 + + Capability Shader + Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_KHR_storage_buffer_storage_class" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_EXT_buffer_reference" + Name 4 "main" + Name 7 "SSBO" + MemberName 7(SSBO) 0 "b" + Name 9 "B" + MemberName 9(B) 0 "a" + Name 11 "A" + MemberName 11(A) 0 "x" + Name 13 "" + Decorate 7(SSBO) Block + MemberDecorate 7(SSBO) 0 Offset 0 + Decorate 9(B) Block + MemberDecorate 9(B) 0 Offset 0 + Decorate 11(A) Block + MemberDecorate 11(A) 0 Offset 0 + Decorate 13 Binding 0 + Decorate 13 DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + TypeForwardPointer 6 PhysicalStorageBufferEXT + 7(SSBO): TypeStruct 6 + TypeForwardPointer 8 PhysicalStorageBufferEXT + 9(B): TypeStruct 8 + 10: TypeInt 32 0 + 11(A): TypeStruct 10(int) + 8: TypePointer PhysicalStorageBufferEXT 11(A) + 6: TypePointer PhysicalStorageBufferEXT 9(B) + 12: TypePointer StorageBuffer 7(SSBO) + 13: 12(ptr) Variable StorageBuffer + 14: TypeInt 32 1 + 15: 14(int) Constant 0 + 16: TypePointer StorageBuffer 6(ptr) + 19: TypePointer PhysicalStorageBufferEXT 8(ptr) + 22: 10(int) Constant 0 + 23: TypePointer PhysicalStorageBufferEXT 10(int) + 4(main): 2 Function None 3 + 5: Label + 17: 16(ptr) AccessChain 13 15 + 18: 6(ptr) Load 17 + 20: 19(ptr) AccessChain 18 15 + 21: 8(ptr) Load 20 Aligned 8 + 24: 23(ptr) AccessChain 21 15 + Store 24 22 Aligned 4 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.bufferhandle25.frag.out b/third_party/glslang/Test/baseResults/spv.bufferhandle25.frag.out new file mode 100644 index 0000000000..bb99fb3bad --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.bufferhandle25.frag.out @@ -0,0 +1,59 @@ +spv.bufferhandle25.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 25 + + Capability Shader + Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_KHR_storage_buffer_storage_class" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_EXT_buffer_reference" + Name 4 "main" + Name 7 "SSBO" + MemberName 7(SSBO) 0 "b" + Name 9 "B" + MemberName 9(B) 0 "a" + Name 11 "A" + MemberName 11(A) 0 "x" + Name 13 "" + Decorate 7(SSBO) Block + MemberDecorate 7(SSBO) 0 Offset 0 + Decorate 9(B) Block + MemberDecorate 9(B) 0 Offset 0 + Decorate 11(A) Block + MemberDecorate 11(A) 0 Offset 0 + Decorate 13 Binding 0 + Decorate 13 DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + TypeForwardPointer 6 PhysicalStorageBufferEXT + 7(SSBO): TypeStruct 6 + TypeForwardPointer 8 PhysicalStorageBufferEXT + 9(B): TypeStruct 8 + 10: TypeInt 32 0 + 11(A): TypeStruct 10(int) + 8: TypePointer PhysicalStorageBufferEXT 11(A) + 6: TypePointer PhysicalStorageBufferEXT 9(B) + 12: TypePointer StorageBuffer 7(SSBO) + 13: 12(ptr) Variable StorageBuffer + 14: TypeInt 32 1 + 15: 14(int) Constant 0 + 16: TypePointer StorageBuffer 6(ptr) + 19: TypePointer PhysicalStorageBufferEXT 8(ptr) + 22: 10(int) Constant 0 + 23: TypePointer PhysicalStorageBufferEXT 10(int) + 4(main): 2 Function None 3 + 5: Label + 17: 16(ptr) AccessChain 13 15 + 18: 6(ptr) Load 17 + 20: 19(ptr) AccessChain 18 15 + 21: 8(ptr) Load 20 Aligned 8 + 24: 23(ptr) AccessChain 21 15 + Store 24 22 Aligned 64 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.bufferhandleRuntimeArray.frag.out b/third_party/glslang/Test/baseResults/spv.bufferhandleRuntimeArray.frag.out new file mode 100644 index 0000000000..59e9959665 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.bufferhandleRuntimeArray.frag.out @@ -0,0 +1,50 @@ +spv.bufferhandleRuntimeArray.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 16 + + Capability Shader + Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_KHR_physical_storage_buffer" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_EXT_buffer_reference" + Name 4 "main" + Name 8 "PushConstants" + MemberName 8(PushConstants) 0 "b" + MemberName 8(PushConstants) 1 "c" + Name 11 "B" + MemberName 11(B) 0 "a" + Name 12 "A" + MemberName 12(A) 0 "x" + Name 15 "" + Decorate 8(PushConstants) Block + MemberDecorate 8(PushConstants) 0 Offset 0 + MemberDecorate 8(PushConstants) 1 Offset 8 + Decorate 10 ArrayStride 8 + Decorate 11(B) Block + MemberDecorate 11(B) 0 Offset 0 + Decorate 12(A) Block + MemberDecorate 12(A) 0 Offset 0 + Decorate 13 ArrayStride 8 + 2: TypeVoid + 3: TypeFunction 2 + TypeForwardPointer 6 PhysicalStorageBufferEXT + 7: TypeInt 32 0 +8(PushConstants): TypeStruct 6 7(int) + TypeForwardPointer 9 PhysicalStorageBufferEXT + 10: TypeRuntimeArray 9 + 11(B): TypeStruct 10 + 12(A): TypeStruct 7(int) + 9: TypePointer PhysicalStorageBufferEXT 12(A) + 13: TypeRuntimeArray 9(ptr) + 6: TypePointer PhysicalStorageBufferEXT 11(B) + 14: TypePointer PushConstant 8(PushConstants) + 15: 14(ptr) Variable PushConstant + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.coopmat.comp.out b/third_party/glslang/Test/baseResults/spv.coopmat.comp.out index ded58df583..b4e77df127 100644 --- a/third_party/glslang/Test/baseResults/spv.coopmat.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopmat.comp.out @@ -1,7 +1,7 @@ spv.coopmat.comp // Module Version 10300 // Generated by (magic number): 8000b -// Id's are bound by 216 +// Id's are bound by 224 Capability Shader Capability Float16 @@ -33,41 +33,42 @@ spv.coopmat.comp MemberName 67(Block) 0 "y" MemberName 67(Block) 1 "x" Name 69 "block" - Name 83 "Block16" - MemberName 83(Block16) 0 "y" - MemberName 83(Block16) 1 "x" - MemberName 83(Block16) 2 "b" - Name 86 "Block" - MemberName 86(Block) 0 "y" - MemberName 86(Block) 1 "x" - Name 88 "block16" - Name 105 "D" - Name 106 "A" - Name 108 "B" - Name 110 "C" - Name 114 "l" - Name 118 "Y" - Name 119 "Z" - Name 122 "F" - Name 127 "a" - Name 131 "md1" - Name 142 "mC2" - Name 155 "p1" - Name 156 "param" - Name 159 "p2" - Name 160 "param" - Name 174 "ms" - Name 179 "shmatrix" - Name 189 "mC" - Name 194 "arr" - Name 199 "arr2" - Name 200 "F" - Name 205 "S" - MemberName 205(S) 0 "a" - MemberName 205(S) 1 "b" - MemberName 205(S) 2 "c" - Name 210 "SC" - Name 215 "scm" + Name 86 "Block16" + MemberName 86(Block16) 0 "arr" + MemberName 86(Block16) 1 "y" + MemberName 86(Block16) 2 "x" + MemberName 86(Block16) 3 "b" + Name 89 "Block" + MemberName 89(Block) 0 "y" + MemberName 89(Block) 1 "x" + Name 91 "block16" + Name 109 "D" + Name 110 "A" + Name 112 "B" + Name 114 "C" + Name 118 "l" + Name 122 "Y" + Name 123 "Z" + Name 126 "F" + Name 131 "a" + Name 134 "md1" + Name 145 "mC2" + Name 158 "p1" + Name 159 "param" + Name 162 "p2" + Name 163 "param" + Name 177 "ms" + Name 182 "shmatrix" + Name 197 "mC" + Name 202 "arr" + Name 207 "arr2" + Name 208 "F" + Name 213 "S" + MemberName 213(S) 0 "a" + MemberName 213(S) 1 "b" + MemberName 213(S) 2 "c" + Name 218 "SC" + Name 223 "scm" Decorate 65 ArrayStride 4 Decorate 66 ArrayStride 4 Decorate 67(Block) Block @@ -75,23 +76,26 @@ spv.coopmat.comp MemberDecorate 67(Block) 1 Offset 4194304 Decorate 69(block) Binding 0 Decorate 69(block) DescriptorSet 0 - Decorate 79 ArrayStride 2 - Decorate 81 ArrayStride 2 - Decorate 83(Block16) Block - MemberDecorate 83(Block16) 0 Offset 0 - MemberDecorate 83(Block16) 1 Offset 2097152 - MemberDecorate 83(Block16) 2 Offset 2097160 - Decorate 84 ArrayStride 4 - Decorate 85 ArrayStride 4 - Decorate 86(Block) Block - MemberDecorate 86(Block) 0 Offset 0 - MemberDecorate 86(Block) 1 Offset 4194304 - Decorate 88(block16) Binding 0 - Decorate 88(block16) DescriptorSet 0 - Decorate 118(Y) SpecId 0 - Decorate 188 BuiltIn WorkgroupSize - Decorate 200(F) SpecId 1 - Decorate 210(SC) SpecId 2 + Decorate 80 ArrayStride 2 + Decorate 81 ArrayStride 512 + Decorate 82 ArrayStride 2 + Decorate 84 ArrayStride 2 + Decorate 86(Block16) Block + MemberDecorate 86(Block16) 0 Offset 0 + MemberDecorate 86(Block16) 1 Offset 131072 + MemberDecorate 86(Block16) 2 Offset 2228224 + MemberDecorate 86(Block16) 3 Offset 2228232 + Decorate 87 ArrayStride 4 + Decorate 88 ArrayStride 4 + Decorate 89(Block) Block + MemberDecorate 89(Block) 0 Offset 0 + MemberDecorate 89(Block) 1 Offset 4194304 + Decorate 91(block16) Binding 0 + Decorate 91(block16) DescriptorSet 0 + Decorate 122(Y) SpecId 0 + Decorate 196 BuiltIn WorkgroupSize + Decorate 208(F) SpecId 1 + Decorate 218(SC) SpecId 2 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 16 @@ -128,100 +132,104 @@ spv.coopmat.comp 73: 7(int) Constant 128 74: TypeBool 75: 74(bool) ConstantFalse - 79: TypeArray 6(float16_t) 64 - 80: 7(int) Constant 1 - 81: TypeArray 6(float16_t) 80 - TypeForwardPointer 82 PhysicalStorageBufferEXT - 83(Block16): TypeStruct 79 81 82 - 84: TypeArray 16(float) 64 - 85: TypeRuntimeArray 16(float) - 86(Block): TypeStruct 84 85 - 82: TypePointer PhysicalStorageBufferEXT 86(Block) - 87: TypePointer StorageBuffer 83(Block16) - 88(block16): 87(ptr) Variable StorageBuffer - 89: TypePointer StorageBuffer 6(float16_t) - 94: 57(int) Constant 2 - 95: TypePointer StorageBuffer 82(ptr) - 98: TypePointer PhysicalStorageBufferEXT 16(float) - 113: TypePointer Function 57(int) - 115: 7(int) SpecConstantOp 5362 32 - 116: 57(int) SpecConstantOp 128 115 61 - 117: 57(int) Constant 8 - 118(Y): 57(int) SpecConstant 2 - 119(Z): 57(int) SpecConstantOp 132 117 118(Y) - 120: TypeCooperativeMatrixNV 6(float16_t) 8 119(Z) 119(Z) - 121: TypePointer Function 120 - 123:6(float16_t) Constant 0 - 124: 120 ConstantComposite 123 - 125: TypeArray 32 70 - 126: TypePointer Function 125 - 128: 57(int) Constant 3 - 129: 16(float) Constant 1065353216 - 135: 57(int) Constant 1234 - 139: TypeCooperativeMatrixNV 6(float16_t) 8 119(Z) 9 - 140: TypeArray 139 8 - 141: TypePointer Private 140 - 142(mC2): 141(ptr) Variable Private - 143: TypePointer Private 139 - 163: 10 ConstantComposite 123 - 164: 17 ConstantComposite 35 - 168:6(float16_t) Constant 16384 - 171: 16(float) Constant 1082130432 - 175: TypeVector 7(int) 4 - 176: 7(int) Constant 32 - 177: TypeArray 175(ivec4) 176 - 178: TypePointer Workgroup 177 - 179(shmatrix): 178(ptr) Variable Workgroup - 180: 7(int) Constant 2 - 181: TypePointer Workgroup 175(ivec4) - 186: TypeVector 7(int) 3 - 187: 7(int) Constant 64 - 188: 186(ivec3) ConstantComposite 187 80 80 - 189(mC): 143(ptr) Variable Private - 190: 7(int) SpecConstantOp 5362 139 - 191: 57(int) SpecConstantOp 128 190 61 - 192: TypeArray 57(int) 191 - 193: TypePointer Private 192 - 194(arr): 193(ptr) Variable Private - 195: 7(int) SpecConstantOp 5362 139 - 196: 57(int) SpecConstantOp 128 195 61 - 197: TypeArray 57(int) 196 - 198: TypePointer Private 197 - 199(arr2): 198(ptr) Variable Private - 200(F): 16(float) SpecConstant 1077936128 - 201: TypeCooperativeMatrixNV 16(float) 8 119(Z) 9 - 202: 201 ConstantComposite 35 - 203:6(float16_t) Constant 15360 - 204: 10 ConstantComposite 203 - 205(S): TypeStruct 57(int) 57(int) 57(int) - 206: 57(int) Constant 12 - 207: 57(int) Constant 23 - 208: 57(int) Constant 34 - 209: 205(S) ConstantComposite 206 207 208 - 210(SC): 57(int) SpecConstant 1 - 211: TypeCooperativeMatrixNV 6(float16_t) 8 210(SC) 210(SC) - 212: TypeArray 211 210(SC) - 213: TypeArray 212 210(SC) - 214: TypePointer Private 213 - 215(scm): 214(ptr) Variable Private + 79: 7(int) Constant 256 + 80: TypeArray 6(float16_t) 79 + 81: TypeArray 80 79 + 82: TypeArray 6(float16_t) 64 + 83: 7(int) Constant 1 + 84: TypeArray 6(float16_t) 83 + TypeForwardPointer 85 PhysicalStorageBufferEXT + 86(Block16): TypeStruct 81 82 84 85 + 87: TypeArray 16(float) 64 + 88: TypeRuntimeArray 16(float) + 89(Block): TypeStruct 87 88 + 85: TypePointer PhysicalStorageBufferEXT 89(Block) + 90: TypePointer StorageBuffer 86(Block16) + 91(block16): 90(ptr) Variable StorageBuffer + 92: 57(int) Constant 2 + 93: TypePointer StorageBuffer 6(float16_t) + 98: 57(int) Constant 3 + 99: TypePointer StorageBuffer 85(ptr) + 102: TypePointer PhysicalStorageBufferEXT 16(float) + 117: TypePointer Function 57(int) + 119: 7(int) SpecConstantOp 5362 32 + 120: 57(int) SpecConstantOp 128 119 61 + 121: 57(int) Constant 8 + 122(Y): 57(int) SpecConstant 2 + 123(Z): 57(int) SpecConstantOp 132 121 122(Y) + 124: TypeCooperativeMatrixNV 6(float16_t) 8 123(Z) 123(Z) + 125: TypePointer Function 124 + 127:6(float16_t) Constant 0 + 128: 124 ConstantComposite 127 + 129: TypeArray 32 70 + 130: TypePointer Function 129 + 132: 16(float) Constant 1065353216 + 138: 57(int) Constant 1234 + 142: TypeCooperativeMatrixNV 6(float16_t) 8 123(Z) 9 + 143: TypeArray 142 8 + 144: TypePointer Private 143 + 145(mC2): 144(ptr) Variable Private + 146: TypePointer Private 142 + 166: 10 ConstantComposite 127 + 167: 17 ConstantComposite 35 + 171:6(float16_t) Constant 16384 + 174: 16(float) Constant 1082130432 + 178: TypeVector 7(int) 4 + 179: 7(int) Constant 32 + 180: TypeArray 178(ivec4) 179 + 181: TypePointer Workgroup 180 + 182(shmatrix): 181(ptr) Variable Workgroup + 183: 7(int) Constant 2 + 184: TypePointer Workgroup 178(ivec4) + 192: 57(int) Constant 16 + 194: TypeVector 7(int) 3 + 195: 7(int) Constant 64 + 196: 194(ivec3) ConstantComposite 195 83 83 + 197(mC): 146(ptr) Variable Private + 198: 7(int) SpecConstantOp 5362 142 + 199: 57(int) SpecConstantOp 128 198 61 + 200: TypeArray 57(int) 199 + 201: TypePointer Private 200 + 202(arr): 201(ptr) Variable Private + 203: 7(int) SpecConstantOp 5362 142 + 204: 57(int) SpecConstantOp 128 203 61 + 205: TypeArray 57(int) 204 + 206: TypePointer Private 205 + 207(arr2): 206(ptr) Variable Private + 208(F): 16(float) SpecConstant 1077936128 + 209: TypeCooperativeMatrixNV 16(float) 8 123(Z) 9 + 210: 209 ConstantComposite 35 + 211:6(float16_t) Constant 15360 + 212: 10 ConstantComposite 211 + 213(S): TypeStruct 57(int) 57(int) 57(int) + 214: 57(int) Constant 12 + 215: 57(int) Constant 23 + 216: 57(int) Constant 34 + 217: 213(S) ConstantComposite 214 215 216 + 218(SC): 57(int) SpecConstant 1 + 219: TypeCooperativeMatrixNV 6(float16_t) 8 218(SC) 218(SC) + 220: TypeArray 219 218(SC) + 221: TypeArray 220 218(SC) + 222: TypePointer Private 221 + 223(scm): 222(ptr) Variable Private 4(main): 2 Function None 3 5: Label 34(m): 33(ptr) Variable Function 52(m2): 51(ptr) Variable Function 56(x): 55(ptr) Variable Function - 105(D): 33(ptr) Variable Function - 106(A): 51(ptr) Variable Function - 108(B): 11(ptr) Variable Function - 110(C): 33(ptr) Variable Function - 114(l): 113(ptr) Variable Function - 122(F): 121(ptr) Variable Function - 127(a): 126(ptr) Variable Function - 131(md1): 55(ptr) Variable Function - 155(p1): 11(ptr) Variable Function - 156(param): 11(ptr) Variable Function - 159(p2): 18(ptr) Variable Function - 160(param): 18(ptr) Variable Function - 174(ms): 51(ptr) Variable Function + 109(D): 33(ptr) Variable Function + 110(A): 51(ptr) Variable Function + 112(B): 11(ptr) Variable Function + 114(C): 33(ptr) Variable Function + 118(l): 117(ptr) Variable Function + 126(F): 125(ptr) Variable Function + 131(a): 130(ptr) Variable Function + 134(md1): 55(ptr) Variable Function + 158(p1): 11(ptr) Variable Function + 159(param): 11(ptr) Variable Function + 162(p2): 18(ptr) Variable Function + 163(param): 18(ptr) Variable Function + 177(ms): 51(ptr) Variable Function Store 34(m) 36 37: 32 Load 34(m) 38: 32 Load 34(m) @@ -255,82 +263,88 @@ spv.coopmat.comp 77: 32 Load 34(m) 78: 71(ptr) AccessChain 69(block) 58 31 CooperativeMatrixStoreNV 78 77 73 75 MakePointerAvailableKHR NonPrivatePointerKHR 70 - 90: 89(ptr) AccessChain 88(block16) 58 31 - 91: 50 CooperativeMatrixLoadNV 90 73 75 MakePointerVisibleKHR NonPrivatePointerKHR 70 - Store 52(m2) 91 - 92: 50 Load 52(m2) - 93: 89(ptr) AccessChain 88(block16) 58 31 - CooperativeMatrixStoreNV 93 92 73 75 MakePointerAvailableKHR NonPrivatePointerKHR 70 - 96: 95(ptr) AccessChain 88(block16) 94 - 97: 82(ptr) Load 96 MakePointerVisibleKHR NonPrivatePointerKHR 70 - 99: 98(ptr) AccessChain 97 58 31 - 100: 32 CooperativeMatrixLoadNV 99 73 75 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 70 - Store 34(m) 100 - 101: 32 Load 34(m) - 102: 95(ptr) AccessChain 88(block16) 94 - 103: 82(ptr) Load 102 MakePointerVisibleKHR NonPrivatePointerKHR 70 - 104: 98(ptr) AccessChain 103 58 31 - CooperativeMatrixStoreNV 104 101 73 75 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 70 - 107: 50 Load 106(A) - 109: 10 Load 108(B) - 111: 32 Load 110(C) - 112: 32 CooperativeMatrixMulAddNV 107 109 111 - Store 105(D) 112 - Store 114(l) 116 - Store 122(F) 124 - 130: 55(ptr) AccessChain 127(a) 128 61 - Store 130 129 - Store 131(md1) 35 - 132: 32 Load 34(m) - 133: 32 Load 34(m) - 134: 32 FAdd 133 132 - Store 34(m) 134 - 136: 16(float) CompositeExtract 134 1234 - 137: 16(float) Load 131(md1) - 138: 16(float) FAdd 137 136 - Store 131(md1) 138 - 144: 143(ptr) AccessChain 142(mC2) 94 - 145: 139 Load 144 - 146: 143(ptr) AccessChain 142(mC2) 58 - Store 146 145 - 147: 71(ptr) AccessChain 69(block) 61 31 - 148: 32 CooperativeMatrixLoadNV 147 73 75 MakePointerVisibleKHR NonPrivatePointerKHR 70 - Store 34(m) 148 - 149: 32 Load 34(m) + 94: 93(ptr) AccessChain 91(block16) 92 31 + 95: 50 CooperativeMatrixLoadNV 94 73 75 MakePointerVisibleKHR NonPrivatePointerKHR 70 + Store 52(m2) 95 + 96: 50 Load 52(m2) + 97: 93(ptr) AccessChain 91(block16) 92 31 + CooperativeMatrixStoreNV 97 96 73 75 MakePointerAvailableKHR NonPrivatePointerKHR 70 + 100: 99(ptr) AccessChain 91(block16) 98 + 101: 85(ptr) Load 100 MakePointerVisibleKHR NonPrivatePointerKHR 70 + 103: 102(ptr) AccessChain 101 58 31 + 104: 32 CooperativeMatrixLoadNV 103 73 75 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 70 + Store 34(m) 104 + 105: 32 Load 34(m) + 106: 99(ptr) AccessChain 91(block16) 98 + 107: 85(ptr) Load 106 MakePointerVisibleKHR NonPrivatePointerKHR 70 + 108: 102(ptr) AccessChain 107 58 31 + CooperativeMatrixStoreNV 108 105 73 75 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 70 + 111: 50 Load 110(A) + 113: 10 Load 112(B) + 115: 32 Load 114(C) + 116: 32 CooperativeMatrixMulAddNV 111 113 115 + Store 109(D) 116 + Store 118(l) 120 + Store 126(F) 128 + 133: 55(ptr) AccessChain 131(a) 98 61 + Store 133 132 + Store 134(md1) 35 + 135: 32 Load 34(m) + 136: 32 Load 34(m) + 137: 32 FAdd 136 135 + Store 34(m) 137 + 139: 16(float) CompositeExtract 137 1234 + 140: 16(float) Load 134(md1) + 141: 16(float) FAdd 140 139 + Store 134(md1) 141 + 147: 146(ptr) AccessChain 145(mC2) 92 + 148: 142 Load 147 + 149: 146(ptr) AccessChain 145(mC2) 58 + Store 149 148 150: 71(ptr) AccessChain 69(block) 61 31 - CooperativeMatrixStoreNV 150 149 73 75 MakePointerAvailableKHR NonPrivatePointerKHR 70 - 151: 89(ptr) AccessChain 88(block16) 61 31 - 152: 50 CooperativeMatrixLoadNV 151 73 75 MakePointerVisibleKHR NonPrivatePointerKHR 70 - Store 52(m2) 152 - 153: 50 Load 52(m2) - 154: 89(ptr) AccessChain 88(block16) 61 31 - CooperativeMatrixStoreNV 154 153 73 75 MakePointerAvailableKHR NonPrivatePointerKHR 70 - 157: 10 Load 155(p1) - Store 156(param) 157 - 158: 10 FunctionCall 14(f16(f161<16><3><8><8>;) 156(param) - Store 155(p1) 158 - 161: 17 Load 159(p2) - Store 160(param) 161 - 162: 17 FunctionCall 21(f32(f1<32><3><8><8>;) 160(param) - Store 159(p2) 162 - Store 155(p1) 163 - Store 159(p2) 164 - 165: 10 Load 155(p1) - 166: 10 Load 155(p1) - 167: 10 FDiv 166 165 - Store 155(p1) 167 - 169: 10 Load 155(p1) - 170: 10 MatrixTimesScalar 169 168 - Store 155(p1) 170 - 172: 17 Load 159(p2) - 173: 17 MatrixTimesScalar 172 171 - Store 159(p2) 173 - 182: 181(ptr) AccessChain 179(shmatrix) 80 - 183: 50 CooperativeMatrixLoadNV 182 180 75 MakePointerVisibleKHR NonPrivatePointerKHR 180 - Store 174(ms) 183 - 184: 50 Load 174(ms) - 185: 181(ptr) AccessChain 179(shmatrix) 80 - CooperativeMatrixStoreNV 185 184 180 75 MakePointerAvailableKHR NonPrivatePointerKHR 180 + 151: 32 CooperativeMatrixLoadNV 150 73 75 MakePointerVisibleKHR NonPrivatePointerKHR 70 + Store 34(m) 151 + 152: 32 Load 34(m) + 153: 71(ptr) AccessChain 69(block) 61 31 + CooperativeMatrixStoreNV 153 152 73 75 MakePointerAvailableKHR NonPrivatePointerKHR 70 + 154: 93(ptr) AccessChain 91(block16) 58 31 + 155: 50 CooperativeMatrixLoadNV 154 73 75 MakePointerVisibleKHR NonPrivatePointerKHR 70 + Store 52(m2) 155 + 156: 50 Load 52(m2) + 157: 93(ptr) AccessChain 91(block16) 58 31 + CooperativeMatrixStoreNV 157 156 73 75 MakePointerAvailableKHR NonPrivatePointerKHR 70 + 160: 10 Load 158(p1) + Store 159(param) 160 + 161: 10 FunctionCall 14(f16(f161<16><3><8><8>;) 159(param) + Store 158(p1) 161 + 164: 17 Load 162(p2) + Store 163(param) 164 + 165: 17 FunctionCall 21(f32(f1<32><3><8><8>;) 163(param) + Store 162(p2) 165 + Store 158(p1) 166 + Store 162(p2) 167 + 168: 10 Load 158(p1) + 169: 10 Load 158(p1) + 170: 10 FDiv 169 168 + Store 158(p1) 170 + 172: 10 Load 158(p1) + 173: 10 MatrixTimesScalar 172 171 + Store 158(p1) 173 + 175: 17 Load 162(p2) + 176: 17 MatrixTimesScalar 175 174 + Store 162(p2) 176 + 185: 184(ptr) AccessChain 182(shmatrix) 83 + 186: 50 CooperativeMatrixLoadNV 185 183 75 MakePointerVisibleKHR NonPrivatePointerKHR 183 + Store 177(ms) 186 + 187: 50 Load 177(ms) + 188: 184(ptr) AccessChain 182(shmatrix) 83 + CooperativeMatrixStoreNV 188 187 183 75 MakePointerAvailableKHR NonPrivatePointerKHR 183 + 189: 93(ptr) AccessChain 91(block16) 61 121 83 + 190: 50 CooperativeMatrixLoadNV 189 183 75 MakePointerVisibleKHR NonPrivatePointerKHR 70 + Store 177(ms) 190 + 191: 50 Load 177(ms) + 193: 93(ptr) AccessChain 91(block16) 61 192 83 + CooperativeMatrixStoreNV 193 191 183 75 MakePointerAvailableKHR NonPrivatePointerKHR 70 Return FunctionEnd 14(f16(f161<16><3><8><8>;): 10 Function None 12 diff --git a/third_party/glslang/Test/baseResults/spv.coopmat2_error.comp.out b/third_party/glslang/Test/baseResults/spv.coopmat2_error.comp.out index 8f57496656..e47693ff22 100644 --- a/third_party/glslang/Test/baseResults/spv.coopmat2_error.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopmat2_error.comp.out @@ -20,7 +20,9 @@ ERROR: 0:76: 'add(u1;u1;f161;f161;' : number of parameters must match call to co ERROR: 0:77: '' : cooperative matrix input and result types must match ERROR: 0:77: 'perelemf32(u1;u1;f161;' : return type must match cooperative matrix component type ERROR: 0:78: '' : cooperative matrix input and result types must match -ERROR: 21 compilation errors. No code generated. +ERROR: 0:81: 'coopMatLoadTensorNV' : Only l-values corresponding to storage block or shared variables can be used with cooperative matrix load/store functions. +ERROR: 0:82: 'coopMatStoreTensorNV' : Only l-values corresponding to storage block or shared variables can be used with cooperative matrix load/store functions. +ERROR: 23 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.coopmat2_tensor.comp.out b/third_party/glslang/Test/baseResults/spv.coopmat2_tensor.comp.out index cc5e29a18c..8a1940ab23 100644 --- a/third_party/glslang/Test/baseResults/spv.coopmat2_tensor.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopmat2_tensor.comp.out @@ -1,7 +1,7 @@ spv.coopmat2_tensor.comp // Module Version 10600 // Generated by (magic number): 8000b -// Id's are bound by 139 +// Id's are bound by 162 Capability Shader Capability Float16 @@ -17,7 +17,7 @@ spv.coopmat2_tensor.comp Extension "SPV_NV_tensor_addressing" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT VulkanKHR - EntryPoint GLCompute 4 "main" 84 116 + EntryPoint GLCompute 4 "main" 90 122 ExecutionMode 4 LocalSize 64 1 1 Source GLSL 450 SourceExtension "GL_EXT_buffer_reference" @@ -33,37 +33,45 @@ spv.coopmat2_tensor.comp Name 14 "blockCoords" Name 15 "coordInBlock" Name 28 "t" - Name 34 "t2" - Name 53 "v" - Name 71 "v2" - Name 75 "v3" - Name 80 "A" - Name 82 "BufType" - MemberName 82(BufType) 0 "x" - Name 84 "Buf" - Name 112 "S" - MemberName 112(S) 0 "x" - Name 114 "SBuf" - MemberName 114(SBuf) 0 "s" - Name 116 "sbuf" - Name 123 "Clamp" - Name 126 "tc" - Name 130 "Arr" + Name 35 "t2" + Name 56 "v" + Name 75 "v2" + Name 79 "v3" + Name 84 "A" + Name 88 "BufType" + MemberName 88(BufType) 0 "arr" + MemberName 88(BufType) 1 "x" + Name 90 "Buf" + Name 118 "S" + MemberName 118(S) 0 "x" + Name 120 "SBuf" + MemberName 120(SBuf) 0 "s" + Name 122 "sbuf" + Name 129 "Clamp" + Name 132 "tc" + Name 136 "Arr" + Name 151 "Clamp_signed" + Name 154 "tc_s" + Name 158 "v4" Decorate 8(fp16Buf) Block MemberDecorate 8(fp16Buf) 0 Offset 0 Decorate 13(b) Aliased - Decorate 81 ArrayStride 2 - Decorate 82(BufType) Block - MemberDecorate 82(BufType) 0 Offset 0 - Decorate 84(Buf) Binding 1 - Decorate 84(Buf) DescriptorSet 0 - MemberDecorate 112(S) 0 Offset 0 - Decorate 113 ArrayStride 4 - Decorate 114(SBuf) Block - MemberDecorate 114(SBuf) 0 Offset 0 - Decorate 116(sbuf) Binding 0 - Decorate 116(sbuf) DescriptorSet 0 - Decorate 123(Clamp) SpecId 0 + Decorate 85 ArrayStride 2 + Decorate 86 ArrayStride 512 + Decorate 87 ArrayStride 2 + Decorate 88(BufType) Block + MemberDecorate 88(BufType) 0 Offset 0 + MemberDecorate 88(BufType) 1 Offset 131072 + Decorate 90(Buf) Binding 1 + Decorate 90(Buf) DescriptorSet 0 + MemberDecorate 118(S) 0 Offset 0 + Decorate 119 ArrayStride 4 + Decorate 120(SBuf) Block + MemberDecorate 120(SBuf) 0 Offset 0 + Decorate 122(sbuf) Binding 0 + Decorate 122(sbuf) DescriptorSet 0 + Decorate 129(Clamp) SpecId 0 + Decorate 151(Clamp_signed) SpecId 1 2: TypeVoid 3: TypeFunction 2 TypeForwardPointer 6 PhysicalStorageBufferEXT @@ -80,139 +88,166 @@ spv.coopmat2_tensor.comp 25: 9(int) Constant 0 26: TypeTensorLayoutNV 10 25 27: TypePointer Function 26 - 30: 9(int) Constant 3 - 31: 9(int) Constant 1 - 32: TypeTensorLayoutNV 30 31 - 33: TypePointer Function 32 - 37: 9(int) Constant 4 - 38: 9(int) Constant 8 - 41: 9(int) Constant 256 - 42: 9(int) Constant 512 - 45: 9(int) Constant 128 - 46: 9(int) Constant 32 - 48: 9(int) Constant 5 - 49: TypeBool - 50: 49(bool) ConstantFalse - 51: TypeTensorViewNV 48 50 25 31 10 30 37 - 52: TypePointer Function 51 - 56: 9(int) Constant 10 - 57: 9(int) Constant 11 - 58: 9(int) Constant 12 - 59: 9(int) Constant 13 - 60: 9(int) Constant 14 - 63: 9(int) Constant 15 - 66: 9(int) Constant 16 - 68: 49(bool) ConstantTrue - 69: TypeTensorViewNV 48 68 25 31 10 30 37 - 70: TypePointer Function 69 - 73: TypeTensorViewNV 10 68 31 25 + 29: 18(int) Constant 2 + 31: 9(int) Constant 3 + 32: 9(int) Constant 1 + 33: TypeTensorLayoutNV 31 32 + 34: TypePointer Function 33 + 36: 18(int) Constant 3 + 37: 18(int) Constant 1 + 40: 9(int) Constant 4 + 41: 9(int) Constant 8 + 44: 9(int) Constant 256 + 45: 9(int) Constant 512 + 48: 9(int) Constant 128 + 49: 9(int) Constant 32 + 51: 9(int) Constant 5 + 52: TypeBool + 53: 52(bool) ConstantFalse + 54: TypeTensorViewNV 51 53 25 32 10 31 40 + 55: TypePointer Function 54 + 57: 18(int) Constant 5 + 60: 9(int) Constant 10 + 61: 9(int) Constant 11 + 62: 9(int) Constant 12 + 63: 9(int) Constant 13 + 64: 9(int) Constant 14 + 67: 9(int) Constant 15 + 70: 9(int) Constant 16 + 72: 52(bool) ConstantTrue + 73: TypeTensorViewNV 51 72 25 32 10 31 40 74: TypePointer Function 73 - 77: 9(int) Constant 64 - 78: TypeCooperativeMatrixKHR 7(float16_t) 10 77 46 25 - 79: TypePointer Function 78 - 81: TypeRuntimeArray 7(float16_t) - 82(BufType): TypeStruct 81 - 83: TypePointer StorageBuffer 82(BufType) - 84(Buf): 83(ptr) Variable StorageBuffer - 85: TypePointer StorageBuffer 7(float16_t) - 111: TypeVector 7(float16_t) 2 - 112(S): TypeStruct 111(f16vec2) - 113: TypeRuntimeArray 112(S) - 114(SBuf): TypeStruct 113 - 115: TypePointer StorageBuffer 114(SBuf) - 116(sbuf): 115(ptr) Variable StorageBuffer - 117: TypePointer StorageBuffer 112(S) - 123(Clamp): 9(int) SpecConstant 1 - 124: TypeTensorLayoutNV 10 123(Clamp) - 125: TypePointer Function 124 - 128: TypeArray 78 10 - 129: TypePointer Function 128 - 131: 18(int) Constant 1 - 137: TypeVector 9(int) 3 - 138: 137(ivec3) ConstantComposite 77 31 31 + 77: TypeTensorViewNV 10 72 32 25 + 78: TypePointer Function 77 + 81: 9(int) Constant 64 + 82: TypeCooperativeMatrixKHR 7(float16_t) 10 81 49 25 + 83: TypePointer Function 82 + 85: TypeArray 7(float16_t) 44 + 86: TypeArray 85 44 + 87: TypeRuntimeArray 7(float16_t) + 88(BufType): TypeStruct 86 87 + 89: TypePointer StorageBuffer 88(BufType) + 90(Buf): 89(ptr) Variable StorageBuffer + 91: TypePointer StorageBuffer 7(float16_t) + 117: TypeVector 7(float16_t) 2 + 118(S): TypeStruct 117(f16vec2) + 119: TypeRuntimeArray 118(S) + 120(SBuf): TypeStruct 119 + 121: TypePointer StorageBuffer 120(SBuf) + 122(sbuf): 121(ptr) Variable StorageBuffer + 123: TypePointer StorageBuffer 118(S) + 129(Clamp): 9(int) SpecConstant 1 + 130: TypeTensorLayoutNV 10 129(Clamp) + 131: TypePointer Function 130 + 134: TypeArray 82 10 + 135: TypePointer Function 134 + 142: 18(int) Constant 8 + 148: 18(int) Constant 16 +151(Clamp_signed): 18(int) SpecConstant 1 + 152: TypeTensorLayoutNV 10 151(Clamp_signed) + 153: TypePointer Function 152 + 156: TypeTensorViewNV 129(Clamp) 72 25 + 157: TypePointer Function 156 + 160: TypeVector 9(int) 3 + 161: 160(ivec3) ConstantComposite 81 32 32 4(main): 2 Function None 3 5: Label 28(t): 27(ptr) Variable Function - 34(t2): 33(ptr) Variable Function - 53(v): 52(ptr) Variable Function - 71(v2): 70(ptr) Variable Function - 75(v3): 74(ptr) Variable Function - 80(A): 79(ptr) Variable Function - 126(tc): 125(ptr) Variable Function - 130(Arr): 129(ptr) Variable Function - 29: 26 CreateTensorLayoutNV - Store 28(t) 29 - 35: 32 CreateTensorLayoutNV - Store 34(t2) 35 - 36: 26 Load 28(t) - 39: 26 TensorLayoutSetBlockSizeNV 36 37 38 - Store 28(t) 39 - 40: 26 Load 28(t) - 43: 26 TensorLayoutSetDimensionNV 40 41 42 - Store 28(t) 43 - 44: 26 Load 28(t) - 47: 26 TensorLayoutSliceNV 44 45 46 41 46 - Store 28(t) 47 - 54: 51 CreateTensorViewNV - Store 53(v) 54 - 55: 51 Load 53(v) - 61: 51 TensorViewSetDimensionNV 55 56 57 58 59 60 - Store 53(v) 61 - 62: 51 Load 53(v) - 64: 51 TensorViewSetStrideNV 62 56 57 58 59 63 - Store 53(v) 64 - 65: 51 Load 53(v) - 67: 51 TensorViewSetClipNV 65 25 66 25 66 - Store 53(v) 67 - 72: 69 CreateTensorViewNV - Store 71(v2) 72 + 35(t2): 34(ptr) Variable Function + 56(v): 55(ptr) Variable Function + 75(v2): 74(ptr) Variable Function + 79(v3): 78(ptr) Variable Function + 84(A): 83(ptr) Variable Function + 132(tc): 131(ptr) Variable Function + 136(Arr): 135(ptr) Variable Function + 154(tc_s): 153(ptr) Variable Function + 158(v4): 157(ptr) Variable Function + 30: 26 CreateTensorLayoutNV + Store 28(t) 30 + 38: 33 CreateTensorLayoutNV + Store 35(t2) 38 + 39: 26 Load 28(t) + 42: 26 TensorLayoutSetBlockSizeNV 39 40 41 + Store 28(t) 42 + 43: 26 Load 28(t) + 46: 26 TensorLayoutSetDimensionNV 43 44 45 + Store 28(t) 46 + 47: 26 Load 28(t) + 50: 26 TensorLayoutSliceNV 47 48 49 44 49 + Store 28(t) 50 + 58: 54 CreateTensorViewNV + Store 56(v) 58 + 59: 54 Load 56(v) + 65: 54 TensorViewSetDimensionNV 59 60 61 62 63 64 + Store 56(v) 65 + 66: 54 Load 56(v) + 68: 54 TensorViewSetStrideNV 66 60 61 62 63 67 + Store 56(v) 68 + 69: 54 Load 56(v) + 71: 54 TensorViewSetClipNV 69 25 70 25 70 + Store 56(v) 71 76: 73 CreateTensorViewNV - Store 75(v3) 76 - 86: 85(ptr) AccessChain 84(Buf) 19 25 - 87: 26 Load 28(t) - 88: 78 Load 80(A) - 89: 78 CooperativeMatrixLoadTensorNV 86 88 87 None None - Store 80(A) 89 - 90: 78 Load 80(A) - 91: 85(ptr) AccessChain 84(Buf) 19 25 - 92: 26 Load 28(t) - CooperativeMatrixStoreTensorNV 91 90 92 None None - 93: 85(ptr) AccessChain 84(Buf) 19 25 - 94: 26 Load 28(t) - 95: 51 Load 53(v) - 96: 78 Load 80(A) - 97: 78 CooperativeMatrixLoadTensorNV 93 96 94 None TensorView 95 - Store 80(A) 97 - 98: 78 Load 80(A) - 99: 85(ptr) AccessChain 84(Buf) 19 25 + Store 75(v2) 76 + 80: 77 CreateTensorViewNV + Store 79(v3) 80 + 92: 91(ptr) AccessChain 90(Buf) 37 25 + 93: 26 Load 28(t) + 94: 82 Load 84(A) + 95: 82 CooperativeMatrixLoadTensorNV 92 94 93 None None + Store 84(A) 95 + 96: 82 Load 84(A) + 97: 91(ptr) AccessChain 90(Buf) 37 25 + 98: 26 Load 28(t) + CooperativeMatrixStoreTensorNV 97 96 98 None None + 99: 91(ptr) AccessChain 90(Buf) 37 25 100: 26 Load 28(t) - 101: 51 Load 53(v) - CooperativeMatrixStoreTensorNV 99 98 100 None TensorView 101 - 102: 85(ptr) AccessChain 84(Buf) 19 25 - 103: 26 Load 28(t) - 104: 78 Load 80(A) - 105: 78 CooperativeMatrixLoadTensorNV 102 104 103 None DecodeFunc 16(decode(1;u1[2];u1[2];) - Store 80(A) 105 - 106: 85(ptr) AccessChain 84(Buf) 19 25 - 107: 26 Load 28(t) - 108: 51 Load 53(v) - 109: 78 Load 80(A) - 110: 78 CooperativeMatrixLoadTensorNV 106 109 107 None TensorView DecodeFunc 108 16(decode(1;u1[2];u1[2];) - Store 80(A) 110 - 118: 117(ptr) AccessChain 116(sbuf) 19 31 - 119: 26 Load 28(t) - 120: 51 Load 53(v) - 121: 78 Load 80(A) - 122: 78 CooperativeMatrixLoadTensorNV 118 121 119 None TensorView DecodeFunc 120 16(decode(1;u1[2];u1[2];) - Store 80(A) 122 - 127: 124 CreateTensorLayoutNV - Store 126(tc) 127 - 132: 79(ptr) AccessChain 130(Arr) 131 - 133: 85(ptr) AccessChain 84(Buf) 19 25 - 134: 26 Load 28(t) - 135: 78 Load 132 - 136: 78 CooperativeMatrixLoadTensorNV 133 135 134 None None - Store 132 136 + 101: 54 Load 56(v) + 102: 82 Load 84(A) + 103: 82 CooperativeMatrixLoadTensorNV 99 102 100 None TensorView 101 + Store 84(A) 103 + 104: 82 Load 84(A) + 105: 91(ptr) AccessChain 90(Buf) 37 25 + 106: 26 Load 28(t) + 107: 54 Load 56(v) + CooperativeMatrixStoreTensorNV 105 104 106 None TensorView 107 + 108: 91(ptr) AccessChain 90(Buf) 37 25 + 109: 26 Load 28(t) + 110: 82 Load 84(A) + 111: 82 CooperativeMatrixLoadTensorNV 108 110 109 None DecodeFunc 16(decode(1;u1[2];u1[2];) + Store 84(A) 111 + 112: 91(ptr) AccessChain 90(Buf) 37 25 + 113: 26 Load 28(t) + 114: 54 Load 56(v) + 115: 82 Load 84(A) + 116: 82 CooperativeMatrixLoadTensorNV 112 115 113 None TensorView DecodeFunc 114 16(decode(1;u1[2];u1[2];) + Store 84(A) 116 + 124: 123(ptr) AccessChain 122(sbuf) 19 32 + 125: 26 Load 28(t) + 126: 54 Load 56(v) + 127: 82 Load 84(A) + 128: 82 CooperativeMatrixLoadTensorNV 124 127 125 None TensorView DecodeFunc 126 16(decode(1;u1[2];u1[2];) + Store 84(A) 128 + 133: 130 CreateTensorLayoutNV + Store 132(tc) 133 + 137: 83(ptr) AccessChain 136(Arr) 37 + 138: 91(ptr) AccessChain 90(Buf) 37 25 + 139: 26 Load 28(t) + 140: 82 Load 137 + 141: 82 CooperativeMatrixLoadTensorNV 138 140 139 None None + Store 137 141 + 143: 91(ptr) AccessChain 90(Buf) 19 142 25 + 144: 26 Load 28(t) + 145: 82 Load 84(A) + 146: 82 CooperativeMatrixLoadTensorNV 143 145 144 None None + Store 84(A) 146 + 147: 82 Load 84(A) + 149: 91(ptr) AccessChain 90(Buf) 19 148 25 + 150: 26 Load 28(t) + CooperativeMatrixStoreTensorNV 149 147 150 None None + 155: 152 CreateTensorLayoutNV + Store 154(tc_s) 155 + 159: 156 CreateTensorViewNV + Store 158(v4) 159 Return FunctionEnd 16(decode(1;u1[2];u1[2];):7(float16_t) Function None 12 diff --git a/third_party/glslang/Test/baseResults/spv.coopmatKHR.comp.out b/third_party/glslang/Test/baseResults/spv.coopmatKHR.comp.out index 167e6c95ef..045d57347b 100644 --- a/third_party/glslang/Test/baseResults/spv.coopmatKHR.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopmatKHR.comp.out @@ -1,7 +1,7 @@ spv.coopmatKHR.comp // Module Version 10300 // Generated by (magic number): 8000b -// Id's are bound by 238 +// Id's are bound by 245 Capability Shader Capability Float16 @@ -35,43 +35,44 @@ spv.coopmatKHR.comp MemberName 68(Block) 0 "y" MemberName 68(Block) 1 "x" Name 70 "block" - Name 82 "Block16" - MemberName 82(Block16) 0 "y" - MemberName 82(Block16) 1 "x" - MemberName 82(Block16) 2 "b" - Name 85 "Block" - MemberName 85(Block) 0 "y" - MemberName 85(Block) 1 "x" - Name 87 "block16" - Name 104 "D" - Name 108 "A" - Name 112 "B" - Name 114 "C" - Name 118 "l" - Name 122 "Y" - Name 123 "Z" - Name 126 "F" - Name 131 "a" - Name 135 "md1" - Name 146 "mC2" - Name 159 "p1" - Name 160 "param" - Name 163 "p2" - Name 164 "param" - Name 178 "ms" - Name 183 "shmatrix" - Name 192 "ms8A" - Name 196 "ms8B" - Name 200 "ms8C" - Name 215 "m16" - Name 221 "mC" - Name 222 "F" - Name 227 "S" - MemberName 227(S) 0 "a" - MemberName 227(S) 1 "b" - MemberName 227(S) 2 "c" - Name 232 "SC" - Name 237 "scm" + Name 85 "Block16" + MemberName 85(Block16) 0 "arr" + MemberName 85(Block16) 1 "y" + MemberName 85(Block16) 2 "x" + MemberName 85(Block16) 3 "b" + Name 88 "Block" + MemberName 88(Block) 0 "y" + MemberName 88(Block) 1 "x" + Name 90 "block16" + Name 108 "D" + Name 112 "A" + Name 116 "B" + Name 118 "C" + Name 122 "l" + Name 126 "Y" + Name 127 "Z" + Name 130 "F" + Name 135 "a" + Name 138 "md1" + Name 149 "mC2" + Name 162 "p1" + Name 163 "param" + Name 166 "p2" + Name 167 "param" + Name 181 "ms" + Name 186 "shmatrix" + Name 200 "ms8A" + Name 204 "ms8B" + Name 208 "ms8C" + Name 222 "m16" + Name 228 "mC" + Name 229 "F" + Name 234 "S" + MemberName 234(S) 0 "a" + MemberName 234(S) 1 "b" + MemberName 234(S) 2 "c" + Name 239 "SC" + Name 244 "scm" Decorate 66 ArrayStride 4 Decorate 67 ArrayStride 4 Decorate 68(Block) Block @@ -79,23 +80,26 @@ spv.coopmatKHR.comp MemberDecorate 68(Block) 1 Offset 4194304 Decorate 70(block) Binding 0 Decorate 70(block) DescriptorSet 0 - Decorate 78 ArrayStride 2 - Decorate 80 ArrayStride 2 - Decorate 82(Block16) Block - MemberDecorate 82(Block16) 0 Offset 0 - MemberDecorate 82(Block16) 1 Offset 2097152 - MemberDecorate 82(Block16) 2 Offset 2097160 - Decorate 83 ArrayStride 4 - Decorate 84 ArrayStride 4 - Decorate 85(Block) Block - MemberDecorate 85(Block) 0 Offset 0 - MemberDecorate 85(Block) 1 Offset 4194304 - Decorate 87(block16) Binding 0 - Decorate 87(block16) DescriptorSet 0 - Decorate 122(Y) SpecId 0 - Decorate 220 BuiltIn WorkgroupSize - Decorate 222(F) SpecId 1 - Decorate 232(SC) SpecId 2 + Decorate 79 ArrayStride 2 + Decorate 80 ArrayStride 512 + Decorate 81 ArrayStride 2 + Decorate 83 ArrayStride 2 + Decorate 85(Block16) Block + MemberDecorate 85(Block16) 0 Offset 0 + MemberDecorate 85(Block16) 1 Offset 131072 + MemberDecorate 85(Block16) 2 Offset 2228224 + MemberDecorate 85(Block16) 3 Offset 2228232 + Decorate 86 ArrayStride 4 + Decorate 87 ArrayStride 4 + Decorate 88(Block) Block + MemberDecorate 88(Block) 0 Offset 0 + MemberDecorate 88(Block) 1 Offset 4194304 + Decorate 90(block16) Binding 0 + Decorate 90(block16) DescriptorSet 0 + Decorate 126(Y) SpecId 0 + Decorate 227 BuiltIn WorkgroupSize + Decorate 229(F) SpecId 1 + Decorate 239(SC) SpecId 2 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 16 @@ -131,107 +135,110 @@ spv.coopmatKHR.comp 71: 7(int) Constant 5 72: TypePointer StorageBuffer 17(float) 74: 7(int) Constant 128 - 78: TypeArray 6(float16_t) 65 - 79: 7(int) Constant 1 - 80: TypeArray 6(float16_t) 79 - TypeForwardPointer 81 PhysicalStorageBufferEXT - 82(Block16): TypeStruct 78 80 81 - 83: TypeArray 17(float) 65 - 84: TypeRuntimeArray 17(float) - 85(Block): TypeStruct 83 84 - 81: TypePointer PhysicalStorageBufferEXT 85(Block) - 86: TypePointer StorageBuffer 82(Block16) - 87(block16): 86(ptr) Variable StorageBuffer - 88: TypePointer StorageBuffer 6(float16_t) - 93: 58(int) Constant 2 - 94: TypePointer StorageBuffer 81(ptr) - 97: TypePointer PhysicalStorageBufferEXT 17(float) - 105: 7(int) Constant 0 - 106: TypeCooperativeMatrixKHR 6(float16_t) 8 32 9 105 - 107: TypePointer Function 106 - 110: TypeCooperativeMatrixKHR 6(float16_t) 8 9 9 79 + 78: 7(int) Constant 256 + 79: TypeArray 6(float16_t) 78 + 80: TypeArray 79 78 + 81: TypeArray 6(float16_t) 65 + 82: 7(int) Constant 1 + 83: TypeArray 6(float16_t) 82 + TypeForwardPointer 84 PhysicalStorageBufferEXT + 85(Block16): TypeStruct 80 81 83 84 + 86: TypeArray 17(float) 65 + 87: TypeRuntimeArray 17(float) + 88(Block): TypeStruct 86 87 + 84: TypePointer PhysicalStorageBufferEXT 88(Block) + 89: TypePointer StorageBuffer 85(Block16) + 90(block16): 89(ptr) Variable StorageBuffer + 91: 58(int) Constant 2 + 92: TypePointer StorageBuffer 6(float16_t) + 97: 58(int) Constant 3 + 98: TypePointer StorageBuffer 84(ptr) + 101: TypePointer PhysicalStorageBufferEXT 17(float) + 109: 7(int) Constant 0 + 110: TypeCooperativeMatrixKHR 6(float16_t) 8 32 9 109 111: TypePointer Function 110 - 117: TypePointer Function 58(int) - 121: 58(int) Constant 8 - 122(Y): 58(int) SpecConstant 2 - 123(Z): 58(int) SpecConstantOp 132 121 122(Y) - 124: TypeCooperativeMatrixKHR 6(float16_t) 8 123(Z) 123(Z) 10 - 125: TypePointer Function 124 - 127:6(float16_t) Constant 0 - 128: 124 ConstantComposite 127 - 129: TypeArray 33 71 - 130: TypePointer Function 129 - 132: 58(int) Constant 3 - 133: 17(float) Constant 1065353216 - 139: 58(int) Constant 1234 - 143: TypeCooperativeMatrixKHR 6(float16_t) 8 123(Z) 9 10 - 144: TypeArray 143 8 - 145: TypePointer Private 144 - 146(mC2): 145(ptr) Variable Private - 147: TypePointer Private 143 - 167: 11 ConstantComposite 127 - 168: 18 ConstantComposite 36 - 172:6(float16_t) Constant 16384 - 175: 17(float) Constant 1082130432 - 179: TypeVector 7(int) 4 - 180: 7(int) Constant 32 - 181: TypeArray 179(ivec4) 180 - 182: TypePointer Workgroup 181 - 183(shmatrix): 182(ptr) Variable Workgroup - 184: TypePointer Workgroup 179(ivec4) - 189: TypeInt 8 1 - 190: TypeCooperativeMatrixKHR 189(int8_t) 8 9 9 105 - 191: TypePointer Function 190 - 194: TypeCooperativeMatrixKHR 189(int8_t) 8 9 9 79 - 195: TypePointer Function 194 - 198: TypeCooperativeMatrixKHR 189(int8_t) 8 9 9 10 + 114: TypeCooperativeMatrixKHR 6(float16_t) 8 9 9 82 + 115: TypePointer Function 114 + 121: TypePointer Function 58(int) + 125: 58(int) Constant 8 + 126(Y): 58(int) SpecConstant 2 + 127(Z): 58(int) SpecConstantOp 132 125 126(Y) + 128: TypeCooperativeMatrixKHR 6(float16_t) 8 127(Z) 127(Z) 10 + 129: TypePointer Function 128 + 131:6(float16_t) Constant 0 + 132: 128 ConstantComposite 131 + 133: TypeArray 33 71 + 134: TypePointer Function 133 + 136: 17(float) Constant 1065353216 + 142: 58(int) Constant 1234 + 146: TypeCooperativeMatrixKHR 6(float16_t) 8 127(Z) 9 10 + 147: TypeArray 146 8 + 148: TypePointer Private 147 + 149(mC2): 148(ptr) Variable Private + 150: TypePointer Private 146 + 170: 11 ConstantComposite 131 + 171: 18 ConstantComposite 36 + 175:6(float16_t) Constant 16384 + 178: 17(float) Constant 1082130432 + 182: TypeVector 7(int) 4 + 183: 7(int) Constant 32 + 184: TypeArray 182(ivec4) 183 + 185: TypePointer Workgroup 184 + 186(shmatrix): 185(ptr) Variable Workgroup + 187: TypePointer Workgroup 182(ivec4) + 195: 58(int) Constant 16 + 197: TypeInt 8 1 + 198: TypeCooperativeMatrixKHR 197(int8_t) 8 9 9 109 199: TypePointer Function 198 - 210: 58(int) Constant 16 - 212: TypeInt 16 1 - 213: TypeCooperativeMatrixKHR 212(int16_t) 8 9 9 105 - 214: TypePointer Function 213 - 218: TypeVector 7(int) 3 - 219: 7(int) Constant 64 - 220: 218(ivec3) ConstantComposite 219 79 79 - 221(mC): 147(ptr) Variable Private - 222(F): 17(float) SpecConstant 1077936128 - 223: TypeCooperativeMatrixKHR 17(float) 8 123(Z) 9 10 - 224: 223 ConstantComposite 36 - 225:6(float16_t) Constant 15360 - 226: 11 ConstantComposite 225 - 227(S): TypeStruct 58(int) 58(int) 58(int) - 228: 58(int) Constant 12 - 229: 58(int) Constant 23 - 230: 58(int) Constant 34 - 231: 227(S) ConstantComposite 228 229 230 - 232(SC): 58(int) SpecConstant 1 - 233: TypeCooperativeMatrixKHR 6(float16_t) 8 232(SC) 232(SC) 10 - 234: TypeArray 233 232(SC) - 235: TypeArray 234 232(SC) - 236: TypePointer Private 235 - 237(scm): 236(ptr) Variable Private + 202: TypeCooperativeMatrixKHR 197(int8_t) 8 9 9 82 + 203: TypePointer Function 202 + 206: TypeCooperativeMatrixKHR 197(int8_t) 8 9 9 10 + 207: TypePointer Function 206 + 219: TypeInt 16 1 + 220: TypeCooperativeMatrixKHR 219(int16_t) 8 9 9 109 + 221: TypePointer Function 220 + 225: TypeVector 7(int) 3 + 226: 7(int) Constant 64 + 227: 225(ivec3) ConstantComposite 226 82 82 + 228(mC): 150(ptr) Variable Private + 229(F): 17(float) SpecConstant 1077936128 + 230: TypeCooperativeMatrixKHR 17(float) 8 127(Z) 9 10 + 231: 230 ConstantComposite 36 + 232:6(float16_t) Constant 15360 + 233: 11 ConstantComposite 232 + 234(S): TypeStruct 58(int) 58(int) 58(int) + 235: 58(int) Constant 12 + 236: 58(int) Constant 23 + 237: 58(int) Constant 34 + 238: 234(S) ConstantComposite 235 236 237 + 239(SC): 58(int) SpecConstant 1 + 240: TypeCooperativeMatrixKHR 6(float16_t) 8 239(SC) 239(SC) 10 + 241: TypeArray 240 239(SC) + 242: TypeArray 241 239(SC) + 243: TypePointer Private 242 + 244(scm): 243(ptr) Variable Private 4(main): 2 Function None 3 5: Label 35(m): 34(ptr) Variable Function 53(m2): 52(ptr) Variable Function 57(x): 56(ptr) Variable Function - 104(D): 34(ptr) Variable Function - 108(A): 107(ptr) Variable Function - 112(B): 111(ptr) Variable Function - 114(C): 34(ptr) Variable Function - 118(l): 117(ptr) Variable Function - 126(F): 125(ptr) Variable Function - 131(a): 130(ptr) Variable Function - 135(md1): 56(ptr) Variable Function - 159(p1): 12(ptr) Variable Function - 160(param): 12(ptr) Variable Function - 163(p2): 19(ptr) Variable Function - 164(param): 19(ptr) Variable Function - 178(ms): 52(ptr) Variable Function - 192(ms8A): 191(ptr) Variable Function - 196(ms8B): 195(ptr) Variable Function - 200(ms8C): 199(ptr) Variable Function - 215(m16): 214(ptr) Variable Function + 108(D): 34(ptr) Variable Function + 112(A): 111(ptr) Variable Function + 116(B): 115(ptr) Variable Function + 118(C): 34(ptr) Variable Function + 122(l): 121(ptr) Variable Function + 130(F): 129(ptr) Variable Function + 135(a): 134(ptr) Variable Function + 138(md1): 56(ptr) Variable Function + 162(p1): 12(ptr) Variable Function + 163(param): 12(ptr) Variable Function + 166(p2): 19(ptr) Variable Function + 167(param): 19(ptr) Variable Function + 181(ms): 52(ptr) Variable Function + 200(ms8A): 199(ptr) Variable Function + 204(ms8B): 203(ptr) Variable Function + 208(ms8C): 207(ptr) Variable Function + 222(m16): 221(ptr) Variable Function Store 35(m) 37 38: 33 Load 35(m) 39: 33 Load 35(m) @@ -265,99 +272,105 @@ spv.coopmatKHR.comp 76: 33 Load 35(m) 77: 72(ptr) AccessChain 70(block) 59 32 CooperativeMatrixStoreKHR 77 76 62 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 - 89: 88(ptr) AccessChain 87(block16) 59 32 - 90: 51 CooperativeMatrixLoadKHR 89 62 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 - Store 53(m2) 90 - 91: 51 Load 53(m2) - 92: 88(ptr) AccessChain 87(block16) 59 32 - CooperativeMatrixStoreKHR 92 91 62 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 - 95: 94(ptr) AccessChain 87(block16) 93 - 96: 81(ptr) Load 95 MakePointerVisibleKHR NonPrivatePointerKHR 71 - 98: 97(ptr) AccessChain 96 59 32 - 99: 33 CooperativeMatrixLoadKHR 98 62 74 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 71 - Store 35(m) 99 - 100: 33 Load 35(m) - 101: 94(ptr) AccessChain 87(block16) 93 - 102: 81(ptr) Load 101 MakePointerVisibleKHR NonPrivatePointerKHR 71 - 103: 97(ptr) AccessChain 102 59 32 - CooperativeMatrixStoreKHR 103 100 62 74 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 71 - 109: 106 Load 108(A) - 113: 110 Load 112(B) - 115: 33 Load 114(C) - 116: 33 CooperativeMatrixMulAddKHR 109 113 115 - Store 104(D) 116 - 119: 7(int) CooperativeMatrixLengthKHR 33 - 120: 58(int) Bitcast 119 - Store 118(l) 120 - Store 126(F) 128 - 134: 56(ptr) AccessChain 131(a) 132 62 - Store 134 133 - Store 135(md1) 36 - 136: 33 Load 35(m) - 137: 33 Load 35(m) - 138: 33 FAdd 137 136 - Store 35(m) 138 - 140: 17(float) CompositeExtract 138 1234 - 141: 17(float) Load 135(md1) - 142: 17(float) FAdd 141 140 - Store 135(md1) 142 - 148: 147(ptr) AccessChain 146(mC2) 93 - 149: 143 Load 148 - 150: 147(ptr) AccessChain 146(mC2) 59 - Store 150 149 - 151: 72(ptr) AccessChain 70(block) 62 32 - 152: 33 CooperativeMatrixLoadKHR 151 62 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 - Store 35(m) 152 - 153: 33 Load 35(m) + 93: 92(ptr) AccessChain 90(block16) 91 32 + 94: 51 CooperativeMatrixLoadKHR 93 62 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 + Store 53(m2) 94 + 95: 51 Load 53(m2) + 96: 92(ptr) AccessChain 90(block16) 91 32 + CooperativeMatrixStoreKHR 96 95 62 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 + 99: 98(ptr) AccessChain 90(block16) 97 + 100: 84(ptr) Load 99 MakePointerVisibleKHR NonPrivatePointerKHR 71 + 102: 101(ptr) AccessChain 100 59 32 + 103: 33 CooperativeMatrixLoadKHR 102 62 74 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 71 + Store 35(m) 103 + 104: 33 Load 35(m) + 105: 98(ptr) AccessChain 90(block16) 97 + 106: 84(ptr) Load 105 MakePointerVisibleKHR NonPrivatePointerKHR 71 + 107: 101(ptr) AccessChain 106 59 32 + CooperativeMatrixStoreKHR 107 104 62 74 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 71 + 113: 110 Load 112(A) + 117: 114 Load 116(B) + 119: 33 Load 118(C) + 120: 33 CooperativeMatrixMulAddKHR 113 117 119 + Store 108(D) 120 + 123: 7(int) CooperativeMatrixLengthKHR 33 + 124: 58(int) Bitcast 123 + Store 122(l) 124 + Store 130(F) 132 + 137: 56(ptr) AccessChain 135(a) 97 62 + Store 137 136 + Store 138(md1) 36 + 139: 33 Load 35(m) + 140: 33 Load 35(m) + 141: 33 FAdd 140 139 + Store 35(m) 141 + 143: 17(float) CompositeExtract 141 1234 + 144: 17(float) Load 138(md1) + 145: 17(float) FAdd 144 143 + Store 138(md1) 145 + 151: 150(ptr) AccessChain 149(mC2) 91 + 152: 146 Load 151 + 153: 150(ptr) AccessChain 149(mC2) 59 + Store 153 152 154: 72(ptr) AccessChain 70(block) 62 32 - CooperativeMatrixStoreKHR 154 153 62 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 - 155: 88(ptr) AccessChain 87(block16) 62 32 - 156: 51 CooperativeMatrixLoadKHR 155 62 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 - Store 53(m2) 156 - 157: 51 Load 53(m2) - 158: 88(ptr) AccessChain 87(block16) 62 32 - CooperativeMatrixStoreKHR 158 157 62 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 - 161: 11 Load 159(p1) - Store 160(param) 161 - 162: 11 FunctionCall 15(f16(f161<3><8><8><2>;) 160(param) - Store 159(p1) 162 - 165: 18 Load 163(p2) - Store 164(param) 165 - 166: 18 FunctionCall 22(f32(f1<3><8><8><2>;) 164(param) - Store 163(p2) 166 - Store 159(p1) 167 - Store 163(p2) 168 - 169: 11 Load 159(p1) - 170: 11 Load 159(p1) - 171: 11 FDiv 170 169 - Store 159(p1) 171 - 173: 11 Load 159(p1) - 174: 11 MatrixTimesScalar 173 172 - Store 159(p1) 174 - 176: 18 Load 163(p2) - 177: 18 MatrixTimesScalar 176 175 - Store 163(p2) 177 - 185: 184(ptr) AccessChain 183(shmatrix) 79 - 186: 51 CooperativeMatrixLoadKHR 185 62 10 MakePointerVisibleKHR NonPrivatePointerKHR 10 - Store 178(ms) 186 - 187: 51 Load 178(ms) - 188: 184(ptr) AccessChain 183(shmatrix) 79 - CooperativeMatrixStoreKHR 188 187 62 10 MakePointerAvailableKHR NonPrivatePointerKHR 10 - 193: 190 Load 192(ms8A) - 197: 194 Load 196(ms8B) - 201: 198 Load 200(ms8C) - 202: 198 CooperativeMatrixMulAddKHR 193 197 201 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR - 203: 190 Load 192(ms8A) - 204: 194 Load 196(ms8B) - 205: 198 Load 200(ms8C) - 206: 198 CooperativeMatrixMulAddKHR 203 204 205 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR - 207: 190 Load 192(ms8A) - 208: 194 Load 196(ms8B) - 209: 198 Load 200(ms8C) - 211: 198 CooperativeMatrixMulAddKHR 207 208 209 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR SaturatingAccumulationKHR - 216: 213 Load 215(m16) - 217: 184(ptr) AccessChain 183(shmatrix) 79 - CooperativeMatrixStoreKHR 217 216 62 10 MakePointerAvailableKHR NonPrivatePointerKHR 10 + 155: 33 CooperativeMatrixLoadKHR 154 62 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 + Store 35(m) 155 + 156: 33 Load 35(m) + 157: 72(ptr) AccessChain 70(block) 62 32 + CooperativeMatrixStoreKHR 157 156 62 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 + 158: 92(ptr) AccessChain 90(block16) 59 32 + 159: 51 CooperativeMatrixLoadKHR 158 62 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 + Store 53(m2) 159 + 160: 51 Load 53(m2) + 161: 92(ptr) AccessChain 90(block16) 59 32 + CooperativeMatrixStoreKHR 161 160 62 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 + 164: 11 Load 162(p1) + Store 163(param) 164 + 165: 11 FunctionCall 15(f16(f161<3><8><8><2>;) 163(param) + Store 162(p1) 165 + 168: 18 Load 166(p2) + Store 167(param) 168 + 169: 18 FunctionCall 22(f32(f1<3><8><8><2>;) 167(param) + Store 166(p2) 169 + Store 162(p1) 170 + Store 166(p2) 171 + 172: 11 Load 162(p1) + 173: 11 Load 162(p1) + 174: 11 FDiv 173 172 + Store 162(p1) 174 + 176: 11 Load 162(p1) + 177: 11 MatrixTimesScalar 176 175 + Store 162(p1) 177 + 179: 18 Load 166(p2) + 180: 18 MatrixTimesScalar 179 178 + Store 166(p2) 180 + 188: 187(ptr) AccessChain 186(shmatrix) 82 + 189: 51 CooperativeMatrixLoadKHR 188 62 10 MakePointerVisibleKHR NonPrivatePointerKHR 10 + Store 181(ms) 189 + 190: 51 Load 181(ms) + 191: 187(ptr) AccessChain 186(shmatrix) 82 + CooperativeMatrixStoreKHR 191 190 62 10 MakePointerAvailableKHR NonPrivatePointerKHR 10 + 192: 92(ptr) AccessChain 90(block16) 62 125 82 + 193: 51 CooperativeMatrixLoadKHR 192 62 10 MakePointerVisibleKHR NonPrivatePointerKHR 71 + Store 181(ms) 193 + 194: 51 Load 181(ms) + 196: 92(ptr) AccessChain 90(block16) 62 195 82 + CooperativeMatrixStoreKHR 196 194 62 10 MakePointerAvailableKHR NonPrivatePointerKHR 71 + 201: 198 Load 200(ms8A) + 205: 202 Load 204(ms8B) + 209: 206 Load 208(ms8C) + 210: 206 CooperativeMatrixMulAddKHR 201 205 209 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR + 211: 198 Load 200(ms8A) + 212: 202 Load 204(ms8B) + 213: 206 Load 208(ms8C) + 214: 206 CooperativeMatrixMulAddKHR 211 212 213 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR + 215: 198 Load 200(ms8A) + 216: 202 Load 204(ms8B) + 217: 206 Load 208(ms8C) + 218: 206 CooperativeMatrixMulAddKHR 215 216 217 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR SaturatingAccumulationKHR + 223: 220 Load 222(m16) + 224: 187(ptr) AccessChain 186(shmatrix) 82 + CooperativeMatrixStoreKHR 224 223 62 10 MakePointerAvailableKHR NonPrivatePointerKHR 10 Return FunctionEnd 15(f16(f161<3><8><8><2>;): 11 Function None 13 diff --git a/third_party/glslang/Test/baseResults/spv.coopmatKHR_Error.comp.out b/third_party/glslang/Test/baseResults/spv.coopmatKHR_Error.comp.out index cfe6d339ff..bb79f6d8a4 100644 --- a/third_party/glslang/Test/baseResults/spv.coopmatKHR_Error.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopmatKHR_Error.comp.out @@ -34,7 +34,9 @@ ERROR: 0:60: '=' : cannot convert from ' const float' to ' temp coopmat<3, 4, 4 ERROR: 0:63: 'expression' : left of '[' is not of type array, matrix, or vector ERROR: 0:66: '.' : cannot apply to a cooperative matrix type: x ERROR: 0:68: 'transpose' : no matching overloaded function found -ERROR: 35 compilation errors. No code generated. +ERROR: 0:73: 'coopMatLoad' : Only l-values corresponding to storage block or shared variables can be used with cooperative matrix load/store functions. +ERROR: 0:74: 'coopMatStore' : Only l-values corresponding to storage block or shared variables can be used with cooperative matrix load/store functions. +ERROR: 37 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.coopmatKHR_matmuladd_Error.comp.out b/third_party/glslang/Test/baseResults/spv.coopmatKHR_matmuladd_Error.comp.out new file mode 100644 index 0000000000..94914903ac --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.coopmatKHR_matmuladd_Error.comp.out @@ -0,0 +1,12 @@ +spv.coopmatKHR_matmuladd_Error.comp +ERROR: 0:26: 'a' : cannot multiply coop matrices with incompatible sizes 3 x 4 with 3 x 4 +ERROR: 0:37: 'i' : cannot multiply coop matrices with incompatible sizes spec_const x spec_const with spec_const x spec_const +ERROR: 0:45: 'e' : cannot add coop matrices with incompatible sizes 3 x 3 with 4 x 4 +ERROR: 0:50: 'f' : coop matrix A in MulAdd operation has incompatible usage property, found 1, but needed 0 +ERROR: 0:55: 'g' : coop matrix B in MulAdd operation has incompatible usage property, found 2, but needed 1 +ERROR: 0:60: 'h' : coop matrix C in MulAdd operation has incompatible usage property, found 0, but needed 2 +ERROR: 0:60: 'assign' : cannot convert from ' temp coopmat<3, 3, 3, 0> float16_t' to ' temp coopmat<3, 4, 4, 2> float16_t' +ERROR: 7 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.coopmat_Error.comp.out b/third_party/glslang/Test/baseResults/spv.coopmat_Error.comp.out index 49223b002b..7fdbb7d3b3 100644 --- a/third_party/glslang/Test/baseResults/spv.coopmat_Error.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopmat_Error.comp.out @@ -29,7 +29,9 @@ ERROR: 0:71: '*' : wrong operand types: no operation '*' exists that takes a le ERROR: 0:72: '*' : wrong operand types: no operation '*' exists that takes a left-hand operand of type ' temp<32, 3, 16, 8> highp float' and a right operand of type ' const float16_t' (or there is no acceptable conversion) ERROR: 0:73: '*' : wrong operand types: no operation '*' exists that takes a left-hand operand of type ' const float16_t' and a right operand of type ' temp<32, 3, 16, 8> highp float' (or there is no acceptable conversion) ERROR: 0:75: 'transpose' : no matching overloaded function found -ERROR: 30 compilation errors. No code generated. +ERROR: 0:80: 'coopMatLoadNV' : Only l-values corresponding to storage block or shared variables can be used with cooperative matrix load/store functions. +ERROR: 0:81: 'coopMatStoreNV' : Only l-values corresponding to storage block or shared variables can be used with cooperative matrix load/store functions. +ERROR: 32 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.coopmat_armlayout.comp.out b/third_party/glslang/Test/baseResults/spv.coopmat_armlayout.comp.out index d19625e579..090ca2edac 100644 --- a/third_party/glslang/Test/baseResults/spv.coopmat_armlayout.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopmat_armlayout.comp.out @@ -1,7 +1,7 @@ spv.coopmat_armlayout.comp // Module Version 10300 // Generated by (magic number): 8000b -// Id's are bound by 239 +// Id's are bound by 240 Capability Shader Capability Float16 @@ -37,43 +37,43 @@ spv.coopmat_armlayout.comp MemberName 68(Block) 0 "y" MemberName 68(Block) 1 "x" Name 70 "block" - Name 83 "Block16" - MemberName 83(Block16) 0 "y" - MemberName 83(Block16) 1 "x" - MemberName 83(Block16) 2 "b" - Name 86 "Block" - MemberName 86(Block) 0 "y" - MemberName 86(Block) 1 "x" - Name 88 "block16" - Name 105 "D" - Name 109 "A" - Name 113 "B" - Name 115 "C" - Name 119 "l" - Name 123 "Y" - Name 124 "Z" - Name 127 "F" - Name 132 "a" - Name 136 "md1" - Name 147 "mC2" - Name 160 "p1" - Name 161 "param" - Name 164 "p2" - Name 165 "param" - Name 179 "ms" - Name 184 "shmatrix" - Name 193 "ms8A" - Name 197 "ms8B" - Name 201 "ms8C" - Name 216 "m16" - Name 222 "mC" - Name 223 "F" - Name 228 "S" - MemberName 228(S) 0 "a" - MemberName 228(S) 1 "b" - MemberName 228(S) 2 "c" - Name 233 "SC" - Name 238 "scm" + Name 82 "Block16" + MemberName 82(Block16) 0 "y" + MemberName 82(Block16) 1 "x" + MemberName 82(Block16) 2 "b" + Name 85 "Block" + MemberName 85(Block) 0 "y" + MemberName 85(Block) 1 "x" + Name 87 "block16" + Name 104 "D" + Name 108 "A" + Name 112 "B" + Name 114 "C" + Name 118 "l" + Name 122 "Y" + Name 123 "Z" + Name 126 "F" + Name 131 "a" + Name 135 "md1" + Name 146 "mC2" + Name 159 "p1" + Name 160 "param" + Name 163 "p2" + Name 164 "param" + Name 180 "ms" + Name 185 "shmatrix" + Name 194 "ms8A" + Name 198 "ms8B" + Name 202 "ms8C" + Name 217 "m16" + Name 223 "mC" + Name 224 "F" + Name 229 "S" + MemberName 229(S) 0 "a" + MemberName 229(S) 1 "b" + MemberName 229(S) 2 "c" + Name 234 "SC" + Name 239 "scm" Decorate 66 ArrayStride 4 Decorate 67 ArrayStride 4 Decorate 68(Block) Block @@ -82,22 +82,22 @@ spv.coopmat_armlayout.comp Decorate 70(block) Binding 0 Decorate 70(block) DescriptorSet 0 Decorate 79 ArrayStride 2 - Decorate 81 ArrayStride 2 - Decorate 83(Block16) Block - MemberDecorate 83(Block16) 0 Offset 0 - MemberDecorate 83(Block16) 1 Offset 2097152 - MemberDecorate 83(Block16) 2 Offset 2097160 + Decorate 80 ArrayStride 2 + Decorate 82(Block16) Block + MemberDecorate 82(Block16) 0 Offset 0 + MemberDecorate 82(Block16) 1 Offset 2097152 + MemberDecorate 82(Block16) 2 Offset 2097160 + Decorate 83 ArrayStride 4 Decorate 84 ArrayStride 4 - Decorate 85 ArrayStride 4 - Decorate 86(Block) Block - MemberDecorate 86(Block) 0 Offset 0 - MemberDecorate 86(Block) 1 Offset 4194304 - Decorate 88(block16) Binding 0 - Decorate 88(block16) DescriptorSet 0 - Decorate 123(Y) SpecId 0 - Decorate 221 BuiltIn WorkgroupSize - Decorate 223(F) SpecId 1 - Decorate 233(SC) SpecId 2 + Decorate 85(Block) Block + MemberDecorate 85(Block) 0 Offset 0 + MemberDecorate 85(Block) 1 Offset 4194304 + Decorate 87(block16) Binding 0 + Decorate 87(block16) DescriptorSet 0 + Decorate 122(Y) SpecId 0 + Decorate 222 BuiltIn WorkgroupSize + Decorate 224(F) SpecId 1 + Decorate 234(SC) SpecId 2 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 16 @@ -132,109 +132,110 @@ spv.coopmat_armlayout.comp 70(block): 69(ptr) Variable StorageBuffer 71: 7(int) Constant 5 72: TypePointer StorageBuffer 17(float) - 74: 7(int) Constant 128 + 74: 7(int) Constant 1 75: 58(int) Constant 4202 79: TypeArray 6(float16_t) 65 - 80: 7(int) Constant 1 - 81: TypeArray 6(float16_t) 80 - TypeForwardPointer 82 PhysicalStorageBufferEXT - 83(Block16): TypeStruct 79 81 82 - 84: TypeArray 17(float) 65 - 85: TypeRuntimeArray 17(float) - 86(Block): TypeStruct 84 85 - 82: TypePointer PhysicalStorageBufferEXT 86(Block) - 87: TypePointer StorageBuffer 83(Block16) - 88(block16): 87(ptr) Variable StorageBuffer - 89: TypePointer StorageBuffer 6(float16_t) - 94: 58(int) Constant 2 - 95: TypePointer StorageBuffer 82(ptr) - 98: TypePointer PhysicalStorageBufferEXT 17(float) - 106: 7(int) Constant 0 - 107: TypeCooperativeMatrixKHR 6(float16_t) 8 32 9 106 - 108: TypePointer Function 107 - 111: TypeCooperativeMatrixKHR 6(float16_t) 8 9 9 80 - 112: TypePointer Function 111 - 118: TypePointer Function 58(int) - 122: 58(int) Constant 8 - 123(Y): 58(int) SpecConstant 2 - 124(Z): 58(int) SpecConstantOp 132 122 123(Y) - 125: TypeCooperativeMatrixKHR 6(float16_t) 8 124(Z) 124(Z) 10 - 126: TypePointer Function 125 - 128:6(float16_t) Constant 0 - 129: 125 ConstantComposite 128 - 130: TypeArray 33 71 - 131: TypePointer Function 130 - 133: 58(int) Constant 3 - 134: 17(float) Constant 1065353216 - 140: 58(int) Constant 1234 - 144: TypeCooperativeMatrixKHR 6(float16_t) 8 124(Z) 9 10 - 145: TypeArray 144 8 - 146: TypePointer Private 145 - 147(mC2): 146(ptr) Variable Private - 148: TypePointer Private 144 - 168: 11 ConstantComposite 128 - 169: 18 ConstantComposite 36 - 173:6(float16_t) Constant 16384 - 176: 17(float) Constant 1082130432 - 180: TypeVector 7(int) 4 - 181: 7(int) Constant 32 - 182: TypeArray 180(ivec4) 181 - 183: TypePointer Workgroup 182 - 184(shmatrix): 183(ptr) Variable Workgroup - 185: TypePointer Workgroup 180(ivec4) - 190: TypeInt 8 1 - 191: TypeCooperativeMatrixKHR 190(int8_t) 8 9 9 106 - 192: TypePointer Function 191 - 195: TypeCooperativeMatrixKHR 190(int8_t) 8 9 9 80 - 196: TypePointer Function 195 - 199: TypeCooperativeMatrixKHR 190(int8_t) 8 9 9 10 - 200: TypePointer Function 199 - 211: 58(int) Constant 16 - 213: TypeInt 16 1 - 214: TypeCooperativeMatrixKHR 213(int16_t) 8 9 9 106 - 215: TypePointer Function 214 - 219: TypeVector 7(int) 3 - 220: 7(int) Constant 64 - 221: 219(ivec3) ConstantComposite 220 80 80 - 222(mC): 148(ptr) Variable Private - 223(F): 17(float) SpecConstant 1077936128 - 224: TypeCooperativeMatrixKHR 17(float) 8 124(Z) 9 10 - 225: 224 ConstantComposite 36 - 226:6(float16_t) Constant 15360 - 227: 11 ConstantComposite 226 - 228(S): TypeStruct 58(int) 58(int) 58(int) - 229: 58(int) Constant 12 - 230: 58(int) Constant 23 - 231: 58(int) Constant 34 - 232: 228(S) ConstantComposite 229 230 231 - 233(SC): 58(int) SpecConstant 1 - 234: TypeCooperativeMatrixKHR 6(float16_t) 8 233(SC) 233(SC) 10 - 235: TypeArray 234 233(SC) - 236: TypeArray 235 233(SC) - 237: TypePointer Private 236 - 238(scm): 237(ptr) Variable Private + 80: TypeArray 6(float16_t) 74 + TypeForwardPointer 81 PhysicalStorageBufferEXT + 82(Block16): TypeStruct 79 80 81 + 83: TypeArray 17(float) 65 + 84: TypeRuntimeArray 17(float) + 85(Block): TypeStruct 83 84 + 81: TypePointer PhysicalStorageBufferEXT 85(Block) + 86: TypePointer StorageBuffer 82(Block16) + 87(block16): 86(ptr) Variable StorageBuffer + 88: TypePointer StorageBuffer 6(float16_t) + 93: 58(int) Constant 2 + 94: TypePointer StorageBuffer 81(ptr) + 97: TypePointer PhysicalStorageBufferEXT 17(float) + 105: 7(int) Constant 0 + 106: TypeCooperativeMatrixKHR 6(float16_t) 8 32 9 105 + 107: TypePointer Function 106 + 110: TypeCooperativeMatrixKHR 6(float16_t) 8 9 9 74 + 111: TypePointer Function 110 + 117: TypePointer Function 58(int) + 121: 58(int) Constant 8 + 122(Y): 58(int) SpecConstant 2 + 123(Z): 58(int) SpecConstantOp 132 121 122(Y) + 124: TypeCooperativeMatrixKHR 6(float16_t) 8 123(Z) 123(Z) 10 + 125: TypePointer Function 124 + 127:6(float16_t) Constant 0 + 128: 124 ConstantComposite 127 + 129: TypeArray 33 71 + 130: TypePointer Function 129 + 132: 58(int) Constant 3 + 133: 17(float) Constant 1065353216 + 139: 58(int) Constant 1234 + 143: TypeCooperativeMatrixKHR 6(float16_t) 8 123(Z) 9 10 + 144: TypeArray 143 8 + 145: TypePointer Private 144 + 146(mC2): 145(ptr) Variable Private + 147: TypePointer Private 143 + 167: 11 ConstantComposite 127 + 168: 18 ConstantComposite 36 + 172:6(float16_t) Constant 16384 + 175: 17(float) Constant 1082130432 + 178: TypeCooperativeMatrixKHR 6(float16_t) 8 32 32 10 + 179: TypePointer Function 178 + 181: TypeVector 7(int) 4 + 182: 7(int) Constant 32 + 183: TypeArray 181(ivec4) 182 + 184: TypePointer Workgroup 183 + 185(shmatrix): 184(ptr) Variable Workgroup + 186: TypePointer Workgroup 181(ivec4) + 191: TypeInt 8 1 + 192: TypeCooperativeMatrixKHR 191(int8_t) 8 9 9 105 + 193: TypePointer Function 192 + 196: TypeCooperativeMatrixKHR 191(int8_t) 8 9 9 74 + 197: TypePointer Function 196 + 200: TypeCooperativeMatrixKHR 191(int8_t) 8 9 9 10 + 201: TypePointer Function 200 + 212: 58(int) Constant 16 + 214: TypeInt 16 1 + 215: TypeCooperativeMatrixKHR 214(int16_t) 8 9 32 105 + 216: TypePointer Function 215 + 220: TypeVector 7(int) 3 + 221: 7(int) Constant 64 + 222: 220(ivec3) ConstantComposite 221 74 74 + 223(mC): 147(ptr) Variable Private + 224(F): 17(float) SpecConstant 1077936128 + 225: TypeCooperativeMatrixKHR 17(float) 8 123(Z) 9 10 + 226: 225 ConstantComposite 36 + 227:6(float16_t) Constant 15360 + 228: 11 ConstantComposite 227 + 229(S): TypeStruct 58(int) 58(int) 58(int) + 230: 58(int) Constant 12 + 231: 58(int) Constant 23 + 232: 58(int) Constant 34 + 233: 229(S) ConstantComposite 230 231 232 + 234(SC): 58(int) SpecConstant 1 + 235: TypeCooperativeMatrixKHR 6(float16_t) 8 234(SC) 234(SC) 10 + 236: TypeArray 235 234(SC) + 237: TypeArray 236 234(SC) + 238: TypePointer Private 237 + 239(scm): 238(ptr) Variable Private 4(main): 2 Function None 3 5: Label 35(m): 34(ptr) Variable Function 53(m2): 52(ptr) Variable Function 57(x): 56(ptr) Variable Function - 105(D): 34(ptr) Variable Function - 109(A): 108(ptr) Variable Function - 113(B): 112(ptr) Variable Function - 115(C): 34(ptr) Variable Function - 119(l): 118(ptr) Variable Function - 127(F): 126(ptr) Variable Function - 132(a): 131(ptr) Variable Function - 136(md1): 56(ptr) Variable Function - 160(p1): 12(ptr) Variable Function - 161(param): 12(ptr) Variable Function - 164(p2): 19(ptr) Variable Function - 165(param): 19(ptr) Variable Function - 179(ms): 52(ptr) Variable Function - 193(ms8A): 192(ptr) Variable Function - 197(ms8B): 196(ptr) Variable Function - 201(ms8C): 200(ptr) Variable Function - 216(m16): 215(ptr) Variable Function + 104(D): 34(ptr) Variable Function + 108(A): 107(ptr) Variable Function + 112(B): 111(ptr) Variable Function + 114(C): 34(ptr) Variable Function + 118(l): 117(ptr) Variable Function + 126(F): 125(ptr) Variable Function + 131(a): 130(ptr) Variable Function + 135(md1): 56(ptr) Variable Function + 159(p1): 12(ptr) Variable Function + 160(param): 12(ptr) Variable Function + 163(p2): 19(ptr) Variable Function + 164(param): 19(ptr) Variable Function + 180(ms): 179(ptr) Variable Function + 194(ms8A): 193(ptr) Variable Function + 198(ms8B): 197(ptr) Variable Function + 202(ms8C): 201(ptr) Variable Function + 217(m16): 216(ptr) Variable Function Store 35(m) 37 38: 33 Load 35(m) 39: 33 Load 35(m) @@ -268,99 +269,99 @@ spv.coopmat_armlayout.comp 77: 33 Load 35(m) 78: 72(ptr) AccessChain 70(block) 59 32 CooperativeMatrixStoreKHR 78 77 75 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 - 90: 89(ptr) AccessChain 88(block16) 59 32 - 91: 51 CooperativeMatrixLoadKHR 90 75 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 - Store 53(m2) 91 - 92: 51 Load 53(m2) - 93: 89(ptr) AccessChain 88(block16) 59 32 - CooperativeMatrixStoreKHR 93 92 75 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 - 96: 95(ptr) AccessChain 88(block16) 94 - 97: 82(ptr) Load 96 MakePointerVisibleKHR NonPrivatePointerKHR 71 - 99: 98(ptr) AccessChain 97 59 32 - 100: 33 CooperativeMatrixLoadKHR 99 75 74 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 71 - Store 35(m) 100 - 101: 33 Load 35(m) - 102: 95(ptr) AccessChain 88(block16) 94 - 103: 82(ptr) Load 102 MakePointerVisibleKHR NonPrivatePointerKHR 71 - 104: 98(ptr) AccessChain 103 59 32 - CooperativeMatrixStoreKHR 104 101 75 74 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 71 - 110: 107 Load 109(A) - 114: 111 Load 113(B) - 116: 33 Load 115(C) - 117: 33 CooperativeMatrixMulAddKHR 110 114 116 - Store 105(D) 117 - 120: 7(int) CooperativeMatrixLengthKHR 33 - 121: 58(int) Bitcast 120 - Store 119(l) 121 - Store 127(F) 129 - 135: 56(ptr) AccessChain 132(a) 133 62 - Store 135 134 - Store 136(md1) 36 + 89: 88(ptr) AccessChain 87(block16) 59 32 + 90: 51 CooperativeMatrixLoadKHR 89 75 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 + Store 53(m2) 90 + 91: 51 Load 53(m2) + 92: 88(ptr) AccessChain 87(block16) 59 32 + CooperativeMatrixStoreKHR 92 91 75 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 + 95: 94(ptr) AccessChain 87(block16) 93 + 96: 81(ptr) Load 95 MakePointerVisibleKHR NonPrivatePointerKHR 71 + 98: 97(ptr) AccessChain 96 59 32 + 99: 33 CooperativeMatrixLoadKHR 98 75 74 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 71 + Store 35(m) 99 + 100: 33 Load 35(m) + 101: 94(ptr) AccessChain 87(block16) 93 + 102: 81(ptr) Load 101 MakePointerVisibleKHR NonPrivatePointerKHR 71 + 103: 97(ptr) AccessChain 102 59 32 + CooperativeMatrixStoreKHR 103 100 75 74 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 71 + 109: 106 Load 108(A) + 113: 110 Load 112(B) + 115: 33 Load 114(C) + 116: 33 CooperativeMatrixMulAddKHR 109 113 115 + Store 104(D) 116 + 119: 7(int) CooperativeMatrixLengthKHR 33 + 120: 58(int) Bitcast 119 + Store 118(l) 120 + Store 126(F) 128 + 134: 56(ptr) AccessChain 131(a) 132 62 + Store 134 133 + Store 135(md1) 36 + 136: 33 Load 35(m) 137: 33 Load 35(m) - 138: 33 Load 35(m) - 139: 33 FAdd 138 137 - Store 35(m) 139 - 141: 17(float) CompositeExtract 139 1234 - 142: 17(float) Load 136(md1) - 143: 17(float) FAdd 142 141 - Store 136(md1) 143 - 149: 148(ptr) AccessChain 147(mC2) 94 - 150: 144 Load 149 - 151: 148(ptr) AccessChain 147(mC2) 59 - Store 151 150 - 152: 72(ptr) AccessChain 70(block) 62 32 - 153: 33 CooperativeMatrixLoadKHR 152 75 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 - Store 35(m) 153 - 154: 33 Load 35(m) - 155: 72(ptr) AccessChain 70(block) 62 32 - CooperativeMatrixStoreKHR 155 154 75 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 - 156: 89(ptr) AccessChain 88(block16) 62 32 - 157: 51 CooperativeMatrixLoadKHR 156 75 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 - Store 53(m2) 157 - 158: 51 Load 53(m2) - 159: 89(ptr) AccessChain 88(block16) 62 32 - CooperativeMatrixStoreKHR 159 158 75 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 - 162: 11 Load 160(p1) - Store 161(param) 162 - 163: 11 FunctionCall 15(f16(f161<3><8><8><2>;) 161(param) - Store 160(p1) 163 - 166: 18 Load 164(p2) - Store 165(param) 166 - 167: 18 FunctionCall 22(f32(f1<3><8><8><2>;) 165(param) - Store 164(p2) 167 - Store 160(p1) 168 - Store 164(p2) 169 - 170: 11 Load 160(p1) - 171: 11 Load 160(p1) - 172: 11 FDiv 171 170 - Store 160(p1) 172 - 174: 11 Load 160(p1) - 175: 11 MatrixTimesScalar 174 173 - Store 160(p1) 175 - 177: 18 Load 164(p2) - 178: 18 MatrixTimesScalar 177 176 - Store 164(p2) 178 - 186: 185(ptr) AccessChain 184(shmatrix) 80 - 187: 51 CooperativeMatrixLoadKHR 186 75 10 MakePointerVisibleKHR NonPrivatePointerKHR 10 - Store 179(ms) 187 - 188: 51 Load 179(ms) - 189: 185(ptr) AccessChain 184(shmatrix) 80 - CooperativeMatrixStoreKHR 189 188 75 10 MakePointerAvailableKHR NonPrivatePointerKHR 10 - 194: 191 Load 193(ms8A) - 198: 195 Load 197(ms8B) - 202: 199 Load 201(ms8C) - 203: 199 CooperativeMatrixMulAddKHR 194 198 202 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR - 204: 191 Load 193(ms8A) - 205: 195 Load 197(ms8B) - 206: 199 Load 201(ms8C) - 207: 199 CooperativeMatrixMulAddKHR 204 205 206 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR - 208: 191 Load 193(ms8A) - 209: 195 Load 197(ms8B) - 210: 199 Load 201(ms8C) - 212: 199 CooperativeMatrixMulAddKHR 208 209 210 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR SaturatingAccumulationKHR - 217: 214 Load 216(m16) - 218: 185(ptr) AccessChain 184(shmatrix) 80 - CooperativeMatrixStoreKHR 218 217 75 10 MakePointerAvailableKHR NonPrivatePointerKHR 10 + 138: 33 FAdd 137 136 + Store 35(m) 138 + 140: 17(float) CompositeExtract 138 1234 + 141: 17(float) Load 135(md1) + 142: 17(float) FAdd 141 140 + Store 135(md1) 142 + 148: 147(ptr) AccessChain 146(mC2) 93 + 149: 143 Load 148 + 150: 147(ptr) AccessChain 146(mC2) 59 + Store 150 149 + 151: 72(ptr) AccessChain 70(block) 62 32 + 152: 33 CooperativeMatrixLoadKHR 151 75 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 + Store 35(m) 152 + 153: 33 Load 35(m) + 154: 72(ptr) AccessChain 70(block) 62 32 + CooperativeMatrixStoreKHR 154 153 75 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 + 155: 88(ptr) AccessChain 87(block16) 62 32 + 156: 51 CooperativeMatrixLoadKHR 155 75 74 MakePointerVisibleKHR NonPrivatePointerKHR 71 + Store 53(m2) 156 + 157: 51 Load 53(m2) + 158: 88(ptr) AccessChain 87(block16) 62 32 + CooperativeMatrixStoreKHR 158 157 75 74 MakePointerAvailableKHR NonPrivatePointerKHR 71 + 161: 11 Load 159(p1) + Store 160(param) 161 + 162: 11 FunctionCall 15(f16(f161<3><8><8><2>;) 160(param) + Store 159(p1) 162 + 165: 18 Load 163(p2) + Store 164(param) 165 + 166: 18 FunctionCall 22(f32(f1<3><8><8><2>;) 164(param) + Store 163(p2) 166 + Store 159(p1) 167 + Store 163(p2) 168 + 169: 11 Load 159(p1) + 170: 11 Load 159(p1) + 171: 11 FDiv 170 169 + Store 159(p1) 171 + 173: 11 Load 159(p1) + 174: 11 MatrixTimesScalar 173 172 + Store 159(p1) 174 + 176: 18 Load 163(p2) + 177: 18 MatrixTimesScalar 176 175 + Store 163(p2) 177 + 187: 186(ptr) AccessChain 185(shmatrix) 74 + 188: 178 CooperativeMatrixLoadKHR 187 75 10 MakePointerVisibleKHR NonPrivatePointerKHR 10 + Store 180(ms) 188 + 189: 178 Load 180(ms) + 190: 186(ptr) AccessChain 185(shmatrix) 74 + CooperativeMatrixStoreKHR 190 189 75 10 MakePointerAvailableKHR NonPrivatePointerKHR 10 + 195: 192 Load 194(ms8A) + 199: 196 Load 198(ms8B) + 203: 200 Load 202(ms8C) + 204: 200 CooperativeMatrixMulAddKHR 195 199 203 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR + 205: 192 Load 194(ms8A) + 206: 196 Load 198(ms8B) + 207: 200 Load 202(ms8C) + 208: 200 CooperativeMatrixMulAddKHR 205 206 207 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR + 209: 192 Load 194(ms8A) + 210: 196 Load 198(ms8B) + 211: 200 Load 202(ms8C) + 213: 200 CooperativeMatrixMulAddKHR 209 210 211 ASignedComponentsKHR BSignedComponentsKHR CSignedComponentsKHR ResultSignedComponentsKHR SaturatingAccumulationKHR + 218: 215 Load 217(m16) + 219: 186(ptr) AccessChain 185(shmatrix) 74 + CooperativeMatrixStoreKHR 219 218 75 10 MakePointerAvailableKHR NonPrivatePointerKHR 10 Return FunctionEnd 15(f16(f161<3><8><8><2>;): 11 Function None 13 diff --git a/third_party/glslang/Test/baseResults/spv.coopvec.comp.out b/third_party/glslang/Test/baseResults/spv.coopvec.comp.out index e3417268ea..63dd7862e2 100644 --- a/third_party/glslang/Test/baseResults/spv.coopvec.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopvec.comp.out @@ -10,7 +10,7 @@ spv.coopvec.comp Capability StorageBuffer8BitAccess Capability VulkanMemoryModelKHR Capability CooperativeVectorNV - Capability CapabilityReplicatedCompositesEXT + Capability ReplicatedCompositesEXT Extension "SPV_EXT_replicated_composites" Extension "SPV_KHR_8bit_storage" Extension "SPV_KHR_vulkan_memory_model" diff --git a/third_party/glslang/Test/baseResults/spv.coopvec2.comp.out b/third_party/glslang/Test/baseResults/spv.coopvec2.comp.out index 4bbe8e9a4c..af76fd1a3d 100644 --- a/third_party/glslang/Test/baseResults/spv.coopvec2.comp.out +++ b/third_party/glslang/Test/baseResults/spv.coopvec2.comp.out @@ -8,7 +8,7 @@ spv.coopvec2.comp Capability Int8 Capability VulkanMemoryModelKHR Capability CooperativeVectorNV - Capability CapabilityReplicatedCompositesEXT + Capability ReplicatedCompositesEXT Extension "SPV_EXT_replicated_composites" Extension "SPV_KHR_vulkan_memory_model" Extension "SPV_NV_cooperative_vector" diff --git a/third_party/glslang/Test/baseResults/spv.coopvecStoreLocal.comp.out b/third_party/glslang/Test/baseResults/spv.coopvecStoreLocal.comp.out new file mode 100644 index 0000000000..8d23471803 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.coopvecStoreLocal.comp.out @@ -0,0 +1,6 @@ +spv.coopvecStoreLocal.comp +ERROR: 0:18: 'coopVecStoreNV' : buffer argument must be in buffer or shared storage +ERROR: 1 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.coopvecloadstore_Error.comp.out b/third_party/glslang/Test/baseResults/spv.coopvecloadstore_Error.comp.out new file mode 100644 index 0000000000..ebf02654cf --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.coopvecloadstore_Error.comp.out @@ -0,0 +1,7 @@ +spv.coopvecloadstore_Error.comp +ERROR: 0:20: 'coopVecStoreNV' : buffer argument must be in buffer or shared storage +ERROR: 0:25: 'coopVecLoadNV' : buffer argument must be in buffer or shared storage +ERROR: 2 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.bufferref.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.bufferref.glsl.frag.out index a117fd79f7..354cf30ad8 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.bufferref.glsl.frag.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.bufferref.glsl.frag.out @@ -1,7 +1,7 @@ spv.debuginfo.bufferref.glsl.frag // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 148 +// Id's are bound by 150 Capability Shader Capability PhysicalStorageBufferAddressesEXT @@ -12,7 +12,7 @@ spv.debuginfo.bufferref.glsl.frag 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 - EntryPoint Fragment 14 "main" 82 135 + EntryPoint Fragment 14 "main" 64 70 ExecutionMode 14 OriginUpperLeft 2: String "spv.debuginfo.bufferref.glsl.frag" 8: String "uint" @@ -53,48 +53,48 @@ void main() { out_fragColor = vec4(vertex_pos0, 1.0); } " - 33: String "positions" - 37: String "Mesh" - 40: String "float" - 46: String "data" - 49: String "MeshVertexPositions" - 55: String "meshData" - 69: String "PerPass_meshes" - 75: String "perPass_meshes" - 77: String "int" - 84: String "tri_idx0" - 100: String "vertex_pos0" - 137: String "out_fragColor" + 30: String "positions" + 34: String "Mesh" + 37: String "float" + 43: String "data" + 46: String "MeshVertexPositions" + 54: String "PerPass_meshes" + 59: String "perPass_meshes" + 66: String "out_fragColor" + 72: String "tri_idx0" + 86: String "meshData" + 91: String "int" + 109: String "vertex_pos0" SourceExtension "GL_EXT_buffer_reference" Name 14 "main" - Name 31 "Mesh" - MemberName 31(Mesh) 0 "positions" - Name 44 "MeshVertexPositions" - MemberName 44(MeshVertexPositions) 0 "data" - Name 53 "meshData" - Name 59 "Mesh" - MemberName 59(Mesh) 0 "positions" - Name 64 "PerPass_meshes" - MemberName 64(PerPass_meshes) 0 "data" - Name 73 "perPass_meshes" - Name 82 "tri_idx0" - Name 98 "vertex_pos0" - Name 135 "out_fragColor" - Decorate 42 ArrayStride 4 - Decorate 44(MeshVertexPositions) Block - MemberDecorate 44(MeshVertexPositions) 0 Offset 0 - Decorate 53(meshData) DecorationAliasedPointerEXT - MemberDecorate 59(Mesh) 0 Offset 0 - Decorate 62 ArrayStride 8 - Decorate 64(PerPass_meshes) Block - MemberDecorate 64(PerPass_meshes) 0 NonWritable - MemberDecorate 64(PerPass_meshes) 0 Offset 0 - Decorate 73(perPass_meshes) NonWritable - Decorate 73(perPass_meshes) Binding 0 - Decorate 73(perPass_meshes) DescriptorSet 0 - Decorate 82(tri_idx0) Flat - Decorate 82(tri_idx0) Location 0 - Decorate 135(out_fragColor) Location 0 + Name 28 "Mesh" + MemberName 28(Mesh) 0 "positions" + Name 41 "MeshVertexPositions" + MemberName 41(MeshVertexPositions) 0 "data" + Name 49 "PerPass_meshes" + MemberName 49(PerPass_meshes) 0 "data" + Name 57 "perPass_meshes" + Name 64 "out_fragColor" + Name 70 "tri_idx0" + Name 77 "Mesh" + MemberName 77(Mesh) 0 "positions" + Name 84 "meshData" + Name 107 "vertex_pos0" + MemberDecorate 28(Mesh) 0 Offset 0 + Decorate 39 ArrayStride 4 + Decorate 41(MeshVertexPositions) Block + MemberDecorate 41(MeshVertexPositions) 0 Offset 0 + Decorate 47 ArrayStride 8 + Decorate 49(PerPass_meshes) Block + MemberDecorate 49(PerPass_meshes) 0 NonWritable + MemberDecorate 49(PerPass_meshes) 0 Offset 0 + Decorate 57(perPass_meshes) NonWritable + Decorate 57(perPass_meshes) Binding 0 + Decorate 57(perPass_meshes) DescriptorSet 0 + Decorate 64(out_fragColor) Location 0 + Decorate 70(tri_idx0) Flat + Decorate 70(tri_idx0) Location 0 + Decorate 84(meshData) DecorationAliasedPointerEXT 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -111,122 +111,124 @@ void main() { 24: 7(int) Constant 2 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 - TypeForwardPointer 28 PhysicalStorageBufferEXT - 29: 7(int) Constant 5349 - 30: 4 ExtInstWithForwardRefsKHR 1(NonSemantic.Shader.DebugInfo.100) 3 48 29 12 - 31(Mesh): TypeStruct 28 - 34: 7(int) Constant 9 - 35: 7(int) Constant 23 - 32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 33 30 18 34 35 12 12 13 - 38: 7(int) Constant 21 - 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 37 22 18 38 12 21 37 12 13 32 - 39: TypeFloat 32 - 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 40 10 13 12 - 42: TypeRuntimeArray 39(float) - 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 41 12 -44(MeshVertexPositions): TypeStruct 42 - 47: 7(int) Constant 5 - 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 46 43 18 47 34 12 12 13 - 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 49 22 18 38 12 21 49 12 13 45 - 28: TypePointer PhysicalStorageBufferEXT 44(MeshVertexPositions) - 50: TypePointer Function 31(Mesh) - 51: 7(int) Constant 7 - 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 36 51 12 - 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 55 36 18 38 12 17 23 - 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 59(Mesh): TypeStruct 28(ptr) - 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 33 30 18 34 35 12 12 13 - 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 37 22 18 38 12 21 37 12 13 60 - 62: TypeRuntimeArray 59(Mesh) - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 61 12 -64(PerPass_meshes): TypeStruct 62 - 66: 7(int) Constant 13 - 67: 7(int) Constant 8 - 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 46 63 18 66 67 12 12 13 - 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 69 22 18 38 12 21 69 12 13 65 - 70: TypePointer StorageBuffer 64(PerPass_meshes) - 71: 7(int) Constant 12 - 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 68 71 12 -73(perPass_meshes): 70(ptr) Variable StorageBuffer - 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 75 68 18 38 12 21 75 73(perPass_meshes) 67 - 76: TypeInt 32 1 - 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 77 10 23 12 - 79: 76(int) Constant 0 - 80: TypePointer Input 7(int) - 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 22 12 - 82(tri_idx0): 80(ptr) Variable Input - 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 84 9 18 38 12 21 84 82(tri_idx0) 67 - 86: TypePointer StorageBuffer 59(Mesh) - 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 61 71 12 - 91: TypePointer Function 28(ptr) - 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 51 12 - 94: TypeVector 39(float) 3 - 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 41 13 - 96: TypePointer Function 94(fvec3) - 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 95 51 12 - 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 100 95 18 35 12 17 23 - 107: TypePointer PhysicalStorageBufferEXT 39(float) - 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 41 29 12 - 113: 7(int) Constant 24 - 122: 7(int) Constant 25 - 131: TypeVector 39(float) 4 - 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 41 23 - 133: TypePointer Output 131(fvec4) - 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 132 13 12 -135(out_fragColor): 133(ptr) Variable Output - 138: 7(int) Constant 27 - 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 137 132 18 138 12 21 137 135(out_fragColor) 67 - 141: 39(float) Constant 1065353216 - 147: 7(int) Constant 28 + TypeForwardPointer 25 PhysicalStorageBufferEXT + 26: 7(int) Constant 5349 + 27: 4 ExtInstWithForwardRefsKHR 1(NonSemantic.Shader.DebugInfo.100) 3 45 26 12 + 28(Mesh): TypeStruct 25 + 31: 7(int) Constant 9 + 32: 7(int) Constant 23 + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 30 27 18 31 32 12 12 13 + 35: 7(int) Constant 12 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 34 22 18 35 12 21 34 12 13 29 + 36: TypeFloat 32 + 38: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 37 10 13 12 + 39: TypeRuntimeArray 36(float) + 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 38 12 +41(MeshVertexPositions): TypeStruct 39 + 44: 7(int) Constant 5 + 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 43 40 18 44 31 12 12 13 + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 46 22 18 35 12 21 46 12 13 42 + 25: TypePointer PhysicalStorageBufferEXT 41(MeshVertexPositions) + 47: TypeRuntimeArray 28(Mesh) + 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 33 12 +49(PerPass_meshes): TypeStruct 47 + 51: 7(int) Constant 13 + 52: 7(int) Constant 8 + 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 43 48 18 51 52 12 12 13 + 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 54 22 18 35 12 21 54 12 13 50 + 55: TypePointer StorageBuffer 49(PerPass_meshes) + 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 53 35 12 +57(perPass_meshes): 55(ptr) Variable StorageBuffer + 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 59 53 18 35 12 21 59 57(perPass_meshes) 52 + 60: TypeVector 36(float) 4 + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 38 23 + 62: TypePointer Output 60(fvec4) + 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 61 13 12 +64(out_fragColor): 62(ptr) Variable Output + 67: 7(int) Constant 16 + 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 66 61 18 67 12 21 66 64(out_fragColor) 52 + 68: TypePointer Input 7(int) + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 22 12 + 70(tri_idx0): 68(ptr) Variable Input + 73: 7(int) Constant 18 + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 72 9 18 73 12 21 72 70(tri_idx0) 52 + 77(Mesh): TypeStruct 25(ptr) + 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 30 27 18 31 32 12 12 13 + 80: 7(int) Constant 21 + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 34 22 18 80 12 21 34 12 13 78 + 81: TypePointer Function 77(Mesh) + 82: 7(int) Constant 7 + 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 79 82 12 + 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 86 79 18 80 12 17 23 + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 90: TypeInt 32 1 + 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 91 10 23 12 + 93: 90(int) Constant 0 + 95: TypePointer StorageBuffer 28(Mesh) + 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 33 35 12 + 100: TypePointer Function 25(ptr) + 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 82 12 + 103: TypeVector 36(float) 3 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 38 13 + 105: TypePointer Function 103(fvec3) + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 104 82 12 + 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 109 104 18 32 12 17 23 + 116: TypePointer PhysicalStorageBufferEXT 36(float) + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 38 26 12 + 122: 7(int) Constant 24 + 131: 7(int) Constant 25 + 142: 7(int) Constant 27 + 143: 36(float) Constant 1065353216 + 149: 7(int) Constant 28 14(main): 4 Function None 5 15: Label - 53(meshData): 50(ptr) Variable Function - 98(vertex_pos0): 96(ptr) Variable Function - 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 - 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 38 38 12 12 - 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 54 53(meshData) 57 - 85: 7(int) Load 82(tri_idx0) - 88: 86(ptr) AccessChain 73(perPass_meshes) 79 85 - 89: 59(Mesh) Load 88 - 90: 28(ptr) CompositeExtract 89 0 - 93: 91(ptr) AccessChain 53(meshData) 79 - Store 93 90 - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 35 35 12 12 - 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 99 98(vertex_pos0) 57 - 103: 91(ptr) AccessChain 53(meshData) 79 - 104: 28(ptr) Load 103 - 105: 7(int) Load 82(tri_idx0) - 106: 7(int) IMul 13 105 - 109: 107(ptr) AccessChain 104 79 106 - 110: 39(float) Load 109 Aligned 4 - 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 113 113 12 12 - 111: 91(ptr) AccessChain 53(meshData) 79 - 114: 28(ptr) Load 111 - 115: 7(int) Load 82(tri_idx0) - 116: 7(int) IMul 13 115 - 117: 7(int) IAdd 116 22 - 118: 107(ptr) AccessChain 114 79 117 - 119: 39(float) Load 118 Aligned 4 + 84(meshData): 81(ptr) Variable Function +107(vertex_pos0): 105(ptr) Variable Function + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 80 80 12 12 + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 85 84(meshData) 88 + 94: 7(int) Load 70(tri_idx0) + 97: 95(ptr) AccessChain 57(perPass_meshes) 93 94 + 98: 28(Mesh) Load 97 + 99: 25(ptr) CompositeExtract 98 0 + 102: 100(ptr) AccessChain 84(meshData) 93 + Store 102 99 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 32 32 12 12 + 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 108 107(vertex_pos0) 88 + 112: 100(ptr) AccessChain 84(meshData) 93 + 113: 25(ptr) Load 112 + 114: 7(int) Load 70(tri_idx0) + 115: 7(int) IMul 13 114 + 118: 116(ptr) AccessChain 113 93 115 + 119: 36(float) Load 118 Aligned 4 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 122 122 12 12 - 120: 91(ptr) AccessChain 53(meshData) 79 - 123: 28(ptr) Load 120 - 124: 7(int) Load 82(tri_idx0) + 120: 100(ptr) AccessChain 84(meshData) 93 + 123: 25(ptr) Load 120 + 124: 7(int) Load 70(tri_idx0) 125: 7(int) IMul 13 124 - 126: 7(int) IAdd 125 24 - 127: 107(ptr) AccessChain 123 79 126 - 128: 39(float) Load 127 Aligned 4 - 129: 94(fvec3) CompositeConstruct 110 119 128 - 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 35 35 12 12 - Store 98(vertex_pos0) 129 - 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 138 138 12 12 - 139: 94(fvec3) Load 98(vertex_pos0) - 142: 39(float) CompositeExtract 139 0 - 143: 39(float) CompositeExtract 139 1 - 144: 39(float) CompositeExtract 139 2 - 145: 131(fvec4) CompositeConstruct 142 143 144 141 - Store 135(out_fragColor) 145 - 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 147 147 12 12 + 126: 7(int) IAdd 125 22 + 127: 116(ptr) AccessChain 123 93 126 + 128: 36(float) Load 127 Aligned 4 + 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 131 131 12 12 + 129: 100(ptr) AccessChain 84(meshData) 93 + 132: 25(ptr) Load 129 + 133: 7(int) Load 70(tri_idx0) + 134: 7(int) IMul 13 133 + 135: 7(int) IAdd 134 24 + 136: 116(ptr) AccessChain 132 93 135 + 137: 36(float) Load 136 Aligned 4 + 138: 103(fvec3) CompositeConstruct 119 128 137 + 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 32 32 12 12 + Store 107(vertex_pos0) 138 + 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 142 142 12 12 + 140: 103(fvec3) Load 107(vertex_pos0) + 144: 36(float) CompositeExtract 140 0 + 145: 36(float) CompositeExtract 140 1 + 146: 36(float) CompositeExtract 140 2 + 147: 60(fvec4) CompositeConstruct 144 145 146 143 + Store 64(out_fragColor) 147 + 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 149 149 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.const_variables.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.const_variables.glsl.frag.out new file mode 100644 index 0000000000..f6fd49d43c --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.const_variables.glsl.frag.out @@ -0,0 +1,87 @@ +spv.debuginfo.const_variables.glsl.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 56 + + Capability Shader + Extension "SPV_KHR_non_semantic_info" + 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" + 3: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 14 "main" 38 + ExecutionMode 14 OriginUpperLeft + 2: String "spv.debuginfo.const_variables.glsl.frag" + 8: String "uint" + 16: String "main" + 19: String "// OpModuleProcessed auto-map-locations +// OpModuleProcessed auto-map-bindings +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed keep-uncalled +// OpModuleProcessed entry-point main +#line 1 +#version 460 + +const vec4 constGlobal = vec4(1.0, 0.0, 0.0, 1.0); + +out vec4 outColor; + +void main() { + const float constLocal = 3.14; + outColor = constGlobal * constLocal; +}" + 26: String "float" + 34: String "constGlobal" + 40: String "outColor" + 47: String "constLocal" + Name 14 "main" + Name 38 "outColor" + Decorate 38(outColor) Location 0 + 4: TypeVoid + 5: TypeFunction 4 + 7: TypeInt 32 0 + 10: 7(int) Constant 32 + 11: 7(int) Constant 6 + 12: 7(int) Constant 0 + 9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12 + 13: 7(int) Constant 3 + 6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 + 18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19 + 20: 7(int) Constant 7 + 22: 7(int) Constant 1 + 23: 7(int) Constant 4 + 24: 7(int) Constant 2 + 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 + 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 + 25: TypeFloat 32 + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 13 12 + 28: TypeVector 25(float) 4 + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 23 + 30: 25(float) Constant 1065353216 + 31: 25(float) Constant 0 + 32: 28(fvec4) ConstantComposite 30 31 31 30 + 35: 7(int) Constant 8 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 34 29 18 13 12 21 34 32 35 + 36: TypePointer Output 28(fvec4) + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 13 12 + 38(outColor): 36(ptr) Variable Output + 41: 7(int) Constant 5 + 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 40 29 18 41 12 21 40 38(outColor) 35 + 45: 25(float) Constant 1078523331 + 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 47 27 18 35 12 17 23 + 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 51: 28(fvec4) ConstantComposite 45 31 31 45 + 53: 7(int) Constant 9 + 55: 7(int) Constant 10 + 14(main): 4 Function None 5 + 15: Label + 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 35 35 12 12 + 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 46 45 49 + 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 53 53 12 12 + Store 38(outColor) 51 + 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 55 55 12 12 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.continued.glsl.vert.out b/third_party/glslang/Test/baseResults/spv.debuginfo.continued.glsl.vert.out index 4dd63f6877..ae7c5fab29 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.continued.glsl.vert.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.continued.glsl.vert.out @@ -1,14 +1,14 @@ spv.debuginfo.continued.glsl.vert // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 71 +// Id's are bound by 73 Capability Shader Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 14 "main" 55 + EntryPoint Vertex 14 "main" 57 2: String "spv.debuginfo.continued.glsl.vert" 8: String "uint" 16: String "main" @@ -3802,17 +3802,18 @@ void main() 33: String "float" 41: String "gl_Position" 44: String "gl_PointSize" - 47: String "gl_CullDistance" - 51: String "gl_PerVertex" - 57: String "" - 60: String "int" + 47: String "gl_ClipDistance" + 50: String "gl_CullDistance" + 53: String "gl_PerVertex" + 59: String "" + 62: String "int" Name 14 "main" Name 39 "gl_PerVertex" MemberName 39(gl_PerVertex) 0 "gl_Position" MemberName 39(gl_PerVertex) 1 "gl_PointSize" MemberName 39(gl_PerVertex) 2 "gl_ClipDistance" MemberName 39(gl_PerVertex) 3 "gl_CullDistance" - Name 55 "" + Name 57 "" Decorate 39(gl_PerVertex) Block MemberDecorate 39(gl_PerVertex) 0 BuiltIn Position MemberDecorate 39(gl_PerVertex) 1 BuiltIn PointSize @@ -3847,32 +3848,33 @@ void main() 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 41 36 18 26 42 12 12 13 45: 7(int) Constant 42 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 44 34 18 26 45 12 12 13 - 48: 7(int) Constant 85 + 48: 7(int) Constant 61 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 47 38 18 26 48 12 12 13 - 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 47 38 18 26 48 12 12 13 - 52: 7(int) Constant 3776 - 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 51 26 18 52 12 25 51 12 13 40 43 46 49 - 53: TypePointer Output 39(gl_PerVertex) - 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 50 13 12 - 55: 53(ptr) Variable Output - 58: 7(int) Constant 8 - 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 57 50 18 52 12 25 57 55 58 - 59: TypeInt 32 1 - 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 60 10 27 12 - 62: 59(int) Constant 0 - 63: 32(float) Constant 1065353216 - 64: 35(fvec4) ConstantComposite 63 63 63 63 - 65: TypePointer Output 35(fvec4) - 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 36 13 12 - 70: 7(int) Constant 3777 + 51: 7(int) Constant 85 + 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 50 38 18 26 51 12 12 13 + 54: 7(int) Constant 3776 + 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 53 26 18 54 12 25 53 12 13 40 43 46 49 + 55: TypePointer Output 39(gl_PerVertex) + 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 52 13 12 + 57: 55(ptr) Variable Output + 60: 7(int) Constant 8 + 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 59 52 18 54 12 25 59 57 60 + 61: TypeInt 32 1 + 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 62 10 27 12 + 64: 61(int) Constant 0 + 65: 32(float) Constant 1065353216 + 66: 35(fvec4) ConstantComposite 65 65 65 65 + 67: TypePointer Output 35(fvec4) + 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 36 13 12 + 72: 7(int) Constant 3777 14(main): 4 Function None 5 15: Label 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 24 24 12 12 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 52 52 12 12 - 67: 65(ptr) AccessChain 55 62 - Store 67 64 - 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 70 70 12 12 + 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 54 54 12 12 + 69: 67(ptr) AccessChain 57 64 + Store 69 66 + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 72 72 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.coopmatKHR.comp.out b/third_party/glslang/Test/baseResults/spv.debuginfo.coopmatKHR.comp.out index aa3e3bd114..bcec069b12 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.coopmatKHR.comp.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.coopmatKHR.comp.out @@ -1,7 +1,7 @@ spv.debuginfo.coopmatKHR.comp // Module Version 10300 // Generated by (magic number): 8000b -// Id's are bound by 367 +// Id's are bound by 412 Capability Shader Capability Float16 @@ -107,27 +107,36 @@ void main() } } " - 33: String "i" - 49: String "bool" - 54: String "j" - 71: String "float16_t" - 78: String "coopmat" - 80: String "@coopmat" - 90: String "result" - 106: String "int" - 116: String "chunkK" - 135: String "k" - 173: String "coopmat" - 175: String "@coopmat" - 182: String "matA" - 201: String "Ash" - 230: String "coopmat" - 232: String "@coopmat" - 237: String "matB" - 243: String "Bsh" - 340: String "x" - 344: String "Output" - 350: String "outputO" + 27: String "lM" + 32: String "lN" + 36: String "lK" + 40: String "TILE_M" + 44: String "TILE_N" + 48: String "TILE_K" + 52: String "K" + 55: String "float16_t" + 62: String "x" + 66: String "Output" + 72: String "outputO" + 82: String "Ash" + 86: String "Bsh" + 89: String "C_ROWS" + 92: String "C_COLS" + 96: String "coopmat" + 98: String "@coopmat" + 108: String "result" + 119: String "i" + 135: String "bool" + 143: String "j" + 172: String "int" + 185: String "chunkK" + 204: String "k" + 222: String "coopmat" + 224: String "@coopmat" + 231: String "matA" + 271: String "coopmat" + 273: String "@coopmat" + 278: String "matB" SourceExtension "GL_EXT_buffer_reference" SourceExtension "GL_EXT_control_flow_attributes" SourceExtension "GL_EXT_scalar_block_layout" @@ -137,30 +146,30 @@ void main() SourceExtension "GL_KHR_cooperative_matrix" SourceExtension "GL_KHR_memory_scope_semantics" Name 14 "main" - Name 31 "i" - Name 52 "j" - Name 74 "lM" - Name 75 "lN" - Name 88 "result" - Name 114 "chunkK" - Name 131 "K" - Name 133 "k" - Name 150 "TILE_K" - Name 151 "lK" - Name 154 "i" - Name 180 "matA" - Name 199 "Ash" - Name 211 "j" - Name 235 "matB" - Name 241 "Bsh" - Name 248 "i" - Name 295 "i" - Name 312 "j" - Name 338 "Output" - MemberName 338(Output) 0 "x" - Name 348 "outputO" - Name 365 "TILE_M" - Name 366 "TILE_N" + Name 25 "lM" + Name 30 "lN" + Name 34 "lK" + Name 38 "TILE_M" + Name 42 "TILE_N" + Name 46 "TILE_K" + Name 50 "K" + Name 60 "Output" + MemberName 60(Output) 0 "x" + Name 70 "outputO" + Name 80 "Ash" + Name 84 "Bsh" + Name 106 "result" + Name 117 "i" + Name 141 "j" + Name 183 "chunkK" + Name 202 "k" + Name 229 "matA" + Name 237 "i" + Name 276 "matB" + Name 284 "j" + Name 308 "i" + Name 357 "i" + Name 375 "j" ModuleProcessed "auto-map-locations" ModuleProcessed "auto-map-bindings" ModuleProcessed "client vulkan100" @@ -172,18 +181,18 @@ void main() ModuleProcessed "use-vulkan-memory-model" ModuleProcessed "use-vulkan-memory-model" ModuleProcessed "use-vulkan-memory-model" - Decorate 74(lM) SpecId 0 - Decorate 75(lN) SpecId 1 - Decorate 131(K) SpecId 6 - Decorate 150(TILE_K) SpecId 5 - Decorate 151(lK) SpecId 2 - Decorate 336 ArrayStride 2 - Decorate 338(Output) Block - MemberDecorate 338(Output) 0 Offset 0 - Decorate 348(outputO) Binding 0 - Decorate 348(outputO) DescriptorSet 0 - Decorate 365(TILE_M) SpecId 3 - Decorate 366(TILE_N) SpecId 4 + Decorate 25(lM) SpecId 0 + Decorate 30(lN) SpecId 1 + Decorate 34(lK) SpecId 2 + Decorate 38(TILE_M) SpecId 3 + Decorate 42(TILE_N) SpecId 4 + Decorate 46(TILE_K) SpecId 5 + Decorate 50(K) SpecId 6 + Decorate 58 ArrayStride 2 + Decorate 60(Output) Block + MemberDecorate 60(Output) 0 Offset 0 + Decorate 70(outputO) Binding 0 + Decorate 70(outputO) DescriptorSet 0 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -200,405 +209,441 @@ void main() 24: 7(int) Constant 2 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 - 28: TypePointer Function 7(int) - 29: 7(int) Constant 7 - 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 29 12 - 34: 7(int) Constant 57 - 32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 33 9 18 34 12 17 23 - 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 48: TypeBool - 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 49 10 24 12 - 55: 7(int) Constant 58 - 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 54 9 18 55 12 17 23 - 70: TypeFloat 16 - 73: 7(int) Constant 16 - 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 71 73 13 12 - 74(lM): 7(int) SpecConstant 1 - 75(lN): 7(int) SpecConstant 1 - 76: TypeCooperativeMatrixKHR 70(float16_t) 13 74(lM) 75(lN) 24 - 79: 7(int) Constant 53 - 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) - 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 78 22 18 79 12 21 80 81 13 - 82: TypeArray 76 24 - 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 77 24 - 84: TypeArray 82 24 - 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 83 24 - 86: TypePointer Private 84 - 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 85 11 12 - 88(result): 86(ptr) Variable Private - 91: 7(int) Constant 8 - 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 90 85 18 79 12 21 90 88(result) 91 - 95: 7(int) Constant 59 - 97:70(float16_t) Constant 0 - 98: 76 ConstantComposite 97 - 99: TypePointer Private 76 - 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 77 11 12 - 105: TypeInt 32 1 - 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 106 10 23 12 - 108: 105(int) Constant 1 - 117: 7(int) Constant 63 - 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 116 9 18 117 12 17 23 - 131(K): 7(int) SpecConstant 1 - 136: 7(int) Constant 64 - 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 135 9 18 136 12 17 23 - 150(TILE_K): 7(int) SpecConstant 1 - 151(lK): 7(int) SpecConstant 1 - 152: 7(int) SpecConstantOp 134 150(TILE_K) 151(lK) - 156: 7(int) Constant 67 - 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 33 9 18 156 12 17 23 - 171: TypeCooperativeMatrixKHR 70(float16_t) 13 74(lM) 151(lK) 12 - 174: 7(int) Constant 66 - 172: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 173 22 18 174 12 21 175 81 13 - 176: TypeArray 171 24 - 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 172 24 - 178: TypePointer Function 176 - 179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 177 29 12 - 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 182 177 18 174 12 17 23 - 188: 7(int) Constant 68 - 189: TypePointer Function 171 - 190: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 172 29 12 - 192: TypeVector 7(int) 4 - 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 9 23 - 194: 7(int) Constant 128 - 195: TypeArray 192(ivec4) 194 - 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 193 194 - 197: TypePointer Workgroup 195 - 198: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 196 23 12 - 199(Ash): 197(ptr) Variable Workgroup - 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 201 196 18 188 12 21 201 199(Ash) 91 - 202: TypePointer Workgroup 192(ivec4) - 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 193 23 12 - 205: 105(int) Constant 0 - 213: 7(int) Constant 72 - 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 54 9 18 213 12 17 23 - 228: TypeCooperativeMatrixKHR 70(float16_t) 13 151(lK) 75(lN) 22 - 231: 7(int) Constant 71 - 229: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 230 22 18 231 12 21 232 81 13 - 233: TypePointer Function 228 - 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 229 29 12 - 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 237 229 18 231 12 17 23 - 241(Bsh): 197(ptr) Variable Workgroup - 244: 7(int) Constant 73 - 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 243 196 18 244 12 21 243 241(Bsh) 91 - 250: 7(int) Constant 75 - 249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 33 9 18 250 12 17 23 - 267: 7(int) Constant 76 - 297: 7(int) Constant 82 - 296: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 33 9 18 297 12 17 23 - 314: 7(int) Constant 83 - 313: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 54 9 18 314 12 17 23 - 332: 7(int) Constant 84 - 336: TypeRuntimeArray 70(float16_t) - 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 72 12 - 338(Output): TypeStruct 336 - 341: 7(int) Constant 46 - 342: 7(int) Constant 24 - 339: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 340 337 18 341 342 12 12 13 - 343: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 344 22 18 332 12 21 344 12 13 339 - 345: TypePointer StorageBuffer 338(Output) - 346: 7(int) Constant 12 - 347: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 343 346 12 - 348(outputO): 345(ptr) Variable StorageBuffer - 349: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 350 343 18 332 12 21 350 348(outputO) 91 - 351: TypePointer StorageBuffer 70(float16_t) - 352: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 72 346 12 - 364: 7(int) Constant 87 - 365(TILE_M): 7(int) SpecConstant 1 - 366(TILE_N): 7(int) SpecConstant 1 + 25(lM): 7(int) SpecConstant 1 + 28: 7(int) Constant 33 + 29: 7(int) Constant 8 + 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 27 9 18 28 12 21 27 25(lM) 29 + 30(lN): 7(int) SpecConstant 1 + 33: 7(int) Constant 34 + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 32 9 18 33 12 21 32 30(lN) 29 + 34(lK): 7(int) SpecConstant 1 + 37: 7(int) Constant 35 + 35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 36 9 18 37 12 21 36 34(lK) 29 + 38(TILE_M): 7(int) SpecConstant 1 + 41: 7(int) Constant 36 + 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 40 9 18 41 12 21 40 38(TILE_M) 29 + 42(TILE_N): 7(int) SpecConstant 1 + 45: 7(int) Constant 37 + 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 44 9 18 45 12 21 44 42(TILE_N) 29 + 46(TILE_K): 7(int) SpecConstant 1 + 49: 7(int) Constant 38 + 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 48 9 18 49 12 21 48 46(TILE_K) 29 + 50(K): 7(int) SpecConstant 1 + 53: 7(int) Constant 39 + 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 52 9 18 53 12 21 52 50(K) 29 + 54: TypeFloat 16 + 57: 7(int) Constant 16 + 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 55 57 13 12 + 58: TypeRuntimeArray 54(float16_t) + 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 56 12 + 60(Output): TypeStruct 58 + 63: 7(int) Constant 46 + 64: 7(int) Constant 24 + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 62 59 18 63 64 12 12 13 + 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 66 22 18 63 12 21 66 12 13 61 + 67: TypePointer StorageBuffer 60(Output) + 68: 7(int) Constant 12 + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 65 68 12 + 70(outputO): 67(ptr) Variable StorageBuffer + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 72 65 18 63 12 21 72 70(outputO) 29 + 73: TypeVector 7(int) 4 + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 9 23 + 75: 7(int) Constant 128 + 76: TypeArray 73(ivec4) 75 + 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 74 75 + 78: TypePointer Workgroup 76 + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 77 23 12 + 80(Ash): 78(ptr) Variable Workgroup + 83: 7(int) Constant 48 + 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 82 77 18 83 12 21 82 80(Ash) 29 + 84(Bsh): 78(ptr) Variable Workgroup + 87: 7(int) Constant 49 + 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 86 77 18 87 12 21 86 84(Bsh) 29 + 90: 7(int) Constant 51 + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 89 9 18 90 12 21 89 24 29 + 93: 7(int) Constant 52 + 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 92 9 18 93 12 21 92 24 29 + 94: TypeCooperativeMatrixKHR 54(float16_t) 13 25(lM) 30(lN) 24 + 97: 7(int) Constant 53 + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) + 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 96 22 18 97 12 21 98 99 13 + 100: TypeArray 94 24 + 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 95 24 + 102: TypeArray 100 24 + 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 101 24 + 104: TypePointer Private 102 + 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 103 11 12 + 106(result): 104(ptr) Variable Private + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 108 103 18 97 12 21 108 106(result) 29 + 113: 7(int) Constant 57 + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 113 57 17 + 114: TypePointer Function 7(int) + 115: 7(int) Constant 7 + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 115 12 + 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 119 9 18 113 12 112 23 + 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 134: TypeBool + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 135 10 24 12 + 139: 7(int) Constant 58 + 140: 7(int) Constant 20 + 138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 139 140 112 + 142: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 143 9 18 139 12 138 23 + 161: 7(int) Constant 59 + 163:54(float16_t) Constant 0 + 164: 94 ConstantComposite 163 + 165: TypePointer Private 94 + 166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 95 11 12 + 171: TypeInt 32 1 + 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 172 10 23 12 + 174: 171(int) Constant 1 + 181: 7(int) Constant 63 + 182: 7(int) Constant 5 + 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 181 182 17 + 184: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 185 9 18 181 12 180 23 + 201: 7(int) Constant 64 + 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 201 140 180 + 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 204 9 18 201 12 200 23 + 218: 7(int) SpecConstantOp 134 46(TILE_K) 34(lK) + 220: TypeCooperativeMatrixKHR 54(float16_t) 13 25(lM) 34(lK) 12 + 223: 7(int) Constant 66 + 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 222 22 18 223 12 21 224 99 13 + 225: TypeArray 220 24 + 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 221 24 + 227: TypePointer Function 225 + 228: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 226 115 12 + 230: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 231 226 18 223 12 200 23 + 236: 7(int) Constant 67 + 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 236 64 200 + 238: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 119 9 18 236 12 235 23 + 256: 7(int) Constant 68 + 257: TypePointer Function 220 + 258: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 221 115 12 + 260: TypePointer Workgroup 73(ivec4) + 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 74 23 12 + 263: 171(int) Constant 0 + 269: TypeCooperativeMatrixKHR 54(float16_t) 13 34(lK) 30(lN) 22 + 272: 7(int) Constant 71 + 270: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 271 22 18 272 12 21 273 99 13 + 274: TypePointer Function 269 + 275: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 270 115 12 + 277: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 278 270 18 272 12 200 23 + 283: 7(int) Constant 72 + 282: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 283 64 200 + 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 143 9 18 283 12 282 23 + 303: 7(int) Constant 73 + 306: 7(int) Constant 75 + 307: 7(int) Constant 28 + 305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 306 307 282 + 309: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 119 9 18 306 12 305 23 + 327: 7(int) Constant 76 + 356: 7(int) Constant 82 + 355: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 356 57 17 + 358: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 119 9 18 356 12 355 23 + 374: 7(int) Constant 83 + 373: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 374 140 355 + 376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 143 9 18 374 12 373 23 + 394: 7(int) Constant 84 + 398: TypePointer StorageBuffer 54(float16_t) + 399: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 56 68 12 + 411: 7(int) Constant 87 14(main): 4 Function None 5 15: Label - 31(i): 28(ptr) Variable Function - 52(j): 28(ptr) Variable Function - 114(chunkK): 28(ptr) Variable Function - 133(k): 28(ptr) Variable Function - 154(i): 28(ptr) Variable Function - 180(matA): 178(ptr) Variable Function - 211(j): 28(ptr) Variable Function - 235(matB): 233(ptr) Variable Function - 248(i): 28(ptr) Variable Function - 295(i): 28(ptr) Variable Function - 312(j): 28(ptr) Variable Function - 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 - 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 34 34 12 12 - 35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 32 31(i) 36 - Store 31(i) 12 - Branch 38 - 38: Label - 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 34 34 12 12 - LoopMerge 40 41 Unroll - Branch 44 - 44: Label - 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 34 34 12 12 - 45: 7(int) Load 31(i) - 51: 48(bool) ULessThan 45 24 - BranchConditional 51 39 40 - 39: Label - 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 55 55 12 12 - 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 53 52(j) 36 - Store 52(j) 12 - Branch 59 - 59: Label - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 55 55 12 12 - LoopMerge 61 62 Unroll - Branch 65 - 65: Label - 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 55 55 12 12 - 66: 7(int) Load 52(j) - 69: 48(bool) ULessThan 66 24 - BranchConditional 69 60 61 - 60: Label - 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 95 95 12 12 - 92: 7(int) Load 31(i) - 96: 7(int) Load 52(j) - 101: 99(ptr) AccessChain 88(result) 92 96 - Store 101 98 - Branch 62 - 62: Label - 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 55 55 12 12 - 102: 7(int) Load 52(j) - 109: 7(int) IAdd 102 108 - Store 52(j) 109 - Branch 59 - 61: Label - Branch 41 - 41: Label - 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 34 34 12 12 - 110: 7(int) Load 31(i) - 113: 7(int) IAdd 110 108 - Store 31(i) 113 - Branch 38 - 40: Label - 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 117 117 12 12 - 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 115 114(chunkK) 36 - Store 114(chunkK) 12 - Branch 121 - 121: Label - 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 117 117 12 12 - LoopMerge 123 124 None - Branch 127 - 127: Label - 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 117 117 12 12 - 128: 7(int) Load 114(chunkK) - 132: 48(bool) ULessThan 128 131(K) - BranchConditional 132 122 123 - 122: Label - 138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 136 136 12 12 - 137: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 134 133(k) 36 - Store 133(k) 12 - Branch 140 - 140: Label - 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 136 136 12 12 - LoopMerge 142 143 Unroll - Branch 146 - 146: Label - 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 149: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 136 136 12 12 - 147: 7(int) Load 133(k) - 153: 48(bool) ULessThan 147 152 - BranchConditional 153 141 142 - 141: Label - 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 156 156 12 12 - 157: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 155 154(i) 36 - Store 154(i) 12 - Branch 160 - 160: Label - 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 156 156 12 12 - LoopMerge 162 163 Unroll - Branch 166 - 166: Label - 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 156 156 12 12 - 167: 7(int) Load 154(i) - 170: 48(bool) ULessThan 167 24 - BranchConditional 170 161 162 - 161: Label - 184: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 174 174 12 12 - 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 181 180(matA) 36 - 187: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 188 188 12 12 - 186: 7(int) Load 154(i) - 191: 189(ptr) AccessChain 180(matA) 186 - 204: 202(ptr) AccessChain 199(Ash) 12 - 206: 171 CooperativeMatrixLoadKHR 204 205 12 MakePointerVisibleKHR NonPrivatePointerKHR 24 - Store 191 206 - Branch 163 - 163: Label - 208: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 156 156 12 12 - 207: 7(int) Load 154(i) - 210: 7(int) IAdd 207 108 - Store 154(i) 210 - Branch 160 - 162: Label - 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 213 213 12 12 - 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 212 211(j) 36 - Store 211(j) 12 - Branch 217 - 217: Label - 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 222: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 213 213 12 12 - LoopMerge 219 220 Unroll - Branch 223 - 223: Label - 225: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 213 213 12 12 - 224: 7(int) Load 211(j) - 227: 48(bool) ULessThan 224 24 - BranchConditional 227 218 219 - 218: Label - 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 231 231 12 12 - 238: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 236 235(matB) 36 - 246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 244 244 12 12 - 245: 202(ptr) AccessChain 241(Bsh) 12 - 247: 228 CooperativeMatrixLoadKHR 245 205 12 MakePointerVisibleKHR NonPrivatePointerKHR 24 - Store 235(matB) 247 - 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 250 250 12 12 - 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 249 248(i) 36 - Store 248(i) 12 - Branch 253 - 253: Label - 257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 258: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 250 250 12 12 - LoopMerge 255 256 Unroll - Branch 259 - 259: Label - 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 262: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 250 250 12 12 - 260: 7(int) Load 248(i) - 263: 48(bool) ULessThan 260 24 - BranchConditional 263 254 255 - 254: Label - 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 266: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 267 267 12 12 - 264: 7(int) Load 248(i) - 268: 7(int) Load 211(j) - 269: 7(int) Load 248(i) - 270: 189(ptr) AccessChain 180(matA) 269 - 271: 171 Load 270 - 272: 228 Load 235(matB) - 273: 7(int) Load 248(i) - 274: 7(int) Load 211(j) - 275: 99(ptr) AccessChain 88(result) 273 274 - 276: 76 Load 275 - 277: 76 CooperativeMatrixMulAddKHR 271 272 276 - 278: 99(ptr) AccessChain 88(result) 264 268 - Store 278 277 - Branch 256 - 256: Label - 280: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 250 250 12 12 - 279: 7(int) Load 248(i) - 282: 7(int) IAdd 279 108 - Store 248(i) 282 - Branch 253 - 255: Label - Branch 220 - 220: Label - 284: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 213 213 12 12 - 283: 7(int) Load 211(j) - 286: 7(int) IAdd 283 108 - Store 211(j) 286 - Branch 217 - 219: Label - Branch 143 - 143: Label - 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 136 136 12 12 - 287: 7(int) Load 133(k) - 290: 7(int) IAdd 287 108 - Store 133(k) 290 - Branch 140 - 142: Label + 117(i): 114(ptr) Variable Function + 141(j): 114(ptr) Variable Function + 183(chunkK): 114(ptr) Variable Function + 202(k): 114(ptr) Variable Function + 229(matA): 227(ptr) Variable Function + 237(i): 114(ptr) Variable Function + 276(matB): 274(ptr) Variable Function + 284(j): 114(ptr) Variable Function + 308(i): 114(ptr) Variable Function + 357(i): 114(ptr) Variable Function + 375(j): 114(ptr) Variable Function + 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 112 + 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 113 113 12 12 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 118 117(i) 121 + Store 117(i) 12 + Branch 124 + 124: Label + 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 112 + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 113 113 12 12 + LoopMerge 126 127 Unroll + Branch 130 + 130: Label + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 112 + 133: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 113 113 12 12 + 131: 7(int) Load 117(i) + 137: 134(bool) ULessThan 131 24 + BranchConditional 137 125 126 + 125: Label + 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 138 + 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 139 139 12 12 + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 142 141(j) 121 + Store 141(j) 12 + Branch 147 + 147: Label + 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 138 + 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 139 139 12 12 + LoopMerge 149 150 Unroll + Branch 153 + 153: Label + 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 138 + 156: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 139 139 12 12 + 154: 7(int) Load 141(j) + 157: 134(bool) ULessThan 154 24 + BranchConditional 157 148 149 + 148: Label + 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 138 + 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 161 161 12 12 + 158: 7(int) Load 117(i) + 162: 7(int) Load 141(j) + 167: 165(ptr) AccessChain 106(result) 158 162 + Store 167 164 + Branch 150 + 150: Label + 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 138 + 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 139 139 12 12 + 168: 7(int) Load 141(j) + 175: 7(int) IAdd 168 174 + Store 141(j) 175 + Branch 147 + 149: Label + Branch 127 + 127: Label + 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 112 + 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 113 113 12 12 + 176: 7(int) Load 117(i) + 179: 7(int) IAdd 176 174 + Store 117(i) 179 Branch 124 - 124: Label - 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 293: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 117 117 12 12 - 291: 7(int) Load 114(chunkK) - 294: 7(int) IAdd 291 150(TILE_K) - Store 114(chunkK) 294 - Branch 121 - 123: Label - 299: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12 - 298: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 296 295(i) 36 - Store 295(i) 12 - Branch 301 - 301: Label - 305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12 - LoopMerge 303 304 Unroll - Branch 307 - 307: Label - 309: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 310: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12 - 308: 7(int) Load 295(i) - 311: 48(bool) ULessThan 308 24 - BranchConditional 311 302 303 - 302: Label - 316: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 314 314 12 12 - 315: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 313 312(j) 36 - Store 312(j) 12 - Branch 318 - 318: Label - 322: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 323: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 314 314 12 12 - LoopMerge 320 321 Unroll - Branch 324 - 324: Label - 326: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 327: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 314 314 12 12 - 325: 7(int) Load 312(j) - 328: 48(bool) ULessThan 325 24 - BranchConditional 328 319 320 - 319: Label - 330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 331: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 332 332 12 12 - 329: 7(int) Load 295(i) - 333: 7(int) Load 312(j) - 334: 99(ptr) AccessChain 88(result) 329 333 - 335: 76 Load 334 - 353: 351(ptr) AccessChain 348(outputO) 205 12 - CooperativeMatrixStoreKHR 353 335 205 12 None - Branch 321 - 321: Label - 355: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 314 314 12 12 - 354: 7(int) Load 312(j) - 357: 7(int) IAdd 354 108 - Store 312(j) 357 - Branch 318 - 320: Label - Branch 304 - 304: Label - 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 360: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12 - 358: 7(int) Load 295(i) - 361: 7(int) IAdd 358 108 - Store 295(i) 361 - Branch 301 - 303: Label - 362: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 363: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 364 364 12 12 + 126: Label + 187: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 180 + 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 181 181 12 12 + 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 184 183(chunkK) 121 + Store 183(chunkK) 12 + Branch 189 + 189: Label + 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 180 + 194: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 181 181 12 12 + LoopMerge 191 192 None + Branch 195 + 195: Label + 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 180 + 198: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 181 181 12 12 + 196: 7(int) Load 183(chunkK) + 199: 134(bool) ULessThan 196 50(K) + BranchConditional 199 190 191 + 190: Label + 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 200 + 207: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 201 201 12 12 + 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 203 202(k) 121 + Store 202(k) 12 + Branch 208 + 208: Label + 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 200 + 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 201 201 12 12 + LoopMerge 210 211 Unroll + Branch 214 + 214: Label + 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 200 + 217: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 201 201 12 12 + 215: 7(int) Load 202(k) + 219: 134(bool) ULessThan 215 218 + BranchConditional 219 209 210 + 209: Label + 233: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 200 + 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 223 223 12 12 + 232: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 230 229(matA) 121 + 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 235 + 241: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 236 236 12 12 + 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 238 237(i) 121 + Store 237(i) 12 + Branch 242 + 242: Label + 246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 235 + 247: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 236 236 12 12 + LoopMerge 244 245 Unroll + Branch 248 + 248: Label + 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 235 + 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 236 236 12 12 + 249: 7(int) Load 237(i) + 252: 134(bool) ULessThan 249 24 + BranchConditional 252 243 244 + 243: Label + 254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 235 + 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 256 256 12 12 + 253: 7(int) Load 237(i) + 259: 257(ptr) AccessChain 229(matA) 253 + 262: 260(ptr) AccessChain 80(Ash) 12 + 264: 220 CooperativeMatrixLoadKHR 262 263 12 MakePointerVisibleKHR NonPrivatePointerKHR 24 + Store 259 264 + Branch 245 + 245: Label + 266: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 235 + 267: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 236 236 12 12 + 265: 7(int) Load 237(i) + 268: 7(int) IAdd 265 174 + Store 237(i) 268 + Branch 242 + 244: Label + 280: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 200 + 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 272 272 12 12 + 279: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 277 276(matB) 121 + 287: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 282 + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 283 283 12 12 + 286: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 285 284(j) 121 + Store 284(j) 12 + Branch 289 + 289: Label + 293: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 282 + 294: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 283 283 12 12 + LoopMerge 291 292 Unroll + Branch 295 + 295: Label + 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 282 + 298: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 283 283 12 12 + 296: 7(int) Load 284(j) + 299: 134(bool) ULessThan 296 24 + BranchConditional 299 290 291 + 290: Label + 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 282 + 302: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 303 303 12 12 + 300: 260(ptr) AccessChain 84(Bsh) 12 + 304: 269 CooperativeMatrixLoadKHR 300 263 12 MakePointerVisibleKHR NonPrivatePointerKHR 24 + Store 276(matB) 304 + 311: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 305 + 312: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 306 306 12 12 + 310: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 309 308(i) 121 + Store 308(i) 12 + Branch 313 + 313: Label + 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 305 + 318: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 306 306 12 12 + LoopMerge 315 316 Unroll + Branch 319 + 319: Label + 321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 305 + 322: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 306 306 12 12 + 320: 7(int) Load 308(i) + 323: 134(bool) ULessThan 320 24 + BranchConditional 323 314 315 + 314: Label + 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 305 + 326: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 327 327 12 12 + 324: 7(int) Load 308(i) + 328: 7(int) Load 284(j) + 329: 7(int) Load 308(i) + 330: 257(ptr) AccessChain 229(matA) 329 + 331: 220 Load 330 + 332: 269 Load 276(matB) + 333: 7(int) Load 308(i) + 334: 7(int) Load 284(j) + 335: 165(ptr) AccessChain 106(result) 333 334 + 336: 94 Load 335 + 337: 94 CooperativeMatrixMulAddKHR 331 332 336 + 338: 165(ptr) AccessChain 106(result) 324 328 + Store 338 337 + Branch 316 + 316: Label + 340: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 305 + 341: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 306 306 12 12 + 339: 7(int) Load 308(i) + 342: 7(int) IAdd 339 174 + Store 308(i) 342 + Branch 313 + 315: Label + Branch 292 + 292: Label + 344: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 282 + 345: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 283 283 12 12 + 343: 7(int) Load 284(j) + 346: 7(int) IAdd 343 174 + Store 284(j) 346 + Branch 289 + 291: Label + Branch 211 + 211: Label + 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 200 + 349: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 201 201 12 12 + 347: 7(int) Load 202(k) + 350: 7(int) IAdd 347 174 + Store 202(k) 350 + Branch 208 + 210: Label + Branch 192 + 192: Label + 352: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 180 + 353: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 181 181 12 12 + 351: 7(int) Load 183(chunkK) + 354: 7(int) IAdd 351 46(TILE_K) + Store 183(chunkK) 354 + Branch 189 + 191: Label + 360: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 355 + 361: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 356 356 12 12 + 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 358 357(i) 121 + Store 357(i) 12 + Branch 362 + 362: Label + 366: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 355 + 367: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 356 356 12 12 + LoopMerge 364 365 Unroll + Branch 368 + 368: Label + 370: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 355 + 371: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 356 356 12 12 + 369: 7(int) Load 357(i) + 372: 134(bool) ULessThan 369 24 + BranchConditional 372 363 364 + 363: Label + 378: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 + 379: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 374 374 12 12 + 377: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 376 375(j) 121 + Store 375(j) 12 + Branch 380 + 380: Label + 384: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 + 385: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 374 374 12 12 + LoopMerge 382 383 Unroll + Branch 386 + 386: Label + 388: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 + 389: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 374 374 12 12 + 387: 7(int) Load 375(j) + 390: 134(bool) ULessThan 387 24 + BranchConditional 390 381 382 + 381: Label + 392: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 + 393: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 394 394 12 12 + 391: 7(int) Load 357(i) + 395: 7(int) Load 375(j) + 396: 165(ptr) AccessChain 106(result) 391 395 + 397: 94 Load 396 + 400: 398(ptr) AccessChain 70(outputO) 263 12 + CooperativeMatrixStoreKHR 400 397 263 12 None + Branch 383 + 383: Label + 402: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 + 403: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 374 374 12 12 + 401: 7(int) Load 375(j) + 404: 7(int) IAdd 401 174 + Store 375(j) 404 + Branch 380 + 382: Label + Branch 365 + 365: Label + 406: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 355 + 407: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 356 356 12 12 + 405: 7(int) Load 357(i) + 408: 7(int) IAdd 405 174 + Store 357(i) 408 + Branch 362 + 364: Label + 409: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 410: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 411 411 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.declaration.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.declaration.glsl.frag.out new file mode 100644 index 0000000000..cf23c561c0 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.declaration.glsl.frag.out @@ -0,0 +1,213 @@ +spv.debuginfo.declaration.glsl.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 137 + + Capability Shader + Extension "SPV_KHR_non_semantic_info" + 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" + 3: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 14 "main" 46 + ExecutionMode 14 OriginUpperLeft + 2: String "spv.debuginfo.declaration.glsl.frag" + 8: String "uint" + 16: String "main" + 19: String "// OpModuleProcessed auto-map-locations +// OpModuleProcessed auto-map-bindings +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed keep-uncalled +// OpModuleProcessed entry-point main +#line 1 +#version 460 + +uniform UBO { + int x; +}; + +out vec4 outColor; + +void main() { + int x = 41; + { + int x = 42; + + while (bool test = x < 45) { + x += 1; + } + + for (int x = 50; bool test = x < 53; ) { + x += 1; + } + + outColor = vec4(x); + } +}" + 26: String "int" + 30: String "x" + 32: String "UBO" + 37: String "" + 40: String "float" + 48: String "outColor" + 81: String "bool" + 87: String "test" + Name 14 "main" + Name 28 "UBO" + MemberName 28(UBO) 0 "x" + Name 35 "" + Name 46 "outColor" + Name 55 "x" + Name 65 "x" + Name 85 "test" + Name 102 "x" + Name 115 "test" + Decorate 28(UBO) Block + MemberDecorate 28(UBO) 0 Offset 0 + Decorate 35 Binding 0 + Decorate 35 DescriptorSet 0 + Decorate 46(outColor) Location 0 + 4: TypeVoid + 5: TypeFunction 4 + 7: TypeInt 32 0 + 10: 7(int) Constant 32 + 11: 7(int) Constant 6 + 12: 7(int) Constant 0 + 9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12 + 13: 7(int) Constant 3 + 6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 + 18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19 + 20: 7(int) Constant 9 + 22: 7(int) Constant 1 + 23: 7(int) Constant 4 + 24: 7(int) Constant 2 + 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 + 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 + 25: TypeInt 32 1 + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 23 12 + 28(UBO): TypeStruct 25(int) + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 30 27 18 23 20 12 12 13 + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 32 22 18 13 12 21 32 12 13 29 + 33: TypePointer Uniform 28(UBO) + 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 31 24 12 + 35: 33(ptr) Variable Uniform + 38: 7(int) Constant 8 + 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 37 31 18 13 12 21 37 35 38 + 39: TypeFloat 32 + 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 40 10 13 12 + 42: TypeVector 39(float) 4 + 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 41 23 + 44: TypePointer Output 42(fvec4) + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 43 13 12 + 46(outColor): 44(ptr) Variable Output + 49: 7(int) Constant 7 + 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 48 43 18 49 12 21 48 46(outColor) 38 + 53: TypePointer Function 25(int) + 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 49 12 + 57: 7(int) Constant 10 + 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 30 27 18 57 12 17 23 + 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 61: 25(int) Constant 41 + 63: 7(int) Constant 12 + 64: 7(int) Constant 13 + 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 63 64 17 + 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 30 27 18 63 12 62 23 + 70: 25(int) Constant 42 + 72: 7(int) Constant 14 + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 72 20 62 + 80: TypeBool + 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 81 10 24 12 + 83: TypePointer Function 80(bool) + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 82 49 12 + 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 87 82 18 72 12 71 23 + 92: 25(int) Constant 45 + 94: 25(int) Constant 1 + 98: 7(int) Constant 15 + 101: 7(int) Constant 18 + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 101 20 62 + 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 30 27 18 101 12 100 23 + 107: 25(int) Constant 50 + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 87 82 18 101 12 100 23 + 121: 25(int) Constant 53 + 126: 7(int) Constant 19 + 131: 7(int) Constant 22 + 136: 7(int) Constant 24 + 14(main): 4 Function None 5 + 15: Label + 55(x): 53(ptr) Variable Function + 65(x): 53(ptr) Variable Function + 85(test): 83(ptr) Variable Function + 102(x): 53(ptr) Variable Function + 115(test): 83(ptr) Variable Function + 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 57 57 12 12 + 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 56 55(x) 59 + Store 55(x) 61 + 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 62 + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 63 63 12 12 + 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 66 65(x) 59 + Store 65(x) 70 + Branch 73 + 73: Label + 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 71 + 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 72 72 12 12 + LoopMerge 75 76 None + Branch 79 + 79: Label + 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 71 + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 72 72 12 12 + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 86 85(test) 59 + 91: 25(int) Load 65(x) + 93: 80(bool) SLessThan 91 92 + Store 85(test) 93 + BranchConditional 93 74 75 + 74: Label + 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 71 + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 98 98 12 12 + 95: 25(int) Load 65(x) + 99: 25(int) IAdd 95 94 + Store 65(x) 99 + Branch 76 + 76: Label + Branch 73 + 75: Label + 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 100 + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 101 101 12 12 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 103 102(x) 59 + Store 102(x) 107 + Branch 108 + 108: Label + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 100 + 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 101 101 12 12 + LoopMerge 110 111 None + Branch 114 + 114: Label + 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 100 + 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 101 101 12 12 + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 116 115(test) 59 + 120: 25(int) Load 102(x) + 122: 80(bool) SLessThan 120 121 + Store 115(test) 122 + BranchConditional 122 109 110 + 109: Label + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 100 + 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 126 126 12 12 + 123: 25(int) Load 102(x) + 127: 25(int) IAdd 123 94 + Store 102(x) 127 + Branch 111 + 111: Label + Branch 108 + 110: Label + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 62 + 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 131 131 12 12 + 128: 25(int) Load 65(x) + 132: 39(float) ConvertSToF 128 + 133: 42(fvec4) CompositeConstruct 132 132 132 132 + Store 46(outColor) 133 + 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 136 136 12 12 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.comp.out b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.comp.out index bcd29ecb02..adf34c6368 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.comp.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.comp.out @@ -1,14 +1,14 @@ spv.debuginfo.glsl.comp // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 999 +// Id's are bound by 1025 Capability Shader Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint GLCompute 14 "main" 135 + EntryPoint GLCompute 14 "main" 210 ExecutionMode 14 LocalSize 10 10 1 2: String "spv.debuginfo.glsl.comp" 8: String "uint" @@ -203,139 +203,149 @@ void main() 49: String "p1" 52: String "restDist" 54: String "main" - 60: String "dist" - 74: String "int" - 80: String "sphereRadius" - 91: String "gravity" - 95: String "particleCount" - 98: String "UBO" - 103: String "params" - 129: String "id" - 137: String "gl_GlobalInvocationID" - 143: String "index" - 169: String "bool" - 180: String "normal" - 186: String "pinned" - 188: String "Particle" - 194: String "particleIn" - 198: String "ParticleIn" - 203: String "" - 222: String "particleOut" - 225: String "ParticleOut" - 251: String "force" - 265: String "pos" - 275: String "vel" - 592: String "f" - 641: String "sphereDist" - 694: String "calculateNormals" - 697: String "PushConsts" - 703: String "pushConsts" - 742: String "a" - 755: String "b" - 772: String "c" + 61: String "pos" + 64: String "vel" + 67: String "uv" + 70: String "normal" + 73: String "pinned" + 76: String "Particle" + 82: String "particleIn" + 86: String "ParticleIn" + 91: String "" + 96: String "particleOut" + 99: String "ParticleOut" + 106: String "int" + 112: String "deltaT" + 115: String "particleMass" + 118: String "springStiffness" + 121: String "damping" + 124: String "restDistH" + 127: String "restDistV" + 130: String "restDistD" + 133: String "sphereRadius" + 136: String "spherePos" + 139: String "gravity" + 142: String "particleCount" + 145: String "UBO" + 151: String "params" + 154: String "calculateNormals" + 157: String "PushConsts" + 164: String "pushConsts" + 168: String "dist" + 204: String "id" + 212: String "gl_GlobalInvocationID" + 218: String "index" + 244: String "bool" + 289: String "force" + 627: String "f" + 676: String "sphereDist" + 746: String "a" + 752: String "b" + 756: String "c" + 1024: String "gl_WorkGroupSize" Name 14 "main" Name 31 "springForce(vf3;vf3;f1;" Name 28 "p0" Name 29 "p1" Name 30 "restDist" - Name 58 "dist" - Name 78 "UBO" - MemberName 78(UBO) 0 "deltaT" - MemberName 78(UBO) 1 "particleMass" - MemberName 78(UBO) 2 "springStiffness" - MemberName 78(UBO) 3 "damping" - MemberName 78(UBO) 4 "restDistH" - MemberName 78(UBO) 5 "restDistV" - MemberName 78(UBO) 6 "restDistD" - MemberName 78(UBO) 7 "sphereRadius" - MemberName 78(UBO) 8 "spherePos" - MemberName 78(UBO) 9 "gravity" - MemberName 78(UBO) 10 "particleCount" - Name 101 "params" - Name 127 "id" - Name 135 "gl_GlobalInvocationID" - Name 141 "index" - Name 178 "Particle" - MemberName 178(Particle) 0 "pos" - MemberName 178(Particle) 1 "vel" - MemberName 178(Particle) 2 "uv" - MemberName 178(Particle) 3 "normal" - MemberName 178(Particle) 4 "pinned" - Name 192 "ParticleIn" - MemberName 192(ParticleIn) 0 "particleIn" - Name 201 "" - Name 220 "ParticleOut" - MemberName 220(ParticleOut) 0 "particleOut" - Name 228 "" - Name 249 "force" - Name 263 "pos" - Name 273 "vel" - Name 297 "param" - Name 301 "param" - Name 303 "param" - Name 327 "param" - Name 331 "param" - Name 333 "param" - Name 361 "param" - Name 365 "param" - Name 367 "param" - Name 390 "param" - Name 394 "param" + Name 59 "Particle" + MemberName 59(Particle) 0 "pos" + MemberName 59(Particle) 1 "vel" + MemberName 59(Particle) 2 "uv" + MemberName 59(Particle) 3 "normal" + MemberName 59(Particle) 4 "pinned" + Name 80 "ParticleIn" + MemberName 80(ParticleIn) 0 "particleIn" + Name 89 "" + Name 94 "ParticleOut" + MemberName 94(ParticleOut) 0 "particleOut" + Name 103 "" + Name 110 "UBO" + MemberName 110(UBO) 0 "deltaT" + MemberName 110(UBO) 1 "particleMass" + MemberName 110(UBO) 2 "springStiffness" + MemberName 110(UBO) 3 "damping" + MemberName 110(UBO) 4 "restDistH" + MemberName 110(UBO) 5 "restDistV" + MemberName 110(UBO) 6 "restDistD" + MemberName 110(UBO) 7 "sphereRadius" + MemberName 110(UBO) 8 "spherePos" + MemberName 110(UBO) 9 "gravity" + MemberName 110(UBO) 10 "particleCount" + Name 149 "params" + Name 152 "PushConsts" + MemberName 152(PushConsts) 0 "calculateNormals" + Name 162 "pushConsts" + Name 166 "dist" + Name 202 "id" + Name 210 "gl_GlobalInvocationID" + Name 216 "index" + Name 287 "force" + Name 301 "pos" + Name 310 "vel" + Name 332 "param" + Name 336 "param" + Name 338 "param" + Name 362 "param" + Name 366 "param" + Name 368 "param" Name 396 "param" - Name 435 "param" - Name 439 "param" - Name 441 "param" - Name 475 "param" - Name 479 "param" - Name 481 "param" - Name 523 "param" - Name 527 "param" - Name 529 "param" - Name 567 "param" - Name 571 "param" - Name 573 "param" - Name 590 "f" - Name 639 "sphereDist" - Name 692 "PushConsts" - MemberName 692(PushConsts) 0 "calculateNormals" - Name 701 "pushConsts" - Name 716 "normal" - Name 740 "a" - Name 753 "b" - Name 770 "c" - Decorate 78(UBO) Block - MemberDecorate 78(UBO) 0 Offset 0 - MemberDecorate 78(UBO) 1 Offset 4 - MemberDecorate 78(UBO) 2 Offset 8 - MemberDecorate 78(UBO) 3 Offset 12 - MemberDecorate 78(UBO) 4 Offset 16 - MemberDecorate 78(UBO) 5 Offset 20 - MemberDecorate 78(UBO) 6 Offset 24 - MemberDecorate 78(UBO) 7 Offset 28 - MemberDecorate 78(UBO) 8 Offset 32 - MemberDecorate 78(UBO) 9 Offset 48 - MemberDecorate 78(UBO) 10 Offset 64 - Decorate 101(params) Binding 2 - Decorate 101(params) DescriptorSet 0 - Decorate 135(gl_GlobalInvocationID) BuiltIn GlobalInvocationId - MemberDecorate 178(Particle) 0 Offset 0 - MemberDecorate 178(Particle) 1 Offset 16 - MemberDecorate 178(Particle) 2 Offset 32 - MemberDecorate 178(Particle) 3 Offset 48 - MemberDecorate 178(Particle) 4 Offset 64 - Decorate 190 ArrayStride 80 - Decorate 192(ParticleIn) BufferBlock - MemberDecorate 192(ParticleIn) 0 Offset 0 - Decorate 201 Binding 0 - Decorate 201 DescriptorSet 0 - Decorate 218 ArrayStride 80 - Decorate 220(ParticleOut) BufferBlock - MemberDecorate 220(ParticleOut) 0 Offset 0 - Decorate 228 Binding 1 - Decorate 228 DescriptorSet 0 - Decorate 692(PushConsts) Block - MemberDecorate 692(PushConsts) 0 Offset 0 - Decorate 998 BuiltIn WorkgroupSize + Name 400 "param" + Name 402 "param" + Name 425 "param" + Name 429 "param" + Name 431 "param" + Name 470 "param" + Name 474 "param" + Name 476 "param" + Name 510 "param" + Name 514 "param" + Name 516 "param" + Name 558 "param" + Name 562 "param" + Name 564 "param" + Name 602 "param" + Name 606 "param" + Name 608 "param" + Name 625 "f" + Name 674 "sphereDist" + Name 738 "normal" + Name 744 "a" + Name 750 "b" + Name 754 "c" + MemberDecorate 59(Particle) 0 Offset 0 + MemberDecorate 59(Particle) 1 Offset 16 + MemberDecorate 59(Particle) 2 Offset 32 + MemberDecorate 59(Particle) 3 Offset 48 + MemberDecorate 59(Particle) 4 Offset 64 + Decorate 78 ArrayStride 80 + Decorate 80(ParticleIn) BufferBlock + MemberDecorate 80(ParticleIn) 0 Offset 0 + Decorate 89 Binding 0 + Decorate 89 DescriptorSet 0 + Decorate 92 ArrayStride 80 + Decorate 94(ParticleOut) BufferBlock + MemberDecorate 94(ParticleOut) 0 Offset 0 + Decorate 103 Binding 1 + Decorate 103 DescriptorSet 0 + Decorate 110(UBO) Block + MemberDecorate 110(UBO) 0 Offset 0 + MemberDecorate 110(UBO) 1 Offset 4 + MemberDecorate 110(UBO) 2 Offset 8 + MemberDecorate 110(UBO) 3 Offset 12 + MemberDecorate 110(UBO) 4 Offset 16 + MemberDecorate 110(UBO) 5 Offset 20 + MemberDecorate 110(UBO) 6 Offset 24 + MemberDecorate 110(UBO) 7 Offset 28 + MemberDecorate 110(UBO) 8 Offset 32 + MemberDecorate 110(UBO) 9 Offset 48 + MemberDecorate 110(UBO) 10 Offset 64 + Decorate 149(params) Binding 2 + Decorate 149(params) DescriptorSet 0 + Decorate 152(PushConsts) Block + MemberDecorate 152(PushConsts) 0 Offset 0 + Decorate 210(gl_GlobalInvocationID) BuiltIn GlobalInvocationId + Decorate 1022 BuiltIn WorkgroupSize 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -369,1028 +379,1044 @@ void main() 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 52 18 35 37 12 34 40 13 56: 7(int) Constant 72 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 54 6 35 56 12 38 54 13 56 - 61: 7(int) Constant 68 - 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 60 20 35 61 12 34 40 - 69: 7(int) Constant 69 - 71: TypeVector 16(float) 4 - 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 40 - 73: TypeInt 32 1 - 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 74 10 40 12 - 76: TypeVector 73(int) 2 - 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 75 41 - 78(UBO): TypeStruct 16(float) 16(float) 16(float) 16(float) 16(float) 16(float) 16(float) 16(float) 71(fvec4) 71(fvec4) 76(ivec2) - 81: 7(int) Constant 56 - 82: 7(int) Constant 8 - 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 18 35 81 82 12 12 13 - 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 18 35 81 82 12 12 13 - 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 18 35 81 82 12 12 13 - 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 18 35 81 82 12 12 13 - 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 18 35 81 82 12 12 13 - 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 18 35 81 82 12 12 13 - 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 18 35 81 82 12 12 13 - 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 18 35 81 82 12 12 13 - 92: 7(int) Constant 58 - 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 91 72 35 92 22 12 12 13 - 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 91 72 35 92 22 12 12 13 - 96: 7(int) Constant 59 - 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 95 77 35 96 82 12 12 13 - 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 98 39 35 69 12 38 98 12 13 79 83 84 85 86 87 88 89 90 93 94 - 99: TypePointer Uniform 78(UBO) - 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 97 41 12 - 101(params): 99(ptr) Variable Uniform - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 103 97 35 69 12 38 103 101(params) 82 - 104: 73(int) Constant 2 - 105: TypePointer Uniform 16(float) - 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 41 12 - 119: 7(int) Constant 70 - 123: TypeVector 7(int) 3 - 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 9 13 - 125: TypePointer Function 123(ivec3) - 126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 124 22 12 - 130: 7(int) Constant 74 - 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 129 124 35 130 12 55 40 - 133: TypePointer Input 123(ivec3) - 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 124 39 12 -135(gl_GlobalInvocationID): 133(ptr) Variable Input - 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 137 124 35 130 12 38 137 135(gl_GlobalInvocationID) 82 - 139: TypePointer Function 7(int) - 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 22 12 - 144: 7(int) Constant 76 - 142: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 143 9 35 144 12 55 40 - 149: 73(int) Constant 10 - 150: TypePointer Uniform 73(int) - 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 75 41 12 - 161: 7(int) Constant 77 - 168: TypeBool - 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 169 10 41 12 - 176: 7(int) Constant 78 - 178(Particle): TypeStruct 71(fvec4) 71(fvec4) 71(fvec4) 71(fvec4) 16(float) - 181: 7(int) Constant 31 - 179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 180 72 35 181 22 12 12 13 - 182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 180 72 35 181 22 12 12 13 - 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 180 72 35 181 22 12 12 13 - 184: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 180 72 35 181 22 12 12 13 - 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 186 18 35 10 82 12 12 13 - 189: 7(int) Constant 81 - 187: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 188 39 35 189 12 38 188 12 13 179 182 183 184 185 - 190: TypeRuntimeArray 178(Particle) - 191: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 187 12 - 192(ParticleIn): TypeStruct 190 - 195: 7(int) Constant 36 - 196: 7(int) Constant 11 - 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 194 191 35 195 196 12 12 13 - 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 198 39 35 189 12 38 198 12 13 193 - 199: TypePointer Uniform 192(ParticleIn) - 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 197 41 12 - 201: 199(ptr) Variable Uniform - 202: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 203 197 35 189 12 38 203 201 82 - 204: 73(int) Constant 0 - 208: 73(int) Constant 4 - 211: 16(float) Constant 1065353216 - 216: 7(int) Constant 82 - 217: 7(int) Constant 26 - 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 216 217 55 - 218: TypeRuntimeArray 178(Particle) - 219: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 187 12 -220(ParticleOut): TypeStruct 218 - 223: 7(int) Constant 40 - 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 222 219 35 223 196 12 12 13 - 224: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 225 39 35 216 12 38 225 12 13 221 - 226: TypePointer Uniform 220(ParticleOut) - 227: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 224 41 12 - 228: 226(ptr) Variable Uniform - 229: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 203 224 35 216 12 38 203 228 82 - 234: TypePointer Uniform 71(fvec4) - 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 72 41 12 - 241: 7(int) Constant 83 - 242: 73(int) Constant 1 - 243: 16(float) Constant 0 - 244: 71(fvec4) ConstantComposite 243 243 243 243 - 247: 7(int) Constant 84 - 252: 7(int) Constant 88 - 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 251 20 35 252 12 55 40 - 256: 73(int) Constant 9 - 266: 7(int) Constant 90 - 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 265 20 35 266 12 55 40 - 276: 7(int) Constant 91 - 274: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 275 20 35 276 12 55 40 - 285: 7(int) Constant 95 - 291: 7(int) Constant 96 - 292: 7(int) Constant 9 - 290: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 291 292 55 - 312: 7(int) Constant 99 - 322: 7(int) Constant 100 - 321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 322 292 55 - 342: 7(int) Constant 103 - 352: 7(int) Constant 104 - 351: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 352 292 55 - 360: 73(int) Constant 5 - 376: 7(int) Constant 107 - 382: 7(int) Constant 108 - 381: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 382 292 55 - 405: 7(int) Constant 111 - 425: 7(int) Constant 112 - 424: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 425 292 55 - 434: 73(int) Constant 6 - 450: 7(int) Constant 115 - 466: 7(int) Constant 116 - 465: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 466 292 55 - 490: 7(int) Constant 119 - 514: 7(int) Constant 120 - 513: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 514 292 55 - 538: 7(int) Constant 123 - 558: 7(int) Constant 124 - 557: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 558 292 55 - 579: 73(int) Constant 3 - 583: 7(int) Constant 127 - 593: 7(int) Constant 130 - 591: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 592 20 35 593 12 55 40 - 603: 7(int) Constant 131 - 610: 16(float) Constant 1056964608 - 627: 7(int) Constant 132 - 642: 7(int) Constant 135 - 640: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 641 20 35 642 12 55 40 - 649: 73(int) Constant 8 - 656: 7(int) Constant 136 - 658: 73(int) Constant 7 - 661: 16(float) Constant 1008981770 - 667: 7(int) Constant 138 - 668: 7(int) Constant 30 - 666: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 667 668 55 - 690: 7(int) Constant 140 - 692(PushConsts): TypeStruct 7(int) - 695: 7(int) Constant 63 - 693: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 694 9 35 695 22 12 12 13 - 698: 7(int) Constant 144 - 696: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 697 39 35 698 12 38 697 12 13 693 - 699: TypePointer PushConstant 692(PushConsts) - 700: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 696 292 12 - 701(pushConsts): 699(ptr) Variable PushConstant - 702: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 703 696 35 698 12 38 703 701(pushConsts) 82 - 704: TypePointer PushConstant 7(int) - 705: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 292 12 - 714: 7(int) Constant 145 - 715: 7(int) Constant 15 - 713: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 714 715 55 - 717: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 180 20 35 714 12 713 40 - 721: 19(fvec3) ConstantComposite 243 243 243 - 724: 7(int) Constant 147 - 730: 7(int) Constant 148 - 729: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 730 40 713 - 739: 7(int) Constant 149 - 738: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 739 22 729 - 741: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 742 20 35 739 12 738 40 - 756: 7(int) Constant 150 - 754: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 755 20 35 756 12 738 40 - 773: 7(int) Constant 151 - 771: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 772 20 35 773 12 738 40 - 788: 7(int) Constant 152 - 800: 7(int) Constant 154 - 810: 7(int) Constant 155 - 809: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 810 22 729 - 825: 7(int) Constant 156 - 838: 7(int) Constant 157 - 847: 7(int) Constant 158 - 859: 7(int) Constant 161 - 869: 7(int) Constant 162 - 868: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 869 40 713 - 878: 7(int) Constant 163 - 877: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 878 22 868 - 893: 7(int) Constant 164 - 906: 7(int) Constant 165 - 915: 7(int) Constant 166 - 927: 7(int) Constant 168 - 937: 7(int) Constant 169 - 936: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 937 22 868 - 949: 7(int) Constant 170 - 962: 7(int) Constant 171 - 974: 7(int) Constant 172 - 986: 7(int) Constant 175 - 996: 7(int) Constant 177 - 997: 7(int) Constant 10 - 998: 123(ivec3) ConstantComposite 997 997 39 + 57: TypeVector 16(float) 4 + 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 40 + 59(Particle): TypeStruct 57(fvec4) 57(fvec4) 57(fvec4) 57(fvec4) 16(float) + 62: 7(int) Constant 28 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 61 58 35 62 22 12 12 13 + 65: 7(int) Constant 29 + 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 64 58 35 65 22 12 12 13 + 68: 7(int) Constant 30 + 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 67 58 35 68 22 12 12 13 + 71: 7(int) Constant 31 + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 70 58 35 71 22 12 12 13 + 74: 7(int) Constant 8 + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 73 18 35 10 74 12 12 13 + 77: 7(int) Constant 35 + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 76 39 35 77 12 38 76 12 13 60 63 66 69 72 + 78: TypeRuntimeArray 59(Particle) + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 75 12 + 80(ParticleIn): TypeStruct 78 + 83: 7(int) Constant 36 + 84: 7(int) Constant 11 + 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 82 79 35 83 84 12 12 13 + 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 86 39 35 77 12 38 86 12 13 81 + 87: TypePointer Uniform 80(ParticleIn) + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 85 41 12 + 89: 87(ptr) Variable Uniform + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 91 85 35 77 12 38 91 89 74 + 92: TypeRuntimeArray 59(Particle) + 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 75 12 + 94(ParticleOut): TypeStruct 92 + 97: 7(int) Constant 40 + 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 93 35 97 84 12 12 13 + 100: 7(int) Constant 39 + 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 99 39 35 100 12 38 99 12 13 95 + 101: TypePointer Uniform 94(ParticleOut) + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 41 12 + 103: 101(ptr) Variable Uniform + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 91 98 35 100 12 38 91 103 74 + 105: TypeInt 32 1 + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 106 10 40 12 + 108: TypeVector 105(int) 2 + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 107 41 + 110(UBO): TypeStruct 16(float) 16(float) 16(float) 16(float) 16(float) 16(float) 16(float) 16(float) 57(fvec4) 57(fvec4) 108(ivec2) + 113: 7(int) Constant 49 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 112 18 35 113 74 12 12 13 + 116: 7(int) Constant 50 + 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 115 18 35 116 74 12 12 13 + 119: 7(int) Constant 51 + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 118 18 35 119 74 12 12 13 + 122: 7(int) Constant 52 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 121 18 35 122 74 12 12 13 + 125: 7(int) Constant 53 + 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 124 18 35 125 74 12 12 13 + 128: 7(int) Constant 54 + 126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 127 18 35 128 74 12 12 13 + 131: 7(int) Constant 55 + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 130 18 35 131 74 12 12 13 + 134: 7(int) Constant 56 + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 133 18 35 134 74 12 12 13 + 137: 7(int) Constant 57 + 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 136 58 35 137 22 12 12 13 + 140: 7(int) Constant 58 + 138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 139 58 35 140 22 12 12 13 + 143: 7(int) Constant 59 + 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 142 109 35 143 74 12 12 13 + 146: 7(int) Constant 47 + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 145 39 35 146 12 38 145 12 13 111 114 117 120 123 126 129 132 135 138 141 + 147: TypePointer Uniform 110(UBO) + 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 144 41 12 + 149(params): 147(ptr) Variable Uniform + 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 151 144 35 146 12 38 151 149(params) 74 + 152(PushConsts): TypeStruct 7(int) + 155: 7(int) Constant 63 + 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 154 9 35 155 22 12 12 13 + 158: 7(int) Constant 62 + 156: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 157 39 35 158 12 38 157 12 13 153 + 159: TypePointer PushConstant 152(PushConsts) + 160: 7(int) Constant 9 + 161: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 156 160 12 + 162(pushConsts): 159(ptr) Variable PushConstant + 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 164 156 35 158 12 38 164 162(pushConsts) 74 + 169: 7(int) Constant 68 + 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 168 20 35 169 12 34 40 + 177: 7(int) Constant 69 + 179: 105(int) Constant 2 + 180: TypePointer Uniform 16(float) + 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 41 12 + 194: 7(int) Constant 70 + 198: TypeVector 7(int) 3 + 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 9 13 + 200: TypePointer Function 198(ivec3) + 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 199 22 12 + 205: 7(int) Constant 74 + 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 204 199 35 205 12 55 40 + 208: TypePointer Input 198(ivec3) + 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 199 39 12 +210(gl_GlobalInvocationID): 208(ptr) Variable Input + 211: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 212 199 35 205 12 38 212 210(gl_GlobalInvocationID) 74 + 214: TypePointer Function 7(int) + 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 22 12 + 219: 7(int) Constant 76 + 217: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 218 9 35 219 12 55 40 + 224: 105(int) Constant 10 + 225: TypePointer Uniform 105(int) + 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 107 41 12 + 236: 7(int) Constant 77 + 243: TypeBool + 245: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 244 10 41 12 + 251: 7(int) Constant 78 + 253: 105(int) Constant 0 + 257: 7(int) Constant 81 + 258: 105(int) Constant 4 + 261: 16(float) Constant 1065353216 + 266: 7(int) Constant 82 + 267: 7(int) Constant 26 + 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 266 267 55 + 272: TypePointer Uniform 57(fvec4) + 273: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 58 41 12 + 279: 7(int) Constant 83 + 280: 105(int) Constant 1 + 281: 16(float) Constant 0 + 282: 57(fvec4) ConstantComposite 281 281 281 281 + 285: 7(int) Constant 84 + 290: 7(int) Constant 88 + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 289 20 35 290 12 55 40 + 294: 105(int) Constant 9 + 303: 7(int) Constant 90 + 302: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 61 20 35 303 12 55 40 + 312: 7(int) Constant 91 + 311: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 64 20 35 312 12 55 40 + 321: 7(int) Constant 95 + 327: 7(int) Constant 96 + 326: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 327 160 55 + 347: 7(int) Constant 99 + 357: 7(int) Constant 100 + 356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 357 160 55 + 377: 7(int) Constant 103 + 387: 7(int) Constant 104 + 386: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 387 160 55 + 395: 105(int) Constant 5 + 411: 7(int) Constant 107 + 417: 7(int) Constant 108 + 416: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 417 160 55 + 440: 7(int) Constant 111 + 460: 7(int) Constant 112 + 459: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 460 160 55 + 469: 105(int) Constant 6 + 485: 7(int) Constant 115 + 501: 7(int) Constant 116 + 500: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 501 160 55 + 525: 7(int) Constant 119 + 549: 7(int) Constant 120 + 548: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 549 160 55 + 573: 7(int) Constant 123 + 593: 7(int) Constant 124 + 592: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 593 160 55 + 614: 105(int) Constant 3 + 618: 7(int) Constant 127 + 628: 7(int) Constant 130 + 626: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 627 20 35 628 12 55 40 + 638: 7(int) Constant 131 + 645: 16(float) Constant 1056964608 + 662: 7(int) Constant 132 + 677: 7(int) Constant 135 + 675: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 676 20 35 677 12 55 40 + 684: 105(int) Constant 8 + 691: 7(int) Constant 136 + 693: 105(int) Constant 7 + 696: 16(float) Constant 1008981770 + 702: 7(int) Constant 138 + 701: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 702 68 55 + 724: 7(int) Constant 140 + 726: TypePointer PushConstant 7(int) + 727: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 160 12 + 731: 7(int) Constant 144 + 737: 7(int) Constant 145 + 736: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 737 74 55 + 739: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 70 20 35 737 12 736 40 + 743: 19(fvec3) ConstantComposite 281 281 281 + 747: 7(int) Constant 146 + 745: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 746 20 35 747 12 736 40 + 751: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 752 20 35 747 12 736 40 + 755: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 756 20 35 747 12 736 40 + 760: 7(int) Constant 147 + 766: 7(int) Constant 148 + 765: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 766 40 736 + 775: 7(int) Constant 149 + 774: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 775 22 765 + 787: 7(int) Constant 150 + 800: 7(int) Constant 151 + 812: 7(int) Constant 152 + 824: 7(int) Constant 154 + 834: 7(int) Constant 155 + 833: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 834 22 765 + 849: 7(int) Constant 156 + 862: 7(int) Constant 157 + 871: 7(int) Constant 158 + 883: 7(int) Constant 161 + 893: 7(int) Constant 162 + 892: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 893 40 736 + 902: 7(int) Constant 163 + 901: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 902 22 892 + 917: 7(int) Constant 164 + 930: 7(int) Constant 165 + 939: 7(int) Constant 166 + 951: 7(int) Constant 168 + 961: 7(int) Constant 169 + 960: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 35 961 22 892 + 973: 7(int) Constant 170 + 986: 7(int) Constant 171 + 998: 7(int) Constant 172 + 1010: 7(int) Constant 175 + 1020: 7(int) Constant 177 + 1021: 7(int) Constant 10 + 1022: 198(ivec3) ConstantComposite 1021 1021 39 + 1023: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 1024 199 35 1020 12 38 1024 1022 74 14(main): 4 Function None 5 15: Label - 127(id): 125(ptr) Variable Function - 141(index): 139(ptr) Variable Function - 249(force): 21(ptr) Variable Function - 263(pos): 21(ptr) Variable Function - 273(vel): 21(ptr) Variable Function - 297(param): 21(ptr) Variable Function - 301(param): 21(ptr) Variable Function - 303(param): 24(ptr) Variable Function - 327(param): 21(ptr) Variable Function - 331(param): 21(ptr) Variable Function - 333(param): 24(ptr) Variable Function - 361(param): 21(ptr) Variable Function - 365(param): 21(ptr) Variable Function - 367(param): 24(ptr) Variable Function - 390(param): 21(ptr) Variable Function - 394(param): 21(ptr) Variable Function - 396(param): 24(ptr) Variable Function - 435(param): 21(ptr) Variable Function - 439(param): 21(ptr) Variable Function - 441(param): 24(ptr) Variable Function - 475(param): 21(ptr) Variable Function - 479(param): 21(ptr) Variable Function - 481(param): 24(ptr) Variable Function - 523(param): 21(ptr) Variable Function - 527(param): 21(ptr) Variable Function - 529(param): 24(ptr) Variable Function - 567(param): 21(ptr) Variable Function - 571(param): 21(ptr) Variable Function - 573(param): 24(ptr) Variable Function - 590(f): 21(ptr) Variable Function - 639(sphereDist): 21(ptr) Variable Function - 716(normal): 21(ptr) Variable Function - 740(a): 21(ptr) Variable Function - 753(b): 21(ptr) Variable Function - 770(c): 21(ptr) Variable Function - 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 56 56 12 12 - 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 55 14(main) - 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 130 130 12 12 - 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 128 127(id) 45 - 138: 123(ivec3) Load 135(gl_GlobalInvocationID) - Store 127(id) 138 - 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 144 144 12 12 - 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 142 141(index) 45 - 147: 139(ptr) AccessChain 127(id) 39 - 148: 7(int) Load 147 - 152: 150(ptr) AccessChain 101(params) 149 12 - 153: 73(int) Load 152 - 154: 7(int) Bitcast 153 - 155: 7(int) IMul 148 154 - 156: 139(ptr) AccessChain 127(id) 12 - 157: 7(int) Load 156 - 158: 7(int) IAdd 155 157 - Store 141(index) 158 - 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 161 161 12 12 - 159: 7(int) Load 141(index) - 162: 150(ptr) AccessChain 101(params) 149 12 - 163: 73(int) Load 162 - 164: 150(ptr) AccessChain 101(params) 149 39 - 165: 73(int) Load 164 - 166: 73(int) IMul 163 165 - 167: 7(int) Bitcast 166 - 171: 168(bool) UGreaterThan 159 167 - SelectionMerge 173 None - BranchConditional 171 172 173 - 172: Label - 174: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 175: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 176 176 12 12 + 202(id): 200(ptr) Variable Function + 216(index): 214(ptr) Variable Function + 287(force): 21(ptr) Variable Function + 301(pos): 21(ptr) Variable Function + 310(vel): 21(ptr) Variable Function + 332(param): 21(ptr) Variable Function + 336(param): 21(ptr) Variable Function + 338(param): 24(ptr) Variable Function + 362(param): 21(ptr) Variable Function + 366(param): 21(ptr) Variable Function + 368(param): 24(ptr) Variable Function + 396(param): 21(ptr) Variable Function + 400(param): 21(ptr) Variable Function + 402(param): 24(ptr) Variable Function + 425(param): 21(ptr) Variable Function + 429(param): 21(ptr) Variable Function + 431(param): 24(ptr) Variable Function + 470(param): 21(ptr) Variable Function + 474(param): 21(ptr) Variable Function + 476(param): 24(ptr) Variable Function + 510(param): 21(ptr) Variable Function + 514(param): 21(ptr) Variable Function + 516(param): 24(ptr) Variable Function + 558(param): 21(ptr) Variable Function + 562(param): 21(ptr) Variable Function + 564(param): 24(ptr) Variable Function + 602(param): 21(ptr) Variable Function + 606(param): 21(ptr) Variable Function + 608(param): 24(ptr) Variable Function + 625(f): 21(ptr) Variable Function + 674(sphereDist): 21(ptr) Variable Function + 738(normal): 21(ptr) Variable Function + 744(a): 21(ptr) Variable Function + 750(b): 21(ptr) Variable Function + 754(c): 21(ptr) Variable Function + 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 56 56 12 12 + 195: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 55 14(main) + 207: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 205 205 12 12 + 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 203 202(id) 45 + 213: 198(ivec3) Load 210(gl_GlobalInvocationID) + Store 202(id) 213 + 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 219 219 12 12 + 220: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 217 216(index) 45 + 222: 214(ptr) AccessChain 202(id) 39 + 223: 7(int) Load 222 + 227: 225(ptr) AccessChain 149(params) 224 12 + 228: 105(int) Load 227 + 229: 7(int) Bitcast 228 + 230: 7(int) IMul 223 229 + 231: 214(ptr) AccessChain 202(id) 12 + 232: 7(int) Load 231 + 233: 7(int) IAdd 230 232 + Store 216(index) 233 + 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 236 236 12 12 + 234: 7(int) Load 216(index) + 237: 225(ptr) AccessChain 149(params) 224 12 + 238: 105(int) Load 237 + 239: 225(ptr) AccessChain 149(params) 224 39 + 240: 105(int) Load 239 + 241: 105(int) IMul 238 240 + 242: 7(int) Bitcast 241 + 246: 243(bool) UGreaterThan 234 242 + SelectionMerge 248 None + BranchConditional 246 247 248 + 247: Label + 249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 251 251 12 12 Return - 173: Label - 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 207: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 189 189 12 12 - 205: 7(int) Load 141(index) - 209: 105(ptr) AccessChain 201 204 205 208 - 210: 16(float) Load 209 - 212: 168(bool) FOrdEqual 210 211 - SelectionMerge 214 None - BranchConditional 212 213 214 - 213: Label - 231: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 215 - 232: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 216 216 12 12 - 230: 7(int) Load 141(index) - 233: 7(int) Load 141(index) - 236: 234(ptr) AccessChain 228 204 233 204 - 237: 71(fvec4) Load 236 - 238: 234(ptr) AccessChain 228 204 230 204 - Store 238 237 - 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 241 241 12 12 - 239: 7(int) Load 141(index) - 245: 234(ptr) AccessChain 228 204 239 242 - Store 245 244 - 246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 247 247 12 12 + 248: Label + 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 257 257 12 12 + 254: 7(int) Load 216(index) + 259: 180(ptr) AccessChain 89 253 254 258 + 260: 16(float) Load 259 + 262: 243(bool) FOrdEqual 260 261 + SelectionMerge 264 None + BranchConditional 262 263 264 + 263: Label + 269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 265 + 270: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 266 266 12 12 + 268: 7(int) Load 216(index) + 271: 7(int) Load 216(index) + 274: 272(ptr) AccessChain 103 253 271 253 + 275: 57(fvec4) Load 274 + 276: 272(ptr) AccessChain 103 253 268 253 + Store 276 275 + 278: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 279 279 12 12 + 277: 7(int) Load 216(index) + 283: 272(ptr) AccessChain 103 253 277 280 + Store 283 282 + 284: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 285 285 12 12 Return - 214: Label - 254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 252 252 12 12 - 253: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 250 249(force) 45 - 257: 234(ptr) AccessChain 101(params) 256 - 258: 71(fvec4) Load 257 - 259: 19(fvec3) VectorShuffle 258 258 0 1 2 - 260: 105(ptr) AccessChain 101(params) 242 - 261: 16(float) Load 260 - 262: 19(fvec3) VectorTimesScalar 259 261 - Store 249(force) 262 - 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 266 266 12 12 - 267: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 264 263(pos) 45 - 269: 7(int) Load 141(index) - 270: 234(ptr) AccessChain 201 204 269 204 - 271: 71(fvec4) Load 270 - 272: 19(fvec3) VectorShuffle 271 271 0 1 2 - Store 263(pos) 272 - 278: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 276 276 12 12 - 277: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 274 273(vel) 45 - 279: 7(int) Load 141(index) - 280: 234(ptr) AccessChain 201 204 279 242 - 281: 71(fvec4) Load 280 - 282: 19(fvec3) VectorShuffle 281 281 0 1 2 - Store 273(vel) 282 - 284: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 285 285 12 12 - 283: 139(ptr) AccessChain 127(id) 12 - 286: 7(int) Load 283 - 287: 168(bool) UGreaterThan 286 12 - SelectionMerge 289 None - BranchConditional 287 288 289 - 288: Label - 294: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 290 - 295: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 291 291 12 12 - 293: 7(int) Load 141(index) - 296: 7(int) ISub 293 39 - 298: 234(ptr) AccessChain 201 204 296 204 - 299: 71(fvec4) Load 298 - 300: 19(fvec3) VectorShuffle 299 299 0 1 2 - Store 297(param) 300 - 302: 19(fvec3) Load 263(pos) - Store 301(param) 302 - 304: 105(ptr) AccessChain 101(params) 208 - 305: 16(float) Load 304 - Store 303(param) 305 - 306: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 297(param) 301(param) 303(param) - 307: 19(fvec3) Load 249(force) - 308: 19(fvec3) FAdd 307 306 - Store 249(force) 308 - Branch 289 - 289: Label - 310: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 311: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 312 312 12 12 - 309: 139(ptr) AccessChain 127(id) 12 - 313: 7(int) Load 309 - 314: 150(ptr) AccessChain 101(params) 149 12 - 315: 73(int) Load 314 - 316: 73(int) ISub 315 242 - 317: 7(int) Bitcast 316 - 318: 168(bool) ULessThan 313 317 - SelectionMerge 320 None - BranchConditional 318 319 320 - 319: Label - 324: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 321 - 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 322 322 12 12 - 323: 7(int) Load 141(index) - 326: 7(int) IAdd 323 39 - 328: 234(ptr) AccessChain 201 204 326 204 - 329: 71(fvec4) Load 328 - 330: 19(fvec3) VectorShuffle 329 329 0 1 2 - Store 327(param) 330 - 332: 19(fvec3) Load 263(pos) - Store 331(param) 332 - 334: 105(ptr) AccessChain 101(params) 208 - 335: 16(float) Load 334 - Store 333(param) 335 - 336: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 327(param) 331(param) 333(param) - 337: 19(fvec3) Load 249(force) - 338: 19(fvec3) FAdd 337 336 - Store 249(force) 338 - Branch 320 - 320: Label - 340: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 341: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 342 342 12 12 - 339: 139(ptr) AccessChain 127(id) 39 - 343: 7(int) Load 339 - 344: 150(ptr) AccessChain 101(params) 149 39 - 345: 73(int) Load 344 - 346: 73(int) ISub 345 242 - 347: 7(int) Bitcast 346 - 348: 168(bool) ULessThan 343 347 - SelectionMerge 350 None - BranchConditional 348 349 350 - 349: Label - 354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 351 - 355: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 352 352 12 12 - 353: 7(int) Load 141(index) - 356: 150(ptr) AccessChain 101(params) 149 12 - 357: 73(int) Load 356 - 358: 7(int) Bitcast 357 - 359: 7(int) IAdd 353 358 - 362: 234(ptr) AccessChain 201 204 359 204 - 363: 71(fvec4) Load 362 - 364: 19(fvec3) VectorShuffle 363 363 0 1 2 - Store 361(param) 364 - 366: 19(fvec3) Load 263(pos) - Store 365(param) 366 - 368: 105(ptr) AccessChain 101(params) 360 - 369: 16(float) Load 368 - Store 367(param) 369 - 370: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 361(param) 365(param) 367(param) - 371: 19(fvec3) Load 249(force) - 372: 19(fvec3) FAdd 371 370 - Store 249(force) 372 - Branch 350 - 350: Label - 374: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 375: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 376 376 12 12 - 373: 139(ptr) AccessChain 127(id) 39 - 377: 7(int) Load 373 - 378: 168(bool) UGreaterThan 377 12 - SelectionMerge 380 None - BranchConditional 378 379 380 - 379: Label - 384: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 381 - 385: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 382 382 12 12 - 383: 7(int) Load 141(index) - 386: 150(ptr) AccessChain 101(params) 149 12 - 387: 73(int) Load 386 - 388: 7(int) Bitcast 387 - 389: 7(int) ISub 383 388 - 391: 234(ptr) AccessChain 201 204 389 204 - 392: 71(fvec4) Load 391 - 393: 19(fvec3) VectorShuffle 392 392 0 1 2 - Store 390(param) 393 - 395: 19(fvec3) Load 263(pos) - Store 394(param) 395 - 397: 105(ptr) AccessChain 101(params) 360 - 398: 16(float) Load 397 - Store 396(param) 398 - 399: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 390(param) 394(param) 396(param) - 400: 19(fvec3) Load 249(force) - 401: 19(fvec3) FAdd 400 399 - Store 249(force) 401 - Branch 380 - 380: Label - 403: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 404: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 405 405 12 12 - 402: 139(ptr) AccessChain 127(id) 12 - 406: 7(int) Load 402 - 407: 168(bool) UGreaterThan 406 12 - SelectionMerge 409 None - BranchConditional 407 408 409 - 408: Label - 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 412: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 405 405 12 12 - 410: 139(ptr) AccessChain 127(id) 39 - 413: 7(int) Load 410 - 414: 150(ptr) AccessChain 101(params) 149 39 - 415: 73(int) Load 414 - 416: 73(int) ISub 415 242 - 417: 7(int) Bitcast 416 - 418: 168(bool) ULessThan 413 417 - Branch 409 - 409: Label - 419: 168(bool) Phi 407 380 418 408 - 422: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 423: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 405 405 12 12 - SelectionMerge 421 None - BranchConditional 419 420 421 - 420: Label - 427: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 424 - 428: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 425 425 12 12 - 426: 7(int) Load 141(index) - 429: 150(ptr) AccessChain 101(params) 149 12 - 430: 73(int) Load 429 - 431: 7(int) Bitcast 430 - 432: 7(int) IAdd 426 431 - 433: 7(int) ISub 432 39 - 436: 234(ptr) AccessChain 201 204 433 204 - 437: 71(fvec4) Load 436 - 438: 19(fvec3) VectorShuffle 437 437 0 1 2 - Store 435(param) 438 - 440: 19(fvec3) Load 263(pos) - Store 439(param) 440 - 442: 105(ptr) AccessChain 101(params) 434 - 443: 16(float) Load 442 - Store 441(param) 443 - 444: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 435(param) 439(param) 441(param) - 445: 19(fvec3) Load 249(force) - 446: 19(fvec3) FAdd 445 444 - Store 249(force) 446 - Branch 421 - 421: Label - 448: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 449: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 450 450 12 12 - 447: 139(ptr) AccessChain 127(id) 12 - 451: 7(int) Load 447 - 452: 168(bool) UGreaterThan 451 12 - SelectionMerge 454 None - BranchConditional 452 453 454 - 453: Label - 456: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 457: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 450 450 12 12 - 455: 139(ptr) AccessChain 127(id) 39 - 458: 7(int) Load 455 - 459: 168(bool) UGreaterThan 458 12 - Branch 454 - 454: Label - 460: 168(bool) Phi 452 421 459 453 - 463: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 464: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 450 450 12 12 - SelectionMerge 462 None - BranchConditional 460 461 462 - 461: Label - 468: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 465 - 469: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 466 466 12 12 - 467: 7(int) Load 141(index) - 470: 150(ptr) AccessChain 101(params) 149 12 - 471: 73(int) Load 470 - 472: 7(int) Bitcast 471 - 473: 7(int) ISub 467 472 - 474: 7(int) ISub 473 39 - 476: 234(ptr) AccessChain 201 204 474 204 - 477: 71(fvec4) Load 476 - 478: 19(fvec3) VectorShuffle 477 477 0 1 2 - Store 475(param) 478 - 480: 19(fvec3) Load 263(pos) - Store 479(param) 480 - 482: 105(ptr) AccessChain 101(params) 434 - 483: 16(float) Load 482 - Store 481(param) 483 - 484: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 475(param) 479(param) 481(param) - 485: 19(fvec3) Load 249(force) - 486: 19(fvec3) FAdd 485 484 - Store 249(force) 486 - Branch 462 - 462: Label - 488: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 489: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 490 490 12 12 - 487: 139(ptr) AccessChain 127(id) 12 - 491: 7(int) Load 487 - 492: 150(ptr) AccessChain 101(params) 149 12 - 493: 73(int) Load 492 - 494: 73(int) ISub 493 242 - 495: 7(int) Bitcast 494 - 496: 168(bool) ULessThan 491 495 - SelectionMerge 498 None - BranchConditional 496 497 498 - 497: Label - 500: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 501: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 490 490 12 12 - 499: 139(ptr) AccessChain 127(id) 39 - 502: 7(int) Load 499 - 503: 150(ptr) AccessChain 101(params) 149 39 - 504: 73(int) Load 503 - 505: 73(int) ISub 504 242 - 506: 7(int) Bitcast 505 - 507: 168(bool) ULessThan 502 506 - Branch 498 - 498: Label - 508: 168(bool) Phi 496 462 507 497 - 511: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 512: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 490 490 12 12 - SelectionMerge 510 None - BranchConditional 508 509 510 - 509: Label - 516: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 513 - 517: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 514 514 12 12 - 515: 7(int) Load 141(index) - 518: 150(ptr) AccessChain 101(params) 149 12 - 519: 73(int) Load 518 - 520: 7(int) Bitcast 519 - 521: 7(int) IAdd 515 520 - 522: 7(int) IAdd 521 39 - 524: 234(ptr) AccessChain 201 204 522 204 - 525: 71(fvec4) Load 524 - 526: 19(fvec3) VectorShuffle 525 525 0 1 2 - Store 523(param) 526 - 528: 19(fvec3) Load 263(pos) - Store 527(param) 528 - 530: 105(ptr) AccessChain 101(params) 434 - 531: 16(float) Load 530 - Store 529(param) 531 - 532: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 523(param) 527(param) 529(param) - 533: 19(fvec3) Load 249(force) - 534: 19(fvec3) FAdd 533 532 - Store 249(force) 534 - Branch 510 - 510: Label - 536: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 537: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 538 538 12 12 - 535: 139(ptr) AccessChain 127(id) 12 - 539: 7(int) Load 535 - 540: 150(ptr) AccessChain 101(params) 149 12 - 541: 73(int) Load 540 - 542: 73(int) ISub 541 242 - 543: 7(int) Bitcast 542 - 544: 168(bool) ULessThan 539 543 - SelectionMerge 546 None - BranchConditional 544 545 546 - 545: Label - 548: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 549: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 538 538 12 12 - 547: 139(ptr) AccessChain 127(id) 39 - 550: 7(int) Load 547 - 551: 168(bool) UGreaterThan 550 12 - Branch 546 - 546: Label - 552: 168(bool) Phi 544 510 551 545 - 555: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 556: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 538 538 12 12 - SelectionMerge 554 None - BranchConditional 552 553 554 - 553: Label - 560: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 557 - 561: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 558 558 12 12 - 559: 7(int) Load 141(index) - 562: 150(ptr) AccessChain 101(params) 149 12 - 563: 73(int) Load 562 - 564: 7(int) Bitcast 563 - 565: 7(int) ISub 559 564 - 566: 7(int) IAdd 565 39 - 568: 234(ptr) AccessChain 201 204 566 204 - 569: 71(fvec4) Load 568 - 570: 19(fvec3) VectorShuffle 569 569 0 1 2 - Store 567(param) 570 - 572: 19(fvec3) Load 263(pos) - Store 571(param) 572 - 574: 105(ptr) AccessChain 101(params) 434 - 575: 16(float) Load 574 - Store 573(param) 575 - 576: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 567(param) 571(param) 573(param) - 577: 19(fvec3) Load 249(force) - 578: 19(fvec3) FAdd 577 576 - Store 249(force) 578 - Branch 554 - 554: Label - 581: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 582: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 583 583 12 12 - 580: 105(ptr) AccessChain 101(params) 579 - 584: 16(float) Load 580 - 585: 16(float) FNegate 584 - 586: 19(fvec3) Load 273(vel) - 587: 19(fvec3) VectorTimesScalar 586 585 - 588: 19(fvec3) Load 249(force) - 589: 19(fvec3) FAdd 588 587 - Store 249(force) 589 - 595: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 593 593 12 12 - 594: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 591 590(f) 45 - 596: 19(fvec3) Load 249(force) - 597: 105(ptr) AccessChain 101(params) 242 - 598: 16(float) Load 597 - 599: 16(float) FDiv 211 598 - 600: 19(fvec3) VectorTimesScalar 596 599 - Store 590(f) 600 - 602: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 603 603 12 12 - 601: 7(int) Load 141(index) - 604: 19(fvec3) Load 263(pos) - 605: 19(fvec3) Load 273(vel) - 606: 105(ptr) AccessChain 101(params) 204 - 607: 16(float) Load 606 - 608: 19(fvec3) VectorTimesScalar 605 607 - 609: 19(fvec3) FAdd 604 608 - 611: 19(fvec3) Load 590(f) - 612: 19(fvec3) VectorTimesScalar 611 610 - 613: 105(ptr) AccessChain 101(params) 204 - 614: 16(float) Load 613 - 615: 19(fvec3) VectorTimesScalar 612 614 - 616: 105(ptr) AccessChain 101(params) 204 - 617: 16(float) Load 616 - 618: 19(fvec3) VectorTimesScalar 615 617 - 619: 19(fvec3) FAdd 609 618 - 620: 16(float) CompositeExtract 619 0 - 621: 16(float) CompositeExtract 619 1 - 622: 16(float) CompositeExtract 619 2 - 623: 71(fvec4) CompositeConstruct 620 621 622 211 - 624: 234(ptr) AccessChain 228 204 601 204 - Store 624 623 - 626: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 627 627 12 12 - 625: 7(int) Load 141(index) - 628: 19(fvec3) Load 273(vel) - 629: 19(fvec3) Load 590(f) - 630: 105(ptr) AccessChain 101(params) 204 - 631: 16(float) Load 630 - 632: 19(fvec3) VectorTimesScalar 629 631 - 633: 19(fvec3) FAdd 628 632 - 634: 16(float) CompositeExtract 633 0 - 635: 16(float) CompositeExtract 633 1 - 636: 16(float) CompositeExtract 633 2 - 637: 71(fvec4) CompositeConstruct 634 635 636 243 - 638: 234(ptr) AccessChain 228 204 625 242 - Store 638 637 - 644: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 642 642 12 12 - 643: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 640 639(sphereDist) 45 - 645: 7(int) Load 141(index) - 646: 234(ptr) AccessChain 228 204 645 204 - 647: 71(fvec4) Load 646 - 648: 19(fvec3) VectorShuffle 647 647 0 1 2 - 650: 234(ptr) AccessChain 101(params) 649 - 651: 71(fvec4) Load 650 - 652: 19(fvec3) VectorShuffle 651 651 0 1 2 - 653: 19(fvec3) FSub 648 652 - Store 639(sphereDist) 653 - 655: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 656 656 12 12 - 654: 19(fvec3) Load 639(sphereDist) - 657: 16(float) ExtInst 3(GLSL.std.450) 66(Length) 654 - 659: 105(ptr) AccessChain 101(params) 658 - 660: 16(float) Load 659 - 662: 16(float) FAdd 660 661 - 663: 168(bool) FOrdLessThan 657 662 - SelectionMerge 665 None - BranchConditional 663 664 665 - 664: Label - 670: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 666 - 671: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 667 667 12 12 - 669: 7(int) Load 141(index) - 672: 234(ptr) AccessChain 101(params) 649 - 673: 71(fvec4) Load 672 - 674: 19(fvec3) VectorShuffle 673 673 0 1 2 - 675: 19(fvec3) Load 639(sphereDist) - 676: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 675 - 677: 105(ptr) AccessChain 101(params) 658 - 678: 16(float) Load 677 - 679: 16(float) FAdd 678 661 - 680: 19(fvec3) VectorTimesScalar 676 679 - 681: 19(fvec3) FAdd 674 680 - 682: 105(ptr) AccessChain 228 204 669 204 12 - 683: 16(float) CompositeExtract 681 0 - Store 682 683 - 684: 105(ptr) AccessChain 228 204 669 204 39 - 685: 16(float) CompositeExtract 681 1 - Store 684 685 - 686: 105(ptr) AccessChain 228 204 669 204 41 - 687: 16(float) CompositeExtract 681 2 - Store 686 687 - 689: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 690 690 12 12 - 688: 7(int) Load 141(index) - 691: 234(ptr) AccessChain 228 204 688 242 - Store 691 244 - Branch 665 - 665: Label - 707: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 708: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 698 698 12 12 - 706: 704(ptr) AccessChain 701(pushConsts) 204 - 709: 7(int) Load 706 - 710: 168(bool) IEqual 709 39 - SelectionMerge 712 None - BranchConditional 710 711 712 - 711: Label - 719: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 713 - 720: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 714 714 12 12 - 718: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 717 716(normal) 45 - Store 716(normal) 721 + 264: Label + 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 293: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 290 290 12 12 + 291: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 288 287(force) 45 + 295: 272(ptr) AccessChain 149(params) 294 + 296: 57(fvec4) Load 295 + 297: 19(fvec3) VectorShuffle 296 296 0 1 2 + 298: 180(ptr) AccessChain 149(params) 280 + 299: 16(float) Load 298 + 300: 19(fvec3) VectorTimesScalar 297 299 + Store 287(force) 300 + 305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 303 303 12 12 + 304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 302 301(pos) 45 + 306: 7(int) Load 216(index) + 307: 272(ptr) AccessChain 89 253 306 253 + 308: 57(fvec4) Load 307 + 309: 19(fvec3) VectorShuffle 308 308 0 1 2 + Store 301(pos) 309 + 314: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 312 312 12 12 + 313: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 311 310(vel) 45 + 315: 7(int) Load 216(index) + 316: 272(ptr) AccessChain 89 253 315 280 + 317: 57(fvec4) Load 316 + 318: 19(fvec3) VectorShuffle 317 317 0 1 2 + Store 310(vel) 318 + 320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 321 321 12 12 + 319: 214(ptr) AccessChain 202(id) 12 + 322: 7(int) Load 319 + 323: 243(bool) UGreaterThan 322 12 + SelectionMerge 325 None + BranchConditional 323 324 325 + 324: Label + 329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 326 + 330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 327 327 12 12 + 328: 7(int) Load 216(index) + 331: 7(int) ISub 328 39 + 333: 272(ptr) AccessChain 89 253 331 253 + 334: 57(fvec4) Load 333 + 335: 19(fvec3) VectorShuffle 334 334 0 1 2 + Store 332(param) 335 + 337: 19(fvec3) Load 301(pos) + Store 336(param) 337 + 339: 180(ptr) AccessChain 149(params) 258 + 340: 16(float) Load 339 + Store 338(param) 340 + 341: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 332(param) 336(param) 338(param) + 342: 19(fvec3) Load 287(force) + 343: 19(fvec3) FAdd 342 341 + Store 287(force) 343 + Branch 325 + 325: Label + 345: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 346: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 347 347 12 12 + 344: 214(ptr) AccessChain 202(id) 12 + 348: 7(int) Load 344 + 349: 225(ptr) AccessChain 149(params) 224 12 + 350: 105(int) Load 349 + 351: 105(int) ISub 350 280 + 352: 7(int) Bitcast 351 + 353: 243(bool) ULessThan 348 352 + SelectionMerge 355 None + BranchConditional 353 354 355 + 354: Label + 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 356 + 360: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 357 357 12 12 + 358: 7(int) Load 216(index) + 361: 7(int) IAdd 358 39 + 363: 272(ptr) AccessChain 89 253 361 253 + 364: 57(fvec4) Load 363 + 365: 19(fvec3) VectorShuffle 364 364 0 1 2 + Store 362(param) 365 + 367: 19(fvec3) Load 301(pos) + Store 366(param) 367 + 369: 180(ptr) AccessChain 149(params) 258 + 370: 16(float) Load 369 + Store 368(param) 370 + 371: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 362(param) 366(param) 368(param) + 372: 19(fvec3) Load 287(force) + 373: 19(fvec3) FAdd 372 371 + Store 287(force) 373 + Branch 355 + 355: Label + 375: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 377 377 12 12 + 374: 214(ptr) AccessChain 202(id) 39 + 378: 7(int) Load 374 + 379: 225(ptr) AccessChain 149(params) 224 39 + 380: 105(int) Load 379 + 381: 105(int) ISub 380 280 + 382: 7(int) Bitcast 381 + 383: 243(bool) ULessThan 378 382 + SelectionMerge 385 None + BranchConditional 383 384 385 + 384: Label + 389: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 386 + 390: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 387 387 12 12 + 388: 7(int) Load 216(index) + 391: 225(ptr) AccessChain 149(params) 224 12 + 392: 105(int) Load 391 + 393: 7(int) Bitcast 392 + 394: 7(int) IAdd 388 393 + 397: 272(ptr) AccessChain 89 253 394 253 + 398: 57(fvec4) Load 397 + 399: 19(fvec3) VectorShuffle 398 398 0 1 2 + Store 396(param) 399 + 401: 19(fvec3) Load 301(pos) + Store 400(param) 401 + 403: 180(ptr) AccessChain 149(params) 395 + 404: 16(float) Load 403 + Store 402(param) 404 + 405: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 396(param) 400(param) 402(param) + 406: 19(fvec3) Load 287(force) + 407: 19(fvec3) FAdd 406 405 + Store 287(force) 407 + Branch 385 + 385: Label + 409: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 410: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 411 411 12 12 + 408: 214(ptr) AccessChain 202(id) 39 + 412: 7(int) Load 408 + 413: 243(bool) UGreaterThan 412 12 + SelectionMerge 415 None + BranchConditional 413 414 415 + 414: Label + 419: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 416 + 420: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 417 417 12 12 + 418: 7(int) Load 216(index) + 421: 225(ptr) AccessChain 149(params) 224 12 + 422: 105(int) Load 421 + 423: 7(int) Bitcast 422 + 424: 7(int) ISub 418 423 + 426: 272(ptr) AccessChain 89 253 424 253 + 427: 57(fvec4) Load 426 + 428: 19(fvec3) VectorShuffle 427 427 0 1 2 + Store 425(param) 428 + 430: 19(fvec3) Load 301(pos) + Store 429(param) 430 + 432: 180(ptr) AccessChain 149(params) 395 + 433: 16(float) Load 432 + Store 431(param) 433 + 434: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 425(param) 429(param) 431(param) + 435: 19(fvec3) Load 287(force) + 436: 19(fvec3) FAdd 435 434 + Store 287(force) 436 + Branch 415 + 415: Label + 438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 439: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 440 440 12 12 + 437: 214(ptr) AccessChain 202(id) 12 + 441: 7(int) Load 437 + 442: 243(bool) UGreaterThan 441 12 + SelectionMerge 444 None + BranchConditional 442 443 444 + 443: Label + 446: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 447: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 440 440 12 12 + 445: 214(ptr) AccessChain 202(id) 39 + 448: 7(int) Load 445 + 449: 225(ptr) AccessChain 149(params) 224 39 + 450: 105(int) Load 449 + 451: 105(int) ISub 450 280 + 452: 7(int) Bitcast 451 + 453: 243(bool) ULessThan 448 452 + Branch 444 + 444: Label + 454: 243(bool) Phi 442 415 453 443 + 457: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 458: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 440 440 12 12 + SelectionMerge 456 None + BranchConditional 454 455 456 + 455: Label + 462: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 459 + 463: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 460 460 12 12 + 461: 7(int) Load 216(index) + 464: 225(ptr) AccessChain 149(params) 224 12 + 465: 105(int) Load 464 + 466: 7(int) Bitcast 465 + 467: 7(int) IAdd 461 466 + 468: 7(int) ISub 467 39 + 471: 272(ptr) AccessChain 89 253 468 253 + 472: 57(fvec4) Load 471 + 473: 19(fvec3) VectorShuffle 472 472 0 1 2 + Store 470(param) 473 + 475: 19(fvec3) Load 301(pos) + Store 474(param) 475 + 477: 180(ptr) AccessChain 149(params) 469 + 478: 16(float) Load 477 + Store 476(param) 478 + 479: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 470(param) 474(param) 476(param) + 480: 19(fvec3) Load 287(force) + 481: 19(fvec3) FAdd 480 479 + Store 287(force) 481 + Branch 456 + 456: Label + 483: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 484: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 485 485 12 12 + 482: 214(ptr) AccessChain 202(id) 12 + 486: 7(int) Load 482 + 487: 243(bool) UGreaterThan 486 12 + SelectionMerge 489 None + BranchConditional 487 488 489 + 488: Label + 491: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 492: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 485 485 12 12 + 490: 214(ptr) AccessChain 202(id) 39 + 493: 7(int) Load 490 + 494: 243(bool) UGreaterThan 493 12 + Branch 489 + 489: Label + 495: 243(bool) Phi 487 456 494 488 + 498: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 499: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 485 485 12 12 + SelectionMerge 497 None + BranchConditional 495 496 497 + 496: Label + 503: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 500 + 504: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 501 501 12 12 + 502: 7(int) Load 216(index) + 505: 225(ptr) AccessChain 149(params) 224 12 + 506: 105(int) Load 505 + 507: 7(int) Bitcast 506 + 508: 7(int) ISub 502 507 + 509: 7(int) ISub 508 39 + 511: 272(ptr) AccessChain 89 253 509 253 + 512: 57(fvec4) Load 511 + 513: 19(fvec3) VectorShuffle 512 512 0 1 2 + Store 510(param) 513 + 515: 19(fvec3) Load 301(pos) + Store 514(param) 515 + 517: 180(ptr) AccessChain 149(params) 469 + 518: 16(float) Load 517 + Store 516(param) 518 + 519: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 510(param) 514(param) 516(param) + 520: 19(fvec3) Load 287(force) + 521: 19(fvec3) FAdd 520 519 + Store 287(force) 521 + Branch 497 + 497: Label + 523: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 524: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 525 525 12 12 + 522: 214(ptr) AccessChain 202(id) 12 + 526: 7(int) Load 522 + 527: 225(ptr) AccessChain 149(params) 224 12 + 528: 105(int) Load 527 + 529: 105(int) ISub 528 280 + 530: 7(int) Bitcast 529 + 531: 243(bool) ULessThan 526 530 + SelectionMerge 533 None + BranchConditional 531 532 533 + 532: Label + 535: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 536: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 525 525 12 12 + 534: 214(ptr) AccessChain 202(id) 39 + 537: 7(int) Load 534 + 538: 225(ptr) AccessChain 149(params) 224 39 + 539: 105(int) Load 538 + 540: 105(int) ISub 539 280 + 541: 7(int) Bitcast 540 + 542: 243(bool) ULessThan 537 541 + Branch 533 + 533: Label + 543: 243(bool) Phi 531 497 542 532 + 546: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 547: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 525 525 12 12 + SelectionMerge 545 None + BranchConditional 543 544 545 + 544: Label + 551: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 548 + 552: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 549 549 12 12 + 550: 7(int) Load 216(index) + 553: 225(ptr) AccessChain 149(params) 224 12 + 554: 105(int) Load 553 + 555: 7(int) Bitcast 554 + 556: 7(int) IAdd 550 555 + 557: 7(int) IAdd 556 39 + 559: 272(ptr) AccessChain 89 253 557 253 + 560: 57(fvec4) Load 559 + 561: 19(fvec3) VectorShuffle 560 560 0 1 2 + Store 558(param) 561 + 563: 19(fvec3) Load 301(pos) + Store 562(param) 563 + 565: 180(ptr) AccessChain 149(params) 469 + 566: 16(float) Load 565 + Store 564(param) 566 + 567: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 558(param) 562(param) 564(param) + 568: 19(fvec3) Load 287(force) + 569: 19(fvec3) FAdd 568 567 + Store 287(force) 569 + Branch 545 + 545: Label + 571: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 572: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 573 573 12 12 + 570: 214(ptr) AccessChain 202(id) 12 + 574: 7(int) Load 570 + 575: 225(ptr) AccessChain 149(params) 224 12 + 576: 105(int) Load 575 + 577: 105(int) ISub 576 280 + 578: 7(int) Bitcast 577 + 579: 243(bool) ULessThan 574 578 + SelectionMerge 581 None + BranchConditional 579 580 581 + 580: Label + 583: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 584: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 573 573 12 12 + 582: 214(ptr) AccessChain 202(id) 39 + 585: 7(int) Load 582 + 586: 243(bool) UGreaterThan 585 12 + Branch 581 + 581: Label + 587: 243(bool) Phi 579 545 586 580 + 590: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 591: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 573 573 12 12 + SelectionMerge 589 None + BranchConditional 587 588 589 + 588: Label + 595: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 592 + 596: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 593 593 12 12 + 594: 7(int) Load 216(index) + 597: 225(ptr) AccessChain 149(params) 224 12 + 598: 105(int) Load 597 + 599: 7(int) Bitcast 598 + 600: 7(int) ISub 594 599 + 601: 7(int) IAdd 600 39 + 603: 272(ptr) AccessChain 89 253 601 253 + 604: 57(fvec4) Load 603 + 605: 19(fvec3) VectorShuffle 604 604 0 1 2 + Store 602(param) 605 + 607: 19(fvec3) Load 301(pos) + Store 606(param) 607 + 609: 180(ptr) AccessChain 149(params) 469 + 610: 16(float) Load 609 + Store 608(param) 610 + 611: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 602(param) 606(param) 608(param) + 612: 19(fvec3) Load 287(force) + 613: 19(fvec3) FAdd 612 611 + Store 287(force) 613 + Branch 589 + 589: Label + 616: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 617: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 618 618 12 12 + 615: 180(ptr) AccessChain 149(params) 614 + 619: 16(float) Load 615 + 620: 16(float) FNegate 619 + 621: 19(fvec3) Load 310(vel) + 622: 19(fvec3) VectorTimesScalar 621 620 + 623: 19(fvec3) Load 287(force) + 624: 19(fvec3) FAdd 623 622 + Store 287(force) 624 + 630: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 628 628 12 12 + 629: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 626 625(f) 45 + 631: 19(fvec3) Load 287(force) + 632: 180(ptr) AccessChain 149(params) 280 + 633: 16(float) Load 632 + 634: 16(float) FDiv 261 633 + 635: 19(fvec3) VectorTimesScalar 631 634 + Store 625(f) 635 + 637: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 638 638 12 12 + 636: 7(int) Load 216(index) + 639: 19(fvec3) Load 301(pos) + 640: 19(fvec3) Load 310(vel) + 641: 180(ptr) AccessChain 149(params) 253 + 642: 16(float) Load 641 + 643: 19(fvec3) VectorTimesScalar 640 642 + 644: 19(fvec3) FAdd 639 643 + 646: 19(fvec3) Load 625(f) + 647: 19(fvec3) VectorTimesScalar 646 645 + 648: 180(ptr) AccessChain 149(params) 253 + 649: 16(float) Load 648 + 650: 19(fvec3) VectorTimesScalar 647 649 + 651: 180(ptr) AccessChain 149(params) 253 + 652: 16(float) Load 651 + 653: 19(fvec3) VectorTimesScalar 650 652 + 654: 19(fvec3) FAdd 644 653 + 655: 16(float) CompositeExtract 654 0 + 656: 16(float) CompositeExtract 654 1 + 657: 16(float) CompositeExtract 654 2 + 658: 57(fvec4) CompositeConstruct 655 656 657 261 + 659: 272(ptr) AccessChain 103 253 636 253 + Store 659 658 + 661: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 662 662 12 12 + 660: 7(int) Load 216(index) + 663: 19(fvec3) Load 310(vel) + 664: 19(fvec3) Load 625(f) + 665: 180(ptr) AccessChain 149(params) 253 + 666: 16(float) Load 665 + 667: 19(fvec3) VectorTimesScalar 664 666 + 668: 19(fvec3) FAdd 663 667 + 669: 16(float) CompositeExtract 668 0 + 670: 16(float) CompositeExtract 668 1 + 671: 16(float) CompositeExtract 668 2 + 672: 57(fvec4) CompositeConstruct 669 670 671 281 + 673: 272(ptr) AccessChain 103 253 660 280 + Store 673 672 + 679: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 677 677 12 12 + 678: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 675 674(sphereDist) 45 + 680: 7(int) Load 216(index) + 681: 272(ptr) AccessChain 103 253 680 253 + 682: 57(fvec4) Load 681 + 683: 19(fvec3) VectorShuffle 682 682 0 1 2 + 685: 272(ptr) AccessChain 149(params) 684 + 686: 57(fvec4) Load 685 + 687: 19(fvec3) VectorShuffle 686 686 0 1 2 + 688: 19(fvec3) FSub 683 687 + Store 674(sphereDist) 688 + 690: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 691 691 12 12 + 689: 19(fvec3) Load 674(sphereDist) + 692: 16(float) ExtInst 3(GLSL.std.450) 66(Length) 689 + 694: 180(ptr) AccessChain 149(params) 693 + 695: 16(float) Load 694 + 697: 16(float) FAdd 695 696 + 698: 243(bool) FOrdLessThan 692 697 + SelectionMerge 700 None + BranchConditional 698 699 700 + 699: Label + 704: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 701 + 705: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 702 702 12 12 + 703: 7(int) Load 216(index) + 706: 272(ptr) AccessChain 149(params) 684 + 707: 57(fvec4) Load 706 + 708: 19(fvec3) VectorShuffle 707 707 0 1 2 + 709: 19(fvec3) Load 674(sphereDist) + 710: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 709 + 711: 180(ptr) AccessChain 149(params) 693 + 712: 16(float) Load 711 + 713: 16(float) FAdd 712 696 + 714: 19(fvec3) VectorTimesScalar 710 713 + 715: 19(fvec3) FAdd 708 714 + 716: 180(ptr) AccessChain 103 253 703 253 12 + 717: 16(float) CompositeExtract 715 0 + Store 716 717 + 718: 180(ptr) AccessChain 103 253 703 253 39 + 719: 16(float) CompositeExtract 715 1 + Store 718 719 + 720: 180(ptr) AccessChain 103 253 703 253 41 + 721: 16(float) CompositeExtract 715 2 + Store 720 721 723: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 724 724 12 12 - 722: 139(ptr) AccessChain 127(id) 39 - 725: 7(int) Load 722 - 726: 168(bool) UGreaterThan 725 12 - SelectionMerge 728 None - BranchConditional 726 727 728 - 727: Label - 732: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 729 - 733: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 730 730 12 12 - 731: 139(ptr) AccessChain 127(id) 12 - 734: 7(int) Load 731 - 735: 168(bool) UGreaterThan 734 12 - SelectionMerge 737 None - BranchConditional 735 736 737 - 736: Label - 744: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 738 - 745: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 739 739 12 12 - 743: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 741 740(a) 45 - 746: 7(int) Load 141(index) - 747: 7(int) ISub 746 39 - 748: 234(ptr) AccessChain 201 204 747 204 - 749: 71(fvec4) Load 748 - 750: 19(fvec3) VectorShuffle 749 749 0 1 2 - 751: 19(fvec3) Load 263(pos) - 752: 19(fvec3) FSub 750 751 - Store 740(a) 752 - 758: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 756 756 12 12 - 757: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 754 753(b) 45 - 759: 7(int) Load 141(index) - 760: 150(ptr) AccessChain 101(params) 149 12 - 761: 73(int) Load 760 - 762: 7(int) Bitcast 761 - 763: 7(int) ISub 759 762 - 764: 7(int) ISub 763 39 - 765: 234(ptr) AccessChain 201 204 764 204 - 766: 71(fvec4) Load 765 - 767: 19(fvec3) VectorShuffle 766 766 0 1 2 - 768: 19(fvec3) Load 263(pos) - 769: 19(fvec3) FSub 767 768 - Store 753(b) 769 - 775: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 773 773 12 12 - 774: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 771 770(c) 45 - 776: 7(int) Load 141(index) - 777: 150(ptr) AccessChain 101(params) 149 12 - 778: 73(int) Load 777 - 779: 7(int) Bitcast 778 - 780: 7(int) ISub 776 779 - 781: 234(ptr) AccessChain 201 204 780 204 - 782: 71(fvec4) Load 781 - 783: 19(fvec3) VectorShuffle 782 782 0 1 2 - 784: 19(fvec3) Load 263(pos) - 785: 19(fvec3) FSub 783 784 - Store 770(c) 785 - 787: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 788 788 12 12 - 786: 19(fvec3) Load 740(a) - 789: 19(fvec3) Load 753(b) - 790: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 786 789 - 791: 19(fvec3) Load 753(b) - 792: 19(fvec3) Load 770(c) - 793: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 791 792 - 794: 19(fvec3) FAdd 790 793 - 795: 19(fvec3) Load 716(normal) - 796: 19(fvec3) FAdd 795 794 - Store 716(normal) 796 - Branch 737 - 737: Label - 798: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 729 - 799: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 800 800 12 12 - 797: 139(ptr) AccessChain 127(id) 12 - 801: 7(int) Load 797 - 802: 150(ptr) AccessChain 101(params) 149 12 - 803: 73(int) Load 802 - 804: 73(int) ISub 803 242 - 805: 7(int) Bitcast 804 - 806: 168(bool) ULessThan 801 805 - SelectionMerge 808 None - BranchConditional 806 807 808 - 807: Label - 812: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 809 - 813: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 810 810 12 12 - 811: 7(int) Load 141(index) - 814: 150(ptr) AccessChain 101(params) 149 12 - 815: 73(int) Load 814 - 816: 7(int) Bitcast 815 - 817: 7(int) ISub 811 816 - 818: 234(ptr) AccessChain 201 204 817 204 - 819: 71(fvec4) Load 818 - 820: 19(fvec3) VectorShuffle 819 819 0 1 2 - 821: 19(fvec3) Load 263(pos) - 822: 19(fvec3) FSub 820 821 - Store 740(a) 822 - 824: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 825 825 12 12 - 823: 7(int) Load 141(index) - 826: 150(ptr) AccessChain 101(params) 149 12 - 827: 73(int) Load 826 - 828: 7(int) Bitcast 827 - 829: 7(int) ISub 823 828 - 830: 7(int) IAdd 829 39 - 831: 234(ptr) AccessChain 201 204 830 204 - 832: 71(fvec4) Load 831 - 833: 19(fvec3) VectorShuffle 832 832 0 1 2 - 834: 19(fvec3) Load 263(pos) - 835: 19(fvec3) FSub 833 834 - Store 753(b) 835 - 837: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 838 838 12 12 - 836: 7(int) Load 141(index) - 839: 7(int) IAdd 836 39 - 840: 234(ptr) AccessChain 201 204 839 204 - 841: 71(fvec4) Load 840 - 842: 19(fvec3) VectorShuffle 841 841 0 1 2 - 843: 19(fvec3) Load 263(pos) - 844: 19(fvec3) FSub 842 843 - Store 770(c) 844 - 846: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 847 847 12 12 - 845: 19(fvec3) Load 740(a) - 848: 19(fvec3) Load 753(b) - 849: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 845 848 - 850: 19(fvec3) Load 753(b) - 851: 19(fvec3) Load 770(c) - 852: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 850 851 - 853: 19(fvec3) FAdd 849 852 - 854: 19(fvec3) Load 716(normal) - 855: 19(fvec3) FAdd 854 853 - Store 716(normal) 855 - Branch 808 - 808: Label - Branch 728 - 728: Label - 857: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 713 - 858: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 859 859 12 12 - 856: 139(ptr) AccessChain 127(id) 39 - 860: 7(int) Load 856 - 861: 150(ptr) AccessChain 101(params) 149 39 - 862: 73(int) Load 861 - 863: 73(int) ISub 862 242 - 864: 7(int) Bitcast 863 - 865: 168(bool) ULessThan 860 864 - SelectionMerge 867 None - BranchConditional 865 866 867 - 866: Label - 871: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 868 - 872: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 869 869 12 12 - 870: 139(ptr) AccessChain 127(id) 12 - 873: 7(int) Load 870 - 874: 168(bool) UGreaterThan 873 12 - SelectionMerge 876 None - BranchConditional 874 875 876 - 875: Label - 880: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 877 - 881: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 878 878 12 12 - 879: 7(int) Load 141(index) - 882: 150(ptr) AccessChain 101(params) 149 12 - 883: 73(int) Load 882 - 884: 7(int) Bitcast 883 - 885: 7(int) IAdd 879 884 - 886: 234(ptr) AccessChain 201 204 885 204 - 887: 71(fvec4) Load 886 - 888: 19(fvec3) VectorShuffle 887 887 0 1 2 - 889: 19(fvec3) Load 263(pos) - 890: 19(fvec3) FSub 888 889 - Store 740(a) 890 - 892: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 893 893 12 12 - 891: 7(int) Load 141(index) - 894: 150(ptr) AccessChain 101(params) 149 12 - 895: 73(int) Load 894 - 896: 7(int) Bitcast 895 - 897: 7(int) IAdd 891 896 - 898: 7(int) ISub 897 39 - 899: 234(ptr) AccessChain 201 204 898 204 - 900: 71(fvec4) Load 899 - 901: 19(fvec3) VectorShuffle 900 900 0 1 2 - 902: 19(fvec3) Load 263(pos) - 903: 19(fvec3) FSub 901 902 - Store 753(b) 903 - 905: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 906 906 12 12 - 904: 7(int) Load 141(index) - 907: 7(int) ISub 904 39 - 908: 234(ptr) AccessChain 201 204 907 204 - 909: 71(fvec4) Load 908 - 910: 19(fvec3) VectorShuffle 909 909 0 1 2 - 911: 19(fvec3) Load 263(pos) - 912: 19(fvec3) FSub 910 911 - Store 770(c) 912 - 914: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 915 915 12 12 - 913: 19(fvec3) Load 740(a) - 916: 19(fvec3) Load 753(b) - 917: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 913 916 - 918: 19(fvec3) Load 753(b) - 919: 19(fvec3) Load 770(c) - 920: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 918 919 - 921: 19(fvec3) FAdd 917 920 - 922: 19(fvec3) Load 716(normal) - 923: 19(fvec3) FAdd 922 921 - Store 716(normal) 923 - Branch 876 - 876: Label - 925: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 868 - 926: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 927 927 12 12 - 924: 139(ptr) AccessChain 127(id) 12 - 928: 7(int) Load 924 - 929: 150(ptr) AccessChain 101(params) 149 12 - 930: 73(int) Load 929 - 931: 73(int) ISub 930 242 - 932: 7(int) Bitcast 931 - 933: 168(bool) ULessThan 928 932 - SelectionMerge 935 None - BranchConditional 933 934 935 - 934: Label - 939: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 936 - 940: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 937 937 12 12 - 938: 7(int) Load 141(index) - 941: 7(int) IAdd 938 39 - 942: 234(ptr) AccessChain 201 204 941 204 - 943: 71(fvec4) Load 942 - 944: 19(fvec3) VectorShuffle 943 943 0 1 2 - 945: 19(fvec3) Load 263(pos) - 946: 19(fvec3) FSub 944 945 - Store 740(a) 946 - 948: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 949 949 12 12 - 947: 7(int) Load 141(index) - 950: 150(ptr) AccessChain 101(params) 149 12 - 951: 73(int) Load 950 - 952: 7(int) Bitcast 951 - 953: 7(int) IAdd 947 952 - 954: 7(int) IAdd 953 39 - 955: 234(ptr) AccessChain 201 204 954 204 - 956: 71(fvec4) Load 955 - 957: 19(fvec3) VectorShuffle 956 956 0 1 2 - 958: 19(fvec3) Load 263(pos) - 959: 19(fvec3) FSub 957 958 - Store 753(b) 959 - 961: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 962 962 12 12 - 960: 7(int) Load 141(index) - 963: 150(ptr) AccessChain 101(params) 149 12 - 964: 73(int) Load 963 - 965: 7(int) Bitcast 964 - 966: 7(int) IAdd 960 965 - 967: 234(ptr) AccessChain 201 204 966 204 - 968: 71(fvec4) Load 967 - 969: 19(fvec3) VectorShuffle 968 968 0 1 2 - 970: 19(fvec3) Load 263(pos) - 971: 19(fvec3) FSub 969 970 - Store 770(c) 971 - 973: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 974 974 12 12 - 972: 19(fvec3) Load 740(a) - 975: 19(fvec3) Load 753(b) - 976: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 972 975 - 977: 19(fvec3) Load 753(b) - 978: 19(fvec3) Load 770(c) - 979: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 977 978 - 980: 19(fvec3) FAdd 976 979 - 981: 19(fvec3) Load 716(normal) - 982: 19(fvec3) FAdd 981 980 - Store 716(normal) 982 - Branch 935 - 935: Label - Branch 867 - 867: Label - 984: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 713 - 985: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 986 986 12 12 - 983: 7(int) Load 141(index) - 987: 19(fvec3) Load 716(normal) - 988: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 987 - 989: 16(float) CompositeExtract 988 0 - 990: 16(float) CompositeExtract 988 1 - 991: 16(float) CompositeExtract 988 2 - 992: 71(fvec4) CompositeConstruct 989 990 991 243 - 993: 234(ptr) AccessChain 228 204 983 579 - Store 993 992 - Branch 712 - 712: Label - 994: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 995: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 996 996 12 12 + 722: 7(int) Load 216(index) + 725: 272(ptr) AccessChain 103 253 722 280 + Store 725 282 + Branch 700 + 700: Label + 729: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 730: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 731 731 12 12 + 728: 726(ptr) AccessChain 162(pushConsts) 253 + 732: 7(int) Load 728 + 733: 243(bool) IEqual 732 39 + SelectionMerge 735 None + BranchConditional 733 734 735 + 734: Label + 741: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 736 + 742: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 737 737 12 12 + 740: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 739 738(normal) 45 + Store 738(normal) 743 + 749: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 747 747 12 12 + 748: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 745 744(a) 45 + 753: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 751 750(b) 45 + 757: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 755 754(c) 45 + 759: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 760 760 12 12 + 758: 214(ptr) AccessChain 202(id) 39 + 761: 7(int) Load 758 + 762: 243(bool) UGreaterThan 761 12 + SelectionMerge 764 None + BranchConditional 762 763 764 + 763: Label + 768: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 765 + 769: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 766 766 12 12 + 767: 214(ptr) AccessChain 202(id) 12 + 770: 7(int) Load 767 + 771: 243(bool) UGreaterThan 770 12 + SelectionMerge 773 None + BranchConditional 771 772 773 + 772: Label + 777: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 774 + 778: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 775 775 12 12 + 776: 7(int) Load 216(index) + 779: 7(int) ISub 776 39 + 780: 272(ptr) AccessChain 89 253 779 253 + 781: 57(fvec4) Load 780 + 782: 19(fvec3) VectorShuffle 781 781 0 1 2 + 783: 19(fvec3) Load 301(pos) + 784: 19(fvec3) FSub 782 783 + Store 744(a) 784 + 786: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 787 787 12 12 + 785: 7(int) Load 216(index) + 788: 225(ptr) AccessChain 149(params) 224 12 + 789: 105(int) Load 788 + 790: 7(int) Bitcast 789 + 791: 7(int) ISub 785 790 + 792: 7(int) ISub 791 39 + 793: 272(ptr) AccessChain 89 253 792 253 + 794: 57(fvec4) Load 793 + 795: 19(fvec3) VectorShuffle 794 794 0 1 2 + 796: 19(fvec3) Load 301(pos) + 797: 19(fvec3) FSub 795 796 + Store 750(b) 797 + 799: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 800 800 12 12 + 798: 7(int) Load 216(index) + 801: 225(ptr) AccessChain 149(params) 224 12 + 802: 105(int) Load 801 + 803: 7(int) Bitcast 802 + 804: 7(int) ISub 798 803 + 805: 272(ptr) AccessChain 89 253 804 253 + 806: 57(fvec4) Load 805 + 807: 19(fvec3) VectorShuffle 806 806 0 1 2 + 808: 19(fvec3) Load 301(pos) + 809: 19(fvec3) FSub 807 808 + Store 754(c) 809 + 811: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 812 812 12 12 + 810: 19(fvec3) Load 744(a) + 813: 19(fvec3) Load 750(b) + 814: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 810 813 + 815: 19(fvec3) Load 750(b) + 816: 19(fvec3) Load 754(c) + 817: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 815 816 + 818: 19(fvec3) FAdd 814 817 + 819: 19(fvec3) Load 738(normal) + 820: 19(fvec3) FAdd 819 818 + Store 738(normal) 820 + Branch 773 + 773: Label + 822: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 765 + 823: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 824 824 12 12 + 821: 214(ptr) AccessChain 202(id) 12 + 825: 7(int) Load 821 + 826: 225(ptr) AccessChain 149(params) 224 12 + 827: 105(int) Load 826 + 828: 105(int) ISub 827 280 + 829: 7(int) Bitcast 828 + 830: 243(bool) ULessThan 825 829 + SelectionMerge 832 None + BranchConditional 830 831 832 + 831: Label + 836: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 833 + 837: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 834 834 12 12 + 835: 7(int) Load 216(index) + 838: 225(ptr) AccessChain 149(params) 224 12 + 839: 105(int) Load 838 + 840: 7(int) Bitcast 839 + 841: 7(int) ISub 835 840 + 842: 272(ptr) AccessChain 89 253 841 253 + 843: 57(fvec4) Load 842 + 844: 19(fvec3) VectorShuffle 843 843 0 1 2 + 845: 19(fvec3) Load 301(pos) + 846: 19(fvec3) FSub 844 845 + Store 744(a) 846 + 848: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 849 849 12 12 + 847: 7(int) Load 216(index) + 850: 225(ptr) AccessChain 149(params) 224 12 + 851: 105(int) Load 850 + 852: 7(int) Bitcast 851 + 853: 7(int) ISub 847 852 + 854: 7(int) IAdd 853 39 + 855: 272(ptr) AccessChain 89 253 854 253 + 856: 57(fvec4) Load 855 + 857: 19(fvec3) VectorShuffle 856 856 0 1 2 + 858: 19(fvec3) Load 301(pos) + 859: 19(fvec3) FSub 857 858 + Store 750(b) 859 + 861: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 862 862 12 12 + 860: 7(int) Load 216(index) + 863: 7(int) IAdd 860 39 + 864: 272(ptr) AccessChain 89 253 863 253 + 865: 57(fvec4) Load 864 + 866: 19(fvec3) VectorShuffle 865 865 0 1 2 + 867: 19(fvec3) Load 301(pos) + 868: 19(fvec3) FSub 866 867 + Store 754(c) 868 + 870: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 871 871 12 12 + 869: 19(fvec3) Load 744(a) + 872: 19(fvec3) Load 750(b) + 873: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 869 872 + 874: 19(fvec3) Load 750(b) + 875: 19(fvec3) Load 754(c) + 876: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 874 875 + 877: 19(fvec3) FAdd 873 876 + 878: 19(fvec3) Load 738(normal) + 879: 19(fvec3) FAdd 878 877 + Store 738(normal) 879 + Branch 832 + 832: Label + Branch 764 + 764: Label + 881: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 736 + 882: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 883 883 12 12 + 880: 214(ptr) AccessChain 202(id) 39 + 884: 7(int) Load 880 + 885: 225(ptr) AccessChain 149(params) 224 39 + 886: 105(int) Load 885 + 887: 105(int) ISub 886 280 + 888: 7(int) Bitcast 887 + 889: 243(bool) ULessThan 884 888 + SelectionMerge 891 None + BranchConditional 889 890 891 + 890: Label + 895: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 892 + 896: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 893 893 12 12 + 894: 214(ptr) AccessChain 202(id) 12 + 897: 7(int) Load 894 + 898: 243(bool) UGreaterThan 897 12 + SelectionMerge 900 None + BranchConditional 898 899 900 + 899: Label + 904: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 901 + 905: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 902 902 12 12 + 903: 7(int) Load 216(index) + 906: 225(ptr) AccessChain 149(params) 224 12 + 907: 105(int) Load 906 + 908: 7(int) Bitcast 907 + 909: 7(int) IAdd 903 908 + 910: 272(ptr) AccessChain 89 253 909 253 + 911: 57(fvec4) Load 910 + 912: 19(fvec3) VectorShuffle 911 911 0 1 2 + 913: 19(fvec3) Load 301(pos) + 914: 19(fvec3) FSub 912 913 + Store 744(a) 914 + 916: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 917 917 12 12 + 915: 7(int) Load 216(index) + 918: 225(ptr) AccessChain 149(params) 224 12 + 919: 105(int) Load 918 + 920: 7(int) Bitcast 919 + 921: 7(int) IAdd 915 920 + 922: 7(int) ISub 921 39 + 923: 272(ptr) AccessChain 89 253 922 253 + 924: 57(fvec4) Load 923 + 925: 19(fvec3) VectorShuffle 924 924 0 1 2 + 926: 19(fvec3) Load 301(pos) + 927: 19(fvec3) FSub 925 926 + Store 750(b) 927 + 929: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 930 930 12 12 + 928: 7(int) Load 216(index) + 931: 7(int) ISub 928 39 + 932: 272(ptr) AccessChain 89 253 931 253 + 933: 57(fvec4) Load 932 + 934: 19(fvec3) VectorShuffle 933 933 0 1 2 + 935: 19(fvec3) Load 301(pos) + 936: 19(fvec3) FSub 934 935 + Store 754(c) 936 + 938: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 939 939 12 12 + 937: 19(fvec3) Load 744(a) + 940: 19(fvec3) Load 750(b) + 941: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 937 940 + 942: 19(fvec3) Load 750(b) + 943: 19(fvec3) Load 754(c) + 944: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 942 943 + 945: 19(fvec3) FAdd 941 944 + 946: 19(fvec3) Load 738(normal) + 947: 19(fvec3) FAdd 946 945 + Store 738(normal) 947 + Branch 900 + 900: Label + 949: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 892 + 950: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 951 951 12 12 + 948: 214(ptr) AccessChain 202(id) 12 + 952: 7(int) Load 948 + 953: 225(ptr) AccessChain 149(params) 224 12 + 954: 105(int) Load 953 + 955: 105(int) ISub 954 280 + 956: 7(int) Bitcast 955 + 957: 243(bool) ULessThan 952 956 + SelectionMerge 959 None + BranchConditional 957 958 959 + 958: Label + 963: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 960 + 964: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 961 961 12 12 + 962: 7(int) Load 216(index) + 965: 7(int) IAdd 962 39 + 966: 272(ptr) AccessChain 89 253 965 253 + 967: 57(fvec4) Load 966 + 968: 19(fvec3) VectorShuffle 967 967 0 1 2 + 969: 19(fvec3) Load 301(pos) + 970: 19(fvec3) FSub 968 969 + Store 744(a) 970 + 972: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 973 973 12 12 + 971: 7(int) Load 216(index) + 974: 225(ptr) AccessChain 149(params) 224 12 + 975: 105(int) Load 974 + 976: 7(int) Bitcast 975 + 977: 7(int) IAdd 971 976 + 978: 7(int) IAdd 977 39 + 979: 272(ptr) AccessChain 89 253 978 253 + 980: 57(fvec4) Load 979 + 981: 19(fvec3) VectorShuffle 980 980 0 1 2 + 982: 19(fvec3) Load 301(pos) + 983: 19(fvec3) FSub 981 982 + Store 750(b) 983 + 985: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 986 986 12 12 + 984: 7(int) Load 216(index) + 987: 225(ptr) AccessChain 149(params) 224 12 + 988: 105(int) Load 987 + 989: 7(int) Bitcast 988 + 990: 7(int) IAdd 984 989 + 991: 272(ptr) AccessChain 89 253 990 253 + 992: 57(fvec4) Load 991 + 993: 19(fvec3) VectorShuffle 992 992 0 1 2 + 994: 19(fvec3) Load 301(pos) + 995: 19(fvec3) FSub 993 994 + Store 754(c) 995 + 997: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 998 998 12 12 + 996: 19(fvec3) Load 744(a) + 999: 19(fvec3) Load 750(b) + 1000: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 996 999 + 1001: 19(fvec3) Load 750(b) + 1002: 19(fvec3) Load 754(c) + 1003: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 1001 1002 + 1004: 19(fvec3) FAdd 1000 1003 + 1005: 19(fvec3) Load 738(normal) + 1006: 19(fvec3) FAdd 1005 1004 + Store 738(normal) 1006 + Branch 959 + 959: Label + Branch 891 + 891: Label + 1008: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 736 + 1009: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 1010 1010 12 12 + 1007: 7(int) Load 216(index) + 1011: 19(fvec3) Load 738(normal) + 1012: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 1011 + 1013: 16(float) CompositeExtract 1012 0 + 1014: 16(float) CompositeExtract 1012 1 + 1015: 16(float) CompositeExtract 1012 2 + 1016: 57(fvec4) CompositeConstruct 1013 1014 1015 281 + 1017: 272(ptr) AccessChain 103 253 1007 614 + Store 1017 1016 + Branch 735 + 735: Label + 1018: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 1019: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 1020 1020 12 12 Return FunctionEnd 31(springForce(vf3;vf3;f1;): 19(fvec3) Function None 26 @@ -1398,29 +1424,29 @@ void main() 29(p1): 21(ptr) FunctionParameter 30(restDist): 24(ptr) FunctionParameter 32: Label - 58(dist): 21(ptr) Variable Function + 166(dist): 21(ptr) Variable Function 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 37 37 12 12 44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 42 28(p0) 45 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 48 29(p1) 45 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 51 30(restDist) 45 - 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 34 31(springForce(vf3;vf3;f1;) - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 61 61 12 12 - 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 59 58(dist) 45 - 64: 19(fvec3) Load 28(p0) - 65: 19(fvec3) Load 29(p1) - 66: 19(fvec3) FSub 64 65 - Store 58(dist) 66 - 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 69 69 12 12 - 67: 19(fvec3) Load 58(dist) - 70: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 67 - 107: 105(ptr) AccessChain 101(params) 104 - 108: 16(float) Load 107 - 109: 19(fvec3) VectorTimesScalar 70 108 - 110: 19(fvec3) Load 58(dist) - 111: 16(float) ExtInst 3(GLSL.std.450) 66(Length) 110 - 112: 16(float) Load 30(restDist) - 113: 16(float) FSub 111 112 - 114: 19(fvec3) VectorTimesScalar 109 113 - ReturnValue 114 + 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 34 31(springForce(vf3;vf3;f1;) + 171: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 169 169 12 12 + 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 167 166(dist) 45 + 172: 19(fvec3) Load 28(p0) + 173: 19(fvec3) Load 29(p1) + 174: 19(fvec3) FSub 172 173 + Store 166(dist) 174 + 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 177 177 12 12 + 175: 19(fvec3) Load 166(dist) + 178: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 175 + 182: 180(ptr) AccessChain 149(params) 179 + 183: 16(float) Load 182 + 184: 19(fvec3) VectorTimesScalar 178 183 + 185: 19(fvec3) Load 166(dist) + 186: 16(float) ExtInst 3(GLSL.std.450) 66(Length) 185 + 187: 16(float) Load 30(restDist) + 188: 16(float) FSub 186 187 + 189: 19(fvec3) VectorTimesScalar 184 188 + ReturnValue 189 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.frag.out index 387041da84..5eb00d21c2 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.frag.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.frag.out @@ -1,7 +1,7 @@ spv.debuginfo.glsl.frag // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 886 +// Id's are bound by 913 Capability Shader Capability ImageQuery @@ -9,7 +9,7 @@ spv.debuginfo.glsl.frag 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 14 "main" 503 557 + EntryPoint Fragment 14 "main" 138 143 ExecutionMode 14 OriginUpperLeft 2: String "spv.debuginfo.glsl.frag" 8: String "uint" @@ -226,57 +226,65 @@ void main() 88: String "fragcolor" 93: String "fragpos" 95: String "main" - 99: String "int" - 105: String "global_var" - 120: String "shadowCoord" - 142: String "bool" - 167: String "dist" - 173: String "type.2d.image" - 174: String "@type.2d.image" - 178: String "type.sampled.image" - 179: String "@type.sampled.image" - 184: String "samplerShadowMap" - 237: String "texDim" - 249: String "scale" - 256: String "dx" - 270: String "dy" - 282: String "shadowFactor" - 288: String "count" - 294: String "range" - 301: String "x" - 321: String "y" - 387: String "i" - 405: String "shadowClip" - 415: String "color" - 420: String "viewMatrix" - 423: String "Light" - 429: String "lights" - 432: String "debugDisplayTarget" - 436: String "UBO" - 441: String "ubo" - 487: String "fragPos" - 499: String "samplerposition" - 505: String "inUV" - 511: String "normal" - 517: String "samplerNormal" - 524: String "albedo" - 530: String "samplerAlbedo" - 559: String "outFragColor" - 653: String "N" - 677: String "L" - 703: String "V" - 718: String "lightCosInnerAngle" - 725: String "lightCosOuterAngle" - 732: String "lightRange" - 739: String "dir" - 755: String "cosDir" - 764: String "spotEffect" - 774: String "heightAttenuation" - 783: String "NdotL" - 793: String "diff" - 801: String "R" - 811: String "NdotR" - 821: String "spec" + 100: String "texture2D" + 102: String "@texture2D" + 106: String "sampler2D" + 107: String "@sampler2D" + 112: String "samplerposition" + 116: String "samplerNormal" + 120: String "samplerAlbedo" + 124: String "texture2DArray" + 126: String "@texture2DArray" + 129: String "sampler2DArray" + 130: String "@sampler2DArray" + 135: String "samplerShadowMap" + 140: String "inUV" + 145: String "outFragColor" + 148: String "int" + 154: String "global_var" + 162: String "bool" + 167: String "position" + 170: String "target" + 173: String "color" + 176: String "viewMatrix" + 179: String "Light" + 185: String "viewPos" + 188: String "lights" + 191: String "useShadows" + 194: String "debugDisplayTarget" + 197: String "UBO" + 202: String "ubo" + 212: String "shadowCoord" + 256: String "dist" + 312: String "texDim" + 324: String "scale" + 331: String "dx" + 345: String "dy" + 357: String "shadowFactor" + 363: String "count" + 369: String "range" + 378: String "x" + 400: String "y" + 467: String "i" + 485: String "shadowClip" + 537: String "fragPos" + 547: String "normal" + 557: String "albedo" + 678: String "N" + 704: String "L" + 730: String "V" + 745: String "lightCosInnerAngle" + 752: String "lightCosOuterAngle" + 759: String "lightRange" + 766: String "dir" + 782: String "cosDir" + 791: String "spotEffect" + 801: String "heightAttenuation" + 810: String "NdotL" + 820: String "diff" + 828: String "R" + 838: String "NdotR" + 848: String "spec" Name 14 "main" Name 37 "textureProj(vf4;f1;vf2;" Name 34 "P" @@ -288,93 +296,93 @@ void main() Name 82 "shadow(vf3;vf3;" Name 80 "fragcolor" Name 81 "fragpos" - Name 103 "global_var" - Name 112 "shadow" - Name 118 "shadowCoord" - Name 165 "dist" - Name 182 "samplerShadowMap" - Name 235 "texDim" - Name 247 "scale" - Name 254 "dx" - Name 268 "dy" - Name 280 "shadowFactor" - Name 286 "count" - Name 292 "range" - Name 299 "x" - Name 319 "y" - Name 352 "param" - Name 354 "param" - Name 356 "param" - Name 385 "i" - Name 403 "shadowClip" - Name 413 "Light" - MemberName 413(Light) 0 "position" - MemberName 413(Light) 1 "target" - MemberName 413(Light) 2 "color" - MemberName 413(Light) 3 "viewMatrix" - Name 426 "UBO" - MemberName 426(UBO) 0 "viewPos" - MemberName 426(UBO) 1 "lights" - MemberName 426(UBO) 2 "useShadows" - MemberName 426(UBO) 3 "debugDisplayTarget" - Name 439 "ubo" - Name 453 "shadowFactor" - Name 460 "param" - Name 462 "param" - Name 485 "fragPos" - Name 497 "samplerposition" - Name 503 "inUV" - Name 509 "normal" - Name 515 "samplerNormal" - Name 522 "albedo" - Name 528 "samplerAlbedo" - Name 557 "outFragColor" - Name 562 "param" - Name 565 "param" - Name 641 "fragcolor" - Name 651 "N" - Name 659 "i" - Name 675 "L" - Name 690 "dist" - Name 701 "V" - Name 716 "lightCosInnerAngle" - Name 723 "lightCosOuterAngle" - Name 730 "lightRange" - Name 737 "dir" - Name 753 "cosDir" - Name 762 "spotEffect" - Name 772 "heightAttenuation" - Name 781 "NdotL" - Name 791 "diff" - Name 799 "R" - Name 809 "NdotR" - Name 819 "spec" - Name 869 "param" - Name 873 "param" - Decorate 182(samplerShadowMap) Binding 5 - Decorate 182(samplerShadowMap) DescriptorSet 0 - MemberDecorate 413(Light) 0 Offset 0 - MemberDecorate 413(Light) 1 Offset 16 - MemberDecorate 413(Light) 2 Offset 32 - MemberDecorate 413(Light) 3 ColMajor - MemberDecorate 413(Light) 3 MatrixStride 16 - MemberDecorate 413(Light) 3 Offset 48 - Decorate 424 ArrayStride 112 - Decorate 426(UBO) Block - MemberDecorate 426(UBO) 0 Offset 0 - MemberDecorate 426(UBO) 1 Offset 16 - MemberDecorate 426(UBO) 2 Offset 352 - MemberDecorate 426(UBO) 3 Offset 356 - Decorate 439(ubo) Binding 4 - Decorate 439(ubo) DescriptorSet 0 - Decorate 497(samplerposition) Binding 1 - Decorate 497(samplerposition) DescriptorSet 0 - Decorate 503(inUV) Location 0 - Decorate 515(samplerNormal) Binding 2 - Decorate 515(samplerNormal) DescriptorSet 0 - Decorate 528(samplerAlbedo) Binding 3 - Decorate 528(samplerAlbedo) DescriptorSet 0 - Decorate 557(outFragColor) Location 0 + Name 110 "samplerposition" + Name 114 "samplerNormal" + Name 118 "samplerAlbedo" + Name 133 "samplerShadowMap" + Name 138 "inUV" + Name 143 "outFragColor" + Name 152 "global_var" + Name 165 "Light" + MemberName 165(Light) 0 "position" + MemberName 165(Light) 1 "target" + MemberName 165(Light) 2 "color" + MemberName 165(Light) 3 "viewMatrix" + Name 183 "UBO" + MemberName 183(UBO) 0 "viewPos" + MemberName 183(UBO) 1 "lights" + MemberName 183(UBO) 2 "useShadows" + MemberName 183(UBO) 3 "debugDisplayTarget" + Name 200 "ubo" + Name 204 "shadow" + Name 210 "shadowCoord" + Name 254 "dist" + Name 310 "texDim" + Name 322 "scale" + Name 329 "dx" + Name 343 "dy" + Name 355 "shadowFactor" + Name 361 "count" + Name 367 "range" + Name 376 "x" + Name 398 "y" + Name 430 "param" + Name 432 "param" + Name 434 "param" + Name 465 "i" + Name 483 "shadowClip" + Name 501 "shadowFactor" + Name 510 "param" + Name 512 "param" + Name 535 "fragPos" + Name 545 "normal" + Name 555 "albedo" + Name 586 "param" + Name 590 "param" + Name 666 "fragcolor" + Name 676 "N" + Name 686 "i" + Name 702 "L" + Name 717 "dist" + Name 728 "V" + Name 743 "lightCosInnerAngle" + Name 750 "lightCosOuterAngle" + Name 757 "lightRange" + Name 764 "dir" + Name 780 "cosDir" + Name 789 "spotEffect" + Name 799 "heightAttenuation" + Name 808 "NdotL" + Name 818 "diff" + Name 826 "R" + Name 836 "NdotR" + Name 846 "spec" + Name 896 "param" + Name 900 "param" + Decorate 110(samplerposition) Binding 1 + Decorate 110(samplerposition) DescriptorSet 0 + Decorate 114(samplerNormal) Binding 2 + Decorate 114(samplerNormal) DescriptorSet 0 + Decorate 118(samplerAlbedo) Binding 3 + Decorate 118(samplerAlbedo) DescriptorSet 0 + Decorate 133(samplerShadowMap) Binding 5 + Decorate 133(samplerShadowMap) DescriptorSet 0 + Decorate 138(inUV) Location 0 + Decorate 143(outFragColor) Location 0 + MemberDecorate 165(Light) 0 Offset 0 + MemberDecorate 165(Light) 1 Offset 16 + MemberDecorate 165(Light) 2 Offset 32 + MemberDecorate 165(Light) 3 ColMajor + MemberDecorate 165(Light) 3 MatrixStride 16 + MemberDecorate 165(Light) 3 Offset 48 + Decorate 181 ArrayStride 112 + Decorate 183(UBO) Block + MemberDecorate 183(UBO) 0 Offset 0 + MemberDecorate 183(UBO) 1 Offset 16 + MemberDecorate 183(UBO) 2 Offset 352 + MemberDecorate 183(UBO) 3 Offset 356 + Decorate 200(ubo) Binding 4 + Decorate 200(ubo) DescriptorSet 0 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -428,566 +436,582 @@ void main() 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 93 75 41 86 12 85 20 28 97: 7(int) Constant 116 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 95 6 41 97 12 44 95 13 97 - 98: TypeInt 32 1 - 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 99 10 20 12 - 101: TypePointer Private 98(int) - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 100 11 12 - 103(global_var): 101(ptr) Variable Private - 106: 7(int) Constant 41 - 107: 7(int) Constant 8 - 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 105 100 41 106 12 44 105 103(global_var) 107 - 108: 98(int) Constant 0 - 114: 7(int) Constant 61 - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 84 18 41 114 12 40 20 - 117: 16(float) Constant 1065353216 - 121: 7(int) Constant 62 - 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 120 21 41 121 12 40 20 - 131: 7(int) Constant 63 - 133: 16(float) Constant 1056964608 - 141: TypeBool - 143: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 142 10 28 12 - 146: 7(int) Constant 65 - 148: 16(float) Constant 3212836864 - 163: 7(int) Constant 67 - 164: 7(int) Constant 14 - 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 163 164 40 - 166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 167 18 41 163 12 162 20 - 171: TypeImage 16(float) 2D array sampled format:Unknown - 175: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) - 172: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 173 12 41 163 12 44 174 175 13 - 176: TypeSampledImage 171 - 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 178 12 41 163 12 44 179 175 13 - 180: TypePointer UniformConstant 176 - 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 177 12 12 -182(samplerShadowMap): 180(ptr) Variable UniformConstant - 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 184 177 41 163 12 44 184 182(samplerShadowMap) 107 - 198: 7(int) Constant 68 - 200: 16(float) Constant 0 - 216: 7(int) Constant 70 - 217: 7(int) Constant 11 - 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 216 217 162 - 218: 16(float) Constant 1048576000 - 224: 7(int) Constant 73 - 229: 7(int) Constant 74 - 231: TypeVector 98(int) 2 - 232: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 100 28 - 233: TypePointer Function 231(ivec2) - 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 232 23 12 - 238: 7(int) Constant 78 - 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 237 232 41 238 12 65 20 - 243: TypeVector 98(int) 3 - 244: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 100 13 - 250: 7(int) Constant 79 - 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 249 18 41 250 12 65 20 - 253: 16(float) Constant 1069547520 - 257: 7(int) Constant 80 - 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 256 18 41 257 12 65 20 - 262: TypePointer Function 98(int) - 263: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 100 23 12 - 271: 7(int) Constant 81 - 269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 270 18 41 271 12 65 20 - 283: 7(int) Constant 83 - 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 282 18 41 283 12 65 20 - 289: 7(int) Constant 84 - 287: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 288 100 41 289 12 65 20 - 295: 7(int) Constant 85 - 293: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 294 100 41 295 12 65 20 - 298: 98(int) Constant 1 - 302: 7(int) Constant 87 - 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 301 100 41 302 12 65 20 - 322: 7(int) Constant 89 - 320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 321 100 41 322 12 65 20 - 343: 7(int) Constant 91 - 362: 7(int) Constant 92 - 375: 7(int) Constant 96 - 383: 7(int) Constant 97 - 388: 7(int) Constant 100 - 386: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 387 100 41 388 12 85 20 - 401: 98(int) Constant 3 - 406: 7(int) Constant 102 - 404: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 405 21 41 406 12 85 20 - 410: TypeMatrix 19(fvec4) 4 - 412: 141(bool) ConstantTrue - 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 21 20 412 - 413(Light): TypeStruct 19(fvec4) 19(fvec4) 19(fvec4) 410 - 416: 7(int) Constant 47 - 414: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 415 21 41 416 23 12 12 13 - 417: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 415 21 41 416 23 12 12 13 - 418: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 415 21 41 416 23 12 12 13 - 421: 7(int) Constant 48 - 419: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 420 411 41 421 23 12 12 13 - 422: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 423 45 41 406 12 44 423 12 13 414 417 418 419 - 424: TypeArray 413(Light) 13 - 425: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 422 13 - 426(UBO): TypeStruct 19(fvec4) 424 98(int) 98(int) - 427: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 415 21 41 416 23 12 12 13 - 430: 7(int) Constant 54 - 428: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 429 425 41 430 107 12 12 13 - 433: 7(int) Constant 56 - 431: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 432 100 41 433 11 12 12 13 - 434: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 432 100 41 433 11 12 12 13 - 435: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 436 45 41 406 12 44 436 12 13 427 428 431 434 - 437: TypePointer Uniform 426(UBO) - 438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 435 28 12 - 439(ubo): 437(ptr) Variable Uniform - 440: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 441 435 41 406 12 44 441 439(ubo) 107 - 443: TypePointer Uniform 410 - 444: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 411 28 12 - 455: 7(int) Constant 106 - 454: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 282 18 41 455 12 85 20 - 466: 7(int) Constant 111 - 476: 7(int) Constant 113 - 481: 7(int) Constant 114 - 488: 7(int) Constant 119 - 486: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 487 75 41 488 12 96 20 - 491: TypeImage 16(float) 2D sampled format:Unknown - 492: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 173 12 41 488 12 44 174 175 13 - 493: TypeSampledImage 491 - 494: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 178 12 41 488 12 44 179 175 13 - 495: TypePointer UniformConstant 493 - 496: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 494 12 12 -497(samplerposition): 495(ptr) Variable UniformConstant - 498: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 499 494 41 488 12 44 499 497(samplerposition) 107 - 501: TypePointer Input 27(fvec2) - 502: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 45 12 - 503(inUV): 501(ptr) Variable Input - 504: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 505 29 41 488 12 44 505 503(inUV) 107 - 512: 7(int) Constant 120 - 510: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 511 75 41 512 12 96 20 -515(samplerNormal): 495(ptr) Variable UniformConstant - 516: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 517 494 41 512 12 44 517 515(samplerNormal) 107 - 525: 7(int) Constant 121 - 523: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 524 21 41 525 12 96 20 -528(samplerAlbedo): 495(ptr) Variable UniformConstant - 529: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 530 494 41 525 12 44 530 528(samplerAlbedo) 107 - 534: TypePointer Uniform 98(int) - 535: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 100 28 12 - 538: 7(int) Constant 124 - 544: 7(int) Constant 125 - 543: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 544 13 96 - 555: TypePointer Output 19(fvec4) - 556: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 13 12 -557(outFragColor): 555(ptr) Variable Output - 560: 7(int) Constant 127 - 558: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 559 21 41 560 12 44 559 557(outFragColor) 107 - 561: 74(fvec3) ConstantComposite 117 117 117 - 568: TypePointer Output 16(float) - 569: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 13 12 - 577: 7(int) Constant 128 - 582: 7(int) Constant 130 - 590: 7(int) Constant 131 - 595: 7(int) Constant 133 - 603: 7(int) Constant 134 - 608: 7(int) Constant 136 - 617: 7(int) Constant 137 - 622: 7(int) Constant 139 - 631: 7(int) Constant 140 - 637: 7(int) Constant 142 - 639: 7(int) Constant 143 - 643: 7(int) Constant 147 - 642: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 88 75 41 643 12 96 20 - 649: 16(float) Constant 1036831949 - 654: 7(int) Constant 149 - 652: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 653 75 41 654 12 96 20 - 661: 7(int) Constant 151 - 660: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 387 100 41 661 12 96 20 - 678: 7(int) Constant 154 - 676: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 677 75 41 678 12 96 20 - 683: TypePointer Uniform 19(fvec4) - 684: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 28 12 - 692: 7(int) Constant 156 - 691: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 167 18 41 692 12 96 20 - 699: 7(int) Constant 157 - 704: 7(int) Constant 160 - 702: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 703 75 41 704 12 96 20 - 714: 7(int) Constant 161 - 719: 7(int) Constant 163 - 717: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 718 18 41 719 12 96 20 - 722: 16(float) Constant 1064781546 - 726: 7(int) Constant 164 - 724: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 725 18 41 726 12 96 20 - 729: 16(float) Constant 1063781322 - 733: 7(int) Constant 165 - 731: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 732 18 41 733 12 96 20 - 736: 16(float) Constant 1120403456 - 740: 7(int) Constant 168 - 738: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 739 75 41 740 12 96 20 - 756: 7(int) Constant 171 - 754: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 755 18 41 756 12 96 20 - 765: 7(int) Constant 172 - 763: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 764 18 41 765 12 96 20 - 775: 7(int) Constant 173 - 773: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 774 18 41 775 12 96 20 - 784: 7(int) Constant 176 - 782: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 783 18 41 784 12 96 20 - 794: 7(int) Constant 177 - 792: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 793 75 41 794 12 96 20 - 802: 7(int) Constant 180 - 800: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 801 75 41 802 12 96 20 - 812: 7(int) Constant 181 - 810: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 811 18 41 812 12 96 20 - 822: 7(int) Constant 182 - 820: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 821 75 41 822 12 96 20 - 826: 16(float) Constant 1098907648 - 831: 16(float) Constant 1075838976 - 836: 7(int) Constant 184 - 844: 98(int) Constant 2 - 861: 7(int) Constant 188 - 867: 7(int) Constant 190 - 868: 7(int) Constant 13 - 866: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 867 868 96 - 879: 7(int) Constant 193 - 885: 7(int) Constant 194 + 98: TypeImage 16(float) 2D sampled format:Unknown + 101: 7(int) Constant 27 + 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 100 45 41 101 12 44 102 103 13 + 104: TypeSampledImage 98 + 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 106 45 41 101 12 44 107 103 13 + 108: TypePointer UniformConstant 104 + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 105 12 12 +110(samplerposition): 108(ptr) Variable UniformConstant + 113: 7(int) Constant 8 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 112 105 41 101 12 44 112 110(samplerposition) 113 +114(samplerNormal): 108(ptr) Variable UniformConstant + 117: 7(int) Constant 28 + 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 116 105 41 117 12 44 116 114(samplerNormal) 113 +118(samplerAlbedo): 108(ptr) Variable UniformConstant + 121: 7(int) Constant 29 + 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 120 105 41 121 12 44 120 118(samplerAlbedo) 113 + 122: TypeImage 16(float) 2D array sampled format:Unknown + 125: 7(int) Constant 30 + 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 124 45 41 125 12 44 126 103 13 + 127: TypeSampledImage 122 + 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 129 45 41 125 12 44 130 103 13 + 131: TypePointer UniformConstant 127 + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 128 12 12 +133(samplerShadowMap): 131(ptr) Variable UniformConstant + 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 135 128 41 125 12 44 135 133(samplerShadowMap) 113 + 136: TypePointer Input 27(fvec2) + 137: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 45 12 + 138(inUV): 136(ptr) Variable Input + 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 140 29 41 10 12 44 140 138(inUV) 113 + 141: TypePointer Output 19(fvec4) + 142: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 13 12 +143(outFragColor): 141(ptr) Variable Output + 146: 7(int) Constant 34 + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 145 21 41 146 12 44 145 143(outFragColor) 113 + 147: TypeInt 32 1 + 149: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 148 10 20 12 + 150: TypePointer Private 147(int) + 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 149 11 12 + 152(global_var): 150(ptr) Variable Private + 155: 7(int) Constant 41 + 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 154 149 41 155 12 44 154 152(global_var) 113 + 156: 147(int) Constant 0 + 159: TypeMatrix 19(fvec4) 4 + 161: TypeBool + 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 162 10 28 12 + 164: 161(bool) ConstantTrue + 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 21 20 164 + 165(Light): TypeStruct 19(fvec4) 19(fvec4) 19(fvec4) 159 + 168: 7(int) Constant 45 + 166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 167 21 41 168 23 12 12 13 + 171: 7(int) Constant 46 + 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 170 21 41 171 23 12 12 13 + 174: 7(int) Constant 47 + 172: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 173 21 41 174 23 12 12 13 + 177: 7(int) Constant 48 + 175: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 176 160 41 177 23 12 12 13 + 180: 7(int) Constant 51 + 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 179 45 41 180 12 44 179 12 13 166 169 172 175 + 181: TypeArray 165(Light) 13 + 182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 178 13 + 183(UBO): TypeStruct 19(fvec4) 181 147(int) 147(int) + 186: 7(int) Constant 53 + 184: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 185 21 41 186 23 12 12 13 + 189: 7(int) Constant 54 + 187: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 188 182 41 189 113 12 12 13 + 192: 7(int) Constant 55 + 190: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 191 149 41 192 11 12 12 13 + 195: 7(int) Constant 56 + 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 194 149 41 195 11 12 12 13 + 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 197 45 41 180 12 44 197 12 13 184 187 190 193 + 198: TypePointer Uniform 183(UBO) + 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 196 28 12 + 200(ubo): 198(ptr) Variable Uniform + 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 202 196 41 180 12 44 202 200(ubo) 113 + 206: 7(int) Constant 61 + 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 84 18 41 206 12 40 20 + 209: 16(float) Constant 1065353216 + 213: 7(int) Constant 62 + 211: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 212 21 41 213 12 40 20 + 223: 7(int) Constant 63 + 225: 16(float) Constant 1056964608 + 235: 7(int) Constant 65 + 237: 16(float) Constant 3212836864 + 252: 7(int) Constant 67 + 253: 7(int) Constant 9 + 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 252 253 40 + 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 256 18 41 252 12 251 20 + 273: 7(int) Constant 68 + 275: 16(float) Constant 0 + 291: 7(int) Constant 70 + 292: 7(int) Constant 11 + 290: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 291 292 251 + 293: 16(float) Constant 1048576000 + 299: 7(int) Constant 73 + 304: 7(int) Constant 74 + 306: TypeVector 147(int) 2 + 307: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 149 28 + 308: TypePointer Function 306(ivec2) + 309: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 307 23 12 + 313: 7(int) Constant 78 + 311: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 312 307 41 313 12 65 20 + 318: TypeVector 147(int) 3 + 319: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 149 13 + 325: 7(int) Constant 79 + 323: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 324 18 41 325 12 65 20 + 328: 16(float) Constant 1069547520 + 332: 7(int) Constant 80 + 330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 331 18 41 332 12 65 20 + 337: TypePointer Function 147(int) + 338: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 149 23 12 + 346: 7(int) Constant 81 + 344: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 345 18 41 346 12 65 20 + 358: 7(int) Constant 83 + 356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 357 18 41 358 12 65 20 + 364: 7(int) Constant 84 + 362: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 363 149 41 364 12 65 20 + 370: 7(int) Constant 85 + 368: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 369 149 41 370 12 65 20 + 373: 147(int) Constant 1 + 375: 7(int) Constant 87 + 374: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 375 28 65 + 377: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 378 149 41 375 12 374 20 + 397: 7(int) Constant 89 + 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 397 13 374 + 399: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 400 149 41 397 12 396 20 + 421: 7(int) Constant 91 + 440: 7(int) Constant 92 + 453: 7(int) Constant 96 + 461: 7(int) Constant 97 + 464: 7(int) Constant 100 + 463: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 464 28 85 + 466: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 467 149 41 464 12 463 20 + 481: 147(int) Constant 3 + 486: 7(int) Constant 102 + 484: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 485 21 41 486 12 463 20 + 491: TypePointer Uniform 159 + 492: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 160 28 12 + 503: 7(int) Constant 104 + 502: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 357 18 41 503 12 463 20 + 508: 7(int) Constant 106 + 516: 7(int) Constant 111 + 526: 7(int) Constant 113 + 531: 7(int) Constant 114 + 538: 7(int) Constant 119 + 536: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 537 75 41 538 12 96 20 + 548: 7(int) Constant 120 + 546: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 547 75 41 548 12 96 20 + 558: 7(int) Constant 121 + 556: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 557 21 41 558 12 96 20 + 564: TypePointer Uniform 147(int) + 565: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 149 28 12 + 568: 7(int) Constant 124 + 574: 7(int) Constant 125 + 573: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 574 13 96 + 585: 74(fvec3) ConstantComposite 209 209 209 + 589: 7(int) Constant 127 + 593: TypePointer Output 16(float) + 594: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 13 12 + 602: 7(int) Constant 128 + 607: 7(int) Constant 130 + 615: 7(int) Constant 131 + 620: 7(int) Constant 133 + 628: 7(int) Constant 134 + 633: 7(int) Constant 136 + 642: 7(int) Constant 137 + 647: 7(int) Constant 139 + 656: 7(int) Constant 140 + 662: 7(int) Constant 142 + 664: 7(int) Constant 143 + 668: 7(int) Constant 147 + 667: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 88 75 41 668 12 96 20 + 674: 16(float) Constant 1036831949 + 679: 7(int) Constant 149 + 677: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 678 75 41 679 12 96 20 + 685: 7(int) Constant 151 + 684: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 685 28 96 + 687: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 467 149 41 685 12 684 20 + 705: 7(int) Constant 154 + 703: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 704 75 41 705 12 684 20 + 710: TypePointer Uniform 19(fvec4) + 711: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 28 12 + 719: 7(int) Constant 156 + 718: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 256 18 41 719 12 684 20 + 726: 7(int) Constant 157 + 731: 7(int) Constant 160 + 729: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 730 75 41 731 12 684 20 + 741: 7(int) Constant 161 + 746: 7(int) Constant 163 + 744: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 745 18 41 746 12 684 20 + 749: 16(float) Constant 1064781546 + 753: 7(int) Constant 164 + 751: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 752 18 41 753 12 684 20 + 756: 16(float) Constant 1063781322 + 760: 7(int) Constant 165 + 758: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 759 18 41 760 12 684 20 + 763: 16(float) Constant 1120403456 + 767: 7(int) Constant 168 + 765: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 766 75 41 767 12 684 20 + 783: 7(int) Constant 171 + 781: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 782 18 41 783 12 684 20 + 792: 7(int) Constant 172 + 790: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 791 18 41 792 12 684 20 + 802: 7(int) Constant 173 + 800: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 801 18 41 802 12 684 20 + 811: 7(int) Constant 176 + 809: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 810 18 41 811 12 684 20 + 821: 7(int) Constant 177 + 819: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 820 75 41 821 12 684 20 + 829: 7(int) Constant 180 + 827: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 828 75 41 829 12 684 20 + 839: 7(int) Constant 181 + 837: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 838 18 41 839 12 684 20 + 849: 7(int) Constant 182 + 847: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 848 75 41 849 12 684 20 + 853: 16(float) Constant 1098907648 + 858: 16(float) Constant 1075838976 + 863: 7(int) Constant 184 + 871: 147(int) Constant 2 + 888: 7(int) Constant 188 + 894: 7(int) Constant 190 + 895: 7(int) Constant 13 + 893: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 41 894 895 96 + 906: 7(int) Constant 193 + 912: 7(int) Constant 194 14(main): 4 Function None 5 15: Label - 485(fragPos): 76(ptr) Variable Function - 509(normal): 76(ptr) Variable Function - 522(albedo): 22(ptr) Variable Function - 562(param): 76(ptr) Variable Function - 565(param): 76(ptr) Variable Function - 641(fragcolor): 76(ptr) Variable Function - 651(N): 76(ptr) Variable Function - 659(i): 262(ptr) Variable Function - 675(L): 76(ptr) Variable Function - 690(dist): 25(ptr) Variable Function - 701(V): 76(ptr) Variable Function -716(lightCosInnerAngle): 25(ptr) Variable Function -723(lightCosOuterAngle): 25(ptr) Variable Function - 730(lightRange): 25(ptr) Variable Function - 737(dir): 76(ptr) Variable Function - 753(cosDir): 25(ptr) Variable Function - 762(spotEffect): 25(ptr) Variable Function -772(heightAttenuation): 25(ptr) Variable Function - 781(NdotL): 25(ptr) Variable Function - 791(diff): 76(ptr) Variable Function - 799(R): 76(ptr) Variable Function - 809(NdotR): 25(ptr) Variable Function - 819(spec): 76(ptr) Variable Function - 869(param): 76(ptr) Variable Function - 873(param): 76(ptr) Variable Function - 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 - 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 106 106 12 12 - Store 103(global_var) 108 - 483: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 - 484: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 97 97 12 12 - 482: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 96 14(main) - 490: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 488 488 12 12 - 489: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 486 485(fragPos) 49 - 500: 493 Load 497(samplerposition) - 506: 27(fvec2) Load 503(inUV) - 507: 19(fvec4) ImageSampleImplicitLod 500 506 - 508: 74(fvec3) VectorShuffle 507 507 0 1 2 - Store 485(fragPos) 508 - 514: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 512 512 12 12 - 513: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 510 509(normal) 49 - 518: 493 Load 515(samplerNormal) - 519: 27(fvec2) Load 503(inUV) - 520: 19(fvec4) ImageSampleImplicitLod 518 519 - 521: 74(fvec3) VectorShuffle 520 520 0 1 2 - Store 509(normal) 521 - 527: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 525 525 12 12 - 526: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 523 522(albedo) 49 - 531: 493 Load 528(samplerAlbedo) - 532: 27(fvec2) Load 503(inUV) - 533: 19(fvec4) ImageSampleImplicitLod 531 532 - Store 522(albedo) 533 - 537: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 538 538 12 12 - 536: 534(ptr) AccessChain 439(ubo) 401 - 539: 98(int) Load 536 - 540: 141(bool) SGreaterThan 539 108 - SelectionMerge 542 None - BranchConditional 540 541 542 - 541: Label - 546: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 543 - 547: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 544 544 12 12 - 545: 534(ptr) AccessChain 439(ubo) 401 - 548: 98(int) Load 545 - SelectionMerge 554 None - Switch 548 554 - case 1: 549 - case 2: 550 - case 3: 551 - case 4: 552 - case 5: 553 - 549: Label - 563: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 543 - 564: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 560 560 12 12 - Store 562(param) 561 - 566: 74(fvec3) Load 485(fragPos) - Store 565(param) 566 - 567: 74(fvec3) FunctionCall 82(shadow(vf3;vf3;) 562(param) 565(param) - 570: 568(ptr) AccessChain 557(outFragColor) 12 - 571: 16(float) CompositeExtract 567 0 - Store 570 571 - 572: 568(ptr) AccessChain 557(outFragColor) 45 - 573: 16(float) CompositeExtract 567 1 - Store 572 573 - 574: 568(ptr) AccessChain 557(outFragColor) 28 - 575: 16(float) CompositeExtract 567 2 - Store 574 575 - 576: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 577 577 12 12 - Branch 554 - 550: Label - 580: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 543 - 581: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 582 582 12 12 - 579: 74(fvec3) Load 485(fragPos) - 583: 568(ptr) AccessChain 557(outFragColor) 12 - 584: 16(float) CompositeExtract 579 0 - Store 583 584 - 585: 568(ptr) AccessChain 557(outFragColor) 45 - 586: 16(float) CompositeExtract 579 1 - Store 585 586 - 587: 568(ptr) AccessChain 557(outFragColor) 28 - 588: 16(float) CompositeExtract 579 2 - Store 587 588 - 589: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 590 590 12 12 - Branch 554 - 551: Label - 593: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 543 - 594: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 595 595 12 12 - 592: 74(fvec3) Load 509(normal) - 596: 568(ptr) AccessChain 557(outFragColor) 12 - 597: 16(float) CompositeExtract 592 0 - Store 596 597 - 598: 568(ptr) AccessChain 557(outFragColor) 45 - 599: 16(float) CompositeExtract 592 1 - Store 598 599 - 600: 568(ptr) AccessChain 557(outFragColor) 28 - 601: 16(float) CompositeExtract 592 2 - Store 600 601 - 602: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 603 603 12 12 - Branch 554 - 552: Label - 606: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 543 - 607: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 608 608 12 12 - 605: 19(fvec4) Load 522(albedo) - 609: 74(fvec3) VectorShuffle 605 605 0 1 2 - 610: 568(ptr) AccessChain 557(outFragColor) 12 - 611: 16(float) CompositeExtract 609 0 + 535(fragPos): 76(ptr) Variable Function + 545(normal): 76(ptr) Variable Function + 555(albedo): 22(ptr) Variable Function + 586(param): 76(ptr) Variable Function + 590(param): 76(ptr) Variable Function + 666(fragcolor): 76(ptr) Variable Function + 676(N): 76(ptr) Variable Function + 686(i): 337(ptr) Variable Function + 702(L): 76(ptr) Variable Function + 717(dist): 25(ptr) Variable Function + 728(V): 76(ptr) Variable Function +743(lightCosInnerAngle): 25(ptr) Variable Function +750(lightCosOuterAngle): 25(ptr) Variable Function + 757(lightRange): 25(ptr) Variable Function + 764(dir): 76(ptr) Variable Function + 780(cosDir): 25(ptr) Variable Function + 789(spotEffect): 25(ptr) Variable Function +799(heightAttenuation): 25(ptr) Variable Function + 808(NdotL): 25(ptr) Variable Function + 818(diff): 76(ptr) Variable Function + 826(R): 76(ptr) Variable Function + 836(NdotR): 25(ptr) Variable Function + 846(spec): 76(ptr) Variable Function + 896(param): 76(ptr) Variable Function + 900(param): 76(ptr) Variable Function + 157: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 + 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 155 155 12 12 + Store 152(global_var) 156 + 533: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 + 534: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 97 97 12 12 + 532: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 96 14(main) + 540: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 538 538 12 12 + 539: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 536 535(fragPos) 49 + 541: 104 Load 110(samplerposition) + 542: 27(fvec2) Load 138(inUV) + 543: 19(fvec4) ImageSampleImplicitLod 541 542 + 544: 74(fvec3) VectorShuffle 543 543 0 1 2 + Store 535(fragPos) 544 + 550: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 548 548 12 12 + 549: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 546 545(normal) 49 + 551: 104 Load 114(samplerNormal) + 552: 27(fvec2) Load 138(inUV) + 553: 19(fvec4) ImageSampleImplicitLod 551 552 + 554: 74(fvec3) VectorShuffle 553 553 0 1 2 + Store 545(normal) 554 + 560: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 558 558 12 12 + 559: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 556 555(albedo) 49 + 561: 104 Load 118(samplerAlbedo) + 562: 27(fvec2) Load 138(inUV) + 563: 19(fvec4) ImageSampleImplicitLod 561 562 + Store 555(albedo) 563 + 567: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 568 568 12 12 + 566: 564(ptr) AccessChain 200(ubo) 481 + 569: 147(int) Load 566 + 570: 161(bool) SGreaterThan 569 156 + SelectionMerge 572 None + BranchConditional 570 571 572 + 571: Label + 576: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 573 + 577: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 574 574 12 12 + 575: 564(ptr) AccessChain 200(ubo) 481 + 578: 147(int) Load 575 + SelectionMerge 584 None + Switch 578 584 + case 1: 579 + case 2: 580 + case 3: 581 + case 4: 582 + case 5: 583 + 579: Label + 587: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 573 + 588: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 589 589 12 12 + Store 586(param) 585 + 591: 74(fvec3) Load 535(fragPos) + Store 590(param) 591 + 592: 74(fvec3) FunctionCall 82(shadow(vf3;vf3;) 586(param) 590(param) + 595: 593(ptr) AccessChain 143(outFragColor) 12 + 596: 16(float) CompositeExtract 592 0 + Store 595 596 + 597: 593(ptr) AccessChain 143(outFragColor) 45 + 598: 16(float) CompositeExtract 592 1 + Store 597 598 + 599: 593(ptr) AccessChain 143(outFragColor) 28 + 600: 16(float) CompositeExtract 592 2 + Store 599 600 + 601: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 602 602 12 12 + Branch 584 + 580: Label + 605: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 573 + 606: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 607 607 12 12 + 604: 74(fvec3) Load 535(fragPos) + 608: 593(ptr) AccessChain 143(outFragColor) 12 + 609: 16(float) CompositeExtract 604 0 + Store 608 609 + 610: 593(ptr) AccessChain 143(outFragColor) 45 + 611: 16(float) CompositeExtract 604 1 Store 610 611 - 612: 568(ptr) AccessChain 557(outFragColor) 45 - 613: 16(float) CompositeExtract 609 1 + 612: 593(ptr) AccessChain 143(outFragColor) 28 + 613: 16(float) CompositeExtract 604 2 Store 612 613 - 614: 568(ptr) AccessChain 557(outFragColor) 28 - 615: 16(float) CompositeExtract 609 2 - Store 614 615 - 616: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 617 617 12 12 - Branch 554 - 553: Label - 620: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 543 - 621: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 622 622 12 12 - 619: 19(fvec4) Load 522(albedo) - 623: 74(fvec3) VectorShuffle 619 619 3 3 3 - 624: 568(ptr) AccessChain 557(outFragColor) 12 - 625: 16(float) CompositeExtract 623 0 - Store 624 625 - 626: 568(ptr) AccessChain 557(outFragColor) 45 - 627: 16(float) CompositeExtract 623 1 - Store 626 627 - 628: 568(ptr) AccessChain 557(outFragColor) 28 - 629: 16(float) CompositeExtract 623 2 - Store 628 629 - 630: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 631 631 12 12 - Branch 554 - 554: Label - 635: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 543 - 636: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 637 637 12 12 - 634: 568(ptr) AccessChain 557(outFragColor) 13 - Store 634 117 - 638: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 639 639 12 12 + 614: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 615 615 12 12 + Branch 584 + 581: Label + 618: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 573 + 619: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 620 620 12 12 + 617: 74(fvec3) Load 545(normal) + 621: 593(ptr) AccessChain 143(outFragColor) 12 + 622: 16(float) CompositeExtract 617 0 + Store 621 622 + 623: 593(ptr) AccessChain 143(outFragColor) 45 + 624: 16(float) CompositeExtract 617 1 + Store 623 624 + 625: 593(ptr) AccessChain 143(outFragColor) 28 + 626: 16(float) CompositeExtract 617 2 + Store 625 626 + 627: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 628 628 12 12 + Branch 584 + 582: Label + 631: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 573 + 632: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 633 633 12 12 + 630: 19(fvec4) Load 555(albedo) + 634: 74(fvec3) VectorShuffle 630 630 0 1 2 + 635: 593(ptr) AccessChain 143(outFragColor) 12 + 636: 16(float) CompositeExtract 634 0 + Store 635 636 + 637: 593(ptr) AccessChain 143(outFragColor) 45 + 638: 16(float) CompositeExtract 634 1 + Store 637 638 + 639: 593(ptr) AccessChain 143(outFragColor) 28 + 640: 16(float) CompositeExtract 634 2 + Store 639 640 + 641: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 642 642 12 12 + Branch 584 + 583: Label + 645: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 573 + 646: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 647 647 12 12 + 644: 19(fvec4) Load 555(albedo) + 648: 74(fvec3) VectorShuffle 644 644 3 3 3 + 649: 593(ptr) AccessChain 143(outFragColor) 12 + 650: 16(float) CompositeExtract 648 0 + Store 649 650 + 651: 593(ptr) AccessChain 143(outFragColor) 45 + 652: 16(float) CompositeExtract 648 1 + Store 651 652 + 653: 593(ptr) AccessChain 143(outFragColor) 28 + 654: 16(float) CompositeExtract 648 2 + Store 653 654 + 655: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 656 656 12 12 + Branch 584 + 584: Label + 660: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 573 + 661: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 662 662 12 12 + 659: 593(ptr) AccessChain 143(outFragColor) 13 + Store 659 209 + 663: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 664 664 12 12 Return - 542: Label - 645: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 - 646: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 643 643 12 12 - 644: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 642 641(fragcolor) 49 - 647: 19(fvec4) Load 522(albedo) - 648: 74(fvec3) VectorShuffle 647 647 0 1 2 - 650: 74(fvec3) VectorTimesScalar 648 649 - Store 641(fragcolor) 650 - 656: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 654 654 12 12 - 655: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 652 651(N) 49 - 657: 74(fvec3) Load 509(normal) - 658: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 657 - Store 651(N) 658 - 663: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 661 661 12 12 - 662: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 660 659(i) 49 - Store 659(i) 108 - Branch 664 - 664: Label - 668: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 - 669: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 661 661 12 12 - LoopMerge 666 667 None - Branch 670 - 670: Label - 672: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 - 673: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 661 661 12 12 - 671: 98(int) Load 659(i) - 674: 141(bool) SLessThan 671 401 - BranchConditional 674 665 666 - 665: Label - 680: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 - 681: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 678 678 12 12 - 679: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 676 675(L) 49 - 682: 98(int) Load 659(i) - 685: 683(ptr) AccessChain 439(ubo) 298 682 108 - 686: 19(fvec4) Load 685 - 687: 74(fvec3) VectorShuffle 686 686 0 1 2 - 688: 74(fvec3) Load 485(fragPos) - 689: 74(fvec3) FSub 687 688 - Store 675(L) 689 - 694: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 692 692 12 12 - 693: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 691 690(dist) 49 - 695: 74(fvec3) Load 675(L) - 696: 16(float) ExtInst 3(GLSL.std.450) 66(Length) 695 - Store 690(dist) 696 - 698: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 699 699 12 12 - 697: 74(fvec3) Load 675(L) - 700: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 697 - Store 675(L) 700 - 706: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 704 704 12 12 - 705: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 702 701(V) 49 - 707: 683(ptr) AccessChain 439(ubo) 108 - 708: 19(fvec4) Load 707 - 709: 74(fvec3) VectorShuffle 708 708 0 1 2 - 710: 74(fvec3) Load 485(fragPos) - 711: 74(fvec3) FSub 709 710 - Store 701(V) 711 - 713: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 714 714 12 12 - 712: 74(fvec3) Load 701(V) - 715: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 712 - Store 701(V) 715 + 572: Label + 670: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 + 671: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 668 668 12 12 + 669: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 667 666(fragcolor) 49 + 672: 19(fvec4) Load 555(albedo) + 673: 74(fvec3) VectorShuffle 672 672 0 1 2 + 675: 74(fvec3) VectorTimesScalar 673 674 + Store 666(fragcolor) 675 + 681: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 679 679 12 12 + 680: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 677 676(N) 49 + 682: 74(fvec3) Load 545(normal) + 683: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 682 + Store 676(N) 683 + 689: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 684 + 690: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 685 685 12 12 + 688: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 687 686(i) 49 + Store 686(i) 156 + Branch 691 + 691: Label + 695: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 684 + 696: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 685 685 12 12 + LoopMerge 693 694 None + Branch 697 + 697: Label + 699: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 684 + 700: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 685 685 12 12 + 698: 147(int) Load 686(i) + 701: 161(bool) SLessThan 698 481 + BranchConditional 701 692 693 + 692: Label + 707: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 684 + 708: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 705 705 12 12 + 706: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 703 702(L) 49 + 709: 147(int) Load 686(i) + 712: 710(ptr) AccessChain 200(ubo) 373 709 156 + 713: 19(fvec4) Load 712 + 714: 74(fvec3) VectorShuffle 713 713 0 1 2 + 715: 74(fvec3) Load 535(fragPos) + 716: 74(fvec3) FSub 714 715 + Store 702(L) 716 721: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 719 719 12 12 - 720: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 717 716(lightCosInnerAngle) 49 - Store 716(lightCosInnerAngle) 722 - 728: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 726 726 12 12 - 727: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 724 723(lightCosOuterAngle) 49 - Store 723(lightCosOuterAngle) 729 - 735: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 733 733 12 12 - 734: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 731 730(lightRange) 49 - Store 730(lightRange) 736 - 742: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 740 740 12 12 - 741: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 738 737(dir) 49 - 743: 98(int) Load 659(i) - 744: 683(ptr) AccessChain 439(ubo) 298 743 108 - 745: 19(fvec4) Load 744 - 746: 74(fvec3) VectorShuffle 745 745 0 1 2 - 747: 98(int) Load 659(i) - 748: 683(ptr) AccessChain 439(ubo) 298 747 298 - 749: 19(fvec4) Load 748 - 750: 74(fvec3) VectorShuffle 749 749 0 1 2 - 751: 74(fvec3) FSub 746 750 - 752: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 751 - Store 737(dir) 752 - 758: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 756 756 12 12 - 757: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 754 753(cosDir) 49 - 759: 74(fvec3) Load 675(L) - 760: 74(fvec3) Load 737(dir) - 761: 16(float) Dot 759 760 - Store 753(cosDir) 761 - 767: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 765 765 12 12 - 766: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 763 762(spotEffect) 49 - 768: 16(float) Load 723(lightCosOuterAngle) - 769: 16(float) Load 716(lightCosInnerAngle) - 770: 16(float) Load 753(cosDir) - 771: 16(float) ExtInst 3(GLSL.std.450) 49(SmoothStep) 768 769 770 - Store 762(spotEffect) 771 - 777: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 775 775 12 12 - 776: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 773 772(heightAttenuation) 49 - 778: 16(float) Load 730(lightRange) - 779: 16(float) Load 690(dist) - 780: 16(float) ExtInst 3(GLSL.std.450) 49(SmoothStep) 778 200 779 - Store 772(heightAttenuation) 780 - 786: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 784 784 12 12 - 785: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 782 781(NdotL) 49 - 787: 74(fvec3) Load 651(N) - 788: 74(fvec3) Load 675(L) - 789: 16(float) Dot 787 788 - 790: 16(float) ExtInst 3(GLSL.std.450) 40(FMax) 200 789 - Store 781(NdotL) 790 - 796: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 794 794 12 12 - 795: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 792 791(diff) 49 - 797: 16(float) Load 781(NdotL) - 798: 74(fvec3) CompositeConstruct 797 797 797 - Store 791(diff) 798 + 720: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 718 717(dist) 49 + 722: 74(fvec3) Load 702(L) + 723: 16(float) ExtInst 3(GLSL.std.450) 66(Length) 722 + Store 717(dist) 723 + 725: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 726 726 12 12 + 724: 74(fvec3) Load 702(L) + 727: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 724 + Store 702(L) 727 + 733: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 731 731 12 12 + 732: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 729 728(V) 49 + 734: 710(ptr) AccessChain 200(ubo) 156 + 735: 19(fvec4) Load 734 + 736: 74(fvec3) VectorShuffle 735 735 0 1 2 + 737: 74(fvec3) Load 535(fragPos) + 738: 74(fvec3) FSub 736 737 + Store 728(V) 738 + 740: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 741 741 12 12 + 739: 74(fvec3) Load 728(V) + 742: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 739 + Store 728(V) 742 + 748: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 746 746 12 12 + 747: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 744 743(lightCosInnerAngle) 49 + Store 743(lightCosInnerAngle) 749 + 755: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 753 753 12 12 + 754: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 751 750(lightCosOuterAngle) 49 + Store 750(lightCosOuterAngle) 756 + 762: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 760 760 12 12 + 761: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 758 757(lightRange) 49 + Store 757(lightRange) 763 + 769: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 767 767 12 12 + 768: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 765 764(dir) 49 + 770: 147(int) Load 686(i) + 771: 710(ptr) AccessChain 200(ubo) 373 770 156 + 772: 19(fvec4) Load 771 + 773: 74(fvec3) VectorShuffle 772 772 0 1 2 + 774: 147(int) Load 686(i) + 775: 710(ptr) AccessChain 200(ubo) 373 774 373 + 776: 19(fvec4) Load 775 + 777: 74(fvec3) VectorShuffle 776 776 0 1 2 + 778: 74(fvec3) FSub 773 777 + 779: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 778 + Store 764(dir) 779 + 785: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 783 783 12 12 + 784: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 781 780(cosDir) 49 + 786: 74(fvec3) Load 702(L) + 787: 74(fvec3) Load 764(dir) + 788: 16(float) Dot 786 787 + Store 780(cosDir) 788 + 794: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 792 792 12 12 + 793: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 790 789(spotEffect) 49 + 795: 16(float) Load 750(lightCosOuterAngle) + 796: 16(float) Load 743(lightCosInnerAngle) + 797: 16(float) Load 780(cosDir) + 798: 16(float) ExtInst 3(GLSL.std.450) 49(SmoothStep) 795 796 797 + Store 789(spotEffect) 798 804: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 802 802 12 12 - 803: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 800 799(R) 49 - 805: 74(fvec3) Load 675(L) - 806: 74(fvec3) FNegate 805 - 807: 74(fvec3) Load 651(N) - 808: 74(fvec3) ExtInst 3(GLSL.std.450) 71(Reflect) 806 807 - Store 799(R) 808 - 814: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 812 812 12 12 - 813: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 810 809(NdotR) 49 - 815: 74(fvec3) Load 799(R) - 816: 74(fvec3) Load 701(V) - 817: 16(float) Dot 815 816 - 818: 16(float) ExtInst 3(GLSL.std.450) 40(FMax) 200 817 - Store 809(NdotR) 818 - 824: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 822 822 12 12 - 823: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 820 819(spec) 49 - 825: 16(float) Load 809(NdotR) - 827: 16(float) ExtInst 3(GLSL.std.450) 26(Pow) 825 826 - 828: 25(ptr) AccessChain 522(albedo) 13 - 829: 16(float) Load 828 - 830: 16(float) FMul 827 829 - 832: 16(float) FMul 830 831 - 833: 74(fvec3) CompositeConstruct 832 832 832 - Store 819(spec) 833 - 835: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 836 836 12 12 - 834: 74(fvec3) Load 791(diff) - 837: 74(fvec3) Load 819(spec) - 838: 74(fvec3) FAdd 834 837 - 839: 16(float) Load 762(spotEffect) - 840: 74(fvec3) VectorTimesScalar 838 839 - 841: 16(float) Load 772(heightAttenuation) - 842: 74(fvec3) VectorTimesScalar 840 841 - 843: 98(int) Load 659(i) - 845: 683(ptr) AccessChain 439(ubo) 298 843 844 - 846: 19(fvec4) Load 845 - 847: 74(fvec3) VectorShuffle 846 846 0 1 2 - 848: 74(fvec3) FMul 842 847 - 849: 19(fvec4) Load 522(albedo) - 850: 74(fvec3) VectorShuffle 849 849 0 1 2 - 851: 74(fvec3) FMul 848 850 - 852: 74(fvec3) Load 641(fragcolor) - 853: 74(fvec3) FAdd 852 851 - Store 641(fragcolor) 853 - Branch 667 - 667: Label - 855: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 - 856: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 661 661 12 12 - 854: 98(int) Load 659(i) - 857: 98(int) IAdd 854 298 - Store 659(i) 857 - Branch 664 - 666: Label - 859: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 - 860: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 861 861 12 12 - 858: 534(ptr) AccessChain 439(ubo) 844 - 862: 98(int) Load 858 - 863: 141(bool) SGreaterThan 862 108 - SelectionMerge 865 None - BranchConditional 863 864 865 - 864: Label - 871: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 866 - 872: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 867 867 12 12 - 870: 74(fvec3) Load 641(fragcolor) - Store 869(param) 870 - 874: 74(fvec3) Load 485(fragPos) - Store 873(param) 874 - 875: 74(fvec3) FunctionCall 82(shadow(vf3;vf3;) 869(param) 873(param) - Store 641(fragcolor) 875 - Branch 865 - 865: Label - 877: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 - 878: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 879 879 12 12 - 876: 74(fvec3) Load 641(fragcolor) - 880: 16(float) CompositeExtract 876 0 - 881: 16(float) CompositeExtract 876 1 - 882: 16(float) CompositeExtract 876 2 - 883: 19(fvec4) CompositeConstruct 880 881 882 117 - Store 557(outFragColor) 883 - 884: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 885 885 12 12 + 803: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 800 799(heightAttenuation) 49 + 805: 16(float) Load 757(lightRange) + 806: 16(float) Load 717(dist) + 807: 16(float) ExtInst 3(GLSL.std.450) 49(SmoothStep) 805 275 806 + Store 799(heightAttenuation) 807 + 813: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 811 811 12 12 + 812: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 809 808(NdotL) 49 + 814: 74(fvec3) Load 676(N) + 815: 74(fvec3) Load 702(L) + 816: 16(float) Dot 814 815 + 817: 16(float) ExtInst 3(GLSL.std.450) 40(FMax) 275 816 + Store 808(NdotL) 817 + 823: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 821 821 12 12 + 822: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 819 818(diff) 49 + 824: 16(float) Load 808(NdotL) + 825: 74(fvec3) CompositeConstruct 824 824 824 + Store 818(diff) 825 + 831: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 829 829 12 12 + 830: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 827 826(R) 49 + 832: 74(fvec3) Load 702(L) + 833: 74(fvec3) FNegate 832 + 834: 74(fvec3) Load 676(N) + 835: 74(fvec3) ExtInst 3(GLSL.std.450) 71(Reflect) 833 834 + Store 826(R) 835 + 841: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 839 839 12 12 + 840: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 837 836(NdotR) 49 + 842: 74(fvec3) Load 826(R) + 843: 74(fvec3) Load 728(V) + 844: 16(float) Dot 842 843 + 845: 16(float) ExtInst 3(GLSL.std.450) 40(FMax) 275 844 + Store 836(NdotR) 845 + 851: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 849 849 12 12 + 850: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 847 846(spec) 49 + 852: 16(float) Load 836(NdotR) + 854: 16(float) ExtInst 3(GLSL.std.450) 26(Pow) 852 853 + 855: 25(ptr) AccessChain 555(albedo) 13 + 856: 16(float) Load 855 + 857: 16(float) FMul 854 856 + 859: 16(float) FMul 857 858 + 860: 74(fvec3) CompositeConstruct 859 859 859 + Store 846(spec) 860 + 862: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 863 863 12 12 + 861: 74(fvec3) Load 818(diff) + 864: 74(fvec3) Load 846(spec) + 865: 74(fvec3) FAdd 861 864 + 866: 16(float) Load 789(spotEffect) + 867: 74(fvec3) VectorTimesScalar 865 866 + 868: 16(float) Load 799(heightAttenuation) + 869: 74(fvec3) VectorTimesScalar 867 868 + 870: 147(int) Load 686(i) + 872: 710(ptr) AccessChain 200(ubo) 373 870 871 + 873: 19(fvec4) Load 872 + 874: 74(fvec3) VectorShuffle 873 873 0 1 2 + 875: 74(fvec3) FMul 869 874 + 876: 19(fvec4) Load 555(albedo) + 877: 74(fvec3) VectorShuffle 876 876 0 1 2 + 878: 74(fvec3) FMul 875 877 + 879: 74(fvec3) Load 666(fragcolor) + 880: 74(fvec3) FAdd 879 878 + Store 666(fragcolor) 880 + Branch 694 + 694: Label + 882: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 684 + 883: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 685 685 12 12 + 881: 147(int) Load 686(i) + 884: 147(int) IAdd 881 373 + Store 686(i) 884 + Branch 691 + 693: Label + 886: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 + 887: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 888 888 12 12 + 885: 564(ptr) AccessChain 200(ubo) 871 + 889: 147(int) Load 885 + 890: 161(bool) SGreaterThan 889 156 + SelectionMerge 892 None + BranchConditional 890 891 892 + 891: Label + 898: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 893 + 899: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 894 894 12 12 + 897: 74(fvec3) Load 666(fragcolor) + Store 896(param) 897 + 901: 74(fvec3) Load 535(fragPos) + Store 900(param) 901 + 902: 74(fvec3) FunctionCall 82(shadow(vf3;vf3;) 896(param) 900(param) + Store 666(fragcolor) 902 + Branch 892 + 892: Label + 904: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 96 + 905: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 906 906 12 12 + 903: 74(fvec3) Load 666(fragcolor) + 907: 16(float) CompositeExtract 903 0 + 908: 16(float) CompositeExtract 903 1 + 909: 16(float) CompositeExtract 903 2 + 910: 19(fvec4) CompositeConstruct 907 908 909 209 + Store 143(outFragColor) 910 + 911: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 912 912 12 12 Return FunctionEnd 37(textureProj(vf4;f1;vf2;): 16(float) Function None 32 @@ -995,321 +1019,324 @@ void main() 35(layer): 25(ptr) FunctionParameter 36(offset): 30(ptr) FunctionParameter 38: Label - 112(shadow): 25(ptr) Variable Function -118(shadowCoord): 22(ptr) Variable Function - 165(dist): 25(ptr) Variable Function + 204(shadow): 25(ptr) Variable Function +210(shadowCoord): 22(ptr) Variable Function + 254(dist): 25(ptr) Variable Function 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 40 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 43 43 12 12 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 46 34(P) 49 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 52 35(layer) 49 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 55 36(offset) 49 - 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 40 37(textureProj(vf4;f1;vf2;) - 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 114 114 12 12 - 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 113 112(shadow) 49 - Store 112(shadow) 117 - 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 121 121 12 12 - 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 119 118(shadowCoord) 49 - 124: 19(fvec4) Load 34(P) - 125: 25(ptr) AccessChain 34(P) 13 - 126: 16(float) Load 125 - 127: 19(fvec4) CompositeConstruct 126 126 126 126 - 128: 19(fvec4) FDiv 124 127 - Store 118(shadowCoord) 128 - 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 131 131 12 12 - 129: 19(fvec4) Load 118(shadowCoord) - 132: 27(fvec2) VectorShuffle 129 129 0 1 - 134: 27(fvec2) VectorTimesScalar 132 133 - 135: 27(fvec2) CompositeConstruct 133 133 - 136: 27(fvec2) FAdd 134 135 - 137: 25(ptr) AccessChain 118(shadowCoord) 12 - 138: 16(float) CompositeExtract 136 0 - Store 137 138 - 139: 25(ptr) AccessChain 118(shadowCoord) 45 - 140: 16(float) CompositeExtract 136 1 - Store 139 140 - 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 146 146 12 12 - 144: 25(ptr) AccessChain 118(shadowCoord) 28 - 147: 16(float) Load 144 - 149: 141(bool) FOrdGreaterThan 147 148 - SelectionMerge 151 None - BranchConditional 149 150 151 - 150: Label - 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 40 - 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 146 146 12 12 - 152: 25(ptr) AccessChain 118(shadowCoord) 28 - 155: 16(float) Load 152 - 156: 141(bool) FOrdLessThan 155 117 - Branch 151 - 151: Label - 157: 141(bool) Phi 149 38 156 150 - 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 40 - 161: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 146 146 12 12 - SelectionMerge 159 None - BranchConditional 157 158 159 - 158: Label - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 162 - 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 163 163 12 12 - 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 166 165(dist) 49 - 185: 176 Load 182(samplerShadowMap) - 186: 19(fvec4) Load 118(shadowCoord) - 187: 27(fvec2) VectorShuffle 186 186 0 1 - 188: 27(fvec2) Load 36(offset) - 189: 27(fvec2) FAdd 187 188 - 190: 16(float) Load 35(layer) - 191: 16(float) CompositeExtract 189 0 - 192: 16(float) CompositeExtract 189 1 - 193: 74(fvec3) CompositeConstruct 191 192 190 - 194: 19(fvec4) ImageSampleImplicitLod 185 193 - 195: 16(float) CompositeExtract 194 0 - Store 165(dist) 195 - 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 198 198 12 12 - 196: 25(ptr) AccessChain 118(shadowCoord) 13 - 199: 16(float) Load 196 - 201: 141(bool) FOrdGreaterThan 199 200 - SelectionMerge 203 None - BranchConditional 201 202 203 - 202: Label - 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 162 - 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 198 198 12 12 - 204: 16(float) Load 165(dist) - 207: 25(ptr) AccessChain 118(shadowCoord) 28 - 208: 16(float) Load 207 - 209: 141(bool) FOrdLessThan 204 208 - Branch 203 - 203: Label - 210: 141(bool) Phi 201 158 209 202 - 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 162 - 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 198 198 12 12 - SelectionMerge 212 None - BranchConditional 210 211 212 - 211: Label - 219: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 215 - 220: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 216 216 12 12 - Store 112(shadow) 218 - Branch 212 - 212: Label - Branch 159 - 159: Label - 222: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 40 - 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 224 224 12 12 - 221: 16(float) Load 112(shadow) - ReturnValue 221 + 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 40 37(textureProj(vf4;f1;vf2;) + 208: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 206 206 12 12 + 207: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 205 204(shadow) 49 + Store 204(shadow) 209 + 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 213 213 12 12 + 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 211 210(shadowCoord) 49 + 216: 19(fvec4) Load 34(P) + 217: 25(ptr) AccessChain 34(P) 13 + 218: 16(float) Load 217 + 219: 19(fvec4) CompositeConstruct 218 218 218 218 + 220: 19(fvec4) FDiv 216 219 + Store 210(shadowCoord) 220 + 222: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 223 223 12 12 + 221: 19(fvec4) Load 210(shadowCoord) + 224: 27(fvec2) VectorShuffle 221 221 0 1 + 226: 27(fvec2) VectorTimesScalar 224 225 + 227: 27(fvec2) CompositeConstruct 225 225 + 228: 27(fvec2) FAdd 226 227 + 229: 25(ptr) AccessChain 210(shadowCoord) 12 + 230: 16(float) CompositeExtract 228 0 + Store 229 230 + 231: 25(ptr) AccessChain 210(shadowCoord) 45 + 232: 16(float) CompositeExtract 228 1 + Store 231 232 + 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 235 235 12 12 + 233: 25(ptr) AccessChain 210(shadowCoord) 28 + 236: 16(float) Load 233 + 238: 161(bool) FOrdGreaterThan 236 237 + SelectionMerge 240 None + BranchConditional 238 239 240 + 239: Label + 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 40 + 243: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 235 235 12 12 + 241: 25(ptr) AccessChain 210(shadowCoord) 28 + 244: 16(float) Load 241 + 245: 161(bool) FOrdLessThan 244 209 + Branch 240 + 240: Label + 246: 161(bool) Phi 238 38 245 239 + 249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 40 + 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 235 235 12 12 + SelectionMerge 248 None + BranchConditional 246 247 248 + 247: Label + 258: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 251 + 259: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 252 252 12 12 + 257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 255 254(dist) 49 + 260: 127 Load 133(samplerShadowMap) + 261: 19(fvec4) Load 210(shadowCoord) + 262: 27(fvec2) VectorShuffle 261 261 0 1 + 263: 27(fvec2) Load 36(offset) + 264: 27(fvec2) FAdd 262 263 + 265: 16(float) Load 35(layer) + 266: 16(float) CompositeExtract 264 0 + 267: 16(float) CompositeExtract 264 1 + 268: 74(fvec3) CompositeConstruct 266 267 265 + 269: 19(fvec4) ImageSampleImplicitLod 260 268 + 270: 16(float) CompositeExtract 269 0 + Store 254(dist) 270 + 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 273 273 12 12 + 271: 25(ptr) AccessChain 210(shadowCoord) 13 + 274: 16(float) Load 271 + 276: 161(bool) FOrdGreaterThan 274 275 + SelectionMerge 278 None + BranchConditional 276 277 278 + 277: Label + 280: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 251 + 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 273 273 12 12 + 279: 16(float) Load 254(dist) + 282: 25(ptr) AccessChain 210(shadowCoord) 28 + 283: 16(float) Load 282 + 284: 161(bool) FOrdLessThan 279 283 + Branch 278 + 278: Label + 285: 161(bool) Phi 276 247 284 277 + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 251 + 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 273 273 12 12 + SelectionMerge 287 None + BranchConditional 285 286 287 + 286: Label + 294: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 290 + 295: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 291 291 12 12 + Store 204(shadow) 293 + Branch 287 + 287: Label + Branch 248 + 248: Label + 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 40 + 298: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 299 299 12 12 + 296: 16(float) Load 204(shadow) + ReturnValue 296 FunctionEnd 62(filterPCF(vf4;f1;): 16(float) Function None 58 60(sc): 22(ptr) FunctionParameter 61(layer): 25(ptr) FunctionParameter 63: Label - 235(texDim): 233(ptr) Variable Function - 247(scale): 25(ptr) Variable Function - 254(dx): 25(ptr) Variable Function - 268(dy): 25(ptr) Variable Function -280(shadowFactor): 25(ptr) Variable Function - 286(count): 262(ptr) Variable Function - 292(range): 262(ptr) Variable Function - 299(x): 262(ptr) Variable Function - 319(y): 262(ptr) Variable Function - 352(param): 22(ptr) Variable Function - 354(param): 25(ptr) Variable Function - 356(param): 30(ptr) Variable Function + 310(texDim): 308(ptr) Variable Function + 322(scale): 25(ptr) Variable Function + 329(dx): 25(ptr) Variable Function + 343(dy): 25(ptr) Variable Function +355(shadowFactor): 25(ptr) Variable Function + 361(count): 337(ptr) Variable Function + 367(range): 337(ptr) Variable Function + 376(x): 337(ptr) Variable Function + 398(y): 337(ptr) Variable Function + 430(param): 22(ptr) Variable Function + 432(param): 25(ptr) Variable Function + 434(param): 30(ptr) Variable Function 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 66 66 12 12 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 67 60(sc) 49 73: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 72 61(layer) 49 - 230: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 65 62(filterPCF(vf4;f1;) - 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 238 238 12 12 - 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 236 235(texDim) 49 - 241: 176 Load 182(samplerShadowMap) - 242: 171 Image 241 - 245: 243(ivec3) ImageQuerySizeLod 242 108 - 246: 231(ivec2) VectorShuffle 245 245 0 1 - Store 235(texDim) 246 - 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 250 250 12 12 - 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 248 247(scale) 49 - Store 247(scale) 253 - 259: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 257 257 12 12 - 258: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 255 254(dx) 49 - 260: 16(float) Load 247(scale) - 261: 16(float) FMul 260 117 - 264: 262(ptr) AccessChain 235(texDim) 12 - 265: 98(int) Load 264 - 266: 16(float) ConvertSToF 265 - 267: 16(float) FDiv 261 266 - Store 254(dx) 267 - 273: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 271 271 12 12 - 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 269 268(dy) 49 - 274: 16(float) Load 247(scale) - 275: 16(float) FMul 274 117 - 276: 262(ptr) AccessChain 235(texDim) 45 - 277: 98(int) Load 276 - 278: 16(float) ConvertSToF 277 - 279: 16(float) FDiv 275 278 - Store 268(dy) 279 - 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 283 283 12 12 - 284: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 281 280(shadowFactor) 49 - Store 280(shadowFactor) 200 - 291: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 289 289 12 12 - 290: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 287 286(count) 49 - Store 286(count) 108 - 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 295 295 12 12 - 296: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 293 292(range) 49 - Store 292(range) 298 - 304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 302 302 12 12 - 303: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 300 299(x) 49 - 305: 98(int) Load 292(range) - 306: 98(int) SNegate 305 - Store 299(x) 306 - Branch 307 - 307: Label - 311: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 312: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 302 302 12 12 - LoopMerge 309 310 None - Branch 313 - 313: Label - 315: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 316: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 302 302 12 12 - 314: 98(int) Load 299(x) - 317: 98(int) Load 292(range) - 318: 141(bool) SLessThanEqual 314 317 - BranchConditional 318 308 309 - 308: Label - 324: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 322 322 12 12 - 323: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 320 319(y) 49 - 326: 98(int) Load 292(range) - 327: 98(int) SNegate 326 - Store 319(y) 327 - Branch 328 - 328: Label - 332: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 333: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 322 322 12 12 - LoopMerge 330 331 None - Branch 334 - 334: Label - 336: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 322 322 12 12 - 335: 98(int) Load 319(y) - 338: 98(int) Load 292(range) - 339: 141(bool) SLessThanEqual 335 338 - BranchConditional 339 329 330 - 329: Label - 341: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 342: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 343 343 12 12 - 340: 16(float) Load 254(dx) - 344: 98(int) Load 299(x) - 345: 16(float) ConvertSToF 344 - 346: 16(float) FMul 340 345 - 347: 16(float) Load 268(dy) - 348: 98(int) Load 319(y) - 349: 16(float) ConvertSToF 348 - 350: 16(float) FMul 347 349 - 351: 27(fvec2) CompositeConstruct 346 350 - 353: 19(fvec4) Load 60(sc) - Store 352(param) 353 - 355: 16(float) Load 61(layer) - Store 354(param) 355 - Store 356(param) 351 - 357: 16(float) FunctionCall 37(textureProj(vf4;f1;vf2;) 352(param) 354(param) 356(param) - 358: 16(float) Load 280(shadowFactor) - 359: 16(float) FAdd 358 357 - Store 280(shadowFactor) 359 - 361: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 362 362 12 12 - 360: 98(int) Load 286(count) - 363: 98(int) IAdd 360 298 - Store 286(count) 363 - Branch 331 - 331: Label - 365: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 366: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 322 322 12 12 - 364: 98(int) Load 319(y) - 367: 98(int) IAdd 364 298 - Store 319(y) 367 - Branch 328 - 330: Label - Branch 310 - 310: Label - 369: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 370: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 302 302 12 12 - 368: 98(int) Load 299(x) - 371: 98(int) IAdd 368 298 - Store 299(x) 371 - Branch 307 - 309: Label - 373: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 - 374: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 375 375 12 12 - 372: 16(float) Load 280(shadowFactor) - 376: 98(int) Load 286(count) - 377: 16(float) ConvertSToF 376 - 378: 16(float) FDiv 372 377 - ReturnValue 378 + 305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 65 62(filterPCF(vf4;f1;) + 315: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 313 313 12 12 + 314: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 311 310(texDim) 49 + 316: 127 Load 133(samplerShadowMap) + 317: 122 Image 316 + 320: 318(ivec3) ImageQuerySizeLod 317 156 + 321: 306(ivec2) VectorShuffle 320 320 0 1 + Store 310(texDim) 321 + 327: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 325 325 12 12 + 326: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 323 322(scale) 49 + Store 322(scale) 328 + 334: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 332 332 12 12 + 333: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 330 329(dx) 49 + 335: 16(float) Load 322(scale) + 336: 16(float) FMul 335 209 + 339: 337(ptr) AccessChain 310(texDim) 12 + 340: 147(int) Load 339 + 341: 16(float) ConvertSToF 340 + 342: 16(float) FDiv 336 341 + Store 329(dx) 342 + 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 346 346 12 12 + 347: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 344 343(dy) 49 + 349: 16(float) Load 322(scale) + 350: 16(float) FMul 349 209 + 351: 337(ptr) AccessChain 310(texDim) 45 + 352: 147(int) Load 351 + 353: 16(float) ConvertSToF 352 + 354: 16(float) FDiv 350 353 + Store 343(dy) 354 + 360: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 358 358 12 12 + 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 356 355(shadowFactor) 49 + Store 355(shadowFactor) 275 + 366: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 364 364 12 12 + 365: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 362 361(count) 49 + Store 361(count) 156 + 372: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 370 370 12 12 + 371: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 368 367(range) 49 + Store 367(range) 373 + 380: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 374 + 381: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 375 375 12 12 + 379: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 377 376(x) 49 + 382: 147(int) Load 367(range) + 383: 147(int) SNegate 382 + Store 376(x) 383 + Branch 384 + 384: Label + 388: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 374 + 389: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 375 375 12 12 + LoopMerge 386 387 None + Branch 390 + 390: Label + 392: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 374 + 393: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 375 375 12 12 + 391: 147(int) Load 376(x) + 394: 147(int) Load 367(range) + 395: 161(bool) SLessThanEqual 391 394 + BranchConditional 395 385 386 + 385: Label + 402: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 396 + 403: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 397 397 12 12 + 401: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 399 398(y) 49 + 404: 147(int) Load 367(range) + 405: 147(int) SNegate 404 + Store 398(y) 405 + Branch 406 + 406: Label + 410: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 396 + 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 397 397 12 12 + LoopMerge 408 409 None + Branch 412 + 412: Label + 414: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 396 + 415: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 397 397 12 12 + 413: 147(int) Load 398(y) + 416: 147(int) Load 367(range) + 417: 161(bool) SLessThanEqual 413 416 + BranchConditional 417 407 408 + 407: Label + 419: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 396 + 420: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 421 421 12 12 + 418: 16(float) Load 329(dx) + 422: 147(int) Load 376(x) + 423: 16(float) ConvertSToF 422 + 424: 16(float) FMul 418 423 + 425: 16(float) Load 343(dy) + 426: 147(int) Load 398(y) + 427: 16(float) ConvertSToF 426 + 428: 16(float) FMul 425 427 + 429: 27(fvec2) CompositeConstruct 424 428 + 431: 19(fvec4) Load 60(sc) + Store 430(param) 431 + 433: 16(float) Load 61(layer) + Store 432(param) 433 + Store 434(param) 429 + 435: 16(float) FunctionCall 37(textureProj(vf4;f1;vf2;) 430(param) 432(param) 434(param) + 436: 16(float) Load 355(shadowFactor) + 437: 16(float) FAdd 436 435 + Store 355(shadowFactor) 437 + 439: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 440 440 12 12 + 438: 147(int) Load 361(count) + 441: 147(int) IAdd 438 373 + Store 361(count) 441 + Branch 409 + 409: Label + 443: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 396 + 444: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 397 397 12 12 + 442: 147(int) Load 398(y) + 445: 147(int) IAdd 442 373 + Store 398(y) 445 + Branch 406 + 408: Label + Branch 387 + 387: Label + 447: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 374 + 448: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 375 375 12 12 + 446: 147(int) Load 376(x) + 449: 147(int) IAdd 446 373 + Store 376(x) 449 + Branch 384 + 386: Label + 451: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 65 + 452: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 453 453 12 12 + 450: 16(float) Load 355(shadowFactor) + 454: 147(int) Load 361(count) + 455: 16(float) ConvertSToF 454 + 456: 16(float) FDiv 450 455 + ReturnValue 456 FunctionEnd 82(shadow(vf3;vf3;): 74(fvec3) Function None 78 80(fragcolor): 76(ptr) FunctionParameter 81(fragpos): 76(ptr) FunctionParameter 83: Label - 385(i): 262(ptr) Variable Function - 403(shadowClip): 22(ptr) Variable Function -453(shadowFactor): 25(ptr) Variable Function - 460(param): 22(ptr) Variable Function - 462(param): 25(ptr) Variable Function + 465(i): 337(ptr) Variable Function + 483(shadowClip): 22(ptr) Variable Function +501(shadowFactor): 25(ptr) Variable Function + 510(param): 22(ptr) Variable Function + 512(param): 25(ptr) Variable Function 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 86 86 12 12 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 87 80(fragcolor) 49 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 92 81(fragpos) 49 - 384: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 85 82(shadow(vf3;vf3;) - 390: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 388 388 12 12 - 389: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 386 385(i) 49 - Store 385(i) 108 - Branch 391 - 391: Label - 395: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 - 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 388 388 12 12 - LoopMerge 393 394 None - Branch 397 - 397: Label - 399: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 - 400: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 388 388 12 12 - 398: 98(int) Load 385(i) - 402: 141(bool) SLessThan 398 401 - BranchConditional 402 392 393 - 392: Label - 408: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 - 409: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 406 406 12 12 - 407: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 404 403(shadowClip) 49 - 442: 98(int) Load 385(i) - 445: 443(ptr) AccessChain 439(ubo) 298 442 401 - 446: 410 Load 445 - 447: 74(fvec3) Load 81(fragpos) - 448: 16(float) CompositeExtract 447 0 - 449: 16(float) CompositeExtract 447 1 - 450: 16(float) CompositeExtract 447 2 - 451: 19(fvec4) CompositeConstruct 448 449 450 117 - 452: 19(fvec4) MatrixTimesVector 446 451 - Store 403(shadowClip) 452 - 457: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 455 455 12 12 - 456: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 454 453(shadowFactor) 49 - 458: 98(int) Load 385(i) - 459: 16(float) ConvertSToF 458 - 461: 19(fvec4) Load 403(shadowClip) - Store 460(param) 461 - Store 462(param) 459 - 463: 16(float) FunctionCall 62(filterPCF(vf4;f1;) 460(param) 462(param) - Store 453(shadowFactor) 463 - 465: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 466 466 12 12 - 464: 16(float) Load 453(shadowFactor) - 467: 74(fvec3) Load 80(fragcolor) - 468: 74(fvec3) VectorTimesScalar 467 464 - Store 80(fragcolor) 468 - Branch 394 - 394: Label - 470: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 - 471: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 388 388 12 12 - 469: 98(int) Load 385(i) - 472: 98(int) IAdd 469 298 - Store 385(i) 472 - Branch 391 - 393: Label - 474: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 - 475: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 476 476 12 12 - 473: 74(fvec3) Load 80(fragcolor) - ReturnValue 473 + 462: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 85 82(shadow(vf3;vf3;) + 469: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 463 + 470: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 464 464 12 12 + 468: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 466 465(i) 49 + Store 465(i) 156 + Branch 471 + 471: Label + 475: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 463 + 476: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 464 464 12 12 + LoopMerge 473 474 None + Branch 477 + 477: Label + 479: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 463 + 480: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 464 464 12 12 + 478: 147(int) Load 465(i) + 482: 161(bool) SLessThan 478 481 + BranchConditional 482 472 473 + 472: Label + 488: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 463 + 489: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 486 486 12 12 + 487: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 484 483(shadowClip) 49 + 490: 147(int) Load 465(i) + 493: 491(ptr) AccessChain 200(ubo) 373 490 481 + 494: 159 Load 493 + 495: 74(fvec3) Load 81(fragpos) + 496: 16(float) CompositeExtract 495 0 + 497: 16(float) CompositeExtract 495 1 + 498: 16(float) CompositeExtract 495 2 + 499: 19(fvec4) CompositeConstruct 496 497 498 209 + 500: 19(fvec4) MatrixTimesVector 494 499 + Store 483(shadowClip) 500 + 505: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 503 503 12 12 + 504: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 502 501(shadowFactor) 49 + 507: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 508 508 12 12 + 506: 147(int) Load 465(i) + 509: 16(float) ConvertSToF 506 + 511: 19(fvec4) Load 483(shadowClip) + Store 510(param) 511 + Store 512(param) 509 + 513: 16(float) FunctionCall 62(filterPCF(vf4;f1;) 510(param) 512(param) + Store 501(shadowFactor) 513 + 515: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 516 516 12 12 + 514: 16(float) Load 501(shadowFactor) + 517: 74(fvec3) Load 80(fragcolor) + 518: 74(fvec3) VectorTimesScalar 517 514 + Store 80(fragcolor) 518 + Branch 474 + 474: Label + 520: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 463 + 521: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 464 464 12 12 + 519: 147(int) Load 465(i) + 522: 147(int) IAdd 519 373 + Store 465(i) 522 + Branch 471 + 473: Label + 524: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 + 525: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 526 526 12 12 + 523: 74(fvec3) Load 80(fragcolor) + ReturnValue 523 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.geom.out b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.geom.out index 0f8ceab639..02936226d0 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.geom.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.geom.out @@ -1,7 +1,7 @@ spv.debuginfo.glsl.geom // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 276 +// Id's are bound by 287 Capability Geometry Capability MultiViewport @@ -9,7 +9,7 @@ spv.debuginfo.glsl.geom 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Geometry 14 "main" 64 98 121 130 134 168 208 217 236 250 256 260 + EntryPoint Geometry 14 "main" 65 69 75 79 83 87 124 184 247 261 267 271 ExecutionMode 14 Triangles ExecutionMode 14 Invocations 2 ExecutionMode 14 OutputTriangleStrip @@ -94,99 +94,100 @@ void main(void) EndPrimitive(); } " - 29: String "int" - 36: String "i" - 54: String "bool" - 58: String "float" - 66: String "outNormal" - 80: String "projection" - 83: String "modelview" - 86: String "lightPos" - 89: String "UBO" - 94: String "ubo" - 100: String "gl_InvocationID" - 123: String "inNormal" - 132: String "outColor" - 136: String "inColor" - 145: String "pos" - 153: String "gl_Position" - 156: String "gl_PointSize" - 159: String "gl_CullDistance" - 163: String "gl_PerVertex" - 170: String "gl_in" - 178: String "worldPos" - 191: String "lPos" - 210: String "outLightVec" - 219: String "outViewVec" - 238: String "" - 252: String "gl_ViewportIndex" - 258: String "gl_PrimitiveID" - 262: String "gl_PrimitiveIDIn" + 26: String "float" + 33: String "bool" + 42: String "projection" + 46: String "modelview" + 49: String "lightPos" + 52: String "UBO" + 57: String "ubo" + 67: String "inNormal" + 71: String "inColor" + 77: String "outNormal" + 81: String "outColor" + 85: String "outViewVec" + 89: String "outLightVec" + 97: String "int" + 103: String "i" + 126: String "gl_InvocationID" + 159: String "pos" + 167: String "gl_Position" + 170: String "gl_PointSize" + 173: String "gl_ClipDistance" + 176: String "gl_CullDistance" + 179: String "gl_PerVertex" + 186: String "gl_in" + 194: String "worldPos" + 207: String "lPos" + 249: String "" + 263: String "gl_ViewportIndex" + 269: String "gl_PrimitiveID" + 273: String "gl_PrimitiveIDIn" SourceExtension "GL_ARB_viewport_array" Name 14 "main" - Name 34 "i" - Name 64 "outNormal" - Name 78 "UBO" - MemberName 78(UBO) 0 "projection" - MemberName 78(UBO) 1 "modelview" - MemberName 78(UBO) 2 "lightPos" - Name 92 "ubo" - Name 98 "gl_InvocationID" - Name 121 "inNormal" - Name 130 "outColor" - Name 134 "inColor" - Name 143 "pos" - Name 151 "gl_PerVertex" - MemberName 151(gl_PerVertex) 0 "gl_Position" - MemberName 151(gl_PerVertex) 1 "gl_PointSize" - MemberName 151(gl_PerVertex) 2 "gl_ClipDistance" - MemberName 151(gl_PerVertex) 3 "gl_CullDistance" - Name 168 "gl_in" - Name 176 "worldPos" - Name 189 "lPos" - Name 208 "outLightVec" - Name 217 "outViewVec" - Name 225 "gl_PerVertex" - MemberName 225(gl_PerVertex) 0 "gl_Position" - MemberName 225(gl_PerVertex) 1 "gl_PointSize" - MemberName 225(gl_PerVertex) 2 "gl_ClipDistance" - MemberName 225(gl_PerVertex) 3 "gl_CullDistance" - Name 236 "" - Name 250 "gl_ViewportIndex" - Name 256 "gl_PrimitiveID" - Name 260 "gl_PrimitiveIDIn" - Decorate 64(outNormal) Location 0 - Decorate 74 ArrayStride 64 - Decorate 76 ArrayStride 64 - Decorate 78(UBO) Block - MemberDecorate 78(UBO) 0 ColMajor - MemberDecorate 78(UBO) 0 MatrixStride 16 - MemberDecorate 78(UBO) 0 Offset 0 - MemberDecorate 78(UBO) 1 ColMajor - MemberDecorate 78(UBO) 1 MatrixStride 16 - MemberDecorate 78(UBO) 1 Offset 128 - MemberDecorate 78(UBO) 2 Offset 256 - Decorate 92(ubo) Binding 0 - Decorate 92(ubo) DescriptorSet 0 - Decorate 98(gl_InvocationID) BuiltIn InvocationId - Decorate 121(inNormal) Location 0 - Decorate 130(outColor) Location 1 - Decorate 134(inColor) Location 1 - Decorate 151(gl_PerVertex) Block - MemberDecorate 151(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 151(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 151(gl_PerVertex) 2 BuiltIn ClipDistance - MemberDecorate 151(gl_PerVertex) 3 BuiltIn CullDistance - Decorate 208(outLightVec) Location 3 - Decorate 217(outViewVec) Location 2 - Decorate 225(gl_PerVertex) Block - MemberDecorate 225(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 225(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 225(gl_PerVertex) 2 BuiltIn ClipDistance - MemberDecorate 225(gl_PerVertex) 3 BuiltIn CullDistance - Decorate 250(gl_ViewportIndex) BuiltIn ViewportIndex - Decorate 256(gl_PrimitiveID) BuiltIn PrimitiveId - Decorate 260(gl_PrimitiveIDIn) BuiltIn PrimitiveId + Name 40 "UBO" + MemberName 40(UBO) 0 "projection" + MemberName 40(UBO) 1 "modelview" + MemberName 40(UBO) 2 "lightPos" + Name 55 "ubo" + Name 65 "inNormal" + Name 69 "inColor" + Name 75 "outNormal" + Name 79 "outColor" + Name 83 "outViewVec" + Name 87 "outLightVec" + Name 101 "i" + Name 124 "gl_InvocationID" + Name 157 "pos" + Name 165 "gl_PerVertex" + MemberName 165(gl_PerVertex) 0 "gl_Position" + MemberName 165(gl_PerVertex) 1 "gl_PointSize" + MemberName 165(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 165(gl_PerVertex) 3 "gl_CullDistance" + Name 184 "gl_in" + Name 192 "worldPos" + Name 205 "lPos" + Name 235 "gl_PerVertex" + MemberName 235(gl_PerVertex) 0 "gl_Position" + MemberName 235(gl_PerVertex) 1 "gl_PointSize" + MemberName 235(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 235(gl_PerVertex) 3 "gl_CullDistance" + Name 247 "" + Name 261 "gl_ViewportIndex" + Name 267 "gl_PrimitiveID" + Name 271 "gl_PrimitiveIDIn" + Decorate 36 ArrayStride 64 + Decorate 38 ArrayStride 64 + Decorate 40(UBO) Block + MemberDecorate 40(UBO) 0 ColMajor + MemberDecorate 40(UBO) 0 MatrixStride 16 + MemberDecorate 40(UBO) 0 Offset 0 + MemberDecorate 40(UBO) 1 ColMajor + MemberDecorate 40(UBO) 1 MatrixStride 16 + MemberDecorate 40(UBO) 1 Offset 128 + MemberDecorate 40(UBO) 2 Offset 256 + Decorate 55(ubo) Binding 0 + Decorate 55(ubo) DescriptorSet 0 + Decorate 65(inNormal) Location 0 + Decorate 69(inColor) Location 1 + Decorate 75(outNormal) Location 0 + Decorate 79(outColor) Location 1 + Decorate 83(outViewVec) Location 2 + Decorate 87(outLightVec) Location 3 + Decorate 124(gl_InvocationID) BuiltIn InvocationId + Decorate 165(gl_PerVertex) Block + MemberDecorate 165(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 165(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 165(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 165(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 235(gl_PerVertex) Block + MemberDecorate 235(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 235(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 235(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 235(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 261(gl_ViewportIndex) BuiltIn ViewportIndex + Decorate 267(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 271(gl_PrimitiveIDIn) BuiltIn PrimitiveId 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -203,250 +204,260 @@ void main(void) 24: 7(int) Constant 2 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 - 28: TypeInt 32 1 - 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 29 10 23 12 - 31: TypePointer Function 28(int) - 32: 7(int) Constant 7 - 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 32 12 - 37: 7(int) Constant 49 - 35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 36 30 18 37 12 17 23 - 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 41: 28(int) Constant 0 - 52: 28(int) Constant 3 - 53: TypeBool - 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 54 10 24 12 - 57: TypeFloat 32 - 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 58 10 13 12 - 60: TypeVector 57(float) 3 - 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 59 13 - 62: TypePointer Output 60(fvec3) - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 61 13 12 - 64(outNormal): 62(ptr) Variable Output - 67: 7(int) Constant 51 - 68: 7(int) Constant 8 - 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 66 61 18 67 12 21 66 64(outNormal) 68 - 69: TypeVector 57(float) 4 - 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 59 23 - 71: TypeMatrix 69(fvec4) 4 - 73: 53(bool) ConstantTrue - 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 70 23 73 - 74: TypeArray 71 24 - 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 72 24 - 76: TypeArray 71 24 - 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 72 24 - 78(UBO): TypeStruct 74 76 69(fvec4) - 81: 7(int) Constant 34 - 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 75 18 81 32 12 12 13 - 84: 7(int) Constant 35 - 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 83 77 18 84 32 12 12 13 - 87: 7(int) Constant 36 - 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 86 70 18 87 32 12 12 13 - 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 89 22 18 67 12 21 89 12 13 79 82 85 - 90: TypePointer Uniform 78(UBO) - 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 88 24 12 - 92(ubo): 90(ptr) Variable Uniform - 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 94 88 18 67 12 21 94 92(ubo) 68 - 95: 28(int) Constant 1 - 96: TypePointer Input 28(int) - 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 22 12 -98(gl_InvocationID): 96(ptr) Variable Input - 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 100 30 18 67 12 21 100 98(gl_InvocationID) 68 - 104: TypePointer Uniform 71 - 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 72 24 12 - 108: TypeMatrix 60(fvec3) 3 - 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 61 13 73 - 117: TypeArray 60(fvec3) 13 - 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 61 13 - 119: TypePointer Input 117 - 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 118 22 12 - 121(inNormal): 119(ptr) Variable Input - 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 123 118 18 67 12 21 123 121(inNormal) 68 - 125: TypePointer Input 60(fvec3) - 126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 61 22 12 - 130(outColor): 62(ptr) Variable Output - 133: 7(int) Constant 52 - 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 132 61 18 133 12 21 132 130(outColor) 68 - 134(inColor): 119(ptr) Variable Input - 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 136 118 18 133 12 21 136 134(inColor) 68 - 141: TypePointer Function 69(fvec4) - 142: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 32 12 - 146: 7(int) Constant 54 - 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 145 70 18 146 12 17 23 - 149: TypeArray 57(float) 22 - 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 59 22 -151(gl_PerVertex): TypeStruct 69(fvec4) 57(float) 149 149 - 154: 7(int) Constant 23 - 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 153 70 18 24 154 12 12 13 - 157: 7(int) Constant 41 - 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 156 59 18 24 157 12 12 13 - 160: 7(int) Constant 84 - 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 159 150 18 24 160 12 12 13 - 161: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 159 150 18 24 160 12 12 13 - 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 163 22 18 146 12 21 163 12 13 152 155 158 161 - 164: TypeArray 151(gl_PerVertex) 13 - 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 162 13 - 166: TypePointer Input 164 - 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 165 22 12 - 168(gl_in): 166(ptr) Variable Input - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 170 165 18 146 12 21 170 168(gl_in) 68 - 172: TypePointer Input 69(fvec4) - 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 22 12 - 179: 7(int) Constant 55 - 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 178 70 18 179 12 17 23 - 187: TypePointer Function 60(fvec3) - 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 61 32 12 - 192: 7(int) Constant 57 - 190: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 191 61 18 192 12 17 23 - 198: 28(int) Constant 2 - 199: TypePointer Uniform 69(fvec4) - 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 24 12 -208(outLightVec): 62(ptr) Variable Output - 211: 7(int) Constant 58 - 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 210 61 18 211 12 21 210 208(outLightVec) 68 - 217(outViewVec): 62(ptr) Variable Output - 220: 7(int) Constant 59 - 218: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 219 61 18 220 12 21 219 217(outViewVec) 68 -225(gl_PerVertex): TypeStruct 69(fvec4) 57(float) 149 149 - 227: 7(int) Constant 215 - 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 153 70 18 24 227 12 12 13 - 229: 7(int) Constant 233 - 228: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 156 59 18 24 229 12 12 13 - 230: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 159 150 18 13 32 12 12 13 - 231: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 159 150 18 13 32 12 12 13 - 233: 7(int) Constant 61 - 232: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 163 22 18 233 12 21 163 12 13 226 228 230 231 - 234: TypePointer Output 225(gl_PerVertex) - 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 232 13 12 - 236: 234(ptr) Variable Output - 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 238 232 18 233 12 21 238 236 68 - 245: TypePointer Output 69(fvec4) - 246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 13 12 - 248: TypePointer Output 28(int) - 249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 13 12 -250(gl_ViewportIndex): 248(ptr) Variable Output - 253: 7(int) Constant 64 - 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 252 30 18 253 12 21 252 250(gl_ViewportIndex) 68 -256(gl_PrimitiveID): 248(ptr) Variable Output - 259: 7(int) Constant 65 - 257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 258 30 18 259 12 21 258 256(gl_PrimitiveID) 68 -260(gl_PrimitiveIDIn): 96(ptr) Variable Input - 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 262 30 18 259 12 21 262 260(gl_PrimitiveIDIn) 68 - 266: 7(int) Constant 66 - 273: 7(int) Constant 68 - 275: 7(int) Constant 69 + 25: TypeFloat 32 + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 13 12 + 28: TypeVector 25(float) 4 + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 23 + 30: TypeMatrix 28(fvec4) 4 + 32: TypeBool + 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 33 10 24 12 + 35: 32(bool) ConstantTrue + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 29 23 35 + 36: TypeArray 30 24 + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 31 24 + 38: TypeArray 30 24 + 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 31 24 + 40(UBO): TypeStruct 36 38 28(fvec4) + 43: 7(int) Constant 34 + 44: 7(int) Constant 7 + 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 42 37 18 43 44 12 12 13 + 47: 7(int) Constant 35 + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 46 39 18 47 44 12 12 13 + 50: 7(int) Constant 36 + 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 49 29 18 50 44 12 12 13 + 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 52 22 18 10 12 21 52 12 13 41 45 48 + 53: TypePointer Uniform 40(UBO) + 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 51 24 12 + 55(ubo): 53(ptr) Variable Uniform + 58: 7(int) Constant 8 + 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 57 51 18 10 12 21 57 55(ubo) 58 + 59: TypeVector 25(float) 3 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 13 + 61: TypeArray 59(fvec3) 13 + 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 60 13 + 63: TypePointer Input 61 + 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 62 22 12 + 65(inNormal): 63(ptr) Variable Input + 68: 7(int) Constant 39 + 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 67 62 18 68 12 21 67 65(inNormal) 58 + 69(inColor): 63(ptr) Variable Input + 72: 7(int) Constant 40 + 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 71 62 18 72 12 21 71 69(inColor) 58 + 73: TypePointer Output 59(fvec3) + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 60 13 12 + 75(outNormal): 73(ptr) Variable Output + 78: 7(int) Constant 42 + 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 77 60 18 78 12 21 77 75(outNormal) 58 + 79(outColor): 73(ptr) Variable Output + 82: 7(int) Constant 43 + 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 81 60 18 82 12 21 81 79(outColor) 58 + 83(outViewVec): 73(ptr) Variable Output + 86: 7(int) Constant 44 + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 85 60 18 86 12 21 85 83(outViewVec) 58 + 87(outLightVec): 73(ptr) Variable Output + 90: 7(int) Constant 45 + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 89 60 18 90 12 21 89 87(outLightVec) 58 + 95: 7(int) Constant 49 + 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 95 24 17 + 96: TypeInt 32 1 + 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 97 10 23 12 + 99: TypePointer Function 96(int) + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 44 12 + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 103 98 18 95 12 94 23 + 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 108: 96(int) Constant 0 + 119: 96(int) Constant 3 + 121: 96(int) Constant 1 + 122: TypePointer Input 96(int) + 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 22 12 +124(gl_InvocationID): 122(ptr) Variable Input + 127: 7(int) Constant 51 + 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 126 98 18 127 12 21 126 124(gl_InvocationID) 58 + 131: TypePointer Uniform 30 + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 31 24 12 + 135: TypeMatrix 59(fvec3) 3 + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 60 13 35 + 145: TypePointer Input 59(fvec3) + 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 60 22 12 + 152: 7(int) Constant 52 + 155: TypePointer Function 28(fvec4) + 156: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 44 12 + 160: 7(int) Constant 54 + 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 159 29 18 160 12 94 23 + 163: TypeArray 25(float) 22 + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 27 22 +165(gl_PerVertex): TypeStruct 28(fvec4) 25(float) 163 163 + 168: 7(int) Constant 23 + 166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 167 29 18 24 168 12 12 13 + 171: 7(int) Constant 41 + 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 170 27 18 24 171 12 12 13 + 174: 7(int) Constant 60 + 172: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 173 164 18 24 174 12 12 13 + 177: 7(int) Constant 84 + 175: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 176 164 18 24 177 12 12 13 + 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 179 22 18 160 12 21 179 12 13 166 169 172 175 + 180: TypeArray 165(gl_PerVertex) 13 + 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 178 13 + 182: TypePointer Input 180 + 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 181 22 12 + 184(gl_in): 182(ptr) Variable Input + 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 186 181 18 160 12 21 186 184(gl_in) 58 + 188: TypePointer Input 28(fvec4) + 189: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 22 12 + 195: 7(int) Constant 55 + 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 194 29 18 195 12 94 23 + 203: TypePointer Function 59(fvec3) + 204: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 60 44 12 + 208: 7(int) Constant 57 + 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 207 60 18 208 12 94 23 + 214: 96(int) Constant 2 + 215: TypePointer Uniform 28(fvec4) + 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 24 12 + 226: 7(int) Constant 58 + 232: 7(int) Constant 59 +235(gl_PerVertex): TypeStruct 28(fvec4) 25(float) 163 163 + 237: 7(int) Constant 215 + 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 167 29 18 24 237 12 12 13 + 239: 7(int) Constant 233 + 238: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 170 27 18 24 239 12 12 13 + 241: 7(int) Constant 252 + 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 173 164 18 24 241 12 12 13 + 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 176 164 18 13 44 12 12 13 + 244: 7(int) Constant 61 + 243: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 179 22 18 244 12 21 179 12 13 236 238 240 242 + 245: TypePointer Output 235(gl_PerVertex) + 246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 243 13 12 + 247: 245(ptr) Variable Output + 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 249 243 18 244 12 21 249 247 58 + 256: TypePointer Output 28(fvec4) + 257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 13 12 + 259: TypePointer Output 96(int) + 260: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 13 12 +261(gl_ViewportIndex): 259(ptr) Variable Output + 264: 7(int) Constant 64 + 262: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 263 98 18 264 12 21 263 261(gl_ViewportIndex) 58 +267(gl_PrimitiveID): 259(ptr) Variable Output + 270: 7(int) Constant 65 + 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 269 98 18 270 12 21 269 267(gl_PrimitiveID) 58 +271(gl_PrimitiveIDIn): 122(ptr) Variable Input + 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 273 98 18 270 12 21 273 271(gl_PrimitiveIDIn) 58 + 277: 7(int) Constant 66 + 284: 7(int) Constant 68 + 286: 7(int) Constant 69 14(main): 4 Function None 5 15: Label - 34(i): 31(ptr) Variable Function - 143(pos): 141(ptr) Variable Function - 176(worldPos): 141(ptr) Variable Function - 189(lPos): 187(ptr) Variable Function - 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 - 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 37 37 12 12 - 38: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 35 34(i) 39 - Store 34(i) 41 - Branch 42 - 42: Label - 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 37 37 12 12 - LoopMerge 44 45 None - Branch 48 - 48: Label - 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 37 37 12 12 - 49: 28(int) Load 34(i) - 56: 53(bool) SLessThan 49 52 - BranchConditional 56 43 44 - 43: Label - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 67 67 12 12 - 101: 28(int) Load 98(gl_InvocationID) - 106: 104(ptr) AccessChain 92(ubo) 95 101 - 107: 71 Load 106 - 110: 69(fvec4) CompositeExtract 107 0 - 111: 60(fvec3) VectorShuffle 110 110 0 1 2 - 112: 69(fvec4) CompositeExtract 107 1 - 113: 60(fvec3) VectorShuffle 112 112 0 1 2 - 114: 69(fvec4) CompositeExtract 107 2 - 115: 60(fvec3) VectorShuffle 114 114 0 1 2 - 116: 108 CompositeConstruct 111 113 115 - 124: 28(int) Load 34(i) - 127: 125(ptr) AccessChain 121(inNormal) 124 - 128: 60(fvec3) Load 127 - 129: 60(fvec3) MatrixTimesVector 116 128 - Store 64(outNormal) 129 - 138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 133 133 12 12 - 137: 28(int) Load 34(i) - 139: 125(ptr) AccessChain 134(inColor) 137 - 140: 60(fvec3) Load 139 - Store 130(outColor) 140 - 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 146 146 12 12 - 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 144 143(pos) 39 - 171: 28(int) Load 34(i) - 174: 172(ptr) AccessChain 168(gl_in) 171 41 - 175: 69(fvec4) Load 174 - Store 143(pos) 175 - 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 179 179 12 12 - 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 177 176(worldPos) 39 - 182: 28(int) Load 98(gl_InvocationID) - 183: 104(ptr) AccessChain 92(ubo) 95 182 - 184: 71 Load 183 - 185: 69(fvec4) Load 143(pos) - 186: 69(fvec4) MatrixTimesVector 184 185 - Store 176(worldPos) 186 - 194: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 192 192 12 12 - 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 190 189(lPos) 39 - 195: 28(int) Load 98(gl_InvocationID) - 196: 104(ptr) AccessChain 92(ubo) 95 195 - 197: 71 Load 196 - 201: 199(ptr) AccessChain 92(ubo) 198 - 202: 69(fvec4) Load 201 - 203: 69(fvec4) MatrixTimesVector 197 202 - 204: 57(float) CompositeExtract 203 0 - 205: 57(float) CompositeExtract 203 1 - 206: 57(float) CompositeExtract 203 2 - 207: 60(fvec3) CompositeConstruct 204 205 206 - Store 189(lPos) 207 - 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 211 211 12 12 - 212: 60(fvec3) Load 189(lPos) - 214: 69(fvec4) Load 176(worldPos) - 215: 60(fvec3) VectorShuffle 214 214 0 1 2 - 216: 60(fvec3) FSub 212 215 - Store 208(outLightVec) 216 - 222: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 220 220 12 12 - 221: 69(fvec4) Load 176(worldPos) - 223: 60(fvec3) VectorShuffle 221 221 0 1 2 - 224: 60(fvec3) FNegate 223 - Store 217(outViewVec) 224 - 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 233 233 12 12 - 239: 28(int) Load 98(gl_InvocationID) - 241: 104(ptr) AccessChain 92(ubo) 41 239 - 242: 71 Load 241 - 243: 69(fvec4) Load 176(worldPos) - 244: 69(fvec4) MatrixTimesVector 242 243 - 247: 245(ptr) AccessChain 236 41 - Store 247 244 - 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 253 253 12 12 - 254: 28(int) Load 98(gl_InvocationID) - Store 250(gl_ViewportIndex) 254 - 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 259 259 12 12 - 263: 28(int) Load 260(gl_PrimitiveIDIn) - Store 256(gl_PrimitiveID) 263 - 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 266 266 12 12 + 101(i): 99(ptr) Variable Function + 157(pos): 155(ptr) Variable Function + 192(worldPos): 155(ptr) Variable Function + 205(lPos): 203(ptr) Variable Function + 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94 + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 95 95 12 12 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 102 101(i) 105 + Store 101(i) 108 + Branch 109 + 109: Label + 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94 + 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 95 95 12 12 + LoopMerge 111 112 None + Branch 115 + 115: Label + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94 + 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 95 95 12 12 + 116: 96(int) Load 101(i) + 120: 32(bool) SLessThan 116 119 + BranchConditional 120 110 111 + 110: Label + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94 + 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 127 127 12 12 + 128: 96(int) Load 124(gl_InvocationID) + 133: 131(ptr) AccessChain 55(ubo) 121 128 + 134: 30 Load 133 + 137: 28(fvec4) CompositeExtract 134 0 + 138: 59(fvec3) VectorShuffle 137 137 0 1 2 + 139: 28(fvec4) CompositeExtract 134 1 + 140: 59(fvec3) VectorShuffle 139 139 0 1 2 + 141: 28(fvec4) CompositeExtract 134 2 + 142: 59(fvec3) VectorShuffle 141 141 0 1 2 + 143: 135 CompositeConstruct 138 140 142 + 144: 96(int) Load 101(i) + 147: 145(ptr) AccessChain 65(inNormal) 144 + 148: 59(fvec3) Load 147 + 149: 59(fvec3) MatrixTimesVector 143 148 + Store 75(outNormal) 149 + 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 152 152 12 12 + 150: 96(int) Load 101(i) + 153: 145(ptr) AccessChain 69(inColor) 150 + 154: 59(fvec3) Load 153 + Store 79(outColor) 154 + 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 160 160 12 12 + 161: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 158 157(pos) 105 + 187: 96(int) Load 101(i) + 190: 188(ptr) AccessChain 184(gl_in) 187 108 + 191: 28(fvec4) Load 190 + Store 157(pos) 191 + 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 195 195 12 12 + 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 193 192(worldPos) 105 + 198: 96(int) Load 124(gl_InvocationID) + 199: 131(ptr) AccessChain 55(ubo) 121 198 + 200: 30 Load 199 + 201: 28(fvec4) Load 157(pos) + 202: 28(fvec4) MatrixTimesVector 200 201 + Store 192(worldPos) 202 + 210: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 208 208 12 12 + 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 206 205(lPos) 105 + 211: 96(int) Load 124(gl_InvocationID) + 212: 131(ptr) AccessChain 55(ubo) 121 211 + 213: 30 Load 212 + 217: 215(ptr) AccessChain 55(ubo) 214 + 218: 28(fvec4) Load 217 + 219: 28(fvec4) MatrixTimesVector 213 218 + 220: 25(float) CompositeExtract 219 0 + 221: 25(float) CompositeExtract 219 1 + 222: 25(float) CompositeExtract 219 2 + 223: 59(fvec3) CompositeConstruct 220 221 222 + Store 205(lPos) 223 + 225: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 226 226 12 12 + 224: 59(fvec3) Load 205(lPos) + 227: 28(fvec4) Load 192(worldPos) + 228: 59(fvec3) VectorShuffle 227 227 0 1 2 + 229: 59(fvec3) FSub 224 228 + Store 87(outLightVec) 229 + 231: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 232 232 12 12 + 230: 28(fvec4) Load 192(worldPos) + 233: 59(fvec3) VectorShuffle 230 230 0 1 2 + 234: 59(fvec3) FNegate 233 + Store 83(outViewVec) 234 + 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 244 244 12 12 + 250: 96(int) Load 124(gl_InvocationID) + 252: 131(ptr) AccessChain 55(ubo) 108 250 + 253: 30 Load 252 + 254: 28(fvec4) Load 192(worldPos) + 255: 28(fvec4) MatrixTimesVector 253 254 + 258: 256(ptr) AccessChain 247 108 + Store 258 255 + 266: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 264 264 12 12 + 265: 96(int) Load 124(gl_InvocationID) + Store 261(gl_ViewportIndex) 265 + 275: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 270 270 12 12 + 274: 96(int) Load 271(gl_PrimitiveIDIn) + Store 267(gl_PrimitiveID) 274 + 276: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 277 277 12 12 EmitVertex - Branch 45 - 45: Label - 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 37 37 12 12 - 267: 28(int) Load 34(i) - 270: 28(int) IAdd 267 95 - Store 34(i) 270 - Branch 42 - 44: Label - 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 273 273 12 12 + Branch 112 + 112: Label + 279: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94 + 280: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 95 95 12 12 + 278: 96(int) Load 101(i) + 281: 96(int) IAdd 278 121 + Store 101(i) 281 + Branch 109 + 111: Label + 282: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 283: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 284 284 12 12 EndPrimitive - 274: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 275 275 12 12 + 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 286 286 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.tesc.out b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.tesc.out index 937a42efab..5508a753b8 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.tesc.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.tesc.out @@ -1,14 +1,14 @@ spv.debuginfo.glsl.tesc // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 579 +// Id's are bound by 600 Capability Tessellation Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationControl 14 "main" 262 267 296 390 405 524 540 550 565 + EntryPoint TessellationControl 14 "main" 122 130 138 146 323 328 431 446 566 ExecutionMode 14 OutputVertices 4 2: String "spv.debuginfo.glsl.tesc" 8: String "uint" @@ -167,126 +167,130 @@ void main() 49: String "bool" 55: String "frustumCheck" 58: String "main" - 64: String "midPoint" - 77: String "radius" - 88: String "v0" - 101: String "modelview" - 105: String "lightPos" - 108: String "frustumPlanes" - 110: String "tessellatedEdgeSize" - 115: String "viewportDim" - 119: String "UBO" - 124: String "ubo" - 126: String "int" - 137: String "clip0" - 158: String "clip1" - 239: String "pos" - 247: String "gl_Position" - 250: String "gl_PointSize" - 253: String "gl_CullDistance" - 257: String "gl_PerVertex" - 264: String "gl_in" - 269: String "gl_InvocationID" - 277: String "type.2d.image" - 279: String "@type.2d.image" - 283: String "type.sampled.image" - 284: String "@type.sampled.image" - 289: String "samplerHeight" - 298: String "inUV" - 317: String "i" - 392: String "gl_TessLevelInner" - 407: String "gl_TessLevelOuter" - 526: String "gl_out" - 542: String "outNormal" - 552: String "inNormal" - 567: String "outUV" + 70: String "projection" + 73: String "modelview" + 76: String "lightPos" + 79: String "frustumPlanes" + 81: String "displacementFactor" + 85: String "tessellationFactor" + 88: String "viewportDim" + 91: String "tessellatedEdgeSize" + 94: String "UBO" + 100: String "ubo" + 103: String "texture2D" + 105: String "@texture2D" + 109: String "sampler2D" + 110: String "@sampler2D" + 115: String "samplerHeight" + 124: String "inNormal" + 132: String "inUV" + 140: String "outNormal" + 148: String "outUV" + 153: String "midPoint" + 166: String "radius" + 177: String "v0" + 182: String "int" + 193: String "clip0" + 212: String "clip1" + 298: String "pos" + 306: String "gl_Position" + 309: String "gl_PointSize" + 312: String "gl_ClipDistance" + 315: String "gl_CullDistance" + 318: String "gl_PerVertex" + 325: String "gl_in" + 330: String "gl_InvocationID" + 359: String "i" + 433: String "gl_TessLevelInner" + 448: String "gl_TessLevelOuter" + 568: String "gl_out" Name 14 "main" Name 29 "screenSpaceTessFactor(vf4;vf4;" Name 27 "p0" Name 28 "p1" Name 53 "frustumCheck(" - Name 62 "midPoint" - Name 75 "radius" - Name 86 "v0" - Name 99 "UBO" - MemberName 99(UBO) 0 "projection" - MemberName 99(UBO) 1 "modelview" - MemberName 99(UBO) 2 "lightPos" - MemberName 99(UBO) 3 "frustumPlanes" - MemberName 99(UBO) 4 "displacementFactor" - MemberName 99(UBO) 5 "tessellationFactor" - MemberName 99(UBO) 6 "viewportDim" - MemberName 99(UBO) 7 "tessellatedEdgeSize" - Name 122 "ubo" - Name 135 "clip0" - Name 156 "clip1" - Name 237 "pos" - Name 245 "gl_PerVertex" - MemberName 245(gl_PerVertex) 0 "gl_Position" - MemberName 245(gl_PerVertex) 1 "gl_PointSize" - MemberName 245(gl_PerVertex) 2 "gl_ClipDistance" - MemberName 245(gl_PerVertex) 3 "gl_CullDistance" - Name 262 "gl_in" - Name 267 "gl_InvocationID" - Name 287 "samplerHeight" - Name 296 "inUV" - Name 315 "i" - Name 390 "gl_TessLevelInner" - Name 405 "gl_TessLevelOuter" - Name 434 "param" - Name 439 "param" - Name 444 "param" - Name 449 "param" - Name 454 "param" - Name 459 "param" - Name 464 "param" - Name 469 "param" - Name 511 "gl_PerVertex" - MemberName 511(gl_PerVertex) 0 "gl_Position" - MemberName 511(gl_PerVertex) 1 "gl_PointSize" - MemberName 511(gl_PerVertex) 2 "gl_ClipDistance" - MemberName 511(gl_PerVertex) 3 "gl_CullDistance" - Name 524 "gl_out" - Name 540 "outNormal" - Name 550 "inNormal" - Name 565 "outUV" - Decorate 95 ArrayStride 16 - Decorate 99(UBO) Block - MemberDecorate 99(UBO) 0 ColMajor - MemberDecorate 99(UBO) 0 MatrixStride 16 - MemberDecorate 99(UBO) 0 Offset 0 - MemberDecorate 99(UBO) 1 ColMajor - MemberDecorate 99(UBO) 1 MatrixStride 16 - MemberDecorate 99(UBO) 1 Offset 64 - MemberDecorate 99(UBO) 2 Offset 128 - MemberDecorate 99(UBO) 3 Offset 144 - MemberDecorate 99(UBO) 4 Offset 240 - MemberDecorate 99(UBO) 5 Offset 244 - MemberDecorate 99(UBO) 6 Offset 248 - MemberDecorate 99(UBO) 7 Offset 256 - Decorate 122(ubo) Binding 0 - Decorate 122(ubo) DescriptorSet 0 - Decorate 245(gl_PerVertex) Block - MemberDecorate 245(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 245(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 245(gl_PerVertex) 2 BuiltIn ClipDistance - MemberDecorate 245(gl_PerVertex) 3 BuiltIn CullDistance - Decorate 267(gl_InvocationID) BuiltIn InvocationId - Decorate 287(samplerHeight) Binding 1 - Decorate 287(samplerHeight) DescriptorSet 0 - Decorate 296(inUV) Location 1 - Decorate 390(gl_TessLevelInner) BuiltIn TessLevelInner - Decorate 390(gl_TessLevelInner) Patch - Decorate 405(gl_TessLevelOuter) BuiltIn TessLevelOuter - Decorate 405(gl_TessLevelOuter) Patch - Decorate 511(gl_PerVertex) Block - MemberDecorate 511(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 511(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 511(gl_PerVertex) 2 BuiltIn ClipDistance - MemberDecorate 511(gl_PerVertex) 3 BuiltIn CullDistance - Decorate 540(outNormal) Location 0 - Decorate 550(inNormal) Location 0 - Decorate 565(outUV) Location 1 + Name 68 "UBO" + MemberName 68(UBO) 0 "projection" + MemberName 68(UBO) 1 "modelview" + MemberName 68(UBO) 2 "lightPos" + MemberName 68(UBO) 3 "frustumPlanes" + MemberName 68(UBO) 4 "displacementFactor" + MemberName 68(UBO) 5 "tessellationFactor" + MemberName 68(UBO) 6 "viewportDim" + MemberName 68(UBO) 7 "tessellatedEdgeSize" + Name 98 "ubo" + Name 113 "samplerHeight" + Name 122 "inNormal" + Name 130 "inUV" + Name 138 "outNormal" + Name 146 "outUV" + Name 151 "midPoint" + Name 164 "radius" + Name 175 "v0" + Name 191 "clip0" + Name 210 "clip1" + Name 296 "pos" + Name 304 "gl_PerVertex" + MemberName 304(gl_PerVertex) 0 "gl_Position" + MemberName 304(gl_PerVertex) 1 "gl_PointSize" + MemberName 304(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 304(gl_PerVertex) 3 "gl_CullDistance" + Name 323 "gl_in" + Name 328 "gl_InvocationID" + Name 357 "i" + Name 431 "gl_TessLevelInner" + Name 446 "gl_TessLevelOuter" + Name 475 "param" + Name 480 "param" + Name 485 "param" + Name 490 "param" + Name 495 "param" + Name 500 "param" + Name 505 "param" + Name 510 "param" + Name 552 "gl_PerVertex" + MemberName 552(gl_PerVertex) 0 "gl_Position" + MemberName 552(gl_PerVertex) 1 "gl_PointSize" + MemberName 552(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 552(gl_PerVertex) 3 "gl_CullDistance" + Name 566 "gl_out" + Decorate 64 ArrayStride 16 + Decorate 68(UBO) Block + MemberDecorate 68(UBO) 0 ColMajor + MemberDecorate 68(UBO) 0 MatrixStride 16 + MemberDecorate 68(UBO) 0 Offset 0 + MemberDecorate 68(UBO) 1 ColMajor + MemberDecorate 68(UBO) 1 MatrixStride 16 + MemberDecorate 68(UBO) 1 Offset 64 + MemberDecorate 68(UBO) 2 Offset 128 + MemberDecorate 68(UBO) 3 Offset 144 + MemberDecorate 68(UBO) 4 Offset 240 + MemberDecorate 68(UBO) 5 Offset 244 + MemberDecorate 68(UBO) 6 Offset 248 + MemberDecorate 68(UBO) 7 Offset 256 + Decorate 98(ubo) Binding 0 + Decorate 98(ubo) DescriptorSet 0 + Decorate 113(samplerHeight) Binding 1 + Decorate 113(samplerHeight) DescriptorSet 0 + Decorate 122(inNormal) Location 0 + Decorate 130(inUV) Location 1 + Decorate 138(outNormal) Location 0 + Decorate 146(outUV) Location 1 + Decorate 304(gl_PerVertex) Block + MemberDecorate 304(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 304(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 304(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 304(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 328(gl_InvocationID) BuiltIn InvocationId + Decorate 431(gl_TessLevelInner) BuiltIn TessLevelInner + Decorate 431(gl_TessLevelInner) Patch + Decorate 446(gl_TessLevelOuter) BuiltIn TessLevelOuter + Decorate 446(gl_TessLevelOuter) Patch + Decorate 552(gl_PerVertex) Block + MemberDecorate 552(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 552(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 552(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 552(gl_PerVertex) 3 BuiltIn CullDistance 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -323,561 +327,578 @@ void main() 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 55 52 33 57 12 36 55 13 57 60: 7(int) Constant 98 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 58 6 33 60 12 36 58 13 60 - 65: 7(int) Constant 54 - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 64 21 33 65 12 32 20 - 68: 16(float) Constant 1056964608 - 73: TypePointer Function 16(float) - 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 23 12 - 78: 7(int) Constant 56 - 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 77 18 33 78 12 32 20 - 84: 16(float) Constant 1073741824 - 89: 7(int) Constant 59 - 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 88 21 33 89 12 32 20 - 92: TypeMatrix 19(fvec4) 4 - 94: 48(bool) ConstantTrue - 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 21 20 94 - 95: TypeArray 19(fvec4) 11 - 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 21 11 - 97: TypeVector 16(float) 2 - 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 38 - 99(UBO): TypeStruct 92 92 19(fvec4) 95 16(float) 16(float) 97(fvec2) 16(float) - 102: 7(int) Constant 30 - 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 101 93 33 102 23 12 12 13 - 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 101 93 33 102 23 12 12 13 - 106: 7(int) Constant 31 - 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 105 21 33 106 23 12 12 13 - 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 108 96 33 10 23 12 12 13 - 111: 7(int) Constant 36 - 112: 7(int) Constant 8 - 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 110 18 33 111 112 12 12 13 - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 110 18 33 111 112 12 12 13 - 116: 7(int) Constant 35 - 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 115 98 33 116 23 12 12 13 - 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 110 18 33 111 112 12 12 13 - 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 119 37 33 89 12 36 119 12 13 100 103 104 107 109 113 114 117 - 120: TypePointer Uniform 99(UBO) - 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 118 38 12 - 122(ubo): 120(ptr) Variable Uniform - 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 124 118 33 89 12 36 124 122(ubo) 112 - 125: TypeInt 32 1 - 127: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 126 10 20 12 - 128: 125(int) Constant 1 - 129: TypePointer Uniform 92 - 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 38 12 - 138: 7(int) Constant 62 - 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 137 21 33 138 12 32 20 - 141: 125(int) Constant 0 - 146: TypeVector 16(float) 3 - 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 13 - 148: 16(float) Constant 0 - 149: 146(fvec3) ConstantComposite 148 148 148 - 159: 7(int) Constant 63 - 157: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 158 21 33 159 12 32 20 - 174: 7(int) Constant 66 - 181: 7(int) Constant 67 - 186: 125(int) Constant 6 - 187: TypePointer Uniform 97(fvec2) - 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 38 12 - 191: 7(int) Constant 70 - 202: 7(int) Constant 71 - 213: 7(int) Constant 76 - 216: 125(int) Constant 7 - 217: TypePointer Uniform 16(float) - 218: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 38 12 - 222: 125(int) Constant 5 - 226: 16(float) Constant 1065353216 - 227: 16(float) Constant 1115684864 - 233: 7(int) Constant 77 - 240: 7(int) Constant 85 - 238: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 239 21 33 240 12 56 20 - 243: TypeArray 16(float) 37 - 244: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 18 37 -245(gl_PerVertex): TypeStruct 19(fvec4) 16(float) 243 243 - 248: 7(int) Constant 1756 - 246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 247 21 33 37 248 12 12 13 - 251: 7(int) Constant 1774 - 249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 250 18 33 37 251 12 12 13 - 254: 7(int) Constant 1817 - 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 253 244 33 37 254 12 12 13 - 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 253 244 33 37 254 12 12 13 - 256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 257 37 33 240 12 36 257 12 13 246 249 252 255 - 258: TypeArray 245(gl_PerVertex) 10 - 259: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 256 10 - 260: TypePointer Input 258 - 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 259 37 12 - 262(gl_in): 260(ptr) Variable Input - 263: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 264 259 33 240 12 36 264 262(gl_in) 112 - 265: TypePointer Input 125(int) - 266: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 127 37 12 -267(gl_InvocationID): 265(ptr) Variable Input - 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 269 127 33 240 12 36 269 267(gl_InvocationID) 112 - 271: TypePointer Input 19(fvec4) - 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 37 12 - 275: TypeImage 16(float) 2D sampled format:Unknown - 278: 7(int) Constant 86 - 280: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) - 276: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 277 12 33 278 12 36 279 280 13 - 281: TypeSampledImage 275 - 282: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 283 12 33 278 12 36 284 280 13 - 285: TypePointer UniformConstant 281 - 286: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 282 12 12 -287(samplerHeight): 285(ptr) Variable UniformConstant - 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 289 282 33 278 12 36 289 287(samplerHeight) 112 - 292: TypeArray 97(fvec2) 10 - 293: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 98 10 - 294: TypePointer Input 292 - 295: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 293 37 12 - 296(inUV): 294(ptr) Variable Input - 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 298 293 33 278 12 36 298 296(inUV) 112 - 299: TypePointer Input 97(fvec2) - 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 37 12 - 305: 125(int) Constant 4 - 313: TypePointer Function 125(int) - 314: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 127 23 12 - 318: 7(int) Constant 89 - 316: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 317 127 33 318 12 56 20 - 335: 7(int) Constant 90 - 336: 125(int) Constant 3 - 338: TypePointer Uniform 19(fvec4) - 339: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 38 12 - 343: 16(float) Constant 1090519040 - 349: 7(int) Constant 92 - 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 349 20 56 - 350: 48(bool) ConstantFalse - 360: 7(int) Constant 95 - 365: 7(int) Constant 96 - 371: 7(int) Constant 100 - 376: 7(int) Constant 102 - 375: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 376 13 59 - 384: 7(int) Constant 104 - 385: 7(int) Constant 25 - 383: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 384 385 375 - 386: TypeArray 16(float) 38 - 387: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 18 38 - 388: TypePointer Output 386 - 389: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 387 13 12 -390(gl_TessLevelInner): 388(ptr) Variable Output - 391: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 392 387 33 384 12 36 392 390(gl_TessLevelInner) 112 - 393: TypePointer Output 16(float) - 394: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 13 12 - 400: 7(int) Constant 105 - 401: TypeArray 16(float) 20 - 402: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 18 20 - 403: TypePointer Output 401 - 404: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 402 13 12 -405(gl_TessLevelOuter): 403(ptr) Variable Output - 408: 7(int) Constant 106 - 406: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 407 402 33 408 12 36 407 405(gl_TessLevelOuter) 112 - 413: 7(int) Constant 107 - 414: 125(int) Constant 2 - 417: 7(int) Constant 108 - 420: 7(int) Constant 109 - 423: 7(int) Constant 113 - 422: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 423 20 375 - 432: 7(int) Constant 115 - 433: 7(int) Constant 26 - 431: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 432 433 422 - 447: 7(int) Constant 116 - 457: 7(int) Constant 117 - 467: 7(int) Constant 118 - 476: 7(int) Constant 119 - 484: 7(int) Constant 120 - 492: 7(int) Constant 126 - 491: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 492 433 422 - 498: 7(int) Constant 127 - 501: 7(int) Constant 128 - 504: 7(int) Constant 129 - 507: 7(int) Constant 130 - 510: 7(int) Constant 131 -511(gl_PerVertex): TypeStruct 19(fvec4) 16(float) 243 243 - 513: 7(int) Constant 110 - 512: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 247 21 33 37 513 12 12 13 - 514: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 250 18 33 37 501 12 12 13 - 516: 7(int) Constant 171 - 515: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 253 244 33 37 516 12 12 13 - 517: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 253 244 33 37 516 12 12 13 - 519: 7(int) Constant 137 - 518: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 257 37 33 519 12 36 257 12 13 512 514 515 517 - 520: TypeArray 511(gl_PerVertex) 20 - 521: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 518 20 - 522: TypePointer Output 520 - 523: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 521 13 12 - 524(gl_out): 522(ptr) Variable Output - 525: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 526 521 33 519 12 36 526 524(gl_out) 112 - 533: TypePointer Output 19(fvec4) - 534: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 13 12 - 536: TypeArray 146(fvec3) 20 - 537: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 147 20 - 538: TypePointer Output 536 - 539: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 537 13 12 - 540(outNormal): 538(ptr) Variable Output - 543: 7(int) Constant 138 - 541: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 542 537 33 543 12 36 542 540(outNormal) 112 - 546: TypeArray 146(fvec3) 10 - 547: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 147 10 - 548: TypePointer Input 546 - 549: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 547 37 12 - 550(inNormal): 548(ptr) Variable Input - 551: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 552 547 33 543 12 36 552 550(inNormal) 112 - 554: TypePointer Input 146(fvec3) - 555: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 147 37 12 - 558: TypePointer Output 146(fvec3) - 559: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 147 13 12 - 561: TypeArray 97(fvec2) 20 - 562: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 98 20 - 563: TypePointer Output 561 - 564: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 562 13 12 - 565(outUV): 563(ptr) Variable Output - 568: 7(int) Constant 139 - 566: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 567 562 33 568 12 36 567 565(outUV) 112 - 574: TypePointer Output 97(fvec2) - 575: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 13 12 - 578: 7(int) Constant 140 + 61: TypeMatrix 19(fvec4) 4 + 63: 48(bool) ConstantTrue + 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 21 20 63 + 64: TypeArray 19(fvec4) 11 + 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 21 11 + 66: TypeVector 16(float) 2 + 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 38 + 68(UBO): TypeStruct 61 61 19(fvec4) 64 16(float) 16(float) 66(fvec2) 16(float) + 71: 7(int) Constant 29 + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 70 62 33 71 23 12 12 13 + 74: 7(int) Constant 30 + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 73 62 33 74 23 12 12 13 + 77: 7(int) Constant 31 + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 76 21 33 77 23 12 12 13 + 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 79 65 33 10 23 12 12 13 + 82: 7(int) Constant 33 + 83: 7(int) Constant 8 + 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 81 18 33 82 83 12 12 13 + 86: 7(int) Constant 34 + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 85 18 33 86 83 12 12 13 + 89: 7(int) Constant 35 + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 88 67 33 89 23 12 12 13 + 92: 7(int) Constant 36 + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 91 18 33 92 83 12 12 13 + 95: 7(int) Constant 27 + 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 94 37 33 95 12 36 94 12 13 69 72 75 78 80 84 87 90 + 96: TypePointer Uniform 68(UBO) + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 38 12 + 98(ubo): 96(ptr) Variable Uniform + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 100 93 33 95 12 36 100 98(ubo) 83 + 101: TypeImage 16(float) 2D sampled format:Unknown + 104: 7(int) Constant 39 + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 103 37 33 104 12 36 105 106 13 + 107: TypeSampledImage 101 + 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 109 37 33 104 12 36 110 106 13 + 111: TypePointer UniformConstant 107 + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 108 12 12 +113(samplerHeight): 111(ptr) Variable UniformConstant + 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 115 108 33 104 12 36 115 113(samplerHeight) 83 + 116: TypeVector 16(float) 3 + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 13 + 118: TypeArray 116(fvec3) 10 + 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 117 10 + 120: TypePointer Input 118 + 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 119 37 12 + 122(inNormal): 120(ptr) Variable Input + 125: 7(int) Constant 43 + 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 124 119 33 125 12 36 124 122(inNormal) 83 + 126: TypeArray 66(fvec2) 10 + 127: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 67 10 + 128: TypePointer Input 126 + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 127 37 12 + 130(inUV): 128(ptr) Variable Input + 133: 7(int) Constant 44 + 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 132 127 33 133 12 36 132 130(inUV) 83 + 134: TypeArray 116(fvec3) 20 + 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 117 20 + 136: TypePointer Output 134 + 137: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 135 13 12 + 138(outNormal): 136(ptr) Variable Output + 141: 7(int) Constant 46 + 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 140 135 33 141 12 36 140 138(outNormal) 83 + 142: TypeArray 66(fvec2) 20 + 143: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 67 20 + 144: TypePointer Output 142 + 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 143 13 12 + 146(outUV): 144(ptr) Variable Output + 149: 7(int) Constant 47 + 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 148 143 33 149 12 36 148 146(outUV) 83 + 154: 7(int) Constant 54 + 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 153 21 33 154 12 32 20 + 157: 16(float) Constant 1056964608 + 162: TypePointer Function 16(float) + 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 23 12 + 167: 7(int) Constant 56 + 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 166 18 33 167 12 32 20 + 173: 16(float) Constant 1073741824 + 178: 7(int) Constant 59 + 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 177 21 33 178 12 32 20 + 181: TypeInt 32 1 + 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 182 10 20 12 + 184: 181(int) Constant 1 + 185: TypePointer Uniform 61 + 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 62 38 12 + 194: 7(int) Constant 62 + 192: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 193 21 33 194 12 32 20 + 197: 181(int) Constant 0 + 202: 16(float) Constant 0 + 203: 116(fvec3) ConstantComposite 202 202 202 + 213: 7(int) Constant 63 + 211: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 212 21 33 213 12 32 20 + 228: 7(int) Constant 66 + 235: 7(int) Constant 67 + 240: 181(int) Constant 6 + 241: TypePointer Uniform 66(fvec2) + 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 67 38 12 + 245: 7(int) Constant 70 + 256: 7(int) Constant 71 + 267: 7(int) Constant 76 + 270: 181(int) Constant 7 + 271: TypePointer Uniform 16(float) + 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 38 12 + 276: 181(int) Constant 5 + 280: 16(float) Constant 1065353216 + 281: 16(float) Constant 1115684864 + 287: 7(int) Constant 77 + 291: 16(float) Constant 1090519040 + 293: 7(int) Constant 84 + 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 166 18 33 293 12 56 20 + 299: 7(int) Constant 85 + 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 298 21 33 299 12 56 20 + 302: TypeArray 16(float) 37 + 303: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 18 37 +304(gl_PerVertex): TypeStruct 19(fvec4) 16(float) 302 302 + 307: 7(int) Constant 1756 + 305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 306 21 33 37 307 12 12 13 + 310: 7(int) Constant 1774 + 308: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 309 18 33 37 310 12 12 13 + 313: 7(int) Constant 1793 + 311: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 312 303 33 37 313 12 12 13 + 316: 7(int) Constant 1817 + 314: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 315 303 33 37 316 12 12 13 + 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 318 37 33 299 12 36 318 12 13 305 308 311 314 + 319: TypeArray 304(gl_PerVertex) 10 + 320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 317 10 + 321: TypePointer Input 319 + 322: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 320 37 12 + 323(gl_in): 321(ptr) Variable Input + 324: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 325 320 33 299 12 36 325 323(gl_in) 83 + 326: TypePointer Input 181(int) + 327: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 183 37 12 +328(gl_InvocationID): 326(ptr) Variable Input + 329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 330 183 33 299 12 36 330 328(gl_InvocationID) 83 + 332: TypePointer Input 19(fvec4) + 333: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 37 12 + 338: 7(int) Constant 86 + 339: TypePointer Input 66(fvec2) + 340: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 67 37 12 + 345: 181(int) Constant 4 + 354: 7(int) Constant 89 + 353: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 354 38 56 + 355: TypePointer Function 181(int) + 356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 183 23 12 + 358: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 359 183 33 354 12 353 20 + 377: 7(int) Constant 90 + 378: 181(int) Constant 3 + 380: TypePointer Uniform 19(fvec4) + 381: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 38 12 + 390: 7(int) Constant 92 + 389: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 390 20 353 + 391: 48(bool) ConstantFalse + 401: 7(int) Constant 95 + 406: 7(int) Constant 96 + 412: 7(int) Constant 100 + 417: 7(int) Constant 102 + 416: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 417 13 59 + 425: 7(int) Constant 104 + 426: 7(int) Constant 25 + 424: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 425 426 416 + 427: TypeArray 16(float) 38 + 428: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 18 38 + 429: TypePointer Output 427 + 430: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 428 13 12 +431(gl_TessLevelInner): 429(ptr) Variable Output + 432: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 433 428 33 425 12 36 433 431(gl_TessLevelInner) 83 + 434: TypePointer Output 16(float) + 435: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 13 12 + 441: 7(int) Constant 105 + 442: TypeArray 16(float) 20 + 443: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 18 20 + 444: TypePointer Output 442 + 445: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 443 13 12 +446(gl_TessLevelOuter): 444(ptr) Variable Output + 449: 7(int) Constant 106 + 447: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 448 443 33 449 12 36 448 446(gl_TessLevelOuter) 83 + 454: 7(int) Constant 107 + 455: 181(int) Constant 2 + 458: 7(int) Constant 108 + 461: 7(int) Constant 109 + 464: 7(int) Constant 113 + 463: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 464 20 416 + 473: 7(int) Constant 115 + 474: 7(int) Constant 26 + 472: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 473 474 463 + 488: 7(int) Constant 116 + 498: 7(int) Constant 117 + 508: 7(int) Constant 118 + 517: 7(int) Constant 119 + 525: 7(int) Constant 120 + 533: 7(int) Constant 126 + 532: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 33 533 474 463 + 539: 7(int) Constant 127 + 542: 7(int) Constant 128 + 545: 7(int) Constant 129 + 548: 7(int) Constant 130 + 551: 7(int) Constant 131 +552(gl_PerVertex): TypeStruct 19(fvec4) 16(float) 302 302 + 554: 7(int) Constant 110 + 553: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 306 21 33 37 554 12 12 13 + 555: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 309 18 33 37 542 12 12 13 + 557: 7(int) Constant 147 + 556: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 312 303 33 37 557 12 12 13 + 559: 7(int) Constant 171 + 558: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 315 303 33 37 559 12 12 13 + 561: 7(int) Constant 137 + 560: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 318 37 33 561 12 36 318 12 13 553 555 556 558 + 562: TypeArray 552(gl_PerVertex) 20 + 563: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 560 20 + 564: TypePointer Output 562 + 565: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 563 13 12 + 566(gl_out): 564(ptr) Variable Output + 567: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 568 563 33 561 12 36 568 566(gl_out) 83 + 575: TypePointer Output 19(fvec4) + 576: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 21 13 12 + 580: 7(int) Constant 138 + 582: TypePointer Input 116(fvec3) + 583: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 117 37 12 + 586: TypePointer Output 116(fvec3) + 587: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 117 13 12 + 591: 7(int) Constant 139 + 595: TypePointer Output 66(fvec2) + 596: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 67 13 12 + 599: 7(int) Constant 140 14(main): 4 Function None 5 15: Label - 434(param): 22(ptr) Variable Function - 439(param): 22(ptr) Variable Function - 444(param): 22(ptr) Variable Function - 449(param): 22(ptr) Variable Function - 454(param): 22(ptr) Variable Function - 459(param): 22(ptr) Variable Function - 464(param): 22(ptr) Variable Function - 469(param): 22(ptr) Variable Function - 367: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 59 - 368: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 60 60 12 12 - 366: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 59 14(main) - 370: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 371 371 12 12 - 369: 125(int) Load 267(gl_InvocationID) - 372: 48(bool) IEqual 369 141 - SelectionMerge 374 None - BranchConditional 372 373 374 - 373: Label - 378: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 375 - 379: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 376 376 12 12 - 377: 48(bool) FunctionCall 53(frustumCheck() - 380: 48(bool) LogicalNot 377 - SelectionMerge 382 None - BranchConditional 380 381 421 - 381: Label - 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 383 - 397: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 384 384 12 12 - 395: 393(ptr) AccessChain 390(gl_TessLevelInner) 141 - Store 395 148 - 399: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 400 400 12 12 - 398: 393(ptr) AccessChain 390(gl_TessLevelInner) 128 - Store 398 148 - 410: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 408 408 12 12 - 409: 393(ptr) AccessChain 405(gl_TessLevelOuter) 141 - Store 409 148 - 412: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 413 413 12 12 - 411: 393(ptr) AccessChain 405(gl_TessLevelOuter) 128 - Store 411 148 - 416: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 417 417 12 12 - 415: 393(ptr) AccessChain 405(gl_TessLevelOuter) 414 - Store 415 148 - 419: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 420 420 12 12 - 418: 393(ptr) AccessChain 405(gl_TessLevelOuter) 336 - Store 418 148 - Branch 382 - 421: Label - 425: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 422 - 426: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 423 423 12 12 - 424: 217(ptr) AccessChain 122(ubo) 222 - 427: 16(float) Load 424 - 428: 48(bool) FOrdGreaterThan 427 148 - SelectionMerge 430 None - BranchConditional 428 429 490 - 429: Label - 436: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 431 - 437: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 432 432 12 12 - 435: 271(ptr) AccessChain 262(gl_in) 336 141 - 438: 19(fvec4) Load 435 - Store 434(param) 438 - 440: 271(ptr) AccessChain 262(gl_in) 141 141 - 441: 19(fvec4) Load 440 - Store 439(param) 441 - 442: 16(float) FunctionCall 29(screenSpaceTessFactor(vf4;vf4;) 434(param) 439(param) - 443: 393(ptr) AccessChain 405(gl_TessLevelOuter) 141 - Store 443 442 - 446: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 447 447 12 12 - 445: 271(ptr) AccessChain 262(gl_in) 141 141 - 448: 19(fvec4) Load 445 - Store 444(param) 448 - 450: 271(ptr) AccessChain 262(gl_in) 128 141 - 451: 19(fvec4) Load 450 - Store 449(param) 451 - 452: 16(float) FunctionCall 29(screenSpaceTessFactor(vf4;vf4;) 444(param) 449(param) - 453: 393(ptr) AccessChain 405(gl_TessLevelOuter) 128 - Store 453 452 - 456: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 457 457 12 12 - 455: 271(ptr) AccessChain 262(gl_in) 128 141 - 458: 19(fvec4) Load 455 - Store 454(param) 458 - 460: 271(ptr) AccessChain 262(gl_in) 414 141 - 461: 19(fvec4) Load 460 - Store 459(param) 461 - 462: 16(float) FunctionCall 29(screenSpaceTessFactor(vf4;vf4;) 454(param) 459(param) - 463: 393(ptr) AccessChain 405(gl_TessLevelOuter) 414 - Store 463 462 - 466: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 467 467 12 12 - 465: 271(ptr) AccessChain 262(gl_in) 414 141 - 468: 19(fvec4) Load 465 - Store 464(param) 468 - 470: 271(ptr) AccessChain 262(gl_in) 336 141 - 471: 19(fvec4) Load 470 - Store 469(param) 471 - 472: 16(float) FunctionCall 29(screenSpaceTessFactor(vf4;vf4;) 464(param) 469(param) - 473: 393(ptr) AccessChain 405(gl_TessLevelOuter) 336 - Store 473 472 - 475: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 476 476 12 12 - 474: 393(ptr) AccessChain 405(gl_TessLevelOuter) 141 - 477: 16(float) Load 474 - 478: 393(ptr) AccessChain 405(gl_TessLevelOuter) 336 - 479: 16(float) Load 478 - 480: 16(float) ExtInst 3(GLSL.std.450) 46(FMix) 477 479 68 - 481: 393(ptr) AccessChain 390(gl_TessLevelInner) 141 - Store 481 480 - 483: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 484 484 12 12 - 482: 393(ptr) AccessChain 405(gl_TessLevelOuter) 414 - 485: 16(float) Load 482 - 486: 393(ptr) AccessChain 405(gl_TessLevelOuter) 128 - 487: 16(float) Load 486 - 488: 16(float) ExtInst 3(GLSL.std.450) 46(FMix) 485 487 68 - 489: 393(ptr) AccessChain 390(gl_TessLevelInner) 128 - Store 489 488 - Branch 430 - 490: Label - 494: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 491 - 495: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 492 492 12 12 - 493: 393(ptr) AccessChain 390(gl_TessLevelInner) 141 - Store 493 226 + 475(param): 22(ptr) Variable Function + 480(param): 22(ptr) Variable Function + 485(param): 22(ptr) Variable Function + 490(param): 22(ptr) Variable Function + 495(param): 22(ptr) Variable Function + 500(param): 22(ptr) Variable Function + 505(param): 22(ptr) Variable Function + 510(param): 22(ptr) Variable Function + 408: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 59 + 409: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 60 60 12 12 + 407: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 59 14(main) + 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 412 412 12 12 + 410: 181(int) Load 328(gl_InvocationID) + 413: 48(bool) IEqual 410 197 + SelectionMerge 415 None + BranchConditional 413 414 415 + 414: Label + 419: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 416 + 420: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 417 417 12 12 + 418: 48(bool) FunctionCall 53(frustumCheck() + 421: 48(bool) LogicalNot 418 + SelectionMerge 423 None + BranchConditional 421 422 462 + 422: Label + 437: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 424 + 438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 425 425 12 12 + 436: 434(ptr) AccessChain 431(gl_TessLevelInner) 197 + Store 436 202 + 440: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 441 441 12 12 + 439: 434(ptr) AccessChain 431(gl_TessLevelInner) 184 + Store 439 202 + 451: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 449 449 12 12 + 450: 434(ptr) AccessChain 446(gl_TessLevelOuter) 197 + Store 450 202 + 453: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 454 454 12 12 + 452: 434(ptr) AccessChain 446(gl_TessLevelOuter) 184 + Store 452 202 + 457: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 458 458 12 12 + 456: 434(ptr) AccessChain 446(gl_TessLevelOuter) 455 + Store 456 202 + 460: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 461 461 12 12 + 459: 434(ptr) AccessChain 446(gl_TessLevelOuter) 378 + Store 459 202 + Branch 423 + 462: Label + 466: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 463 + 467: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 464 464 12 12 + 465: 271(ptr) AccessChain 98(ubo) 276 + 468: 16(float) Load 465 + 469: 48(bool) FOrdGreaterThan 468 202 + SelectionMerge 471 None + BranchConditional 469 470 531 + 470: Label + 477: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 472 + 478: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 473 473 12 12 + 476: 332(ptr) AccessChain 323(gl_in) 378 197 + 479: 19(fvec4) Load 476 + Store 475(param) 479 + 481: 332(ptr) AccessChain 323(gl_in) 197 197 + 482: 19(fvec4) Load 481 + Store 480(param) 482 + 483: 16(float) FunctionCall 29(screenSpaceTessFactor(vf4;vf4;) 475(param) 480(param) + 484: 434(ptr) AccessChain 446(gl_TessLevelOuter) 197 + Store 484 483 + 487: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 488 488 12 12 + 486: 332(ptr) AccessChain 323(gl_in) 197 197 + 489: 19(fvec4) Load 486 + Store 485(param) 489 + 491: 332(ptr) AccessChain 323(gl_in) 184 197 + 492: 19(fvec4) Load 491 + Store 490(param) 492 + 493: 16(float) FunctionCall 29(screenSpaceTessFactor(vf4;vf4;) 485(param) 490(param) + 494: 434(ptr) AccessChain 446(gl_TessLevelOuter) 184 + Store 494 493 497: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 498 498 12 12 - 496: 393(ptr) AccessChain 390(gl_TessLevelInner) 128 - Store 496 226 - 500: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 501 501 12 12 - 499: 393(ptr) AccessChain 405(gl_TessLevelOuter) 141 - Store 499 226 - 503: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 504 504 12 12 - 502: 393(ptr) AccessChain 405(gl_TessLevelOuter) 128 - Store 502 226 - 506: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 507 507 12 12 - 505: 393(ptr) AccessChain 405(gl_TessLevelOuter) 414 - Store 505 226 - 509: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 510 510 12 12 - 508: 393(ptr) AccessChain 405(gl_TessLevelOuter) 336 - Store 508 226 - Branch 430 - 430: Label - Branch 382 - 382: Label - Branch 374 - 374: Label - 528: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 59 - 529: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 519 519 12 12 - 527: 125(int) Load 267(gl_InvocationID) - 530: 125(int) Load 267(gl_InvocationID) - 531: 271(ptr) AccessChain 262(gl_in) 530 141 - 532: 19(fvec4) Load 531 - 535: 533(ptr) AccessChain 524(gl_out) 527 141 - Store 535 532 - 545: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 543 543 12 12 - 544: 125(int) Load 267(gl_InvocationID) - 553: 125(int) Load 267(gl_InvocationID) - 556: 554(ptr) AccessChain 550(inNormal) 553 - 557: 146(fvec3) Load 556 - 560: 558(ptr) AccessChain 540(outNormal) 544 - Store 560 557 - 570: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 568 568 12 12 - 569: 125(int) Load 267(gl_InvocationID) - 571: 125(int) Load 267(gl_InvocationID) - 572: 299(ptr) AccessChain 296(inUV) 571 - 573: 97(fvec2) Load 572 - 576: 574(ptr) AccessChain 565(outUV) 569 - Store 576 573 - 577: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 578 578 12 12 + 496: 332(ptr) AccessChain 323(gl_in) 184 197 + 499: 19(fvec4) Load 496 + Store 495(param) 499 + 501: 332(ptr) AccessChain 323(gl_in) 455 197 + 502: 19(fvec4) Load 501 + Store 500(param) 502 + 503: 16(float) FunctionCall 29(screenSpaceTessFactor(vf4;vf4;) 495(param) 500(param) + 504: 434(ptr) AccessChain 446(gl_TessLevelOuter) 455 + Store 504 503 + 507: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 508 508 12 12 + 506: 332(ptr) AccessChain 323(gl_in) 455 197 + 509: 19(fvec4) Load 506 + Store 505(param) 509 + 511: 332(ptr) AccessChain 323(gl_in) 378 197 + 512: 19(fvec4) Load 511 + Store 510(param) 512 + 513: 16(float) FunctionCall 29(screenSpaceTessFactor(vf4;vf4;) 505(param) 510(param) + 514: 434(ptr) AccessChain 446(gl_TessLevelOuter) 378 + Store 514 513 + 516: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 517 517 12 12 + 515: 434(ptr) AccessChain 446(gl_TessLevelOuter) 197 + 518: 16(float) Load 515 + 519: 434(ptr) AccessChain 446(gl_TessLevelOuter) 378 + 520: 16(float) Load 519 + 521: 16(float) ExtInst 3(GLSL.std.450) 46(FMix) 518 520 157 + 522: 434(ptr) AccessChain 431(gl_TessLevelInner) 197 + Store 522 521 + 524: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 525 525 12 12 + 523: 434(ptr) AccessChain 446(gl_TessLevelOuter) 455 + 526: 16(float) Load 523 + 527: 434(ptr) AccessChain 446(gl_TessLevelOuter) 184 + 528: 16(float) Load 527 + 529: 16(float) ExtInst 3(GLSL.std.450) 46(FMix) 526 528 157 + 530: 434(ptr) AccessChain 431(gl_TessLevelInner) 184 + Store 530 529 + Branch 471 + 531: Label + 535: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 532 + 536: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 533 533 12 12 + 534: 434(ptr) AccessChain 431(gl_TessLevelInner) 197 + Store 534 280 + 538: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 539 539 12 12 + 537: 434(ptr) AccessChain 431(gl_TessLevelInner) 184 + Store 537 280 + 541: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 542 542 12 12 + 540: 434(ptr) AccessChain 446(gl_TessLevelOuter) 197 + Store 540 280 + 544: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 545 545 12 12 + 543: 434(ptr) AccessChain 446(gl_TessLevelOuter) 184 + Store 543 280 + 547: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 548 548 12 12 + 546: 434(ptr) AccessChain 446(gl_TessLevelOuter) 455 + Store 546 280 + 550: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 551 551 12 12 + 549: 434(ptr) AccessChain 446(gl_TessLevelOuter) 378 + Store 549 280 + Branch 471 + 471: Label + Branch 423 + 423: Label + Branch 415 + 415: Label + 570: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 59 + 571: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 561 561 12 12 + 569: 181(int) Load 328(gl_InvocationID) + 572: 181(int) Load 328(gl_InvocationID) + 573: 332(ptr) AccessChain 323(gl_in) 572 197 + 574: 19(fvec4) Load 573 + 577: 575(ptr) AccessChain 566(gl_out) 569 197 + Store 577 574 + 579: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 580 580 12 12 + 578: 181(int) Load 328(gl_InvocationID) + 581: 181(int) Load 328(gl_InvocationID) + 584: 582(ptr) AccessChain 122(inNormal) 581 + 585: 116(fvec3) Load 584 + 588: 586(ptr) AccessChain 138(outNormal) 578 + Store 588 585 + 590: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 591 591 12 12 + 589: 181(int) Load 328(gl_InvocationID) + 592: 181(int) Load 328(gl_InvocationID) + 593: 339(ptr) AccessChain 130(inUV) 592 + 594: 66(fvec2) Load 593 + 597: 595(ptr) AccessChain 146(outUV) 589 + Store 597 594 + 598: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 599 599 12 12 Return FunctionEnd 29(screenSpaceTessFactor(vf4;vf4;): 16(float) Function None 25 27(p0): 22(ptr) FunctionParameter 28(p1): 22(ptr) FunctionParameter 30: Label - 62(midPoint): 22(ptr) Variable Function - 75(radius): 73(ptr) Variable Function - 86(v0): 22(ptr) Variable Function - 135(clip0): 22(ptr) Variable Function - 156(clip1): 22(ptr) Variable Function + 151(midPoint): 22(ptr) Variable Function + 164(radius): 162(ptr) Variable Function + 175(v0): 22(ptr) Variable Function + 191(clip0): 22(ptr) Variable Function + 210(clip1): 22(ptr) Variable Function 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 32 44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 35 35 12 12 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 39 27(p0) 42 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 45 28(p1) 42 - 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 32 29(screenSpaceTessFactor(vf4;vf4;) - 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 65 65 12 12 - 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 63 62(midPoint) 42 - 69: 19(fvec4) Load 27(p0) - 70: 19(fvec4) Load 28(p1) - 71: 19(fvec4) FAdd 69 70 - 72: 19(fvec4) VectorTimesScalar 71 68 - Store 62(midPoint) 72 - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 78 78 12 12 - 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 76 75(radius) 42 - 81: 19(fvec4) Load 27(p0) - 82: 19(fvec4) Load 28(p1) - 83: 16(float) ExtInst 3(GLSL.std.450) 67(Distance) 81 82 - 85: 16(float) FDiv 83 84 - Store 75(radius) 85 - 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 89 89 12 12 - 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 87 86(v0) 42 - 131: 129(ptr) AccessChain 122(ubo) 128 - 132: 92 Load 131 - 133: 19(fvec4) Load 62(midPoint) - 134: 19(fvec4) MatrixTimesVector 132 133 - Store 86(v0) 134 - 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 138 138 12 12 - 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 136 135(clip0) 42 - 142: 129(ptr) AccessChain 122(ubo) 141 - 143: 92 Load 142 - 144: 19(fvec4) Load 86(v0) - 145: 16(float) Load 75(radius) - 150: 16(float) CompositeExtract 149 0 - 151: 16(float) CompositeExtract 149 1 - 152: 16(float) CompositeExtract 149 2 - 153: 19(fvec4) CompositeConstruct 145 150 151 152 - 154: 19(fvec4) FSub 144 153 - 155: 19(fvec4) MatrixTimesVector 143 154 - Store 135(clip0) 155 - 161: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 159 159 12 12 - 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 157 156(clip1) 42 - 162: 129(ptr) AccessChain 122(ubo) 141 - 163: 92 Load 162 - 164: 19(fvec4) Load 86(v0) - 165: 16(float) Load 75(radius) - 166: 16(float) CompositeExtract 149 0 - 167: 16(float) CompositeExtract 149 1 - 168: 16(float) CompositeExtract 149 2 - 169: 19(fvec4) CompositeConstruct 165 166 167 168 - 170: 19(fvec4) FAdd 164 169 - 171: 19(fvec4) MatrixTimesVector 163 170 - Store 156(clip1) 171 - 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 174 174 12 12 - 172: 73(ptr) AccessChain 135(clip0) 13 - 175: 16(float) Load 172 - 176: 19(fvec4) Load 135(clip0) - 177: 19(fvec4) CompositeConstruct 175 175 175 175 - 178: 19(fvec4) FDiv 176 177 - Store 135(clip0) 178 - 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 181 181 12 12 - 179: 73(ptr) AccessChain 156(clip1) 13 - 182: 16(float) Load 179 - 183: 19(fvec4) Load 156(clip1) - 184: 19(fvec4) CompositeConstruct 182 182 182 182 - 185: 19(fvec4) FDiv 183 184 - Store 156(clip1) 185 - 190: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 191 191 12 12 - 189: 187(ptr) AccessChain 122(ubo) 186 - 192: 97(fvec2) Load 189 - 193: 19(fvec4) Load 135(clip0) - 194: 97(fvec2) VectorShuffle 193 193 0 1 - 195: 97(fvec2) FMul 194 192 - 196: 73(ptr) AccessChain 135(clip0) 12 - 197: 16(float) CompositeExtract 195 0 - Store 196 197 - 198: 73(ptr) AccessChain 135(clip0) 37 - 199: 16(float) CompositeExtract 195 1 - Store 198 199 - 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 202 202 12 12 - 200: 187(ptr) AccessChain 122(ubo) 186 - 203: 97(fvec2) Load 200 - 204: 19(fvec4) Load 156(clip1) - 205: 97(fvec2) VectorShuffle 204 204 0 1 - 206: 97(fvec2) FMul 205 203 - 207: 73(ptr) AccessChain 156(clip1) 12 - 208: 16(float) CompositeExtract 206 0 - Store 207 208 - 209: 73(ptr) AccessChain 156(clip1) 37 - 210: 16(float) CompositeExtract 206 1 - Store 209 210 - 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 213 213 12 12 - 211: 19(fvec4) Load 135(clip0) - 214: 19(fvec4) Load 156(clip1) - 215: 16(float) ExtInst 3(GLSL.std.450) 67(Distance) 211 214 - 219: 217(ptr) AccessChain 122(ubo) 216 - 220: 16(float) Load 219 - 221: 16(float) FDiv 215 220 - 223: 217(ptr) AccessChain 122(ubo) 222 - 224: 16(float) Load 223 - 225: 16(float) FMul 221 224 - 228: 16(float) ExtInst 3(GLSL.std.450) 43(FClamp) 225 226 227 - ReturnValue 228 + 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 32 29(screenSpaceTessFactor(vf4;vf4;) + 156: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 154 154 12 12 + 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 152 151(midPoint) 42 + 158: 19(fvec4) Load 27(p0) + 159: 19(fvec4) Load 28(p1) + 160: 19(fvec4) FAdd 158 159 + 161: 19(fvec4) VectorTimesScalar 160 157 + Store 151(midPoint) 161 + 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 167 167 12 12 + 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 165 164(radius) 42 + 170: 19(fvec4) Load 27(p0) + 171: 19(fvec4) Load 28(p1) + 172: 16(float) ExtInst 3(GLSL.std.450) 67(Distance) 170 171 + 174: 16(float) FDiv 172 173 + Store 164(radius) 174 + 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 178 178 12 12 + 179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 176 175(v0) 42 + 187: 185(ptr) AccessChain 98(ubo) 184 + 188: 61 Load 187 + 189: 19(fvec4) Load 151(midPoint) + 190: 19(fvec4) MatrixTimesVector 188 189 + Store 175(v0) 190 + 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 194 194 12 12 + 195: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 192 191(clip0) 42 + 198: 185(ptr) AccessChain 98(ubo) 197 + 199: 61 Load 198 + 200: 19(fvec4) Load 175(v0) + 201: 16(float) Load 164(radius) + 204: 16(float) CompositeExtract 203 0 + 205: 16(float) CompositeExtract 203 1 + 206: 16(float) CompositeExtract 203 2 + 207: 19(fvec4) CompositeConstruct 201 204 205 206 + 208: 19(fvec4) FSub 200 207 + 209: 19(fvec4) MatrixTimesVector 199 208 + Store 191(clip0) 209 + 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 213 213 12 12 + 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 211 210(clip1) 42 + 216: 185(ptr) AccessChain 98(ubo) 197 + 217: 61 Load 216 + 218: 19(fvec4) Load 175(v0) + 219: 16(float) Load 164(radius) + 220: 16(float) CompositeExtract 203 0 + 221: 16(float) CompositeExtract 203 1 + 222: 16(float) CompositeExtract 203 2 + 223: 19(fvec4) CompositeConstruct 219 220 221 222 + 224: 19(fvec4) FAdd 218 223 + 225: 19(fvec4) MatrixTimesVector 217 224 + Store 210(clip1) 225 + 227: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 228 228 12 12 + 226: 162(ptr) AccessChain 191(clip0) 13 + 229: 16(float) Load 226 + 230: 19(fvec4) Load 191(clip0) + 231: 19(fvec4) CompositeConstruct 229 229 229 229 + 232: 19(fvec4) FDiv 230 231 + Store 191(clip0) 232 + 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 235 235 12 12 + 233: 162(ptr) AccessChain 210(clip1) 13 + 236: 16(float) Load 233 + 237: 19(fvec4) Load 210(clip1) + 238: 19(fvec4) CompositeConstruct 236 236 236 236 + 239: 19(fvec4) FDiv 237 238 + Store 210(clip1) 239 + 244: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 245 245 12 12 + 243: 241(ptr) AccessChain 98(ubo) 240 + 246: 66(fvec2) Load 243 + 247: 19(fvec4) Load 191(clip0) + 248: 66(fvec2) VectorShuffle 247 247 0 1 + 249: 66(fvec2) FMul 248 246 + 250: 162(ptr) AccessChain 191(clip0) 12 + 251: 16(float) CompositeExtract 249 0 + Store 250 251 + 252: 162(ptr) AccessChain 191(clip0) 37 + 253: 16(float) CompositeExtract 249 1 + Store 252 253 + 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 256 256 12 12 + 254: 241(ptr) AccessChain 98(ubo) 240 + 257: 66(fvec2) Load 254 + 258: 19(fvec4) Load 210(clip1) + 259: 66(fvec2) VectorShuffle 258 258 0 1 + 260: 66(fvec2) FMul 259 257 + 261: 162(ptr) AccessChain 210(clip1) 12 + 262: 16(float) CompositeExtract 260 0 + Store 261 262 + 263: 162(ptr) AccessChain 210(clip1) 37 + 264: 16(float) CompositeExtract 260 1 + Store 263 264 + 266: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 267 267 12 12 + 265: 19(fvec4) Load 191(clip0) + 268: 19(fvec4) Load 210(clip1) + 269: 16(float) ExtInst 3(GLSL.std.450) 67(Distance) 265 268 + 273: 271(ptr) AccessChain 98(ubo) 270 + 274: 16(float) Load 273 + 275: 16(float) FDiv 269 274 + 277: 271(ptr) AccessChain 98(ubo) 276 + 278: 16(float) Load 277 + 279: 16(float) FMul 275 278 + 282: 16(float) ExtInst 3(GLSL.std.450) 43(FClamp) 279 280 281 + ReturnValue 282 FunctionEnd 53(frustumCheck(): 48(bool) Function None 51 54: Label - 237(pos): 22(ptr) Variable Function - 315(i): 313(ptr) Variable Function - 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 56 - 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 57 57 12 12 - 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 56 53(frustumCheck() - 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 240 240 12 12 - 241: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 238 237(pos) 42 - 270: 125(int) Load 267(gl_InvocationID) - 273: 271(ptr) AccessChain 262(gl_in) 270 141 - 274: 19(fvec4) Load 273 - Store 237(pos) 274 - 291: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 278 278 12 12 - 290: 281 Load 287(samplerHeight) - 301: 299(ptr) AccessChain 296(inUV) 141 - 302: 97(fvec2) Load 301 - 303: 19(fvec4) ImageSampleExplicitLod 290 302 Lod 148 - 304: 16(float) CompositeExtract 303 0 - 306: 217(ptr) AccessChain 122(ubo) 305 - 307: 16(float) Load 306 - 308: 16(float) FMul 304 307 - 309: 73(ptr) AccessChain 237(pos) 37 - 310: 16(float) Load 309 - 311: 16(float) FSub 310 308 - 312: 73(ptr) AccessChain 237(pos) 37 - Store 312 311 - 320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 318 318 12 12 - 319: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 316 315(i) 42 - Store 315(i) 141 - Branch 321 - 321: Label - 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 56 - 326: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 318 318 12 12 - LoopMerge 323 324 None - Branch 327 - 327: Label - 329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 56 - 330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 318 318 12 12 - 328: 125(int) Load 315(i) - 331: 48(bool) SLessThan 328 186 - BranchConditional 331 322 323 - 322: Label - 333: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 56 - 334: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 335 335 12 12 - 332: 19(fvec4) Load 237(pos) - 337: 125(int) Load 315(i) - 340: 338(ptr) AccessChain 122(ubo) 336 337 - 341: 19(fvec4) Load 340 - 342: 16(float) Dot 332 341 - 344: 16(float) FAdd 342 343 - 345: 48(bool) FOrdLessThan 344 148 - SelectionMerge 347 None - BranchConditional 345 346 347 - 346: Label - 351: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 348 - 352: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 349 349 12 12 - ReturnValue 350 - 347: Label - Branch 324 - 324: Label - 355: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 56 - 356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 318 318 12 12 - 354: 125(int) Load 315(i) - 357: 125(int) IAdd 354 128 - Store 315(i) 357 - Branch 321 - 323: Label - 358: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 56 - 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 360 360 12 12 - ReturnValue 94 + 296(pos): 22(ptr) Variable Function + 357(i): 355(ptr) Variable Function + 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 56 + 290: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 57 57 12 12 + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 56 53(frustumCheck() + 295: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 293 293 12 12 + 294: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 292 291 42 + 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 299 299 12 12 + 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 297 296(pos) 42 + 331: 181(int) Load 328(gl_InvocationID) + 334: 332(ptr) AccessChain 323(gl_in) 331 197 + 335: 19(fvec4) Load 334 + Store 296(pos) 335 + 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 338 338 12 12 + 336: 107 Load 113(samplerHeight) + 341: 339(ptr) AccessChain 130(inUV) 197 + 342: 66(fvec2) Load 341 + 343: 19(fvec4) ImageSampleExplicitLod 336 342 Lod 202 + 344: 16(float) CompositeExtract 343 0 + 346: 271(ptr) AccessChain 98(ubo) 345 + 347: 16(float) Load 346 + 348: 16(float) FMul 344 347 + 349: 162(ptr) AccessChain 296(pos) 37 + 350: 16(float) Load 349 + 351: 16(float) FSub 350 348 + 352: 162(ptr) AccessChain 296(pos) 37 + Store 352 351 + 361: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 353 + 362: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 354 354 12 12 + 360: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 358 357(i) 42 + Store 357(i) 197 + Branch 363 + 363: Label + 367: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 353 + 368: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 354 354 12 12 + LoopMerge 365 366 None + Branch 369 + 369: Label + 371: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 353 + 372: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 354 354 12 12 + 370: 181(int) Load 357(i) + 373: 48(bool) SLessThan 370 240 + BranchConditional 373 364 365 + 364: Label + 375: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 353 + 376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 377 377 12 12 + 374: 19(fvec4) Load 296(pos) + 379: 181(int) Load 357(i) + 382: 380(ptr) AccessChain 98(ubo) 378 379 + 383: 19(fvec4) Load 382 + 384: 16(float) Dot 374 383 + 385: 16(float) FAdd 384 291 + 386: 48(bool) FOrdLessThan 385 202 + SelectionMerge 388 None + BranchConditional 386 387 388 + 387: Label + 392: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 389 + 393: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 390 390 12 12 + ReturnValue 391 + 388: Label + Branch 366 + 366: Label + 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 353 + 397: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 354 354 12 12 + 395: 181(int) Load 357(i) + 398: 181(int) IAdd 395 184 + Store 357(i) 398 + Branch 363 + 365: Label + 399: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 56 + 400: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 401 401 12 12 + ReturnValue 63 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.tese.out b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.tese.out index bce85b48a1..04d688e6d3 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.tese.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.tese.out @@ -1,14 +1,14 @@ spv.debuginfo.glsl.tese // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 359 +// Id's are bound by 378 Capability Tessellation Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationEvaluation 14 "main" 47 66 93 116 143 183 300 316 324 337 344 + EntryPoint TessellationEvaluation 14 "main" 95 103 109 115 119 123 127 131 160 260 331 ExecutionMode 14 Quads ExecutionMode 14 SpacingEqual ExecutionMode 14 VertexOrderCw @@ -101,120 +101,124 @@ void main() outEyePos = vec3(ubo.modelview * pos); } " - 29: String "float" - 38: String "uv1" - 49: String "inUV" - 52: String "int" - 68: String "gl_TessCoord" - 77: String "uv2" - 95: String "outUV" - 108: String "n1" - 118: String "inNormal" - 129: String "n2" - 145: String "outNormal" - 160: String "pos1" - 168: String "gl_Position" - 171: String "gl_PointSize" - 174: String "gl_CullDistance" - 178: String "gl_PerVertex" - 185: String "gl_in" - 198: String "pos2" - 212: String "pos" - 224: String "type.2d.image" - 226: String "@type.2d.image" - 230: String "type.sampled.image" - 231: String "@type.sampled.image" - 236: String "displacementMap" - 246: String "bool" - 253: String "modelview" - 257: String "lightPos" - 260: String "frustumPlanes" - 262: String "tessellatedEdgeSize" - 266: String "viewportDim" - 270: String "UBO" - 275: String "ubo" - 302: String "" - 318: String "outViewVec" - 326: String "outLightVec" - 339: String "outWorldPos" - 346: String "outEyePos" + 26: String "float" + 33: String "bool" + 42: String "projection" + 46: String "modelview" + 49: String "lightPos" + 52: String "frustumPlanes" + 54: String "displacementFactor" + 58: String "tessellationFactor" + 61: String "viewportDim" + 64: String "tessellatedEdgeSize" + 67: String "UBO" + 73: String "ubo" + 76: String "texture2D" + 78: String "@texture2D" + 82: String "sampler2D" + 83: String "@sampler2D" + 88: String "displacementMap" + 97: String "inNormal" + 105: String "inUV" + 111: String "outNormal" + 117: String "outUV" + 121: String "outViewVec" + 125: String "outLightVec" + 129: String "outEyePos" + 133: String "outWorldPos" + 142: String "uv1" + 148: String "int" + 162: String "gl_TessCoord" + 171: String "uv2" + 197: String "n1" + 211: String "n2" + 235: String "pos1" + 243: String "gl_Position" + 246: String "gl_PointSize" + 249: String "gl_ClipDistance" + 252: String "gl_CullDistance" + 255: String "gl_PerVertex" + 262: String "gl_in" + 275: String "pos2" + 289: String "pos" + 333: String "" Name 14 "main" - Name 36 "uv1" - Name 47 "inUV" - Name 66 "gl_TessCoord" - Name 75 "uv2" - Name 93 "outUV" - Name 106 "n1" - Name 116 "inNormal" - Name 127 "n2" - Name 143 "outNormal" - Name 158 "pos1" - Name 166 "gl_PerVertex" - MemberName 166(gl_PerVertex) 0 "gl_Position" - MemberName 166(gl_PerVertex) 1 "gl_PointSize" - MemberName 166(gl_PerVertex) 2 "gl_ClipDistance" - MemberName 166(gl_PerVertex) 3 "gl_CullDistance" - Name 183 "gl_in" - Name 196 "pos2" - Name 210 "pos" - Name 234 "displacementMap" - Name 251 "UBO" - MemberName 251(UBO) 0 "projection" - MemberName 251(UBO) 1 "modelview" - MemberName 251(UBO) 2 "lightPos" - MemberName 251(UBO) 3 "frustumPlanes" - MemberName 251(UBO) 4 "displacementFactor" - MemberName 251(UBO) 5 "tessellationFactor" - MemberName 251(UBO) 6 "viewportDim" - MemberName 251(UBO) 7 "tessellatedEdgeSize" - Name 273 "ubo" - Name 288 "gl_PerVertex" - MemberName 288(gl_PerVertex) 0 "gl_Position" - MemberName 288(gl_PerVertex) 1 "gl_PointSize" - MemberName 288(gl_PerVertex) 2 "gl_ClipDistance" - MemberName 288(gl_PerVertex) 3 "gl_CullDistance" - Name 300 "" - Name 316 "outViewVec" - Name 324 "outLightVec" - Name 337 "outWorldPos" - Name 344 "outEyePos" - Decorate 47(inUV) Location 1 - Decorate 66(gl_TessCoord) BuiltIn TessCoord - Decorate 93(outUV) Location 1 - Decorate 116(inNormal) Location 0 - Decorate 143(outNormal) Location 0 - Decorate 166(gl_PerVertex) Block - MemberDecorate 166(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 166(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 166(gl_PerVertex) 2 BuiltIn ClipDistance - MemberDecorate 166(gl_PerVertex) 3 BuiltIn CullDistance - Decorate 234(displacementMap) Binding 1 - Decorate 234(displacementMap) DescriptorSet 0 - Decorate 249 ArrayStride 16 - Decorate 251(UBO) Block - MemberDecorate 251(UBO) 0 ColMajor - MemberDecorate 251(UBO) 0 MatrixStride 16 - MemberDecorate 251(UBO) 0 Offset 0 - MemberDecorate 251(UBO) 1 ColMajor - MemberDecorate 251(UBO) 1 MatrixStride 16 - MemberDecorate 251(UBO) 1 Offset 64 - MemberDecorate 251(UBO) 2 Offset 128 - MemberDecorate 251(UBO) 3 Offset 144 - MemberDecorate 251(UBO) 4 Offset 240 - MemberDecorate 251(UBO) 5 Offset 244 - MemberDecorate 251(UBO) 6 Offset 248 - MemberDecorate 251(UBO) 7 Offset 256 - Decorate 273(ubo) Binding 0 - Decorate 273(ubo) DescriptorSet 0 - Decorate 288(gl_PerVertex) Block - MemberDecorate 288(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 288(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 288(gl_PerVertex) 2 BuiltIn ClipDistance - MemberDecorate 288(gl_PerVertex) 3 BuiltIn CullDistance - Decorate 316(outViewVec) Location 2 - Decorate 324(outLightVec) Location 3 - Decorate 337(outWorldPos) Location 5 - Decorate 344(outEyePos) Location 4 + Name 40 "UBO" + MemberName 40(UBO) 0 "projection" + MemberName 40(UBO) 1 "modelview" + MemberName 40(UBO) 2 "lightPos" + MemberName 40(UBO) 3 "frustumPlanes" + MemberName 40(UBO) 4 "displacementFactor" + MemberName 40(UBO) 5 "tessellationFactor" + MemberName 40(UBO) 6 "viewportDim" + MemberName 40(UBO) 7 "tessellatedEdgeSize" + Name 71 "ubo" + Name 86 "displacementMap" + Name 95 "inNormal" + Name 103 "inUV" + Name 109 "outNormal" + Name 115 "outUV" + Name 119 "outViewVec" + Name 123 "outLightVec" + Name 127 "outEyePos" + Name 131 "outWorldPos" + Name 140 "uv1" + Name 160 "gl_TessCoord" + Name 169 "uv2" + Name 195 "n1" + Name 209 "n2" + Name 233 "pos1" + Name 241 "gl_PerVertex" + MemberName 241(gl_PerVertex) 0 "gl_Position" + MemberName 241(gl_PerVertex) 1 "gl_PointSize" + MemberName 241(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 241(gl_PerVertex) 3 "gl_CullDistance" + Name 260 "gl_in" + Name 273 "pos2" + Name 287 "pos" + Name 318 "gl_PerVertex" + MemberName 318(gl_PerVertex) 0 "gl_Position" + MemberName 318(gl_PerVertex) 1 "gl_PointSize" + MemberName 318(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 318(gl_PerVertex) 3 "gl_CullDistance" + Name 331 "" + Decorate 36 ArrayStride 16 + Decorate 40(UBO) Block + MemberDecorate 40(UBO) 0 ColMajor + MemberDecorate 40(UBO) 0 MatrixStride 16 + MemberDecorate 40(UBO) 0 Offset 0 + MemberDecorate 40(UBO) 1 ColMajor + MemberDecorate 40(UBO) 1 MatrixStride 16 + MemberDecorate 40(UBO) 1 Offset 64 + MemberDecorate 40(UBO) 2 Offset 128 + MemberDecorate 40(UBO) 3 Offset 144 + MemberDecorate 40(UBO) 4 Offset 240 + MemberDecorate 40(UBO) 5 Offset 244 + MemberDecorate 40(UBO) 6 Offset 248 + MemberDecorate 40(UBO) 7 Offset 256 + Decorate 71(ubo) Binding 0 + Decorate 71(ubo) DescriptorSet 0 + Decorate 86(displacementMap) Binding 1 + Decorate 86(displacementMap) DescriptorSet 0 + Decorate 95(inNormal) Location 0 + Decorate 103(inUV) Location 1 + Decorate 109(outNormal) Location 0 + Decorate 115(outUV) Location 1 + Decorate 119(outViewVec) Location 2 + Decorate 123(outLightVec) Location 3 + Decorate 127(outEyePos) Location 4 + Decorate 131(outWorldPos) Location 5 + Decorate 160(gl_TessCoord) BuiltIn TessCoord + Decorate 241(gl_PerVertex) Block + MemberDecorate 241(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 241(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 241(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 241(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 318(gl_PerVertex) Block + MemberDecorate 318(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 318(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 318(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 318(gl_PerVertex) 3 BuiltIn CullDistance 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -231,319 +235,334 @@ void main() 24: 7(int) Constant 2 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 - 28: TypeFloat 32 - 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 29 10 13 12 - 31: TypeVector 28(float) 2 - 32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 30 24 - 33: TypePointer Function 31(fvec2) - 34: 7(int) Constant 7 - 35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 32 34 12 - 39: 7(int) Constant 56 - 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 38 32 18 39 12 17 23 - 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 43: TypeArray 31(fvec2) 10 - 44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 32 10 - 45: TypePointer Input 43 - 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 44 22 12 - 47(inUV): 45(ptr) Variable Input - 50: 7(int) Constant 8 - 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 49 44 18 39 12 21 49 47(inUV) 50 - 51: TypeInt 32 1 - 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 52 10 23 12 - 54: 51(int) Constant 0 - 55: TypePointer Input 31(fvec2) - 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 32 22 12 - 59: 51(int) Constant 1 - 62: TypeVector 28(float) 3 - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 30 13 - 64: TypePointer Input 62(fvec3) - 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 63 22 12 -66(gl_TessCoord): 64(ptr) Variable Input - 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 68 63 18 39 12 21 68 66(gl_TessCoord) 50 - 69: TypePointer Input 28(float) - 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 22 12 - 78: 7(int) Constant 57 - 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 77 32 18 78 12 17 23 - 81: 51(int) Constant 3 - 84: 51(int) Constant 2 - 91: TypePointer Output 31(fvec2) - 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 32 13 12 - 93(outUV): 91(ptr) Variable Output - 96: 7(int) Constant 58 - 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 95 32 18 96 12 21 95 93(outUV) 50 - 104: TypePointer Function 62(fvec3) - 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 63 34 12 - 109: 7(int) Constant 60 - 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 108 63 18 109 12 17 23 - 112: TypeArray 62(fvec3) 10 - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 63 10 - 114: TypePointer Input 112 - 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 113 22 12 - 116(inNormal): 114(ptr) Variable Input - 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 118 113 18 109 12 21 118 116(inNormal) 50 - 130: 7(int) Constant 61 - 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 129 63 18 130 12 17 23 - 141: TypePointer Output 62(fvec3) - 142: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 63 13 12 - 143(outNormal): 141(ptr) Variable Output - 146: 7(int) Constant 62 - 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 145 63 18 146 12 21 145 143(outNormal) 50 - 154: TypeVector 28(float) 4 - 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 30 23 - 156: TypePointer Function 154(fvec4) - 157: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 34 12 - 161: 7(int) Constant 65 - 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 160 155 18 161 12 17 23 - 164: TypeArray 28(float) 22 - 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 30 22 -166(gl_PerVertex): TypeStruct 154(fvec4) 28(float) 164 164 - 169: 7(int) Constant 1756 - 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 168 155 18 22 169 12 12 13 - 172: 7(int) Constant 1774 - 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 171 30 18 22 172 12 12 13 - 175: 7(int) Constant 1817 - 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 174 165 18 22 175 12 12 13 - 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 174 165 18 22 175 12 12 13 - 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 178 22 18 161 12 21 178 12 13 167 170 173 176 - 179: TypeArray 166(gl_PerVertex) 10 - 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 177 10 - 181: TypePointer Input 179 - 182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 180 22 12 - 183(gl_in): 181(ptr) Variable Input - 184: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 185 180 18 161 12 21 185 183(gl_in) 50 - 186: TypePointer Input 154(fvec4) - 187: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 22 12 - 199: 7(int) Constant 66 - 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 198 155 18 199 12 17 23 - 213: 7(int) Constant 67 - 211: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 212 155 18 213 12 17 23 - 222: TypeImage 28(float) 2D sampled format:Unknown - 225: 7(int) Constant 69 - 227: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) - 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 224 12 18 225 12 21 226 227 13 - 228: TypeSampledImage 222 - 229: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 230 12 18 225 12 21 231 227 13 - 232: TypePointer UniformConstant 228 - 233: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 229 12 12 -234(displacementMap): 232(ptr) Variable UniformConstant - 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 236 229 18 225 12 21 236 234(displacementMap) 50 - 240: 28(float) Constant 0 - 243: TypeMatrix 154(fvec4) 4 - 245: TypeBool - 247: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 246 10 24 12 - 248: 245(bool) ConstantTrue - 244: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 155 23 248 - 249: TypeArray 154(fvec4) 11 - 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 155 11 - 251(UBO): TypeStruct 243 243 154(fvec4) 249 28(float) 28(float) 31(fvec2) 28(float) - 254: 7(int) Constant 30 - 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 253 244 18 254 34 12 12 13 - 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 253 244 18 254 34 12 12 13 - 258: 7(int) Constant 31 - 256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 257 155 18 258 34 12 12 13 - 259: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 260 250 18 10 34 12 12 13 - 263: 7(int) Constant 36 - 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 262 30 18 263 50 12 12 13 - 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 262 30 18 263 50 12 12 13 - 267: 7(int) Constant 35 - 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 266 32 18 267 34 12 12 13 - 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 262 30 18 263 50 12 12 13 - 269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 270 22 18 225 12 21 270 12 13 252 255 256 259 261 264 265 268 - 271: TypePointer Uniform 251(UBO) - 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 269 24 12 - 273(ubo): 271(ptr) Variable Uniform - 274: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 275 269 18 225 12 21 275 273(ubo) 50 - 276: 51(int) Constant 4 - 277: TypePointer Uniform 28(float) - 278: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 24 12 - 282: TypePointer Function 28(float) - 283: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 34 12 -288(gl_PerVertex): TypeStruct 154(fvec4) 28(float) 164 164 - 290: 7(int) Constant 165 - 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 168 155 18 22 290 12 12 13 - 292: 7(int) Constant 183 - 291: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 171 30 18 22 292 12 12 13 - 294: 7(int) Constant 226 - 293: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 174 165 18 22 294 12 12 13 - 295: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 174 165 18 22 294 12 12 13 - 297: 7(int) Constant 71 - 296: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 178 22 18 297 12 21 178 12 13 289 291 293 295 - 298: TypePointer Output 288(gl_PerVertex) - 299: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 296 13 12 - 300: 298(ptr) Variable Output - 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 302 296 18 297 12 21 302 300 50 - 303: TypePointer Uniform 243 - 304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 244 24 12 - 313: TypePointer Output 154(fvec4) - 314: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 13 12 - 316(outViewVec): 141(ptr) Variable Output - 319: 7(int) Constant 74 - 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 318 63 18 319 12 21 318 316(outViewVec) 50 -324(outLightVec): 141(ptr) Variable Output - 327: 7(int) Constant 75 - 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 326 63 18 327 12 21 326 324(outLightVec) 50 - 328: TypePointer Uniform 154(fvec4) - 329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 24 12 -337(outWorldPos): 141(ptr) Variable Output - 340: 7(int) Constant 76 - 338: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 339 63 18 340 12 21 339 337(outWorldPos) 50 - 344(outEyePos): 141(ptr) Variable Output - 347: 7(int) Constant 77 - 345: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 346 63 18 347 12 21 346 344(outEyePos) 50 - 358: 7(int) Constant 78 + 25: TypeFloat 32 + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 13 12 + 28: TypeVector 25(float) 4 + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 23 + 30: TypeMatrix 28(fvec4) 4 + 32: TypeBool + 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 33 10 24 12 + 35: 32(bool) ConstantTrue + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 29 23 35 + 36: TypeArray 28(fvec4) 11 + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 29 11 + 38: TypeVector 25(float) 2 + 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 24 + 40(UBO): TypeStruct 30 30 28(fvec4) 36 25(float) 25(float) 38(fvec2) 25(float) + 43: 7(int) Constant 29 + 44: 7(int) Constant 7 + 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 42 31 18 43 44 12 12 13 + 47: 7(int) Constant 30 + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 46 31 18 47 44 12 12 13 + 50: 7(int) Constant 31 + 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 49 29 18 50 44 12 12 13 + 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 52 37 18 10 44 12 12 13 + 55: 7(int) Constant 33 + 56: 7(int) Constant 8 + 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 54 27 18 55 56 12 12 13 + 59: 7(int) Constant 34 + 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 58 27 18 59 56 12 12 13 + 62: 7(int) Constant 35 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 61 39 18 62 44 12 12 13 + 65: 7(int) Constant 36 + 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 64 27 18 65 56 12 12 13 + 68: 7(int) Constant 27 + 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 67 22 18 68 12 21 67 12 13 41 45 48 51 53 57 60 63 + 69: TypePointer Uniform 40(UBO) + 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 66 24 12 + 71(ubo): 69(ptr) Variable Uniform + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 73 66 18 68 12 21 73 71(ubo) 56 + 74: TypeImage 25(float) 2D sampled format:Unknown + 77: 7(int) Constant 39 + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 76 22 18 77 12 21 78 79 13 + 80: TypeSampledImage 74 + 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 82 22 18 77 12 21 83 79 13 + 84: TypePointer UniformConstant 80 + 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 81 12 12 +86(displacementMap): 84(ptr) Variable UniformConstant + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 88 81 18 77 12 21 88 86(displacementMap) 56 + 89: TypeVector 25(float) 3 + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 13 + 91: TypeArray 89(fvec3) 10 + 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 90 10 + 93: TypePointer Input 91 + 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 92 22 12 + 95(inNormal): 93(ptr) Variable Input + 98: 7(int) Constant 43 + 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 97 92 18 98 12 21 97 95(inNormal) 56 + 99: TypeArray 38(fvec2) 10 + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 39 10 + 101: TypePointer Input 99 + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 100 22 12 + 103(inUV): 101(ptr) Variable Input + 106: 7(int) Constant 44 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 105 100 18 106 12 21 105 103(inUV) 56 + 107: TypePointer Output 89(fvec3) + 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 90 13 12 + 109(outNormal): 107(ptr) Variable Output + 112: 7(int) Constant 46 + 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 111 90 18 112 12 21 111 109(outNormal) 56 + 113: TypePointer Output 38(fvec2) + 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 39 13 12 + 115(outUV): 113(ptr) Variable Output + 118: 7(int) Constant 47 + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 117 39 18 118 12 21 117 115(outUV) 56 + 119(outViewVec): 107(ptr) Variable Output + 122: 7(int) Constant 48 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 121 90 18 122 12 21 121 119(outViewVec) 56 +123(outLightVec): 107(ptr) Variable Output + 126: 7(int) Constant 49 + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 125 90 18 126 12 21 125 123(outLightVec) 56 + 127(outEyePos): 107(ptr) Variable Output + 130: 7(int) Constant 50 + 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 129 90 18 130 12 21 129 127(outEyePos) 56 +131(outWorldPos): 107(ptr) Variable Output + 134: 7(int) Constant 51 + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 133 90 18 134 12 21 133 131(outWorldPos) 56 + 138: TypePointer Function 38(fvec2) + 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 39 44 12 + 143: 7(int) Constant 56 + 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 142 39 18 143 12 17 23 + 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 147: TypeInt 32 1 + 149: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 148 10 23 12 + 150: 147(int) Constant 0 + 151: TypePointer Input 38(fvec2) + 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 39 22 12 + 155: 147(int) Constant 1 + 158: TypePointer Input 89(fvec3) + 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 90 22 12 +160(gl_TessCoord): 158(ptr) Variable Input + 161: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 162 90 18 143 12 21 162 160(gl_TessCoord) 56 + 163: TypePointer Input 25(float) + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 22 12 + 172: 7(int) Constant 57 + 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 171 39 18 172 12 17 23 + 175: 147(int) Constant 3 + 178: 147(int) Constant 2 + 187: 7(int) Constant 58 + 193: TypePointer Function 89(fvec3) + 194: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 90 44 12 + 198: 7(int) Constant 60 + 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 197 90 18 198 12 17 23 + 212: 7(int) Constant 61 + 210: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 211 90 18 212 12 17 23 + 225: 7(int) Constant 62 + 231: TypePointer Function 28(fvec4) + 232: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 44 12 + 236: 7(int) Constant 65 + 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 235 29 18 236 12 17 23 + 239: TypeArray 25(float) 22 + 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 27 22 +241(gl_PerVertex): TypeStruct 28(fvec4) 25(float) 239 239 + 244: 7(int) Constant 1756 + 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 243 29 18 22 244 12 12 13 + 247: 7(int) Constant 1774 + 245: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 246 27 18 22 247 12 12 13 + 250: 7(int) Constant 1793 + 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 249 240 18 22 250 12 12 13 + 253: 7(int) Constant 1817 + 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 252 240 18 22 253 12 12 13 + 254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 255 22 18 236 12 21 255 12 13 242 245 248 251 + 256: TypeArray 241(gl_PerVertex) 10 + 257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 254 10 + 258: TypePointer Input 256 + 259: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 257 22 12 + 260(gl_in): 258(ptr) Variable Input + 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 262 257 18 236 12 21 262 260(gl_in) 56 + 263: TypePointer Input 28(fvec4) + 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 22 12 + 276: 7(int) Constant 66 + 274: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 275 29 18 276 12 17 23 + 290: 7(int) Constant 67 + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 289 29 18 290 12 17 23 + 301: 7(int) Constant 69 + 303: 25(float) Constant 0 + 306: 147(int) Constant 4 + 307: TypePointer Uniform 25(float) + 308: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 24 12 + 312: TypePointer Function 25(float) + 313: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 44 12 +318(gl_PerVertex): TypeStruct 28(fvec4) 25(float) 239 239 + 320: 7(int) Constant 165 + 319: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 243 29 18 22 320 12 12 13 + 322: 7(int) Constant 183 + 321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 246 27 18 22 322 12 12 13 + 324: 7(int) Constant 202 + 323: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 249 240 18 22 324 12 12 13 + 326: 7(int) Constant 226 + 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 252 240 18 22 326 12 12 13 + 328: 7(int) Constant 71 + 327: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 255 22 18 328 12 21 255 12 13 319 321 323 325 + 329: TypePointer Output 318(gl_PerVertex) + 330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 327 13 12 + 331: 329(ptr) Variable Output + 332: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 333 327 18 328 12 21 333 331 56 + 334: TypePointer Uniform 30 + 335: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 31 24 12 + 344: TypePointer Output 28(fvec4) + 345: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 13 12 + 349: 7(int) Constant 74 + 352: TypePointer Uniform 28(fvec4) + 353: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 24 12 + 356: 7(int) Constant 75 + 364: 7(int) Constant 76 + 368: 7(int) Constant 77 + 377: 7(int) Constant 78 14(main): 4 Function None 5 15: Label - 36(uv1): 33(ptr) Variable Function - 75(uv2): 33(ptr) Variable Function - 106(n1): 104(ptr) Variable Function - 127(n2): 104(ptr) Variable Function - 158(pos1): 156(ptr) Variable Function - 196(pos2): 156(ptr) Variable Function - 210(pos): 156(ptr) Variable Function - 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 - 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 39 39 12 12 - 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 37 36(uv1) 41 - 57: 55(ptr) AccessChain 47(inUV) 54 - 58: 31(fvec2) Load 57 - 60: 55(ptr) AccessChain 47(inUV) 59 - 61: 31(fvec2) Load 60 - 71: 69(ptr) AccessChain 66(gl_TessCoord) 12 - 72: 28(float) Load 71 - 73: 31(fvec2) CompositeConstruct 72 72 - 74: 31(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 58 61 73 - Store 36(uv1) 74 - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 78 78 12 12 - 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 76 75(uv2) 41 - 82: 55(ptr) AccessChain 47(inUV) 81 - 83: 31(fvec2) Load 82 - 85: 55(ptr) AccessChain 47(inUV) 84 - 86: 31(fvec2) Load 85 - 87: 69(ptr) AccessChain 66(gl_TessCoord) 12 - 88: 28(float) Load 87 - 89: 31(fvec2) CompositeConstruct 88 88 - 90: 31(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 83 86 89 - Store 75(uv2) 90 - 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 96 96 12 12 - 97: 31(fvec2) Load 36(uv1) - 99: 31(fvec2) Load 75(uv2) - 100: 69(ptr) AccessChain 66(gl_TessCoord) 22 - 101: 28(float) Load 100 - 102: 31(fvec2) CompositeConstruct 101 101 - 103: 31(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 97 99 102 - Store 93(outUV) 103 - 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 109 109 12 12 - 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 107 106(n1) 41 - 119: 64(ptr) AccessChain 116(inNormal) 54 - 120: 62(fvec3) Load 119 - 121: 64(ptr) AccessChain 116(inNormal) 59 - 122: 62(fvec3) Load 121 - 123: 69(ptr) AccessChain 66(gl_TessCoord) 12 - 124: 28(float) Load 123 - 125: 62(fvec3) CompositeConstruct 124 124 124 - 126: 62(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 120 122 125 - Store 106(n1) 126 - 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 130 130 12 12 - 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 128 127(n2) 41 - 133: 64(ptr) AccessChain 116(inNormal) 81 - 134: 62(fvec3) Load 133 - 135: 64(ptr) AccessChain 116(inNormal) 84 - 136: 62(fvec3) Load 135 - 137: 69(ptr) AccessChain 66(gl_TessCoord) 12 - 138: 28(float) Load 137 - 139: 62(fvec3) CompositeConstruct 138 138 138 - 140: 62(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 134 136 139 - Store 127(n2) 140 - 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 146 146 12 12 - 147: 62(fvec3) Load 106(n1) - 149: 62(fvec3) Load 127(n2) - 150: 69(ptr) AccessChain 66(gl_TessCoord) 22 - 151: 28(float) Load 150 - 152: 62(fvec3) CompositeConstruct 151 151 151 - 153: 62(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 147 149 152 - Store 143(outNormal) 153 - 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 161 161 12 12 - 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 159 158(pos1) 41 - 188: 186(ptr) AccessChain 183(gl_in) 54 54 - 189: 154(fvec4) Load 188 - 190: 186(ptr) AccessChain 183(gl_in) 59 54 - 191: 154(fvec4) Load 190 - 192: 69(ptr) AccessChain 66(gl_TessCoord) 12 - 193: 28(float) Load 192 - 194: 154(fvec4) CompositeConstruct 193 193 193 193 - 195: 154(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 189 191 194 - Store 158(pos1) 195 - 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 199 199 12 12 - 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 197 196(pos2) 41 - 202: 186(ptr) AccessChain 183(gl_in) 81 54 - 203: 154(fvec4) Load 202 - 204: 186(ptr) AccessChain 183(gl_in) 84 54 - 205: 154(fvec4) Load 204 - 206: 69(ptr) AccessChain 66(gl_TessCoord) 12 - 207: 28(float) Load 206 - 208: 154(fvec4) CompositeConstruct 207 207 207 207 - 209: 154(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 203 205 208 - Store 196(pos2) 209 - 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 213 213 12 12 - 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 211 210(pos) 41 - 216: 154(fvec4) Load 158(pos1) - 217: 154(fvec4) Load 196(pos2) - 218: 69(ptr) AccessChain 66(gl_TessCoord) 22 - 219: 28(float) Load 218 - 220: 154(fvec4) CompositeConstruct 219 219 219 219 - 221: 154(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 216 217 220 - Store 210(pos) 221 - 238: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 225 225 12 12 - 237: 228 Load 234(displacementMap) - 239: 31(fvec2) Load 93(outUV) - 241: 154(fvec4) ImageSampleExplicitLod 237 239 Lod 240 - 242: 28(float) CompositeExtract 241 0 - 279: 277(ptr) AccessChain 273(ubo) 276 - 280: 28(float) Load 279 - 281: 28(float) FMul 242 280 - 284: 282(ptr) AccessChain 210(pos) 22 - 285: 28(float) Load 284 - 286: 28(float) FSub 285 281 - 287: 282(ptr) AccessChain 210(pos) 22 - Store 287 286 - 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12 - 305: 303(ptr) AccessChain 273(ubo) 54 - 307: 243 Load 305 - 308: 303(ptr) AccessChain 273(ubo) 59 - 309: 243 Load 308 - 310: 243 MatrixTimesMatrix 307 309 - 311: 154(fvec4) Load 210(pos) - 312: 154(fvec4) MatrixTimesVector 310 311 - 315: 313(ptr) AccessChain 300 54 - Store 315 312 - 321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 319 319 12 12 - 320: 154(fvec4) Load 210(pos) - 322: 62(fvec3) VectorShuffle 320 320 0 1 2 - 323: 62(fvec3) FNegate 322 - Store 316(outViewVec) 323 - 331: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 327 327 12 12 - 330: 328(ptr) AccessChain 273(ubo) 84 - 332: 154(fvec4) Load 330 - 333: 62(fvec3) VectorShuffle 332 332 0 1 2 - 334: 62(fvec3) Load 316(outViewVec) - 335: 62(fvec3) FAdd 333 334 - 336: 62(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 335 - Store 324(outLightVec) 336 - 342: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 340 340 12 12 - 341: 154(fvec4) Load 210(pos) - 343: 62(fvec3) VectorShuffle 341 341 0 1 2 - Store 337(outWorldPos) 343 - 349: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 347 347 12 12 - 348: 303(ptr) AccessChain 273(ubo) 59 - 350: 243 Load 348 - 351: 154(fvec4) Load 210(pos) - 352: 154(fvec4) MatrixTimesVector 350 351 - 353: 28(float) CompositeExtract 352 0 - 354: 28(float) CompositeExtract 352 1 - 355: 28(float) CompositeExtract 352 2 - 356: 62(fvec3) CompositeConstruct 353 354 355 - Store 344(outEyePos) 356 - 357: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 358 358 12 12 + 140(uv1): 138(ptr) Variable Function + 169(uv2): 138(ptr) Variable Function + 195(n1): 193(ptr) Variable Function + 209(n2): 193(ptr) Variable Function + 233(pos1): 231(ptr) Variable Function + 273(pos2): 231(ptr) Variable Function + 287(pos): 231(ptr) Variable Function + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 137: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 143 143 12 12 + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 141 140(uv1) 145 + 153: 151(ptr) AccessChain 103(inUV) 150 + 154: 38(fvec2) Load 153 + 156: 151(ptr) AccessChain 103(inUV) 155 + 157: 38(fvec2) Load 156 + 165: 163(ptr) AccessChain 160(gl_TessCoord) 12 + 166: 25(float) Load 165 + 167: 38(fvec2) CompositeConstruct 166 166 + 168: 38(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 154 157 167 + Store 140(uv1) 168 + 174: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 172 172 12 12 + 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 170 169(uv2) 145 + 176: 151(ptr) AccessChain 103(inUV) 175 + 177: 38(fvec2) Load 176 + 179: 151(ptr) AccessChain 103(inUV) 178 + 180: 38(fvec2) Load 179 + 181: 163(ptr) AccessChain 160(gl_TessCoord) 12 + 182: 25(float) Load 181 + 183: 38(fvec2) CompositeConstruct 182 182 + 184: 38(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 177 180 183 + Store 169(uv2) 184 + 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 187 187 12 12 + 185: 38(fvec2) Load 140(uv1) + 188: 38(fvec2) Load 169(uv2) + 189: 163(ptr) AccessChain 160(gl_TessCoord) 22 + 190: 25(float) Load 189 + 191: 38(fvec2) CompositeConstruct 190 190 + 192: 38(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 185 188 191 + Store 115(outUV) 192 + 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 198 198 12 12 + 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 196 195(n1) 145 + 201: 158(ptr) AccessChain 95(inNormal) 150 + 202: 89(fvec3) Load 201 + 203: 158(ptr) AccessChain 95(inNormal) 155 + 204: 89(fvec3) Load 203 + 205: 163(ptr) AccessChain 160(gl_TessCoord) 12 + 206: 25(float) Load 205 + 207: 89(fvec3) CompositeConstruct 206 206 206 + 208: 89(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 202 204 207 + Store 195(n1) 208 + 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 212 212 12 12 + 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 210 209(n2) 145 + 215: 158(ptr) AccessChain 95(inNormal) 175 + 216: 89(fvec3) Load 215 + 217: 158(ptr) AccessChain 95(inNormal) 178 + 218: 89(fvec3) Load 217 + 219: 163(ptr) AccessChain 160(gl_TessCoord) 12 + 220: 25(float) Load 219 + 221: 89(fvec3) CompositeConstruct 220 220 220 + 222: 89(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 216 218 221 + Store 209(n2) 222 + 224: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 225 225 12 12 + 223: 89(fvec3) Load 195(n1) + 226: 89(fvec3) Load 209(n2) + 227: 163(ptr) AccessChain 160(gl_TessCoord) 22 + 228: 25(float) Load 227 + 229: 89(fvec3) CompositeConstruct 228 228 228 + 230: 89(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 223 226 229 + Store 109(outNormal) 230 + 238: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 236 236 12 12 + 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 234 233(pos1) 145 + 265: 263(ptr) AccessChain 260(gl_in) 150 150 + 266: 28(fvec4) Load 265 + 267: 263(ptr) AccessChain 260(gl_in) 155 150 + 268: 28(fvec4) Load 267 + 269: 163(ptr) AccessChain 160(gl_TessCoord) 12 + 270: 25(float) Load 269 + 271: 28(fvec4) CompositeConstruct 270 270 270 270 + 272: 28(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 266 268 271 + Store 233(pos1) 272 + 278: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 276 276 12 12 + 277: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 274 273(pos2) 145 + 279: 263(ptr) AccessChain 260(gl_in) 175 150 + 280: 28(fvec4) Load 279 + 281: 263(ptr) AccessChain 260(gl_in) 178 150 + 282: 28(fvec4) Load 281 + 283: 163(ptr) AccessChain 160(gl_TessCoord) 12 + 284: 25(float) Load 283 + 285: 28(fvec4) CompositeConstruct 284 284 284 284 + 286: 28(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 280 282 285 + Store 273(pos2) 286 + 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 290 290 12 12 + 291: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 288 287(pos) 145 + 293: 28(fvec4) Load 233(pos1) + 294: 28(fvec4) Load 273(pos2) + 295: 163(ptr) AccessChain 160(gl_TessCoord) 22 + 296: 25(float) Load 295 + 297: 28(fvec4) CompositeConstruct 296 296 296 296 + 298: 28(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 293 294 297 + Store 287(pos) 298 + 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 301 301 12 12 + 299: 80 Load 86(displacementMap) + 302: 38(fvec2) Load 115(outUV) + 304: 28(fvec4) ImageSampleExplicitLod 299 302 Lod 303 + 305: 25(float) CompositeExtract 304 0 + 309: 307(ptr) AccessChain 71(ubo) 306 + 310: 25(float) Load 309 + 311: 25(float) FMul 305 310 + 314: 312(ptr) AccessChain 287(pos) 22 + 315: 25(float) Load 314 + 316: 25(float) FSub 315 311 + 317: 312(ptr) AccessChain 287(pos) 22 + Store 317 316 + 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 328 328 12 12 + 336: 334(ptr) AccessChain 71(ubo) 150 + 338: 30 Load 336 + 339: 334(ptr) AccessChain 71(ubo) 155 + 340: 30 Load 339 + 341: 30 MatrixTimesMatrix 338 340 + 342: 28(fvec4) Load 287(pos) + 343: 28(fvec4) MatrixTimesVector 341 342 + 346: 344(ptr) AccessChain 331 150 + Store 346 343 + 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 349 349 12 12 + 347: 28(fvec4) Load 287(pos) + 350: 89(fvec3) VectorShuffle 347 347 0 1 2 + 351: 89(fvec3) FNegate 350 + Store 119(outViewVec) 351 + 355: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 356 356 12 12 + 354: 352(ptr) AccessChain 71(ubo) 178 + 357: 28(fvec4) Load 354 + 358: 89(fvec3) VectorShuffle 357 357 0 1 2 + 359: 89(fvec3) Load 119(outViewVec) + 360: 89(fvec3) FAdd 358 359 + 361: 89(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 360 + Store 123(outLightVec) 361 + 363: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 364 364 12 12 + 362: 28(fvec4) Load 287(pos) + 365: 89(fvec3) VectorShuffle 362 362 0 1 2 + Store 131(outWorldPos) 365 + 367: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 368 368 12 12 + 366: 334(ptr) AccessChain 71(ubo) 155 + 369: 30 Load 366 + 370: 28(fvec4) Load 287(pos) + 371: 28(fvec4) MatrixTimesVector 369 370 + 372: 25(float) CompositeExtract 371 0 + 373: 25(float) CompositeExtract 371 1 + 374: 25(float) CompositeExtract 371 2 + 375: 89(fvec3) CompositeConstruct 372 373 374 + Store 127(outEyePos) 375 + 376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 377 377 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.vert.out b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.vert.out index 9eef2dd2df..da470fe3a1 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.vert.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.glsl.vert.out @@ -1,14 +1,14 @@ spv.debuginfo.glsl.vert // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 447 +// Id's are bound by 471 Capability Shader Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 14 "main" 35 42 47 55 65 83 305 323 328 353 371 390 428 437 + EntryPoint Vertex 14 "main" 32 37 45 49 53 57 63 72 111 115 119 123 127 389 2: String "spv.debuginfo.glsl.vert" 8: String "uint" 16: String "main" @@ -125,109 +125,112 @@ void main() outViewVec = -pos.xyz; } " - 29: String "float" - 37: String "outColor" - 44: String "inColor" - 49: String "outUV" - 57: String "inUV" - 61: String "int" - 67: String "instanceTexIndex" - 78: String "s" - 85: String "instanceRot" - 95: String "bool" - 100: String "modelview" - 104: String "lightPos" - 107: String "globSpeed" - 111: String "UBO" - 116: String "ubo" - 126: String "c" - 142: String "mx" - 186: String "my" - 223: String "mz" - 244: String "rotMat" - 274: String "gRotMat" - 301: String "locPos" - 307: String "inPos" - 317: String "pos" - 325: String "instanceScale" - 330: String "instancePos" - 341: String "gl_Position" - 344: String "gl_PointSize" - 346: String "gl_CullDistance" - 349: String "gl_PerVertex" - 355: String "" - 373: String "outNormal" - 392: String "inNormal" - 409: String "lPos" - 430: String "outLightVec" - 439: String "outViewVec" + 26: String "float" + 34: String "inPos" + 39: String "inNormal" + 47: String "inUV" + 51: String "inColor" + 55: String "instancePos" + 59: String "instanceRot" + 65: String "instanceScale" + 68: String "int" + 74: String "instanceTexIndex" + 81: String "bool" + 86: String "projection" + 90: String "modelview" + 93: String "lightPos" + 96: String "locSpeed" + 99: String "globSpeed" + 102: String "UBO" + 108: String "ubo" + 113: String "outNormal" + 117: String "outColor" + 121: String "outUV" + 125: String "outViewVec" + 129: String "outLightVec" + 151: String "mx" + 158: String "my" + 162: String "mz" + 168: String "s" + 183: String "c" + 285: String "rotMat" + 298: String "gRotMat" + 344: String "locPos" + 357: String "pos" + 375: String "gl_Position" + 378: String "gl_PointSize" + 380: String "gl_ClipDistance" + 383: String "gl_CullDistance" + 385: String "gl_PerVertex" + 391: String "" + 439: String "lPos" Name 14 "main" - Name 35 "outColor" - Name 42 "inColor" - Name 47 "outUV" - Name 55 "inUV" - Name 65 "instanceTexIndex" - Name 76 "s" - Name 83 "instanceRot" - Name 98 "UBO" - MemberName 98(UBO) 0 "projection" - MemberName 98(UBO) 1 "modelview" - MemberName 98(UBO) 2 "lightPos" - MemberName 98(UBO) 3 "locSpeed" - MemberName 98(UBO) 4 "globSpeed" - Name 114 "ubo" - Name 124 "c" - Name 140 "mx" - Name 184 "my" - Name 221 "mz" - Name 242 "rotMat" - Name 272 "gRotMat" - Name 299 "locPos" - Name 305 "inPos" - Name 315 "pos" - Name 323 "instanceScale" - Name 328 "instancePos" - Name 339 "gl_PerVertex" - MemberName 339(gl_PerVertex) 0 "gl_Position" - MemberName 339(gl_PerVertex) 1 "gl_PointSize" - MemberName 339(gl_PerVertex) 2 "gl_ClipDistance" - MemberName 339(gl_PerVertex) 3 "gl_CullDistance" - Name 353 "" - Name 371 "outNormal" - Name 390 "inNormal" - Name 407 "lPos" - Name 428 "outLightVec" - Name 437 "outViewVec" - Decorate 35(outColor) Location 1 - Decorate 42(inColor) Location 3 - Decorate 47(outUV) Location 2 - Decorate 55(inUV) Location 2 - Decorate 65(instanceTexIndex) Location 7 - Decorate 83(instanceRot) Location 5 - Decorate 98(UBO) Block - MemberDecorate 98(UBO) 0 ColMajor - MemberDecorate 98(UBO) 0 MatrixStride 16 - MemberDecorate 98(UBO) 0 Offset 0 - MemberDecorate 98(UBO) 1 ColMajor - MemberDecorate 98(UBO) 1 MatrixStride 16 - MemberDecorate 98(UBO) 1 Offset 64 - MemberDecorate 98(UBO) 2 Offset 128 - MemberDecorate 98(UBO) 3 Offset 144 - MemberDecorate 98(UBO) 4 Offset 148 - Decorate 114(ubo) Binding 0 - Decorate 114(ubo) DescriptorSet 0 - Decorate 305(inPos) Location 0 - Decorate 323(instanceScale) Location 6 - Decorate 328(instancePos) Location 4 - Decorate 339(gl_PerVertex) Block - MemberDecorate 339(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 339(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 339(gl_PerVertex) 2 BuiltIn ClipDistance - MemberDecorate 339(gl_PerVertex) 3 BuiltIn CullDistance - Decorate 371(outNormal) Location 0 - Decorate 390(inNormal) Location 1 - Decorate 428(outLightVec) Location 4 - Decorate 437(outViewVec) Location 3 + Name 32 "inPos" + Name 37 "inNormal" + Name 45 "inUV" + Name 49 "inColor" + Name 53 "instancePos" + Name 57 "instanceRot" + Name 63 "instanceScale" + Name 72 "instanceTexIndex" + Name 84 "UBO" + MemberName 84(UBO) 0 "projection" + MemberName 84(UBO) 1 "modelview" + MemberName 84(UBO) 2 "lightPos" + MemberName 84(UBO) 3 "locSpeed" + MemberName 84(UBO) 4 "globSpeed" + Name 106 "ubo" + Name 111 "outNormal" + Name 115 "outColor" + Name 119 "outUV" + Name 123 "outViewVec" + Name 127 "outLightVec" + Name 149 "mx" + Name 156 "my" + Name 160 "mz" + Name 166 "s" + Name 181 "c" + Name 283 "rotMat" + Name 296 "gRotMat" + Name 342 "locPos" + Name 355 "pos" + Name 373 "gl_PerVertex" + MemberName 373(gl_PerVertex) 0 "gl_Position" + MemberName 373(gl_PerVertex) 1 "gl_PointSize" + MemberName 373(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 373(gl_PerVertex) 3 "gl_CullDistance" + Name 389 "" + Name 437 "lPos" + Decorate 32(inPos) Location 0 + Decorate 37(inNormal) Location 1 + Decorate 45(inUV) Location 2 + Decorate 49(inColor) Location 3 + Decorate 53(instancePos) Location 4 + Decorate 57(instanceRot) Location 5 + Decorate 63(instanceScale) Location 6 + Decorate 72(instanceTexIndex) Location 7 + Decorate 84(UBO) Block + MemberDecorate 84(UBO) 0 ColMajor + MemberDecorate 84(UBO) 0 MatrixStride 16 + MemberDecorate 84(UBO) 0 Offset 0 + MemberDecorate 84(UBO) 1 ColMajor + MemberDecorate 84(UBO) 1 MatrixStride 16 + MemberDecorate 84(UBO) 1 Offset 64 + MemberDecorate 84(UBO) 2 Offset 128 + MemberDecorate 84(UBO) 3 Offset 144 + MemberDecorate 84(UBO) 4 Offset 148 + Decorate 106(ubo) Binding 0 + Decorate 106(ubo) DescriptorSet 0 + Decorate 111(outNormal) Location 0 + Decorate 115(outColor) Location 1 + Decorate 119(outUV) Location 2 + Decorate 123(outViewVec) Location 3 + Decorate 127(outLightVec) Location 4 + Decorate 373(gl_PerVertex) Block + MemberDecorate 373(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 373(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 373(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 373(gl_PerVertex) 3 BuiltIn CullDistance 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -244,425 +247,446 @@ void main() 24: 7(int) Constant 2 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 - 28: TypeFloat 32 - 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 29 10 13 12 - 31: TypeVector 28(float) 3 - 32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 30 13 - 33: TypePointer Output 31(fvec3) - 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 32 13 12 - 35(outColor): 33(ptr) Variable Output - 38: 7(int) Constant 56 - 39: 7(int) Constant 8 - 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 37 32 18 38 12 21 37 35(outColor) 39 - 40: TypePointer Input 31(fvec3) - 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 32 22 12 - 42(inColor): 40(ptr) Variable Input - 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 44 32 18 38 12 21 44 42(inColor) 39 - 47(outUV): 33(ptr) Variable Output - 50: 7(int) Constant 57 - 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 49 32 18 50 12 21 49 47(outUV) 39 - 51: TypeVector 28(float) 2 - 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 30 24 - 53: TypePointer Input 51(fvec2) - 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 52 22 12 - 55(inUV): 53(ptr) Variable Input - 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 57 52 18 50 12 21 57 55(inUV) 39 - 60: TypeInt 32 1 - 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 61 10 23 12 - 63: TypePointer Input 60(int) - 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 62 22 12 -65(instanceTexIndex): 63(ptr) Variable Input - 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 67 62 18 50 12 21 67 65(instanceTexIndex) 39 - 73: TypePointer Function 28(float) - 74: 7(int) Constant 7 - 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 74 12 - 79: 7(int) Constant 62 - 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 78 30 18 79 12 17 23 - 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 83(instanceRot): 40(ptr) Variable Input - 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 85 32 18 79 12 21 85 83(instanceRot) 39 - 86: TypePointer Input 28(float) - 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 22 12 - 90: TypeVector 28(float) 4 - 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 30 23 - 92: TypeMatrix 90(fvec4) 4 - 94: TypeBool - 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 95 10 24 12 - 97: 94(bool) ConstantTrue - 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 91 23 97 - 98(UBO): TypeStruct 92 92 90(fvec4) 28(float) 28(float) - 101: 7(int) Constant 42 - 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 100 93 18 101 74 12 12 13 - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 100 93 18 101 74 12 12 13 - 105: 7(int) Constant 43 - 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 104 91 18 105 74 12 12 13 - 108: 7(int) Constant 45 - 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 107 30 18 108 39 12 12 13 - 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 107 30 18 108 39 12 12 13 - 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 111 22 18 79 12 21 111 12 13 99 102 103 106 109 - 112: TypePointer Uniform 98(UBO) - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 110 24 12 - 114(ubo): 112(ptr) Variable Uniform - 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 116 110 18 79 12 21 116 114(ubo) 39 - 117: 60(int) Constant 3 - 118: TypePointer Uniform 28(float) - 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 24 12 - 127: 7(int) Constant 63 - 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 126 30 18 127 12 17 23 - 136: TypeMatrix 31(fvec3) 3 - 137: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 32 13 97 - 138: TypePointer Function 136 - 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 137 74 12 - 143: 7(int) Constant 65 - 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 142 137 18 143 12 17 23 - 146: 60(int) Constant 0 - 149: 28(float) Constant 0 - 151: TypePointer Function 31(fvec3) - 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 32 74 12 - 154: 60(int) Constant 1 - 157: 7(int) Constant 66 - 162: 60(int) Constant 2 - 163: 28(float) Constant 1065353216 - 164: 31(fvec3) ConstantComposite 149 149 163 - 167: 7(int) Constant 67 - 170: 7(int) Constant 70 - 178: 7(int) Constant 71 - 187: 7(int) Constant 73 - 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 186 137 18 187 12 17 23 - 194: 31(fvec3) ConstantComposite 149 163 149 - 197: 7(int) Constant 74 - 200: 7(int) Constant 75 - 207: 7(int) Constant 78 - 215: 7(int) Constant 79 - 224: 7(int) Constant 81 - 222: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 223 137 18 224 12 17 23 - 227: 31(fvec3) ConstantComposite 163 149 149 - 231: 7(int) Constant 82 - 237: 7(int) Constant 83 - 245: 7(int) Constant 85 - 243: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 244 137 18 245 12 17 23 - 255: 7(int) Constant 88 - 257: 60(int) Constant 4 - 264: 7(int) Constant 89 - 270: TypePointer Function 92 - 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 74 12 - 275: 7(int) Constant 90 - 273: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 274 93 18 275 12 17 23 - 281: TypePointer Function 90(fvec4) - 282: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 74 12 - 284: 90(fvec4) ConstantComposite 149 163 149 149 - 287: 7(int) Constant 91 - 290: 7(int) Constant 92 - 295: 90(fvec4) ConstantComposite 149 149 149 163 - 298: 7(int) Constant 93 - 302: 7(int) Constant 95 - 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 301 91 18 302 12 17 23 - 305(inPos): 40(ptr) Variable Input - 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 307 32 18 302 12 21 307 305(inPos) 39 - 318: 7(int) Constant 96 - 316: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 317 91 18 318 12 17 23 -323(instanceScale): 86(ptr) Variable Input - 324: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 325 30 18 318 12 21 325 323(instanceScale) 39 -328(instancePos): 40(ptr) Variable Input - 329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 330 32 18 318 12 21 330 328(instancePos) 39 - 337: TypeArray 28(float) 22 - 338: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 30 22 -339(gl_PerVertex): TypeStruct 90(fvec4) 28(float) 337 337 - 342: 7(int) Constant 24 - 340: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 341 91 18 22 342 12 12 13 - 343: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 344 30 18 22 101 12 12 13 - 345: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 346 338 18 22 245 12 12 13 - 347: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 346 338 18 22 245 12 12 13 - 350: 7(int) Constant 98 - 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 349 22 18 350 12 21 349 12 13 340 343 345 347 - 351: TypePointer Output 339(gl_PerVertex) - 352: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 348 13 12 - 353: 351(ptr) Variable Output - 354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 355 348 18 350 12 21 355 353 39 - 356: TypePointer Uniform 92 - 357: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 24 12 - 368: TypePointer Output 90(fvec4) - 369: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 13 12 - 371(outNormal): 33(ptr) Variable Output - 374: 7(int) Constant 99 - 372: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 373 32 18 374 12 21 373 371(outNormal) 39 - 390(inNormal): 40(ptr) Variable Input - 391: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 392 32 18 374 12 21 392 390(inNormal) 39 - 397: 7(int) Constant 101 - 410: 7(int) Constant 102 - 408: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 409 32 18 410 12 17 23 - 422: TypePointer Uniform 90(fvec4) - 423: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 24 12 -428(outLightVec): 33(ptr) Variable Output - 431: 7(int) Constant 103 - 429: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 430 32 18 431 12 21 430 428(outLightVec) 39 - 437(outViewVec): 33(ptr) Variable Output - 440: 7(int) Constant 104 - 438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 439 32 18 440 12 21 439 437(outViewVec) 39 - 446: 7(int) Constant 105 + 25: TypeFloat 32 + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 13 12 + 28: TypeVector 25(float) 3 + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 13 + 30: TypePointer Input 28(fvec3) + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 22 12 + 32(inPos): 30(ptr) Variable Input + 35: 7(int) Constant 28 + 36: 7(int) Constant 8 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 34 29 18 35 12 21 34 32(inPos) 36 + 37(inNormal): 30(ptr) Variable Input + 40: 7(int) Constant 29 + 38: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 39 29 18 40 12 21 39 37(inNormal) 36 + 41: TypeVector 25(float) 2 + 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 24 + 43: TypePointer Input 41(fvec2) + 44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 42 22 12 + 45(inUV): 43(ptr) Variable Input + 48: 7(int) Constant 30 + 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 47 42 18 48 12 21 47 45(inUV) 36 + 49(inColor): 30(ptr) Variable Input + 52: 7(int) Constant 31 + 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 51 29 18 52 12 21 51 49(inColor) 36 + 53(instancePos): 30(ptr) Variable Input + 56: 7(int) Constant 34 + 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 55 29 18 56 12 21 55 53(instancePos) 36 + 57(instanceRot): 30(ptr) Variable Input + 60: 7(int) Constant 35 + 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 59 29 18 60 12 21 59 57(instanceRot) 36 + 61: TypePointer Input 25(float) + 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 22 12 +63(instanceScale): 61(ptr) Variable Input + 66: 7(int) Constant 36 + 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 65 27 18 66 12 21 65 63(instanceScale) 36 + 67: TypeInt 32 1 + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 68 10 23 12 + 70: TypePointer Input 67(int) + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 69 22 12 +72(instanceTexIndex): 70(ptr) Variable Input + 75: 7(int) Constant 37 + 73: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 74 69 18 75 12 21 74 72(instanceTexIndex) 36 + 76: TypeVector 25(float) 4 + 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 23 + 78: TypeMatrix 76(fvec4) 4 + 80: TypeBool + 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 81 10 24 12 + 83: 80(bool) ConstantTrue + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 77 23 83 + 84(UBO): TypeStruct 78 78 76(fvec4) 25(float) 25(float) + 87: 7(int) Constant 41 + 88: 7(int) Constant 7 + 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 86 79 18 87 88 12 12 13 + 91: 7(int) Constant 42 + 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 90 79 18 91 88 12 12 13 + 94: 7(int) Constant 43 + 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 93 77 18 94 88 12 12 13 + 97: 7(int) Constant 44 + 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 27 18 97 36 12 12 13 + 100: 7(int) Constant 45 + 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 99 27 18 100 36 12 12 13 + 103: 7(int) Constant 39 + 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 102 22 18 103 12 21 102 12 13 85 89 92 95 98 + 104: TypePointer Uniform 84(UBO) + 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 101 24 12 + 106(ubo): 104(ptr) Variable Uniform + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 108 101 18 103 12 21 108 106(ubo) 36 + 109: TypePointer Output 28(fvec3) + 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 13 12 + 111(outNormal): 109(ptr) Variable Output + 114: 7(int) Constant 48 + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 113 29 18 114 12 21 113 111(outNormal) 36 + 115(outColor): 109(ptr) Variable Output + 118: 7(int) Constant 49 + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 117 29 18 118 12 21 117 115(outColor) 36 + 119(outUV): 109(ptr) Variable Output + 122: 7(int) Constant 50 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 121 29 18 122 12 21 121 119(outUV) 36 + 123(outViewVec): 109(ptr) Variable Output + 126: 7(int) Constant 51 + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 125 29 18 126 12 21 125 123(outViewVec) 36 +127(outLightVec): 109(ptr) Variable Output + 130: 7(int) Constant 52 + 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 129 29 18 130 12 21 129 127(outLightVec) 36 + 136: 7(int) Constant 56 + 139: 7(int) Constant 57 + 145: TypeMatrix 28(fvec3) 3 + 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 29 13 83 + 147: TypePointer Function 145 + 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 146 88 12 + 152: 7(int) Constant 59 + 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 151 146 18 152 12 17 23 + 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 157: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 158 146 18 152 12 17 23 + 161: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 162 146 18 152 12 17 23 + 164: TypePointer Function 25(float) + 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 88 12 + 169: 7(int) Constant 62 + 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 168 27 18 169 12 17 23 + 174: 67(int) Constant 3 + 175: TypePointer Uniform 25(float) + 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 24 12 + 184: 7(int) Constant 63 + 182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 183 27 18 184 12 17 23 + 193: 67(int) Constant 0 + 196: 7(int) Constant 65 + 198: 25(float) Constant 0 + 200: TypePointer Function 28(fvec3) + 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 88 12 + 203: 67(int) Constant 1 + 206: 7(int) Constant 66 + 211: 67(int) Constant 2 + 212: 25(float) Constant 1065353216 + 213: 28(fvec3) ConstantComposite 198 198 212 + 216: 7(int) Constant 67 + 219: 7(int) Constant 70 + 227: 7(int) Constant 71 + 235: 7(int) Constant 73 + 239: 28(fvec3) ConstantComposite 198 212 198 + 242: 7(int) Constant 74 + 245: 7(int) Constant 75 + 252: 7(int) Constant 78 + 260: 7(int) Constant 79 + 266: 28(fvec3) ConstantComposite 212 198 198 + 269: 7(int) Constant 81 + 272: 7(int) Constant 82 + 278: 7(int) Constant 83 + 286: 7(int) Constant 85 + 284: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 285 146 18 286 12 17 23 + 294: TypePointer Function 78 + 295: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 79 88 12 + 299: 7(int) Constant 87 + 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 298 79 18 299 12 17 23 + 304: 7(int) Constant 88 + 306: 67(int) Constant 4 + 313: 7(int) Constant 89 + 321: 7(int) Constant 90 + 324: TypePointer Function 76(fvec4) + 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 77 88 12 + 327: 76(fvec4) ConstantComposite 198 212 198 198 + 330: 7(int) Constant 91 + 333: 7(int) Constant 92 + 338: 76(fvec4) ConstantComposite 198 198 198 212 + 341: 7(int) Constant 93 + 345: 7(int) Constant 95 + 343: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 344 77 18 345 12 17 23 + 358: 7(int) Constant 96 + 356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 357 77 18 358 12 17 23 + 371: TypeArray 25(float) 22 + 372: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 27 22 +373(gl_PerVertex): TypeStruct 76(fvec4) 25(float) 371 371 + 376: 7(int) Constant 24 + 374: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 375 77 18 22 376 12 12 13 + 377: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 378 27 18 22 91 12 12 13 + 381: 7(int) Constant 61 + 379: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 380 372 18 22 381 12 12 13 + 382: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 383 372 18 22 286 12 12 13 + 386: 7(int) Constant 98 + 384: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 385 22 18 386 12 21 385 12 13 374 377 379 382 + 387: TypePointer Output 373(gl_PerVertex) + 388: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 384 13 12 + 389: 387(ptr) Variable Output + 390: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 391 384 18 386 12 21 391 389 36 + 392: TypePointer Uniform 78 + 393: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 79 24 12 + 404: TypePointer Output 76(fvec4) + 405: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 77 13 12 + 409: 7(int) Constant 99 + 427: 7(int) Constant 101 + 440: 7(int) Constant 102 + 438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 439 29 18 440 12 17 23 + 452: TypePointer Uniform 76(fvec4) + 453: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 77 24 12 + 460: 7(int) Constant 103 + 466: 7(int) Constant 104 + 470: 7(int) Constant 105 14(main): 4 Function None 5 15: Label - 76(s): 73(ptr) Variable Function - 124(c): 73(ptr) Variable Function - 140(mx): 138(ptr) Variable Function - 184(my): 138(ptr) Variable Function - 221(mz): 138(ptr) Variable Function - 242(rotMat): 138(ptr) Variable Function - 272(gRotMat): 270(ptr) Variable Function - 299(locPos): 281(ptr) Variable Function - 315(pos): 281(ptr) Variable Function - 407(lPos): 151(ptr) Variable Function - 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 - 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 38 38 12 12 - 45: 31(fvec3) Load 42(inColor) - Store 35(outColor) 45 - 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 50 50 12 12 - 58: 51(fvec2) Load 55(inUV) - 68: 60(int) Load 65(instanceTexIndex) - 69: 28(float) ConvertSToF 68 - 70: 28(float) CompositeExtract 58 0 - 71: 28(float) CompositeExtract 58 1 - 72: 31(fvec3) CompositeConstruct 70 71 69 - Store 47(outUV) 72 - 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 79 79 12 12 - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 77 76(s) 81 - 88: 86(ptr) AccessChain 83(instanceRot) 12 - 89: 28(float) Load 88 - 120: 118(ptr) AccessChain 114(ubo) 117 - 121: 28(float) Load 120 - 122: 28(float) FAdd 89 121 - 123: 28(float) ExtInst 3(GLSL.std.450) 13(Sin) 122 - Store 76(s) 123 - 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 127 127 12 12 - 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 125 124(c) 81 - 130: 86(ptr) AccessChain 83(instanceRot) 12 - 131: 28(float) Load 130 - 132: 118(ptr) AccessChain 114(ubo) 117 - 133: 28(float) Load 132 - 134: 28(float) FAdd 131 133 - 135: 28(float) ExtInst 3(GLSL.std.450) 14(Cos) 134 - Store 124(c) 135 - 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 143 143 12 12 - 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 141 140(mx) 81 - 147: 28(float) Load 124(c) - 148: 28(float) Load 76(s) - 150: 31(fvec3) CompositeConstruct 147 148 149 - 153: 151(ptr) AccessChain 140(mx) 146 - Store 153 150 - 156: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 157 157 12 12 - 155: 28(float) Load 76(s) - 158: 28(float) FNegate 155 - 159: 28(float) Load 124(c) - 160: 31(fvec3) CompositeConstruct 158 159 149 - 161: 151(ptr) AccessChain 140(mx) 154 - Store 161 160 - 166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 167 167 12 12 - 165: 151(ptr) AccessChain 140(mx) 162 - Store 165 164 - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 170 170 12 12 - 168: 86(ptr) AccessChain 83(instanceRot) 22 - 171: 28(float) Load 168 - 172: 118(ptr) AccessChain 114(ubo) 117 - 173: 28(float) Load 172 - 174: 28(float) FAdd 171 173 - 175: 28(float) ExtInst 3(GLSL.std.450) 13(Sin) 174 - Store 76(s) 175 - 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 178 178 12 12 - 176: 86(ptr) AccessChain 83(instanceRot) 22 - 179: 28(float) Load 176 - 180: 118(ptr) AccessChain 114(ubo) 117 - 181: 28(float) Load 180 - 182: 28(float) FAdd 179 181 - 183: 28(float) ExtInst 3(GLSL.std.450) 14(Cos) 182 - Store 124(c) 183 - 189: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 187 187 12 12 - 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 185 184(my) 81 - 190: 28(float) Load 124(c) - 191: 28(float) Load 76(s) - 192: 31(fvec3) CompositeConstruct 190 149 191 - 193: 151(ptr) AccessChain 184(my) 146 - Store 193 192 - 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 197 197 12 12 - 195: 151(ptr) AccessChain 184(my) 154 - Store 195 194 - 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 200 200 12 12 - 198: 28(float) Load 76(s) - 201: 28(float) FNegate 198 - 202: 28(float) Load 124(c) - 203: 31(fvec3) CompositeConstruct 201 149 202 - 204: 151(ptr) AccessChain 184(my) 162 - Store 204 203 - 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 207 207 12 12 - 205: 86(ptr) AccessChain 83(instanceRot) 24 - 208: 28(float) Load 205 - 209: 118(ptr) AccessChain 114(ubo) 117 - 210: 28(float) Load 209 - 211: 28(float) FAdd 208 210 - 212: 28(float) ExtInst 3(GLSL.std.450) 13(Sin) 211 - Store 76(s) 212 - 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 215 215 12 12 - 213: 86(ptr) AccessChain 83(instanceRot) 24 - 216: 28(float) Load 213 - 217: 118(ptr) AccessChain 114(ubo) 117 - 218: 28(float) Load 217 - 219: 28(float) FAdd 216 218 - 220: 28(float) ExtInst 3(GLSL.std.450) 14(Cos) 219 - Store 124(c) 220 - 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 224 224 12 12 - 225: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 222 221(mz) 81 - 228: 151(ptr) AccessChain 221(mz) 146 - Store 228 227 - 230: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 231 231 12 12 - 229: 28(float) Load 124(c) - 232: 28(float) Load 76(s) - 233: 31(fvec3) CompositeConstruct 149 229 232 - 234: 151(ptr) AccessChain 221(mz) 154 - Store 234 233 - 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 237 237 12 12 - 235: 28(float) Load 76(s) - 238: 28(float) FNegate 235 - 239: 28(float) Load 124(c) - 240: 31(fvec3) CompositeConstruct 149 238 239 - 241: 151(ptr) AccessChain 221(mz) 162 - Store 241 240 - 247: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 245 245 12 12 - 246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 243 242(rotMat) 81 - 248: 136 Load 221(mz) - 249: 136 Load 184(my) - 250: 136 MatrixTimesMatrix 248 249 - 251: 136 Load 140(mx) - 252: 136 MatrixTimesMatrix 250 251 - Store 242(rotMat) 252 - 254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 255 255 12 12 - 253: 86(ptr) AccessChain 83(instanceRot) 22 - 256: 28(float) Load 253 - 258: 118(ptr) AccessChain 114(ubo) 257 - 259: 28(float) Load 258 - 260: 28(float) FAdd 256 259 - 261: 28(float) ExtInst 3(GLSL.std.450) 13(Sin) 260 - Store 76(s) 261 - 263: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 264 264 12 12 - 262: 86(ptr) AccessChain 83(instanceRot) 22 - 265: 28(float) Load 262 - 266: 118(ptr) AccessChain 114(ubo) 257 - 267: 28(float) Load 266 - 268: 28(float) FAdd 265 267 - 269: 28(float) ExtInst 3(GLSL.std.450) 14(Cos) 268 - Store 124(c) 269 - 277: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 275 275 12 12 - 276: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 273 272(gRotMat) 81 - 278: 28(float) Load 124(c) - 279: 28(float) Load 76(s) - 280: 90(fvec4) CompositeConstruct 278 149 279 149 - 283: 281(ptr) AccessChain 272(gRotMat) 146 - Store 283 280 - 286: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 287 287 12 12 - 285: 281(ptr) AccessChain 272(gRotMat) 154 - Store 285 284 - 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 290 290 12 12 - 288: 28(float) Load 76(s) - 291: 28(float) FNegate 288 - 292: 28(float) Load 124(c) - 293: 90(fvec4) CompositeConstruct 291 149 292 149 - 294: 281(ptr) AccessChain 272(gRotMat) 162 - Store 294 293 - 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 298 298 12 12 - 296: 281(ptr) AccessChain 272(gRotMat) 117 - Store 296 295 - 304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 302 302 12 12 - 303: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 300 299(locPos) 81 - 308: 31(fvec3) Load 305(inPos) - 309: 136 Load 242(rotMat) - 310: 31(fvec3) VectorTimesMatrix 308 309 - 311: 28(float) CompositeExtract 310 0 - 312: 28(float) CompositeExtract 310 1 - 313: 28(float) CompositeExtract 310 2 - 314: 90(fvec4) CompositeConstruct 311 312 313 163 - Store 299(locPos) 314 - 320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 318 318 12 12 - 319: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 316 315(pos) 81 - 321: 90(fvec4) Load 299(locPos) - 322: 31(fvec3) VectorShuffle 321 321 0 1 2 - 326: 28(float) Load 323(instanceScale) - 327: 31(fvec3) VectorTimesScalar 322 326 - 331: 31(fvec3) Load 328(instancePos) - 332: 31(fvec3) FAdd 327 331 - 333: 28(float) CompositeExtract 332 0 - 334: 28(float) CompositeExtract 332 1 - 335: 28(float) CompositeExtract 332 2 - 336: 90(fvec4) CompositeConstruct 333 334 335 163 - Store 315(pos) 336 - 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 350 350 12 12 - 358: 356(ptr) AccessChain 114(ubo) 146 - 360: 92 Load 358 - 361: 356(ptr) AccessChain 114(ubo) 154 - 362: 92 Load 361 - 363: 92 MatrixTimesMatrix 360 362 - 364: 92 Load 272(gRotMat) - 365: 92 MatrixTimesMatrix 363 364 - 366: 90(fvec4) Load 315(pos) - 367: 90(fvec4) MatrixTimesVector 365 366 - 370: 368(ptr) AccessChain 353 146 - Store 370 367 - 376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 374 374 12 12 - 375: 356(ptr) AccessChain 114(ubo) 154 - 377: 92 Load 375 - 378: 92 Load 272(gRotMat) - 379: 92 MatrixTimesMatrix 377 378 - 380: 90(fvec4) CompositeExtract 379 0 - 381: 31(fvec3) VectorShuffle 380 380 0 1 2 - 382: 90(fvec4) CompositeExtract 379 1 - 383: 31(fvec3) VectorShuffle 382 382 0 1 2 - 384: 90(fvec4) CompositeExtract 379 2 - 385: 31(fvec3) VectorShuffle 384 384 0 1 2 - 386: 136 CompositeConstruct 381 383 385 - 387: 136 Load 242(rotMat) - 388: 136 ExtInst 3(GLSL.std.450) 34(MatrixInverse) 387 - 389: 136 MatrixTimesMatrix 386 388 - 393: 31(fvec3) Load 390(inNormal) - 394: 31(fvec3) MatrixTimesVector 389 393 - Store 371(outNormal) 394 - 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 397 397 12 12 - 395: 356(ptr) AccessChain 114(ubo) 154 - 398: 92 Load 395 - 399: 31(fvec3) Load 305(inPos) - 400: 31(fvec3) Load 328(instancePos) - 401: 31(fvec3) FAdd 399 400 - 402: 28(float) CompositeExtract 401 0 - 403: 28(float) CompositeExtract 401 1 - 404: 28(float) CompositeExtract 401 2 - 405: 90(fvec4) CompositeConstruct 402 403 404 163 - 406: 90(fvec4) MatrixTimesVector 398 405 - Store 315(pos) 406 - 412: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 410 410 12 12 - 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 408 407(lPos) 81 - 413: 356(ptr) AccessChain 114(ubo) 154 - 414: 92 Load 413 - 415: 90(fvec4) CompositeExtract 414 0 - 416: 31(fvec3) VectorShuffle 415 415 0 1 2 - 417: 90(fvec4) CompositeExtract 414 1 - 418: 31(fvec3) VectorShuffle 417 417 0 1 2 - 419: 90(fvec4) CompositeExtract 414 2 - 420: 31(fvec3) VectorShuffle 419 419 0 1 2 - 421: 136 CompositeConstruct 416 418 420 - 424: 422(ptr) AccessChain 114(ubo) 162 - 425: 90(fvec4) Load 424 - 426: 31(fvec3) VectorShuffle 425 425 0 1 2 - 427: 31(fvec3) MatrixTimesVector 421 426 - Store 407(lPos) 427 - 433: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 431 431 12 12 - 432: 31(fvec3) Load 407(lPos) - 434: 90(fvec4) Load 315(pos) - 435: 31(fvec3) VectorShuffle 434 434 0 1 2 - 436: 31(fvec3) FSub 432 435 - Store 428(outLightVec) 436 + 149(mx): 147(ptr) Variable Function + 156(my): 147(ptr) Variable Function + 160(mz): 147(ptr) Variable Function + 166(s): 164(ptr) Variable Function + 181(c): 164(ptr) Variable Function + 283(rotMat): 147(ptr) Variable Function + 296(gRotMat): 294(ptr) Variable Function + 342(locPos): 324(ptr) Variable Function + 355(pos): 324(ptr) Variable Function + 437(lPos): 200(ptr) Variable Function + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 133: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 136 136 12 12 + 134: 28(fvec3) Load 49(inColor) + Store 115(outColor) 134 + 138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 139 139 12 12 + 137: 41(fvec2) Load 45(inUV) + 140: 67(int) Load 72(instanceTexIndex) + 141: 25(float) ConvertSToF 140 + 142: 25(float) CompositeExtract 137 0 + 143: 25(float) CompositeExtract 137 1 + 144: 28(fvec3) CompositeConstruct 142 143 141 + Store 119(outUV) 144 + 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 152 152 12 12 + 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 150 149(mx) 154 + 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 157 156(my) 154 + 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 161 160(mz) 154 + 171: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 169 169 12 12 + 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 167 166(s) 154 + 172: 61(ptr) AccessChain 57(instanceRot) 12 + 173: 25(float) Load 172 + 177: 175(ptr) AccessChain 106(ubo) 174 + 178: 25(float) Load 177 + 179: 25(float) FAdd 173 178 + 180: 25(float) ExtInst 3(GLSL.std.450) 13(Sin) 179 + Store 166(s) 180 + 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 184 184 12 12 + 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 182 181(c) 154 + 187: 61(ptr) AccessChain 57(instanceRot) 12 + 188: 25(float) Load 187 + 189: 175(ptr) AccessChain 106(ubo) 174 + 190: 25(float) Load 189 + 191: 25(float) FAdd 188 190 + 192: 25(float) ExtInst 3(GLSL.std.450) 14(Cos) 191 + Store 181(c) 192 + 195: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 196 196 12 12 + 194: 25(float) Load 181(c) + 197: 25(float) Load 166(s) + 199: 28(fvec3) CompositeConstruct 194 197 198 + 202: 200(ptr) AccessChain 149(mx) 193 + Store 202 199 + 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 206 206 12 12 + 204: 25(float) Load 166(s) + 207: 25(float) FNegate 204 + 208: 25(float) Load 181(c) + 209: 28(fvec3) CompositeConstruct 207 208 198 + 210: 200(ptr) AccessChain 149(mx) 203 + Store 210 209 + 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 216 216 12 12 + 214: 200(ptr) AccessChain 149(mx) 211 + Store 214 213 + 218: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 219 219 12 12 + 217: 61(ptr) AccessChain 57(instanceRot) 22 + 220: 25(float) Load 217 + 221: 175(ptr) AccessChain 106(ubo) 174 + 222: 25(float) Load 221 + 223: 25(float) FAdd 220 222 + 224: 25(float) ExtInst 3(GLSL.std.450) 13(Sin) 223 + Store 166(s) 224 + 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 227 227 12 12 + 225: 61(ptr) AccessChain 57(instanceRot) 22 + 228: 25(float) Load 225 + 229: 175(ptr) AccessChain 106(ubo) 174 + 230: 25(float) Load 229 + 231: 25(float) FAdd 228 230 + 232: 25(float) ExtInst 3(GLSL.std.450) 14(Cos) 231 + Store 181(c) 232 + 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 235 235 12 12 + 233: 25(float) Load 181(c) + 236: 25(float) Load 166(s) + 237: 28(fvec3) CompositeConstruct 233 198 236 + 238: 200(ptr) AccessChain 156(my) 193 + Store 238 237 + 241: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 242 242 12 12 + 240: 200(ptr) AccessChain 156(my) 203 + Store 240 239 + 244: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 245 245 12 12 + 243: 25(float) Load 166(s) + 246: 25(float) FNegate 243 + 247: 25(float) Load 181(c) + 248: 28(fvec3) CompositeConstruct 246 198 247 + 249: 200(ptr) AccessChain 156(my) 211 + Store 249 248 + 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 252 252 12 12 + 250: 61(ptr) AccessChain 57(instanceRot) 24 + 253: 25(float) Load 250 + 254: 175(ptr) AccessChain 106(ubo) 174 + 255: 25(float) Load 254 + 256: 25(float) FAdd 253 255 + 257: 25(float) ExtInst 3(GLSL.std.450) 13(Sin) 256 + Store 166(s) 257 + 259: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 260 260 12 12 + 258: 61(ptr) AccessChain 57(instanceRot) 24 + 261: 25(float) Load 258 + 262: 175(ptr) AccessChain 106(ubo) 174 + 263: 25(float) Load 262 + 264: 25(float) FAdd 261 263 + 265: 25(float) ExtInst 3(GLSL.std.450) 14(Cos) 264 + Store 181(c) 265 + 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 269 269 12 12 + 267: 200(ptr) AccessChain 160(mz) 193 + Store 267 266 + 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 272 272 12 12 + 270: 25(float) Load 181(c) + 273: 25(float) Load 166(s) + 274: 28(fvec3) CompositeConstruct 198 270 273 + 275: 200(ptr) AccessChain 160(mz) 203 + Store 275 274 + 277: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 278 278 12 12 + 276: 25(float) Load 166(s) + 279: 25(float) FNegate 276 + 280: 25(float) Load 181(c) + 281: 28(fvec3) CompositeConstruct 198 279 280 + 282: 200(ptr) AccessChain 160(mz) 211 + Store 282 281 + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 286 286 12 12 + 287: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 284 283(rotMat) 154 + 289: 145 Load 160(mz) + 290: 145 Load 156(my) + 291: 145 MatrixTimesMatrix 289 290 + 292: 145 Load 149(mx) + 293: 145 MatrixTimesMatrix 291 292 + Store 283(rotMat) 293 + 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 299 299 12 12 + 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 297 296(gRotMat) 154 + 303: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 304 304 12 12 + 302: 61(ptr) AccessChain 57(instanceRot) 22 + 305: 25(float) Load 302 + 307: 175(ptr) AccessChain 106(ubo) 306 + 308: 25(float) Load 307 + 309: 25(float) FAdd 305 308 + 310: 25(float) ExtInst 3(GLSL.std.450) 13(Sin) 309 + Store 166(s) 310 + 312: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 313 313 12 12 + 311: 61(ptr) AccessChain 57(instanceRot) 22 + 314: 25(float) Load 311 + 315: 175(ptr) AccessChain 106(ubo) 306 + 316: 25(float) Load 315 + 317: 25(float) FAdd 314 316 + 318: 25(float) ExtInst 3(GLSL.std.450) 14(Cos) 317 + Store 181(c) 318 + 320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 321 321 12 12 + 319: 25(float) Load 181(c) + 322: 25(float) Load 166(s) + 323: 76(fvec4) CompositeConstruct 319 198 322 198 + 326: 324(ptr) AccessChain 296(gRotMat) 193 + Store 326 323 + 329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 330 330 12 12 + 328: 324(ptr) AccessChain 296(gRotMat) 203 + Store 328 327 + 332: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 333 333 12 12 + 331: 25(float) Load 166(s) + 334: 25(float) FNegate 331 + 335: 25(float) Load 181(c) + 336: 76(fvec4) CompositeConstruct 334 198 335 198 + 337: 324(ptr) AccessChain 296(gRotMat) 211 + Store 337 336 + 340: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 341 341 12 12 + 339: 324(ptr) AccessChain 296(gRotMat) 174 + Store 339 338 + 347: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 345 345 12 12 + 346: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 343 342(locPos) 154 + 348: 28(fvec3) Load 32(inPos) + 349: 145 Load 283(rotMat) + 350: 28(fvec3) VectorTimesMatrix 348 349 + 351: 25(float) CompositeExtract 350 0 + 352: 25(float) CompositeExtract 350 1 + 353: 25(float) CompositeExtract 350 2 + 354: 76(fvec4) CompositeConstruct 351 352 353 212 + Store 342(locPos) 354 + 360: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 358 358 12 12 + 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 356 355(pos) 154 + 361: 76(fvec4) Load 342(locPos) + 362: 28(fvec3) VectorShuffle 361 361 0 1 2 + 363: 25(float) Load 63(instanceScale) + 364: 28(fvec3) VectorTimesScalar 362 363 + 365: 28(fvec3) Load 53(instancePos) + 366: 28(fvec3) FAdd 364 365 + 367: 25(float) CompositeExtract 366 0 + 368: 25(float) CompositeExtract 366 1 + 369: 25(float) CompositeExtract 366 2 + 370: 76(fvec4) CompositeConstruct 367 368 369 212 + Store 355(pos) 370 + 395: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 386 386 12 12 + 394: 392(ptr) AccessChain 106(ubo) 193 + 396: 78 Load 394 + 397: 392(ptr) AccessChain 106(ubo) 203 + 398: 78 Load 397 + 399: 78 MatrixTimesMatrix 396 398 + 400: 78 Load 296(gRotMat) + 401: 78 MatrixTimesMatrix 399 400 + 402: 76(fvec4) Load 355(pos) + 403: 76(fvec4) MatrixTimesVector 401 402 + 406: 404(ptr) AccessChain 389 193 + Store 406 403 + 408: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 409 409 12 12 + 407: 392(ptr) AccessChain 106(ubo) 203 + 410: 78 Load 407 + 411: 78 Load 296(gRotMat) + 412: 78 MatrixTimesMatrix 410 411 + 413: 76(fvec4) CompositeExtract 412 0 + 414: 28(fvec3) VectorShuffle 413 413 0 1 2 + 415: 76(fvec4) CompositeExtract 412 1 + 416: 28(fvec3) VectorShuffle 415 415 0 1 2 + 417: 76(fvec4) CompositeExtract 412 2 + 418: 28(fvec3) VectorShuffle 417 417 0 1 2 + 419: 145 CompositeConstruct 414 416 418 + 420: 145 Load 283(rotMat) + 421: 145 ExtInst 3(GLSL.std.450) 34(MatrixInverse) 420 + 422: 145 MatrixTimesMatrix 419 421 + 423: 28(fvec3) Load 37(inNormal) + 424: 28(fvec3) MatrixTimesVector 422 423 + Store 111(outNormal) 424 + 426: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 427 427 12 12 + 425: 392(ptr) AccessChain 106(ubo) 203 + 428: 78 Load 425 + 429: 28(fvec3) Load 32(inPos) + 430: 28(fvec3) Load 53(instancePos) + 431: 28(fvec3) FAdd 429 430 + 432: 25(float) CompositeExtract 431 0 + 433: 25(float) CompositeExtract 431 1 + 434: 25(float) CompositeExtract 431 2 + 435: 76(fvec4) CompositeConstruct 432 433 434 212 + 436: 76(fvec4) MatrixTimesVector 428 435 + Store 355(pos) 436 442: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 440 440 12 12 - 441: 90(fvec4) Load 315(pos) - 443: 31(fvec3) VectorShuffle 441 441 0 1 2 - 444: 31(fvec3) FNegate 443 - Store 437(outViewVec) 444 - 445: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 446 446 12 12 + 441: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 438 437(lPos) 154 + 443: 392(ptr) AccessChain 106(ubo) 203 + 444: 78 Load 443 + 445: 76(fvec4) CompositeExtract 444 0 + 446: 28(fvec3) VectorShuffle 445 445 0 1 2 + 447: 76(fvec4) CompositeExtract 444 1 + 448: 28(fvec3) VectorShuffle 447 447 0 1 2 + 449: 76(fvec4) CompositeExtract 444 2 + 450: 28(fvec3) VectorShuffle 449 449 0 1 2 + 451: 145 CompositeConstruct 446 448 450 + 454: 452(ptr) AccessChain 106(ubo) 211 + 455: 76(fvec4) Load 454 + 456: 28(fvec3) VectorShuffle 455 455 0 1 2 + 457: 28(fvec3) MatrixTimesVector 451 456 + Store 437(lPos) 457 + 459: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 460 460 12 12 + 458: 28(fvec3) Load 437(lPos) + 461: 76(fvec4) Load 355(pos) + 462: 28(fvec3) VectorShuffle 461 461 0 1 2 + 463: 28(fvec3) FSub 458 462 + Store 127(outLightVec) 463 + 465: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 466 466 12 12 + 464: 76(fvec4) Load 355(pos) + 467: 28(fvec3) VectorShuffle 464 464 0 1 2 + 468: 28(fvec3) FNegate 467 + Store 123(outViewVec) 468 + 469: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 470 470 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.comp.out b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.comp.out index 107c848bda..6ad6991933 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.comp.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.comp.out @@ -1,14 +1,14 @@ spv.debuginfo.hlsl.comp // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 992 +// Id's are bound by 1014 Capability Shader Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint GLCompute 6 "main" 987 + EntryPoint GLCompute 6 "main" 1009 ExecutionMode 6 LocalSize 10 10 1 2: String "spv.debuginfo.hlsl.comp" 9: String "float" @@ -214,33 +214,42 @@ void main(uint3 id : SV_DispatchThreadID) 67: String "id" 75: String "dist" 90: String "int" - 96: String "sphereRadius" - 107: String "gravity" - 112: String "particleCount" - 115: String "UBO" - 118: String "params" - 122: String "ubo" - 127: String "" - 151: String "index" - 178: String "bool" - 189: String "normal" - 196: String "pinned" - 200: String "Particle" - 206: String "@data" - 210: String "particleIn" - 232: String "particleOut" - 259: String "force" - 273: String "pos" - 283: String "vel" - 575: String "f" - 624: String "sphereDist" - 676: String "calculateNormals" - 680: String "PushConstants" - 684: String "pushConstants" - 687: String "$Global" - 711: String "a" - 717: String "b" - 721: String "c" + 96: String "deltaT" + 100: String "particleMass" + 104: String "springStiffness" + 108: String "damping" + 112: String "restDistH" + 116: String "restDistV" + 119: String "restDistD" + 122: String "sphereRadius" + 125: String "spherePos" + 129: String "gravity" + 133: String "particleCount" + 136: String "UBO" + 139: String "params" + 143: String "ubo" + 148: String "" + 172: String "index" + 199: String "bool" + 210: String "pos" + 213: String "vel" + 216: String "uv" + 220: String "normal" + 223: String "pinned" + 226: String "Particle" + 232: String "@data" + 235: String "particleIn" + 257: String "particleOut" + 284: String "force" + 598: String "f" + 647: String "sphereDist" + 699: String "calculateNormals" + 702: String "PushConstants" + 706: String "pushConstants" + 709: String "$Global" + 733: String "a" + 739: String "b" + 743: String "c" Name 6 "main" Name 30 "springForce(vf3;vf3;f1;" Name 27 "p0" @@ -261,63 +270,63 @@ void main(uint3 id : SV_DispatchThreadID) MemberName 94(UBO) 8 "spherePos" MemberName 94(UBO) 9 "gravity" MemberName 94(UBO) 10 "particleCount" - Name 116 "ubo" - MemberName 116(ubo) 0 "params" - Name 125 "" - Name 149 "index" - Name 187 "Particle" - MemberName 187(Particle) 0 "pos" - MemberName 187(Particle) 1 "vel" - MemberName 187(Particle) 2 "uv" - MemberName 187(Particle) 3 "normal" - MemberName 187(Particle) 4 "pinned" - Name 204 "particleIn" - MemberName 204(particleIn) 0 "@data" - Name 213 "particleIn" - Name 228 "particleOut" - MemberName 228(particleOut) 0 "@data" - Name 236 "particleOut" - Name 257 "force" - Name 271 "pos" - Name 281 "vel" - Name 304 "param" - Name 308 "param" - Name 310 "param" - Name 334 "param" - Name 338 "param" - Name 340 "param" - Name 368 "param" - Name 372 "param" - Name 374 "param" + Name 137 "ubo" + MemberName 137(ubo) 0 "params" + Name 146 "" + Name 170 "index" + Name 208 "Particle" + MemberName 208(Particle) 0 "pos" + MemberName 208(Particle) 1 "vel" + MemberName 208(Particle) 2 "uv" + MemberName 208(Particle) 3 "normal" + MemberName 208(Particle) 4 "pinned" + Name 230 "particleIn" + MemberName 230(particleIn) 0 "@data" + Name 238 "particleIn" + Name 253 "particleOut" + MemberName 253(particleOut) 0 "@data" + Name 261 "particleOut" + Name 282 "force" + Name 296 "pos" + Name 305 "vel" + Name 327 "param" + Name 331 "param" + Name 333 "param" + Name 357 "param" + Name 361 "param" + Name 363 "param" + Name 391 "param" + Name 395 "param" Name 397 "param" - Name 401 "param" - Name 403 "param" - Name 436 "param" - Name 440 "param" - Name 442 "param" - Name 470 "param" - Name 474 "param" - Name 476 "param" - Name 512 "param" - Name 516 "param" - Name 518 "param" - Name 550 "param" - Name 554 "param" - Name 556 "param" - Name 573 "f" - Name 622 "sphereDist" - Name 674 "PushConstants" - MemberName 674(PushConstants) 0 "calculateNormals" - Name 682 "$Global" - MemberName 682($Global) 0 "pushConstants" - Name 690 "" - Name 702 "normal" - Name 709 "a" - Name 715 "b" - Name 719 "c" - Name 985 "id" - Name 987 "id" - Name 989 "param" + Name 420 "param" + Name 424 "param" + Name 426 "param" + Name 459 "param" + Name 463 "param" + Name 465 "param" + Name 493 "param" + Name 497 "param" + Name 499 "param" + Name 535 "param" + Name 539 "param" + Name 541 "param" + Name 573 "param" + Name 577 "param" + Name 579 "param" + Name 596 "f" + Name 645 "sphereDist" + Name 697 "PushConstants" + MemberName 697(PushConstants) 0 "calculateNormals" + Name 704 "$Global" + MemberName 704($Global) 0 "pushConstants" + Name 712 "" + Name 724 "normal" + Name 731 "a" + Name 737 "b" + Name 741 "c" + Name 1007 "id" + Name 1009 "id" + Name 1011 "param" MemberDecorate 94(UBO) 0 Offset 0 MemberDecorate 94(UBO) 1 Offset 4 MemberDecorate 94(UBO) 2 Offset 8 @@ -329,33 +338,33 @@ void main(uint3 id : SV_DispatchThreadID) MemberDecorate 94(UBO) 8 Offset 32 MemberDecorate 94(UBO) 9 Offset 48 MemberDecorate 94(UBO) 10 Offset 64 - Decorate 116(ubo) Block - MemberDecorate 116(ubo) 0 Offset 0 - Decorate 125 Binding 2 - Decorate 125 DescriptorSet 0 - MemberDecorate 187(Particle) 0 Offset 0 - MemberDecorate 187(Particle) 1 Offset 16 - MemberDecorate 187(Particle) 2 Offset 32 - MemberDecorate 187(Particle) 3 Offset 48 - MemberDecorate 187(Particle) 4 Offset 64 - Decorate 202 ArrayStride 80 - Decorate 204(particleIn) BufferBlock - MemberDecorate 204(particleIn) 0 NonWritable - MemberDecorate 204(particleIn) 0 Offset 0 - Decorate 213(particleIn) NonWritable - Decorate 213(particleIn) Binding 0 - Decorate 213(particleIn) DescriptorSet 0 - Decorate 226 ArrayStride 80 - Decorate 228(particleOut) BufferBlock - MemberDecorate 228(particleOut) 0 Offset 0 - Decorate 236(particleOut) Binding 1 - Decorate 236(particleOut) DescriptorSet 0 - MemberDecorate 674(PushConstants) 0 Offset 0 - Decorate 682($Global) Block - MemberDecorate 682($Global) 0 Offset 0 - Decorate 690 Binding 3 - Decorate 690 DescriptorSet 0 - Decorate 987(id) BuiltIn GlobalInvocationId + Decorate 137(ubo) Block + MemberDecorate 137(ubo) 0 Offset 0 + Decorate 146 Binding 2 + Decorate 146 DescriptorSet 0 + MemberDecorate 208(Particle) 0 Offset 0 + MemberDecorate 208(Particle) 1 Offset 16 + MemberDecorate 208(Particle) 2 Offset 32 + MemberDecorate 208(Particle) 3 Offset 48 + MemberDecorate 208(Particle) 4 Offset 64 + Decorate 228 ArrayStride 80 + Decorate 230(particleIn) BufferBlock + MemberDecorate 230(particleIn) 0 NonWritable + MemberDecorate 230(particleIn) 0 Offset 0 + Decorate 238(particleIn) NonWritable + Decorate 238(particleIn) Binding 0 + Decorate 238(particleIn) DescriptorSet 0 + Decorate 251 ArrayStride 80 + Decorate 253(particleOut) BufferBlock + MemberDecorate 253(particleOut) 0 Offset 0 + Decorate 261(particleOut) Binding 1 + Decorate 261(particleOut) DescriptorSet 0 + MemberDecorate 697(PushConstants) 0 Offset 0 + Decorate 704($Global) Block + MemberDecorate 704($Global) 0 Offset 0 + Decorate 712 Binding 3 + Decorate 712 DescriptorSet 0 + Decorate 1009(id) BuiltIn GlobalInvocationId 4: TypeVoid 5: TypeFunction 4 8: TypeFloat 32 @@ -407,206 +416,219 @@ void main(uint3 id : SV_DispatchThreadID) 92: TypeVector 89(int) 2 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 91 49 94(UBO): TypeStruct 8(float) 8(float) 8(float) 8(float) 8(float) 8(float) 8(float) 8(float) 87(fvec4) 87(fvec4) 92(ivec2) - 97: 11(int) Constant 48 - 98: 11(int) Constant 20 + 97: 11(int) Constant 41 + 98: 11(int) Constant 14 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 10 34 97 98 16 16 17 - 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 10 34 97 98 16 16 17 - 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 10 34 97 98 16 16 17 - 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 10 34 97 98 16 16 17 - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 10 34 97 98 16 16 17 - 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 10 34 97 98 16 16 17 - 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 10 34 97 98 16 16 17 - 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 96 10 34 97 98 16 16 17 - 108: 11(int) Constant 50 - 109: 11(int) Constant 16 - 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 107 88 34 108 109 16 16 17 - 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 107 88 34 108 109 16 16 17 - 113: 11(int) Constant 51 - 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 112 93 34 113 98 16 16 17 - 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 115 38 34 85 16 37 115 16 17 95 99 100 101 102 103 104 105 106 110 111 - 116(ubo): TypeStruct 94(UBO) - 119: 11(int) Constant 56 - 120: 11(int) Constant 12 - 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 118 114 34 119 120 16 16 17 - 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 122 38 34 85 16 37 122 16 17 117 - 123: TypePointer Uniform 116(ubo) - 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 121 49 16 - 125: 123(ptr) Variable Uniform - 128: 11(int) Constant 8 - 126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 127 121 34 85 16 37 127 125 128 - 129: 89(int) Constant 0 - 130: 89(int) Constant 2 - 131: TypePointer Uniform 8(float) - 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 49 16 - 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 64 - 147: TypePointer Function 11(int) - 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 13 21 16 - 152: 11(int) Constant 83 - 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 151 13 34 152 16 146 39 - 158: 89(int) Constant 10 - 159: TypePointer Uniform 89(int) - 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 49 16 - 170: 11(int) Constant 84 - 177: TypeBool - 179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 178 14 49 16 - 185: 11(int) Constant 85 - 187(Particle): TypeStruct 87(fvec4) 87(fvec4) 87(fvec4) 87(fvec4) 8(float) - 190: 11(int) Constant 30 - 191: 11(int) Constant 15 - 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 189 88 34 190 191 16 16 17 - 192: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 189 88 34 190 191 16 16 17 - 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 189 88 34 190 191 16 16 17 - 194: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 189 88 34 190 191 16 16 17 - 197: 11(int) Constant 31 - 198: 11(int) Constant 14 - 195: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 196 10 34 197 198 16 16 17 - 201: 11(int) Constant 88 - 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 200 38 34 201 16 37 200 16 17 188 192 193 194 195 - 202: TypeRuntimeArray 187(Particle) - 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 199 16 - 204(particleIn): TypeStruct 202 - 207: 11(int) Constant 35 - 208: 11(int) Constant 28 - 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 206 203 34 207 208 16 16 17 - 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 210 38 34 201 16 37 210 16 17 205 - 211: TypePointer Uniform 204(particleIn) - 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 209 49 16 - 213(particleIn): 211(ptr) Variable Uniform - 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 210 209 34 201 16 37 210 213(particleIn) 128 - 218: 89(int) Constant 4 - 221: 8(float) Constant 1065353216 - 225: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 226: TypeRuntimeArray 187(Particle) - 227: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 199 16 -228(particleOut): TypeStruct 226 - 230: 11(int) Constant 37 - 229: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 206 227 34 230 190 16 16 17 - 233: 11(int) Constant 89 - 231: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 232 38 34 233 16 37 232 16 17 229 - 234: TypePointer Uniform 228(particleOut) - 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 231 49 16 -236(particleOut): 234(ptr) Variable Uniform - 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 232 231 34 233 16 37 232 236(particleOut) 128 - 242: TypePointer Uniform 87(fvec4) - 243: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 88 49 16 - 249: 11(int) Constant 90 - 250: 89(int) Constant 1 - 251: 8(float) Constant 0 - 252: 87(fvec4) ConstantComposite 251 251 251 251 - 255: 11(int) Constant 91 - 260: 11(int) Constant 95 - 258: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 259 19 34 260 16 146 39 - 264: 89(int) Constant 9 - 274: 11(int) Constant 97 - 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 273 19 34 274 16 146 39 - 284: 11(int) Constant 98 - 282: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 283 19 34 284 16 146 39 - 293: 11(int) Constant 102 - 298: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 302: 11(int) Constant 103 - 319: 11(int) Constant 106 - 328: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 332: 11(int) Constant 107 - 349: 11(int) Constant 110 - 358: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 362: 11(int) Constant 111 - 367: 89(int) Constant 5 - 383: 11(int) Constant 114 - 388: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 392: 11(int) Constant 115 - 412: 11(int) Constant 118 - 425: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 429: 11(int) Constant 119 - 435: 89(int) Constant 6 - 451: 11(int) Constant 122 - 460: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 464: 11(int) Constant 123 - 485: 11(int) Constant 126 - 502: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 506: 11(int) Constant 127 - 527: 11(int) Constant 130 - 540: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 544: 11(int) Constant 131 - 562: 89(int) Constant 3 - 566: 11(int) Constant 134 - 576: 11(int) Constant 137 - 574: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 575 19 34 576 16 146 39 - 586: 11(int) Constant 138 - 593: 8(float) Constant 1056964608 - 610: 11(int) Constant 139 - 625: 11(int) Constant 142 - 623: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 624 19 34 625 16 146 39 - 632: 89(int) Constant 8 - 639: 11(int) Constant 143 - 641: 89(int) Constant 7 - 644: 8(float) Constant 1008981770 - 649: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 653: 11(int) Constant 145 - 672: 11(int) Constant 147 -674(PushConstants): TypeStruct 11(int) - 677: 11(int) Constant 67 - 678: 11(int) Constant 23 - 675: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 676 13 34 677 678 16 16 17 - 681: 11(int) Constant 151 - 679: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 680 38 34 681 16 37 680 16 17 675 - 682($Global): TypeStruct 674(PushConstants) - 685: 11(int) Constant 71 - 683: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 684 679 34 685 191 16 16 17 - 686: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 687 38 34 681 16 37 687 16 17 683 - 688: TypePointer Uniform 682($Global) - 689: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 686 49 16 - 690: 688(ptr) Variable Uniform - 691: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 127 686 34 681 16 37 127 690 128 - 692: TypePointer Uniform 11(int) - 693: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 13 49 16 - 701: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 146 - 704: 11(int) Constant 152 - 703: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 189 19 34 704 16 701 39 - 708: 18(fvec3) ConstantComposite 251 251 251 - 712: 11(int) Constant 153 - 710: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 711 19 34 712 16 701 39 - 716: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 717 19 34 712 16 701 39 - 720: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 721 19 34 712 16 701 39 - 725: 11(int) Constant 154 - 730: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 701 - 734: 11(int) Constant 155 - 739: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 730 - 743: 11(int) Constant 156 - 752: 11(int) Constant 157 - 765: 11(int) Constant 158 - 777: 11(int) Constant 159 - 789: 11(int) Constant 161 - 798: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 730 - 802: 11(int) Constant 162 - 814: 11(int) Constant 163 - 827: 11(int) Constant 164 - 836: 11(int) Constant 165 - 848: 11(int) Constant 168 - 857: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 701 - 861: 11(int) Constant 169 - 866: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 857 - 870: 11(int) Constant 170 - 882: 11(int) Constant 171 - 895: 11(int) Constant 172 - 904: 11(int) Constant 173 - 916: 11(int) Constant 175 - 925: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 857 - 929: 11(int) Constant 176 - 938: 11(int) Constant 177 - 951: 11(int) Constant 178 - 963: 11(int) Constant 179 - 975: 11(int) Constant 182 - 986: TypePointer Input 54(ivec3) - 987(id): 986(ptr) Variable Input + 101: 11(int) Constant 42 + 102: 11(int) Constant 20 + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 100 10 34 101 102 16 16 17 + 105: 11(int) Constant 43 + 106: 11(int) Constant 23 + 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 104 10 34 105 106 16 16 17 + 109: 11(int) Constant 44 + 110: 11(int) Constant 15 + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 108 10 34 109 110 16 16 17 + 113: 11(int) Constant 45 + 114: 11(int) Constant 17 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 112 10 34 113 114 16 16 17 + 117: 11(int) Constant 46 + 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 116 10 34 117 114 16 16 17 + 120: 11(int) Constant 47 + 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 119 10 34 120 114 16 16 17 + 123: 11(int) Constant 48 + 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 122 10 34 123 102 16 16 17 + 126: 11(int) Constant 49 + 127: 11(int) Constant 18 + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 125 88 34 126 127 16 16 17 + 130: 11(int) Constant 50 + 131: 11(int) Constant 16 + 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 129 88 34 130 131 16 16 17 + 134: 11(int) Constant 51 + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 133 93 34 134 102 16 16 17 + 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 136 38 34 85 16 37 136 16 17 95 99 103 107 111 115 118 121 124 128 132 + 137(ubo): TypeStruct 94(UBO) + 140: 11(int) Constant 56 + 141: 11(int) Constant 12 + 138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 139 135 34 140 141 16 16 17 + 142: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 143 38 34 85 16 37 143 16 17 138 + 144: TypePointer Uniform 137(ubo) + 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 142 49 16 + 146: 144(ptr) Variable Uniform + 149: 11(int) Constant 8 + 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 148 142 34 85 16 37 148 146 149 + 150: 89(int) Constant 0 + 151: 89(int) Constant 2 + 152: TypePointer Uniform 8(float) + 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 49 16 + 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 64 + 168: TypePointer Function 11(int) + 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 13 21 16 + 173: 11(int) Constant 83 + 171: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 172 13 34 173 16 167 39 + 179: 89(int) Constant 10 + 180: TypePointer Uniform 89(int) + 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 49 16 + 191: 11(int) Constant 84 + 198: TypeBool + 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 199 14 49 16 + 206: 11(int) Constant 85 + 208(Particle): TypeStruct 87(fvec4) 87(fvec4) 87(fvec4) 87(fvec4) 8(float) + 211: 11(int) Constant 27 + 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 210 88 34 211 141 16 16 17 + 214: 11(int) Constant 28 + 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 213 88 34 214 141 16 16 17 + 217: 11(int) Constant 29 + 218: 11(int) Constant 11 + 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 216 88 34 217 218 16 16 17 + 221: 11(int) Constant 30 + 219: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 220 88 34 221 110 16 16 17 + 224: 11(int) Constant 31 + 222: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 223 10 34 224 98 16 16 17 + 227: 11(int) Constant 88 + 225: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 226 38 34 227 16 37 226 16 17 209 212 215 219 222 + 228: TypeRuntimeArray 208(Particle) + 229: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 225 16 + 230(particleIn): TypeStruct 228 + 233: 11(int) Constant 35 + 231: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 232 229 34 233 214 16 16 17 + 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 235 38 34 227 16 37 235 16 17 231 + 236: TypePointer Uniform 230(particleIn) + 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 234 49 16 + 238(particleIn): 236(ptr) Variable Uniform + 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 235 234 34 227 16 37 235 238(particleIn) 149 + 243: 89(int) Constant 4 + 246: 8(float) Constant 1065353216 + 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 251: TypeRuntimeArray 208(Particle) + 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 225 16 +253(particleOut): TypeStruct 251 + 255: 11(int) Constant 37 + 254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 232 252 34 255 221 16 16 17 + 258: 11(int) Constant 89 + 256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 257 38 34 258 16 37 257 16 17 254 + 259: TypePointer Uniform 253(particleOut) + 260: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 256 49 16 +261(particleOut): 259(ptr) Variable Uniform + 262: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 257 256 34 258 16 37 257 261(particleOut) 149 + 267: TypePointer Uniform 87(fvec4) + 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 88 49 16 + 274: 11(int) Constant 90 + 275: 89(int) Constant 1 + 276: 8(float) Constant 0 + 277: 87(fvec4) ConstantComposite 276 276 276 276 + 280: 11(int) Constant 91 + 285: 11(int) Constant 95 + 283: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 284 19 34 285 16 167 39 + 289: 89(int) Constant 9 + 298: 11(int) Constant 97 + 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 210 19 34 298 16 167 39 + 307: 11(int) Constant 98 + 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 213 19 34 307 16 167 39 + 316: 11(int) Constant 102 + 321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 325: 11(int) Constant 103 + 342: 11(int) Constant 106 + 351: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 355: 11(int) Constant 107 + 372: 11(int) Constant 110 + 381: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 385: 11(int) Constant 111 + 390: 89(int) Constant 5 + 406: 11(int) Constant 114 + 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 415: 11(int) Constant 115 + 435: 11(int) Constant 118 + 448: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 452: 11(int) Constant 119 + 458: 89(int) Constant 6 + 474: 11(int) Constant 122 + 483: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 487: 11(int) Constant 123 + 508: 11(int) Constant 126 + 525: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 529: 11(int) Constant 127 + 550: 11(int) Constant 130 + 563: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 567: 11(int) Constant 131 + 585: 89(int) Constant 3 + 589: 11(int) Constant 134 + 599: 11(int) Constant 137 + 597: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 598 19 34 599 16 167 39 + 609: 11(int) Constant 138 + 616: 8(float) Constant 1056964608 + 633: 11(int) Constant 139 + 648: 11(int) Constant 142 + 646: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 647 19 34 648 16 167 39 + 655: 89(int) Constant 8 + 662: 11(int) Constant 143 + 664: 89(int) Constant 7 + 667: 8(float) Constant 1008981770 + 672: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 676: 11(int) Constant 145 + 695: 11(int) Constant 147 +697(PushConstants): TypeStruct 11(int) + 700: 11(int) Constant 67 + 698: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 699 13 34 700 106 16 16 17 + 703: 11(int) Constant 151 + 701: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 702 38 34 703 16 37 702 16 17 698 + 704($Global): TypeStruct 697(PushConstants) + 707: 11(int) Constant 71 + 705: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 706 701 34 707 110 16 16 17 + 708: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 709 38 34 703 16 37 709 16 17 705 + 710: TypePointer Uniform 704($Global) + 711: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 708 49 16 + 712: 710(ptr) Variable Uniform + 713: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 148 708 34 703 16 37 148 712 149 + 714: TypePointer Uniform 11(int) + 715: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 13 49 16 + 723: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 167 + 726: 11(int) Constant 152 + 725: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 220 19 34 726 16 723 39 + 730: 18(fvec3) ConstantComposite 276 276 276 + 734: 11(int) Constant 153 + 732: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 733 19 34 734 16 723 39 + 738: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 739 19 34 734 16 723 39 + 742: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 743 19 34 734 16 723 39 + 747: 11(int) Constant 154 + 752: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 723 + 756: 11(int) Constant 155 + 761: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 752 + 765: 11(int) Constant 156 + 774: 11(int) Constant 157 + 787: 11(int) Constant 158 + 799: 11(int) Constant 159 + 811: 11(int) Constant 161 + 820: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 752 + 824: 11(int) Constant 162 + 836: 11(int) Constant 163 + 849: 11(int) Constant 164 + 858: 11(int) Constant 165 + 870: 11(int) Constant 168 + 879: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 723 + 883: 11(int) Constant 169 + 888: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 879 + 892: 11(int) Constant 170 + 904: 11(int) Constant 171 + 917: 11(int) Constant 172 + 926: 11(int) Constant 173 + 938: 11(int) Constant 175 + 947: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 34 16 16 879 + 951: 11(int) Constant 176 + 960: 11(int) Constant 177 + 973: 11(int) Constant 178 + 985: 11(int) Constant 179 + 997: 11(int) Constant 182 + 1008: TypePointer Input 54(ivec3) + 1009(id): 1008(ptr) Variable Input 6(main): 4 Function None 5 7: Label - 985(id): 56(ptr) Variable Function - 989(param): 56(ptr) Variable Function - 988: 54(ivec3) Load 987(id) - Store 985(id) 988 - 990: 54(ivec3) Load 985(id) - Store 989(param) 990 - 991: 4 FunctionCall 61(@main(vu3;) 989(param) + 1007(id): 56(ptr) Variable Function + 1011(param): 56(ptr) Variable Function + 1010: 54(ivec3) Load 1009(id) + Store 1007(id) 1010 + 1012: 54(ivec3) Load 1007(id) + Store 1011(param) 1012 + 1013: 4 FunctionCall 61(@main(vu3;) 1011(param) Return FunctionEnd 30(springForce(vf3;vf3;f1;): 18(fvec3) Function None 25 @@ -631,800 +653,800 @@ void main(uint3 id : SV_DispatchThreadID) 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 85 85 16 16 83: 18(fvec3) Load 73(dist) 86: 18(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 83 - 133: 131(ptr) AccessChain 125 129 130 - 134: 8(float) Load 133 - 135: 18(fvec3) VectorTimesScalar 86 134 - 136: 18(fvec3) Load 73(dist) - 137: 8(float) ExtInst 3(GLSL.std.450) 66(Length) 136 - 138: 8(float) Load 29(restDist) - 139: 8(float) FSub 137 138 - 140: 18(fvec3) VectorTimesScalar 135 139 - ReturnValue 140 + 154: 152(ptr) AccessChain 146 150 151 + 155: 8(float) Load 154 + 156: 18(fvec3) VectorTimesScalar 86 155 + 157: 18(fvec3) Load 73(dist) + 158: 8(float) ExtInst 3(GLSL.std.450) 66(Length) 157 + 159: 8(float) Load 29(restDist) + 160: 8(float) FSub 158 159 + 161: 18(fvec3) VectorTimesScalar 156 160 + ReturnValue 161 FunctionEnd 61(@main(vu3;): 4 Function None 58 60(id): 56(ptr) FunctionParameter 62: Label - 149(index): 147(ptr) Variable Function - 257(force): 20(ptr) Variable Function - 271(pos): 20(ptr) Variable Function - 281(vel): 20(ptr) Variable Function - 304(param): 20(ptr) Variable Function - 308(param): 20(ptr) Variable Function - 310(param): 23(ptr) Variable Function - 334(param): 20(ptr) Variable Function - 338(param): 20(ptr) Variable Function - 340(param): 23(ptr) Variable Function - 368(param): 20(ptr) Variable Function - 372(param): 20(ptr) Variable Function - 374(param): 23(ptr) Variable Function - 397(param): 20(ptr) Variable Function - 401(param): 20(ptr) Variable Function - 403(param): 23(ptr) Variable Function - 436(param): 20(ptr) Variable Function - 440(param): 20(ptr) Variable Function - 442(param): 23(ptr) Variable Function - 470(param): 20(ptr) Variable Function - 474(param): 20(ptr) Variable Function - 476(param): 23(ptr) Variable Function - 512(param): 20(ptr) Variable Function - 516(param): 20(ptr) Variable Function - 518(param): 23(ptr) Variable Function - 550(param): 20(ptr) Variable Function - 554(param): 20(ptr) Variable Function - 556(param): 23(ptr) Variable Function - 573(f): 20(ptr) Variable Function - 622(sphereDist): 20(ptr) Variable Function - 702(normal): 20(ptr) Variable Function - 709(a): 20(ptr) Variable Function - 715(b): 20(ptr) Variable Function - 719(c): 20(ptr) Variable Function + 170(index): 168(ptr) Variable Function + 282(force): 20(ptr) Variable Function + 296(pos): 20(ptr) Variable Function + 305(vel): 20(ptr) Variable Function + 327(param): 20(ptr) Variable Function + 331(param): 20(ptr) Variable Function + 333(param): 23(ptr) Variable Function + 357(param): 20(ptr) Variable Function + 361(param): 20(ptr) Variable Function + 363(param): 23(ptr) Variable Function + 391(param): 20(ptr) Variable Function + 395(param): 20(ptr) Variable Function + 397(param): 23(ptr) Variable Function + 420(param): 20(ptr) Variable Function + 424(param): 20(ptr) Variable Function + 426(param): 23(ptr) Variable Function + 459(param): 20(ptr) Variable Function + 463(param): 20(ptr) Variable Function + 465(param): 23(ptr) Variable Function + 493(param): 20(ptr) Variable Function + 497(param): 20(ptr) Variable Function + 499(param): 23(ptr) Variable Function + 535(param): 20(ptr) Variable Function + 539(param): 20(ptr) Variable Function + 541(param): 23(ptr) Variable Function + 573(param): 20(ptr) Variable Function + 577(param): 20(ptr) Variable Function + 579(param): 23(ptr) Variable Function + 596(f): 20(ptr) Variable Function + 645(sphereDist): 20(ptr) Variable Function + 724(normal): 20(ptr) Variable Function + 731(a): 20(ptr) Variable Function + 737(b): 20(ptr) Variable Function + 741(c): 20(ptr) Variable Function 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 64 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 65 65 16 16 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 66 60(id) 44 - 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 64 61(@main(vu3;) - 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 152 152 16 16 - 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 150 149(index) 44 - 156: 147(ptr) AccessChain 60(id) 38 - 157: 11(int) Load 156 - 161: 159(ptr) AccessChain 125 129 158 16 - 162: 89(int) Load 161 - 163: 11(int) Bitcast 162 - 164: 11(int) IMul 157 163 - 165: 147(ptr) AccessChain 60(id) 16 - 166: 11(int) Load 165 - 167: 11(int) IAdd 164 166 - Store 149(index) 167 - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 170 170 16 16 - 168: 11(int) Load 149(index) - 171: 159(ptr) AccessChain 125 129 158 16 - 172: 89(int) Load 171 - 173: 159(ptr) AccessChain 125 129 158 38 - 174: 89(int) Load 173 - 175: 89(int) IMul 172 174 - 176: 11(int) Bitcast 175 - 180: 177(bool) UGreaterThan 168 176 - SelectionMerge 182 None - BranchConditional 180 181 182 - 181: Label - 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 184: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 185 185 16 16 + 166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 64 61(@main(vu3;) + 175: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 173 173 16 16 + 174: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 171 170(index) 44 + 177: 168(ptr) AccessChain 60(id) 38 + 178: 11(int) Load 177 + 182: 180(ptr) AccessChain 146 150 179 16 + 183: 89(int) Load 182 + 184: 11(int) Bitcast 183 + 185: 11(int) IMul 178 184 + 186: 168(ptr) AccessChain 60(id) 16 + 187: 11(int) Load 186 + 188: 11(int) IAdd 185 187 + Store 170(index) 188 + 190: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 191 191 16 16 + 189: 11(int) Load 170(index) + 192: 180(ptr) AccessChain 146 150 179 16 + 193: 89(int) Load 192 + 194: 180(ptr) AccessChain 146 150 179 38 + 195: 89(int) Load 194 + 196: 89(int) IMul 193 195 + 197: 11(int) Bitcast 196 + 201: 198(bool) UGreaterThan 189 197 + SelectionMerge 203 None + BranchConditional 201 202 203 + 202: Label + 204: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 206 206 16 16 Return - 182: Label - 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 217: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 201 201 16 16 - 215: 11(int) Load 149(index) - 219: 131(ptr) AccessChain 213(particleIn) 129 215 218 - 220: 8(float) Load 219 - 222: 177(bool) FOrdEqual 220 221 - SelectionMerge 224 None - BranchConditional 222 223 224 - 223: Label - 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 225 - 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 233 233 16 16 - 238: 11(int) Load 149(index) - 241: 11(int) Load 149(index) - 244: 242(ptr) AccessChain 236(particleOut) 129 241 129 - 245: 87(fvec4) Load 244 - 246: 242(ptr) AccessChain 236(particleOut) 129 238 129 - Store 246 245 - 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 249 249 16 16 - 247: 11(int) Load 149(index) - 253: 242(ptr) AccessChain 236(particleOut) 129 247 250 - Store 253 252 - 254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 255 255 16 16 + 203: Label + 241: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 227 227 16 16 + 240: 11(int) Load 170(index) + 244: 152(ptr) AccessChain 238(particleIn) 150 240 243 + 245: 8(float) Load 244 + 247: 198(bool) FOrdEqual 245 246 + SelectionMerge 249 None + BranchConditional 247 248 249 + 248: Label + 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 250 + 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 258 258 16 16 + 263: 11(int) Load 170(index) + 266: 11(int) Load 170(index) + 269: 267(ptr) AccessChain 261(particleOut) 150 266 150 + 270: 87(fvec4) Load 269 + 271: 267(ptr) AccessChain 261(particleOut) 150 263 150 + Store 271 270 + 273: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 274 274 16 16 + 272: 11(int) Load 170(index) + 278: 267(ptr) AccessChain 261(particleOut) 150 272 275 + Store 278 277 + 279: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 280 280 16 16 Return - 224: Label - 262: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 263: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 260 260 16 16 - 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 258 257(force) 44 - 265: 242(ptr) AccessChain 125 129 264 - 266: 87(fvec4) Load 265 - 267: 18(fvec3) VectorShuffle 266 266 0 1 2 - 268: 131(ptr) AccessChain 125 129 250 - 269: 8(float) Load 268 - 270: 18(fvec3) VectorTimesScalar 267 269 - Store 257(force) 270 - 276: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 274 274 16 16 - 275: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 272 271(pos) 44 - 277: 11(int) Load 149(index) - 278: 242(ptr) AccessChain 213(particleIn) 129 277 129 - 279: 87(fvec4) Load 278 - 280: 18(fvec3) VectorShuffle 279 279 0 1 2 - Store 271(pos) 280 - 286: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 284 284 16 16 - 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 282 281(vel) 44 - 287: 11(int) Load 149(index) - 288: 242(ptr) AccessChain 213(particleIn) 129 287 250 - 289: 87(fvec4) Load 288 - 290: 18(fvec3) VectorShuffle 289 289 0 1 2 - Store 281(vel) 290 - 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 293 293 16 16 - 291: 147(ptr) AccessChain 60(id) 16 - 294: 11(int) Load 291 - 295: 177(bool) UGreaterThan 294 16 - SelectionMerge 297 None - BranchConditional 295 296 297 - 296: Label - 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 298 - 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 302 302 16 16 - 299: 11(int) Load 149(index) - 303: 11(int) ISub 299 38 - 305: 242(ptr) AccessChain 213(particleIn) 129 303 129 - 306: 87(fvec4) Load 305 - 307: 18(fvec3) VectorShuffle 306 306 0 1 2 - Store 304(param) 307 - 309: 18(fvec3) Load 271(pos) - Store 308(param) 309 - 311: 131(ptr) AccessChain 125 129 218 - 312: 8(float) Load 311 - Store 310(param) 312 - 313: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 304(param) 308(param) 310(param) - 314: 18(fvec3) Load 257(force) - 315: 18(fvec3) FAdd 314 313 - Store 257(force) 315 - Branch 297 - 297: Label - 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 318: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 319 319 16 16 - 316: 147(ptr) AccessChain 60(id) 16 - 320: 11(int) Load 316 - 321: 159(ptr) AccessChain 125 129 158 16 - 322: 89(int) Load 321 - 323: 89(int) ISub 322 250 - 324: 11(int) Bitcast 323 - 325: 177(bool) ULessThan 320 324 - SelectionMerge 327 None - BranchConditional 325 326 327 - 326: Label - 330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 328 - 331: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 332 332 16 16 - 329: 11(int) Load 149(index) - 333: 11(int) IAdd 329 38 - 335: 242(ptr) AccessChain 213(particleIn) 129 333 129 - 336: 87(fvec4) Load 335 - 337: 18(fvec3) VectorShuffle 336 336 0 1 2 - Store 334(param) 337 - 339: 18(fvec3) Load 271(pos) - Store 338(param) 339 - 341: 131(ptr) AccessChain 125 129 218 - 342: 8(float) Load 341 - Store 340(param) 342 - 343: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 334(param) 338(param) 340(param) - 344: 18(fvec3) Load 257(force) - 345: 18(fvec3) FAdd 344 343 - Store 257(force) 345 - Branch 327 - 327: Label - 347: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 349 349 16 16 - 346: 147(ptr) AccessChain 60(id) 38 - 350: 11(int) Load 346 - 351: 159(ptr) AccessChain 125 129 158 38 - 352: 89(int) Load 351 - 353: 89(int) ISub 352 250 - 354: 11(int) Bitcast 353 - 355: 177(bool) ULessThan 350 354 - SelectionMerge 357 None - BranchConditional 355 356 357 - 356: Label - 360: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 358 - 361: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 362 362 16 16 - 359: 11(int) Load 149(index) - 363: 159(ptr) AccessChain 125 129 158 16 - 364: 89(int) Load 363 - 365: 11(int) Bitcast 364 - 366: 11(int) IAdd 359 365 - 369: 242(ptr) AccessChain 213(particleIn) 129 366 129 - 370: 87(fvec4) Load 369 - 371: 18(fvec3) VectorShuffle 370 370 0 1 2 - Store 368(param) 371 - 373: 18(fvec3) Load 271(pos) - Store 372(param) 373 - 375: 131(ptr) AccessChain 125 129 367 - 376: 8(float) Load 375 - Store 374(param) 376 - 377: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 368(param) 372(param) 374(param) - 378: 18(fvec3) Load 257(force) - 379: 18(fvec3) FAdd 378 377 - Store 257(force) 379 - Branch 357 - 357: Label - 381: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 382: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 383 383 16 16 - 380: 147(ptr) AccessChain 60(id) 38 - 384: 11(int) Load 380 - 385: 177(bool) UGreaterThan 384 16 - SelectionMerge 387 None - BranchConditional 385 386 387 - 386: Label - 390: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 388 - 391: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 392 392 16 16 - 389: 11(int) Load 149(index) - 393: 159(ptr) AccessChain 125 129 158 16 - 394: 89(int) Load 393 - 395: 11(int) Bitcast 394 - 396: 11(int) ISub 389 395 - 398: 242(ptr) AccessChain 213(particleIn) 129 396 129 - 399: 87(fvec4) Load 398 - 400: 18(fvec3) VectorShuffle 399 399 0 1 2 - Store 397(param) 400 - 402: 18(fvec3) Load 271(pos) - Store 401(param) 402 - 404: 131(ptr) AccessChain 125 129 367 - 405: 8(float) Load 404 - Store 403(param) 405 - 406: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 397(param) 401(param) 403(param) - 407: 18(fvec3) Load 257(force) - 408: 18(fvec3) FAdd 407 406 - Store 257(force) 408 - Branch 387 - 387: Label - 410: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 412 412 16 16 - 409: 147(ptr) AccessChain 60(id) 16 - 413: 11(int) Load 409 - 414: 177(bool) UGreaterThan 413 16 - 415: 147(ptr) AccessChain 60(id) 38 - 416: 11(int) Load 415 - 417: 159(ptr) AccessChain 125 129 158 38 - 418: 89(int) Load 417 - 419: 89(int) ISub 418 250 - 420: 11(int) Bitcast 419 - 421: 177(bool) ULessThan 416 420 - 422: 177(bool) LogicalAnd 414 421 - SelectionMerge 424 None - BranchConditional 422 423 424 - 423: Label - 427: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 425 - 428: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 429 429 16 16 - 426: 11(int) Load 149(index) - 430: 159(ptr) AccessChain 125 129 158 16 - 431: 89(int) Load 430 - 432: 11(int) Bitcast 431 - 433: 11(int) IAdd 426 432 - 434: 11(int) ISub 433 38 - 437: 242(ptr) AccessChain 213(particleIn) 129 434 129 - 438: 87(fvec4) Load 437 - 439: 18(fvec3) VectorShuffle 438 438 0 1 2 - Store 436(param) 439 - 441: 18(fvec3) Load 271(pos) - Store 440(param) 441 - 443: 131(ptr) AccessChain 125 129 435 - 444: 8(float) Load 443 - Store 442(param) 444 - 445: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 436(param) 440(param) 442(param) - 446: 18(fvec3) Load 257(force) - 447: 18(fvec3) FAdd 446 445 - Store 257(force) 447 - Branch 424 - 424: Label - 449: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 450: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 451 451 16 16 - 448: 147(ptr) AccessChain 60(id) 16 - 452: 11(int) Load 448 - 453: 177(bool) UGreaterThan 452 16 - 454: 147(ptr) AccessChain 60(id) 38 - 455: 11(int) Load 454 - 456: 177(bool) UGreaterThan 455 16 - 457: 177(bool) LogicalAnd 453 456 - SelectionMerge 459 None - BranchConditional 457 458 459 - 458: Label - 462: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 460 - 463: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 464 464 16 16 - 461: 11(int) Load 149(index) - 465: 159(ptr) AccessChain 125 129 158 16 - 466: 89(int) Load 465 - 467: 11(int) Bitcast 466 - 468: 11(int) ISub 461 467 - 469: 11(int) ISub 468 38 - 471: 242(ptr) AccessChain 213(particleIn) 129 469 129 - 472: 87(fvec4) Load 471 - 473: 18(fvec3) VectorShuffle 472 472 0 1 2 - Store 470(param) 473 - 475: 18(fvec3) Load 271(pos) - Store 474(param) 475 - 477: 131(ptr) AccessChain 125 129 435 - 478: 8(float) Load 477 - Store 476(param) 478 - 479: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 470(param) 474(param) 476(param) - 480: 18(fvec3) Load 257(force) - 481: 18(fvec3) FAdd 480 479 - Store 257(force) 481 - Branch 459 - 459: Label - 483: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 484: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 485 485 16 16 - 482: 147(ptr) AccessChain 60(id) 16 - 486: 11(int) Load 482 - 487: 159(ptr) AccessChain 125 129 158 16 - 488: 89(int) Load 487 - 489: 89(int) ISub 488 250 - 490: 11(int) Bitcast 489 - 491: 177(bool) ULessThan 486 490 - 492: 147(ptr) AccessChain 60(id) 38 - 493: 11(int) Load 492 - 494: 159(ptr) AccessChain 125 129 158 38 - 495: 89(int) Load 494 - 496: 89(int) ISub 495 250 - 497: 11(int) Bitcast 496 - 498: 177(bool) ULessThan 493 497 - 499: 177(bool) LogicalAnd 491 498 - SelectionMerge 501 None - BranchConditional 499 500 501 - 500: Label - 504: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 502 - 505: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 506 506 16 16 - 503: 11(int) Load 149(index) - 507: 159(ptr) AccessChain 125 129 158 16 - 508: 89(int) Load 507 - 509: 11(int) Bitcast 508 - 510: 11(int) IAdd 503 509 - 511: 11(int) IAdd 510 38 - 513: 242(ptr) AccessChain 213(particleIn) 129 511 129 - 514: 87(fvec4) Load 513 - 515: 18(fvec3) VectorShuffle 514 514 0 1 2 - Store 512(param) 515 - 517: 18(fvec3) Load 271(pos) - Store 516(param) 517 - 519: 131(ptr) AccessChain 125 129 435 - 520: 8(float) Load 519 - Store 518(param) 520 - 521: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 512(param) 516(param) 518(param) - 522: 18(fvec3) Load 257(force) - 523: 18(fvec3) FAdd 522 521 - Store 257(force) 523 - Branch 501 - 501: Label - 525: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 526: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 527 527 16 16 - 524: 147(ptr) AccessChain 60(id) 16 - 528: 11(int) Load 524 - 529: 159(ptr) AccessChain 125 129 158 16 - 530: 89(int) Load 529 - 531: 89(int) ISub 530 250 - 532: 11(int) Bitcast 531 - 533: 177(bool) ULessThan 528 532 - 534: 147(ptr) AccessChain 60(id) 38 - 535: 11(int) Load 534 - 536: 177(bool) UGreaterThan 535 16 - 537: 177(bool) LogicalAnd 533 536 - SelectionMerge 539 None - BranchConditional 537 538 539 - 538: Label - 542: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 540 - 543: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 544 544 16 16 - 541: 11(int) Load 149(index) - 545: 159(ptr) AccessChain 125 129 158 16 - 546: 89(int) Load 545 - 547: 11(int) Bitcast 546 - 548: 11(int) ISub 541 547 - 549: 11(int) IAdd 548 38 - 551: 242(ptr) AccessChain 213(particleIn) 129 549 129 - 552: 87(fvec4) Load 551 - 553: 18(fvec3) VectorShuffle 552 552 0 1 2 - Store 550(param) 553 - 555: 18(fvec3) Load 271(pos) - Store 554(param) 555 - 557: 131(ptr) AccessChain 125 129 435 - 558: 8(float) Load 557 - Store 556(param) 558 - 559: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 550(param) 554(param) 556(param) - 560: 18(fvec3) Load 257(force) - 561: 18(fvec3) FAdd 560 559 - Store 257(force) 561 - Branch 539 - 539: Label - 564: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 565: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 566 566 16 16 - 563: 131(ptr) AccessChain 125 129 562 - 567: 8(float) Load 563 - 568: 8(float) FNegate 567 - 569: 18(fvec3) Load 281(vel) - 570: 18(fvec3) VectorTimesScalar 569 568 - 571: 18(fvec3) Load 257(force) - 572: 18(fvec3) FAdd 571 570 - Store 257(force) 572 - 578: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 576 576 16 16 - 577: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 574 573(f) 44 - 579: 18(fvec3) Load 257(force) - 580: 131(ptr) AccessChain 125 129 250 - 581: 8(float) Load 580 - 582: 8(float) FDiv 221 581 - 583: 18(fvec3) VectorTimesScalar 579 582 - Store 573(f) 583 - 585: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 586 586 16 16 - 584: 11(int) Load 149(index) - 587: 18(fvec3) Load 271(pos) - 588: 18(fvec3) Load 281(vel) - 589: 131(ptr) AccessChain 125 129 129 - 590: 8(float) Load 589 - 591: 18(fvec3) VectorTimesScalar 588 590 - 592: 18(fvec3) FAdd 587 591 - 594: 18(fvec3) Load 573(f) - 595: 18(fvec3) VectorTimesScalar 594 593 - 596: 131(ptr) AccessChain 125 129 129 - 597: 8(float) Load 596 - 598: 18(fvec3) VectorTimesScalar 595 597 - 599: 131(ptr) AccessChain 125 129 129 - 600: 8(float) Load 599 - 601: 18(fvec3) VectorTimesScalar 598 600 - 602: 18(fvec3) FAdd 592 601 - 603: 8(float) CompositeExtract 602 0 - 604: 8(float) CompositeExtract 602 1 - 605: 8(float) CompositeExtract 602 2 - 606: 87(fvec4) CompositeConstruct 603 604 605 221 - 607: 242(ptr) AccessChain 236(particleOut) 129 584 129 - Store 607 606 - 609: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 610 610 16 16 - 608: 11(int) Load 149(index) - 611: 18(fvec3) Load 281(vel) - 612: 18(fvec3) Load 573(f) - 613: 131(ptr) AccessChain 125 129 129 - 614: 8(float) Load 613 - 615: 18(fvec3) VectorTimesScalar 612 614 - 616: 18(fvec3) FAdd 611 615 - 617: 8(float) CompositeExtract 616 0 - 618: 8(float) CompositeExtract 616 1 - 619: 8(float) CompositeExtract 616 2 - 620: 87(fvec4) CompositeConstruct 617 618 619 251 - 621: 242(ptr) AccessChain 236(particleOut) 129 608 250 - Store 621 620 - 627: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 625 625 16 16 - 626: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 623 622(sphereDist) 44 - 628: 11(int) Load 149(index) - 629: 242(ptr) AccessChain 236(particleOut) 129 628 129 - 630: 87(fvec4) Load 629 - 631: 18(fvec3) VectorShuffle 630 630 0 1 2 - 633: 242(ptr) AccessChain 125 129 632 - 634: 87(fvec4) Load 633 - 635: 18(fvec3) VectorShuffle 634 634 0 1 2 - 636: 18(fvec3) FSub 631 635 - Store 622(sphereDist) 636 - 638: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 639 639 16 16 - 637: 18(fvec3) Load 622(sphereDist) - 640: 8(float) ExtInst 3(GLSL.std.450) 66(Length) 637 - 642: 131(ptr) AccessChain 125 129 641 - 643: 8(float) Load 642 - 645: 8(float) FAdd 643 644 - 646: 177(bool) FOrdLessThan 640 645 - SelectionMerge 648 None - BranchConditional 646 647 648 - 647: Label - 651: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 649 - 652: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 653 653 16 16 - 650: 11(int) Load 149(index) - 654: 242(ptr) AccessChain 125 129 632 - 655: 87(fvec4) Load 654 - 656: 18(fvec3) VectorShuffle 655 655 0 1 2 - 657: 18(fvec3) Load 622(sphereDist) - 658: 18(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 657 - 659: 131(ptr) AccessChain 125 129 641 - 660: 8(float) Load 659 - 661: 8(float) FAdd 660 644 - 662: 18(fvec3) VectorTimesScalar 658 661 - 663: 18(fvec3) FAdd 656 662 - 664: 131(ptr) AccessChain 236(particleOut) 129 650 129 16 - 665: 8(float) CompositeExtract 663 0 - Store 664 665 - 666: 131(ptr) AccessChain 236(particleOut) 129 650 129 38 - 667: 8(float) CompositeExtract 663 1 - Store 666 667 - 668: 131(ptr) AccessChain 236(particleOut) 129 650 129 49 - 669: 8(float) CompositeExtract 663 2 - Store 668 669 - 671: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 672 672 16 16 - 670: 11(int) Load 149(index) - 673: 242(ptr) AccessChain 236(particleOut) 129 670 250 - Store 673 252 - Branch 648 - 648: Label - 695: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 146 - 696: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 681 681 16 16 - 694: 692(ptr) AccessChain 690 129 129 - 697: 11(int) Load 694 - 698: 177(bool) IEqual 697 38 - SelectionMerge 700 None - BranchConditional 698 699 700 - 699: Label - 706: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 701 - 707: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 704 704 16 16 - 705: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 703 702(normal) 44 - Store 702(normal) 708 - 714: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 712 712 16 16 - 713: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 710 709(a) 44 - 718: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 716 715(b) 44 - 722: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 720 719(c) 44 - 724: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 725 725 16 16 - 723: 147(ptr) AccessChain 60(id) 38 - 726: 11(int) Load 723 - 727: 177(bool) UGreaterThan 726 16 - SelectionMerge 729 None - BranchConditional 727 728 729 - 728: Label - 732: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 730 - 733: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 734 734 16 16 - 731: 147(ptr) AccessChain 60(id) 16 - 735: 11(int) Load 731 - 736: 177(bool) UGreaterThan 735 16 - SelectionMerge 738 None - BranchConditional 736 737 738 - 737: Label - 741: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 739 - 742: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 743 743 16 16 - 740: 11(int) Load 149(index) - 744: 11(int) ISub 740 38 - 745: 242(ptr) AccessChain 213(particleIn) 129 744 129 - 746: 87(fvec4) Load 745 - 747: 18(fvec3) VectorShuffle 746 746 0 1 2 - 748: 18(fvec3) Load 271(pos) - 749: 18(fvec3) FSub 747 748 - Store 709(a) 749 - 751: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 752 752 16 16 - 750: 11(int) Load 149(index) - 753: 159(ptr) AccessChain 125 129 158 16 - 754: 89(int) Load 753 - 755: 11(int) Bitcast 754 - 756: 11(int) ISub 750 755 - 757: 11(int) ISub 756 38 - 758: 242(ptr) AccessChain 213(particleIn) 129 757 129 - 759: 87(fvec4) Load 758 - 760: 18(fvec3) VectorShuffle 759 759 0 1 2 - 761: 18(fvec3) Load 271(pos) - 762: 18(fvec3) FSub 760 761 - Store 715(b) 762 + 249: Label + 287: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 285 285 16 16 + 286: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 283 282(force) 44 + 290: 267(ptr) AccessChain 146 150 289 + 291: 87(fvec4) Load 290 + 292: 18(fvec3) VectorShuffle 291 291 0 1 2 + 293: 152(ptr) AccessChain 146 150 275 + 294: 8(float) Load 293 + 295: 18(fvec3) VectorTimesScalar 292 294 + Store 282(force) 295 + 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 298 298 16 16 + 299: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 297 296(pos) 44 + 301: 11(int) Load 170(index) + 302: 267(ptr) AccessChain 238(particleIn) 150 301 150 + 303: 87(fvec4) Load 302 + 304: 18(fvec3) VectorShuffle 303 303 0 1 2 + Store 296(pos) 304 + 309: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 307 307 16 16 + 308: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 306 305(vel) 44 + 310: 11(int) Load 170(index) + 311: 267(ptr) AccessChain 238(particleIn) 150 310 275 + 312: 87(fvec4) Load 311 + 313: 18(fvec3) VectorShuffle 312 312 0 1 2 + Store 305(vel) 313 + 315: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 316 316 16 16 + 314: 168(ptr) AccessChain 60(id) 16 + 317: 11(int) Load 314 + 318: 198(bool) UGreaterThan 317 16 + SelectionMerge 320 None + BranchConditional 318 319 320 + 319: Label + 323: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 321 + 324: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 325 325 16 16 + 322: 11(int) Load 170(index) + 326: 11(int) ISub 322 38 + 328: 267(ptr) AccessChain 238(particleIn) 150 326 150 + 329: 87(fvec4) Load 328 + 330: 18(fvec3) VectorShuffle 329 329 0 1 2 + Store 327(param) 330 + 332: 18(fvec3) Load 296(pos) + Store 331(param) 332 + 334: 152(ptr) AccessChain 146 150 243 + 335: 8(float) Load 334 + Store 333(param) 335 + 336: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 327(param) 331(param) 333(param) + 337: 18(fvec3) Load 282(force) + 338: 18(fvec3) FAdd 337 336 + Store 282(force) 338 + Branch 320 + 320: Label + 340: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 341: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 342 342 16 16 + 339: 168(ptr) AccessChain 60(id) 16 + 343: 11(int) Load 339 + 344: 180(ptr) AccessChain 146 150 179 16 + 345: 89(int) Load 344 + 346: 89(int) ISub 345 275 + 347: 11(int) Bitcast 346 + 348: 198(bool) ULessThan 343 347 + SelectionMerge 350 None + BranchConditional 348 349 350 + 349: Label + 353: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 351 + 354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 355 355 16 16 + 352: 11(int) Load 170(index) + 356: 11(int) IAdd 352 38 + 358: 267(ptr) AccessChain 238(particleIn) 150 356 150 + 359: 87(fvec4) Load 358 + 360: 18(fvec3) VectorShuffle 359 359 0 1 2 + Store 357(param) 360 + 362: 18(fvec3) Load 296(pos) + Store 361(param) 362 + 364: 152(ptr) AccessChain 146 150 243 + 365: 8(float) Load 364 + Store 363(param) 365 + 366: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 357(param) 361(param) 363(param) + 367: 18(fvec3) Load 282(force) + 368: 18(fvec3) FAdd 367 366 + Store 282(force) 368 + Branch 350 + 350: Label + 370: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 371: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 372 372 16 16 + 369: 168(ptr) AccessChain 60(id) 38 + 373: 11(int) Load 369 + 374: 180(ptr) AccessChain 146 150 179 38 + 375: 89(int) Load 374 + 376: 89(int) ISub 375 275 + 377: 11(int) Bitcast 376 + 378: 198(bool) ULessThan 373 377 + SelectionMerge 380 None + BranchConditional 378 379 380 + 379: Label + 383: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 381 + 384: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 385 385 16 16 + 382: 11(int) Load 170(index) + 386: 180(ptr) AccessChain 146 150 179 16 + 387: 89(int) Load 386 + 388: 11(int) Bitcast 387 + 389: 11(int) IAdd 382 388 + 392: 267(ptr) AccessChain 238(particleIn) 150 389 150 + 393: 87(fvec4) Load 392 + 394: 18(fvec3) VectorShuffle 393 393 0 1 2 + Store 391(param) 394 + 396: 18(fvec3) Load 296(pos) + Store 395(param) 396 + 398: 152(ptr) AccessChain 146 150 390 + 399: 8(float) Load 398 + Store 397(param) 399 + 400: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 391(param) 395(param) 397(param) + 401: 18(fvec3) Load 282(force) + 402: 18(fvec3) FAdd 401 400 + Store 282(force) 402 + Branch 380 + 380: Label + 404: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 405: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 406 406 16 16 + 403: 168(ptr) AccessChain 60(id) 38 + 407: 11(int) Load 403 + 408: 198(bool) UGreaterThan 407 16 + SelectionMerge 410 None + BranchConditional 408 409 410 + 409: Label + 413: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 411 + 414: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 415 415 16 16 + 412: 11(int) Load 170(index) + 416: 180(ptr) AccessChain 146 150 179 16 + 417: 89(int) Load 416 + 418: 11(int) Bitcast 417 + 419: 11(int) ISub 412 418 + 421: 267(ptr) AccessChain 238(particleIn) 150 419 150 + 422: 87(fvec4) Load 421 + 423: 18(fvec3) VectorShuffle 422 422 0 1 2 + Store 420(param) 423 + 425: 18(fvec3) Load 296(pos) + Store 424(param) 425 + 427: 152(ptr) AccessChain 146 150 390 + 428: 8(float) Load 427 + Store 426(param) 428 + 429: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 420(param) 424(param) 426(param) + 430: 18(fvec3) Load 282(force) + 431: 18(fvec3) FAdd 430 429 + Store 282(force) 431 + Branch 410 + 410: Label + 433: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 434: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 435 435 16 16 + 432: 168(ptr) AccessChain 60(id) 16 + 436: 11(int) Load 432 + 437: 198(bool) UGreaterThan 436 16 + 438: 168(ptr) AccessChain 60(id) 38 + 439: 11(int) Load 438 + 440: 180(ptr) AccessChain 146 150 179 38 + 441: 89(int) Load 440 + 442: 89(int) ISub 441 275 + 443: 11(int) Bitcast 442 + 444: 198(bool) ULessThan 439 443 + 445: 198(bool) LogicalAnd 437 444 + SelectionMerge 447 None + BranchConditional 445 446 447 + 446: Label + 450: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 448 + 451: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 452 452 16 16 + 449: 11(int) Load 170(index) + 453: 180(ptr) AccessChain 146 150 179 16 + 454: 89(int) Load 453 + 455: 11(int) Bitcast 454 + 456: 11(int) IAdd 449 455 + 457: 11(int) ISub 456 38 + 460: 267(ptr) AccessChain 238(particleIn) 150 457 150 + 461: 87(fvec4) Load 460 + 462: 18(fvec3) VectorShuffle 461 461 0 1 2 + Store 459(param) 462 + 464: 18(fvec3) Load 296(pos) + Store 463(param) 464 + 466: 152(ptr) AccessChain 146 150 458 + 467: 8(float) Load 466 + Store 465(param) 467 + 468: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 459(param) 463(param) 465(param) + 469: 18(fvec3) Load 282(force) + 470: 18(fvec3) FAdd 469 468 + Store 282(force) 470 + Branch 447 + 447: Label + 472: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 473: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 474 474 16 16 + 471: 168(ptr) AccessChain 60(id) 16 + 475: 11(int) Load 471 + 476: 198(bool) UGreaterThan 475 16 + 477: 168(ptr) AccessChain 60(id) 38 + 478: 11(int) Load 477 + 479: 198(bool) UGreaterThan 478 16 + 480: 198(bool) LogicalAnd 476 479 + SelectionMerge 482 None + BranchConditional 480 481 482 + 481: Label + 485: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 483 + 486: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 487 487 16 16 + 484: 11(int) Load 170(index) + 488: 180(ptr) AccessChain 146 150 179 16 + 489: 89(int) Load 488 + 490: 11(int) Bitcast 489 + 491: 11(int) ISub 484 490 + 492: 11(int) ISub 491 38 + 494: 267(ptr) AccessChain 238(particleIn) 150 492 150 + 495: 87(fvec4) Load 494 + 496: 18(fvec3) VectorShuffle 495 495 0 1 2 + Store 493(param) 496 + 498: 18(fvec3) Load 296(pos) + Store 497(param) 498 + 500: 152(ptr) AccessChain 146 150 458 + 501: 8(float) Load 500 + Store 499(param) 501 + 502: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 493(param) 497(param) 499(param) + 503: 18(fvec3) Load 282(force) + 504: 18(fvec3) FAdd 503 502 + Store 282(force) 504 + Branch 482 + 482: Label + 506: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 507: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 508 508 16 16 + 505: 168(ptr) AccessChain 60(id) 16 + 509: 11(int) Load 505 + 510: 180(ptr) AccessChain 146 150 179 16 + 511: 89(int) Load 510 + 512: 89(int) ISub 511 275 + 513: 11(int) Bitcast 512 + 514: 198(bool) ULessThan 509 513 + 515: 168(ptr) AccessChain 60(id) 38 + 516: 11(int) Load 515 + 517: 180(ptr) AccessChain 146 150 179 38 + 518: 89(int) Load 517 + 519: 89(int) ISub 518 275 + 520: 11(int) Bitcast 519 + 521: 198(bool) ULessThan 516 520 + 522: 198(bool) LogicalAnd 514 521 + SelectionMerge 524 None + BranchConditional 522 523 524 + 523: Label + 527: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 525 + 528: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 529 529 16 16 + 526: 11(int) Load 170(index) + 530: 180(ptr) AccessChain 146 150 179 16 + 531: 89(int) Load 530 + 532: 11(int) Bitcast 531 + 533: 11(int) IAdd 526 532 + 534: 11(int) IAdd 533 38 + 536: 267(ptr) AccessChain 238(particleIn) 150 534 150 + 537: 87(fvec4) Load 536 + 538: 18(fvec3) VectorShuffle 537 537 0 1 2 + Store 535(param) 538 + 540: 18(fvec3) Load 296(pos) + Store 539(param) 540 + 542: 152(ptr) AccessChain 146 150 458 + 543: 8(float) Load 542 + Store 541(param) 543 + 544: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 535(param) 539(param) 541(param) + 545: 18(fvec3) Load 282(force) + 546: 18(fvec3) FAdd 545 544 + Store 282(force) 546 + Branch 524 + 524: Label + 548: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 549: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 550 550 16 16 + 547: 168(ptr) AccessChain 60(id) 16 + 551: 11(int) Load 547 + 552: 180(ptr) AccessChain 146 150 179 16 + 553: 89(int) Load 552 + 554: 89(int) ISub 553 275 + 555: 11(int) Bitcast 554 + 556: 198(bool) ULessThan 551 555 + 557: 168(ptr) AccessChain 60(id) 38 + 558: 11(int) Load 557 + 559: 198(bool) UGreaterThan 558 16 + 560: 198(bool) LogicalAnd 556 559 + SelectionMerge 562 None + BranchConditional 560 561 562 + 561: Label + 565: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 563 + 566: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 567 567 16 16 + 564: 11(int) Load 170(index) + 568: 180(ptr) AccessChain 146 150 179 16 + 569: 89(int) Load 568 + 570: 11(int) Bitcast 569 + 571: 11(int) ISub 564 570 + 572: 11(int) IAdd 571 38 + 574: 267(ptr) AccessChain 238(particleIn) 150 572 150 + 575: 87(fvec4) Load 574 + 576: 18(fvec3) VectorShuffle 575 575 0 1 2 + Store 573(param) 576 + 578: 18(fvec3) Load 296(pos) + Store 577(param) 578 + 580: 152(ptr) AccessChain 146 150 458 + 581: 8(float) Load 580 + Store 579(param) 581 + 582: 18(fvec3) FunctionCall 30(springForce(vf3;vf3;f1;) 573(param) 577(param) 579(param) + 583: 18(fvec3) Load 282(force) + 584: 18(fvec3) FAdd 583 582 + Store 282(force) 584 + Branch 562 + 562: Label + 587: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 588: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 589 589 16 16 + 586: 152(ptr) AccessChain 146 150 585 + 590: 8(float) Load 586 + 591: 8(float) FNegate 590 + 592: 18(fvec3) Load 305(vel) + 593: 18(fvec3) VectorTimesScalar 592 591 + 594: 18(fvec3) Load 282(force) + 595: 18(fvec3) FAdd 594 593 + Store 282(force) 595 + 601: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 599 599 16 16 + 600: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 597 596(f) 44 + 602: 18(fvec3) Load 282(force) + 603: 152(ptr) AccessChain 146 150 275 + 604: 8(float) Load 603 + 605: 8(float) FDiv 246 604 + 606: 18(fvec3) VectorTimesScalar 602 605 + Store 596(f) 606 + 608: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 609 609 16 16 + 607: 11(int) Load 170(index) + 610: 18(fvec3) Load 296(pos) + 611: 18(fvec3) Load 305(vel) + 612: 152(ptr) AccessChain 146 150 150 + 613: 8(float) Load 612 + 614: 18(fvec3) VectorTimesScalar 611 613 + 615: 18(fvec3) FAdd 610 614 + 617: 18(fvec3) Load 596(f) + 618: 18(fvec3) VectorTimesScalar 617 616 + 619: 152(ptr) AccessChain 146 150 150 + 620: 8(float) Load 619 + 621: 18(fvec3) VectorTimesScalar 618 620 + 622: 152(ptr) AccessChain 146 150 150 + 623: 8(float) Load 622 + 624: 18(fvec3) VectorTimesScalar 621 623 + 625: 18(fvec3) FAdd 615 624 + 626: 8(float) CompositeExtract 625 0 + 627: 8(float) CompositeExtract 625 1 + 628: 8(float) CompositeExtract 625 2 + 629: 87(fvec4) CompositeConstruct 626 627 628 246 + 630: 267(ptr) AccessChain 261(particleOut) 150 607 150 + Store 630 629 + 632: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 633 633 16 16 + 631: 11(int) Load 170(index) + 634: 18(fvec3) Load 305(vel) + 635: 18(fvec3) Load 596(f) + 636: 152(ptr) AccessChain 146 150 150 + 637: 8(float) Load 636 + 638: 18(fvec3) VectorTimesScalar 635 637 + 639: 18(fvec3) FAdd 634 638 + 640: 8(float) CompositeExtract 639 0 + 641: 8(float) CompositeExtract 639 1 + 642: 8(float) CompositeExtract 639 2 + 643: 87(fvec4) CompositeConstruct 640 641 642 276 + 644: 267(ptr) AccessChain 261(particleOut) 150 631 275 + Store 644 643 + 650: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 648 648 16 16 + 649: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 646 645(sphereDist) 44 + 651: 11(int) Load 170(index) + 652: 267(ptr) AccessChain 261(particleOut) 150 651 150 + 653: 87(fvec4) Load 652 + 654: 18(fvec3) VectorShuffle 653 653 0 1 2 + 656: 267(ptr) AccessChain 146 150 655 + 657: 87(fvec4) Load 656 + 658: 18(fvec3) VectorShuffle 657 657 0 1 2 + 659: 18(fvec3) FSub 654 658 + Store 645(sphereDist) 659 + 661: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 662 662 16 16 + 660: 18(fvec3) Load 645(sphereDist) + 663: 8(float) ExtInst 3(GLSL.std.450) 66(Length) 660 + 665: 152(ptr) AccessChain 146 150 664 + 666: 8(float) Load 665 + 668: 8(float) FAdd 666 667 + 669: 198(bool) FOrdLessThan 663 668 + SelectionMerge 671 None + BranchConditional 669 670 671 + 670: Label + 674: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 672 + 675: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 676 676 16 16 + 673: 11(int) Load 170(index) + 677: 267(ptr) AccessChain 146 150 655 + 678: 87(fvec4) Load 677 + 679: 18(fvec3) VectorShuffle 678 678 0 1 2 + 680: 18(fvec3) Load 645(sphereDist) + 681: 18(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 680 + 682: 152(ptr) AccessChain 146 150 664 + 683: 8(float) Load 682 + 684: 8(float) FAdd 683 667 + 685: 18(fvec3) VectorTimesScalar 681 684 + 686: 18(fvec3) FAdd 679 685 + 687: 152(ptr) AccessChain 261(particleOut) 150 673 150 16 + 688: 8(float) CompositeExtract 686 0 + Store 687 688 + 689: 152(ptr) AccessChain 261(particleOut) 150 673 150 38 + 690: 8(float) CompositeExtract 686 1 + Store 689 690 + 691: 152(ptr) AccessChain 261(particleOut) 150 673 150 49 + 692: 8(float) CompositeExtract 686 2 + Store 691 692 + 694: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 695 695 16 16 + 693: 11(int) Load 170(index) + 696: 267(ptr) AccessChain 261(particleOut) 150 693 275 + Store 696 277 + Branch 671 + 671: Label + 717: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 167 + 718: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 703 703 16 16 + 716: 714(ptr) AccessChain 712 150 150 + 719: 11(int) Load 716 + 720: 198(bool) IEqual 719 38 + SelectionMerge 722 None + BranchConditional 720 721 722 + 721: Label + 728: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 723 + 729: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 726 726 16 16 + 727: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 725 724(normal) 44 + Store 724(normal) 730 + 736: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 734 734 16 16 + 735: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 732 731(a) 44 + 740: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 738 737(b) 44 + 744: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 742 741(c) 44 + 746: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 747 747 16 16 + 745: 168(ptr) AccessChain 60(id) 38 + 748: 11(int) Load 745 + 749: 198(bool) UGreaterThan 748 16 + SelectionMerge 751 None + BranchConditional 749 750 751 + 750: Label + 754: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 752 + 755: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 756 756 16 16 + 753: 168(ptr) AccessChain 60(id) 16 + 757: 11(int) Load 753 + 758: 198(bool) UGreaterThan 757 16 + SelectionMerge 760 None + BranchConditional 758 759 760 + 759: Label + 763: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 761 764: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 765 765 16 16 - 763: 11(int) Load 149(index) - 766: 159(ptr) AccessChain 125 129 158 16 - 767: 89(int) Load 766 - 768: 11(int) Bitcast 767 - 769: 11(int) ISub 763 768 - 770: 242(ptr) AccessChain 213(particleIn) 129 769 129 - 771: 87(fvec4) Load 770 - 772: 18(fvec3) VectorShuffle 771 771 0 1 2 - 773: 18(fvec3) Load 271(pos) - 774: 18(fvec3) FSub 772 773 - Store 719(c) 774 - 776: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 777 777 16 16 - 775: 18(fvec3) Load 709(a) - 778: 18(fvec3) Load 715(b) - 779: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 775 778 - 780: 18(fvec3) Load 715(b) - 781: 18(fvec3) Load 719(c) - 782: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 780 781 - 783: 18(fvec3) FAdd 779 782 - 784: 18(fvec3) Load 702(normal) - 785: 18(fvec3) FAdd 784 783 - Store 702(normal) 785 - Branch 738 - 738: Label - 787: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 730 - 788: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 789 789 16 16 - 786: 147(ptr) AccessChain 60(id) 16 - 790: 11(int) Load 786 - 791: 159(ptr) AccessChain 125 129 158 16 - 792: 89(int) Load 791 - 793: 89(int) ISub 792 250 - 794: 11(int) Bitcast 793 - 795: 177(bool) ULessThan 790 794 - SelectionMerge 797 None - BranchConditional 795 796 797 - 796: Label - 800: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 798 - 801: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 802 802 16 16 - 799: 11(int) Load 149(index) - 803: 159(ptr) AccessChain 125 129 158 16 - 804: 89(int) Load 803 - 805: 11(int) Bitcast 804 - 806: 11(int) ISub 799 805 - 807: 242(ptr) AccessChain 213(particleIn) 129 806 129 - 808: 87(fvec4) Load 807 - 809: 18(fvec3) VectorShuffle 808 808 0 1 2 - 810: 18(fvec3) Load 271(pos) - 811: 18(fvec3) FSub 809 810 - Store 709(a) 811 - 813: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 814 814 16 16 - 812: 11(int) Load 149(index) - 815: 159(ptr) AccessChain 125 129 158 16 - 816: 89(int) Load 815 - 817: 11(int) Bitcast 816 - 818: 11(int) ISub 812 817 - 819: 11(int) IAdd 818 38 - 820: 242(ptr) AccessChain 213(particleIn) 129 819 129 - 821: 87(fvec4) Load 820 - 822: 18(fvec3) VectorShuffle 821 821 0 1 2 - 823: 18(fvec3) Load 271(pos) - 824: 18(fvec3) FSub 822 823 - Store 715(b) 824 - 826: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 827 827 16 16 - 825: 11(int) Load 149(index) - 828: 11(int) IAdd 825 38 - 829: 242(ptr) AccessChain 213(particleIn) 129 828 129 + 762: 11(int) Load 170(index) + 766: 11(int) ISub 762 38 + 767: 267(ptr) AccessChain 238(particleIn) 150 766 150 + 768: 87(fvec4) Load 767 + 769: 18(fvec3) VectorShuffle 768 768 0 1 2 + 770: 18(fvec3) Load 296(pos) + 771: 18(fvec3) FSub 769 770 + Store 731(a) 771 + 773: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 774 774 16 16 + 772: 11(int) Load 170(index) + 775: 180(ptr) AccessChain 146 150 179 16 + 776: 89(int) Load 775 + 777: 11(int) Bitcast 776 + 778: 11(int) ISub 772 777 + 779: 11(int) ISub 778 38 + 780: 267(ptr) AccessChain 238(particleIn) 150 779 150 + 781: 87(fvec4) Load 780 + 782: 18(fvec3) VectorShuffle 781 781 0 1 2 + 783: 18(fvec3) Load 296(pos) + 784: 18(fvec3) FSub 782 783 + Store 737(b) 784 + 786: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 787 787 16 16 + 785: 11(int) Load 170(index) + 788: 180(ptr) AccessChain 146 150 179 16 + 789: 89(int) Load 788 + 790: 11(int) Bitcast 789 + 791: 11(int) ISub 785 790 + 792: 267(ptr) AccessChain 238(particleIn) 150 791 150 + 793: 87(fvec4) Load 792 + 794: 18(fvec3) VectorShuffle 793 793 0 1 2 + 795: 18(fvec3) Load 296(pos) + 796: 18(fvec3) FSub 794 795 + Store 741(c) 796 + 798: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 799 799 16 16 + 797: 18(fvec3) Load 731(a) + 800: 18(fvec3) Load 737(b) + 801: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 797 800 + 802: 18(fvec3) Load 737(b) + 803: 18(fvec3) Load 741(c) + 804: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 802 803 + 805: 18(fvec3) FAdd 801 804 + 806: 18(fvec3) Load 724(normal) + 807: 18(fvec3) FAdd 806 805 + Store 724(normal) 807 + Branch 760 + 760: Label + 809: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 752 + 810: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 811 811 16 16 + 808: 168(ptr) AccessChain 60(id) 16 + 812: 11(int) Load 808 + 813: 180(ptr) AccessChain 146 150 179 16 + 814: 89(int) Load 813 + 815: 89(int) ISub 814 275 + 816: 11(int) Bitcast 815 + 817: 198(bool) ULessThan 812 816 + SelectionMerge 819 None + BranchConditional 817 818 819 + 818: Label + 822: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 820 + 823: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 824 824 16 16 + 821: 11(int) Load 170(index) + 825: 180(ptr) AccessChain 146 150 179 16 + 826: 89(int) Load 825 + 827: 11(int) Bitcast 826 + 828: 11(int) ISub 821 827 + 829: 267(ptr) AccessChain 238(particleIn) 150 828 150 830: 87(fvec4) Load 829 831: 18(fvec3) VectorShuffle 830 830 0 1 2 - 832: 18(fvec3) Load 271(pos) + 832: 18(fvec3) Load 296(pos) 833: 18(fvec3) FSub 831 832 - Store 719(c) 833 + Store 731(a) 833 835: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 836 836 16 16 - 834: 18(fvec3) Load 709(a) - 837: 18(fvec3) Load 715(b) - 838: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 834 837 - 839: 18(fvec3) Load 715(b) - 840: 18(fvec3) Load 719(c) - 841: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 839 840 - 842: 18(fvec3) FAdd 838 841 - 843: 18(fvec3) Load 702(normal) - 844: 18(fvec3) FAdd 843 842 - Store 702(normal) 844 - Branch 797 - 797: Label - Branch 729 - 729: Label - 846: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 701 - 847: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 848 848 16 16 - 845: 147(ptr) AccessChain 60(id) 38 - 849: 11(int) Load 845 - 850: 159(ptr) AccessChain 125 129 158 38 - 851: 89(int) Load 850 - 852: 89(int) ISub 851 250 - 853: 11(int) Bitcast 852 - 854: 177(bool) ULessThan 849 853 - SelectionMerge 856 None - BranchConditional 854 855 856 - 855: Label - 859: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 857 - 860: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 861 861 16 16 - 858: 147(ptr) AccessChain 60(id) 16 - 862: 11(int) Load 858 - 863: 177(bool) UGreaterThan 862 16 - SelectionMerge 865 None - BranchConditional 863 864 865 - 864: Label - 868: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 866 - 869: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 870 870 16 16 - 867: 11(int) Load 149(index) - 871: 159(ptr) AccessChain 125 129 158 16 - 872: 89(int) Load 871 - 873: 11(int) Bitcast 872 - 874: 11(int) IAdd 867 873 - 875: 242(ptr) AccessChain 213(particleIn) 129 874 129 - 876: 87(fvec4) Load 875 - 877: 18(fvec3) VectorShuffle 876 876 0 1 2 - 878: 18(fvec3) Load 271(pos) - 879: 18(fvec3) FSub 877 878 - Store 709(a) 879 - 881: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 882 882 16 16 - 880: 11(int) Load 149(index) - 883: 159(ptr) AccessChain 125 129 158 16 - 884: 89(int) Load 883 - 885: 11(int) Bitcast 884 - 886: 11(int) IAdd 880 885 - 887: 11(int) ISub 886 38 - 888: 242(ptr) AccessChain 213(particleIn) 129 887 129 - 889: 87(fvec4) Load 888 - 890: 18(fvec3) VectorShuffle 889 889 0 1 2 - 891: 18(fvec3) Load 271(pos) - 892: 18(fvec3) FSub 890 891 - Store 715(b) 892 - 894: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 895 895 16 16 - 893: 11(int) Load 149(index) - 896: 11(int) ISub 893 38 - 897: 242(ptr) AccessChain 213(particleIn) 129 896 129 + 834: 11(int) Load 170(index) + 837: 180(ptr) AccessChain 146 150 179 16 + 838: 89(int) Load 837 + 839: 11(int) Bitcast 838 + 840: 11(int) ISub 834 839 + 841: 11(int) IAdd 840 38 + 842: 267(ptr) AccessChain 238(particleIn) 150 841 150 + 843: 87(fvec4) Load 842 + 844: 18(fvec3) VectorShuffle 843 843 0 1 2 + 845: 18(fvec3) Load 296(pos) + 846: 18(fvec3) FSub 844 845 + Store 737(b) 846 + 848: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 849 849 16 16 + 847: 11(int) Load 170(index) + 850: 11(int) IAdd 847 38 + 851: 267(ptr) AccessChain 238(particleIn) 150 850 150 + 852: 87(fvec4) Load 851 + 853: 18(fvec3) VectorShuffle 852 852 0 1 2 + 854: 18(fvec3) Load 296(pos) + 855: 18(fvec3) FSub 853 854 + Store 741(c) 855 + 857: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 858 858 16 16 + 856: 18(fvec3) Load 731(a) + 859: 18(fvec3) Load 737(b) + 860: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 856 859 + 861: 18(fvec3) Load 737(b) + 862: 18(fvec3) Load 741(c) + 863: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 861 862 + 864: 18(fvec3) FAdd 860 863 + 865: 18(fvec3) Load 724(normal) + 866: 18(fvec3) FAdd 865 864 + Store 724(normal) 866 + Branch 819 + 819: Label + Branch 751 + 751: Label + 868: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 723 + 869: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 870 870 16 16 + 867: 168(ptr) AccessChain 60(id) 38 + 871: 11(int) Load 867 + 872: 180(ptr) AccessChain 146 150 179 38 + 873: 89(int) Load 872 + 874: 89(int) ISub 873 275 + 875: 11(int) Bitcast 874 + 876: 198(bool) ULessThan 871 875 + SelectionMerge 878 None + BranchConditional 876 877 878 + 877: Label + 881: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 879 + 882: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 883 883 16 16 + 880: 168(ptr) AccessChain 60(id) 16 + 884: 11(int) Load 880 + 885: 198(bool) UGreaterThan 884 16 + SelectionMerge 887 None + BranchConditional 885 886 887 + 886: Label + 890: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 888 + 891: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 892 892 16 16 + 889: 11(int) Load 170(index) + 893: 180(ptr) AccessChain 146 150 179 16 + 894: 89(int) Load 893 + 895: 11(int) Bitcast 894 + 896: 11(int) IAdd 889 895 + 897: 267(ptr) AccessChain 238(particleIn) 150 896 150 898: 87(fvec4) Load 897 899: 18(fvec3) VectorShuffle 898 898 0 1 2 - 900: 18(fvec3) Load 271(pos) + 900: 18(fvec3) Load 296(pos) 901: 18(fvec3) FSub 899 900 - Store 719(c) 901 + Store 731(a) 901 903: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 904 904 16 16 - 902: 18(fvec3) Load 709(a) - 905: 18(fvec3) Load 715(b) - 906: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 902 905 - 907: 18(fvec3) Load 715(b) - 908: 18(fvec3) Load 719(c) - 909: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 907 908 - 910: 18(fvec3) FAdd 906 909 - 911: 18(fvec3) Load 702(normal) - 912: 18(fvec3) FAdd 911 910 - Store 702(normal) 912 - Branch 865 - 865: Label - 914: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 857 - 915: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 916 916 16 16 - 913: 147(ptr) AccessChain 60(id) 16 - 917: 11(int) Load 913 - 918: 159(ptr) AccessChain 125 129 158 16 - 919: 89(int) Load 918 - 920: 89(int) ISub 919 250 - 921: 11(int) Bitcast 920 - 922: 177(bool) ULessThan 917 921 - SelectionMerge 924 None - BranchConditional 922 923 924 - 923: Label - 927: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 925 - 928: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 929 929 16 16 - 926: 11(int) Load 149(index) - 930: 11(int) IAdd 926 38 - 931: 242(ptr) AccessChain 213(particleIn) 129 930 129 - 932: 87(fvec4) Load 931 - 933: 18(fvec3) VectorShuffle 932 932 0 1 2 - 934: 18(fvec3) Load 271(pos) - 935: 18(fvec3) FSub 933 934 - Store 709(a) 935 - 937: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 938 938 16 16 - 936: 11(int) Load 149(index) - 939: 159(ptr) AccessChain 125 129 158 16 - 940: 89(int) Load 939 - 941: 11(int) Bitcast 940 - 942: 11(int) IAdd 936 941 - 943: 11(int) IAdd 942 38 - 944: 242(ptr) AccessChain 213(particleIn) 129 943 129 - 945: 87(fvec4) Load 944 - 946: 18(fvec3) VectorShuffle 945 945 0 1 2 - 947: 18(fvec3) Load 271(pos) - 948: 18(fvec3) FSub 946 947 - Store 715(b) 948 + 902: 11(int) Load 170(index) + 905: 180(ptr) AccessChain 146 150 179 16 + 906: 89(int) Load 905 + 907: 11(int) Bitcast 906 + 908: 11(int) IAdd 902 907 + 909: 11(int) ISub 908 38 + 910: 267(ptr) AccessChain 238(particleIn) 150 909 150 + 911: 87(fvec4) Load 910 + 912: 18(fvec3) VectorShuffle 911 911 0 1 2 + 913: 18(fvec3) Load 296(pos) + 914: 18(fvec3) FSub 912 913 + Store 737(b) 914 + 916: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 917 917 16 16 + 915: 11(int) Load 170(index) + 918: 11(int) ISub 915 38 + 919: 267(ptr) AccessChain 238(particleIn) 150 918 150 + 920: 87(fvec4) Load 919 + 921: 18(fvec3) VectorShuffle 920 920 0 1 2 + 922: 18(fvec3) Load 296(pos) + 923: 18(fvec3) FSub 921 922 + Store 741(c) 923 + 925: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 926 926 16 16 + 924: 18(fvec3) Load 731(a) + 927: 18(fvec3) Load 737(b) + 928: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 924 927 + 929: 18(fvec3) Load 737(b) + 930: 18(fvec3) Load 741(c) + 931: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 929 930 + 932: 18(fvec3) FAdd 928 931 + 933: 18(fvec3) Load 724(normal) + 934: 18(fvec3) FAdd 933 932 + Store 724(normal) 934 + Branch 887 + 887: Label + 936: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 879 + 937: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 938 938 16 16 + 935: 168(ptr) AccessChain 60(id) 16 + 939: 11(int) Load 935 + 940: 180(ptr) AccessChain 146 150 179 16 + 941: 89(int) Load 940 + 942: 89(int) ISub 941 275 + 943: 11(int) Bitcast 942 + 944: 198(bool) ULessThan 939 943 + SelectionMerge 946 None + BranchConditional 944 945 946 + 945: Label + 949: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 947 950: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 951 951 16 16 - 949: 11(int) Load 149(index) - 952: 159(ptr) AccessChain 125 129 158 16 - 953: 89(int) Load 952 - 954: 11(int) Bitcast 953 - 955: 11(int) IAdd 949 954 - 956: 242(ptr) AccessChain 213(particleIn) 129 955 129 - 957: 87(fvec4) Load 956 - 958: 18(fvec3) VectorShuffle 957 957 0 1 2 - 959: 18(fvec3) Load 271(pos) - 960: 18(fvec3) FSub 958 959 - Store 719(c) 960 - 962: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 963 963 16 16 - 961: 18(fvec3) Load 709(a) - 964: 18(fvec3) Load 715(b) - 965: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 961 964 - 966: 18(fvec3) Load 715(b) - 967: 18(fvec3) Load 719(c) - 968: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 966 967 - 969: 18(fvec3) FAdd 965 968 - 970: 18(fvec3) Load 702(normal) - 971: 18(fvec3) FAdd 970 969 - Store 702(normal) 971 - Branch 924 - 924: Label - Branch 856 - 856: Label - 973: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 701 - 974: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 975 975 16 16 - 972: 11(int) Load 149(index) - 976: 18(fvec3) Load 702(normal) - 977: 18(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 976 - 978: 8(float) CompositeExtract 977 0 - 979: 8(float) CompositeExtract 977 1 - 980: 8(float) CompositeExtract 977 2 - 981: 87(fvec4) CompositeConstruct 978 979 980 251 - 982: 242(ptr) AccessChain 236(particleOut) 129 972 562 - Store 982 981 - Branch 700 - 700: Label - 983: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 64 - 984: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 975 975 16 16 + 948: 11(int) Load 170(index) + 952: 11(int) IAdd 948 38 + 953: 267(ptr) AccessChain 238(particleIn) 150 952 150 + 954: 87(fvec4) Load 953 + 955: 18(fvec3) VectorShuffle 954 954 0 1 2 + 956: 18(fvec3) Load 296(pos) + 957: 18(fvec3) FSub 955 956 + Store 731(a) 957 + 959: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 960 960 16 16 + 958: 11(int) Load 170(index) + 961: 180(ptr) AccessChain 146 150 179 16 + 962: 89(int) Load 961 + 963: 11(int) Bitcast 962 + 964: 11(int) IAdd 958 963 + 965: 11(int) IAdd 964 38 + 966: 267(ptr) AccessChain 238(particleIn) 150 965 150 + 967: 87(fvec4) Load 966 + 968: 18(fvec3) VectorShuffle 967 967 0 1 2 + 969: 18(fvec3) Load 296(pos) + 970: 18(fvec3) FSub 968 969 + Store 737(b) 970 + 972: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 973 973 16 16 + 971: 11(int) Load 170(index) + 974: 180(ptr) AccessChain 146 150 179 16 + 975: 89(int) Load 974 + 976: 11(int) Bitcast 975 + 977: 11(int) IAdd 971 976 + 978: 267(ptr) AccessChain 238(particleIn) 150 977 150 + 979: 87(fvec4) Load 978 + 980: 18(fvec3) VectorShuffle 979 979 0 1 2 + 981: 18(fvec3) Load 296(pos) + 982: 18(fvec3) FSub 980 981 + Store 741(c) 982 + 984: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 985 985 16 16 + 983: 18(fvec3) Load 731(a) + 986: 18(fvec3) Load 737(b) + 987: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 983 986 + 988: 18(fvec3) Load 737(b) + 989: 18(fvec3) Load 741(c) + 990: 18(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 988 989 + 991: 18(fvec3) FAdd 987 990 + 992: 18(fvec3) Load 724(normal) + 993: 18(fvec3) FAdd 992 991 + Store 724(normal) 993 + Branch 946 + 946: Label + Branch 878 + 878: Label + 995: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 723 + 996: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 997 997 16 16 + 994: 11(int) Load 170(index) + 998: 18(fvec3) Load 724(normal) + 999: 18(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 998 + 1000: 8(float) CompositeExtract 999 0 + 1001: 8(float) CompositeExtract 999 1 + 1002: 8(float) CompositeExtract 999 2 + 1003: 87(fvec4) CompositeConstruct 1000 1001 1002 276 + 1004: 267(ptr) AccessChain 261(particleOut) 150 994 585 + Store 1004 1003 + Branch 722 + 722: Label + 1005: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 64 + 1006: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 34 997 997 16 16 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.frag.out index d8367e1098..a7f1a3acd4 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.frag.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.frag.out @@ -1,7 +1,7 @@ spv.debuginfo.hlsl.frag // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 931 +// Id's are bound by 942 Capability Shader Capability ImageQuery @@ -9,7 +9,7 @@ spv.debuginfo.hlsl.frag 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 6 "main" 924 927 + EntryPoint Fragment 6 "main" 935 938 ExecutionMode 6 OriginUpperLeft 2: String "spv.debuginfo.hlsl.frag" 9: String "float" @@ -257,37 +257,41 @@ float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET 360: String "y" 428: String "i" 447: String "shadowClip" - 462: String "color" - 468: String "viewMatrix" - 472: String "Light" - 478: String "lights" - 481: String "displayDebugTarget" - 486: String "UBO" - 489: String "ubo" - 497: String "" - 548: String "textureposition" - 553: String "samplerposition" - 563: String "normal" - 569: String "textureNormal" - 574: String "samplerNormal" - 582: String "albedo" - 588: String "textureAlbedo" - 593: String "samplerAlbedo" - 684: String "N" - 712: String "L" - 738: String "V" - 753: String "lightCosInnerAngle" - 760: String "lightCosOuterAngle" - 767: String "lightRange" - 774: String "dir" - 790: String "cosDir" - 799: String "spotEffect" - 809: String "heightAttenuation" - 818: String "NdotL" - 828: String "diff" - 836: String "R" - 846: String "NdotR" - 856: String "spec" + 462: String "position" + 466: String "target" + 470: String "color" + 474: String "viewMatrix" + 478: String "Light" + 483: String "viewPos" + 487: String "lights" + 490: String "useShadows" + 493: String "displayDebugTarget" + 497: String "UBO" + 500: String "ubo" + 508: String "" + 559: String "textureposition" + 564: String "samplerposition" + 574: String "normal" + 580: String "textureNormal" + 585: String "samplerNormal" + 593: String "albedo" + 599: String "textureAlbedo" + 604: String "samplerAlbedo" + 695: String "N" + 723: String "L" + 749: String "V" + 764: String "lightCosInnerAngle" + 771: String "lightCosOuterAngle" + 778: String "lightRange" + 785: String "dir" + 801: String "cosDir" + 810: String "spotEffect" + 820: String "heightAttenuation" + 829: String "NdotL" + 839: String "diff" + 847: String "R" + 857: String "NdotR" + 867: String "spec" Name 6 "main" Name 36 "textureProj(vf4;f1;vf2;" Name 33 "P" @@ -328,52 +332,52 @@ float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET MemberName 460(Light) 1 "target" MemberName 460(Light) 2 "color" MemberName 460(Light) 3 "viewMatrix" - Name 475 "UBO" - MemberName 475(UBO) 0 "viewPos" - MemberName 475(UBO) 1 "lights" - MemberName 475(UBO) 2 "useShadows" - MemberName 475(UBO) 3 "displayDebugTarget" - Name 487 "ubo" - MemberName 487(ubo) 0 "ubo" - Name 495 "" - Name 504 "shadowFactor" - Name 513 "param" - Name 515 "param" - Name 536 "fragPos" - Name 546 "textureposition" - Name 551 "samplerposition" - Name 561 "normal" - Name 567 "textureNormal" - Name 572 "samplerNormal" - Name 580 "albedo" - Name 586 "textureAlbedo" - Name 591 "samplerAlbedo" - Name 598 "fragcolor" - Name 625 "param" - Name 629 "param" - Name 682 "N" - Name 693 "i" - Name 710 "L" - Name 725 "dist" - Name 736 "V" - Name 751 "lightCosInnerAngle" - Name 758 "lightCosOuterAngle" - Name 765 "lightRange" - Name 772 "dir" - Name 788 "cosDir" - Name 797 "spotEffect" - Name 807 "heightAttenuation" - Name 816 "NdotL" - Name 826 "diff" - Name 834 "R" - Name 844 "NdotR" - Name 854 "spec" - Name 902 "param" - Name 907 "param" - Name 922 "inUV" - Name 924 "inUV" - Name 927 "@entryPointOutput" - Name 928 "param" + Name 481 "UBO" + MemberName 481(UBO) 0 "viewPos" + MemberName 481(UBO) 1 "lights" + MemberName 481(UBO) 2 "useShadows" + MemberName 481(UBO) 3 "displayDebugTarget" + Name 498 "ubo" + MemberName 498(ubo) 0 "ubo" + Name 506 "" + Name 515 "shadowFactor" + Name 524 "param" + Name 526 "param" + Name 547 "fragPos" + Name 557 "textureposition" + Name 562 "samplerposition" + Name 572 "normal" + Name 578 "textureNormal" + Name 583 "samplerNormal" + Name 591 "albedo" + Name 597 "textureAlbedo" + Name 602 "samplerAlbedo" + Name 609 "fragcolor" + Name 636 "param" + Name 640 "param" + Name 693 "N" + Name 704 "i" + Name 721 "L" + Name 736 "dist" + Name 747 "V" + Name 762 "lightCosInnerAngle" + Name 769 "lightCosOuterAngle" + Name 776 "lightRange" + Name 783 "dir" + Name 799 "cosDir" + Name 808 "spotEffect" + Name 818 "heightAttenuation" + Name 827 "NdotL" + Name 837 "diff" + Name 845 "R" + Name 855 "NdotR" + Name 865 "spec" + Name 913 "param" + Name 918 "param" + Name 933 "inUV" + Name 935 "inUV" + Name 938 "@entryPointOutput" + Name 939 "param" Decorate 170(textureShadowMap) Binding 5 Decorate 170(textureShadowMap) DescriptorSet 0 Decorate 181(samplerShadowMap) Binding 5 @@ -384,29 +388,29 @@ float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET MemberDecorate 460(Light) 3 RowMajor MemberDecorate 460(Light) 3 MatrixStride 16 MemberDecorate 460(Light) 3 Offset 48 - Decorate 473 ArrayStride 112 - MemberDecorate 475(UBO) 0 Offset 0 - MemberDecorate 475(UBO) 1 Offset 16 - MemberDecorate 475(UBO) 2 Offset 352 - MemberDecorate 475(UBO) 3 Offset 356 - Decorate 487(ubo) Block - MemberDecorate 487(ubo) 0 Offset 0 - Decorate 495 Binding 4 - Decorate 495 DescriptorSet 0 - Decorate 546(textureposition) Binding 1 - Decorate 546(textureposition) DescriptorSet 0 - Decorate 551(samplerposition) Binding 1 - Decorate 551(samplerposition) DescriptorSet 0 - Decorate 567(textureNormal) Binding 2 - Decorate 567(textureNormal) DescriptorSet 0 - Decorate 572(samplerNormal) Binding 2 - Decorate 572(samplerNormal) DescriptorSet 0 - Decorate 586(textureAlbedo) Binding 3 - Decorate 586(textureAlbedo) DescriptorSet 0 - Decorate 591(samplerAlbedo) Binding 3 - Decorate 591(samplerAlbedo) DescriptorSet 0 - Decorate 924(inUV) Location 0 - Decorate 927(@entryPointOutput) Location 0 + Decorate 479 ArrayStride 112 + MemberDecorate 481(UBO) 0 Offset 0 + MemberDecorate 481(UBO) 1 Offset 16 + MemberDecorate 481(UBO) 2 Offset 352 + MemberDecorate 481(UBO) 3 Offset 356 + Decorate 498(ubo) Block + MemberDecorate 498(ubo) 0 Offset 0 + Decorate 506 Binding 4 + Decorate 506 DescriptorSet 0 + Decorate 557(textureposition) Binding 1 + Decorate 557(textureposition) DescriptorSet 0 + Decorate 562(samplerposition) Binding 1 + Decorate 562(samplerposition) DescriptorSet 0 + Decorate 578(textureNormal) Binding 2 + Decorate 578(textureNormal) DescriptorSet 0 + Decorate 583(samplerNormal) Binding 2 + Decorate 583(samplerNormal) DescriptorSet 0 + Decorate 597(textureAlbedo) Binding 3 + Decorate 597(textureAlbedo) DescriptorSet 0 + Decorate 602(samplerAlbedo) Binding 3 + Decorate 602(samplerAlbedo) DescriptorSet 0 + Decorate 935(inUV) Location 0 + Decorate 938(@entryPointOutput) Location 0 4: TypeVoid 5: TypeFunction 4 8: TypeFloat 32 @@ -480,7 +484,7 @@ float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET 157: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 158 10 40 159 16 155 19 163: TypeImage 8(float) 2D array sampled format:Unknown 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) - 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 165 16 40 159 16 43 166 167 17 + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 165 44 40 159 16 43 166 167 17 168: TypePointer UniformConstant 163 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 164 16 16 170(textureShadowMap): 168(ptr) Variable UniformConstant @@ -493,7 +497,7 @@ float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET 181(samplerShadowMap): 179(ptr) Variable UniformConstant 182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 183 176 40 159 16 43 183 181(samplerShadowMap) 173 185: TypeSampledImage 163 - 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 187 16 40 159 16 43 188 167 17 + 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 187 44 40 159 16 43 188 167 17 202: 11(int) Constant 69 204: 8(float) Constant 0 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 155 @@ -561,157 +565,164 @@ float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET 459: 145(bool) ConstantTrue 458: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 20 19 459 460(Light): TypeStruct 18(fvec4) 18(fvec4) 18(fvec4) 457 - 463: 11(int) Constant 46 - 464: 11(int) Constant 14 + 463: 11(int) Constant 44 + 464: 11(int) Constant 17 461: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 462 20 40 463 464 16 16 17 - 465: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 462 20 40 463 464 16 16 17 - 466: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 462 20 40 463 464 16 16 17 - 469: 11(int) Constant 47 - 470: 11(int) Constant 21 - 467: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 468 458 40 469 470 16 16 17 - 471: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 472 44 40 448 16 43 472 16 17 461 465 466 467 - 473: TypeArray 460(Light) 17 - 474: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 471 17 - 475(UBO): TypeStruct 18(fvec4) 473 228(int) 228(int) - 476: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 462 20 40 463 464 16 16 17 - 479: 11(int) Constant 53 - 477: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 478 474 40 479 464 16 16 17 - 482: 11(int) Constant 55 - 483: 11(int) Constant 24 - 480: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 481 230 40 482 483 16 16 17 - 484: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 481 230 40 482 483 16 16 17 - 485: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 486 44 40 448 16 43 486 16 17 476 477 480 484 - 487(ubo): TypeStruct 475(UBO) - 490: 11(int) Constant 58 - 491: 11(int) Constant 37 - 488: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 489 485 40 490 491 16 16 17 - 492: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 489 44 40 448 16 43 489 16 17 488 - 493: TypePointer Uniform 487(ubo) - 494: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 492 27 16 - 495: 493(ptr) Variable Uniform - 496: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 497 492 40 448 16 43 497 495 173 - 499: TypePointer Uniform 457 - 500: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 458 27 16 - 506: 11(int) Constant 106 - 505: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 313 10 40 506 16 444 19 - 511: 11(int) Constant 108 - 519: 11(int) Constant 113 - 529: 11(int) Constant 115 - 535: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 101 - 538: 11(int) Constant 121 - 537: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 93 75 40 538 16 535 19 - 542: TypeImage 8(float) 2D sampled format:Unknown - 543: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 165 16 40 538 16 43 166 167 17 - 544: TypePointer UniformConstant 542 - 545: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 543 16 16 -546(textureposition): 544(ptr) Variable UniformConstant - 547: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 548 543 40 538 16 43 548 546(textureposition) 173 - 550: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 177 44 40 538 16 43 178 167 17 -551(samplerposition): 179(ptr) Variable UniformConstant - 552: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 553 550 40 538 16 43 553 551(samplerposition) 173 - 555: TypeSampledImage 542 - 556: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 187 16 40 538 16 43 188 167 17 - 564: 11(int) Constant 122 - 562: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 563 75 40 564 16 535 19 -567(textureNormal): 544(ptr) Variable UniformConstant - 568: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 569 543 40 564 16 43 569 567(textureNormal) 173 - 571: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 177 44 40 564 16 43 178 167 17 -572(samplerNormal): 179(ptr) Variable UniformConstant - 573: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 574 571 40 564 16 43 574 572(samplerNormal) 173 - 583: 11(int) Constant 123 - 581: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 582 20 40 583 16 535 19 -586(textureAlbedo): 544(ptr) Variable UniformConstant - 587: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 588 543 40 583 16 43 588 586(textureAlbedo) 173 - 590: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 177 44 40 583 16 43 178 167 17 -591(samplerAlbedo): 179(ptr) Variable UniformConstant - 592: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 593 590 40 583 16 43 593 591(samplerAlbedo) 173 - 600: 11(int) Constant 125 - 599: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 88 75 40 600 16 535 19 - 603: TypePointer Uniform 228(int) - 604: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 230 27 16 - 607: 11(int) Constant 128 - 612: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 535 - 616: 11(int) Constant 129 - 624: 74(fvec3) ConstantComposite 116 116 116 - 628: 11(int) Constant 131 - 633: 11(int) Constant 132 - 638: 11(int) Constant 134 - 640: 11(int) Constant 135 - 645: 11(int) Constant 137 - 647: 11(int) Constant 138 - 652: 11(int) Constant 140 - 655: 11(int) Constant 141 - 660: 11(int) Constant 143 - 663: 11(int) Constant 144 - 669: 11(int) Constant 146 - 678: 11(int) Constant 150 - 680: 8(float) Constant 1036831949 - 685: 11(int) Constant 152 - 683: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 684 75 40 685 16 535 19 - 691: 11(int) Constant 154 - 692: 11(int) Constant 10 - 690: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 691 692 535 - 694: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 428 230 40 691 16 690 19 - 709: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 690 - 713: 11(int) Constant 157 - 711: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 712 75 40 713 16 709 19 - 718: TypePointer Uniform 18(fvec4) - 719: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 27 16 - 727: 11(int) Constant 159 - 726: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 158 10 40 727 16 709 19 - 734: 11(int) Constant 160 - 739: 11(int) Constant 163 - 737: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 738 75 40 739 16 709 19 - 749: 11(int) Constant 164 - 754: 11(int) Constant 166 - 752: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 753 10 40 754 16 709 19 - 757: 8(float) Constant 1064781546 - 761: 11(int) Constant 167 - 759: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 760 10 40 761 16 709 19 - 764: 8(float) Constant 1063781322 - 768: 11(int) Constant 168 - 766: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 767 10 40 768 16 709 19 - 771: 8(float) Constant 1120403456 - 775: 11(int) Constant 171 - 773: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 774 75 40 775 16 709 19 - 791: 11(int) Constant 174 - 789: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 790 10 40 791 16 709 19 - 800: 11(int) Constant 175 - 798: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 799 10 40 800 16 709 19 - 810: 11(int) Constant 176 - 808: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 809 10 40 810 16 709 19 - 819: 11(int) Constant 179 - 817: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 818 10 40 819 16 709 19 - 829: 11(int) Constant 180 - 827: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 828 75 40 829 16 709 19 - 837: 11(int) Constant 183 - 835: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 836 75 40 837 16 709 19 - 847: 11(int) Constant 184 - 845: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 846 10 40 847 16 709 19 - 857: 11(int) Constant 185 - 855: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 856 75 40 857 16 709 19 - 861: 8(float) Constant 1098907648 - 866: 8(float) Constant 1075838976 - 871: 11(int) Constant 187 - 879: 228(int) Constant 2 - 896: 11(int) Constant 191 - 901: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 535 - 906: 11(int) Constant 193 - 913: 11(int) Constant 196 - 923: TypePointer Input 26(fvec2) - 924(inUV): 923(ptr) Variable Input - 926: TypePointer Output 18(fvec4) -927(@entryPointOutput): 926(ptr) Variable Output + 467: 11(int) Constant 45 + 468: 11(int) Constant 15 + 465: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 466 20 40 467 468 16 16 17 + 471: 11(int) Constant 46 + 472: 11(int) Constant 14 + 469: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 470 20 40 471 472 16 16 17 + 475: 11(int) Constant 47 + 476: 11(int) Constant 21 + 473: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 474 458 40 475 476 16 16 17 + 477: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 478 44 40 448 16 43 478 16 17 461 465 469 473 + 479: TypeArray 460(Light) 17 + 480: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 477 17 + 481(UBO): TypeStruct 18(fvec4) 479 228(int) 228(int) + 484: 11(int) Constant 52 + 485: 11(int) Constant 16 + 482: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 483 20 40 484 485 16 16 17 + 488: 11(int) Constant 53 + 486: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 487 480 40 488 472 16 16 17 + 491: 11(int) Constant 54 + 489: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 490 230 40 491 485 16 16 17 + 494: 11(int) Constant 55 + 495: 11(int) Constant 24 + 492: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 493 230 40 494 495 16 16 17 + 496: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 497 44 40 448 16 43 497 16 17 482 486 489 492 + 498(ubo): TypeStruct 481(UBO) + 501: 11(int) Constant 58 + 502: 11(int) Constant 37 + 499: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 500 496 40 501 502 16 16 17 + 503: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 500 44 40 448 16 43 500 16 17 499 + 504: TypePointer Uniform 498(ubo) + 505: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 503 27 16 + 506: 504(ptr) Variable Uniform + 507: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 508 503 40 448 16 43 508 506 173 + 510: TypePointer Uniform 457 + 511: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 458 27 16 + 517: 11(int) Constant 106 + 516: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 313 10 40 517 16 444 19 + 522: 11(int) Constant 108 + 530: 11(int) Constant 113 + 540: 11(int) Constant 115 + 546: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 101 + 549: 11(int) Constant 121 + 548: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 93 75 40 549 16 546 19 + 553: TypeImage 8(float) 2D sampled format:Unknown + 554: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 165 44 40 549 16 43 166 167 17 + 555: TypePointer UniformConstant 553 + 556: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 554 16 16 +557(textureposition): 555(ptr) Variable UniformConstant + 558: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 559 554 40 549 16 43 559 557(textureposition) 173 + 561: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 177 44 40 549 16 43 178 167 17 +562(samplerposition): 179(ptr) Variable UniformConstant + 563: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 564 561 40 549 16 43 564 562(samplerposition) 173 + 566: TypeSampledImage 553 + 567: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 187 44 40 549 16 43 188 167 17 + 575: 11(int) Constant 122 + 573: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 574 75 40 575 16 546 19 +578(textureNormal): 555(ptr) Variable UniformConstant + 579: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 580 554 40 575 16 43 580 578(textureNormal) 173 + 582: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 177 44 40 575 16 43 178 167 17 +583(samplerNormal): 179(ptr) Variable UniformConstant + 584: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 585 582 40 575 16 43 585 583(samplerNormal) 173 + 594: 11(int) Constant 123 + 592: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 593 20 40 594 16 546 19 +597(textureAlbedo): 555(ptr) Variable UniformConstant + 598: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 599 554 40 594 16 43 599 597(textureAlbedo) 173 + 601: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 177 44 40 594 16 43 178 167 17 +602(samplerAlbedo): 179(ptr) Variable UniformConstant + 603: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 604 601 40 594 16 43 604 602(samplerAlbedo) 173 + 611: 11(int) Constant 125 + 610: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 88 75 40 611 16 546 19 + 614: TypePointer Uniform 228(int) + 615: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 230 27 16 + 618: 11(int) Constant 128 + 623: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 546 + 627: 11(int) Constant 129 + 635: 74(fvec3) ConstantComposite 116 116 116 + 639: 11(int) Constant 131 + 644: 11(int) Constant 132 + 649: 11(int) Constant 134 + 651: 11(int) Constant 135 + 656: 11(int) Constant 137 + 658: 11(int) Constant 138 + 663: 11(int) Constant 140 + 666: 11(int) Constant 141 + 671: 11(int) Constant 143 + 674: 11(int) Constant 144 + 680: 11(int) Constant 146 + 689: 11(int) Constant 150 + 691: 8(float) Constant 1036831949 + 696: 11(int) Constant 152 + 694: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 695 75 40 696 16 546 19 + 702: 11(int) Constant 154 + 703: 11(int) Constant 10 + 701: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 702 703 546 + 705: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 428 230 40 702 16 701 19 + 720: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 701 + 724: 11(int) Constant 157 + 722: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 723 75 40 724 16 720 19 + 729: TypePointer Uniform 18(fvec4) + 730: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 27 16 + 738: 11(int) Constant 159 + 737: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 158 10 40 738 16 720 19 + 745: 11(int) Constant 160 + 750: 11(int) Constant 163 + 748: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 749 75 40 750 16 720 19 + 760: 11(int) Constant 164 + 765: 11(int) Constant 166 + 763: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 764 10 40 765 16 720 19 + 768: 8(float) Constant 1064781546 + 772: 11(int) Constant 167 + 770: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 771 10 40 772 16 720 19 + 775: 8(float) Constant 1063781322 + 779: 11(int) Constant 168 + 777: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 778 10 40 779 16 720 19 + 782: 8(float) Constant 1120403456 + 786: 11(int) Constant 171 + 784: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 785 75 40 786 16 720 19 + 802: 11(int) Constant 174 + 800: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 801 10 40 802 16 720 19 + 811: 11(int) Constant 175 + 809: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 810 10 40 811 16 720 19 + 821: 11(int) Constant 176 + 819: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 820 10 40 821 16 720 19 + 830: 11(int) Constant 179 + 828: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 829 10 40 830 16 720 19 + 840: 11(int) Constant 180 + 838: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 839 75 40 840 16 720 19 + 848: 11(int) Constant 183 + 846: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 847 75 40 848 16 720 19 + 858: 11(int) Constant 184 + 856: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 857 10 40 858 16 720 19 + 868: 11(int) Constant 185 + 866: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 867 75 40 868 16 720 19 + 872: 8(float) Constant 1098907648 + 877: 8(float) Constant 1075838976 + 882: 11(int) Constant 187 + 890: 228(int) Constant 2 + 907: 11(int) Constant 191 + 912: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 40 16 16 546 + 917: 11(int) Constant 193 + 924: 11(int) Constant 196 + 934: TypePointer Input 26(fvec2) + 935(inUV): 934(ptr) Variable Input + 937: TypePointer Output 18(fvec4) +938(@entryPointOutput): 937(ptr) Variable Output 6(main): 4 Function None 5 7: Label - 922(inUV): 29(ptr) Variable Function - 928(param): 29(ptr) Variable Function - 925: 26(fvec2) Load 924(inUV) - Store 922(inUV) 925 - 929: 26(fvec2) Load 922(inUV) - Store 928(param) 929 - 930: 18(fvec4) FunctionCall 98(@main(vf2;) 928(param) - Store 927(@entryPointOutput) 930 + 933(inUV): 29(ptr) Variable Function + 939(param): 29(ptr) Variable Function + 936: 26(fvec2) Load 935(inUV) + Store 933(inUV) 936 + 940: 26(fvec2) Load 933(inUV) + Store 939(param) 940 + 941: 18(fvec4) FunctionCall 98(@main(vf2;) 939(param) + Store 938(@entryPointOutput) 941 Return FunctionEnd 36(textureProj(vf4;f1;vf2;): 8(float) Function None 31 @@ -982,9 +993,9 @@ float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET 83: Label 426(i): 242(ptr) Variable Function 445(shadowClip): 21(ptr) Variable Function -504(shadowFactor): 24(ptr) Variable Function - 513(param): 21(ptr) Variable Function - 515(param): 24(ptr) Variable Function +515(shadowFactor): 24(ptr) Variable Function + 524(param): 21(ptr) Variable Function + 526(param): 24(ptr) Variable Function 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 86 86 16 16 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 87 80(fragcolor) 49 @@ -1015,357 +1026,357 @@ float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET 454: 8(float) CompositeExtract 452 1 455: 8(float) CompositeExtract 452 2 456: 18(fvec4) CompositeConstruct 453 454 455 116 - 498: 228(int) Load 426(i) - 501: 499(ptr) AccessChain 495 323 330 498 442 - 502: 457 Load 501 - 503: 18(fvec4) VectorTimesMatrix 456 502 - Store 445(shadowClip) 503 - 508: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 506 506 16 16 - 507: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 505 504(shadowFactor) 49 - 510: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 511 511 16 16 509: 228(int) Load 426(i) - 512: 8(float) ConvertSToF 509 - 514: 18(fvec4) Load 445(shadowClip) - Store 513(param) 514 - Store 515(param) 512 - 516: 8(float) FunctionCall 62(filterPCF(vf4;f1;) 513(param) 515(param) - Store 504(shadowFactor) 516 - 518: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 519 519 16 16 - 517: 8(float) Load 504(shadowFactor) - 520: 74(fvec3) Load 80(fragcolor) - 521: 74(fvec3) VectorTimesScalar 520 517 - Store 80(fragcolor) 521 + 512: 510(ptr) AccessChain 506 323 330 509 442 + 513: 457 Load 512 + 514: 18(fvec4) VectorTimesMatrix 456 513 + Store 445(shadowClip) 514 + 519: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 517 517 16 16 + 518: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 516 515(shadowFactor) 49 + 521: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 522 522 16 16 + 520: 228(int) Load 426(i) + 523: 8(float) ConvertSToF 520 + 525: 18(fvec4) Load 445(shadowClip) + Store 524(param) 525 + Store 526(param) 523 + 527: 8(float) FunctionCall 62(filterPCF(vf4;f1;) 524(param) 526(param) + Store 515(shadowFactor) 527 + 529: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 530 530 16 16 + 528: 8(float) Load 515(shadowFactor) + 531: 74(fvec3) Load 80(fragcolor) + 532: 74(fvec3) VectorTimesScalar 531 528 + Store 80(fragcolor) 532 Branch 435 435: Label - 523: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 424 - 524: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 425 425 16 16 - 522: 228(int) Load 426(i) - 525: 228(int) IAdd 522 330 - Store 426(i) 525 + 534: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 424 + 535: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 425 425 16 16 + 533: 228(int) Load 426(i) + 536: 228(int) IAdd 533 330 + Store 426(i) 536 Branch 432 434: Label - 527: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 423 - 528: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 529 529 16 16 - 526: 74(fvec3) Load 80(fragcolor) - ReturnValue 526 + 538: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 423 + 539: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 540 540 16 16 + 537: 74(fvec3) Load 80(fragcolor) + ReturnValue 537 FunctionEnd 98(@main(vf2;): 18(fvec4) Function None 95 97(inUV): 29(ptr) FunctionParameter 99: Label - 536(fragPos): 76(ptr) Variable Function - 561(normal): 76(ptr) Variable Function - 580(albedo): 21(ptr) Variable Function - 598(fragcolor): 76(ptr) Variable Function - 625(param): 76(ptr) Variable Function - 629(param): 76(ptr) Variable Function - 682(N): 76(ptr) Variable Function - 693(i): 242(ptr) Variable Function - 710(L): 76(ptr) Variable Function - 725(dist): 24(ptr) Variable Function - 736(V): 76(ptr) Variable Function -751(lightCosInnerAngle): 24(ptr) Variable Function -758(lightCosOuterAngle): 24(ptr) Variable Function - 765(lightRange): 24(ptr) Variable Function - 772(dir): 76(ptr) Variable Function - 788(cosDir): 24(ptr) Variable Function - 797(spotEffect): 24(ptr) Variable Function -807(heightAttenuation): 24(ptr) Variable Function - 816(NdotL): 24(ptr) Variable Function - 826(diff): 76(ptr) Variable Function - 834(R): 76(ptr) Variable Function - 844(NdotR): 24(ptr) Variable Function - 854(spec): 76(ptr) Variable Function - 902(param): 76(ptr) Variable Function - 907(param): 76(ptr) Variable Function + 547(fragPos): 76(ptr) Variable Function + 572(normal): 76(ptr) Variable Function + 591(albedo): 21(ptr) Variable Function + 609(fragcolor): 76(ptr) Variable Function + 636(param): 76(ptr) Variable Function + 640(param): 76(ptr) Variable Function + 693(N): 76(ptr) Variable Function + 704(i): 242(ptr) Variable Function + 721(L): 76(ptr) Variable Function + 736(dist): 24(ptr) Variable Function + 747(V): 76(ptr) Variable Function +762(lightCosInnerAngle): 24(ptr) Variable Function +769(lightCosOuterAngle): 24(ptr) Variable Function + 776(lightRange): 24(ptr) Variable Function + 783(dir): 76(ptr) Variable Function + 799(cosDir): 24(ptr) Variable Function + 808(spotEffect): 24(ptr) Variable Function +818(heightAttenuation): 24(ptr) Variable Function + 827(NdotL): 24(ptr) Variable Function + 837(diff): 76(ptr) Variable Function + 845(R): 76(ptr) Variable Function + 855(NdotR): 24(ptr) Variable Function + 865(spec): 76(ptr) Variable Function + 913(param): 76(ptr) Variable Function + 918(param): 76(ptr) Variable Function 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 101 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 102 102 16 16 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 103 97(inUV) 49 - 534: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 101 98(@main(vf2;) - 540: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 535 - 541: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 538 538 16 16 - 539: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 537 536(fragPos) 49 - 549: 542 Load 546(textureposition) - 554: 175 Load 551(samplerposition) - 557: 555 SampledImage 549 554 - 558: 26(fvec2) Load 97(inUV) - 559: 18(fvec4) ImageSampleImplicitLod 557 558 - 560: 74(fvec3) VectorShuffle 559 559 0 1 2 - Store 536(fragPos) 560 - 566: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 564 564 16 16 - 565: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 562 561(normal) 49 - 570: 542 Load 567(textureNormal) - 575: 175 Load 572(samplerNormal) - 576: 555 SampledImage 570 575 - 577: 26(fvec2) Load 97(inUV) - 578: 18(fvec4) ImageSampleImplicitLod 576 577 - 579: 74(fvec3) VectorShuffle 578 578 0 1 2 - Store 561(normal) 579 - 585: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 583 583 16 16 - 584: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 581 580(albedo) 49 - 589: 542 Load 586(textureAlbedo) - 594: 175 Load 591(samplerAlbedo) - 595: 555 SampledImage 589 594 - 596: 26(fvec2) Load 97(inUV) - 597: 18(fvec4) ImageSampleImplicitLod 595 596 - Store 580(albedo) 597 - 602: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 600 600 16 16 - 601: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 599 598(fragcolor) 49 - 606: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 607 607 16 16 - 605: 603(ptr) AccessChain 495 323 442 - 608: 228(int) Load 605 - 609: 145(bool) SGreaterThan 608 323 - SelectionMerge 611 None - BranchConditional 609 610 611 - 610: Label - 614: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 612 - 615: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 616 616 16 16 - 613: 603(ptr) AccessChain 495 323 442 - 617: 228(int) Load 613 - SelectionMerge 623 None - Switch 617 623 - case 1: 618 - case 2: 619 - case 3: 620 - case 4: 621 - case 5: 622 - 618: Label - 626: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 612 - 627: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 628 628 16 16 - Store 625(param) 624 - 630: 74(fvec3) Load 536(fragPos) - Store 629(param) 630 - 631: 74(fvec3) FunctionCall 82(shadow(vf3;vf3;) 625(param) 629(param) - Store 598(fragcolor) 631 - 632: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 633 633 16 16 - Branch 623 - 619: Label - 636: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 612 - 637: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 638 638 16 16 - 635: 74(fvec3) Load 536(fragPos) - Store 598(fragcolor) 635 - 639: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 640 640 16 16 - Branch 623 - 620: Label - 643: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 612 - 644: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 645 645 16 16 - 642: 74(fvec3) Load 561(normal) - Store 598(fragcolor) 642 - 646: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 647 647 16 16 - Branch 623 - 621: Label - 650: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 612 - 651: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 652 652 16 16 - 649: 18(fvec4) Load 580(albedo) - 653: 74(fvec3) VectorShuffle 649 649 0 1 2 - Store 598(fragcolor) 653 - 654: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 655 655 16 16 - Branch 623 - 622: Label - 658: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 612 - 659: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 660 660 16 16 - 657: 18(fvec4) Load 580(albedo) - 661: 74(fvec3) VectorShuffle 657 657 3 3 3 - Store 598(fragcolor) 661 + 545: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 101 98(@main(vf2;) + 551: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 546 + 552: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 549 549 16 16 + 550: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 548 547(fragPos) 49 + 560: 553 Load 557(textureposition) + 565: 175 Load 562(samplerposition) + 568: 566 SampledImage 560 565 + 569: 26(fvec2) Load 97(inUV) + 570: 18(fvec4) ImageSampleImplicitLod 568 569 + 571: 74(fvec3) VectorShuffle 570 570 0 1 2 + Store 547(fragPos) 571 + 577: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 575 575 16 16 + 576: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 573 572(normal) 49 + 581: 553 Load 578(textureNormal) + 586: 175 Load 583(samplerNormal) + 587: 566 SampledImage 581 586 + 588: 26(fvec2) Load 97(inUV) + 589: 18(fvec4) ImageSampleImplicitLod 587 588 + 590: 74(fvec3) VectorShuffle 589 589 0 1 2 + Store 572(normal) 590 + 596: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 594 594 16 16 + 595: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 592 591(albedo) 49 + 600: 553 Load 597(textureAlbedo) + 605: 175 Load 602(samplerAlbedo) + 606: 566 SampledImage 600 605 + 607: 26(fvec2) Load 97(inUV) + 608: 18(fvec4) ImageSampleImplicitLod 606 607 + Store 591(albedo) 608 + 613: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 611 611 16 16 + 612: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 610 609(fragcolor) 49 + 617: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 618 618 16 16 + 616: 614(ptr) AccessChain 506 323 442 + 619: 228(int) Load 616 + 620: 145(bool) SGreaterThan 619 323 + SelectionMerge 622 None + BranchConditional 620 621 622 + 621: Label + 625: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 623 + 626: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 627 627 16 16 + 624: 614(ptr) AccessChain 506 323 442 + 628: 228(int) Load 624 + SelectionMerge 634 None + Switch 628 634 + case 1: 629 + case 2: 630 + case 3: 631 + case 4: 632 + case 5: 633 + 629: Label + 637: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 623 + 638: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 639 639 16 16 + Store 636(param) 635 + 641: 74(fvec3) Load 547(fragPos) + Store 640(param) 641 + 642: 74(fvec3) FunctionCall 82(shadow(vf3;vf3;) 636(param) 640(param) + Store 609(fragcolor) 642 + 643: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 644 644 16 16 + Branch 634 + 630: Label + 647: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 623 + 648: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 649 649 16 16 + 646: 74(fvec3) Load 547(fragPos) + Store 609(fragcolor) 646 + 650: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 651 651 16 16 + Branch 634 + 631: Label + 654: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 623 + 655: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 656 656 16 16 + 653: 74(fvec3) Load 572(normal) + Store 609(fragcolor) 653 + 657: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 658 658 16 16 + Branch 634 + 632: Label + 661: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 623 662: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 663 663 16 16 - Branch 623 - 623: Label - 667: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 612 - 668: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 669 669 16 16 - 666: 74(fvec3) Load 598(fragcolor) - 670: 8(float) CompositeExtract 666 0 - 671: 8(float) CompositeExtract 666 1 - 672: 8(float) CompositeExtract 666 2 - 673: 18(fvec4) CompositeConstruct 670 671 672 116 - ReturnValue 673 - 611: Label - 676: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 535 - 677: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 678 678 16 16 - 675: 18(fvec4) Load 580(albedo) - 679: 74(fvec3) VectorShuffle 675 675 0 1 2 - 681: 74(fvec3) VectorTimesScalar 679 680 - Store 598(fragcolor) 681 - 687: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 685 685 16 16 - 686: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 683 682(N) 49 - 688: 74(fvec3) Load 561(normal) - 689: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 688 - Store 682(N) 689 - 696: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 690 - 697: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 691 691 16 16 - 695: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 694 693(i) 49 - Store 693(i) 323 - Branch 698 - 698: Label - 702: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 690 - 703: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 691 691 16 16 - LoopMerge 700 701 None - Branch 704 - 704: Label - 706: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 690 - 707: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 691 691 16 16 - 705: 228(int) Load 693(i) - 708: 145(bool) SLessThan 705 442 - BranchConditional 708 699 700 - 699: Label - 715: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 709 - 716: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 713 713 16 16 - 714: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 711 710(L) 49 - 717: 228(int) Load 693(i) - 720: 718(ptr) AccessChain 495 323 330 717 323 - 721: 18(fvec4) Load 720 - 722: 74(fvec3) VectorShuffle 721 721 0 1 2 - 723: 74(fvec3) Load 536(fragPos) - 724: 74(fvec3) FSub 722 723 - Store 710(L) 724 - 729: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 727 727 16 16 - 728: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 726 725(dist) 49 - 730: 74(fvec3) Load 710(L) - 731: 8(float) ExtInst 3(GLSL.std.450) 66(Length) 730 - Store 725(dist) 731 - 733: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 734 734 16 16 - 732: 74(fvec3) Load 710(L) - 735: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 732 - Store 710(L) 735 - 741: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 739 739 16 16 - 740: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 737 736(V) 49 - 742: 718(ptr) AccessChain 495 323 323 - 743: 18(fvec4) Load 742 - 744: 74(fvec3) VectorShuffle 743 743 0 1 2 - 745: 74(fvec3) Load 536(fragPos) - 746: 74(fvec3) FSub 744 745 - Store 736(V) 746 - 748: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 749 749 16 16 - 747: 74(fvec3) Load 736(V) - 750: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 747 - Store 736(V) 750 - 756: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 754 754 16 16 - 755: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 752 751(lightCosInnerAngle) 49 - Store 751(lightCosInnerAngle) 757 - 763: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 761 761 16 16 - 762: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 759 758(lightCosOuterAngle) 49 - Store 758(lightCosOuterAngle) 764 - 770: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 768 768 16 16 - 769: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 766 765(lightRange) 49 - Store 765(lightRange) 771 - 777: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 775 775 16 16 - 776: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 773 772(dir) 49 - 778: 228(int) Load 693(i) - 779: 718(ptr) AccessChain 495 323 330 778 323 - 780: 18(fvec4) Load 779 - 781: 74(fvec3) VectorShuffle 780 780 0 1 2 - 782: 228(int) Load 693(i) - 783: 718(ptr) AccessChain 495 323 330 782 330 - 784: 18(fvec4) Load 783 - 785: 74(fvec3) VectorShuffle 784 784 0 1 2 - 786: 74(fvec3) FSub 781 785 - 787: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 786 - Store 772(dir) 787 - 793: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 791 791 16 16 - 792: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 789 788(cosDir) 49 - 794: 74(fvec3) Load 710(L) - 795: 74(fvec3) Load 772(dir) - 796: 8(float) Dot 794 795 - Store 788(cosDir) 796 - 802: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 800 800 16 16 - 801: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 798 797(spotEffect) 49 - 803: 8(float) Load 758(lightCosOuterAngle) - 804: 8(float) Load 751(lightCosInnerAngle) - 805: 8(float) Load 788(cosDir) - 806: 8(float) ExtInst 3(GLSL.std.450) 49(SmoothStep) 803 804 805 - Store 797(spotEffect) 806 - 812: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 810 810 16 16 - 811: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 808 807(heightAttenuation) 49 - 813: 8(float) Load 765(lightRange) - 814: 8(float) Load 725(dist) - 815: 8(float) ExtInst 3(GLSL.std.450) 49(SmoothStep) 813 204 814 - Store 807(heightAttenuation) 815 - 821: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 819 819 16 16 - 820: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 817 816(NdotL) 49 - 822: 74(fvec3) Load 682(N) - 823: 74(fvec3) Load 710(L) - 824: 8(float) Dot 822 823 - 825: 8(float) ExtInst 3(GLSL.std.450) 40(FMax) 204 824 - Store 816(NdotL) 825 - 831: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 829 829 16 16 - 830: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 827 826(diff) 49 - 832: 8(float) Load 816(NdotL) - 833: 74(fvec3) CompositeConstruct 832 832 832 - Store 826(diff) 833 - 839: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 837 837 16 16 - 838: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 835 834(R) 49 - 840: 74(fvec3) Load 710(L) - 841: 74(fvec3) FNegate 840 - 842: 74(fvec3) Load 682(N) - 843: 74(fvec3) ExtInst 3(GLSL.std.450) 71(Reflect) 841 842 - Store 834(R) 843 - 849: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 847 847 16 16 - 848: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 845 844(NdotR) 49 - 850: 74(fvec3) Load 834(R) - 851: 74(fvec3) Load 736(V) - 852: 8(float) Dot 850 851 - 853: 8(float) ExtInst 3(GLSL.std.450) 40(FMax) 204 852 - Store 844(NdotR) 853 - 859: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 857 857 16 16 - 858: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 855 854(spec) 49 - 860: 8(float) Load 844(NdotR) - 862: 8(float) ExtInst 3(GLSL.std.450) 26(Pow) 860 861 - 863: 24(ptr) AccessChain 580(albedo) 17 - 864: 8(float) Load 863 - 865: 8(float) FMul 862 864 - 867: 8(float) FMul 865 866 - 868: 74(fvec3) CompositeConstruct 867 867 867 - Store 854(spec) 868 - 870: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 871 871 16 16 - 869: 74(fvec3) Load 826(diff) - 872: 74(fvec3) Load 854(spec) - 873: 74(fvec3) FAdd 869 872 - 874: 8(float) Load 797(spotEffect) - 875: 74(fvec3) VectorTimesScalar 873 874 - 876: 8(float) Load 807(heightAttenuation) - 877: 74(fvec3) VectorTimesScalar 875 876 - 878: 228(int) Load 693(i) - 880: 718(ptr) AccessChain 495 323 330 878 879 - 881: 18(fvec4) Load 880 - 882: 74(fvec3) VectorShuffle 881 881 0 1 2 - 883: 74(fvec3) FMul 877 882 - 884: 18(fvec4) Load 580(albedo) - 885: 74(fvec3) VectorShuffle 884 884 0 1 2 - 886: 74(fvec3) FMul 883 885 - 887: 74(fvec3) Load 598(fragcolor) - 888: 74(fvec3) FAdd 887 886 - Store 598(fragcolor) 888 - Branch 701 - 701: Label - 890: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 690 - 891: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 691 691 16 16 - 889: 228(int) Load 693(i) - 892: 228(int) IAdd 889 330 - Store 693(i) 892 - Branch 698 - 700: Label - 894: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 535 - 895: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 896 896 16 16 - 893: 603(ptr) AccessChain 495 323 879 - 897: 228(int) Load 893 - 898: 145(bool) SGreaterThan 897 323 - SelectionMerge 900 None - BranchConditional 898 899 900 - 899: Label - 904: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 901 - 905: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 906 906 16 16 - 903: 74(fvec3) Load 598(fragcolor) - Store 902(param) 903 - 908: 74(fvec3) Load 536(fragPos) - Store 907(param) 908 - 909: 74(fvec3) FunctionCall 82(shadow(vf3;vf3;) 902(param) 907(param) - Store 598(fragcolor) 909 - Branch 900 - 900: Label - 911: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 535 - 912: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 913 913 16 16 - 910: 74(fvec3) Load 598(fragcolor) - 914: 8(float) CompositeExtract 910 0 - 915: 8(float) CompositeExtract 910 1 - 916: 8(float) CompositeExtract 910 2 - 917: 18(fvec4) CompositeConstruct 914 915 916 116 - ReturnValue 917 + 660: 18(fvec4) Load 591(albedo) + 664: 74(fvec3) VectorShuffle 660 660 0 1 2 + Store 609(fragcolor) 664 + 665: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 666 666 16 16 + Branch 634 + 633: Label + 669: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 623 + 670: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 671 671 16 16 + 668: 18(fvec4) Load 591(albedo) + 672: 74(fvec3) VectorShuffle 668 668 3 3 3 + Store 609(fragcolor) 672 + 673: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 674 674 16 16 + Branch 634 + 634: Label + 678: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 623 + 679: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 680 680 16 16 + 677: 74(fvec3) Load 609(fragcolor) + 681: 8(float) CompositeExtract 677 0 + 682: 8(float) CompositeExtract 677 1 + 683: 8(float) CompositeExtract 677 2 + 684: 18(fvec4) CompositeConstruct 681 682 683 116 + ReturnValue 684 + 622: Label + 687: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 546 + 688: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 689 689 16 16 + 686: 18(fvec4) Load 591(albedo) + 690: 74(fvec3) VectorShuffle 686 686 0 1 2 + 692: 74(fvec3) VectorTimesScalar 690 691 + Store 609(fragcolor) 692 + 698: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 696 696 16 16 + 697: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 694 693(N) 49 + 699: 74(fvec3) Load 572(normal) + 700: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 699 + Store 693(N) 700 + 707: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 701 + 708: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 702 702 16 16 + 706: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 705 704(i) 49 + Store 704(i) 323 + Branch 709 + 709: Label + 713: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 701 + 714: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 702 702 16 16 + LoopMerge 711 712 None + Branch 715 + 715: Label + 717: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 701 + 718: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 702 702 16 16 + 716: 228(int) Load 704(i) + 719: 145(bool) SLessThan 716 442 + BranchConditional 719 710 711 + 710: Label + 726: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 720 + 727: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 724 724 16 16 + 725: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 722 721(L) 49 + 728: 228(int) Load 704(i) + 731: 729(ptr) AccessChain 506 323 330 728 323 + 732: 18(fvec4) Load 731 + 733: 74(fvec3) VectorShuffle 732 732 0 1 2 + 734: 74(fvec3) Load 547(fragPos) + 735: 74(fvec3) FSub 733 734 + Store 721(L) 735 + 740: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 738 738 16 16 + 739: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 737 736(dist) 49 + 741: 74(fvec3) Load 721(L) + 742: 8(float) ExtInst 3(GLSL.std.450) 66(Length) 741 + Store 736(dist) 742 + 744: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 745 745 16 16 + 743: 74(fvec3) Load 721(L) + 746: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 743 + Store 721(L) 746 + 752: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 750 750 16 16 + 751: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 748 747(V) 49 + 753: 729(ptr) AccessChain 506 323 323 + 754: 18(fvec4) Load 753 + 755: 74(fvec3) VectorShuffle 754 754 0 1 2 + 756: 74(fvec3) Load 547(fragPos) + 757: 74(fvec3) FSub 755 756 + Store 747(V) 757 + 759: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 760 760 16 16 + 758: 74(fvec3) Load 747(V) + 761: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 758 + Store 747(V) 761 + 767: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 765 765 16 16 + 766: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 763 762(lightCosInnerAngle) 49 + Store 762(lightCosInnerAngle) 768 + 774: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 772 772 16 16 + 773: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 770 769(lightCosOuterAngle) 49 + Store 769(lightCosOuterAngle) 775 + 781: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 779 779 16 16 + 780: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 777 776(lightRange) 49 + Store 776(lightRange) 782 + 788: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 786 786 16 16 + 787: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 784 783(dir) 49 + 789: 228(int) Load 704(i) + 790: 729(ptr) AccessChain 506 323 330 789 323 + 791: 18(fvec4) Load 790 + 792: 74(fvec3) VectorShuffle 791 791 0 1 2 + 793: 228(int) Load 704(i) + 794: 729(ptr) AccessChain 506 323 330 793 330 + 795: 18(fvec4) Load 794 + 796: 74(fvec3) VectorShuffle 795 795 0 1 2 + 797: 74(fvec3) FSub 792 796 + 798: 74(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 797 + Store 783(dir) 798 + 804: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 802 802 16 16 + 803: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 800 799(cosDir) 49 + 805: 74(fvec3) Load 721(L) + 806: 74(fvec3) Load 783(dir) + 807: 8(float) Dot 805 806 + Store 799(cosDir) 807 + 813: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 811 811 16 16 + 812: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 809 808(spotEffect) 49 + 814: 8(float) Load 769(lightCosOuterAngle) + 815: 8(float) Load 762(lightCosInnerAngle) + 816: 8(float) Load 799(cosDir) + 817: 8(float) ExtInst 3(GLSL.std.450) 49(SmoothStep) 814 815 816 + Store 808(spotEffect) 817 + 823: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 821 821 16 16 + 822: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 819 818(heightAttenuation) 49 + 824: 8(float) Load 776(lightRange) + 825: 8(float) Load 736(dist) + 826: 8(float) ExtInst 3(GLSL.std.450) 49(SmoothStep) 824 204 825 + Store 818(heightAttenuation) 826 + 832: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 830 830 16 16 + 831: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 828 827(NdotL) 49 + 833: 74(fvec3) Load 693(N) + 834: 74(fvec3) Load 721(L) + 835: 8(float) Dot 833 834 + 836: 8(float) ExtInst 3(GLSL.std.450) 40(FMax) 204 835 + Store 827(NdotL) 836 + 842: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 840 840 16 16 + 841: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 838 837(diff) 49 + 843: 8(float) Load 827(NdotL) + 844: 74(fvec3) CompositeConstruct 843 843 843 + Store 837(diff) 844 + 850: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 848 848 16 16 + 849: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 846 845(R) 49 + 851: 74(fvec3) Load 721(L) + 852: 74(fvec3) FNegate 851 + 853: 74(fvec3) Load 693(N) + 854: 74(fvec3) ExtInst 3(GLSL.std.450) 71(Reflect) 852 853 + Store 845(R) 854 + 860: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 858 858 16 16 + 859: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 856 855(NdotR) 49 + 861: 74(fvec3) Load 845(R) + 862: 74(fvec3) Load 747(V) + 863: 8(float) Dot 861 862 + 864: 8(float) ExtInst 3(GLSL.std.450) 40(FMax) 204 863 + Store 855(NdotR) 864 + 870: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 868 868 16 16 + 869: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 866 865(spec) 49 + 871: 8(float) Load 855(NdotR) + 873: 8(float) ExtInst 3(GLSL.std.450) 26(Pow) 871 872 + 874: 24(ptr) AccessChain 591(albedo) 17 + 875: 8(float) Load 874 + 876: 8(float) FMul 873 875 + 878: 8(float) FMul 876 877 + 879: 74(fvec3) CompositeConstruct 878 878 878 + Store 865(spec) 879 + 881: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 882 882 16 16 + 880: 74(fvec3) Load 837(diff) + 883: 74(fvec3) Load 865(spec) + 884: 74(fvec3) FAdd 880 883 + 885: 8(float) Load 808(spotEffect) + 886: 74(fvec3) VectorTimesScalar 884 885 + 887: 8(float) Load 818(heightAttenuation) + 888: 74(fvec3) VectorTimesScalar 886 887 + 889: 228(int) Load 704(i) + 891: 729(ptr) AccessChain 506 323 330 889 890 + 892: 18(fvec4) Load 891 + 893: 74(fvec3) VectorShuffle 892 892 0 1 2 + 894: 74(fvec3) FMul 888 893 + 895: 18(fvec4) Load 591(albedo) + 896: 74(fvec3) VectorShuffle 895 895 0 1 2 + 897: 74(fvec3) FMul 894 896 + 898: 74(fvec3) Load 609(fragcolor) + 899: 74(fvec3) FAdd 898 897 + Store 609(fragcolor) 899 + Branch 712 + 712: Label + 901: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 701 + 902: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 702 702 16 16 + 900: 228(int) Load 704(i) + 903: 228(int) IAdd 900 330 + Store 704(i) 903 + Branch 709 + 711: Label + 905: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 546 + 906: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 907 907 16 16 + 904: 614(ptr) AccessChain 506 323 890 + 908: 228(int) Load 904 + 909: 145(bool) SGreaterThan 908 323 + SelectionMerge 911 None + BranchConditional 909 910 911 + 910: Label + 915: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 912 + 916: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 917 917 16 16 + 914: 74(fvec3) Load 609(fragcolor) + Store 913(param) 914 + 919: 74(fvec3) Load 547(fragPos) + Store 918(param) 919 + 920: 74(fvec3) FunctionCall 82(shadow(vf3;vf3;) 913(param) 918(param) + Store 609(fragcolor) 920 + Branch 911 + 911: Label + 922: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 546 + 923: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 40 924 924 16 16 + 921: 74(fvec3) Load 609(fragcolor) + 925: 8(float) CompositeExtract 921 0 + 926: 8(float) CompositeExtract 921 1 + 927: 8(float) CompositeExtract 921 2 + 928: 18(fvec4) CompositeConstruct 925 926 927 116 + ReturnValue 928 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.geom.out b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.geom.out index f4503bad82..a0b0e6c5c7 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.geom.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.geom.out @@ -1,7 +1,7 @@ spv.debuginfo.hlsl.geom // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 373 +// Id's are bound by 383 Capability Geometry Capability MultiViewport @@ -9,7 +9,7 @@ spv.debuginfo.hlsl.geom 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Geometry 6 "main" 270 279 284 291 296 301 306 322 329 334 358 361 + EntryPoint Geometry 6 "main" 280 289 294 301 306 311 316 332 339 344 368 371 ExecutionMode 6 Triangles ExecutionMode 6 Invocations 2 ExecutionMode 6 OutputTriangleStrip @@ -106,110 +106,113 @@ void main(triangle VSOutput input[3], inout TriangleStream outStream, outStream.RestartStrip(); } " - 31: String "Color" - 36: String "VSOutput" - 50: String "PrimitiveID" - 55: String "LightVec" - 61: String "GSOutput" - 74: String "@main" - 77: String "input" - 83: String "outStream" - 87: String "InvocationID" - 97: String "int" - 103: String "i" - 120: String "bool" - 126: String "output" - 152: String "projection" - 156: String "modelview" - 160: String "lightPos" - 164: String "UBO" - 167: String "ubo" - 174: String "" - 204: String "pos" - 213: String "worldPos" - 224: String "lPos" - 272: String "outStream.Pos" - 281: String "outStream.ViewportIndex" - 286: String "outStream.PrimitiveID" - 293: String "outStream.Normal" - 298: String "outStream.Color" - 303: String "outStream.ViewVec" - 308: String "outStream.LightVec" + 31: String "Normal" + 35: String "Color" + 39: String "VSOutput" + 53: String "ViewportIndex" + 57: String "PrimitiveID" + 65: String "ViewVec" + 69: String "LightVec" + 72: String "GSOutput" + 85: String "@main" + 88: String "input" + 94: String "outStream" + 98: String "InvocationID" + 108: String "int" + 114: String "i" + 131: String "bool" + 137: String "output" + 163: String "projection" + 166: String "modelview" + 170: String "lightPos" + 174: String "UBO" + 177: String "ubo" + 184: String "" + 214: String "pos" + 223: String "worldPos" + 234: String "lPos" + 282: String "outStream.Pos" + 291: String "outStream.ViewportIndex" + 296: String "outStream.PrimitiveID" + 303: String "outStream.Normal" + 308: String "outStream.Color" + 313: String "outStream.ViewVec" + 318: String "outStream.LightVec" Name 6 "main" Name 23 "VSOutput" MemberName 23(VSOutput) 0 "Pos" MemberName 23(VSOutput) 1 "Normal" MemberName 23(VSOutput) 2 "Color" - Name 46 "GSOutput" - MemberName 46(GSOutput) 0 "Pos" - MemberName 46(GSOutput) 1 "ViewportIndex" - MemberName 46(GSOutput) 2 "PrimitiveID" - MemberName 46(GSOutput) 3 "Normal" - MemberName 46(GSOutput) 4 "Color" - MemberName 46(GSOutput) 5 "ViewVec" - MemberName 46(GSOutput) 6 "LightVec" - Name 72 "@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;" - Name 68 "input" - Name 69 "outStream" - Name 70 "InvocationID" - Name 71 "PrimitiveID" - Name 101 "i" - Name 124 "output" - Name 150 "UBO" - MemberName 150(UBO) 0 "projection" - MemberName 150(UBO) 1 "modelview" - MemberName 150(UBO) 2 "lightPos" - Name 165 "ubo" - MemberName 165(ubo) 0 "ubo" - Name 172 "" - Name 202 "pos" - Name 211 "worldPos" - Name 222 "lPos" - Name 270 "outStream.Pos" - Name 279 "outStream.ViewportIndex" - Name 284 "outStream.PrimitiveID" - Name 291 "outStream.Normal" - Name 296 "outStream.Color" - Name 301 "outStream.ViewVec" - Name 306 "outStream.LightVec" - Name 319 "input" - Name 322 "input.Pos" - Name 329 "input.Normal" - Name 334 "input.Color" - Name 356 "InvocationID" - Name 358 "InvocationID" - Name 360 "PrimitiveID" - Name 361 "PrimitiveID" - Name 363 "outStream" - Name 364 "param" - Name 366 "param" - Name 367 "param" - Name 369 "param" - Decorate 146 ArrayStride 64 - Decorate 148 ArrayStride 64 - MemberDecorate 150(UBO) 0 RowMajor - MemberDecorate 150(UBO) 0 MatrixStride 16 - MemberDecorate 150(UBO) 0 Offset 0 - MemberDecorate 150(UBO) 1 RowMajor - MemberDecorate 150(UBO) 1 MatrixStride 16 - MemberDecorate 150(UBO) 1 Offset 128 - MemberDecorate 150(UBO) 2 Offset 256 - Decorate 165(ubo) Block - MemberDecorate 165(ubo) 0 Offset 0 - Decorate 172 Binding 0 - Decorate 172 DescriptorSet 0 - Decorate 270(outStream.Pos) BuiltIn Position - Decorate 279(outStream.ViewportIndex) BuiltIn ViewportIndex - Decorate 284(outStream.PrimitiveID) BuiltIn PrimitiveId - Decorate 291(outStream.Normal) Location 0 - Decorate 296(outStream.Color) Location 1 - Decorate 301(outStream.ViewVec) Location 2 - Decorate 306(outStream.LightVec) Location 3 - Decorate 322(input.Pos) BuiltIn Position - Decorate 329(input.Normal) Location 0 - Decorate 334(input.Color) Location 1 - Decorate 358(InvocationID) BuiltIn InvocationId - Decorate 361(PrimitiveID) BuiltIn PrimitiveId + Name 49 "GSOutput" + MemberName 49(GSOutput) 0 "Pos" + MemberName 49(GSOutput) 1 "ViewportIndex" + MemberName 49(GSOutput) 2 "PrimitiveID" + MemberName 49(GSOutput) 3 "Normal" + MemberName 49(GSOutput) 4 "Color" + MemberName 49(GSOutput) 5 "ViewVec" + MemberName 49(GSOutput) 6 "LightVec" + Name 83 "@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;" + Name 79 "input" + Name 80 "outStream" + Name 81 "InvocationID" + Name 82 "PrimitiveID" + Name 112 "i" + Name 135 "output" + Name 161 "UBO" + MemberName 161(UBO) 0 "projection" + MemberName 161(UBO) 1 "modelview" + MemberName 161(UBO) 2 "lightPos" + Name 175 "ubo" + MemberName 175(ubo) 0 "ubo" + Name 182 "" + Name 212 "pos" + Name 221 "worldPos" + Name 232 "lPos" + Name 280 "outStream.Pos" + Name 289 "outStream.ViewportIndex" + Name 294 "outStream.PrimitiveID" + Name 301 "outStream.Normal" + Name 306 "outStream.Color" + Name 311 "outStream.ViewVec" + Name 316 "outStream.LightVec" + Name 329 "input" + Name 332 "input.Pos" + Name 339 "input.Normal" + Name 344 "input.Color" + Name 366 "InvocationID" + Name 368 "InvocationID" + Name 370 "PrimitiveID" + Name 371 "PrimitiveID" + Name 373 "outStream" + Name 374 "param" + Name 376 "param" + Name 377 "param" + Name 379 "param" + Decorate 157 ArrayStride 64 + Decorate 159 ArrayStride 64 + MemberDecorate 161(UBO) 0 RowMajor + MemberDecorate 161(UBO) 0 MatrixStride 16 + MemberDecorate 161(UBO) 0 Offset 0 + MemberDecorate 161(UBO) 1 RowMajor + MemberDecorate 161(UBO) 1 MatrixStride 16 + MemberDecorate 161(UBO) 1 Offset 128 + MemberDecorate 161(UBO) 2 Offset 256 + Decorate 175(ubo) Block + MemberDecorate 175(ubo) 0 Offset 0 + Decorate 182 Binding 0 + Decorate 182 DescriptorSet 0 + Decorate 280(outStream.Pos) BuiltIn Position + Decorate 289(outStream.ViewportIndex) BuiltIn ViewportIndex + Decorate 294(outStream.PrimitiveID) BuiltIn PrimitiveId + Decorate 301(outStream.Normal) Location 0 + Decorate 306(outStream.Color) Location 1 + Decorate 311(outStream.ViewVec) Location 2 + Decorate 316(outStream.LightVec) Location 3 + Decorate 332(input.Pos) BuiltIn Position + Decorate 339(input.Normal) Location 0 + Decorate 344(input.Color) Location 1 + Decorate 368(InvocationID) BuiltIn InvocationId + Decorate 371(PrimitiveID) BuiltIn PrimitiveId 4: TypeVoid 5: TypeFunction 4 8: TypeFloat 32 @@ -230,366 +233,373 @@ void main(triangle VSOutput input[3], inout TriangleStream outStream, 28: 11(int) Constant 37 29: 11(int) Constant 13 24: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 25 20 26 28 29 16 16 17 - 32: 11(int) Constant 39 - 33: 11(int) Constant 34 + 32: 11(int) Constant 38 + 33: 11(int) Constant 35 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 31 22 26 32 33 16 16 17 - 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 31 22 26 32 33 16 16 17 - 37: 11(int) Constant 1 - 38: 11(int) Constant 56 - 40: 11(int) Constant 5 - 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 37 19 26 40 - 35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 36 37 26 38 16 39 36 16 17 24 30 34 - 41: TypeArray 23(VSOutput) 17 - 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 35 17 - 43: TypePointer Function 41 - 44: 11(int) Constant 7 - 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 42 44 16 - 46(GSOutput): TypeStruct 18(fvec4) 11(int) 11(int) 21(fvec3) 21(fvec3) 21(fvec3) 21(fvec3) - 48: 11(int) Constant 44 - 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 25 20 26 48 29 16 16 17 - 51: 11(int) Constant 46 - 52: 11(int) Constant 19 - 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 50 13 26 51 52 16 16 17 - 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 50 13 26 51 52 16 16 17 - 56: 11(int) Constant 50 - 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 55 22 26 56 28 16 16 17 - 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 55 22 26 56 28 16 16 17 - 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 55 22 26 56 28 16 16 17 - 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 55 22 26 56 28 16 16 17 - 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 61 37 26 38 16 39 61 16 17 47 49 53 54 57 58 59 - 62: TypePointer Function 46(GSOutput) - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 60 44 16 - 64: TypePointer Function 11(int) - 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 13 44 16 - 66: TypeFunction 4 43(ptr) 62(ptr) 64(ptr) 64(ptr) - 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 17 4 42 60 13 13 - 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 74 67 26 38 16 39 74 17 38 - 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 77 42 26 38 16 75 19 37 - 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 84: 11(int) Constant 2 - 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 83 60 26 38 16 75 19 84 - 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 87 13 26 38 16 75 19 17 - 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 50 13 26 38 16 75 19 19 - 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 26 16 16 75 - 94: 11(int) Constant 57 - 95: 11(int) Constant 10 - 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 26 94 95 92 - 96: TypeInt 32 1 - 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 97 14 19 16 - 99: TypePointer Function 96(int) - 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 44 16 - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 103 98 26 94 16 93 19 - 107: 96(int) Constant 0 - 118: 96(int) Constant 3 - 119: TypeBool - 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 120 14 84 16 - 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 26 16 16 93 - 127: 11(int) Constant 59 - 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 126 60 26 127 16 123 19 - 131: 8(float) Constant 0 - 132: 18(fvec4) ConstantComposite 131 131 131 131 - 133: 21(fvec3) ConstantComposite 131 131 131 - 134:46(GSOutput) ConstantComposite 132 16 16 133 133 133 133 - 137: 11(int) Constant 60 - 138: 96(int) Constant 1 - 139: TypePointer Function 21(fvec3) - 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 44 16 - 143: TypeMatrix 18(fvec4) 4 - 145: 119(bool) ConstantTrue - 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 20 19 145 - 146: TypeArray 143 84 - 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 144 84 - 148: TypeArray 143 84 - 149: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 144 84 - 150(UBO): TypeStruct 146 148 18(fvec4) - 153: 11(int) Constant 28 - 154: 11(int) Constant 21 - 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 152 147 26 153 154 16 16 17 - 157: 11(int) Constant 29 - 158: 11(int) Constant 20 - 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 156 149 26 157 158 16 16 17 - 161: 11(int) Constant 30 - 162: 11(int) Constant 17 - 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 160 20 26 161 162 16 16 17 - 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 164 37 26 137 16 39 164 16 17 151 155 159 - 165(ubo): TypeStruct 150(UBO) - 168: 11(int) Constant 33 - 166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 167 163 26 168 28 16 16 17 - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 167 37 26 137 16 39 167 16 17 166 - 170: TypePointer Uniform 165(ubo) - 171: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 169 84 16 - 172: 170(ptr) Variable Uniform - 175: 11(int) Constant 8 - 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 174 169 26 137 16 39 174 172 175 - 177: TypePointer Uniform 143 - 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 144 84 16 - 181: TypeMatrix 21(fvec3) 3 - 182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 22 17 145 - 192: 96(int) Constant 4 - 195: 11(int) Constant 61 - 196: 96(int) Constant 2 - 200: TypePointer Function 18(fvec4) - 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 44 16 - 205: 11(int) Constant 63 - 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 204 20 26 205 16 123 19 - 214: 11(int) Constant 64 - 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 213 20 26 214 16 123 19 - 225: 11(int) Constant 66 - 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 224 22 26 225 16 123 19 - 228: TypePointer Uniform 18(fvec4) - 229: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 84 16 - 237: 96(int) Constant 6 - 240: 11(int) Constant 67 - 245: 96(int) Constant 5 - 248: 11(int) Constant 68 - 254: 11(int) Constant 70 - 262: 11(int) Constant 73 - 266: 11(int) Constant 74 - 268: TypePointer Output 18(fvec4) - 269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 17 16 -270(outStream.Pos): 268(ptr) Variable Output - 273: 11(int) Constant 75 - 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 272 20 26 273 16 39 272 270(outStream.Pos) 175 - 277: TypePointer Output 11(int) - 278: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 13 17 16 -279(outStream.ViewportIndex): 277(ptr) Variable Output - 280: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 281 13 26 273 16 39 281 279(outStream.ViewportIndex) 175 -284(outStream.PrimitiveID): 277(ptr) Variable Output - 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 286 13 26 273 16 39 286 284(outStream.PrimitiveID) 175 - 289: TypePointer Output 21(fvec3) - 290: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 17 16 -291(outStream.Normal): 289(ptr) Variable Output - 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 293 22 26 273 16 39 293 291(outStream.Normal) 175 -296(outStream.Color): 289(ptr) Variable Output - 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 298 22 26 273 16 39 298 296(outStream.Color) 175 -301(outStream.ViewVec): 289(ptr) Variable Output - 302: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 303 22 26 273 16 39 303 301(outStream.ViewVec) 175 -306(outStream.LightVec): 289(ptr) Variable Output - 307: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 308 22 26 273 16 39 308 306(outStream.LightVec) 175 - 317: 11(int) Constant 78 - 320: TypeArray 18(fvec4) 17 - 321: TypePointer Input 320 - 322(input.Pos): 321(ptr) Variable Input - 323: TypePointer Input 18(fvec4) - 327: TypeArray 21(fvec3) 17 - 328: TypePointer Input 327 -329(input.Normal): 328(ptr) Variable Input - 330: TypePointer Input 21(fvec3) -334(input.Color): 328(ptr) Variable Input - 357: TypePointer Input 11(int) -358(InvocationID): 357(ptr) Variable Input -361(PrimitiveID): 357(ptr) Variable Input + 36: 11(int) Constant 39 + 37: 11(int) Constant 34 + 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 35 22 26 36 37 16 16 17 + 40: 11(int) Constant 1 + 41: 11(int) Constant 56 + 43: 11(int) Constant 5 + 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 40 19 26 43 + 38: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 39 40 26 41 16 42 39 16 17 24 30 34 + 44: TypeArray 23(VSOutput) 17 + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 38 17 + 46: TypePointer Function 44 + 47: 11(int) Constant 7 + 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 45 47 16 + 49(GSOutput): TypeStruct 18(fvec4) 11(int) 11(int) 21(fvec3) 21(fvec3) 21(fvec3) 21(fvec3) + 51: 11(int) Constant 44 + 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 25 20 26 51 29 16 16 17 + 54: 11(int) Constant 45 + 55: 11(int) Constant 21 + 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 53 13 26 54 55 16 16 17 + 58: 11(int) Constant 46 + 59: 11(int) Constant 19 + 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 57 13 26 58 59 16 16 17 + 61: 11(int) Constant 47 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 31 22 26 61 33 16 16 17 + 63: 11(int) Constant 48 + 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 35 22 26 63 37 16 16 17 + 66: 11(int) Constant 49 + 67: 11(int) Constant 36 + 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 65 22 26 66 67 16 16 17 + 70: 11(int) Constant 50 + 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 69 22 26 70 28 16 16 17 + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 72 40 26 41 16 42 72 16 17 50 52 56 60 62 64 68 + 73: TypePointer Function 49(GSOutput) + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 71 47 16 + 75: TypePointer Function 11(int) + 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 13 47 16 + 77: TypeFunction 4 46(ptr) 73(ptr) 75(ptr) 75(ptr) + 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 17 4 45 71 13 13 + 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 85 78 26 41 16 42 85 17 41 + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 88 45 26 41 16 86 19 40 + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 95: 11(int) Constant 2 + 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 94 71 26 41 16 86 19 95 + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 98 13 26 41 16 86 19 17 + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 57 13 26 41 16 86 19 19 + 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 26 16 16 86 + 105: 11(int) Constant 57 + 106: 11(int) Constant 10 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 26 105 106 103 + 107: TypeInt 32 1 + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 108 14 19 16 + 110: TypePointer Function 107(int) + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 109 47 16 + 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 114 109 26 105 16 104 19 + 118: 107(int) Constant 0 + 129: 107(int) Constant 3 + 130: TypeBool + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 131 14 95 16 + 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 26 16 16 104 + 138: 11(int) Constant 59 + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 137 71 26 138 16 134 19 + 142: 8(float) Constant 0 + 143: 18(fvec4) ConstantComposite 142 142 142 142 + 144: 21(fvec3) ConstantComposite 142 142 142 + 145:49(GSOutput) ConstantComposite 143 16 16 144 144 144 144 + 148: 11(int) Constant 60 + 149: 107(int) Constant 1 + 150: TypePointer Function 21(fvec3) + 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 47 16 + 154: TypeMatrix 18(fvec4) 4 + 156: 130(bool) ConstantTrue + 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 20 19 156 + 157: TypeArray 154 95 + 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 155 95 + 159: TypeArray 154 95 + 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 155 95 + 161(UBO): TypeStruct 157 159 18(fvec4) + 164: 11(int) Constant 28 + 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 163 158 26 164 55 16 16 17 + 167: 11(int) Constant 29 + 168: 11(int) Constant 20 + 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 166 160 26 167 168 16 16 17 + 171: 11(int) Constant 30 + 172: 11(int) Constant 17 + 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 170 20 26 171 172 16 16 17 + 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 174 40 26 148 16 42 174 16 17 162 165 169 + 175(ubo): TypeStruct 161(UBO) + 178: 11(int) Constant 33 + 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 177 173 26 178 28 16 16 17 + 179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 177 40 26 148 16 42 177 16 17 176 + 180: TypePointer Uniform 175(ubo) + 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 179 95 16 + 182: 180(ptr) Variable Uniform + 185: 11(int) Constant 8 + 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 184 179 26 148 16 42 184 182 185 + 187: TypePointer Uniform 154 + 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 95 16 + 191: TypeMatrix 21(fvec3) 3 + 192: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 22 17 156 + 202: 107(int) Constant 4 + 205: 11(int) Constant 61 + 206: 107(int) Constant 2 + 210: TypePointer Function 18(fvec4) + 211: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 47 16 + 215: 11(int) Constant 63 + 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 214 20 26 215 16 134 19 + 224: 11(int) Constant 64 + 222: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 223 20 26 224 16 134 19 + 235: 11(int) Constant 66 + 233: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 234 22 26 235 16 134 19 + 238: TypePointer Uniform 18(fvec4) + 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 95 16 + 247: 107(int) Constant 6 + 250: 11(int) Constant 67 + 255: 107(int) Constant 5 + 258: 11(int) Constant 68 + 264: 11(int) Constant 70 + 272: 11(int) Constant 73 + 276: 11(int) Constant 74 + 278: TypePointer Output 18(fvec4) + 279: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 17 16 +280(outStream.Pos): 278(ptr) Variable Output + 283: 11(int) Constant 75 + 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 282 20 26 283 16 42 282 280(outStream.Pos) 185 + 287: TypePointer Output 11(int) + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 13 17 16 +289(outStream.ViewportIndex): 287(ptr) Variable Output + 290: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 291 13 26 283 16 42 291 289(outStream.ViewportIndex) 185 +294(outStream.PrimitiveID): 287(ptr) Variable Output + 295: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 296 13 26 283 16 42 296 294(outStream.PrimitiveID) 185 + 299: TypePointer Output 21(fvec3) + 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 17 16 +301(outStream.Normal): 299(ptr) Variable Output + 302: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 303 22 26 283 16 42 303 301(outStream.Normal) 185 +306(outStream.Color): 299(ptr) Variable Output + 307: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 308 22 26 283 16 42 308 306(outStream.Color) 185 +311(outStream.ViewVec): 299(ptr) Variable Output + 312: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 313 22 26 283 16 42 313 311(outStream.ViewVec) 185 +316(outStream.LightVec): 299(ptr) Variable Output + 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 318 22 26 283 16 42 318 316(outStream.LightVec) 185 + 327: 11(int) Constant 78 + 330: TypeArray 18(fvec4) 17 + 331: TypePointer Input 330 + 332(input.Pos): 331(ptr) Variable Input + 333: TypePointer Input 18(fvec4) + 337: TypeArray 21(fvec3) 17 + 338: TypePointer Input 337 +339(input.Normal): 338(ptr) Variable Input + 340: TypePointer Input 21(fvec3) +344(input.Color): 338(ptr) Variable Input + 367: TypePointer Input 11(int) +368(InvocationID): 367(ptr) Variable Input +371(PrimitiveID): 367(ptr) Variable Input 6(main): 4 Function None 5 7: Label - 319(input): 43(ptr) Variable Function -356(InvocationID): 64(ptr) Variable Function -360(PrimitiveID): 64(ptr) Variable Function - 363(outStream): 62(ptr) Variable Function - 364(param): 43(ptr) Variable Function - 366(param): 62(ptr) Variable Function - 367(param): 64(ptr) Variable Function - 369(param): 64(ptr) Variable Function - 324: 323(ptr) AccessChain 322(input.Pos) 107 - 325: 18(fvec4) Load 324 - 326: 200(ptr) AccessChain 319(input) 107 107 - Store 326 325 - 331: 330(ptr) AccessChain 329(input.Normal) 107 - 332: 21(fvec3) Load 331 - 333: 139(ptr) AccessChain 319(input) 107 138 - Store 333 332 - 335: 330(ptr) AccessChain 334(input.Color) 107 - 336: 21(fvec3) Load 335 - 337: 139(ptr) AccessChain 319(input) 107 196 - Store 337 336 - 338: 323(ptr) AccessChain 322(input.Pos) 138 - 339: 18(fvec4) Load 338 - 340: 200(ptr) AccessChain 319(input) 138 107 - Store 340 339 - 341: 330(ptr) AccessChain 329(input.Normal) 138 + 329(input): 46(ptr) Variable Function +366(InvocationID): 75(ptr) Variable Function +370(PrimitiveID): 75(ptr) Variable Function + 373(outStream): 73(ptr) Variable Function + 374(param): 46(ptr) Variable Function + 376(param): 73(ptr) Variable Function + 377(param): 75(ptr) Variable Function + 379(param): 75(ptr) Variable Function + 334: 333(ptr) AccessChain 332(input.Pos) 118 + 335: 18(fvec4) Load 334 + 336: 210(ptr) AccessChain 329(input) 118 118 + Store 336 335 + 341: 340(ptr) AccessChain 339(input.Normal) 118 342: 21(fvec3) Load 341 - 343: 139(ptr) AccessChain 319(input) 138 138 + 343: 150(ptr) AccessChain 329(input) 118 149 Store 343 342 - 344: 330(ptr) AccessChain 334(input.Color) 138 - 345: 21(fvec3) Load 344 - 346: 139(ptr) AccessChain 319(input) 138 196 - Store 346 345 - 347: 323(ptr) AccessChain 322(input.Pos) 196 - 348: 18(fvec4) Load 347 - 349: 200(ptr) AccessChain 319(input) 196 107 - Store 349 348 - 350: 330(ptr) AccessChain 329(input.Normal) 196 - 351: 21(fvec3) Load 350 - 352: 139(ptr) AccessChain 319(input) 196 138 - Store 352 351 - 353: 330(ptr) AccessChain 334(input.Color) 196 - 354: 21(fvec3) Load 353 - 355: 139(ptr) AccessChain 319(input) 196 196 - Store 355 354 - 359: 11(int) Load 358(InvocationID) - Store 356(InvocationID) 359 - 362: 11(int) Load 361(PrimitiveID) - Store 360(PrimitiveID) 362 - 365: 41 Load 319(input) - Store 364(param) 365 - 368: 11(int) Load 356(InvocationID) - Store 367(param) 368 - 370: 11(int) Load 360(PrimitiveID) - Store 369(param) 370 - 371: 4 FunctionCall 72(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;) 364(param) 366(param) 367(param) 369(param) - 372:46(GSOutput) Load 366(param) - Store 363(outStream) 372 + 345: 340(ptr) AccessChain 344(input.Color) 118 + 346: 21(fvec3) Load 345 + 347: 150(ptr) AccessChain 329(input) 118 206 + Store 347 346 + 348: 333(ptr) AccessChain 332(input.Pos) 149 + 349: 18(fvec4) Load 348 + 350: 210(ptr) AccessChain 329(input) 149 118 + Store 350 349 + 351: 340(ptr) AccessChain 339(input.Normal) 149 + 352: 21(fvec3) Load 351 + 353: 150(ptr) AccessChain 329(input) 149 149 + Store 353 352 + 354: 340(ptr) AccessChain 344(input.Color) 149 + 355: 21(fvec3) Load 354 + 356: 150(ptr) AccessChain 329(input) 149 206 + Store 356 355 + 357: 333(ptr) AccessChain 332(input.Pos) 206 + 358: 18(fvec4) Load 357 + 359: 210(ptr) AccessChain 329(input) 206 118 + Store 359 358 + 360: 340(ptr) AccessChain 339(input.Normal) 206 + 361: 21(fvec3) Load 360 + 362: 150(ptr) AccessChain 329(input) 206 149 + Store 362 361 + 363: 340(ptr) AccessChain 344(input.Color) 206 + 364: 21(fvec3) Load 363 + 365: 150(ptr) AccessChain 329(input) 206 206 + Store 365 364 + 369: 11(int) Load 368(InvocationID) + Store 366(InvocationID) 369 + 372: 11(int) Load 371(PrimitiveID) + Store 370(PrimitiveID) 372 + 375: 44 Load 329(input) + Store 374(param) 375 + 378: 11(int) Load 366(InvocationID) + Store 377(param) 378 + 380: 11(int) Load 370(PrimitiveID) + Store 379(param) 380 + 381: 4 FunctionCall 83(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;) 374(param) 376(param) 377(param) 379(param) + 382:49(GSOutput) Load 376(param) + Store 373(outStream) 382 Return FunctionEnd -72(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;): 4 Function None 66 - 68(input): 43(ptr) FunctionParameter - 69(outStream): 62(ptr) FunctionParameter -70(InvocationID): 64(ptr) FunctionParameter - 71(PrimitiveID): 64(ptr) FunctionParameter - 73: Label - 101(i): 99(ptr) Variable Function - 124(output): 62(ptr) Variable Function - 202(pos): 200(ptr) Variable Function - 211(worldPos): 200(ptr) Variable Function - 222(lPos): 139(ptr) Variable Function - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 75 - 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 38 38 16 16 - 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 76 68(input) 79 - 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 82 69(outStream) 79 - 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 86 70(InvocationID) 79 - 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 89 71(PrimitiveID) 79 - 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 75 72(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;) - 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 93 - 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 94 94 16 16 - 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 102 101(i) 79 - Store 101(i) 107 - Branch 108 - 108: Label - 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 93 - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 94 94 16 16 - LoopMerge 110 111 None - Branch 114 - 114: Label - 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 93 - 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 94 94 16 16 - 115: 96(int) Load 101(i) - 122: 119(bool) SLessThan 115 118 - BranchConditional 122 109 110 - 109: Label - 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 123 - 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 127 127 16 16 - 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 125 124(output) 79 - Store 124(output) 134 - 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 137 137 16 16 - 135: 96(int) Load 101(i) - 141: 139(ptr) AccessChain 68(input) 135 138 - 142: 21(fvec3) Load 141 - 176: 11(int) Load 70(InvocationID) - 179: 177(ptr) AccessChain 172 107 138 176 - 180: 143 Load 179 - 183: 18(fvec4) CompositeExtract 180 0 - 184: 21(fvec3) VectorShuffle 183 183 0 1 2 - 185: 18(fvec4) CompositeExtract 180 1 - 186: 21(fvec3) VectorShuffle 185 185 0 1 2 - 187: 18(fvec4) CompositeExtract 180 2 - 188: 21(fvec3) VectorShuffle 187 187 0 1 2 - 189: 181 CompositeConstruct 184 186 188 - 190: 21(fvec3) VectorTimesMatrix 142 189 - 191: 139(ptr) AccessChain 124(output) 118 - Store 191 190 - 194: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 195 195 16 16 - 193: 96(int) Load 101(i) - 197: 139(ptr) AccessChain 68(input) 193 196 - 198: 21(fvec3) Load 197 - 199: 139(ptr) AccessChain 124(output) 192 - Store 199 198 - 207: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 205 205 16 16 - 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 203 202(pos) 79 - 208: 96(int) Load 101(i) - 209: 200(ptr) AccessChain 68(input) 208 107 - 210: 18(fvec4) Load 209 - Store 202(pos) 210 - 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 214 214 16 16 - 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 212 211(worldPos) 79 - 217: 18(fvec4) Load 202(pos) - 218: 11(int) Load 70(InvocationID) - 219: 177(ptr) AccessChain 172 107 138 218 - 220: 143 Load 219 - 221: 18(fvec4) VectorTimesMatrix 217 220 - Store 211(worldPos) 221 - 227: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 225 225 16 16 - 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 223 222(lPos) 79 - 230: 228(ptr) AccessChain 172 107 196 - 231: 18(fvec4) Load 230 - 232: 11(int) Load 70(InvocationID) - 233: 177(ptr) AccessChain 172 107 138 232 - 234: 143 Load 233 - 235: 18(fvec4) VectorTimesMatrix 231 234 - 236: 21(fvec3) VectorShuffle 235 235 0 1 2 - Store 222(lPos) 236 - 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 240 240 16 16 - 238: 21(fvec3) Load 222(lPos) - 241: 18(fvec4) Load 211(worldPos) - 242: 21(fvec3) VectorShuffle 241 241 0 1 2 - 243: 21(fvec3) FSub 238 242 - 244: 139(ptr) AccessChain 124(output) 237 - Store 244 243 - 247: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 248 248 16 16 - 246: 18(fvec4) Load 211(worldPos) - 249: 21(fvec3) VectorShuffle 246 246 0 1 2 - 250: 21(fvec3) FNegate 249 - 251: 139(ptr) AccessChain 124(output) 245 - Store 251 250 - 253: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 254 254 16 16 - 252: 18(fvec4) Load 211(worldPos) - 255: 11(int) Load 70(InvocationID) - 256: 177(ptr) AccessChain 172 107 107 255 - 257: 143 Load 256 - 258: 18(fvec4) VectorTimesMatrix 252 257 - 259: 200(ptr) AccessChain 124(output) 107 - Store 259 258 - 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 262 262 16 16 - 260: 11(int) Load 70(InvocationID) - 263: 64(ptr) AccessChain 124(output) 138 - Store 263 260 - 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 266 266 16 16 - 264: 11(int) Load 71(PrimitiveID) - 267: 64(ptr) AccessChain 124(output) 196 - Store 267 264 - 275: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 273 273 16 16 - 274: 200(ptr) AccessChain 124(output) 107 - 276: 18(fvec4) Load 274 - Store 270(outStream.Pos) 276 - 282: 64(ptr) AccessChain 124(output) 138 - 283: 11(int) Load 282 - Store 279(outStream.ViewportIndex) 283 - 287: 64(ptr) AccessChain 124(output) 196 - 288: 11(int) Load 287 - Store 284(outStream.PrimitiveID) 288 - 294: 139(ptr) AccessChain 124(output) 118 - 295: 21(fvec3) Load 294 - Store 291(outStream.Normal) 295 - 299: 139(ptr) AccessChain 124(output) 192 - 300: 21(fvec3) Load 299 - Store 296(outStream.Color) 300 - 304: 139(ptr) AccessChain 124(output) 245 +83(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;): 4 Function None 77 + 79(input): 46(ptr) FunctionParameter + 80(outStream): 73(ptr) FunctionParameter +81(InvocationID): 75(ptr) FunctionParameter + 82(PrimitiveID): 75(ptr) FunctionParameter + 84: Label + 112(i): 110(ptr) Variable Function + 135(output): 73(ptr) Variable Function + 212(pos): 210(ptr) Variable Function + 221(worldPos): 210(ptr) Variable Function + 232(lPos): 150(ptr) Variable Function + 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 86 + 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 41 41 16 16 + 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 87 79(input) 90 + 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 93 80(outStream) 90 + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 97 81(InvocationID) 90 + 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 100 82(PrimitiveID) 90 + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 86 83(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;) + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 104 + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 105 105 16 16 + 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 113 112(i) 90 + Store 112(i) 118 + Branch 119 + 119: Label + 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 104 + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 105 105 16 16 + LoopMerge 121 122 None + Branch 125 + 125: Label + 127: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 104 + 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 105 105 16 16 + 126: 107(int) Load 112(i) + 133: 130(bool) SLessThan 126 129 + BranchConditional 133 120 121 + 120: Label + 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 134 + 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 138 138 16 16 + 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 136 135(output) 90 + Store 135(output) 145 + 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 148 148 16 16 + 146: 107(int) Load 112(i) + 152: 150(ptr) AccessChain 79(input) 146 149 + 153: 21(fvec3) Load 152 + 186: 11(int) Load 81(InvocationID) + 189: 187(ptr) AccessChain 182 118 149 186 + 190: 154 Load 189 + 193: 18(fvec4) CompositeExtract 190 0 + 194: 21(fvec3) VectorShuffle 193 193 0 1 2 + 195: 18(fvec4) CompositeExtract 190 1 + 196: 21(fvec3) VectorShuffle 195 195 0 1 2 + 197: 18(fvec4) CompositeExtract 190 2 + 198: 21(fvec3) VectorShuffle 197 197 0 1 2 + 199: 191 CompositeConstruct 194 196 198 + 200: 21(fvec3) VectorTimesMatrix 153 199 + 201: 150(ptr) AccessChain 135(output) 129 + Store 201 200 + 204: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 205 205 16 16 + 203: 107(int) Load 112(i) + 207: 150(ptr) AccessChain 79(input) 203 206 + 208: 21(fvec3) Load 207 + 209: 150(ptr) AccessChain 135(output) 202 + Store 209 208 + 217: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 215 215 16 16 + 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 213 212(pos) 90 + 218: 107(int) Load 112(i) + 219: 210(ptr) AccessChain 79(input) 218 118 + 220: 18(fvec4) Load 219 + Store 212(pos) 220 + 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 224 224 16 16 + 225: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 222 221(worldPos) 90 + 227: 18(fvec4) Load 212(pos) + 228: 11(int) Load 81(InvocationID) + 229: 187(ptr) AccessChain 182 118 149 228 + 230: 154 Load 229 + 231: 18(fvec4) VectorTimesMatrix 227 230 + Store 221(worldPos) 231 + 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 235 235 16 16 + 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 233 232(lPos) 90 + 240: 238(ptr) AccessChain 182 118 206 + 241: 18(fvec4) Load 240 + 242: 11(int) Load 81(InvocationID) + 243: 187(ptr) AccessChain 182 118 149 242 + 244: 154 Load 243 + 245: 18(fvec4) VectorTimesMatrix 241 244 + 246: 21(fvec3) VectorShuffle 245 245 0 1 2 + Store 232(lPos) 246 + 249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 250 250 16 16 + 248: 21(fvec3) Load 232(lPos) + 251: 18(fvec4) Load 221(worldPos) + 252: 21(fvec3) VectorShuffle 251 251 0 1 2 + 253: 21(fvec3) FSub 248 252 + 254: 150(ptr) AccessChain 135(output) 247 + Store 254 253 + 257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 258 258 16 16 + 256: 18(fvec4) Load 221(worldPos) + 259: 21(fvec3) VectorShuffle 256 256 0 1 2 + 260: 21(fvec3) FNegate 259 + 261: 150(ptr) AccessChain 135(output) 255 + Store 261 260 + 263: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 264 264 16 16 + 262: 18(fvec4) Load 221(worldPos) + 265: 11(int) Load 81(InvocationID) + 266: 187(ptr) AccessChain 182 118 118 265 + 267: 154 Load 266 + 268: 18(fvec4) VectorTimesMatrix 262 267 + 269: 210(ptr) AccessChain 135(output) 118 + Store 269 268 + 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 272 272 16 16 + 270: 11(int) Load 81(InvocationID) + 273: 75(ptr) AccessChain 135(output) 149 + Store 273 270 + 275: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 276 276 16 16 + 274: 11(int) Load 82(PrimitiveID) + 277: 75(ptr) AccessChain 135(output) 206 + Store 277 274 + 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 283 283 16 16 + 284: 210(ptr) AccessChain 135(output) 118 + 286: 18(fvec4) Load 284 + Store 280(outStream.Pos) 286 + 292: 75(ptr) AccessChain 135(output) 149 + 293: 11(int) Load 292 + Store 289(outStream.ViewportIndex) 293 + 297: 75(ptr) AccessChain 135(output) 206 + 298: 11(int) Load 297 + Store 294(outStream.PrimitiveID) 298 + 304: 150(ptr) AccessChain 135(output) 129 305: 21(fvec3) Load 304 - Store 301(outStream.ViewVec) 305 - 309: 139(ptr) AccessChain 124(output) 237 + Store 301(outStream.Normal) 305 + 309: 150(ptr) AccessChain 135(output) 202 310: 21(fvec3) Load 309 - Store 306(outStream.LightVec) 310 + Store 306(outStream.Color) 310 + 314: 150(ptr) AccessChain 135(output) 255 + 315: 21(fvec3) Load 314 + Store 311(outStream.ViewVec) 315 + 319: 150(ptr) AccessChain 135(output) 247 + 320: 21(fvec3) Load 319 + Store 316(outStream.LightVec) 320 EmitVertex - Branch 111 - 111: Label - 312: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 93 - 313: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 94 94 16 16 - 311: 96(int) Load 101(i) - 314: 96(int) IAdd 311 138 - Store 101(i) 314 - Branch 108 - 110: Label - 315: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 92 - 316: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 317 317 16 16 + Branch 122 + 122: Label + 322: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 104 + 323: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 105 105 16 16 + 321: 107(int) Load 112(i) + 324: 107(int) IAdd 321 149 + Store 112(i) 324 + Branch 119 + 121: Label + 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 103 + 326: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 26 327 327 16 16 EndPrimitive - 318: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 75 + 328: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 86 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.tesc.out b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.tesc.out index 494878cd1c..285aeb0a61 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.tesc.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.tesc.out @@ -3,14 +3,14 @@ WARNING: spv.debuginfo.hlsl.tesc:158: '' : attribute does not apply to entry poi // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 724 +// Id's are bound by 731 Capability Tessellation Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationControl 6 "main" 616 623 630 664 673 680 687 702 717 + EntryPoint TessellationControl 6 "main" 623 630 637 671 680 687 694 709 724 ExecutionMode 6 OutputVertices 4 ExecutionMode 6 Quads ExecutionMode 6 SpacingEqual @@ -212,28 +212,31 @@ HSOutput main(InputPatch patch, uint InvocationID : SV_OutputContro 150: String "midPoint" 164: String "radius" 175: String "v0" - 187: String "modelview" - 192: String "lightPos" - 196: String "frustumPlanes" - 199: String "tessellatedEdgeSize" - 203: String "viewportDim" - 207: String "UBO" - 210: String "ubo" - 217: String "" - 220: String "int" - 231: String "clip0" - 249: String "clip1" - 328: String "pos" - 336: String "type.2d.image" - 338: String "@type.2d.image" - 344: String "textureHeight" - 349: String "type.sampler" - 350: String "@type.sampler" - 355: String "samplerHeight" - 359: String "type.sampled.image" - 360: String "@type.sampled.image" - 380: String "i" - 435: String "output" + 187: String "projection" + 191: String "modelview" + 195: String "lightPos" + 199: String "frustumPlanes" + 202: String "displacementFactor" + 205: String "tessellationFactor" + 208: String "viewportDim" + 211: String "tessellatedEdgeSize" + 214: String "UBO" + 217: String "ubo" + 224: String "" + 227: String "int" + 238: String "clip0" + 256: String "clip1" + 335: String "pos" + 343: String "type.2d.image" + 345: String "@type.2d.image" + 351: String "textureHeight" + 356: String "type.sampler" + 357: String "@type.sampler" + 362: String "samplerHeight" + 366: String "type.sampled.image" + 367: String "@type.sampled.image" + 387: String "i" + 442: String "output" Name 6 "main" Name 28 "screenSpaceTessFactor(vf4;vf4;" Name 26 "p0" @@ -269,43 +272,43 @@ HSOutput main(InputPatch patch, uint InvocationID : SV_OutputContro MemberName 185(UBO) 5 "tessellationFactor" MemberName 185(UBO) 6 "viewportDim" MemberName 185(UBO) 7 "tessellatedEdgeSize" - Name 208 "ubo" - MemberName 208(ubo) 0 "ubo" - Name 215 "" - Name 229 "clip0" - Name 247 "clip1" - Name 326 "pos" - Name 342 "textureHeight" - Name 353 "samplerHeight" - Name 378 "i" - Name 433 "output" - Name 444 "param" - Name 449 "param" - Name 487 "param" - Name 493 "param" - Name 498 "param" - Name 503 "param" - Name 508 "param" - Name 513 "param" - Name 518 "param" - Name 523 "param" - Name 577 "output" - Name 613 "patch" - Name 616 "patch.Pos" - Name 623 "patch.Normal" - Name 630 "patch.UV" - Name 662 "InvocationID" - Name 664 "InvocationID" - Name 666 "flattenTemp" - Name 667 "param" - Name 669 "param" - Name 673 "@entryPointOutput.Pos" - Name 680 "@entryPointOutput.Normal" - Name 687 "@entryPointOutput.UV" - Name 697 "@patchConstantResult" - Name 698 "param" - Name 702 "@patchConstantOutput.TessLevelOuter" - Name 717 "@patchConstantOutput.TessLevelInner" + Name 215 "ubo" + MemberName 215(ubo) 0 "ubo" + Name 222 "" + Name 236 "clip0" + Name 254 "clip1" + Name 333 "pos" + Name 349 "textureHeight" + Name 360 "samplerHeight" + Name 385 "i" + Name 440 "output" + Name 451 "param" + Name 456 "param" + Name 494 "param" + Name 500 "param" + Name 505 "param" + Name 510 "param" + Name 515 "param" + Name 520 "param" + Name 525 "param" + Name 530 "param" + Name 584 "output" + Name 620 "patch" + Name 623 "patch.Pos" + Name 630 "patch.Normal" + Name 637 "patch.UV" + Name 669 "InvocationID" + Name 671 "InvocationID" + Name 673 "flattenTemp" + Name 674 "param" + Name 676 "param" + Name 680 "@entryPointOutput.Pos" + Name 687 "@entryPointOutput.Normal" + Name 694 "@entryPointOutput.UV" + Name 704 "@patchConstantResult" + Name 705 "param" + Name 709 "@patchConstantOutput.TessLevelOuter" + Name 724 "@patchConstantOutput.TessLevelInner" Decorate 183 ArrayStride 16 MemberDecorate 185(UBO) 0 RowMajor MemberDecorate 185(UBO) 0 MatrixStride 16 @@ -319,25 +322,25 @@ HSOutput main(InputPatch patch, uint InvocationID : SV_OutputContro MemberDecorate 185(UBO) 5 Offset 244 MemberDecorate 185(UBO) 6 Offset 248 MemberDecorate 185(UBO) 7 Offset 256 - Decorate 208(ubo) Block - MemberDecorate 208(ubo) 0 Offset 0 - Decorate 215 Binding 0 - Decorate 215 DescriptorSet 0 - Decorate 342(textureHeight) Binding 1 - Decorate 342(textureHeight) DescriptorSet 0 - Decorate 353(samplerHeight) Binding 1 - Decorate 353(samplerHeight) DescriptorSet 0 - Decorate 616(patch.Pos) BuiltIn Position - Decorate 623(patch.Normal) Location 0 - Decorate 630(patch.UV) Location 1 - Decorate 664(InvocationID) BuiltIn InvocationId - Decorate 673(@entryPointOutput.Pos) BuiltIn Position - Decorate 680(@entryPointOutput.Normal) Location 0 - Decorate 687(@entryPointOutput.UV) Location 1 - Decorate 702(@patchConstantOutput.TessLevelOuter) BuiltIn TessLevelOuter - Decorate 702(@patchConstantOutput.TessLevelOuter) Patch - Decorate 717(@patchConstantOutput.TessLevelInner) BuiltIn TessLevelInner - Decorate 717(@patchConstantOutput.TessLevelInner) Patch + Decorate 215(ubo) Block + MemberDecorate 215(ubo) 0 Offset 0 + Decorate 222 Binding 0 + Decorate 222 DescriptorSet 0 + Decorate 349(textureHeight) Binding 1 + Decorate 349(textureHeight) DescriptorSet 0 + Decorate 360(samplerHeight) Binding 1 + Decorate 360(samplerHeight) DescriptorSet 0 + Decorate 623(patch.Pos) BuiltIn Position + Decorate 630(patch.Normal) Location 0 + Decorate 637(patch.UV) Location 1 + Decorate 671(InvocationID) BuiltIn InvocationId + Decorate 680(@entryPointOutput.Pos) BuiltIn Position + Decorate 687(@entryPointOutput.Normal) Location 0 + Decorate 694(@entryPointOutput.UV) Location 1 + Decorate 709(@patchConstantOutput.TessLevelOuter) BuiltIn TessLevelOuter + Decorate 709(@patchConstantOutput.TessLevelOuter) Patch + Decorate 724(@patchConstantOutput.TessLevelInner) BuiltIn TessLevelInner + Decorate 724(@patchConstantOutput.TessLevelInner) Patch 4: TypeVoid 5: TypeFunction 4 8: TypeFloat 32 @@ -444,285 +447,289 @@ HSOutput main(InputPatch patch, uint InvocationID : SV_OutputContro 183: TypeArray 18(fvec4) 15 184: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 20 15 185(UBO): TypeStruct 180 180 18(fvec4) 183 8(float) 8(float) 48(fvec2) 8(float) - 188: 11(int) Constant 29 - 189: 11(int) Constant 20 + 188: 11(int) Constant 28 + 189: 11(int) Constant 21 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 187 181 32 188 189 16 16 17 - 190: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 187 181 32 188 189 16 16 17 - 193: 11(int) Constant 30 - 194: 11(int) Constant 17 - 191: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 192 20 32 193 194 16 16 17 - 197: 11(int) Constant 22 - 195: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 196 184 32 85 197 16 16 17 - 200: 11(int) Constant 27 - 198: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 199 10 32 81 200 16 16 17 - 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 199 10 32 81 200 16 16 17 - 204: 11(int) Constant 34 - 202: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 203 49 32 204 189 16 16 17 - 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 199 10 32 81 200 16 16 17 - 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 207 36 32 176 16 35 207 16 17 186 190 191 195 198 201 202 205 - 208(ubo): TypeStruct 185(UBO) - 211: 11(int) Constant 37 - 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 210 206 32 211 211 16 16 17 - 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 210 36 32 176 16 35 210 16 17 209 - 213: TypePointer Uniform 208(ubo) - 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 212 46 16 - 215: 213(ptr) Variable Uniform - 218: 11(int) Constant 8 - 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 217 212 32 176 16 35 217 215 218 - 219: TypeInt 32 1 - 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 220 14 19 16 - 222: 219(int) Constant 0 - 223: 219(int) Constant 1 - 224: TypePointer Uniform 180 - 225: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 181 46 16 - 232: 11(int) Constant 75 - 230: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 231 20 32 232 16 147 19 - 237: 8(float) Constant 0 - 238: 72(fvec3) ConstantComposite 237 237 237 - 250: 11(int) Constant 76 - 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 249 20 32 250 16 147 19 - 265: 11(int) Constant 79 - 272: 11(int) Constant 80 - 277: 219(int) Constant 6 - 278: TypePointer Uniform 48(fvec2) - 279: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 49 46 16 - 282: 11(int) Constant 83 - 293: 11(int) Constant 84 - 304: 11(int) Constant 89 - 307: 219(int) Constant 7 - 308: TypePointer Uniform 8(float) - 309: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 46 16 - 313: 219(int) Constant 5 - 317: 8(float) Constant 1065353216 - 318: 8(float) Constant 1115684864 - 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 62 - 329: 11(int) Constant 98 - 327: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 328 20 32 329 16 325 19 - 334: TypeImage 8(float) 2D sampled format:Unknown - 337: 11(int) Constant 99 - 339: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) - 335: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 336 16 32 337 16 35 338 339 17 - 340: TypePointer UniformConstant 334 - 341: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 335 16 16 -342(textureHeight): 340(ptr) Variable UniformConstant - 343: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 344 335 32 337 16 35 344 342(textureHeight) 218 - 347: TypeSampler - 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 349 36 32 337 16 35 350 339 17 - 351: TypePointer UniformConstant 347 - 352: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 348 16 16 -353(samplerHeight): 351(ptr) Variable UniformConstant - 354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 355 348 32 337 16 35 355 353(samplerHeight) 218 - 357: TypeSampledImage 334 - 358: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 359 16 32 337 16 35 360 339 17 - 365: 219(int) Constant 4 - 374: 11(int) Constant 102 - 375: 11(int) Constant 11 - 373: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 374 375 325 - 376: TypePointer Function 219(int) - 377: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 221 22 16 - 379: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 380 221 32 374 16 373 19 - 395: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 373 - 399: 11(int) Constant 103 - 400: 219(int) Constant 3 - 402: TypePointer Uniform 18(fvec4) - 403: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 46 16 - 407: 8(float) Constant 1090519040 - 412: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 395 - 413: 52(bool) ConstantFalse - 416: 11(int) Constant 105 - 424: 11(int) Constant 108 - 430: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 113 - 431: TypePointer Function 97(ConstantsHSOutput) - 432: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 105 22 16 - 436: 11(int) Constant 113 - 434: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 435 105 32 436 16 430 19 - 440: 93 ConstantComposite 237 237 237 237 - 441: 95 ConstantComposite 237 237 - 442:97(ConstantsHSOutput) ConstantComposite 440 441 - 443: 219(int) Constant 2 - 447: 11(int) Constant 115 - 456: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 430 - 460: 11(int) Constant 117 - 463: 11(int) Constant 118 - 466: 11(int) Constant 119 - 469: 11(int) Constant 120 - 472: 11(int) Constant 121 - 475: 11(int) Constant 122 - 477: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 430 - 481: 11(int) Constant 126 - 486: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 477 - 491: 11(int) Constant 128 - 501: 11(int) Constant 129 - 511: 11(int) Constant 130 - 521: 11(int) Constant 131 - 530: 11(int) Constant 132 - 538: 11(int) Constant 133 - 545: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 477 - 549: 11(int) Constant 139 - 552: 11(int) Constant 140 - 555: 11(int) Constant 141 - 558: 11(int) Constant 142 - 561: 11(int) Constant 143 - 564: 11(int) Constant 144 - 568: 11(int) Constant 148 - 574: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 138 - 575: TypePointer Function 121(HSOutput) - 576: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 128 22 16 - 579: 11(int) Constant 159 - 578: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 435 128 32 579 16 574 19 - 583: 18(fvec4) ConstantComposite 237 237 237 237 - 584: 48(fvec2) ConstantComposite 237 237 - 585:121(HSOutput) ConstantComposite 583 238 584 - 588: 11(int) Constant 160 - 594: 11(int) Constant 161 - 595: TypePointer Function 72(fvec3) - 596: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 73 22 16 - 602: 11(int) Constant 162 - 608: 11(int) Constant 163 - 614: TypeArray 18(fvec4) 19 - 615: TypePointer Input 614 - 616(patch.Pos): 615(ptr) Variable Input - 617: TypePointer Input 18(fvec4) - 621: TypeArray 72(fvec3) 19 + 192: 11(int) Constant 29 + 193: 11(int) Constant 20 + 190: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 191 181 32 192 193 16 16 17 + 196: 11(int) Constant 30 + 197: 11(int) Constant 17 + 194: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 195 20 32 196 197 16 16 17 + 200: 11(int) Constant 22 + 198: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 199 184 32 85 200 16 16 17 + 203: 11(int) Constant 26 + 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 202 10 32 14 203 16 16 17 + 206: 11(int) Constant 33 + 204: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 205 10 32 206 203 16 16 17 + 209: 11(int) Constant 34 + 207: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 208 49 32 209 193 16 16 17 + 212: 11(int) Constant 27 + 210: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 211 10 32 81 212 16 16 17 + 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 214 36 32 176 16 35 214 16 17 186 190 194 198 201 204 207 210 + 215(ubo): TypeStruct 185(UBO) + 218: 11(int) Constant 37 + 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 217 213 32 218 218 16 16 17 + 219: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 217 36 32 176 16 35 217 16 17 216 + 220: TypePointer Uniform 215(ubo) + 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 219 46 16 + 222: 220(ptr) Variable Uniform + 225: 11(int) Constant 8 + 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 224 219 32 176 16 35 224 222 225 + 226: TypeInt 32 1 + 228: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 227 14 19 16 + 229: 226(int) Constant 0 + 230: 226(int) Constant 1 + 231: TypePointer Uniform 180 + 232: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 181 46 16 + 239: 11(int) Constant 75 + 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 238 20 32 239 16 147 19 + 244: 8(float) Constant 0 + 245: 72(fvec3) ConstantComposite 244 244 244 + 257: 11(int) Constant 76 + 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 256 20 32 257 16 147 19 + 272: 11(int) Constant 79 + 279: 11(int) Constant 80 + 284: 226(int) Constant 6 + 285: TypePointer Uniform 48(fvec2) + 286: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 49 46 16 + 289: 11(int) Constant 83 + 300: 11(int) Constant 84 + 311: 11(int) Constant 89 + 314: 226(int) Constant 7 + 315: TypePointer Uniform 8(float) + 316: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 46 16 + 320: 226(int) Constant 5 + 324: 8(float) Constant 1065353216 + 325: 8(float) Constant 1115684864 + 332: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 62 + 336: 11(int) Constant 98 + 334: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 335 20 32 336 16 332 19 + 341: TypeImage 8(float) 2D sampled format:Unknown + 344: 11(int) Constant 99 + 346: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) + 342: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 343 36 32 344 16 35 345 346 17 + 347: TypePointer UniformConstant 341 + 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 342 16 16 +349(textureHeight): 347(ptr) Variable UniformConstant + 350: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 351 342 32 344 16 35 351 349(textureHeight) 225 + 354: TypeSampler + 355: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 356 36 32 344 16 35 357 346 17 + 358: TypePointer UniformConstant 354 + 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 355 16 16 +360(samplerHeight): 358(ptr) Variable UniformConstant + 361: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 362 355 32 344 16 35 362 360(samplerHeight) 225 + 364: TypeSampledImage 341 + 365: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 366 36 32 344 16 35 367 346 17 + 372: 226(int) Constant 4 + 381: 11(int) Constant 102 + 382: 11(int) Constant 11 + 380: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 381 382 332 + 383: TypePointer Function 226(int) + 384: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 228 22 16 + 386: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 387 228 32 381 16 380 19 + 402: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 380 + 406: 11(int) Constant 103 + 407: 226(int) Constant 3 + 409: TypePointer Uniform 18(fvec4) + 410: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 20 46 16 + 414: 8(float) Constant 1090519040 + 419: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 402 + 420: 52(bool) ConstantFalse + 423: 11(int) Constant 105 + 431: 11(int) Constant 108 + 437: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 113 + 438: TypePointer Function 97(ConstantsHSOutput) + 439: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 105 22 16 + 443: 11(int) Constant 113 + 441: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 442 105 32 443 16 437 19 + 447: 93 ConstantComposite 244 244 244 244 + 448: 95 ConstantComposite 244 244 + 449:97(ConstantsHSOutput) ConstantComposite 447 448 + 450: 226(int) Constant 2 + 454: 11(int) Constant 115 + 463: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 437 + 467: 11(int) Constant 117 + 470: 11(int) Constant 118 + 473: 11(int) Constant 119 + 476: 11(int) Constant 120 + 479: 11(int) Constant 121 + 482: 11(int) Constant 122 + 484: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 437 + 488: 11(int) Constant 126 + 493: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 484 + 498: 11(int) Constant 128 + 508: 11(int) Constant 129 + 518: 11(int) Constant 130 + 528: 11(int) Constant 131 + 537: 11(int) Constant 132 + 545: 11(int) Constant 133 + 552: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 484 + 556: 11(int) Constant 139 + 559: 11(int) Constant 140 + 562: 11(int) Constant 141 + 565: 11(int) Constant 142 + 568: 11(int) Constant 143 + 571: 11(int) Constant 144 + 575: 11(int) Constant 148 + 581: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 32 16 16 138 + 582: TypePointer Function 121(HSOutput) + 583: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 128 22 16 + 586: 11(int) Constant 159 + 585: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 442 128 32 586 16 581 19 + 590: 18(fvec4) ConstantComposite 244 244 244 244 + 591: 48(fvec2) ConstantComposite 244 244 + 592:121(HSOutput) ConstantComposite 590 245 591 + 595: 11(int) Constant 160 + 601: 11(int) Constant 161 + 602: TypePointer Function 72(fvec3) + 603: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 73 22 16 + 609: 11(int) Constant 162 + 615: 11(int) Constant 163 + 621: TypeArray 18(fvec4) 19 622: TypePointer Input 621 -623(patch.Normal): 622(ptr) Variable Input - 624: TypePointer Input 72(fvec3) - 628: TypeArray 48(fvec2) 19 + 623(patch.Pos): 622(ptr) Variable Input + 624: TypePointer Input 18(fvec4) + 628: TypeArray 72(fvec3) 19 629: TypePointer Input 628 - 630(patch.UV): 629(ptr) Variable Input - 631: TypePointer Input 48(fvec2) - 663: TypePointer Input 11(int) -664(InvocationID): 663(ptr) Variable Input - 672: TypePointer Output 614 -673(@entryPointOutput.Pos): 672(ptr) Variable Output - 677: TypePointer Output 18(fvec4) +630(patch.Normal): 629(ptr) Variable Input + 631: TypePointer Input 72(fvec3) + 635: TypeArray 48(fvec2) 19 + 636: TypePointer Input 635 + 637(patch.UV): 636(ptr) Variable Input + 638: TypePointer Input 48(fvec2) + 670: TypePointer Input 11(int) +671(InvocationID): 670(ptr) Variable Input 679: TypePointer Output 621 -680(@entryPointOutput.Normal): 679(ptr) Variable Output - 684: TypePointer Output 72(fvec3) +680(@entryPointOutput.Pos): 679(ptr) Variable Output + 684: TypePointer Output 18(fvec4) 686: TypePointer Output 628 -687(@entryPointOutput.UV): 686(ptr) Variable Output - 691: TypePointer Output 48(fvec2) - 701: TypePointer Output 93 -702(@patchConstantOutput.TessLevelOuter): 701(ptr) Variable Output - 705: TypePointer Output 8(float) - 716: TypePointer Output 95 -717(@patchConstantOutput.TessLevelInner): 716(ptr) Variable Output +687(@entryPointOutput.Normal): 686(ptr) Variable Output + 691: TypePointer Output 72(fvec3) + 693: TypePointer Output 635 +694(@entryPointOutput.UV): 693(ptr) Variable Output + 698: TypePointer Output 48(fvec2) + 708: TypePointer Output 93 +709(@patchConstantOutput.TessLevelOuter): 708(ptr) Variable Output + 712: TypePointer Output 8(float) + 723: TypePointer Output 95 +724(@patchConstantOutput.TessLevelInner): 723(ptr) Variable Output 6(main): 4 Function None 5 7: Label - 613(patch): 91(ptr) Variable Function -662(InvocationID): 119(ptr) Variable Function -666(flattenTemp): 575(ptr) Variable Function - 667(param): 91(ptr) Variable Function - 669(param): 119(ptr) Variable Function -697(@patchConstantResult): 431(ptr) Variable Function - 698(param): 91(ptr) Variable Function - 618: 617(ptr) AccessChain 616(patch.Pos) 222 - 619: 18(fvec4) Load 618 - 620: 21(ptr) AccessChain 613(patch) 222 222 - Store 620 619 - 625: 624(ptr) AccessChain 623(patch.Normal) 222 - 626: 72(fvec3) Load 625 - 627: 595(ptr) AccessChain 613(patch) 222 223 + 620(patch): 91(ptr) Variable Function +669(InvocationID): 119(ptr) Variable Function +673(flattenTemp): 582(ptr) Variable Function + 674(param): 91(ptr) Variable Function + 676(param): 119(ptr) Variable Function +704(@patchConstantResult): 438(ptr) Variable Function + 705(param): 91(ptr) Variable Function + 625: 624(ptr) AccessChain 623(patch.Pos) 229 + 626: 18(fvec4) Load 625 + 627: 21(ptr) AccessChain 620(patch) 229 229 Store 627 626 - 632: 631(ptr) AccessChain 630(patch.UV) 222 - 633: 48(fvec2) Load 632 - 634: 50(ptr) AccessChain 613(patch) 222 443 + 632: 631(ptr) AccessChain 630(patch.Normal) 229 + 633: 72(fvec3) Load 632 + 634: 602(ptr) AccessChain 620(patch) 229 230 Store 634 633 - 635: 617(ptr) AccessChain 616(patch.Pos) 223 - 636: 18(fvec4) Load 635 - 637: 21(ptr) AccessChain 613(patch) 223 222 - Store 637 636 - 638: 624(ptr) AccessChain 623(patch.Normal) 223 - 639: 72(fvec3) Load 638 - 640: 595(ptr) AccessChain 613(patch) 223 223 - Store 640 639 - 641: 631(ptr) AccessChain 630(patch.UV) 223 - 642: 48(fvec2) Load 641 - 643: 50(ptr) AccessChain 613(patch) 223 443 - Store 643 642 - 644: 617(ptr) AccessChain 616(patch.Pos) 443 - 645: 18(fvec4) Load 644 - 646: 21(ptr) AccessChain 613(patch) 443 222 - Store 646 645 - 647: 624(ptr) AccessChain 623(patch.Normal) 443 - 648: 72(fvec3) Load 647 - 649: 595(ptr) AccessChain 613(patch) 443 223 - Store 649 648 - 650: 631(ptr) AccessChain 630(patch.UV) 443 - 651: 48(fvec2) Load 650 - 652: 50(ptr) AccessChain 613(patch) 443 443 - Store 652 651 - 653: 617(ptr) AccessChain 616(patch.Pos) 400 - 654: 18(fvec4) Load 653 - 655: 21(ptr) AccessChain 613(patch) 400 222 - Store 655 654 - 656: 624(ptr) AccessChain 623(patch.Normal) 400 - 657: 72(fvec3) Load 656 - 658: 595(ptr) AccessChain 613(patch) 400 223 - Store 658 657 - 659: 631(ptr) AccessChain 630(patch.UV) 400 - 660: 48(fvec2) Load 659 - 661: 50(ptr) AccessChain 613(patch) 400 443 - Store 661 660 - 665: 11(int) Load 664(InvocationID) - Store 662(InvocationID) 665 - 668: 89 Load 613(patch) - Store 667(param) 668 - 670: 11(int) Load 662(InvocationID) - Store 669(param) 670 - 671:121(HSOutput) FunctionCall 135(@main(struct-VSOutput-vf4-vf3-vf21[4];u1;) 667(param) 669(param) - Store 666(flattenTemp) 671 - 674: 11(int) Load 664(InvocationID) - 675: 21(ptr) AccessChain 666(flattenTemp) 222 - 676: 18(fvec4) Load 675 - 678: 677(ptr) AccessChain 673(@entryPointOutput.Pos) 674 - Store 678 676 - 681: 11(int) Load 664(InvocationID) - 682: 595(ptr) AccessChain 666(flattenTemp) 223 - 683: 72(fvec3) Load 682 - 685: 684(ptr) AccessChain 680(@entryPointOutput.Normal) 681 + 639: 638(ptr) AccessChain 637(patch.UV) 229 + 640: 48(fvec2) Load 639 + 641: 50(ptr) AccessChain 620(patch) 229 450 + Store 641 640 + 642: 624(ptr) AccessChain 623(patch.Pos) 230 + 643: 18(fvec4) Load 642 + 644: 21(ptr) AccessChain 620(patch) 230 229 + Store 644 643 + 645: 631(ptr) AccessChain 630(patch.Normal) 230 + 646: 72(fvec3) Load 645 + 647: 602(ptr) AccessChain 620(patch) 230 230 + Store 647 646 + 648: 638(ptr) AccessChain 637(patch.UV) 230 + 649: 48(fvec2) Load 648 + 650: 50(ptr) AccessChain 620(patch) 230 450 + Store 650 649 + 651: 624(ptr) AccessChain 623(patch.Pos) 450 + 652: 18(fvec4) Load 651 + 653: 21(ptr) AccessChain 620(patch) 450 229 + Store 653 652 + 654: 631(ptr) AccessChain 630(patch.Normal) 450 + 655: 72(fvec3) Load 654 + 656: 602(ptr) AccessChain 620(patch) 450 230 + Store 656 655 + 657: 638(ptr) AccessChain 637(patch.UV) 450 + 658: 48(fvec2) Load 657 + 659: 50(ptr) AccessChain 620(patch) 450 450 + Store 659 658 + 660: 624(ptr) AccessChain 623(patch.Pos) 407 + 661: 18(fvec4) Load 660 + 662: 21(ptr) AccessChain 620(patch) 407 229 + Store 662 661 + 663: 631(ptr) AccessChain 630(patch.Normal) 407 + 664: 72(fvec3) Load 663 + 665: 602(ptr) AccessChain 620(patch) 407 230 + Store 665 664 + 666: 638(ptr) AccessChain 637(patch.UV) 407 + 667: 48(fvec2) Load 666 + 668: 50(ptr) AccessChain 620(patch) 407 450 + Store 668 667 + 672: 11(int) Load 671(InvocationID) + Store 669(InvocationID) 672 + 675: 89 Load 620(patch) + Store 674(param) 675 + 677: 11(int) Load 669(InvocationID) + Store 676(param) 677 + 678:121(HSOutput) FunctionCall 135(@main(struct-VSOutput-vf4-vf3-vf21[4];u1;) 674(param) 676(param) + Store 673(flattenTemp) 678 + 681: 11(int) Load 671(InvocationID) + 682: 21(ptr) AccessChain 673(flattenTemp) 229 + 683: 18(fvec4) Load 682 + 685: 684(ptr) AccessChain 680(@entryPointOutput.Pos) 681 Store 685 683 - 688: 11(int) Load 664(InvocationID) - 689: 50(ptr) AccessChain 666(flattenTemp) 443 - 690: 48(fvec2) Load 689 - 692: 691(ptr) AccessChain 687(@entryPointOutput.UV) 688 + 688: 11(int) Load 671(InvocationID) + 689: 602(ptr) AccessChain 673(flattenTemp) 230 + 690: 72(fvec3) Load 689 + 692: 691(ptr) AccessChain 687(@entryPointOutput.Normal) 688 Store 692 690 + 695: 11(int) Load 671(InvocationID) + 696: 50(ptr) AccessChain 673(flattenTemp) 450 + 697: 48(fvec2) Load 696 + 699: 698(ptr) AccessChain 694(@entryPointOutput.UV) 695 + Store 699 697 ControlBarrier 46 19 16 - 693: 11(int) Load 664(InvocationID) - 694: 52(bool) IEqual 693 222 - SelectionMerge 696 None - BranchConditional 694 695 696 - 695: Label - 699: 89 Load 613(patch) - Store 698(param) 699 - 700:97(ConstantsHSOutput) FunctionCall 110(ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];) 698(param) - Store 697(@patchConstantResult) 700 - 703: 160(ptr) AccessChain 697(@patchConstantResult) 222 222 - 704: 8(float) Load 703 - 706: 705(ptr) AccessChain 702(@patchConstantOutput.TessLevelOuter) 222 - Store 706 704 - 707: 160(ptr) AccessChain 697(@patchConstantResult) 222 223 - 708: 8(float) Load 707 - 709: 705(ptr) AccessChain 702(@patchConstantOutput.TessLevelOuter) 223 - Store 709 708 - 710: 160(ptr) AccessChain 697(@patchConstantResult) 222 443 + 700: 11(int) Load 671(InvocationID) + 701: 52(bool) IEqual 700 229 + SelectionMerge 703 None + BranchConditional 701 702 703 + 702: Label + 706: 89 Load 620(patch) + Store 705(param) 706 + 707:97(ConstantsHSOutput) FunctionCall 110(ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];) 705(param) + Store 704(@patchConstantResult) 707 + 710: 160(ptr) AccessChain 704(@patchConstantResult) 229 229 711: 8(float) Load 710 - 712: 705(ptr) AccessChain 702(@patchConstantOutput.TessLevelOuter) 443 - Store 712 711 - 713: 160(ptr) AccessChain 697(@patchConstantResult) 222 400 - 714: 8(float) Load 713 - 715: 705(ptr) AccessChain 702(@patchConstantOutput.TessLevelOuter) 400 - Store 715 714 - 718: 160(ptr) AccessChain 697(@patchConstantResult) 223 222 - 719: 8(float) Load 718 - 720: 705(ptr) AccessChain 717(@patchConstantOutput.TessLevelInner) 222 - Store 720 719 - 721: 160(ptr) AccessChain 697(@patchConstantResult) 223 223 - 722: 8(float) Load 721 - 723: 705(ptr) AccessChain 717(@patchConstantOutput.TessLevelInner) 223 - Store 723 722 - Branch 696 - 696: Label + 713: 712(ptr) AccessChain 709(@patchConstantOutput.TessLevelOuter) 229 + Store 713 711 + 714: 160(ptr) AccessChain 704(@patchConstantResult) 229 230 + 715: 8(float) Load 714 + 716: 712(ptr) AccessChain 709(@patchConstantOutput.TessLevelOuter) 230 + Store 716 715 + 717: 160(ptr) AccessChain 704(@patchConstantResult) 229 450 + 718: 8(float) Load 717 + 719: 712(ptr) AccessChain 709(@patchConstantOutput.TessLevelOuter) 450 + Store 719 718 + 720: 160(ptr) AccessChain 704(@patchConstantResult) 229 407 + 721: 8(float) Load 720 + 722: 712(ptr) AccessChain 709(@patchConstantOutput.TessLevelOuter) 407 + Store 722 721 + 725: 160(ptr) AccessChain 704(@patchConstantResult) 230 229 + 726: 8(float) Load 725 + 727: 712(ptr) AccessChain 724(@patchConstantOutput.TessLevelInner) 229 + Store 727 726 + 728: 160(ptr) AccessChain 704(@patchConstantResult) 230 230 + 729: 8(float) Load 728 + 730: 712(ptr) AccessChain 724(@patchConstantOutput.TessLevelInner) 230 + Store 730 729 + Branch 703 + 703: Label Return FunctionEnd 28(screenSpaceTessFactor(vf4;vf4;): 8(float) Function None 24 @@ -732,8 +739,8 @@ HSOutput main(InputPatch patch, uint InvocationID : SV_OutputContro 148(midPoint): 21(ptr) Variable Function 162(radius): 160(ptr) Variable Function 173(v0): 21(ptr) Variable Function - 229(clip0): 21(ptr) Variable Function - 247(clip1): 21(ptr) Variable Function + 236(clip0): 21(ptr) Variable Function + 254(clip1): 21(ptr) Variable Function 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 31 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 34 34 16 16 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 38 26(p0) 41 @@ -757,347 +764,347 @@ HSOutput main(InputPatch patch, uint InvocationID : SV_OutputContro 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 176 176 16 16 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 174 173(v0) 41 179: 18(fvec4) Load 148(midPoint) - 226: 224(ptr) AccessChain 215 222 223 - 227: 180 Load 226 - 228: 18(fvec4) VectorTimesMatrix 179 227 - Store 173(v0) 228 - 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 232 232 16 16 - 233: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 230 229(clip0) 41 - 235: 18(fvec4) Load 173(v0) - 236: 8(float) Load 162(radius) - 239: 8(float) CompositeExtract 238 0 - 240: 8(float) CompositeExtract 238 1 - 241: 8(float) CompositeExtract 238 2 - 242: 18(fvec4) CompositeConstruct 236 239 240 241 - 243: 18(fvec4) FSub 235 242 - 244: 224(ptr) AccessChain 215 222 222 - 245: 180 Load 244 - 246: 18(fvec4) VectorTimesMatrix 243 245 - Store 229(clip0) 246 - 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 250 250 16 16 - 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 248 247(clip1) 41 - 253: 18(fvec4) Load 173(v0) - 254: 8(float) Load 162(radius) - 255: 8(float) CompositeExtract 238 0 - 256: 8(float) CompositeExtract 238 1 - 257: 8(float) CompositeExtract 238 2 - 258: 18(fvec4) CompositeConstruct 254 255 256 257 - 259: 18(fvec4) FAdd 253 258 - 260: 224(ptr) AccessChain 215 222 222 - 261: 180 Load 260 - 262: 18(fvec4) VectorTimesMatrix 259 261 - Store 247(clip1) 262 - 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 265 265 16 16 - 263: 160(ptr) AccessChain 229(clip0) 17 - 266: 8(float) Load 263 - 267: 18(fvec4) Load 229(clip0) - 268: 18(fvec4) CompositeConstruct 266 266 266 266 - 269: 18(fvec4) FDiv 267 268 - Store 229(clip0) 269 + 233: 231(ptr) AccessChain 222 229 230 + 234: 180 Load 233 + 235: 18(fvec4) VectorTimesMatrix 179 234 + Store 173(v0) 235 + 241: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 239 239 16 16 + 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 237 236(clip0) 41 + 242: 18(fvec4) Load 173(v0) + 243: 8(float) Load 162(radius) + 246: 8(float) CompositeExtract 245 0 + 247: 8(float) CompositeExtract 245 1 + 248: 8(float) CompositeExtract 245 2 + 249: 18(fvec4) CompositeConstruct 243 246 247 248 + 250: 18(fvec4) FSub 242 249 + 251: 231(ptr) AccessChain 222 229 229 + 252: 180 Load 251 + 253: 18(fvec4) VectorTimesMatrix 250 252 + Store 236(clip0) 253 + 259: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 257 257 16 16 + 258: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 255 254(clip1) 41 + 260: 18(fvec4) Load 173(v0) + 261: 8(float) Load 162(radius) + 262: 8(float) CompositeExtract 245 0 + 263: 8(float) CompositeExtract 245 1 + 264: 8(float) CompositeExtract 245 2 + 265: 18(fvec4) CompositeConstruct 261 262 263 264 + 266: 18(fvec4) FAdd 260 265 + 267: 231(ptr) AccessChain 222 229 229 + 268: 180 Load 267 + 269: 18(fvec4) VectorTimesMatrix 266 268 + Store 254(clip1) 269 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 272 272 16 16 - 270: 160(ptr) AccessChain 247(clip1) 17 + 270: 160(ptr) AccessChain 236(clip0) 17 273: 8(float) Load 270 - 274: 18(fvec4) Load 247(clip1) + 274: 18(fvec4) Load 236(clip0) 275: 18(fvec4) CompositeConstruct 273 273 273 273 276: 18(fvec4) FDiv 274 275 - Store 247(clip1) 276 - 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 282 282 16 16 - 280: 278(ptr) AccessChain 215 222 277 - 283: 48(fvec2) Load 280 - 284: 18(fvec4) Load 229(clip0) - 285: 48(fvec2) VectorShuffle 284 284 0 1 - 286: 48(fvec2) FMul 285 283 - 287: 160(ptr) AccessChain 229(clip0) 16 - 288: 8(float) CompositeExtract 286 0 - Store 287 288 - 289: 160(ptr) AccessChain 229(clip0) 36 - 290: 8(float) CompositeExtract 286 1 - Store 289 290 - 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 293 293 16 16 - 291: 278(ptr) AccessChain 215 222 277 - 294: 48(fvec2) Load 291 - 295: 18(fvec4) Load 247(clip1) - 296: 48(fvec2) VectorShuffle 295 295 0 1 - 297: 48(fvec2) FMul 296 294 - 298: 160(ptr) AccessChain 247(clip1) 16 - 299: 8(float) CompositeExtract 297 0 - Store 298 299 - 300: 160(ptr) AccessChain 247(clip1) 36 - 301: 8(float) CompositeExtract 297 1 - Store 300 301 - 303: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 304 304 16 16 - 302: 18(fvec4) Load 229(clip0) - 305: 18(fvec4) Load 247(clip1) - 306: 8(float) ExtInst 3(GLSL.std.450) 67(Distance) 302 305 - 310: 308(ptr) AccessChain 215 222 307 - 311: 8(float) Load 310 - 312: 8(float) FDiv 306 311 - 314: 308(ptr) AccessChain 215 222 313 - 315: 8(float) Load 314 - 316: 8(float) FMul 312 315 - 319: 8(float) ExtInst 3(GLSL.std.450) 43(FClamp) 316 317 318 - ReturnValue 319 + Store 236(clip0) 276 + 278: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 279 279 16 16 + 277: 160(ptr) AccessChain 254(clip1) 17 + 280: 8(float) Load 277 + 281: 18(fvec4) Load 254(clip1) + 282: 18(fvec4) CompositeConstruct 280 280 280 280 + 283: 18(fvec4) FDiv 281 282 + Store 254(clip1) 283 + 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 289 289 16 16 + 287: 285(ptr) AccessChain 222 229 284 + 290: 48(fvec2) Load 287 + 291: 18(fvec4) Load 236(clip0) + 292: 48(fvec2) VectorShuffle 291 291 0 1 + 293: 48(fvec2) FMul 292 290 + 294: 160(ptr) AccessChain 236(clip0) 16 + 295: 8(float) CompositeExtract 293 0 + Store 294 295 + 296: 160(ptr) AccessChain 236(clip0) 36 + 297: 8(float) CompositeExtract 293 1 + Store 296 297 + 299: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 300 300 16 16 + 298: 285(ptr) AccessChain 222 229 284 + 301: 48(fvec2) Load 298 + 302: 18(fvec4) Load 254(clip1) + 303: 48(fvec2) VectorShuffle 302 302 0 1 + 304: 48(fvec2) FMul 303 301 + 305: 160(ptr) AccessChain 254(clip1) 16 + 306: 8(float) CompositeExtract 304 0 + Store 305 306 + 307: 160(ptr) AccessChain 254(clip1) 36 + 308: 8(float) CompositeExtract 304 1 + Store 307 308 + 310: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 311 311 16 16 + 309: 18(fvec4) Load 236(clip0) + 312: 18(fvec4) Load 254(clip1) + 313: 8(float) ExtInst 3(GLSL.std.450) 67(Distance) 309 312 + 317: 315(ptr) AccessChain 222 229 314 + 318: 8(float) Load 317 + 319: 8(float) FDiv 313 318 + 321: 315(ptr) AccessChain 222 229 320 + 322: 8(float) Load 321 + 323: 8(float) FMul 319 322 + 326: 8(float) ExtInst 3(GLSL.std.450) 43(FClamp) 323 324 325 + ReturnValue 326 FunctionEnd 59(frustumCheck(vf4;vf2;): 52(bool) Function None 55 57(Pos): 21(ptr) FunctionParameter 58(inUV): 50(ptr) FunctionParameter 60: Label - 326(pos): 21(ptr) Variable Function - 378(i): 376(ptr) Variable Function + 333(pos): 21(ptr) Variable Function + 385(i): 383(ptr) Variable Function 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 62 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 63 63 16 16 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 64 57(Pos) 41 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 69 58(inUV) 41 - 324: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 62 59(frustumCheck(vf4;vf2;) - 331: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 325 - 332: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 329 329 16 16 - 330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 327 326(pos) 41 - 333: 18(fvec4) Load 57(Pos) - Store 326(pos) 333 - 346: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 337 337 16 16 - 345: 334 Load 342(textureHeight) - 356: 347 Load 353(samplerHeight) - 361: 357 SampledImage 345 356 - 362: 48(fvec2) Load 58(inUV) - 363: 18(fvec4) ImageSampleExplicitLod 361 362 Lod 237 - 364: 8(float) CompositeExtract 363 0 - 366: 308(ptr) AccessChain 215 222 365 - 367: 8(float) Load 366 - 368: 8(float) FMul 364 367 - 369: 160(ptr) AccessChain 326(pos) 36 - 370: 8(float) Load 369 - 371: 8(float) FSub 370 368 - 372: 160(ptr) AccessChain 326(pos) 36 - Store 372 371 - 382: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 - 383: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 374 374 16 16 - 381: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 379 378(i) 41 - Store 378(i) 222 - Branch 384 - 384: Label - 388: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 - 389: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 374 374 16 16 - LoopMerge 386 387 None - Branch 390 - 390: Label - 392: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 - 393: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 374 374 16 16 - 391: 219(int) Load 378(i) - 394: 52(bool) SLessThan 391 277 - BranchConditional 394 385 386 - 385: Label - 397: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 395 - 398: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 399 399 16 16 - 396: 18(fvec4) Load 326(pos) - 401: 219(int) Load 378(i) - 404: 402(ptr) AccessChain 215 222 400 401 - 405: 18(fvec4) Load 404 - 406: 8(float) Dot 396 405 - 408: 8(float) FAdd 406 407 - 409: 52(bool) FOrdLessThan 408 237 - SelectionMerge 411 None - BranchConditional 409 410 411 - 410: Label - 414: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 412 - 415: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 416 416 16 16 - ReturnValue 413 - 411: Label - Branch 387 - 387: Label - 419: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 373 - 420: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 374 374 16 16 - 418: 219(int) Load 378(i) - 421: 219(int) IAdd 418 223 - Store 378(i) 421 - Branch 384 - 386: Label - 422: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 325 - 423: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 424 424 16 16 + 331: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 62 59(frustumCheck(vf4;vf2;) + 338: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 332 + 339: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 336 336 16 16 + 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 334 333(pos) 41 + 340: 18(fvec4) Load 57(Pos) + Store 333(pos) 340 + 353: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 344 344 16 16 + 352: 341 Load 349(textureHeight) + 363: 354 Load 360(samplerHeight) + 368: 364 SampledImage 352 363 + 369: 48(fvec2) Load 58(inUV) + 370: 18(fvec4) ImageSampleExplicitLod 368 369 Lod 244 + 371: 8(float) CompositeExtract 370 0 + 373: 315(ptr) AccessChain 222 229 372 + 374: 8(float) Load 373 + 375: 8(float) FMul 371 374 + 376: 160(ptr) AccessChain 333(pos) 36 + 377: 8(float) Load 376 + 378: 8(float) FSub 377 375 + 379: 160(ptr) AccessChain 333(pos) 36 + Store 379 378 + 389: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 380 + 390: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 381 381 16 16 + 388: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 386 385(i) 41 + Store 385(i) 229 + Branch 391 + 391: Label + 395: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 380 + 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 381 381 16 16 + LoopMerge 393 394 None + Branch 397 + 397: Label + 399: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 380 + 400: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 381 381 16 16 + 398: 226(int) Load 385(i) + 401: 52(bool) SLessThan 398 284 + BranchConditional 401 392 393 + 392: Label + 404: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 402 + 405: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 406 406 16 16 + 403: 18(fvec4) Load 333(pos) + 408: 226(int) Load 385(i) + 411: 409(ptr) AccessChain 222 229 407 408 + 412: 18(fvec4) Load 411 + 413: 8(float) Dot 403 412 + 415: 8(float) FAdd 413 414 + 416: 52(bool) FOrdLessThan 415 244 + SelectionMerge 418 None + BranchConditional 416 417 418 + 417: Label + 421: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 419 + 422: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 423 423 16 16 + ReturnValue 420 + 418: Label + Branch 394 + 394: Label + 426: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 380 + 427: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 381 381 16 16 + 425: 226(int) Load 385(i) + 428: 226(int) IAdd 425 230 + Store 385(i) 428 + Branch 391 + 393: Label + 429: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 332 + 430: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 431 431 16 16 ReturnValue 182 FunctionEnd 110(ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];):97(ConstantsHSOutput) Function None 107 109(patch): 91(ptr) FunctionParameter 111: Label - 433(output): 431(ptr) Variable Function - 444(param): 21(ptr) Variable Function - 449(param): 50(ptr) Variable Function - 487(param): 21(ptr) Variable Function - 493(param): 21(ptr) Variable Function - 498(param): 21(ptr) Variable Function - 503(param): 21(ptr) Variable Function - 508(param): 21(ptr) Variable Function - 513(param): 21(ptr) Variable Function - 518(param): 21(ptr) Variable Function - 523(param): 21(ptr) Variable Function + 440(output): 438(ptr) Variable Function + 451(param): 21(ptr) Variable Function + 456(param): 50(ptr) Variable Function + 494(param): 21(ptr) Variable Function + 500(param): 21(ptr) Variable Function + 505(param): 21(ptr) Variable Function + 510(param): 21(ptr) Variable Function + 515(param): 21(ptr) Variable Function + 520(param): 21(ptr) Variable Function + 525(param): 21(ptr) Variable Function + 530(param): 21(ptr) Variable Function 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 113 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 88 88 16 16 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 114 109(patch) 41 - 429: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 113 110(ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];) - 438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 430 - 439: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 436 436 16 16 - 437: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 434 433(output) 41 - Store 433(output) 442 - 446: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 447 447 16 16 - 445: 21(ptr) AccessChain 109(patch) 222 222 - 448: 18(fvec4) Load 445 - Store 444(param) 448 - 450: 50(ptr) AccessChain 109(patch) 222 443 - 451: 48(fvec2) Load 450 - Store 449(param) 451 - 452: 52(bool) FunctionCall 59(frustumCheck(vf4;vf2;) 444(param) 449(param) - 453: 52(bool) LogicalNot 452 - SelectionMerge 455 None - BranchConditional 453 454 476 - 454: Label - 458: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 456 - 459: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 460 460 16 16 - 457: 160(ptr) AccessChain 433(output) 223 222 - Store 457 237 - 462: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 463 463 16 16 - 461: 160(ptr) AccessChain 433(output) 223 223 - Store 461 237 - 465: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 466 466 16 16 - 464: 160(ptr) AccessChain 433(output) 222 222 - Store 464 237 - 468: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 469 469 16 16 - 467: 160(ptr) AccessChain 433(output) 222 223 - Store 467 237 - 471: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 472 472 16 16 - 470: 160(ptr) AccessChain 433(output) 222 443 - Store 470 237 - 474: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 475 475 16 16 - 473: 160(ptr) AccessChain 433(output) 222 400 - Store 473 237 - Branch 455 - 476: Label - 479: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 477 - 480: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 481 481 16 16 - 478: 308(ptr) AccessChain 215 222 313 - 482: 8(float) Load 478 - 483: 52(bool) FOrdGreaterThan 482 237 - SelectionMerge 485 None - BranchConditional 483 484 544 - 484: Label - 489: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 486 - 490: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 491 491 16 16 - 488: 21(ptr) AccessChain 109(patch) 400 222 - 492: 18(fvec4) Load 488 - Store 487(param) 492 - 494: 21(ptr) AccessChain 109(patch) 222 222 - 495: 18(fvec4) Load 494 - Store 493(param) 495 - 496: 8(float) FunctionCall 28(screenSpaceTessFactor(vf4;vf4;) 487(param) 493(param) - 497: 160(ptr) AccessChain 433(output) 222 222 - Store 497 496 - 500: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 501 501 16 16 - 499: 21(ptr) AccessChain 109(patch) 222 222 - 502: 18(fvec4) Load 499 - Store 498(param) 502 - 504: 21(ptr) AccessChain 109(patch) 223 222 - 505: 18(fvec4) Load 504 - Store 503(param) 505 - 506: 8(float) FunctionCall 28(screenSpaceTessFactor(vf4;vf4;) 498(param) 503(param) - 507: 160(ptr) AccessChain 433(output) 222 223 - Store 507 506 - 510: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 511 511 16 16 - 509: 21(ptr) AccessChain 109(patch) 223 222 - 512: 18(fvec4) Load 509 - Store 508(param) 512 - 514: 21(ptr) AccessChain 109(patch) 443 222 - 515: 18(fvec4) Load 514 - Store 513(param) 515 - 516: 8(float) FunctionCall 28(screenSpaceTessFactor(vf4;vf4;) 508(param) 513(param) - 517: 160(ptr) AccessChain 433(output) 222 443 - Store 517 516 - 520: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 521 521 16 16 - 519: 21(ptr) AccessChain 109(patch) 443 222 - 522: 18(fvec4) Load 519 - Store 518(param) 522 - 524: 21(ptr) AccessChain 109(patch) 400 222 - 525: 18(fvec4) Load 524 - Store 523(param) 525 - 526: 8(float) FunctionCall 28(screenSpaceTessFactor(vf4;vf4;) 518(param) 523(param) - 527: 160(ptr) AccessChain 433(output) 222 400 - Store 527 526 - 529: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 530 530 16 16 - 528: 160(ptr) AccessChain 433(output) 222 222 - 531: 8(float) Load 528 - 532: 160(ptr) AccessChain 433(output) 222 400 - 533: 8(float) Load 532 - 534: 8(float) ExtInst 3(GLSL.std.450) 46(FMix) 531 533 155 - 535: 160(ptr) AccessChain 433(output) 223 222 - Store 535 534 - 537: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 538 538 16 16 - 536: 160(ptr) AccessChain 433(output) 222 443 - 539: 8(float) Load 536 - 540: 160(ptr) AccessChain 433(output) 222 223 - 541: 8(float) Load 540 - 542: 8(float) ExtInst 3(GLSL.std.450) 46(FMix) 539 541 155 - 543: 160(ptr) AccessChain 433(output) 223 223 - Store 543 542 - Branch 485 - 544: Label - 547: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 545 - 548: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 549 549 16 16 - 546: 160(ptr) AccessChain 433(output) 223 222 - Store 546 317 - 551: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 552 552 16 16 - 550: 160(ptr) AccessChain 433(output) 223 223 - Store 550 317 - 554: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 555 555 16 16 - 553: 160(ptr) AccessChain 433(output) 222 222 - Store 553 317 - 557: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 558 558 16 16 - 556: 160(ptr) AccessChain 433(output) 222 223 - Store 556 317 - 560: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 561 561 16 16 - 559: 160(ptr) AccessChain 433(output) 222 443 - Store 559 317 - 563: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 564 564 16 16 - 562: 160(ptr) AccessChain 433(output) 222 400 - Store 562 317 - Branch 485 - 485: Label - Branch 455 - 455: Label - 566: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 430 - 567: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 568 568 16 16 - 565:97(ConstantsHSOutput) Load 433(output) - ReturnValue 565 + 436: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 113 110(ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];) + 445: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 437 + 446: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 443 443 16 16 + 444: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 441 440(output) 41 + Store 440(output) 449 + 453: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 454 454 16 16 + 452: 21(ptr) AccessChain 109(patch) 229 229 + 455: 18(fvec4) Load 452 + Store 451(param) 455 + 457: 50(ptr) AccessChain 109(patch) 229 450 + 458: 48(fvec2) Load 457 + Store 456(param) 458 + 459: 52(bool) FunctionCall 59(frustumCheck(vf4;vf2;) 451(param) 456(param) + 460: 52(bool) LogicalNot 459 + SelectionMerge 462 None + BranchConditional 460 461 483 + 461: Label + 465: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 463 + 466: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 467 467 16 16 + 464: 160(ptr) AccessChain 440(output) 230 229 + Store 464 244 + 469: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 470 470 16 16 + 468: 160(ptr) AccessChain 440(output) 230 230 + Store 468 244 + 472: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 473 473 16 16 + 471: 160(ptr) AccessChain 440(output) 229 229 + Store 471 244 + 475: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 476 476 16 16 + 474: 160(ptr) AccessChain 440(output) 229 230 + Store 474 244 + 478: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 479 479 16 16 + 477: 160(ptr) AccessChain 440(output) 229 450 + Store 477 244 + 481: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 482 482 16 16 + 480: 160(ptr) AccessChain 440(output) 229 407 + Store 480 244 + Branch 462 + 483: Label + 486: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 484 + 487: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 488 488 16 16 + 485: 315(ptr) AccessChain 222 229 320 + 489: 8(float) Load 485 + 490: 52(bool) FOrdGreaterThan 489 244 + SelectionMerge 492 None + BranchConditional 490 491 551 + 491: Label + 496: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 493 + 497: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 498 498 16 16 + 495: 21(ptr) AccessChain 109(patch) 407 229 + 499: 18(fvec4) Load 495 + Store 494(param) 499 + 501: 21(ptr) AccessChain 109(patch) 229 229 + 502: 18(fvec4) Load 501 + Store 500(param) 502 + 503: 8(float) FunctionCall 28(screenSpaceTessFactor(vf4;vf4;) 494(param) 500(param) + 504: 160(ptr) AccessChain 440(output) 229 229 + Store 504 503 + 507: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 508 508 16 16 + 506: 21(ptr) AccessChain 109(patch) 229 229 + 509: 18(fvec4) Load 506 + Store 505(param) 509 + 511: 21(ptr) AccessChain 109(patch) 230 229 + 512: 18(fvec4) Load 511 + Store 510(param) 512 + 513: 8(float) FunctionCall 28(screenSpaceTessFactor(vf4;vf4;) 505(param) 510(param) + 514: 160(ptr) AccessChain 440(output) 229 230 + Store 514 513 + 517: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 518 518 16 16 + 516: 21(ptr) AccessChain 109(patch) 230 229 + 519: 18(fvec4) Load 516 + Store 515(param) 519 + 521: 21(ptr) AccessChain 109(patch) 450 229 + 522: 18(fvec4) Load 521 + Store 520(param) 522 + 523: 8(float) FunctionCall 28(screenSpaceTessFactor(vf4;vf4;) 515(param) 520(param) + 524: 160(ptr) AccessChain 440(output) 229 450 + Store 524 523 + 527: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 528 528 16 16 + 526: 21(ptr) AccessChain 109(patch) 450 229 + 529: 18(fvec4) Load 526 + Store 525(param) 529 + 531: 21(ptr) AccessChain 109(patch) 407 229 + 532: 18(fvec4) Load 531 + Store 530(param) 532 + 533: 8(float) FunctionCall 28(screenSpaceTessFactor(vf4;vf4;) 525(param) 530(param) + 534: 160(ptr) AccessChain 440(output) 229 407 + Store 534 533 + 536: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 537 537 16 16 + 535: 160(ptr) AccessChain 440(output) 229 229 + 538: 8(float) Load 535 + 539: 160(ptr) AccessChain 440(output) 229 407 + 540: 8(float) Load 539 + 541: 8(float) ExtInst 3(GLSL.std.450) 46(FMix) 538 540 155 + 542: 160(ptr) AccessChain 440(output) 230 229 + Store 542 541 + 544: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 545 545 16 16 + 543: 160(ptr) AccessChain 440(output) 229 450 + 546: 8(float) Load 543 + 547: 160(ptr) AccessChain 440(output) 229 230 + 548: 8(float) Load 547 + 549: 8(float) ExtInst 3(GLSL.std.450) 46(FMix) 546 548 155 + 550: 160(ptr) AccessChain 440(output) 230 230 + Store 550 549 + Branch 492 + 551: Label + 554: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 552 + 555: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 556 556 16 16 + 553: 160(ptr) AccessChain 440(output) 230 229 + Store 553 324 + 558: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 559 559 16 16 + 557: 160(ptr) AccessChain 440(output) 230 230 + Store 557 324 + 561: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 562 562 16 16 + 560: 160(ptr) AccessChain 440(output) 229 229 + Store 560 324 + 564: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 565 565 16 16 + 563: 160(ptr) AccessChain 440(output) 229 230 + Store 563 324 + 567: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 568 568 16 16 + 566: 160(ptr) AccessChain 440(output) 229 450 + Store 566 324 + 570: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 571 571 16 16 + 569: 160(ptr) AccessChain 440(output) 229 407 + Store 569 324 + Branch 492 + 492: Label + Branch 462 + 462: Label + 573: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 437 + 574: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 575 575 16 16 + 572:97(ConstantsHSOutput) Load 440(output) + ReturnValue 572 FunctionEnd 135(@main(struct-VSOutput-vf4-vf3-vf21[4];u1;):121(HSOutput) Function None 131 133(patch): 91(ptr) FunctionParameter 134(InvocationID): 119(ptr) FunctionParameter 136: Label - 577(output): 575(ptr) Variable Function + 584(output): 582(ptr) Variable Function 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 138 142: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 130 130 16 16 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 139 133(patch) 41 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 143 134(InvocationID) 41 - 573: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 138 135(@main(struct-VSOutput-vf4-vf3-vf21[4];u1;) - 581: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 574 - 582: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 579 579 16 16 - 580: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 578 577(output) 41 - Store 577(output) 585 - 587: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 588 588 16 16 - 586: 11(int) Load 134(InvocationID) - 589: 21(ptr) AccessChain 133(patch) 586 222 - 590: 18(fvec4) Load 589 - 591: 21(ptr) AccessChain 577(output) 222 - Store 591 590 - 593: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 594 594 16 16 - 592: 11(int) Load 134(InvocationID) - 597: 595(ptr) AccessChain 133(patch) 592 223 - 598: 72(fvec3) Load 597 - 599: 595(ptr) AccessChain 577(output) 223 - Store 599 598 - 601: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 602 602 16 16 - 600: 11(int) Load 134(InvocationID) - 603: 50(ptr) AccessChain 133(patch) 600 443 - 604: 48(fvec2) Load 603 - 605: 50(ptr) AccessChain 577(output) 443 - Store 605 604 - 607: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 608 608 16 16 - 606:121(HSOutput) Load 577(output) - ReturnValue 606 + 580: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 138 135(@main(struct-VSOutput-vf4-vf3-vf21[4];u1;) + 588: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 581 + 589: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 586 586 16 16 + 587: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 585 584(output) 41 + Store 584(output) 592 + 594: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 595 595 16 16 + 593: 11(int) Load 134(InvocationID) + 596: 21(ptr) AccessChain 133(patch) 593 229 + 597: 18(fvec4) Load 596 + 598: 21(ptr) AccessChain 584(output) 229 + Store 598 597 + 600: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 601 601 16 16 + 599: 11(int) Load 134(InvocationID) + 604: 602(ptr) AccessChain 133(patch) 599 230 + 605: 72(fvec3) Load 604 + 606: 602(ptr) AccessChain 584(output) 230 + Store 606 605 + 608: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 609 609 16 16 + 607: 11(int) Load 134(InvocationID) + 610: 50(ptr) AccessChain 133(patch) 607 450 + 611: 48(fvec2) Load 610 + 612: 50(ptr) AccessChain 584(output) 450 + Store 612 611 + 614: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 32 615 615 16 16 + 613:121(HSOutput) Load 584(output) + ReturnValue 613 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.tese.out b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.tese.out index 22e613d608..ab2bbed8f2 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.tese.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.tese.out @@ -1,14 +1,14 @@ spv.debuginfo.hlsl.tese // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 481 +// Id's are bound by 496 Capability Tessellation Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationEvaluation 6 "main" 372 387 396 405 412 418 458 462 466 469 472 475 478 + EntryPoint TessellationEvaluation 6 "main" 387 402 411 420 427 433 473 477 481 484 487 490 493 ExecutionMode 6 Quads 2: String "spv.debuginfo.hlsl.tese" 9: String "float" @@ -123,38 +123,44 @@ DSOutput main(ConstantsHSOutput input, float2 TessCoord : SV_DomainLocation, con 56: String "Normal" 60: String "UV" 64: String "HSOutput" - 72: String "WorldPos" - 82: String "DSOutput" - 90: String "@main" - 93: String "input" - 99: String "TessCoord" - 102: String "patch" - 110: String "output" - 122: String "uv1" - 127: String "int" - 142: String "uv2" - 166: String "n1" - 178: String "n2" - 201: String "pos1" - 213: String "pos2" - 225: String "pos" - 237: String "type.2d.image" - 239: String "@type.2d.image" - 245: String "displacementMapTexture" - 251: String "type.sampler" - 252: String "@type.sampler" - 257: String "displacementMapSampler" - 261: String "type.sampled.image" - 262: String "@type.sampled.image" - 271: String "bool" - 278: String "modelview" - 283: String "lightPos" - 287: String "frustumPlanes" - 290: String "tessellatedEdgeSize" - 294: String "viewportDim" - 298: String "UBO" - 301: String "ubo" - 307: String "" + 76: String "ViewVec" + 80: String "LightVec" + 84: String "EyePos" + 87: String "WorldPos" + 90: String "DSOutput" + 98: String "@main" + 101: String "input" + 107: String "TessCoord" + 110: String "patch" + 118: String "output" + 130: String "uv1" + 135: String "int" + 150: String "uv2" + 174: String "n1" + 186: String "n2" + 209: String "pos1" + 221: String "pos2" + 233: String "pos" + 245: String "type.2d.image" + 247: String "@type.2d.image" + 253: String "displacementMapTexture" + 259: String "type.sampler" + 260: String "@type.sampler" + 265: String "displacementMapSampler" + 269: String "type.sampled.image" + 270: String "@type.sampled.image" + 279: String "bool" + 286: String "projection" + 290: String "modelview" + 294: String "lightPos" + 298: String "frustumPlanes" + 301: String "displacementFactor" + 304: String "tessellationFactor" + 307: String "viewportDim" + 310: String "tessellatedEdgeSize" + 313: String "UBO" + 316: String "ubo" + 322: String "" Name 6 "main" Name 24 "ConstantsHSOutput" MemberName 24(ConstantsHSOutput) 0 "TessLevelOuter" @@ -171,88 +177,88 @@ DSOutput main(ConstantsHSOutput input, float2 TessCoord : SV_DomainLocation, con MemberName 67(DSOutput) 4 "LightVec" MemberName 67(DSOutput) 5 "EyePos" MemberName 67(DSOutput) 6 "WorldPos" - Name 88 "@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];" - Name 85 "input" - Name 86 "TessCoord" - Name 87 "patch" - Name 108 "output" - Name 120 "uv1" - Name 140 "uv2" - Name 164 "n1" - Name 176 "n2" - Name 199 "pos1" - Name 211 "pos2" - Name 223 "pos" - Name 243 "displacementMapTexture" - Name 255 "displacementMapSampler" - Name 276 "UBO" - MemberName 276(UBO) 0 "projection" - MemberName 276(UBO) 1 "modelview" - MemberName 276(UBO) 2 "lightPos" - MemberName 276(UBO) 3 "frustumPlanes" - MemberName 276(UBO) 4 "displacementFactor" - MemberName 276(UBO) 5 "tessellationFactor" - MemberName 276(UBO) 6 "viewportDim" - MemberName 276(UBO) 7 "tessellatedEdgeSize" - Name 299 "ubo" - MemberName 299(ubo) 0 "ubo" - Name 305 "" - Name 370 "input" - Name 372 "input.TessLevelOuter" - Name 387 "input.TessLevelInner" - Name 394 "TessCoord" - Name 396 "TessCoord" - Name 402 "patch" - Name 405 "patch.Pos" - Name 412 "patch.Normal" - Name 418 "patch.UV" - Name 450 "flattenTemp" - Name 452 "param" - Name 454 "param" - Name 458 "@entryPointOutput.Pos" - Name 462 "@entryPointOutput.Normal" - Name 466 "@entryPointOutput.UV" - Name 469 "@entryPointOutput.ViewVec" - Name 472 "@entryPointOutput.LightVec" - Name 475 "@entryPointOutput.EyePos" - Name 478 "@entryPointOutput.WorldPos" - Decorate 243(displacementMapTexture) Binding 1 - Decorate 243(displacementMapTexture) DescriptorSet 0 - Decorate 255(displacementMapSampler) Binding 1 - Decorate 255(displacementMapSampler) DescriptorSet 0 - Decorate 274 ArrayStride 16 - MemberDecorate 276(UBO) 0 RowMajor - MemberDecorate 276(UBO) 0 MatrixStride 16 - MemberDecorate 276(UBO) 0 Offset 0 - MemberDecorate 276(UBO) 1 RowMajor - MemberDecorate 276(UBO) 1 MatrixStride 16 - MemberDecorate 276(UBO) 1 Offset 64 - MemberDecorate 276(UBO) 2 Offset 128 - MemberDecorate 276(UBO) 3 Offset 144 - MemberDecorate 276(UBO) 4 Offset 240 - MemberDecorate 276(UBO) 5 Offset 244 - MemberDecorate 276(UBO) 6 Offset 248 - MemberDecorate 276(UBO) 7 Offset 256 - Decorate 299(ubo) Block - MemberDecorate 299(ubo) 0 Offset 0 - Decorate 305 Binding 0 - Decorate 305 DescriptorSet 0 - Decorate 372(input.TessLevelOuter) BuiltIn TessLevelOuter - Decorate 372(input.TessLevelOuter) Patch - Decorate 387(input.TessLevelInner) BuiltIn TessLevelInner - Decorate 387(input.TessLevelInner) Patch - Decorate 396(TessCoord) BuiltIn TessCoord - Decorate 396(TessCoord) Patch - Decorate 405(patch.Pos) BuiltIn Position - Decorate 412(patch.Normal) Location 0 - Decorate 418(patch.UV) Location 1 - Decorate 458(@entryPointOutput.Pos) BuiltIn Position - Decorate 462(@entryPointOutput.Normal) Location 0 - Decorate 466(@entryPointOutput.UV) Location 1 - Decorate 469(@entryPointOutput.ViewVec) Location 2 - Decorate 472(@entryPointOutput.LightVec) Location 3 - Decorate 475(@entryPointOutput.EyePos) Location 4 - Decorate 478(@entryPointOutput.WorldPos) Location 5 + Name 96 "@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];" + Name 93 "input" + Name 94 "TessCoord" + Name 95 "patch" + Name 116 "output" + Name 128 "uv1" + Name 148 "uv2" + Name 172 "n1" + Name 184 "n2" + Name 207 "pos1" + Name 219 "pos2" + Name 231 "pos" + Name 251 "displacementMapTexture" + Name 263 "displacementMapSampler" + Name 284 "UBO" + MemberName 284(UBO) 0 "projection" + MemberName 284(UBO) 1 "modelview" + MemberName 284(UBO) 2 "lightPos" + MemberName 284(UBO) 3 "frustumPlanes" + MemberName 284(UBO) 4 "displacementFactor" + MemberName 284(UBO) 5 "tessellationFactor" + MemberName 284(UBO) 6 "viewportDim" + MemberName 284(UBO) 7 "tessellatedEdgeSize" + Name 314 "ubo" + MemberName 314(ubo) 0 "ubo" + Name 320 "" + Name 385 "input" + Name 387 "input.TessLevelOuter" + Name 402 "input.TessLevelInner" + Name 409 "TessCoord" + Name 411 "TessCoord" + Name 417 "patch" + Name 420 "patch.Pos" + Name 427 "patch.Normal" + Name 433 "patch.UV" + Name 465 "flattenTemp" + Name 467 "param" + Name 469 "param" + Name 473 "@entryPointOutput.Pos" + Name 477 "@entryPointOutput.Normal" + Name 481 "@entryPointOutput.UV" + Name 484 "@entryPointOutput.ViewVec" + Name 487 "@entryPointOutput.LightVec" + Name 490 "@entryPointOutput.EyePos" + Name 493 "@entryPointOutput.WorldPos" + Decorate 251(displacementMapTexture) Binding 1 + Decorate 251(displacementMapTexture) DescriptorSet 0 + Decorate 263(displacementMapSampler) Binding 1 + Decorate 263(displacementMapSampler) DescriptorSet 0 + Decorate 282 ArrayStride 16 + MemberDecorate 284(UBO) 0 RowMajor + MemberDecorate 284(UBO) 0 MatrixStride 16 + MemberDecorate 284(UBO) 0 Offset 0 + MemberDecorate 284(UBO) 1 RowMajor + MemberDecorate 284(UBO) 1 MatrixStride 16 + MemberDecorate 284(UBO) 1 Offset 64 + MemberDecorate 284(UBO) 2 Offset 128 + MemberDecorate 284(UBO) 3 Offset 144 + MemberDecorate 284(UBO) 4 Offset 240 + MemberDecorate 284(UBO) 5 Offset 244 + MemberDecorate 284(UBO) 6 Offset 248 + MemberDecorate 284(UBO) 7 Offset 256 + Decorate 314(ubo) Block + MemberDecorate 314(ubo) 0 Offset 0 + Decorate 320 Binding 0 + Decorate 320 DescriptorSet 0 + Decorate 387(input.TessLevelOuter) BuiltIn TessLevelOuter + Decorate 387(input.TessLevelOuter) Patch + Decorate 402(input.TessLevelInner) BuiltIn TessLevelInner + Decorate 402(input.TessLevelInner) Patch + Decorate 411(TessCoord) BuiltIn TessCoord + Decorate 411(TessCoord) Patch + Decorate 420(patch.Pos) BuiltIn Position + Decorate 427(patch.Normal) Location 0 + Decorate 433(patch.UV) Location 1 + Decorate 473(@entryPointOutput.Pos) BuiltIn Position + Decorate 477(@entryPointOutput.Normal) Location 0 + Decorate 481(@entryPointOutput.UV) Location 1 + Decorate 484(@entryPointOutput.ViewVec) Location 2 + Decorate 487(@entryPointOutput.LightVec) Location 3 + Decorate 490(@entryPointOutput.EyePos) Location 4 + Decorate 493(@entryPointOutput.WorldPos) Location 5 4: TypeVoid 5: TypeFunction 4 8: TypeFloat 32 @@ -308,428 +314,437 @@ DSOutput main(ConstantsHSOutput input, float2 TessCoord : SV_DomainLocation, con 69: 11(int) Constant 57 70: 11(int) Constant 13 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 53 48 27 69 70 16 16 17 - 73: 11(int) Constant 63 - 74: 11(int) Constant 37 - 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 72 50 27 73 74 16 16 17 - 76: 11(int) Constant 59 - 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 60 44 27 76 62 16 16 17 - 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 72 50 27 73 74 16 16 17 - 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 72 50 27 73 74 16 16 17 - 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 72 50 27 73 74 16 16 17 - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 72 50 27 73 74 16 16 17 - 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 82 36 27 37 16 38 82 16 17 68 71 75 77 78 79 80 - 83: TypeFunction 67(DSOutput) 40(ptr) 45(ptr) 65 - 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 17 81 34 44 63 - 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 90 84 27 37 16 38 90 17 37 - 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 93 34 27 37 16 91 18 36 - 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 99 44 27 37 16 91 18 21 - 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 102 63 27 37 16 91 18 17 - 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 27 16 16 91 - 106: TypePointer Function 67(DSOutput) - 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 81 41 16 - 111: 11(int) Constant 70 - 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 110 81 27 111 16 105 18 - 115: 8(float) Constant 0 - 116: 47(fvec4) ConstantComposite 115 115 115 115 - 117: 49(fvec3) ConstantComposite 115 115 115 - 118: 43(fvec2) ConstantComposite 115 115 - 119:67(DSOutput) ConstantComposite 116 117 118 117 117 117 117 - 123: 11(int) Constant 71 - 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 122 44 27 123 16 105 18 - 126: TypeInt 32 1 - 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 127 14 18 16 - 129: 126(int) Constant 0 - 130: 126(int) Constant 2 - 132: 126(int) Constant 1 - 134: TypePointer Function 8(float) - 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 41 16 - 143: 11(int) Constant 72 - 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 142 44 27 143 16 105 18 - 146: 126(int) Constant 3 - 155: 11(int) Constant 73 - 162: TypePointer Function 49(fvec3) - 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 50 41 16 - 167: 11(int) Constant 75 - 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 166 50 27 167 16 105 18 - 179: 11(int) Constant 76 - 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 178 50 27 179 16 105 18 - 190: 11(int) Constant 77 - 197: TypePointer Function 47(fvec4) - 198: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 48 41 16 - 202: 11(int) Constant 80 - 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 201 48 27 202 16 105 18 - 214: 11(int) Constant 81 - 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 213 48 27 214 16 105 18 - 226: 11(int) Constant 82 - 224: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 225 48 27 226 16 105 18 - 235: TypeImage 8(float) 2D sampled format:Unknown - 238: 11(int) Constant 84 - 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) - 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 237 16 27 238 16 38 239 240 17 - 241: TypePointer UniformConstant 235 - 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 236 16 16 -243(displacementMapTexture): 241(ptr) Variable UniformConstant - 246: 11(int) Constant 8 - 244: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 245 236 27 238 16 38 245 243(displacementMapTexture) 246 - 249: TypeSampler - 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 251 36 27 238 16 38 252 240 17 - 253: TypePointer UniformConstant 249 - 254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 250 16 16 -255(displacementMapSampler): 253(ptr) Variable UniformConstant - 256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 257 250 27 238 16 38 257 255(displacementMapSampler) 246 - 259: TypeSampledImage 235 - 260: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 261 16 27 238 16 38 262 240 17 - 268: TypeMatrix 47(fvec4) 4 - 270: TypeBool - 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 271 14 21 16 - 273: 270(bool) ConstantTrue - 269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 48 18 273 - 274: TypeArray 47(fvec4) 15 - 275: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 48 15 - 276(UBO): TypeStruct 268 268 47(fvec4) 274 8(float) 8(float) 43(fvec2) 8(float) - 279: 11(int) Constant 29 - 280: 11(int) Constant 20 - 277: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 278 269 27 279 280 16 16 17 - 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 278 269 27 279 280 16 16 17 - 284: 11(int) Constant 30 - 285: 11(int) Constant 17 - 282: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 283 48 27 284 285 16 16 17 - 288: 11(int) Constant 22 - 286: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 287 275 27 62 288 16 16 17 - 291: 11(int) Constant 27 - 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 290 10 27 58 291 16 16 17 - 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 290 10 27 58 291 16 16 17 - 295: 11(int) Constant 34 - 293: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 294 44 27 295 280 16 16 17 - 296: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 290 10 27 58 291 16 16 17 - 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 298 36 27 238 16 38 298 16 17 277 281 282 286 289 292 293 296 - 299(ubo): TypeStruct 276(UBO) - 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 301 297 27 74 74 16 16 17 - 302: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 301 36 27 238 16 38 301 16 17 300 - 303: TypePointer Uniform 299(ubo) - 304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 302 21 16 - 305: 303(ptr) Variable Uniform - 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 307 302 27 238 16 38 307 305 246 - 308: 126(int) Constant 4 - 309: TypePointer Uniform 8(float) - 310: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 21 16 - 320: 11(int) Constant 86 - 321: TypePointer Uniform 268 - 322: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 269 21 16 - 332: 11(int) Constant 89 - 336: TypePointer Uniform 47(fvec4) - 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 48 21 16 - 340: 11(int) Constant 90 - 348: 126(int) Constant 6 - 351: 11(int) Constant 91 - 354: 126(int) Constant 5 - 357: 11(int) Constant 92 - 365: 11(int) Constant 93 - 371: TypePointer Input 19 -372(input.TessLevelOuter): 371(ptr) Variable Input - 373: TypePointer Input 8(float) - 386: TypePointer Input 22 -387(input.TessLevelInner): 386(ptr) Variable Input - 395: TypePointer Input 49(fvec3) - 396(TessCoord): 395(ptr) Variable Input - 401: TypePointer Function 65 - 403: TypeArray 47(fvec4) 18 - 404: TypePointer Input 403 - 405(patch.Pos): 404(ptr) Variable Input - 406: TypePointer Input 47(fvec4) - 410: TypeArray 49(fvec3) 18 - 411: TypePointer Input 410 -412(patch.Normal): 411(ptr) Variable Input - 416: TypeArray 43(fvec2) 18 - 417: TypePointer Input 416 - 418(patch.UV): 417(ptr) Variable Input - 419: TypePointer Input 43(fvec2) - 457: TypePointer Output 47(fvec4) -458(@entryPointOutput.Pos): 457(ptr) Variable Output - 461: TypePointer Output 49(fvec3) -462(@entryPointOutput.Normal): 461(ptr) Variable Output - 465: TypePointer Output 43(fvec2) -466(@entryPointOutput.UV): 465(ptr) Variable Output -469(@entryPointOutput.ViewVec): 461(ptr) Variable Output -472(@entryPointOutput.LightVec): 461(ptr) Variable Output -475(@entryPointOutput.EyePos): 461(ptr) Variable Output -478(@entryPointOutput.WorldPos): 461(ptr) Variable Output + 72: 11(int) Constant 58 + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 56 50 27 72 58 16 16 17 + 74: 11(int) Constant 59 + 73: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 60 44 27 74 62 16 16 17 + 77: 11(int) Constant 60 + 78: 11(int) Constant 36 + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 76 50 27 77 78 16 16 17 + 81: 11(int) Constant 61 + 82: 11(int) Constant 37 + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 80 50 27 81 82 16 16 17 + 85: 11(int) Constant 62 + 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 84 50 27 85 58 16 16 17 + 88: 11(int) Constant 63 + 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 87 50 27 88 82 16 16 17 + 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 90 36 27 37 16 38 90 16 17 68 71 73 75 79 83 86 + 91: TypeFunction 67(DSOutput) 40(ptr) 45(ptr) 65 + 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 17 89 34 44 63 + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 98 92 27 37 16 38 98 17 37 + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 101 34 27 37 16 99 18 36 + 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 107 44 27 37 16 99 18 21 + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 110 63 27 37 16 99 18 17 + 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 27 16 16 99 + 114: TypePointer Function 67(DSOutput) + 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 89 41 16 + 119: 11(int) Constant 70 + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 118 89 27 119 16 113 18 + 123: 8(float) Constant 0 + 124: 47(fvec4) ConstantComposite 123 123 123 123 + 125: 49(fvec3) ConstantComposite 123 123 123 + 126: 43(fvec2) ConstantComposite 123 123 + 127:67(DSOutput) ConstantComposite 124 125 126 125 125 125 125 + 131: 11(int) Constant 71 + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 130 44 27 131 16 113 18 + 134: TypeInt 32 1 + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 135 14 18 16 + 137: 134(int) Constant 0 + 138: 134(int) Constant 2 + 140: 134(int) Constant 1 + 142: TypePointer Function 8(float) + 143: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 41 16 + 151: 11(int) Constant 72 + 149: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 150 44 27 151 16 113 18 + 154: 134(int) Constant 3 + 163: 11(int) Constant 73 + 170: TypePointer Function 49(fvec3) + 171: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 50 41 16 + 175: 11(int) Constant 75 + 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 174 50 27 175 16 113 18 + 187: 11(int) Constant 76 + 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 186 50 27 187 16 113 18 + 198: 11(int) Constant 77 + 205: TypePointer Function 47(fvec4) + 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 48 41 16 + 210: 11(int) Constant 80 + 208: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 209 48 27 210 16 113 18 + 222: 11(int) Constant 81 + 220: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 221 48 27 222 16 113 18 + 234: 11(int) Constant 82 + 232: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 233 48 27 234 16 113 18 + 243: TypeImage 8(float) 2D sampled format:Unknown + 246: 11(int) Constant 84 + 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) + 244: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 245 36 27 246 16 38 247 248 17 + 249: TypePointer UniformConstant 243 + 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 244 16 16 +251(displacementMapTexture): 249(ptr) Variable UniformConstant + 254: 11(int) Constant 8 + 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 253 244 27 246 16 38 253 251(displacementMapTexture) 254 + 257: TypeSampler + 258: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 259 36 27 246 16 38 260 248 17 + 261: TypePointer UniformConstant 257 + 262: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 258 16 16 +263(displacementMapSampler): 261(ptr) Variable UniformConstant + 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 265 258 27 246 16 38 265 263(displacementMapSampler) 254 + 267: TypeSampledImage 243 + 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 269 36 27 246 16 38 270 248 17 + 276: TypeMatrix 47(fvec4) 4 + 278: TypeBool + 280: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 279 14 21 16 + 281: 278(bool) ConstantTrue + 277: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 48 18 281 + 282: TypeArray 47(fvec4) 15 + 283: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 48 15 + 284(UBO): TypeStruct 276 276 47(fvec4) 282 8(float) 8(float) 43(fvec2) 8(float) + 287: 11(int) Constant 28 + 288: 11(int) Constant 21 + 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 286 277 27 287 288 16 16 17 + 291: 11(int) Constant 29 + 292: 11(int) Constant 20 + 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 290 277 27 291 292 16 16 17 + 295: 11(int) Constant 30 + 296: 11(int) Constant 17 + 293: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 294 48 27 295 296 16 16 17 + 299: 11(int) Constant 22 + 297: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 298 283 27 62 299 16 16 17 + 302: 11(int) Constant 26 + 300: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 301 10 27 14 302 16 16 17 + 305: 11(int) Constant 33 + 303: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 304 10 27 305 302 16 16 17 + 308: 11(int) Constant 34 + 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 307 44 27 308 292 16 16 17 + 311: 11(int) Constant 27 + 309: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 310 10 27 58 311 16 16 17 + 312: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 313 36 27 246 16 38 313 16 17 285 289 293 297 300 303 306 309 + 314(ubo): TypeStruct 284(UBO) + 315: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 316 312 27 82 82 16 16 17 + 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 316 36 27 246 16 38 316 16 17 315 + 318: TypePointer Uniform 314(ubo) + 319: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 317 21 16 + 320: 318(ptr) Variable Uniform + 321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 322 317 27 246 16 38 322 320 254 + 323: 134(int) Constant 4 + 324: TypePointer Uniform 8(float) + 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 21 16 + 335: 11(int) Constant 86 + 336: TypePointer Uniform 276 + 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 277 21 16 + 347: 11(int) Constant 89 + 351: TypePointer Uniform 47(fvec4) + 352: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 48 21 16 + 355: 11(int) Constant 90 + 363: 134(int) Constant 6 + 366: 11(int) Constant 91 + 369: 134(int) Constant 5 + 372: 11(int) Constant 92 + 380: 11(int) Constant 93 + 386: TypePointer Input 19 +387(input.TessLevelOuter): 386(ptr) Variable Input + 388: TypePointer Input 8(float) + 401: TypePointer Input 22 +402(input.TessLevelInner): 401(ptr) Variable Input + 410: TypePointer Input 49(fvec3) + 411(TessCoord): 410(ptr) Variable Input + 416: TypePointer Function 65 + 418: TypeArray 47(fvec4) 18 + 419: TypePointer Input 418 + 420(patch.Pos): 419(ptr) Variable Input + 421: TypePointer Input 47(fvec4) + 425: TypeArray 49(fvec3) 18 + 426: TypePointer Input 425 +427(patch.Normal): 426(ptr) Variable Input + 431: TypeArray 43(fvec2) 18 + 432: TypePointer Input 431 + 433(patch.UV): 432(ptr) Variable Input + 434: TypePointer Input 43(fvec2) + 472: TypePointer Output 47(fvec4) +473(@entryPointOutput.Pos): 472(ptr) Variable Output + 476: TypePointer Output 49(fvec3) +477(@entryPointOutput.Normal): 476(ptr) Variable Output + 480: TypePointer Output 43(fvec2) +481(@entryPointOutput.UV): 480(ptr) Variable Output +484(@entryPointOutput.ViewVec): 476(ptr) Variable Output +487(@entryPointOutput.LightVec): 476(ptr) Variable Output +490(@entryPointOutput.EyePos): 476(ptr) Variable Output +493(@entryPointOutput.WorldPos): 476(ptr) Variable Output 6(main): 4 Function None 5 7: Label - 370(input): 40(ptr) Variable Function - 394(TessCoord): 45(ptr) Variable Function - 402(patch): 401(ptr) Variable Function -450(flattenTemp): 106(ptr) Variable Function - 452(param): 40(ptr) Variable Function - 454(param): 45(ptr) Variable Function - 374: 373(ptr) AccessChain 372(input.TessLevelOuter) 129 - 375: 8(float) Load 374 - 376: 134(ptr) AccessChain 370(input) 129 129 - Store 376 375 - 377: 373(ptr) AccessChain 372(input.TessLevelOuter) 132 - 378: 8(float) Load 377 - 379: 134(ptr) AccessChain 370(input) 129 132 - Store 379 378 - 380: 373(ptr) AccessChain 372(input.TessLevelOuter) 130 - 381: 8(float) Load 380 - 382: 134(ptr) AccessChain 370(input) 129 130 - Store 382 381 - 383: 373(ptr) AccessChain 372(input.TessLevelOuter) 146 - 384: 8(float) Load 383 - 385: 134(ptr) AccessChain 370(input) 129 146 - Store 385 384 - 388: 373(ptr) AccessChain 387(input.TessLevelInner) 129 - 389: 8(float) Load 388 - 390: 134(ptr) AccessChain 370(input) 132 129 - Store 390 389 - 391: 373(ptr) AccessChain 387(input.TessLevelInner) 132 - 392: 8(float) Load 391 - 393: 134(ptr) AccessChain 370(input) 132 132 - Store 393 392 - 397: 49(fvec3) Load 396(TessCoord) - 398: 8(float) CompositeExtract 397 0 - 399: 8(float) CompositeExtract 397 1 - 400: 43(fvec2) CompositeConstruct 398 399 - Store 394(TessCoord) 400 - 407: 406(ptr) AccessChain 405(patch.Pos) 129 - 408: 47(fvec4) Load 407 - 409: 197(ptr) AccessChain 402(patch) 129 129 - Store 409 408 - 413: 395(ptr) AccessChain 412(patch.Normal) 129 - 414: 49(fvec3) Load 413 - 415: 162(ptr) AccessChain 402(patch) 129 132 - Store 415 414 - 420: 419(ptr) AccessChain 418(patch.UV) 129 - 421: 43(fvec2) Load 420 - 422: 45(ptr) AccessChain 402(patch) 129 130 - Store 422 421 - 423: 406(ptr) AccessChain 405(patch.Pos) 132 - 424: 47(fvec4) Load 423 - 425: 197(ptr) AccessChain 402(patch) 132 129 - Store 425 424 - 426: 395(ptr) AccessChain 412(patch.Normal) 132 - 427: 49(fvec3) Load 426 - 428: 162(ptr) AccessChain 402(patch) 132 132 - Store 428 427 - 429: 419(ptr) AccessChain 418(patch.UV) 132 - 430: 43(fvec2) Load 429 - 431: 45(ptr) AccessChain 402(patch) 132 130 - Store 431 430 - 432: 406(ptr) AccessChain 405(patch.Pos) 130 - 433: 47(fvec4) Load 432 - 434: 197(ptr) AccessChain 402(patch) 130 129 - Store 434 433 - 435: 395(ptr) AccessChain 412(patch.Normal) 130 - 436: 49(fvec3) Load 435 - 437: 162(ptr) AccessChain 402(patch) 130 132 + 385(input): 40(ptr) Variable Function + 409(TessCoord): 45(ptr) Variable Function + 417(patch): 416(ptr) Variable Function +465(flattenTemp): 114(ptr) Variable Function + 467(param): 40(ptr) Variable Function + 469(param): 45(ptr) Variable Function + 389: 388(ptr) AccessChain 387(input.TessLevelOuter) 137 + 390: 8(float) Load 389 + 391: 142(ptr) AccessChain 385(input) 137 137 + Store 391 390 + 392: 388(ptr) AccessChain 387(input.TessLevelOuter) 140 + 393: 8(float) Load 392 + 394: 142(ptr) AccessChain 385(input) 137 140 + Store 394 393 + 395: 388(ptr) AccessChain 387(input.TessLevelOuter) 138 + 396: 8(float) Load 395 + 397: 142(ptr) AccessChain 385(input) 137 138 + Store 397 396 + 398: 388(ptr) AccessChain 387(input.TessLevelOuter) 154 + 399: 8(float) Load 398 + 400: 142(ptr) AccessChain 385(input) 137 154 + Store 400 399 + 403: 388(ptr) AccessChain 402(input.TessLevelInner) 137 + 404: 8(float) Load 403 + 405: 142(ptr) AccessChain 385(input) 140 137 + Store 405 404 + 406: 388(ptr) AccessChain 402(input.TessLevelInner) 140 + 407: 8(float) Load 406 + 408: 142(ptr) AccessChain 385(input) 140 140 + Store 408 407 + 412: 49(fvec3) Load 411(TessCoord) + 413: 8(float) CompositeExtract 412 0 + 414: 8(float) CompositeExtract 412 1 + 415: 43(fvec2) CompositeConstruct 413 414 + Store 409(TessCoord) 415 + 422: 421(ptr) AccessChain 420(patch.Pos) 137 + 423: 47(fvec4) Load 422 + 424: 205(ptr) AccessChain 417(patch) 137 137 + Store 424 423 + 428: 410(ptr) AccessChain 427(patch.Normal) 137 + 429: 49(fvec3) Load 428 + 430: 170(ptr) AccessChain 417(patch) 137 140 + Store 430 429 + 435: 434(ptr) AccessChain 433(patch.UV) 137 + 436: 43(fvec2) Load 435 + 437: 45(ptr) AccessChain 417(patch) 137 138 Store 437 436 - 438: 419(ptr) AccessChain 418(patch.UV) 130 - 439: 43(fvec2) Load 438 - 440: 45(ptr) AccessChain 402(patch) 130 130 + 438: 421(ptr) AccessChain 420(patch.Pos) 140 + 439: 47(fvec4) Load 438 + 440: 205(ptr) AccessChain 417(patch) 140 137 Store 440 439 - 441: 406(ptr) AccessChain 405(patch.Pos) 146 - 442: 47(fvec4) Load 441 - 443: 197(ptr) AccessChain 402(patch) 146 129 + 441: 410(ptr) AccessChain 427(patch.Normal) 140 + 442: 49(fvec3) Load 441 + 443: 170(ptr) AccessChain 417(patch) 140 140 Store 443 442 - 444: 395(ptr) AccessChain 412(patch.Normal) 146 - 445: 49(fvec3) Load 444 - 446: 162(ptr) AccessChain 402(patch) 146 132 + 444: 434(ptr) AccessChain 433(patch.UV) 140 + 445: 43(fvec2) Load 444 + 446: 45(ptr) AccessChain 417(patch) 140 138 Store 446 445 - 447: 419(ptr) AccessChain 418(patch.UV) 146 - 448: 43(fvec2) Load 447 - 449: 45(ptr) AccessChain 402(patch) 146 130 + 447: 421(ptr) AccessChain 420(patch.Pos) 138 + 448: 47(fvec4) Load 447 + 449: 205(ptr) AccessChain 417(patch) 138 137 Store 449 448 - 451: 65 Load 402(patch) - 453:24(ConstantsHSOutput) Load 370(input) - Store 452(param) 453 - 455: 43(fvec2) Load 394(TessCoord) - Store 454(param) 455 - 456:67(DSOutput) FunctionCall 88(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];) 452(param) 454(param) 451 - Store 450(flattenTemp) 456 - 459: 197(ptr) AccessChain 450(flattenTemp) 129 - 460: 47(fvec4) Load 459 - Store 458(@entryPointOutput.Pos) 460 - 463: 162(ptr) AccessChain 450(flattenTemp) 132 - 464: 49(fvec3) Load 463 - Store 462(@entryPointOutput.Normal) 464 - 467: 45(ptr) AccessChain 450(flattenTemp) 130 - 468: 43(fvec2) Load 467 - Store 466(@entryPointOutput.UV) 468 - 470: 162(ptr) AccessChain 450(flattenTemp) 146 - 471: 49(fvec3) Load 470 - Store 469(@entryPointOutput.ViewVec) 471 - 473: 162(ptr) AccessChain 450(flattenTemp) 308 - 474: 49(fvec3) Load 473 - Store 472(@entryPointOutput.LightVec) 474 - 476: 162(ptr) AccessChain 450(flattenTemp) 354 - 477: 49(fvec3) Load 476 - Store 475(@entryPointOutput.EyePos) 477 - 479: 162(ptr) AccessChain 450(flattenTemp) 348 - 480: 49(fvec3) Load 479 - Store 478(@entryPointOutput.WorldPos) 480 + 450: 410(ptr) AccessChain 427(patch.Normal) 138 + 451: 49(fvec3) Load 450 + 452: 170(ptr) AccessChain 417(patch) 138 140 + Store 452 451 + 453: 434(ptr) AccessChain 433(patch.UV) 138 + 454: 43(fvec2) Load 453 + 455: 45(ptr) AccessChain 417(patch) 138 138 + Store 455 454 + 456: 421(ptr) AccessChain 420(patch.Pos) 154 + 457: 47(fvec4) Load 456 + 458: 205(ptr) AccessChain 417(patch) 154 137 + Store 458 457 + 459: 410(ptr) AccessChain 427(patch.Normal) 154 + 460: 49(fvec3) Load 459 + 461: 170(ptr) AccessChain 417(patch) 154 140 + Store 461 460 + 462: 434(ptr) AccessChain 433(patch.UV) 154 + 463: 43(fvec2) Load 462 + 464: 45(ptr) AccessChain 417(patch) 154 138 + Store 464 463 + 466: 65 Load 417(patch) + 468:24(ConstantsHSOutput) Load 385(input) + Store 467(param) 468 + 470: 43(fvec2) Load 409(TessCoord) + Store 469(param) 470 + 471:67(DSOutput) FunctionCall 96(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];) 467(param) 469(param) 466 + Store 465(flattenTemp) 471 + 474: 205(ptr) AccessChain 465(flattenTemp) 137 + 475: 47(fvec4) Load 474 + Store 473(@entryPointOutput.Pos) 475 + 478: 170(ptr) AccessChain 465(flattenTemp) 140 + 479: 49(fvec3) Load 478 + Store 477(@entryPointOutput.Normal) 479 + 482: 45(ptr) AccessChain 465(flattenTemp) 138 + 483: 43(fvec2) Load 482 + Store 481(@entryPointOutput.UV) 483 + 485: 170(ptr) AccessChain 465(flattenTemp) 154 + 486: 49(fvec3) Load 485 + Store 484(@entryPointOutput.ViewVec) 486 + 488: 170(ptr) AccessChain 465(flattenTemp) 323 + 489: 49(fvec3) Load 488 + Store 487(@entryPointOutput.LightVec) 489 + 491: 170(ptr) AccessChain 465(flattenTemp) 369 + 492: 49(fvec3) Load 491 + Store 490(@entryPointOutput.EyePos) 492 + 494: 170(ptr) AccessChain 465(flattenTemp) 363 + 495: 49(fvec3) Load 494 + Store 493(@entryPointOutput.WorldPos) 495 Return FunctionEnd -88(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];):67(DSOutput) Function None 83 - 85(input): 40(ptr) FunctionParameter - 86(TessCoord): 45(ptr) FunctionParameter - 87(patch): 65 FunctionParameter - 89: Label - 108(output): 106(ptr) Variable Function - 120(uv1): 45(ptr) Variable Function - 140(uv2): 45(ptr) Variable Function - 164(n1): 162(ptr) Variable Function - 176(n2): 162(ptr) Variable Function - 199(pos1): 197(ptr) Variable Function - 211(pos2): 197(ptr) Variable Function - 223(pos): 197(ptr) Variable Function - 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 91 - 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 37 37 16 16 - 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 92 85(input) 95 - 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 98 86(TessCoord) 95 - 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 101 87(patch) 95 - 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 91 88(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];) - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 105 - 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 111 111 16 16 - 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 109 108(output) 95 - Store 108(output) 119 - 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 123 123 16 16 - 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 121 120(uv1) 95 - 131: 43(fvec2) CompositeExtract 87(patch) 0 2 - 133: 43(fvec2) CompositeExtract 87(patch) 1 2 - 136: 134(ptr) AccessChain 86(TessCoord) 16 - 137: 8(float) Load 136 - 138: 43(fvec2) CompositeConstruct 137 137 - 139: 43(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 131 133 138 - Store 120(uv1) 139 - 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 143 143 16 16 - 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 141 140(uv2) 95 - 147: 43(fvec2) CompositeExtract 87(patch) 3 2 - 148: 43(fvec2) CompositeExtract 87(patch) 2 2 - 149: 134(ptr) AccessChain 86(TessCoord) 16 - 150: 8(float) Load 149 - 151: 43(fvec2) CompositeConstruct 150 150 - 152: 43(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 147 148 151 - Store 140(uv2) 152 - 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 155 155 16 16 - 153: 43(fvec2) Load 120(uv1) - 156: 43(fvec2) Load 140(uv2) - 157: 134(ptr) AccessChain 86(TessCoord) 36 +96(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];):67(DSOutput) Function None 91 + 93(input): 40(ptr) FunctionParameter + 94(TessCoord): 45(ptr) FunctionParameter + 95(patch): 65 FunctionParameter + 97: Label + 116(output): 114(ptr) Variable Function + 128(uv1): 45(ptr) Variable Function + 148(uv2): 45(ptr) Variable Function + 172(n1): 170(ptr) Variable Function + 184(n2): 170(ptr) Variable Function + 207(pos1): 205(ptr) Variable Function + 219(pos2): 205(ptr) Variable Function + 231(pos): 205(ptr) Variable Function + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 99 + 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 37 37 16 16 + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 100 93(input) 103 + 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 106 94(TessCoord) 103 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 109 95(patch) 103 + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 99 96(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];) + 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 113 + 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 119 119 16 16 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 117 116(output) 103 + Store 116(output) 127 + 133: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 131 131 16 16 + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 129 128(uv1) 103 + 139: 43(fvec2) CompositeExtract 95(patch) 0 2 + 141: 43(fvec2) CompositeExtract 95(patch) 1 2 + 144: 142(ptr) AccessChain 94(TessCoord) 16 + 145: 8(float) Load 144 + 146: 43(fvec2) CompositeConstruct 145 145 + 147: 43(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 139 141 146 + Store 128(uv1) 147 + 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 151 151 16 16 + 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 149 148(uv2) 103 + 155: 43(fvec2) CompositeExtract 95(patch) 3 2 + 156: 43(fvec2) CompositeExtract 95(patch) 2 2 + 157: 142(ptr) AccessChain 94(TessCoord) 16 158: 8(float) Load 157 159: 43(fvec2) CompositeConstruct 158 158 - 160: 43(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 153 156 159 - 161: 45(ptr) AccessChain 108(output) 130 - Store 161 160 - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 167 167 16 16 - 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 165 164(n1) 95 - 170: 49(fvec3) CompositeExtract 87(patch) 0 1 - 171: 49(fvec3) CompositeExtract 87(patch) 1 1 - 172: 134(ptr) AccessChain 86(TessCoord) 16 - 173: 8(float) Load 172 - 174: 49(fvec3) CompositeConstruct 173 173 173 - 175: 49(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 170 171 174 - Store 164(n1) 175 - 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 179 179 16 16 - 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 177 176(n2) 95 - 182: 49(fvec3) CompositeExtract 87(patch) 3 1 - 183: 49(fvec3) CompositeExtract 87(patch) 2 1 - 184: 134(ptr) AccessChain 86(TessCoord) 16 - 185: 8(float) Load 184 - 186: 49(fvec3) CompositeConstruct 185 185 185 - 187: 49(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 182 183 186 - Store 176(n2) 187 - 189: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 190 190 16 16 - 188: 49(fvec3) Load 164(n1) - 191: 49(fvec3) Load 176(n2) - 192: 134(ptr) AccessChain 86(TessCoord) 36 + 160: 43(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 155 156 159 + Store 148(uv2) 160 + 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 163 163 16 16 + 161: 43(fvec2) Load 128(uv1) + 164: 43(fvec2) Load 148(uv2) + 165: 142(ptr) AccessChain 94(TessCoord) 36 + 166: 8(float) Load 165 + 167: 43(fvec2) CompositeConstruct 166 166 + 168: 43(fvec2) ExtInst 3(GLSL.std.450) 46(FMix) 161 164 167 + 169: 45(ptr) AccessChain 116(output) 138 + Store 169 168 + 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 175 175 16 16 + 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 173 172(n1) 103 + 178: 49(fvec3) CompositeExtract 95(patch) 0 1 + 179: 49(fvec3) CompositeExtract 95(patch) 1 1 + 180: 142(ptr) AccessChain 94(TessCoord) 16 + 181: 8(float) Load 180 + 182: 49(fvec3) CompositeConstruct 181 181 181 + 183: 49(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 178 179 182 + Store 172(n1) 183 + 189: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 187 187 16 16 + 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 185 184(n2) 103 + 190: 49(fvec3) CompositeExtract 95(patch) 3 1 + 191: 49(fvec3) CompositeExtract 95(patch) 2 1 + 192: 142(ptr) AccessChain 94(TessCoord) 16 193: 8(float) Load 192 194: 49(fvec3) CompositeConstruct 193 193 193 - 195: 49(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 188 191 194 - 196: 162(ptr) AccessChain 108(output) 132 - Store 196 195 - 204: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 202 202 16 16 - 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 200 199(pos1) 95 - 205: 47(fvec4) CompositeExtract 87(patch) 0 0 - 206: 47(fvec4) CompositeExtract 87(patch) 1 0 - 207: 134(ptr) AccessChain 86(TessCoord) 16 - 208: 8(float) Load 207 - 209: 47(fvec4) CompositeConstruct 208 208 208 208 - 210: 47(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 205 206 209 - Store 199(pos1) 210 - 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 214 214 16 16 - 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 212 211(pos2) 95 - 217: 47(fvec4) CompositeExtract 87(patch) 3 0 - 218: 47(fvec4) CompositeExtract 87(patch) 2 0 - 219: 134(ptr) AccessChain 86(TessCoord) 16 - 220: 8(float) Load 219 - 221: 47(fvec4) CompositeConstruct 220 220 220 220 - 222: 47(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 217 218 221 - Store 211(pos2) 222 - 228: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 226 226 16 16 - 227: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 224 223(pos) 95 - 229: 47(fvec4) Load 199(pos1) - 230: 47(fvec4) Load 211(pos2) - 231: 134(ptr) AccessChain 86(TessCoord) 36 - 232: 8(float) Load 231 - 233: 47(fvec4) CompositeConstruct 232 232 232 232 - 234: 47(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 229 230 233 - Store 223(pos) 234 - 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 238 238 16 16 - 247: 235 Load 243(displacementMapTexture) - 258: 249 Load 255(displacementMapSampler) - 263: 259 SampledImage 247 258 - 264: 45(ptr) AccessChain 108(output) 130 - 265: 43(fvec2) Load 264 - 266: 47(fvec4) ImageSampleExplicitLod 263 265 Lod 115 - 267: 8(float) CompositeExtract 266 0 - 311: 309(ptr) AccessChain 305 129 308 - 312: 8(float) Load 311 - 313: 8(float) FMul 267 312 - 314: 134(ptr) AccessChain 223(pos) 36 - 315: 8(float) Load 314 - 316: 8(float) FSub 315 313 - 317: 134(ptr) AccessChain 223(pos) 36 - Store 317 316 - 319: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 320 320 16 16 - 318: 47(fvec4) Load 223(pos) - 323: 321(ptr) AccessChain 305 129 132 - 324: 268 Load 323 - 325: 47(fvec4) VectorTimesMatrix 318 324 - 326: 321(ptr) AccessChain 305 129 129 - 327: 268 Load 326 - 328: 47(fvec4) VectorTimesMatrix 325 327 - 329: 197(ptr) AccessChain 108(output) 129 - Store 329 328 - 331: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 332 332 16 16 - 330: 47(fvec4) Load 223(pos) - 333: 49(fvec3) VectorShuffle 330 330 0 1 2 - 334: 49(fvec3) FNegate 333 - 335: 162(ptr) AccessChain 108(output) 146 - Store 335 334 - 339: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 340 340 16 16 - 338: 336(ptr) AccessChain 305 129 130 - 341: 47(fvec4) Load 338 - 342: 49(fvec3) VectorShuffle 341 341 0 1 2 - 343: 162(ptr) AccessChain 108(output) 146 - 344: 49(fvec3) Load 343 - 345: 49(fvec3) FAdd 342 344 - 346: 49(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 345 - 347: 162(ptr) AccessChain 108(output) 308 - Store 347 346 - 350: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 351 351 16 16 - 349: 47(fvec4) Load 223(pos) - 352: 49(fvec3) VectorShuffle 349 349 0 1 2 - 353: 162(ptr) AccessChain 108(output) 348 - Store 353 352 - 356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 357 357 16 16 - 355: 47(fvec4) Load 223(pos) - 358: 321(ptr) AccessChain 305 129 132 - 359: 268 Load 358 - 360: 47(fvec4) VectorTimesMatrix 355 359 - 361: 49(fvec3) VectorShuffle 360 360 0 1 2 - 362: 162(ptr) AccessChain 108(output) 354 + 195: 49(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 190 191 194 + Store 184(n2) 195 + 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 198 198 16 16 + 196: 49(fvec3) Load 172(n1) + 199: 49(fvec3) Load 184(n2) + 200: 142(ptr) AccessChain 94(TessCoord) 36 + 201: 8(float) Load 200 + 202: 49(fvec3) CompositeConstruct 201 201 201 + 203: 49(fvec3) ExtInst 3(GLSL.std.450) 46(FMix) 196 199 202 + 204: 170(ptr) AccessChain 116(output) 140 + Store 204 203 + 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 210 210 16 16 + 211: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 208 207(pos1) 103 + 213: 47(fvec4) CompositeExtract 95(patch) 0 0 + 214: 47(fvec4) CompositeExtract 95(patch) 1 0 + 215: 142(ptr) AccessChain 94(TessCoord) 16 + 216: 8(float) Load 215 + 217: 47(fvec4) CompositeConstruct 216 216 216 216 + 218: 47(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 213 214 217 + Store 207(pos1) 218 + 224: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 222 222 16 16 + 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 220 219(pos2) 103 + 225: 47(fvec4) CompositeExtract 95(patch) 3 0 + 226: 47(fvec4) CompositeExtract 95(patch) 2 0 + 227: 142(ptr) AccessChain 94(TessCoord) 16 + 228: 8(float) Load 227 + 229: 47(fvec4) CompositeConstruct 228 228 228 228 + 230: 47(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 225 226 229 + Store 219(pos2) 230 + 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 234 234 16 16 + 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 232 231(pos) 103 + 237: 47(fvec4) Load 207(pos1) + 238: 47(fvec4) Load 219(pos2) + 239: 142(ptr) AccessChain 94(TessCoord) 36 + 240: 8(float) Load 239 + 241: 47(fvec4) CompositeConstruct 240 240 240 240 + 242: 47(fvec4) ExtInst 3(GLSL.std.450) 46(FMix) 237 238 241 + Store 231(pos) 242 + 256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 246 246 16 16 + 255: 243 Load 251(displacementMapTexture) + 266: 257 Load 263(displacementMapSampler) + 271: 267 SampledImage 255 266 + 272: 45(ptr) AccessChain 116(output) 138 + 273: 43(fvec2) Load 272 + 274: 47(fvec4) ImageSampleExplicitLod 271 273 Lod 123 + 275: 8(float) CompositeExtract 274 0 + 326: 324(ptr) AccessChain 320 137 323 + 327: 8(float) Load 326 + 328: 8(float) FMul 275 327 + 329: 142(ptr) AccessChain 231(pos) 36 + 330: 8(float) Load 329 + 331: 8(float) FSub 330 328 + 332: 142(ptr) AccessChain 231(pos) 36 + Store 332 331 + 334: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 335 335 16 16 + 333: 47(fvec4) Load 231(pos) + 338: 336(ptr) AccessChain 320 137 140 + 339: 276 Load 338 + 340: 47(fvec4) VectorTimesMatrix 333 339 + 341: 336(ptr) AccessChain 320 137 137 + 342: 276 Load 341 + 343: 47(fvec4) VectorTimesMatrix 340 342 + 344: 205(ptr) AccessChain 116(output) 137 + Store 344 343 + 346: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 347 347 16 16 + 345: 47(fvec4) Load 231(pos) + 348: 49(fvec3) VectorShuffle 345 345 0 1 2 + 349: 49(fvec3) FNegate 348 + 350: 170(ptr) AccessChain 116(output) 154 + Store 350 349 + 354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 355 355 16 16 + 353: 351(ptr) AccessChain 320 137 138 + 356: 47(fvec4) Load 353 + 357: 49(fvec3) VectorShuffle 356 356 0 1 2 + 358: 170(ptr) AccessChain 116(output) 154 + 359: 49(fvec3) Load 358 + 360: 49(fvec3) FAdd 357 359 + 361: 49(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 360 + 362: 170(ptr) AccessChain 116(output) 323 Store 362 361 - 364: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 365 365 16 16 - 363:67(DSOutput) Load 108(output) - ReturnValue 363 + 365: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 366 366 16 16 + 364: 47(fvec4) Load 231(pos) + 367: 49(fvec3) VectorShuffle 364 364 0 1 2 + 368: 170(ptr) AccessChain 116(output) 363 + Store 368 367 + 371: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 372 372 16 16 + 370: 47(fvec4) Load 231(pos) + 373: 336(ptr) AccessChain 320 137 140 + 374: 276 Load 373 + 375: 47(fvec4) VectorTimesMatrix 370 374 + 376: 49(fvec3) VectorShuffle 375 375 0 1 2 + 377: 170(ptr) AccessChain 116(output) 369 + Store 377 376 + 379: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 27 380 380 16 16 + 378:67(DSOutput) Load 116(output) + ReturnValue 378 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.vert.out b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.vert.out index 4e49f04a0e..3ff0ab7560 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.vert.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.hlsl.vert.out @@ -1,19 +1,19 @@ spv.debuginfo.hlsl.vert // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 518 +// Id's are bound by 534 Capability Shader Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 6 "main" 467 470 474 477 480 483 487 491 499 503 506 509 512 515 + EntryPoint Vertex 6 "main" 483 486 490 493 496 499 503 507 515 519 522 525 528 531 2: String "spv.debuginfo.hlsl.vert" 9: String "float" 12: String "uint" 24: String "int" - 29: String "instanceRot" + 29: String "Pos" 31: String "// OpModuleProcessed auto-map-locations // OpModuleProcessed auto-map-bindings // OpModuleProcessed entry-point main @@ -135,33 +135,39 @@ VSOutput main(VSInput input) return output; } " - 36: String "UV" - 43: String "instanceScale" - 47: String "instanceTexIndex" - 51: String "VSInput" - 63: String "Pos" - 67: String "LightVec" - 74: String "VSOutput" - 80: String "@main" - 83: String "input" - 94: String "output" - 132: String "s" - 142: String "bool" - 147: String "modelview" - 152: String "lightPos" - 156: String "globSpeed" - 160: String "UBO" - 163: String "ubo" - 170: String "" - 181: String "c" - 197: String "mx" - 232: String "my" - 266: String "mz" - 286: String "rotMat" - 299: String "gRotMat" - 346: String "locPos" - 360: String "pos" - 426: String "lPos" + 34: String "Normal" + 38: String "UV" + 42: String "Color" + 45: String "instancePos" + 48: String "instanceRot" + 50: String "instanceScale" + 54: String "instanceTexIndex" + 58: String "VSInput" + 79: String "ViewVec" + 82: String "LightVec" + 85: String "VSOutput" + 91: String "@main" + 94: String "input" + 105: String "output" + 143: String "s" + 153: String "bool" + 158: String "projection" + 161: String "modelview" + 165: String "lightPos" + 169: String "locSpeed" + 173: String "globSpeed" + 176: String "UBO" + 179: String "ubo" + 186: String "" + 197: String "c" + 213: String "mx" + 248: String "my" + 282: String "mz" + 302: String "rotMat" + 315: String "gRotMat" + 362: String "locPos" + 376: String "pos" + 442: String "lPos" Name 6 "main" Name 27 "VSInput" MemberName 27(VSInput) 0 "Pos" @@ -172,79 +178,79 @@ VSOutput main(VSInput input) MemberName 27(VSInput) 5 "instanceRot" MemberName 27(VSInput) 6 "instanceScale" MemberName 27(VSInput) 7 "instanceTexIndex" - Name 61 "VSOutput" - MemberName 61(VSOutput) 0 "Pos" - MemberName 61(VSOutput) 1 "Normal" - MemberName 61(VSOutput) 2 "Color" - MemberName 61(VSOutput) 3 "UV" - MemberName 61(VSOutput) 4 "ViewVec" - MemberName 61(VSOutput) 5 "LightVec" - Name 78 "@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;" - Name 77 "input" - Name 92 "output" - Name 130 "s" - Name 145 "UBO" - MemberName 145(UBO) 0 "projection" - MemberName 145(UBO) 1 "modelview" - MemberName 145(UBO) 2 "lightPos" - MemberName 145(UBO) 3 "locSpeed" - MemberName 145(UBO) 4 "globSpeed" - Name 161 "ubo" - MemberName 161(ubo) 0 "ubo" - Name 168 "" - Name 179 "c" - Name 195 "mx" - Name 230 "my" - Name 264 "mz" - Name 284 "rotMat" - Name 297 "gRotMat" - Name 344 "locPos" - Name 358 "pos" - Name 424 "lPos" - Name 465 "input" - Name 467 "input.Pos" - Name 470 "input.Normal" - Name 474 "input.UV" - Name 477 "input.Color" - Name 480 "input.instancePos" - Name 483 "input.instanceRot" - Name 487 "input.instanceScale" - Name 491 "input.instanceTexIndex" - Name 494 "flattenTemp" - Name 495 "param" - Name 499 "@entryPointOutput.Pos" - Name 503 "@entryPointOutput.Normal" - Name 506 "@entryPointOutput.Color" - Name 509 "@entryPointOutput.UV" - Name 512 "@entryPointOutput.ViewVec" - Name 515 "@entryPointOutput.LightVec" - MemberDecorate 145(UBO) 0 RowMajor - MemberDecorate 145(UBO) 0 MatrixStride 16 - MemberDecorate 145(UBO) 0 Offset 0 - MemberDecorate 145(UBO) 1 RowMajor - MemberDecorate 145(UBO) 1 MatrixStride 16 - MemberDecorate 145(UBO) 1 Offset 64 - MemberDecorate 145(UBO) 2 Offset 128 - MemberDecorate 145(UBO) 3 Offset 144 - MemberDecorate 145(UBO) 4 Offset 148 - Decorate 161(ubo) Block - MemberDecorate 161(ubo) 0 Offset 0 - Decorate 168 Binding 0 - Decorate 168 DescriptorSet 0 - Decorate 467(input.Pos) Location 0 - Decorate 470(input.Normal) Location 1 - Decorate 474(input.UV) Location 2 - Decorate 477(input.Color) Location 3 - Decorate 480(input.instancePos) Location 4 - Decorate 483(input.instanceRot) Location 5 - Decorate 487(input.instanceScale) Location 6 - Decorate 491(input.instanceTexIndex) Location 7 - Decorate 499(@entryPointOutput.Pos) BuiltIn Position - Decorate 503(@entryPointOutput.Normal) Location 0 - Decorate 506(@entryPointOutput.Color) Location 1 - Decorate 509(@entryPointOutput.UV) Location 2 - Decorate 512(@entryPointOutput.ViewVec) Location 3 - Decorate 515(@entryPointOutput.LightVec) Location 4 + Name 68 "VSOutput" + MemberName 68(VSOutput) 0 "Pos" + MemberName 68(VSOutput) 1 "Normal" + MemberName 68(VSOutput) 2 "Color" + MemberName 68(VSOutput) 3 "UV" + MemberName 68(VSOutput) 4 "ViewVec" + MemberName 68(VSOutput) 5 "LightVec" + Name 89 "@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;" + Name 88 "input" + Name 103 "output" + Name 141 "s" + Name 156 "UBO" + MemberName 156(UBO) 0 "projection" + MemberName 156(UBO) 1 "modelview" + MemberName 156(UBO) 2 "lightPos" + MemberName 156(UBO) 3 "locSpeed" + MemberName 156(UBO) 4 "globSpeed" + Name 177 "ubo" + MemberName 177(ubo) 0 "ubo" + Name 184 "" + Name 195 "c" + Name 211 "mx" + Name 246 "my" + Name 280 "mz" + Name 300 "rotMat" + Name 313 "gRotMat" + Name 360 "locPos" + Name 374 "pos" + Name 440 "lPos" + Name 481 "input" + Name 483 "input.Pos" + Name 486 "input.Normal" + Name 490 "input.UV" + Name 493 "input.Color" + Name 496 "input.instancePos" + Name 499 "input.instanceRot" + Name 503 "input.instanceScale" + Name 507 "input.instanceTexIndex" + Name 510 "flattenTemp" + Name 511 "param" + Name 515 "@entryPointOutput.Pos" + Name 519 "@entryPointOutput.Normal" + Name 522 "@entryPointOutput.Color" + Name 525 "@entryPointOutput.UV" + Name 528 "@entryPointOutput.ViewVec" + Name 531 "@entryPointOutput.LightVec" + MemberDecorate 156(UBO) 0 RowMajor + MemberDecorate 156(UBO) 0 MatrixStride 16 + MemberDecorate 156(UBO) 0 Offset 0 + MemberDecorate 156(UBO) 1 RowMajor + MemberDecorate 156(UBO) 1 MatrixStride 16 + MemberDecorate 156(UBO) 1 Offset 64 + MemberDecorate 156(UBO) 2 Offset 128 + MemberDecorate 156(UBO) 3 Offset 144 + MemberDecorate 156(UBO) 4 Offset 148 + Decorate 177(ubo) Block + MemberDecorate 177(ubo) 0 Offset 0 + Decorate 184 Binding 0 + Decorate 184 DescriptorSet 0 + Decorate 483(input.Pos) Location 0 + Decorate 486(input.Normal) Location 1 + Decorate 490(input.UV) Location 2 + Decorate 493(input.Color) Location 3 + Decorate 496(input.instancePos) Location 4 + Decorate 499(input.instanceRot) Location 5 + Decorate 503(input.instanceScale) Location 6 + Decorate 507(input.instanceTexIndex) Location 7 + Decorate 515(@entryPointOutput.Pos) BuiltIn Position + Decorate 519(@entryPointOutput.Normal) Location 0 + Decorate 522(@entryPointOutput.Color) Location 1 + Decorate 525(@entryPointOutput.UV) Location 2 + Decorate 528(@entryPointOutput.ViewVec) Location 3 + Decorate 531(@entryPointOutput.LightVec) Location 4 4: TypeVoid 5: TypeFunction 4 8: TypeFloat 32 @@ -265,508 +271,518 @@ VSOutput main(VSInput input) 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 24 14 26 16 27(VSInput): TypeStruct 18(fvec3) 18(fvec3) 20(fvec2) 18(fvec3) 18(fvec3) 18(fvec3) 8(float) 23(int) 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 31 - 32: 11(int) Constant 35 - 33: 11(int) Constant 40 - 28: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 29 19 30 32 33 16 16 17 - 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 29 19 30 32 33 16 16 17 - 37: 11(int) Constant 30 - 38: 11(int) Constant 31 - 35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 36 22 30 37 38 16 16 17 - 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 29 19 30 32 33 16 16 17 - 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 29 19 30 32 33 16 16 17 - 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 29 19 30 32 33 16 16 17 - 44: 11(int) Constant 36 - 45: 11(int) Constant 41 - 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 43 10 30 44 45 16 16 17 - 48: 11(int) Constant 37 - 49: 11(int) Constant 42 - 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 47 25 30 48 49 16 16 17 - 52: 11(int) Constant 1 - 53: 11(int) Constant 62 - 55: 11(int) Constant 5 - 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 52 26 30 55 - 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 51 52 30 53 16 54 51 16 17 28 34 35 39 40 41 42 46 - 56: TypePointer Function 27(VSInput) - 57: 11(int) Constant 7 - 58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 50 57 16 - 59: TypeVector 8(float) 4 - 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 10 26 - 61(VSOutput): TypeStruct 59(fvec4) 18(fvec3) 18(fvec3) 18(fvec3) 18(fvec3) 18(fvec3) - 64: 11(int) Constant 53 - 65: 11(int) Constant 13 - 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 63 60 30 64 65 16 16 17 - 68: 11(int) Constant 58 - 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 67 19 30 68 48 16 16 17 - 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 67 19 30 68 48 16 16 17 - 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 67 19 30 68 48 16 16 17 - 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 67 19 30 68 48 16 16 17 - 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 67 19 30 68 48 16 16 17 - 73: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 74 52 30 53 16 54 74 16 17 62 66 69 70 71 72 - 75: TypeFunction 61(VSOutput) 56(ptr) - 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 17 73 50 - 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 80 76 30 53 16 54 80 17 53 - 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 83 50 30 53 16 81 26 52 - 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 30 16 16 81 - 90: TypePointer Function 61(VSOutput) - 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 73 57 16 - 95: 11(int) Constant 63 - 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 94 73 30 95 16 89 26 - 99: 8(float) Constant 0 - 100: 59(fvec4) ConstantComposite 99 99 99 99 - 101: 18(fvec3) ConstantComposite 99 99 99 - 102:61(VSOutput) ConstantComposite 100 101 101 101 101 101 - 103: 23(int) Constant 2 - 104: 23(int) Constant 3 - 105: TypePointer Function 18(fvec3) - 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 19 57 16 - 109: 11(int) Constant 64 - 112: TypePointer Function 20(fvec2) - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 57 16 - 116: 11(int) Constant 65 - 118: 23(int) Constant 7 - 119: TypePointer Function 23(int) - 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 25 57 16 - 128: TypePointer Function 8(float) - 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 57 16 - 133: 11(int) Constant 68 - 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 132 10 30 133 16 89 26 - 136: 23(int) Constant 5 - 139: TypeMatrix 59(fvec4) 4 - 141: TypeBool - 143: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 142 14 21 16 - 144: 141(bool) ConstantTrue - 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 60 26 144 - 145(UBO): TypeStruct 139 139 59(fvec4) 8(float) 8(float) - 148: 11(int) Constant 43 - 149: 11(int) Constant 20 - 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 147 140 30 148 149 16 16 17 - 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 147 140 30 148 149 16 16 17 - 153: 11(int) Constant 44 - 154: 11(int) Constant 17 - 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 152 60 30 153 154 16 16 17 - 157: 11(int) Constant 46 - 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 156 10 30 157 154 16 16 17 - 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 156 10 30 157 154 16 16 17 - 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 160 52 30 133 16 54 160 16 17 146 150 151 155 158 - 161(ubo): TypeStruct 145(UBO) - 164: 11(int) Constant 49 - 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 163 159 30 164 48 16 16 17 - 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 163 52 30 133 16 54 163 16 17 162 - 166: TypePointer Uniform 161(ubo) - 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 165 21 16 - 168: 166(ptr) Variable Uniform - 171: 11(int) Constant 8 - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 170 165 30 133 16 54 170 168 171 - 172: 23(int) Constant 0 - 173: TypePointer Uniform 8(float) - 174: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 21 16 - 182: 11(int) Constant 69 - 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 181 10 30 182 16 89 26 - 191: TypeMatrix 18(fvec3) 3 - 192: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 19 17 144 - 193: TypePointer Function 191 - 194: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 192 57 16 - 198: 11(int) Constant 71 - 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 197 192 30 198 16 89 26 - 206: 11(int) Constant 72 - 208: 8(float) Constant 1065353216 - 216: 11(int) Constant 76 - 224: 11(int) Constant 77 - 233: 11(int) Constant 79 - 231: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 232 192 30 233 16 89 26 - 241: 11(int) Constant 81 - 250: 11(int) Constant 84 - 258: 11(int) Constant 85 - 267: 11(int) Constant 87 - 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 266 192 30 267 16 89 26 - 272: 11(int) Constant 88 - 277: 11(int) Constant 89 - 287: 11(int) Constant 91 - 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 286 192 30 287 16 89 26 - 295: TypePointer Function 139 - 296: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 140 57 16 - 300: 11(int) Constant 93 - 298: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 299 140 30 300 16 89 26 - 305: 11(int) Constant 94 - 307: 23(int) Constant 4 - 314: 11(int) Constant 95 - 322: 11(int) Constant 96 - 326: TypePointer Function 59(fvec4) - 327: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 60 57 16 - 329: 23(int) Constant 1 - 330: 59(fvec4) ConstantComposite 99 208 99 99 - 333: 11(int) Constant 97 - 336: 11(int) Constant 98 - 340: 59(fvec4) ConstantComposite 99 99 99 208 - 343: 11(int) Constant 99 - 347: 11(int) Constant 101 - 345: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 346 60 30 347 16 89 26 - 361: 11(int) Constant 102 - 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 360 60 30 361 16 89 26 - 366: 23(int) Constant 6 - 379: 11(int) Constant 104 - 382: TypePointer Uniform 139 - 383: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 140 21 16 - 393: 11(int) Constant 105 - 412: 11(int) Constant 107 - 427: 11(int) Constant 108 - 425: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 426 19 30 427 16 89 26 - 430: TypePointer Uniform 59(fvec4) - 431: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 60 21 16 - 447: 11(int) Constant 109 - 454: 11(int) Constant 110 - 460: 11(int) Constant 111 - 466: TypePointer Input 18(fvec3) - 467(input.Pos): 466(ptr) Variable Input -470(input.Normal): 466(ptr) Variable Input - 473: TypePointer Input 20(fvec2) - 474(input.UV): 473(ptr) Variable Input -477(input.Color): 466(ptr) Variable Input -480(input.instancePos): 466(ptr) Variable Input -483(input.instanceRot): 466(ptr) Variable Input - 486: TypePointer Input 8(float) -487(input.instanceScale): 486(ptr) Variable Input - 490: TypePointer Input 23(int) -491(input.instanceTexIndex): 490(ptr) Variable Input - 498: TypePointer Output 59(fvec4) -499(@entryPointOutput.Pos): 498(ptr) Variable Output - 502: TypePointer Output 18(fvec3) -503(@entryPointOutput.Normal): 502(ptr) Variable Output -506(@entryPointOutput.Color): 502(ptr) Variable Output -509(@entryPointOutput.UV): 502(ptr) Variable Output -512(@entryPointOutput.ViewVec): 502(ptr) Variable Output -515(@entryPointOutput.LightVec): 502(ptr) Variable Output + 32: 11(int) Constant 28 + 28: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 29 19 30 32 14 16 16 17 + 35: 11(int) Constant 29 + 36: 11(int) Constant 35 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 34 19 30 35 36 16 16 17 + 39: 11(int) Constant 30 + 40: 11(int) Constant 31 + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 38 22 30 39 40 16 16 17 + 43: 11(int) Constant 34 + 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 42 19 30 40 43 16 16 17 + 46: 11(int) Constant 40 + 44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 45 19 30 43 46 16 16 17 + 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 48 19 30 36 46 16 16 17 + 51: 11(int) Constant 36 + 52: 11(int) Constant 41 + 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 50 10 30 51 52 16 16 17 + 55: 11(int) Constant 37 + 56: 11(int) Constant 42 + 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 54 25 30 55 56 16 16 17 + 59: 11(int) Constant 1 + 60: 11(int) Constant 62 + 62: 11(int) Constant 5 + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 59 26 30 62 + 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 58 59 30 60 16 61 58 16 17 28 33 37 41 44 47 49 53 + 63: TypePointer Function 27(VSInput) + 64: 11(int) Constant 7 + 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 57 64 16 + 66: TypeVector 8(float) 4 + 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 10 26 + 68(VSOutput): TypeStruct 66(fvec4) 18(fvec3) 18(fvec3) 18(fvec3) 18(fvec3) 18(fvec3) + 70: 11(int) Constant 53 + 71: 11(int) Constant 13 + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 29 67 30 70 71 16 16 17 + 73: 11(int) Constant 54 + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 34 19 30 73 36 16 16 17 + 75: 11(int) Constant 55 + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 42 19 30 75 43 16 16 17 + 77: 11(int) Constant 56 + 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 38 19 30 77 40 16 16 17 + 80: 11(int) Constant 57 + 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 79 19 30 80 51 16 16 17 + 83: 11(int) Constant 58 + 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 82 19 30 83 55 16 16 17 + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 85 59 30 60 16 61 85 16 17 69 72 74 76 78 81 + 86: TypeFunction 68(VSOutput) 63(ptr) + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 17 84 57 + 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 91 87 30 60 16 61 91 17 60 + 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 94 57 30 60 16 92 26 59 + 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 30 16 16 92 + 101: TypePointer Function 68(VSOutput) + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 84 64 16 + 106: 11(int) Constant 63 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 105 84 30 106 16 100 26 + 110: 8(float) Constant 0 + 111: 66(fvec4) ConstantComposite 110 110 110 110 + 112: 18(fvec3) ConstantComposite 110 110 110 + 113:68(VSOutput) ConstantComposite 111 112 112 112 112 112 + 114: 23(int) Constant 2 + 115: 23(int) Constant 3 + 116: TypePointer Function 18(fvec3) + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 19 64 16 + 120: 11(int) Constant 64 + 123: TypePointer Function 20(fvec2) + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 64 16 + 127: 11(int) Constant 65 + 129: 23(int) Constant 7 + 130: TypePointer Function 23(int) + 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 25 64 16 + 139: TypePointer Function 8(float) + 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 64 16 + 144: 11(int) Constant 68 + 142: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 143 10 30 144 16 100 26 + 147: 23(int) Constant 5 + 150: TypeMatrix 66(fvec4) 4 + 152: TypeBool + 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 153 14 21 16 + 155: 152(bool) ConstantTrue + 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 67 26 155 + 156(UBO): TypeStruct 150 150 66(fvec4) 8(float) 8(float) + 159: 11(int) Constant 21 + 157: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 158 151 30 56 159 16 16 17 + 162: 11(int) Constant 43 + 163: 11(int) Constant 20 + 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 161 151 30 162 163 16 16 17 + 166: 11(int) Constant 44 + 167: 11(int) Constant 17 + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 165 67 30 166 167 16 16 17 + 170: 11(int) Constant 45 + 171: 11(int) Constant 16 + 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 169 10 30 170 171 16 16 17 + 174: 11(int) Constant 46 + 172: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 173 10 30 174 167 16 16 17 + 175: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 176 59 30 144 16 61 176 16 17 157 160 164 168 172 + 177(ubo): TypeStruct 156(UBO) + 180: 11(int) Constant 49 + 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 179 175 30 180 55 16 16 17 + 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 179 59 30 144 16 61 179 16 17 178 + 182: TypePointer Uniform 177(ubo) + 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 181 21 16 + 184: 182(ptr) Variable Uniform + 187: 11(int) Constant 8 + 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 186 181 30 144 16 61 186 184 187 + 188: 23(int) Constant 0 + 189: TypePointer Uniform 8(float) + 190: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 10 21 16 + 198: 11(int) Constant 69 + 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 197 10 30 198 16 100 26 + 207: TypeMatrix 18(fvec3) 3 + 208: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 19 17 155 + 209: TypePointer Function 207 + 210: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 208 64 16 + 214: 11(int) Constant 71 + 212: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 213 208 30 214 16 100 26 + 222: 11(int) Constant 72 + 224: 8(float) Constant 1065353216 + 232: 11(int) Constant 76 + 240: 11(int) Constant 77 + 249: 11(int) Constant 79 + 247: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 248 208 30 249 16 100 26 + 257: 11(int) Constant 81 + 266: 11(int) Constant 84 + 274: 11(int) Constant 85 + 283: 11(int) Constant 87 + 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 282 208 30 283 16 100 26 + 288: 11(int) Constant 88 + 293: 11(int) Constant 89 + 303: 11(int) Constant 91 + 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 302 208 30 303 16 100 26 + 311: TypePointer Function 150 + 312: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 151 64 16 + 316: 11(int) Constant 93 + 314: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 315 151 30 316 16 100 26 + 321: 11(int) Constant 94 + 323: 23(int) Constant 4 + 330: 11(int) Constant 95 + 338: 11(int) Constant 96 + 342: TypePointer Function 66(fvec4) + 343: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 67 64 16 + 345: 23(int) Constant 1 + 346: 66(fvec4) ConstantComposite 110 224 110 110 + 349: 11(int) Constant 97 + 352: 11(int) Constant 98 + 356: 66(fvec4) ConstantComposite 110 110 110 224 + 359: 11(int) Constant 99 + 363: 11(int) Constant 101 + 361: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 362 67 30 363 16 100 26 + 377: 11(int) Constant 102 + 375: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 376 67 30 377 16 100 26 + 382: 23(int) Constant 6 + 395: 11(int) Constant 104 + 398: TypePointer Uniform 150 + 399: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 151 21 16 + 409: 11(int) Constant 105 + 428: 11(int) Constant 107 + 443: 11(int) Constant 108 + 441: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 442 19 30 443 16 100 26 + 446: TypePointer Uniform 66(fvec4) + 447: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 67 21 16 + 463: 11(int) Constant 109 + 470: 11(int) Constant 110 + 476: 11(int) Constant 111 + 482: TypePointer Input 18(fvec3) + 483(input.Pos): 482(ptr) Variable Input +486(input.Normal): 482(ptr) Variable Input + 489: TypePointer Input 20(fvec2) + 490(input.UV): 489(ptr) Variable Input +493(input.Color): 482(ptr) Variable Input +496(input.instancePos): 482(ptr) Variable Input +499(input.instanceRot): 482(ptr) Variable Input + 502: TypePointer Input 8(float) +503(input.instanceScale): 502(ptr) Variable Input + 506: TypePointer Input 23(int) +507(input.instanceTexIndex): 506(ptr) Variable Input + 514: TypePointer Output 66(fvec4) +515(@entryPointOutput.Pos): 514(ptr) Variable Output + 518: TypePointer Output 18(fvec3) +519(@entryPointOutput.Normal): 518(ptr) Variable Output +522(@entryPointOutput.Color): 518(ptr) Variable Output +525(@entryPointOutput.UV): 518(ptr) Variable Output +528(@entryPointOutput.ViewVec): 518(ptr) Variable Output +531(@entryPointOutput.LightVec): 518(ptr) Variable Output 6(main): 4 Function None 5 7: Label - 465(input): 56(ptr) Variable Function -494(flattenTemp): 90(ptr) Variable Function - 495(param): 56(ptr) Variable Function - 468: 18(fvec3) Load 467(input.Pos) - 469: 105(ptr) AccessChain 465(input) 172 - Store 469 468 - 471: 18(fvec3) Load 470(input.Normal) - 472: 105(ptr) AccessChain 465(input) 329 - Store 472 471 - 475: 20(fvec2) Load 474(input.UV) - 476: 112(ptr) AccessChain 465(input) 103 - Store 476 475 - 478: 18(fvec3) Load 477(input.Color) - 479: 105(ptr) AccessChain 465(input) 104 - Store 479 478 - 481: 18(fvec3) Load 480(input.instancePos) - 482: 105(ptr) AccessChain 465(input) 307 - Store 482 481 - 484: 18(fvec3) Load 483(input.instanceRot) - 485: 105(ptr) AccessChain 465(input) 136 + 481(input): 63(ptr) Variable Function +510(flattenTemp): 101(ptr) Variable Function + 511(param): 63(ptr) Variable Function + 484: 18(fvec3) Load 483(input.Pos) + 485: 116(ptr) AccessChain 481(input) 188 Store 485 484 - 488: 8(float) Load 487(input.instanceScale) - 489: 128(ptr) AccessChain 465(input) 366 - Store 489 488 - 492: 23(int) Load 491(input.instanceTexIndex) - 493: 119(ptr) AccessChain 465(input) 118 - Store 493 492 - 496: 27(VSInput) Load 465(input) - Store 495(param) 496 - 497:61(VSOutput) FunctionCall 78(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;) 495(param) - Store 494(flattenTemp) 497 - 500: 326(ptr) AccessChain 494(flattenTemp) 172 - 501: 59(fvec4) Load 500 - Store 499(@entryPointOutput.Pos) 501 - 504: 105(ptr) AccessChain 494(flattenTemp) 329 - 505: 18(fvec3) Load 504 - Store 503(@entryPointOutput.Normal) 505 - 507: 105(ptr) AccessChain 494(flattenTemp) 103 - 508: 18(fvec3) Load 507 - Store 506(@entryPointOutput.Color) 508 - 510: 105(ptr) AccessChain 494(flattenTemp) 104 - 511: 18(fvec3) Load 510 - Store 509(@entryPointOutput.UV) 511 - 513: 105(ptr) AccessChain 494(flattenTemp) 307 - 514: 18(fvec3) Load 513 - Store 512(@entryPointOutput.ViewVec) 514 - 516: 105(ptr) AccessChain 494(flattenTemp) 136 - 517: 18(fvec3) Load 516 - Store 515(@entryPointOutput.LightVec) 517 + 487: 18(fvec3) Load 486(input.Normal) + 488: 116(ptr) AccessChain 481(input) 345 + Store 488 487 + 491: 20(fvec2) Load 490(input.UV) + 492: 123(ptr) AccessChain 481(input) 114 + Store 492 491 + 494: 18(fvec3) Load 493(input.Color) + 495: 116(ptr) AccessChain 481(input) 115 + Store 495 494 + 497: 18(fvec3) Load 496(input.instancePos) + 498: 116(ptr) AccessChain 481(input) 323 + Store 498 497 + 500: 18(fvec3) Load 499(input.instanceRot) + 501: 116(ptr) AccessChain 481(input) 147 + Store 501 500 + 504: 8(float) Load 503(input.instanceScale) + 505: 139(ptr) AccessChain 481(input) 382 + Store 505 504 + 508: 23(int) Load 507(input.instanceTexIndex) + 509: 130(ptr) AccessChain 481(input) 129 + Store 509 508 + 512: 27(VSInput) Load 481(input) + Store 511(param) 512 + 513:68(VSOutput) FunctionCall 89(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;) 511(param) + Store 510(flattenTemp) 513 + 516: 342(ptr) AccessChain 510(flattenTemp) 188 + 517: 66(fvec4) Load 516 + Store 515(@entryPointOutput.Pos) 517 + 520: 116(ptr) AccessChain 510(flattenTemp) 345 + 521: 18(fvec3) Load 520 + Store 519(@entryPointOutput.Normal) 521 + 523: 116(ptr) AccessChain 510(flattenTemp) 114 + 524: 18(fvec3) Load 523 + Store 522(@entryPointOutput.Color) 524 + 526: 116(ptr) AccessChain 510(flattenTemp) 115 + 527: 18(fvec3) Load 526 + Store 525(@entryPointOutput.UV) 527 + 529: 116(ptr) AccessChain 510(flattenTemp) 323 + 530: 18(fvec3) Load 529 + Store 528(@entryPointOutput.ViewVec) 530 + 532: 116(ptr) AccessChain 510(flattenTemp) 147 + 533: 18(fvec3) Load 532 + Store 531(@entryPointOutput.LightVec) 533 Return FunctionEnd -78(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;):61(VSOutput) Function None 75 - 77(input): 56(ptr) FunctionParameter - 79: Label - 92(output): 90(ptr) Variable Function - 130(s): 128(ptr) Variable Function - 179(c): 128(ptr) Variable Function - 195(mx): 193(ptr) Variable Function - 230(my): 193(ptr) Variable Function - 264(mz): 193(ptr) Variable Function - 284(rotMat): 193(ptr) Variable Function - 297(gRotMat): 295(ptr) Variable Function - 344(locPos): 326(ptr) Variable Function - 358(pos): 326(ptr) Variable Function - 424(lPos): 105(ptr) Variable Function - 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 81 - 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 53 53 16 16 - 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 82 77(input) 85 - 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 81 78(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;) - 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 89 - 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 95 95 16 16 - 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 93 92(output) 85 - Store 92(output) 102 - 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 109 109 16 16 - 107: 105(ptr) AccessChain 77(input) 104 - 110: 18(fvec3) Load 107 - 111: 105(ptr) AccessChain 92(output) 103 - Store 111 110 - 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 116 116 16 16 - 114: 112(ptr) AccessChain 77(input) 103 - 117: 20(fvec2) Load 114 - 121: 119(ptr) AccessChain 77(input) 118 - 122: 23(int) Load 121 - 123: 8(float) ConvertSToF 122 - 124: 8(float) CompositeExtract 117 0 - 125: 8(float) CompositeExtract 117 1 - 126: 18(fvec3) CompositeConstruct 124 125 123 - 127: 105(ptr) AccessChain 92(output) 104 - Store 127 126 - 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 133 133 16 16 - 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 131 130(s) 85 - 137: 128(ptr) AccessChain 77(input) 136 16 - 138: 8(float) Load 137 - 175: 173(ptr) AccessChain 168 172 104 - 176: 8(float) Load 175 - 177: 8(float) FAdd 138 176 - 178: 8(float) ExtInst 3(GLSL.std.450) 13(Sin) 177 - Store 130(s) 178 - 184: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 182 182 16 16 - 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 180 179(c) 85 - 185: 128(ptr) AccessChain 77(input) 136 16 - 186: 8(float) Load 185 - 187: 173(ptr) AccessChain 168 172 104 - 188: 8(float) Load 187 - 189: 8(float) FAdd 186 188 - 190: 8(float) ExtInst 3(GLSL.std.450) 14(Cos) 189 - Store 179(c) 190 +89(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;):68(VSOutput) Function None 86 + 88(input): 63(ptr) FunctionParameter + 90: Label + 103(output): 101(ptr) Variable Function + 141(s): 139(ptr) Variable Function + 195(c): 139(ptr) Variable Function + 211(mx): 209(ptr) Variable Function + 246(my): 209(ptr) Variable Function + 280(mz): 209(ptr) Variable Function + 300(rotMat): 209(ptr) Variable Function + 313(gRotMat): 311(ptr) Variable Function + 360(locPos): 342(ptr) Variable Function + 374(pos): 342(ptr) Variable Function + 440(lPos): 116(ptr) Variable Function + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 92 + 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 60 60 16 16 + 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 93 88(input) 96 + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 92 89(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;) + 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 100 + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 106 106 16 16 + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 104 103(output) 96 + Store 103(output) 113 + 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 120 120 16 16 + 118: 116(ptr) AccessChain 88(input) 115 + 121: 18(fvec3) Load 118 + 122: 116(ptr) AccessChain 103(output) 114 + Store 122 121 + 126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 127 127 16 16 + 125: 123(ptr) AccessChain 88(input) 114 + 128: 20(fvec2) Load 125 + 132: 130(ptr) AccessChain 88(input) 129 + 133: 23(int) Load 132 + 134: 8(float) ConvertSToF 133 + 135: 8(float) CompositeExtract 128 0 + 136: 8(float) CompositeExtract 128 1 + 137: 18(fvec3) CompositeConstruct 135 136 134 + 138: 116(ptr) AccessChain 103(output) 115 + Store 138 137 + 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 144 144 16 16 + 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 142 141(s) 96 + 148: 139(ptr) AccessChain 88(input) 147 16 + 149: 8(float) Load 148 + 191: 189(ptr) AccessChain 184 188 115 + 192: 8(float) Load 191 + 193: 8(float) FAdd 149 192 + 194: 8(float) ExtInst 3(GLSL.std.450) 13(Sin) 193 + Store 141(s) 194 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 198 198 16 16 - 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 196 195(mx) 85 - 201: 8(float) Load 179(c) - 202: 8(float) Load 130(s) - 203: 8(float) FNegate 202 - 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 206 206 16 16 - 204: 8(float) Load 130(s) - 207: 8(float) Load 179(c) - 210: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 198 198 16 16 - 209: 18(fvec3) CompositeConstruct 201 203 99 - 211: 18(fvec3) CompositeConstruct 204 207 99 - 212: 18(fvec3) CompositeConstruct 99 99 208 - 213: 191 CompositeConstruct 209 211 212 - Store 195(mx) 213 - 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 216 216 16 16 - 214: 128(ptr) AccessChain 77(input) 136 52 - 217: 8(float) Load 214 - 218: 173(ptr) AccessChain 168 172 104 - 219: 8(float) Load 218 - 220: 8(float) FAdd 217 219 - 221: 8(float) ExtInst 3(GLSL.std.450) 13(Sin) 220 - Store 130(s) 221 - 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 224 224 16 16 - 222: 128(ptr) AccessChain 77(input) 136 52 - 225: 8(float) Load 222 - 226: 173(ptr) AccessChain 168 172 104 - 227: 8(float) Load 226 - 228: 8(float) FAdd 225 227 - 229: 8(float) ExtInst 3(GLSL.std.450) 14(Cos) 228 - Store 179(c) 229 - 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 233 233 16 16 - 234: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 231 230(my) 85 - 236: 8(float) Load 179(c) - 237: 8(float) Load 130(s) - 238: 8(float) FNegate 237 - 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 241 241 16 16 - 239: 8(float) Load 130(s) - 242: 8(float) Load 179(c) - 244: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 233 233 16 16 - 243: 18(fvec3) CompositeConstruct 236 99 238 - 245: 18(fvec3) CompositeConstruct 99 208 99 - 246: 18(fvec3) CompositeConstruct 239 99 242 - 247: 191 CompositeConstruct 243 245 246 - Store 230(my) 247 - 249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 250 250 16 16 - 248: 128(ptr) AccessChain 77(input) 136 21 - 251: 8(float) Load 248 - 252: 173(ptr) AccessChain 168 172 104 - 253: 8(float) Load 252 - 254: 8(float) FAdd 251 253 - 255: 8(float) ExtInst 3(GLSL.std.450) 13(Sin) 254 - Store 130(s) 255 - 257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 258 258 16 16 - 256: 128(ptr) AccessChain 77(input) 136 21 - 259: 8(float) Load 256 - 260: 173(ptr) AccessChain 168 172 104 - 261: 8(float) Load 260 - 262: 8(float) FAdd 259 261 - 263: 8(float) ExtInst 3(GLSL.std.450) 14(Cos) 262 - Store 179(c) 263 - 269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 267 267 16 16 - 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 265 264(mz) 85 - 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 272 272 16 16 - 270: 8(float) Load 179(c) - 273: 8(float) Load 130(s) - 274: 8(float) FNegate 273 - 276: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 277 277 16 16 - 275: 8(float) Load 130(s) - 278: 8(float) Load 179(c) - 280: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 267 267 16 16 - 279: 18(fvec3) CompositeConstruct 208 99 99 - 281: 18(fvec3) CompositeConstruct 99 270 274 - 282: 18(fvec3) CompositeConstruct 99 275 278 - 283: 191 CompositeConstruct 279 281 282 - Store 264(mz) 283 - 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 287 287 16 16 - 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 285 284(rotMat) 85 - 290: 191 Load 195(mx) - 291: 191 Load 230(my) - 292: 191 MatrixTimesMatrix 290 291 - 293: 191 Load 264(mz) - 294: 191 MatrixTimesMatrix 292 293 - Store 284(rotMat) 294 - 302: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 300 300 16 16 - 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 298 297(gRotMat) 85 - 304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 305 305 16 16 - 303: 128(ptr) AccessChain 77(input) 136 52 - 306: 8(float) Load 303 - 308: 173(ptr) AccessChain 168 172 307 - 309: 8(float) Load 308 - 310: 8(float) FAdd 306 309 - 311: 8(float) ExtInst 3(GLSL.std.450) 13(Sin) 310 - Store 130(s) 311 - 313: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 314 314 16 16 - 312: 128(ptr) AccessChain 77(input) 136 52 - 315: 8(float) Load 312 - 316: 173(ptr) AccessChain 168 172 307 - 317: 8(float) Load 316 - 318: 8(float) FAdd 315 317 - 319: 8(float) ExtInst 3(GLSL.std.450) 14(Cos) 318 - Store 179(c) 319 - 321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 322 322 16 16 - 320: 8(float) Load 179(c) - 323: 8(float) Load 130(s) - 324: 8(float) FNegate 323 - 325: 59(fvec4) CompositeConstruct 320 99 324 99 - 328: 326(ptr) AccessChain 297(gRotMat) 172 - Store 328 325 - 332: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 333 333 16 16 - 331: 326(ptr) AccessChain 297(gRotMat) 329 - Store 331 330 - 335: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 336 336 16 16 - 334: 8(float) Load 130(s) - 337: 8(float) Load 179(c) - 338: 59(fvec4) CompositeConstruct 334 99 337 99 - 339: 326(ptr) AccessChain 297(gRotMat) 103 - Store 339 338 - 342: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 343 343 16 16 - 341: 326(ptr) AccessChain 297(gRotMat) 104 - Store 341 340 - 349: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 347 347 16 16 - 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 345 344(locPos) 85 - 350: 105(ptr) AccessChain 77(input) 172 - 351: 18(fvec3) Load 350 - 352: 191 Load 284(rotMat) - 353: 18(fvec3) VectorTimesMatrix 351 352 - 354: 8(float) CompositeExtract 353 0 - 355: 8(float) CompositeExtract 353 1 - 356: 8(float) CompositeExtract 353 2 - 357: 59(fvec4) CompositeConstruct 354 355 356 208 - Store 344(locPos) 357 - 363: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 361 361 16 16 - 362: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 359 358(pos) 85 - 364: 59(fvec4) Load 344(locPos) - 365: 18(fvec3) VectorShuffle 364 364 0 1 2 - 367: 128(ptr) AccessChain 77(input) 366 - 368: 8(float) Load 367 - 369: 18(fvec3) VectorTimesScalar 365 368 - 370: 105(ptr) AccessChain 77(input) 307 - 371: 18(fvec3) Load 370 - 372: 18(fvec3) FAdd 369 371 - 373: 8(float) CompositeExtract 372 0 - 374: 8(float) CompositeExtract 372 1 - 375: 8(float) CompositeExtract 372 2 - 376: 59(fvec4) CompositeConstruct 373 374 375 208 - Store 358(pos) 376 - 378: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 379 379 16 16 - 377: 59(fvec4) Load 358(pos) - 380: 139 Load 297(gRotMat) - 381: 59(fvec4) VectorTimesMatrix 377 380 - 384: 382(ptr) AccessChain 168 172 329 - 385: 139 Load 384 - 386: 59(fvec4) VectorTimesMatrix 381 385 - 387: 382(ptr) AccessChain 168 172 172 - 388: 139 Load 387 - 389: 59(fvec4) VectorTimesMatrix 386 388 - 390: 326(ptr) AccessChain 92(output) 172 - Store 390 389 - 392: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 393 393 16 16 - 391: 105(ptr) AccessChain 77(input) 329 - 394: 18(fvec3) Load 391 - 395: 191 Load 284(rotMat) - 396: 18(fvec3) VectorTimesMatrix 394 395 - 397: 139 Load 297(gRotMat) - 398: 382(ptr) AccessChain 168 172 329 - 399: 139 Load 398 - 400: 139 MatrixTimesMatrix 397 399 - 401: 59(fvec4) CompositeExtract 400 0 - 402: 18(fvec3) VectorShuffle 401 401 0 1 2 - 403: 59(fvec4) CompositeExtract 400 1 - 404: 18(fvec3) VectorShuffle 403 403 0 1 2 - 405: 59(fvec4) CompositeExtract 400 2 - 406: 18(fvec3) VectorShuffle 405 405 0 1 2 - 407: 191 CompositeConstruct 402 404 406 - 408: 18(fvec3) VectorTimesMatrix 396 407 - 409: 105(ptr) AccessChain 92(output) 329 - Store 409 408 - 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 412 412 16 16 - 410: 105(ptr) AccessChain 77(input) 172 - 413: 18(fvec3) Load 410 - 414: 105(ptr) AccessChain 77(input) 307 - 415: 18(fvec3) Load 414 - 416: 18(fvec3) FAdd 413 415 - 417: 8(float) CompositeExtract 416 0 - 418: 8(float) CompositeExtract 416 1 - 419: 8(float) CompositeExtract 416 2 - 420: 59(fvec4) CompositeConstruct 417 418 419 208 - 421: 382(ptr) AccessChain 168 172 329 - 422: 139 Load 421 - 423: 59(fvec4) VectorTimesMatrix 420 422 - Store 358(pos) 423 - 429: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 427 427 16 16 - 428: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 425 424(lPos) 85 - 432: 430(ptr) AccessChain 168 172 103 - 433: 59(fvec4) Load 432 - 434: 18(fvec3) VectorShuffle 433 433 0 1 2 - 435: 382(ptr) AccessChain 168 172 329 - 436: 139 Load 435 - 437: 59(fvec4) CompositeExtract 436 0 - 438: 18(fvec3) VectorShuffle 437 437 0 1 2 - 439: 59(fvec4) CompositeExtract 436 1 - 440: 18(fvec3) VectorShuffle 439 439 0 1 2 - 441: 59(fvec4) CompositeExtract 436 2 - 442: 18(fvec3) VectorShuffle 441 441 0 1 2 - 443: 191 CompositeConstruct 438 440 442 - 444: 18(fvec3) VectorTimesMatrix 434 443 - Store 424(lPos) 444 - 446: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 447 447 16 16 - 445: 18(fvec3) Load 424(lPos) - 448: 59(fvec4) Load 358(pos) - 449: 18(fvec3) VectorShuffle 448 448 0 1 2 - 450: 18(fvec3) FSub 445 449 - 451: 105(ptr) AccessChain 92(output) 136 - Store 451 450 - 453: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 454 454 16 16 - 452: 59(fvec4) Load 358(pos) - 455: 18(fvec3) VectorShuffle 452 452 0 1 2 - 456: 18(fvec3) FNegate 455 - 457: 105(ptr) AccessChain 92(output) 307 - Store 457 456 - 459: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 460 460 16 16 - 458:61(VSOutput) Load 92(output) - ReturnValue 458 + 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 196 195(c) 96 + 201: 139(ptr) AccessChain 88(input) 147 16 + 202: 8(float) Load 201 + 203: 189(ptr) AccessChain 184 188 115 + 204: 8(float) Load 203 + 205: 8(float) FAdd 202 204 + 206: 8(float) ExtInst 3(GLSL.std.450) 14(Cos) 205 + Store 195(c) 206 + 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 214 214 16 16 + 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 212 211(mx) 96 + 217: 8(float) Load 195(c) + 218: 8(float) Load 141(s) + 219: 8(float) FNegate 218 + 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 222 222 16 16 + 220: 8(float) Load 141(s) + 223: 8(float) Load 195(c) + 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 214 214 16 16 + 225: 18(fvec3) CompositeConstruct 217 219 110 + 227: 18(fvec3) CompositeConstruct 220 223 110 + 228: 18(fvec3) CompositeConstruct 110 110 224 + 229: 207 CompositeConstruct 225 227 228 + Store 211(mx) 229 + 231: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 232 232 16 16 + 230: 139(ptr) AccessChain 88(input) 147 59 + 233: 8(float) Load 230 + 234: 189(ptr) AccessChain 184 188 115 + 235: 8(float) Load 234 + 236: 8(float) FAdd 233 235 + 237: 8(float) ExtInst 3(GLSL.std.450) 13(Sin) 236 + Store 141(s) 237 + 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 240 240 16 16 + 238: 139(ptr) AccessChain 88(input) 147 59 + 241: 8(float) Load 238 + 242: 189(ptr) AccessChain 184 188 115 + 243: 8(float) Load 242 + 244: 8(float) FAdd 241 243 + 245: 8(float) ExtInst 3(GLSL.std.450) 14(Cos) 244 + Store 195(c) 245 + 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 249 249 16 16 + 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 247 246(my) 96 + 252: 8(float) Load 195(c) + 253: 8(float) Load 141(s) + 254: 8(float) FNegate 253 + 256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 257 257 16 16 + 255: 8(float) Load 141(s) + 258: 8(float) Load 195(c) + 260: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 249 249 16 16 + 259: 18(fvec3) CompositeConstruct 252 110 254 + 261: 18(fvec3) CompositeConstruct 110 224 110 + 262: 18(fvec3) CompositeConstruct 255 110 258 + 263: 207 CompositeConstruct 259 261 262 + Store 246(my) 263 + 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 266 266 16 16 + 264: 139(ptr) AccessChain 88(input) 147 21 + 267: 8(float) Load 264 + 268: 189(ptr) AccessChain 184 188 115 + 269: 8(float) Load 268 + 270: 8(float) FAdd 267 269 + 271: 8(float) ExtInst 3(GLSL.std.450) 13(Sin) 270 + Store 141(s) 271 + 273: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 274 274 16 16 + 272: 139(ptr) AccessChain 88(input) 147 21 + 275: 8(float) Load 272 + 276: 189(ptr) AccessChain 184 188 115 + 277: 8(float) Load 276 + 278: 8(float) FAdd 275 277 + 279: 8(float) ExtInst 3(GLSL.std.450) 14(Cos) 278 + Store 195(c) 279 + 285: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 283 283 16 16 + 284: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 281 280(mz) 96 + 287: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 288 288 16 16 + 286: 8(float) Load 195(c) + 289: 8(float) Load 141(s) + 290: 8(float) FNegate 289 + 292: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 293 293 16 16 + 291: 8(float) Load 141(s) + 294: 8(float) Load 195(c) + 296: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 283 283 16 16 + 295: 18(fvec3) CompositeConstruct 224 110 110 + 297: 18(fvec3) CompositeConstruct 110 286 290 + 298: 18(fvec3) CompositeConstruct 110 291 294 + 299: 207 CompositeConstruct 295 297 298 + Store 280(mz) 299 + 305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 303 303 16 16 + 304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 301 300(rotMat) 96 + 306: 207 Load 211(mx) + 307: 207 Load 246(my) + 308: 207 MatrixTimesMatrix 306 307 + 309: 207 Load 280(mz) + 310: 207 MatrixTimesMatrix 308 309 + Store 300(rotMat) 310 + 318: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 316 316 16 16 + 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 314 313(gRotMat) 96 + 320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 321 321 16 16 + 319: 139(ptr) AccessChain 88(input) 147 59 + 322: 8(float) Load 319 + 324: 189(ptr) AccessChain 184 188 323 + 325: 8(float) Load 324 + 326: 8(float) FAdd 322 325 + 327: 8(float) ExtInst 3(GLSL.std.450) 13(Sin) 326 + Store 141(s) 327 + 329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 330 330 16 16 + 328: 139(ptr) AccessChain 88(input) 147 59 + 331: 8(float) Load 328 + 332: 189(ptr) AccessChain 184 188 323 + 333: 8(float) Load 332 + 334: 8(float) FAdd 331 333 + 335: 8(float) ExtInst 3(GLSL.std.450) 14(Cos) 334 + Store 195(c) 335 + 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 338 338 16 16 + 336: 8(float) Load 195(c) + 339: 8(float) Load 141(s) + 340: 8(float) FNegate 339 + 341: 66(fvec4) CompositeConstruct 336 110 340 110 + 344: 342(ptr) AccessChain 313(gRotMat) 188 + Store 344 341 + 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 349 349 16 16 + 347: 342(ptr) AccessChain 313(gRotMat) 345 + Store 347 346 + 351: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 352 352 16 16 + 350: 8(float) Load 141(s) + 353: 8(float) Load 195(c) + 354: 66(fvec4) CompositeConstruct 350 110 353 110 + 355: 342(ptr) AccessChain 313(gRotMat) 114 + Store 355 354 + 358: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 359 359 16 16 + 357: 342(ptr) AccessChain 313(gRotMat) 115 + Store 357 356 + 365: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 363 363 16 16 + 364: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 361 360(locPos) 96 + 366: 116(ptr) AccessChain 88(input) 188 + 367: 18(fvec3) Load 366 + 368: 207 Load 300(rotMat) + 369: 18(fvec3) VectorTimesMatrix 367 368 + 370: 8(float) CompositeExtract 369 0 + 371: 8(float) CompositeExtract 369 1 + 372: 8(float) CompositeExtract 369 2 + 373: 66(fvec4) CompositeConstruct 370 371 372 224 + Store 360(locPos) 373 + 379: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 377 377 16 16 + 378: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 375 374(pos) 96 + 380: 66(fvec4) Load 360(locPos) + 381: 18(fvec3) VectorShuffle 380 380 0 1 2 + 383: 139(ptr) AccessChain 88(input) 382 + 384: 8(float) Load 383 + 385: 18(fvec3) VectorTimesScalar 381 384 + 386: 116(ptr) AccessChain 88(input) 323 + 387: 18(fvec3) Load 386 + 388: 18(fvec3) FAdd 385 387 + 389: 8(float) CompositeExtract 388 0 + 390: 8(float) CompositeExtract 388 1 + 391: 8(float) CompositeExtract 388 2 + 392: 66(fvec4) CompositeConstruct 389 390 391 224 + Store 374(pos) 392 + 394: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 395 395 16 16 + 393: 66(fvec4) Load 374(pos) + 396: 150 Load 313(gRotMat) + 397: 66(fvec4) VectorTimesMatrix 393 396 + 400: 398(ptr) AccessChain 184 188 345 + 401: 150 Load 400 + 402: 66(fvec4) VectorTimesMatrix 397 401 + 403: 398(ptr) AccessChain 184 188 188 + 404: 150 Load 403 + 405: 66(fvec4) VectorTimesMatrix 402 404 + 406: 342(ptr) AccessChain 103(output) 188 + Store 406 405 + 408: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 409 409 16 16 + 407: 116(ptr) AccessChain 88(input) 345 + 410: 18(fvec3) Load 407 + 411: 207 Load 300(rotMat) + 412: 18(fvec3) VectorTimesMatrix 410 411 + 413: 150 Load 313(gRotMat) + 414: 398(ptr) AccessChain 184 188 345 + 415: 150 Load 414 + 416: 150 MatrixTimesMatrix 413 415 + 417: 66(fvec4) CompositeExtract 416 0 + 418: 18(fvec3) VectorShuffle 417 417 0 1 2 + 419: 66(fvec4) CompositeExtract 416 1 + 420: 18(fvec3) VectorShuffle 419 419 0 1 2 + 421: 66(fvec4) CompositeExtract 416 2 + 422: 18(fvec3) VectorShuffle 421 421 0 1 2 + 423: 207 CompositeConstruct 418 420 422 + 424: 18(fvec3) VectorTimesMatrix 412 423 + 425: 116(ptr) AccessChain 103(output) 345 + Store 425 424 + 427: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 428 428 16 16 + 426: 116(ptr) AccessChain 88(input) 188 + 429: 18(fvec3) Load 426 + 430: 116(ptr) AccessChain 88(input) 323 + 431: 18(fvec3) Load 430 + 432: 18(fvec3) FAdd 429 431 + 433: 8(float) CompositeExtract 432 0 + 434: 8(float) CompositeExtract 432 1 + 435: 8(float) CompositeExtract 432 2 + 436: 66(fvec4) CompositeConstruct 433 434 435 224 + 437: 398(ptr) AccessChain 184 188 345 + 438: 150 Load 437 + 439: 66(fvec4) VectorTimesMatrix 436 438 + Store 374(pos) 439 + 445: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 443 443 16 16 + 444: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 441 440(lPos) 96 + 448: 446(ptr) AccessChain 184 188 114 + 449: 66(fvec4) Load 448 + 450: 18(fvec3) VectorShuffle 449 449 0 1 2 + 451: 398(ptr) AccessChain 184 188 345 + 452: 150 Load 451 + 453: 66(fvec4) CompositeExtract 452 0 + 454: 18(fvec3) VectorShuffle 453 453 0 1 2 + 455: 66(fvec4) CompositeExtract 452 1 + 456: 18(fvec3) VectorShuffle 455 455 0 1 2 + 457: 66(fvec4) CompositeExtract 452 2 + 458: 18(fvec3) VectorShuffle 457 457 0 1 2 + 459: 207 CompositeConstruct 454 456 458 + 460: 18(fvec3) VectorTimesMatrix 450 459 + Store 440(lPos) 460 + 462: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 463 463 16 16 + 461: 18(fvec3) Load 440(lPos) + 464: 66(fvec4) Load 374(pos) + 465: 18(fvec3) VectorShuffle 464 464 0 1 2 + 466: 18(fvec3) FSub 461 465 + 467: 116(ptr) AccessChain 103(output) 147 + Store 467 466 + 469: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 470 470 16 16 + 468: 66(fvec4) Load 374(pos) + 471: 18(fvec3) VectorShuffle 468 468 0 1 2 + 472: 18(fvec3) FNegate 471 + 473: 116(ptr) AccessChain 103(output) 323 + Store 473 472 + 475: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 30 476 476 16 16 + 474:68(VSOutput) Load 103(output) + ReturnValue 474 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.implicit_br.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.implicit_br.glsl.frag.out index 7a3ef97563..a5c0dffc1b 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.implicit_br.glsl.frag.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.implicit_br.glsl.frag.out @@ -8,7 +8,7 @@ spv.debuginfo.implicit_br.glsl.frag 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 14 "main" 196 + EntryPoint Fragment 14 "main" 54 ExecutionMode 14 OriginUpperLeft 2: String "spv.debuginfo.implicit_br.glsl.frag" 8: String "uint" @@ -86,18 +86,18 @@ void main() { 43: String "test_switch" 46: String "main" 50: String "int" - 56: String "counter" - 65: String "bool" - 198: String "outx" + 56: String "outx" + 62: String "counter" + 70: String "bool" Name 14 "main" Name 16 "test_if(" Name 26 "test_ifelse(" Name 31 "test_if_compound(" Name 36 "test_if_compound2(" Name 41 "test_switch(" - Name 54 "counter" - Name 196 "outx" - Decorate 196(outx) Location 0 + Name 54 "outx" + Name 60 "counter" + Decorate 54(outx) Location 0 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -125,211 +125,211 @@ void main() { 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 46 6 20 48 12 22 46 13 48 49: TypeInt 32 1 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 50 10 24 12 - 52: TypePointer Private 49(int) - 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 51 11 12 - 54(counter): 52(ptr) Variable Private + 52: TypePointer Output 49(int) + 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 51 13 12 + 54(outx): 52(ptr) Variable Output 57: 7(int) Constant 8 - 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 56 51 20 24 12 22 56 54(counter) 57 - 58: 49(int) Constant 0 - 64: TypeBool - 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 65 10 25 12 - 67: 64(bool) ConstantFalse - 71: 7(int) Constant 17 - 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 57 71 19 - 72: 49(int) Constant 1 - 79: 7(int) Constant 10 - 86: 7(int) Constant 14 - 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 86 71 29 - 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 71 71 29 - 93: 49(int) Constant 2 - 100: 7(int) Constant 19 - 107: 7(int) Constant 23 - 108: 7(int) Constant 9 - 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 107 108 34 - 114: 7(int) Constant 24 - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 114 35 106 - 121: 7(int) Constant 27 - 128: 7(int) Constant 31 - 127: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 128 108 39 - 133: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 10 35 127 - 141: 7(int) Constant 35 - 145: 7(int) Constant 37 - 156: 7(int) Constant 42 - 161: 7(int) Constant 45 - 164: 7(int) Constant 46 - 166: 49(int) Constant 3 - 170: 7(int) Constant 48 - 175: 7(int) Constant 51 - 181: 7(int) Constant 54 - 184: 7(int) Constant 55 - 187: 7(int) Constant 56 - 190: 7(int) Constant 57 - 193: 7(int) Constant 58 - 194: TypePointer Output 49(int) - 195: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 51 13 12 - 196(outx): 194(ptr) Variable Output - 199: 7(int) Constant 59 - 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 198 51 20 199 12 22 198 196(outx) 57 + 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 56 51 20 13 12 22 56 54(outx) 57 + 58: TypePointer Private 49(int) + 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 51 11 12 + 60(counter): 58(ptr) Variable Private + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 62 51 20 24 12 22 62 60(counter) 57 + 63: 49(int) Constant 0 + 69: TypeBool + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 70 10 25 12 + 72: 69(bool) ConstantFalse + 76: 7(int) Constant 17 + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 57 76 19 + 77: 49(int) Constant 1 + 84: 7(int) Constant 10 + 91: 7(int) Constant 14 + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 91 76 29 + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 76 76 29 + 98: 49(int) Constant 2 + 105: 7(int) Constant 19 + 112: 7(int) Constant 23 + 113: 7(int) Constant 9 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 112 113 34 + 119: 7(int) Constant 24 + 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 119 35 111 + 126: 7(int) Constant 27 + 133: 7(int) Constant 31 + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 133 113 39 + 138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 10 35 132 + 146: 7(int) Constant 35 + 150: 7(int) Constant 37 + 161: 7(int) Constant 42 + 166: 7(int) Constant 45 + 169: 7(int) Constant 46 + 171: 49(int) Constant 3 + 175: 7(int) Constant 48 + 180: 7(int) Constant 51 + 186: 7(int) Constant 54 + 189: 7(int) Constant 55 + 192: 7(int) Constant 56 + 195: 7(int) Constant 57 + 198: 7(int) Constant 58 + 201: 7(int) Constant 59 203: 7(int) Constant 60 14(main): 4 Function None 5 15: Label - 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 22 - 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 24 24 12 12 - Store 54(counter) 58 - 177: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 47 - 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 48 48 12 12 - 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 47 14(main) - 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 181 181 12 12 - 179: 4 FunctionCall 16(test_if() - 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 184 184 12 12 - 182: 4 FunctionCall 26(test_ifelse() - 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 187 187 12 12 - 185: 4 FunctionCall 31(test_if_compound() - 189: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 190 190 12 12 - 188: 4 FunctionCall 36(test_if_compound2() - 192: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 193 193 12 12 - 191: 4 FunctionCall 41(test_switch() - 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 199 199 12 12 - 200: 49(int) Load 54(counter) - Store 196(outx) 200 + 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 22 + 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 24 24 12 12 + Store 60(counter) 63 + 182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 47 + 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 48 48 12 12 + 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 47 14(main) + 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 186 186 12 12 + 184: 4 FunctionCall 16(test_if() + 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 189 189 12 12 + 187: 4 FunctionCall 26(test_ifelse() + 191: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 192 192 12 12 + 190: 4 FunctionCall 31(test_if_compound() + 194: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 195 195 12 12 + 193: 4 FunctionCall 36(test_if_compound2() + 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 198 198 12 12 + 196: 4 FunctionCall 41(test_switch() + 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 201 201 12 12 + 199: 49(int) Load 60(counter) + Store 54(outx) 199 202: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 203 203 12 12 Return FunctionEnd 16(test_if(): 4 Function None 5 17: Label - 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19 - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 11 11 12 12 - 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 19 16(test_if() - SelectionMerge 69 None - BranchConditional 67 68 69 - 68: Label - 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 70 - 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 57 57 12 12 - 73: 49(int) Load 54(counter) - 76: 49(int) IAdd 73 72 - Store 54(counter) 76 - Branch 69 - 69: Label - 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19 - 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 79 79 12 12 + 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19 + 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 11 11 12 12 + 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 19 16(test_if() + SelectionMerge 74 None + BranchConditional 72 73 74 + 73: Label + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 75 + 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 57 57 12 12 + 78: 49(int) Load 60(counter) + 81: 49(int) IAdd 78 77 + Store 60(counter) 81 + Branch 74 + 74: Label + 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19 + 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 84 84 12 12 Return FunctionEnd 26(test_ifelse(): 4 Function None 5 27: Label - 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 29 - 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 30 30 12 12 - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 29 26(test_ifelse() - SelectionMerge 84 None - BranchConditional 67 83 91 - 83: Label - 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 85 - 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 86 86 12 12 - 87: 49(int) Load 54(counter) - 90: 49(int) IAdd 87 72 - Store 54(counter) 90 - Branch 84 - 91: Label - 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 92 - 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 71 71 12 12 - 94: 49(int) Load 54(counter) - 97: 49(int) IAdd 94 93 - Store 54(counter) 97 - Branch 84 - 84: Label - 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 29 - 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 100 100 12 12 + 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 29 + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 30 30 12 12 + 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 29 26(test_ifelse() + SelectionMerge 89 None + BranchConditional 72 88 96 + 88: Label + 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 90 + 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 91 91 12 12 + 92: 49(int) Load 60(counter) + 95: 49(int) IAdd 92 77 + Store 60(counter) 95 + Branch 89 + 96: Label + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 97 + 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 76 76 12 12 + 99: 49(int) Load 60(counter) + 102: 49(int) IAdd 99 98 + Store 60(counter) 102 + Branch 89 + 89: Label + 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 29 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 105 105 12 12 Return FunctionEnd 31(test_if_compound(): 4 Function None 5 32: Label - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34 - 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 35 35 12 12 - 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 34 31(test_if_compound() - SelectionMerge 105 None - BranchConditional 67 104 105 - 104: Label - 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 106 - 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 35 35 12 12 - SelectionMerge 110 None - BranchConditional 67 109 110 - 109: Label - 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 113 - 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 114 114 12 12 - 115: 49(int) Load 54(counter) - 118: 49(int) IAdd 115 72 - Store 54(counter) 118 - Branch 110 - 110: Label - Branch 105 - 105: Label - 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34 - 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 121 121 12 12 + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34 + 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 35 35 12 12 + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 34 31(test_if_compound() + SelectionMerge 110 None + BranchConditional 72 109 110 + 109: Label + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 111 + 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 35 35 12 12 + SelectionMerge 115 None + BranchConditional 72 114 115 + 114: Label + 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 118 + 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 119 119 12 12 + 120: 49(int) Load 60(counter) + 123: 49(int) IAdd 120 77 + Store 60(counter) 123 + Branch 115 + 115: Label + Branch 110 + 110: Label + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34 + 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 126 126 12 12 Return FunctionEnd 36(test_if_compound2(): 4 Function None 5 37: Label - 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39 - 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 40 40 12 12 - 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 39 36(test_if_compound2() - SelectionMerge 126 None - BranchConditional 67 125 126 - 125: Label - 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 127 - 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 40 40 12 12 - SelectionMerge 130 None - BranchConditional 67 129 130 - 129: Label - 135: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 133 - 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 10 10 12 12 - 134: 49(int) Load 54(counter) - 137: 49(int) IAdd 134 72 - Store 54(counter) 137 - Branch 130 + 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39 + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 40 40 12 12 + 127: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 39 36(test_if_compound2() + SelectionMerge 131 None + BranchConditional 72 130 131 130: Label - 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 127 - 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 141 141 12 12 - 138: 49(int) Load 54(counter) - 142: 49(int) IAdd 138 93 - Store 54(counter) 142 - Branch 126 - 126: Label - 143: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39 - 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 145 145 12 12 + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 132 + 137: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 40 40 12 12 + SelectionMerge 135 None + BranchConditional 72 134 135 + 134: Label + 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 138 + 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 10 10 12 12 + 139: 49(int) Load 60(counter) + 142: 49(int) IAdd 139 77 + Store 60(counter) 142 + Branch 135 + 135: Label + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 132 + 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 146 146 12 12 + 143: 49(int) Load 60(counter) + 147: 49(int) IAdd 143 98 + Store 60(counter) 147 + Branch 131 + 131: Label + 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39 + 149: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 150 150 12 12 Return FunctionEnd 41(test_switch(): 4 Function None 5 42: Label - 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 - 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 45 45 12 12 - 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 44 41(test_switch() - SelectionMerge 152 None - Switch 58 151 - case 0: 149 - case 1: 150 - 151: Label - 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 - 169: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 170 170 12 12 - 167: 49(int) Load 54(counter) - 171: 49(int) IAdd 167 166 - Store 54(counter) 171 - Branch 152 - 149: Label - 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 - 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 156 156 12 12 - 153: 49(int) Load 54(counter) - 157: 49(int) IAdd 153 72 - Store 54(counter) 157 - Branch 150 - 150: Label + 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 + 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 45 45 12 12 + 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 44 41(test_switch() + SelectionMerge 157 None + Switch 63 156 + case 0: 154 + case 1: 155 + 156: Label + 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 + 174: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 175 175 12 12 + 172: 49(int) Load 60(counter) + 176: 49(int) IAdd 172 171 + Store 60(counter) 176 + Branch 157 + 154: Label 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 161 161 12 12 - 158: 49(int) Load 54(counter) - 162: 49(int) IAdd 158 93 - Store 54(counter) 162 - 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 164 164 12 12 - Branch 152 - 152: Label - 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 - 174: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 175 175 12 12 + 158: 49(int) Load 60(counter) + 162: 49(int) IAdd 158 77 + Store 60(counter) 162 + Branch 155 + 155: Label + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 + 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 166 166 12 12 + 163: 49(int) Load 60(counter) + 167: 49(int) IAdd 163 98 + Store 60(counter) 167 + 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 169 169 12 12 + Branch 157 + 157: Label + 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44 + 179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 180 180 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.include.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.include.glsl.frag.out index 1d8348ae7b..96759e2b73 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.include.glsl.frag.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.include.glsl.frag.out @@ -8,7 +8,7 @@ spv.debuginfo.include.glsl.frag 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 4: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 15 "main" 82 + EntryPoint Fragment 15 "main" 62 ExecutionMode 15 OriginUpperLeft 2: String "spv.debuginfo.include.glsl.frag" 3: String "spv.debuginfo.include.glsl.h" @@ -48,11 +48,11 @@ void main() { 50: String "mainFileFunction" 53: String "v" 57: String "main" - 84: String "headerOut" - 88: String "headerUboItem" - 91: String "UBO" - 96: String "" - 98: String "int" + 64: String "headerOut" + 67: String "headerUboItem" + 70: String "UBO" + 75: String "" + 97: String "int" SourceExtension "GL_GOOGLE_cpp_style_line_directive" SourceExtension "GL_GOOGLE_include_directive" Name 15 "main" @@ -60,17 +60,17 @@ void main() { Name 28 "a" Name 48 "mainFileFunction(vf4;" Name 47 "v" - Name 82 "headerOut" - Name 86 "UBO" - MemberName 86(UBO) 0 "headerUboItem" - Name 94 "" - Name 101 "param" + Name 62 "headerOut" + Name 65 "UBO" + MemberName 65(UBO) 0 "headerUboItem" + Name 73 "" + Name 100 "param" Name 108 "param" - Decorate 82(headerOut) Location 0 - Decorate 86(UBO) Block - MemberDecorate 86(UBO) 0 Offset 0 - Decorate 94 Binding 0 - Decorate 94 DescriptorSet 0 + Decorate 62(headerOut) Location 0 + Decorate 65(UBO) Block + MemberDecorate 65(UBO) 0 Offset 0 + Decorate 73 Binding 0 + Decorate 73 DescriptorSet 0 5: TypeVoid 6: TypeFunction 5 8: TypeInt 32 0 @@ -103,41 +103,41 @@ void main() { 52: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 53 22 38 12 13 51 21 37 59: 8(int) Constant 10 58: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 57 7 38 59 13 36 57 14 59 - 63: 8(int) Constant 9 - 80: TypePointer Output 20(fvec4) - 81: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 14 13 - 82(headerOut): 80(ptr) Variable Output - 85: 8(int) Constant 11 - 83: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 84 22 38 85 13 36 84 82(headerOut) 35 - 86(UBO): TypeStruct 20(fvec4) - 89: 8(int) Constant 5 - 87: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 88 22 38 89 24 13 13 14 - 90: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 91 37 38 85 13 36 91 13 14 87 - 92: TypePointer Uniform 86(UBO) - 93: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 90 40 13 - 94: 92(ptr) Variable Uniform - 95: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 96 90 38 85 13 36 96 94 35 - 97: TypeInt 32 1 - 99: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 98 11 21 13 - 100: 97(int) Constant 0 - 102: TypePointer Uniform 20(fvec4) - 103: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 40 13 + 60: TypePointer Output 20(fvec4) + 61: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 14 13 + 62(headerOut): 60(ptr) Variable Output + 63: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 64 22 33 40 13 36 64 62(headerOut) 35 + 65(UBO): TypeStruct 20(fvec4) + 68: 8(int) Constant 5 + 66: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 67 22 33 68 24 13 13 14 + 69: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 70 37 33 21 13 36 70 13 14 66 + 71: TypePointer Uniform 65(UBO) + 72: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 69 40 13 + 73: 71(ptr) Variable Uniform + 74: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 75 69 33 21 13 36 75 73 35 + 79: 8(int) Constant 9 + 96: TypeInt 32 1 + 98: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 97 11 21 13 + 99: 96(int) Constant 0 + 101: TypePointer Uniform 20(fvec4) + 102: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 40 13 + 105: 8(int) Constant 11 111: 8(int) Constant 12 15(main): 5 Function None 6 16: Label - 101(param): 23(ptr) Variable Function + 100(param): 23(ptr) Variable Function 108(param): 23(ptr) Variable Function - 78: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 58 - 79: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 59 59 13 13 - 77: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 58 15(main) - 105: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 85 85 13 13 - 104: 102(ptr) AccessChain 94 100 - 106: 20(fvec4) Load 104 - Store 101(param) 106 - 107: 20(fvec4) FunctionCall 48(mainFileFunction(vf4;) 101(param) + 94: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 58 + 95: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 59 59 13 13 + 93: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 58 15(main) + 104: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 105 105 13 13 + 103: 101(ptr) AccessChain 73 99 + 106: 20(fvec4) Load 103 + Store 100(param) 106 + 107: 20(fvec4) FunctionCall 48(mainFileFunction(vf4;) 100(param) Store 108(param) 107 109: 20(fvec4) FunctionCall 29(headerFunction(vf4;) 108(param) - Store 82(headerOut) 109 + Store 62(headerOut) 109 110: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 111 111 13 13 Return FunctionEnd @@ -147,11 +147,11 @@ void main() { 45: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 32 46: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 35 35 13 13 43: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 41 28(a) 44 - 60: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 32 29(headerFunction(vf4;) - 62: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 63 63 13 13 - 61: 20(fvec4) Load 28(a) - 64: 20(fvec4) FNegate 61 - ReturnValue 64 + 76: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 32 29(headerFunction(vf4;) + 78: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 79 79 13 13 + 77: 20(fvec4) Load 28(a) + 80: 20(fvec4) FNegate 77 + ReturnValue 80 FunctionEnd 48(mainFileFunction(vf4;): 20(fvec4) Function None 26 47(v): 23(ptr) FunctionParameter @@ -159,9 +159,9 @@ void main() { 55: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 51 56: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 12 12 13 13 54: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 52 47(v) 44 - 69: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 51 48(mainFileFunction(vf4;) - 71: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 24 24 13 13 - 70: 20(fvec4) Load 47(v) - 72: 20(fvec4) FNegate 70 - ReturnValue 72 + 85: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 51 48(mainFileFunction(vf4;) + 87: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 24 24 13 13 + 86: 20(fvec4) Load 47(v) + 88: 20(fvec4) FNegate 86 + ReturnValue 88 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.interface_bool.glsl.comp.out b/third_party/glslang/Test/baseResults/spv.debuginfo.interface_bool.glsl.comp.out new file mode 100644 index 0000000000..6623a2f92b --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.interface_bool.glsl.comp.out @@ -0,0 +1,263 @@ +spv.debuginfo.interface_bool.glsl.comp +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 172 + + Capability Shader + Extension "SPV_KHR_non_semantic_info" + 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" + 3: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 14 "main" 83 + ExecutionMode 14 LocalSize 32 1 1 + 2: String "spv.debuginfo.interface_bool.glsl.comp" + 8: String "uint" + 16: String "main" + 19: String "// OpModuleProcessed auto-map-locations +// OpModuleProcessed auto-map-bindings +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed keep-uncalled +// OpModuleProcessed entry-point main +#line 1 +#version 450 + +layout (local_size_x = 32, local_size_y = 1) in; + +uniform UBO +{ + bool b; + bvec4 bv; + bool[4] ba; +}; + +buffer SSBO { + bool b; + bvec4 bv; + bool[4] ba; +} ssbo; + +void main() +{ + if (gl_GlobalInvocationID.x == 0 && gl_GlobalInvocationID.y == 0) { + ssbo.b = b; + ssbo.bv = bv; + for (int i = 0; i < 4; ++i) { + ssbo.ba[i] = ba[i]; + } + } +} +" + 26: String "bool" + 35: String "int" + 42: String "b" + 45: String "bv" + 48: String "ba" + 52: String "UBO" + 58: String "" + 69: String "SSBO" + 75: String "ssbo" + 85: String "gl_GlobalInvocationID" + 135: String "i" + 171: String "gl_WorkGroupSize" + Name 14 "main" + Name 40 "UBO" + MemberName 40(UBO) 0 "b" + MemberName 40(UBO) 1 "bv" + MemberName 40(UBO) 2 "ba" + Name 56 "" + Name 61 "SSBO" + MemberName 61(SSBO) 0 "b" + MemberName 61(SSBO) 1 "bv" + MemberName 61(SSBO) 2 "ba" + Name 73 "ssbo" + Name 83 "gl_GlobalInvocationID" + Name 133 "i" + Decorate 32 ArrayStride 16 + Decorate 40(UBO) Block + MemberDecorate 40(UBO) 0 Offset 0 + MemberDecorate 40(UBO) 1 Offset 16 + MemberDecorate 40(UBO) 2 Offset 32 + Decorate 56 Binding 0 + Decorate 56 DescriptorSet 0 + Decorate 59 ArrayStride 4 + Decorate 61(SSBO) BufferBlock + MemberDecorate 61(SSBO) 0 Offset 0 + MemberDecorate 61(SSBO) 1 Offset 16 + MemberDecorate 61(SSBO) 2 Offset 32 + Decorate 73(ssbo) Binding 1 + Decorate 73(ssbo) DescriptorSet 0 + Decorate 83(gl_GlobalInvocationID) BuiltIn GlobalInvocationId + Decorate 169 BuiltIn WorkgroupSize + 4: TypeVoid + 5: TypeFunction 4 + 7: TypeInt 32 0 + 10: 7(int) Constant 32 + 11: 7(int) Constant 6 + 12: 7(int) Constant 0 + 9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12 + 13: 7(int) Constant 3 + 6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 + 18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19 + 20: 7(int) Constant 18 + 22: 7(int) Constant 1 + 23: 7(int) Constant 4 + 24: 7(int) Constant 2 + 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 + 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 + 25: TypeBool + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 24 12 + 28: TypeVector 7(int) 4 + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 9 23 + 30: TypeVector 25(bool) 4 + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 23 + 32: TypeArray 7(int) 23 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 9 23 + 34: TypeInt 32 1 + 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 35 10 23 12 + 37: 34(int) Constant 4 + 38: TypeArray 25(bool) 37 + 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 27 37 + 40(UBO): TypeStruct 7(int) 28(ivec4) 32 + 43: 7(int) Constant 7 + 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 42 27 18 43 43 12 12 13 + 46: 7(int) Constant 8 + 44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 45 31 18 46 46 12 12 13 + 49: 7(int) Constant 9 + 50: 7(int) Constant 10 + 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 48 39 18 49 50 12 12 13 + 53: 7(int) Constant 5 + 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 52 22 18 53 12 21 52 12 13 41 44 47 + 54: TypePointer Uniform 40(UBO) + 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 51 24 12 + 56: 54(ptr) Variable Uniform + 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 58 51 18 53 12 21 58 56 46 + 59: TypeArray 7(int) 23 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 9 23 + 61(SSBO): TypeStruct 7(int) 28(ivec4) 59 + 63: 7(int) Constant 13 + 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 42 27 18 63 43 12 12 13 + 65: 7(int) Constant 14 + 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 45 31 18 65 46 12 12 13 + 67: 7(int) Constant 15 + 66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 48 39 18 67 50 12 12 13 + 70: 7(int) Constant 12 + 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 69 22 18 70 12 21 69 12 13 62 64 66 + 71: TypePointer Uniform 61(SSBO) + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 68 24 12 + 73(ssbo): 71(ptr) Variable Uniform + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 75 68 18 70 12 21 75 73(ssbo) 46 + 79: TypeVector 7(int) 3 + 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 9 13 + 81: TypePointer Input 79(ivec3) + 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 80 22 12 +83(gl_GlobalInvocationID): 81(ptr) Variable Input + 86: 7(int) Constant 20 + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 85 80 18 86 12 21 85 83(gl_GlobalInvocationID) 46 + 87: TypePointer Input 7(int) + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 22 12 + 106: 7(int) Constant 21 + 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 106 50 17 + 107: 34(int) Constant 0 + 108: TypePointer Uniform 7(int) + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 24 12 + 117: 34(int) Constant 1 + 118: TypePointer Uniform 28(ivec4) + 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 24 12 + 122: 7(int) Constant 22 + 124: 28(ivec4) ConstantComposite 12 12 12 12 + 126: 28(ivec4) ConstantComposite 22 22 22 22 + 130: 7(int) Constant 23 + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 130 13 105 + 131: TypePointer Function 34(int) + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 36 43 12 + 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 135 36 18 130 12 129 23 + 137: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 151: 34(int) Constant 2 + 155: 7(int) Constant 24 + 168: 7(int) Constant 27 + 169: 79(ivec3) ConstantComposite 10 22 22 + 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 171 80 18 168 12 21 171 169 46 + 14(main): 4 Function None 5 + 15: Label + 133(i): 131(ptr) Variable Function + 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 86 86 12 12 + 89: 87(ptr) AccessChain 83(gl_GlobalInvocationID) 12 + 91: 7(int) Load 89 + 92: 25(bool) IEqual 91 12 + SelectionMerge 94 None + BranchConditional 92 93 94 + 93: Label + 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 86 86 12 12 + 95: 87(ptr) AccessChain 83(gl_GlobalInvocationID) 22 + 98: 7(int) Load 95 + 99: 25(bool) IEqual 98 12 + Branch 94 + 94: Label + 100: 25(bool) Phi 92 15 99 93 + 103: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 86 86 12 12 + SelectionMerge 102 None + BranchConditional 100 101 102 + 101: Label + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 105 + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 106 106 12 12 + 110: 108(ptr) AccessChain 56 107 + 113: 7(int) Load 110 + 114: 25(bool) INotEqual 113 12 + 115: 7(int) Select 114 22 12 + 116: 108(ptr) AccessChain 73(ssbo) 107 + Store 116 115 + 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 122 122 12 12 + 120: 118(ptr) AccessChain 56 117 + 123: 28(ivec4) Load 120 + 125: 30(bvec4) INotEqual 123 124 + 127: 28(ivec4) Select 125 126 124 + 128: 118(ptr) AccessChain 73(ssbo) 117 + Store 128 127 + 138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 129 + 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 130 130 12 12 + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 134 133(i) 137 + Store 133(i) 107 + Branch 140 + 140: Label + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 129 + 145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 130 130 12 12 + LoopMerge 142 143 None + Branch 146 + 146: Label + 148: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 129 + 149: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 130 130 12 12 + 147: 34(int) Load 133(i) + 150: 25(bool) SLessThan 147 37 + BranchConditional 150 141 142 + 141: Label + 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 129 + 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 155 155 12 12 + 152: 34(int) Load 133(i) + 156: 34(int) Load 133(i) + 157: 108(ptr) AccessChain 56 151 156 + 158: 7(int) Load 157 + 159: 25(bool) INotEqual 158 12 + 160: 7(int) Select 159 22 12 + 161: 108(ptr) AccessChain 73(ssbo) 151 152 + Store 161 160 + Branch 143 + 143: Label + 163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 129 + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 130 130 12 12 + 162: 34(int) Load 133(i) + 165: 34(int) IAdd 162 117 + Store 133(i) 165 + Branch 140 + 142: Label + Branch 102 + 102: Label + 166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 168 168 12 12 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.multiline.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.multiline.glsl.frag.out index b16727df3e..05dc9245ff 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.multiline.glsl.frag.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.multiline.glsl.frag.out @@ -1,14 +1,14 @@ spv.debuginfo.multiline.glsl.frag // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 109 +// Id's are bound by 108 Capability Shader Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 14 "main" 75 81 + EntryPoint Fragment 14 "main" 54 60 ExecutionMode 14 OriginUpperLeft 2: String "spv.debuginfo.multiline.glsl.frag" 8: String "uint" @@ -50,20 +50,20 @@ void main() { 44: String "y" 47: String "z" 49: String "main" - 77: String "outx" - 83: String "inx" + 56: String "inx" + 62: String "outx" Name 14 "main" Name 27 "add(f1;f1;f1;" Name 24 "x" Name 25 "y" Name 26 "z" - Name 75 "outx" - Name 81 "inx" - Name 99 "param" + Name 54 "inx" + Name 60 "outx" + Name 98 "param" + Name 101 "param" Name 102 "param" - Name 103 "param" - Decorate 75(outx) Location 0 - Decorate 81(inx) Location 0 + Decorate 54(inx) Location 0 + Decorate 60(outx) Location 0 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -92,53 +92,52 @@ void main() { 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 47 18 31 11 12 30 35 13 51: 7(int) Constant 16 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 49 6 31 51 12 33 49 13 51 - 55: 7(int) Constant 8 - 58: 7(int) Constant 10 - 62: 7(int) Constant 12 - 69: 7(int) Constant 14 - 73: TypePointer Output 16(float) - 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 13 12 - 75(outx): 73(ptr) Variable Output - 78: 7(int) Constant 17 - 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 77 18 31 78 12 33 77 75(outx) 55 - 79: TypePointer Input 16(float) - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 34 12 - 81(inx): 79(ptr) Variable Input - 84: 7(int) Constant 20 - 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 83 18 31 84 12 33 83 81(inx) 55 - 87: 16(float) Constant 1065353216 - 91: 7(int) Constant 21 - 92: 16(float) Constant 1073741824 - 96: 7(int) Constant 22 - 97: 16(float) Constant 1077936128 - 101: 7(int) Constant 23 - 106: 7(int) Constant 18 - 108: 7(int) Constant 25 + 52: TypePointer Input 16(float) + 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 34 12 + 54(inx): 52(ptr) Variable Input + 57: 7(int) Constant 8 + 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 56 18 31 13 12 33 56 54(inx) 57 + 58: TypePointer Output 16(float) + 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 18 13 12 + 60(outx): 58(ptr) Variable Output + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 62 18 31 35 12 33 62 60(outx) 57 + 68: 7(int) Constant 10 + 72: 7(int) Constant 12 + 79: 7(int) Constant 14 + 85: 7(int) Constant 20 + 86: 16(float) Constant 1065353216 + 90: 7(int) Constant 21 + 91: 16(float) Constant 1073741824 + 95: 7(int) Constant 22 + 96: 16(float) Constant 1077936128 + 100: 7(int) Constant 23 + 105: 7(int) Constant 18 + 107: 7(int) Constant 25 14(main): 4 Function None 5 15: Label - 99(param): 19(ptr) Variable Function + 98(param): 19(ptr) Variable Function + 101(param): 19(ptr) Variable Function 102(param): 19(ptr) Variable Function - 103(param): 19(ptr) Variable Function - 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 50 - 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 51 51 12 12 - 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 50 14(main) - 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 84 84 12 12 - 85: 16(float) Load 81(inx) - 88: 16(float) FAdd 85 87 - 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 91 91 12 12 - 89: 16(float) Load 81(inx) - 93: 16(float) FAdd 89 92 - 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 96 96 12 12 - 94: 16(float) Load 81(inx) - 98: 16(float) FAdd 94 97 - 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 101 101 12 12 - Store 99(param) 88 - Store 102(param) 93 - Store 103(param) 98 - 104: 16(float) FunctionCall 27(add(f1;f1;f1;) 99(param) 102(param) 103(param) - 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 106 106 12 12 - Store 75(outx) 104 - 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 108 108 12 12 + 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 50 + 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 51 51 12 12 + 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 50 14(main) + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 85 85 12 12 + 83: 16(float) Load 54(inx) + 87: 16(float) FAdd 83 86 + 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 90 90 12 12 + 88: 16(float) Load 54(inx) + 92: 16(float) FAdd 88 91 + 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 95 95 12 12 + 93: 16(float) Load 54(inx) + 97: 16(float) FAdd 93 96 + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 100 100 12 12 + Store 98(param) 87 + Store 101(param) 92 + Store 102(param) 97 + 103: 16(float) FunctionCall 27(add(f1;f1;f1;) 98(param) 101(param) 102(param) + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 105 105 12 12 + Store 60(outx) 103 + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 107 107 12 12 Return FunctionEnd 27(add(f1;f1;f1;): 16(float) Function None 22 @@ -151,15 +150,15 @@ void main() { 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 37 24(x) 40 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 43 25(y) 40 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 46 26(z) 40 - 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 30 27(add(f1;f1;f1;) - 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 55 55 12 12 - 53: 16(float) Load 24(x) - 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 58 58 12 12 - 56: 16(float) Load 25(y) - 59: 16(float) FAdd 53 56 - 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 62 62 12 12 - 60: 16(float) Load 26(z) - 63: 16(float) FAdd 59 60 - 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 20 20 12 12 - ReturnValue 63 + 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 30 27(add(f1;f1;f1;) + 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 57 57 12 12 + 64: 16(float) Load 24(x) + 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 68 68 12 12 + 66: 16(float) Load 25(y) + 69: 16(float) FAdd 64 66 + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 72 72 12 12 + 70: 16(float) Load 26(z) + 73: 16(float) FAdd 69 70 + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 31 20 20 12 12 + ReturnValue 73 FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.non_ascii.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.non_ascii.glsl.frag.out index 8c3f103684..a88691696d 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.non_ascii.glsl.frag.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.non_ascii.glsl.frag.out @@ -8,7 +8,7 @@ spv.debuginfo.non_ascii.glsl.frag 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 14 "main" 35 + EntryPoint Fragment 14 "main" 32 ExecutionMode 14 OriginUpperLeft 2: String "spv.debuginfo.non_ascii.glsl.frag" 8: String "uint" @@ -30,11 +30,11 @@ void main() o = vec4(1.0); } " - 29: String "float" - 37: String "o" + 26: String "float" + 34: String "o" Name 14 "main" - Name 35 "o" - Decorate 35(o) Location 0 + Name 32 "o" + Decorate 32(o) Location 0 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -51,25 +51,25 @@ void main() 24: 7(int) Constant 2 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 - 28: TypeFloat 32 - 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 29 10 13 12 - 31: TypeVector 28(float) 4 - 32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 30 23 - 33: TypePointer Output 31(fvec4) - 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 32 13 12 - 35(o): 33(ptr) Variable Output - 38: 7(int) Constant 8 - 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 37 32 18 38 12 21 37 35(o) 38 - 39: 28(float) Constant 1065353216 - 40: 31(fvec4) ConstantComposite 39 39 39 39 + 25: TypeFloat 32 + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 13 12 + 28: TypeVector 25(float) 4 + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 23 + 30: TypePointer Output 28(fvec4) + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 13 12 + 32(o): 30(ptr) Variable Output + 35: 7(int) Constant 8 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 34 29 18 13 12 21 34 32(o) 35 + 39: 25(float) Constant 1065353216 + 40: 28(fvec4) ConstantComposite 39 39 39 39 43: 7(int) Constant 9 14(main): 4 Function None 5 15: Label - 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 - 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 38 38 12 12 - Store 35(o) 40 + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 38: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 35 35 12 12 + Store 32(o) 40 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 43 43 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.rt_ext_builtins.glsl.rahit.out b/third_party/glslang/Test/baseResults/spv.debuginfo.rt_ext_builtins.glsl.rahit.out new file mode 100644 index 0000000000..2dd5018012 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.rt_ext_builtins.glsl.rahit.out @@ -0,0 +1,335 @@ +spv.debuginfo.rt_ext_builtins.glsl.rahit +// Module Version 10600 +// Generated by (magic number): 8000b +// Id's are bound by 232 + + Capability RayTracingKHR + Extension "SPV_KHR_non_semantic_info" + Extension "SPV_KHR_ray_tracing" + 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" + 3: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint AnyHitKHR 14 "main" 32 52 62 79 89 99 115 125 135 145 159 169 192 212 222 + 2: String "spv.debuginfo.rt_ext_builtins.glsl.rahit" + 8: String "uint" + 16: String "main" + 19: String "#version 460 +#extension GL_EXT_ray_tracing : enable + +layout(location = 1) rayPayloadInEXT vec4 incomingPayload; + +void main() +{ + uvec3 v0 = gl_LaunchIDEXT; + uvec3 v1 = gl_LaunchSizeEXT; + int v2 = gl_PrimitiveID; + int v3 = gl_InstanceID; + int v4 = gl_InstanceCustomIndexEXT; + vec3 v5 = gl_WorldRayOriginEXT; + vec3 v6 = gl_WorldRayDirectionEXT; + vec3 v7 = gl_ObjectRayOriginEXT; + vec3 v8 = gl_ObjectRayDirectionEXT; + float v9 = gl_RayTminEXT; + float v10 = gl_RayTmaxEXT; + float v11 = gl_HitTEXT; + uint v12 = gl_HitKindEXT; + mat4x3 v13 = gl_ObjectToWorldEXT; + mat4x3 v14 = gl_WorldToObjectEXT; + incomingPayload = vec4(0.5f); +}" + 25: String "float" + 34: String "incomingPayload" + 46: String "v0" + 54: String "gl_LaunchIDEXT" + 58: String "v1" + 64: String "gl_LaunchSizeEXT" + 67: String "int" + 73: String "v2" + 81: String "gl_PrimitiveID" + 85: String "v3" + 91: String "gl_InstanceID" + 95: String "v4" + 101: String "gl_InstanceCustomIndexEXT" + 109: String "v5" + 117: String "gl_WorldRayOriginEXT" + 121: String "v6" + 127: String "gl_WorldRayDirectionEXT" + 131: String "v7" + 137: String "gl_ObjectRayOriginEXT" + 141: String "v8" + 147: String "gl_ObjectRayDirectionEXT" + 153: String "v9" + 161: String "gl_RayTminEXT" + 165: String "v10" + 171: String "gl_RayTmaxEXT" + 173: String "gl_HitTEXT" + 177: String "v11" + 186: String "v12" + 194: String "gl_HitKindEXT" + 199: String "bool" + 206: String "v13" + 214: String "gl_ObjectToWorldEXT" + 218: String "v14" + 224: String "gl_WorldToObjectEXT" + SourceExtension "GL_EXT_ray_tracing" + Name 14 "main" + Name 32 "incomingPayload" + Name 44 "v0" + Name 52 "gl_LaunchIDEXT" + Name 56 "v1" + Name 62 "gl_LaunchSizeEXT" + Name 71 "v2" + Name 79 "gl_PrimitiveID" + Name 83 "v3" + Name 89 "gl_InstanceID" + Name 93 "v4" + Name 99 "gl_InstanceCustomIndexEXT" + Name 107 "v5" + Name 115 "gl_WorldRayOriginEXT" + Name 119 "v6" + Name 125 "gl_WorldRayDirectionEXT" + Name 129 "v7" + Name 135 "gl_ObjectRayOriginEXT" + Name 139 "v8" + Name 145 "gl_ObjectRayDirectionEXT" + Name 151 "v9" + Name 159 "gl_RayTminEXT" + Name 163 "v10" + Name 169 "gl_RayTmaxEXT" + Name 175 "v11" + Name 184 "v12" + Name 192 "gl_HitKindEXT" + Name 204 "v13" + Name 212 "gl_ObjectToWorldEXT" + Name 216 "v14" + Name 222 "gl_WorldToObjectEXT" + ModuleProcessed "auto-map-locations" + ModuleProcessed "auto-map-bindings" + ModuleProcessed "client vulkan100" + ModuleProcessed "target-env spirv1.6" + ModuleProcessed "target-env vulkan1.4" + ModuleProcessed "keep-uncalled" + ModuleProcessed "entry-point main" + Decorate 52(gl_LaunchIDEXT) BuiltIn LaunchIdKHR + Decorate 62(gl_LaunchSizeEXT) BuiltIn LaunchSizeKHR + Decorate 79(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 89(gl_InstanceID) BuiltIn InstanceId + Decorate 99(gl_InstanceCustomIndexEXT) BuiltIn InstanceCustomIndexKHR + Decorate 115(gl_WorldRayOriginEXT) BuiltIn WorldRayOriginKHR + Decorate 125(gl_WorldRayDirectionEXT) BuiltIn WorldRayDirectionKHR + Decorate 135(gl_ObjectRayOriginEXT) BuiltIn ObjectRayOriginKHR + Decorate 145(gl_ObjectRayDirectionEXT) BuiltIn ObjectRayDirectionKHR + Decorate 159(gl_RayTminEXT) BuiltIn RayTminKHR + Decorate 169(gl_RayTmaxEXT) BuiltIn RayTmaxKHR + Decorate 192(gl_HitKindEXT) BuiltIn HitKindKHR + Decorate 212(gl_ObjectToWorldEXT) BuiltIn ObjectToWorldKHR + Decorate 222(gl_WorldToObjectEXT) BuiltIn WorldToObjectKHR + 4: TypeVoid + 5: TypeFunction 4 + 7: TypeInt 32 0 + 10: 7(int) Constant 32 + 11: 7(int) Constant 6 + 12: 7(int) Constant 0 + 9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12 + 13: 7(int) Constant 3 + 6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 + 18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19 + 21: 7(int) Constant 1 + 22: 7(int) Constant 4 + 23: 7(int) Constant 2 + 20: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 21 22 18 23 + 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 11 12 20 16 13 11 + 24: TypeFloat 32 + 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 25 10 13 12 + 27: TypeVector 24(float) 4 + 28: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 26 22 + 29: TypePointer IncomingRayPayloadKHR 27(fvec4) + 30: 7(int) Constant 5342 + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 28 30 12 +32(incomingPayload): 29(ptr) Variable IncomingRayPayloadKHR + 35: 7(int) Constant 8 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 34 28 18 22 12 20 34 32(incomingPayload) 35 + 39: TypeVector 7(int) 3 + 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 9 13 + 41: TypePointer Function 39(ivec3) + 42: 7(int) Constant 7 + 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 40 42 12 + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 46 40 18 35 12 17 22 + 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 50: TypePointer Input 39(ivec3) + 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 40 21 12 +52(gl_LaunchIDEXT): 50(ptr) Variable Input + 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 54 40 18 35 12 20 54 52(gl_LaunchIDEXT) 35 + 59: 7(int) Constant 9 + 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 58 40 18 59 12 17 22 +62(gl_LaunchSizeEXT): 50(ptr) Variable Input + 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 64 40 18 59 12 20 64 62(gl_LaunchSizeEXT) 35 + 66: TypeInt 32 1 + 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 67 10 22 12 + 69: TypePointer Function 66(int) + 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 68 42 12 + 74: 7(int) Constant 10 + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 73 68 18 74 12 17 22 + 77: TypePointer Input 66(int) + 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 68 21 12 +79(gl_PrimitiveID): 77(ptr) Variable Input + 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 81 68 18 74 12 20 81 79(gl_PrimitiveID) 35 + 86: 7(int) Constant 11 + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 85 68 18 86 12 17 22 +89(gl_InstanceID): 77(ptr) Variable Input + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 91 68 18 86 12 20 91 89(gl_InstanceID) 35 + 96: 7(int) Constant 12 + 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 95 68 18 96 12 17 22 +99(gl_InstanceCustomIndexEXT): 77(ptr) Variable Input + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 101 68 18 96 12 20 101 99(gl_InstanceCustomIndexEXT) 35 + 103: TypeVector 24(float) 3 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 26 13 + 105: TypePointer Function 103(fvec3) + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 104 42 12 + 110: 7(int) Constant 13 + 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 109 104 18 110 12 17 22 + 113: TypePointer Input 103(fvec3) + 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 104 21 12 +115(gl_WorldRayOriginEXT): 113(ptr) Variable Input + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 117 104 18 110 12 20 117 115(gl_WorldRayOriginEXT) 35 + 122: 7(int) Constant 14 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 121 104 18 122 12 17 22 +125(gl_WorldRayDirectionEXT): 113(ptr) Variable Input + 126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 127 104 18 122 12 20 127 125(gl_WorldRayDirectionEXT) 35 + 132: 7(int) Constant 15 + 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 131 104 18 132 12 17 22 +135(gl_ObjectRayOriginEXT): 113(ptr) Variable Input + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 137 104 18 132 12 20 137 135(gl_ObjectRayOriginEXT) 35 + 142: 7(int) Constant 16 + 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 141 104 18 142 12 17 22 +145(gl_ObjectRayDirectionEXT): 113(ptr) Variable Input + 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 147 104 18 142 12 20 147 145(gl_ObjectRayDirectionEXT) 35 + 149: TypePointer Function 24(float) + 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 26 42 12 + 154: 7(int) Constant 17 + 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 153 26 18 154 12 17 22 + 157: TypePointer Input 24(float) + 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 26 21 12 +159(gl_RayTminEXT): 157(ptr) Variable Input + 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 161 26 18 154 12 20 161 159(gl_RayTminEXT) 35 + 166: 7(int) Constant 18 + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 165 26 18 166 12 17 22 +169(gl_RayTmaxEXT): 157(ptr) Variable Input + 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 171 26 18 166 12 20 171 169(gl_RayTmaxEXT) 35 + 172: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 173 26 18 166 12 20 173 169(gl_RayTmaxEXT) 35 + 178: 7(int) Constant 19 + 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 177 26 18 178 12 17 22 + 182: TypePointer Function 7(int) + 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 42 12 + 187: 7(int) Constant 20 + 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 186 9 18 187 12 17 22 + 190: TypePointer Input 7(int) + 191: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 21 12 +192(gl_HitKindEXT): 190(ptr) Variable Input + 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 194 9 18 187 12 20 194 192(gl_HitKindEXT) 35 + 196: TypeMatrix 103(fvec3) 4 + 198: TypeBool + 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 199 10 23 12 + 201: 198(bool) ConstantTrue + 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 104 22 201 + 202: TypePointer Function 196 + 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 197 42 12 + 207: 7(int) Constant 21 + 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 206 197 18 207 12 17 22 + 210: TypePointer Input 196 + 211: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 197 21 12 +212(gl_ObjectToWorldEXT): 210(ptr) Variable Input + 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 214 197 18 207 12 20 214 212(gl_ObjectToWorldEXT) 35 + 219: 7(int) Constant 22 + 217: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 218 197 18 219 12 17 22 +222(gl_WorldToObjectEXT): 210(ptr) Variable Input + 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 224 197 18 219 12 20 224 222(gl_WorldToObjectEXT) 35 + 226: 24(float) Constant 1056964608 + 227: 27(fvec4) ConstantComposite 226 226 226 226 + 229: 7(int) Constant 23 + 231: 7(int) Constant 24 + 14(main): 4 Function None 5 + 15: Label + 44(v0): 41(ptr) Variable Function + 56(v1): 41(ptr) Variable Function + 71(v2): 69(ptr) Variable Function + 83(v3): 69(ptr) Variable Function + 93(v4): 69(ptr) Variable Function + 107(v5): 105(ptr) Variable Function + 119(v6): 105(ptr) Variable Function + 129(v7): 105(ptr) Variable Function + 139(v8): 105(ptr) Variable Function + 151(v9): 149(ptr) Variable Function + 163(v10): 149(ptr) Variable Function + 175(v11): 149(ptr) Variable Function + 184(v12): 182(ptr) Variable Function + 204(v13): 202(ptr) Variable Function + 216(v14): 202(ptr) Variable Function + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 38: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 11 11 12 12 + 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 35 35 12 12 + 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 45 44(v0) 48 + 55: 39(ivec3) Load 52(gl_LaunchIDEXT) + Store 44(v0) 55 + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 59 59 12 12 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 57 56(v1) 48 + 65: 39(ivec3) Load 62(gl_LaunchSizeEXT) + Store 56(v1) 65 + 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 74 74 12 12 + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 72 71(v2) 48 + 82: 66(int) Load 79(gl_PrimitiveID) + Store 71(v2) 82 + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 86 86 12 12 + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 84 83(v3) 48 + 92: 66(int) Load 89(gl_InstanceID) + Store 83(v3) 92 + 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 96 96 12 12 + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 94 93(v4) 48 + 102: 66(int) Load 99(gl_InstanceCustomIndexEXT) + Store 93(v4) 102 + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 110 110 12 12 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 108 107(v5) 48 + 118: 103(fvec3) Load 115(gl_WorldRayOriginEXT) + Store 107(v5) 118 + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 122 122 12 12 + 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 120 119(v6) 48 + 128: 103(fvec3) Load 125(gl_WorldRayDirectionEXT) + Store 119(v6) 128 + 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 132 132 12 12 + 133: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 130 129(v7) 48 + 138: 103(fvec3) Load 135(gl_ObjectRayOriginEXT) + Store 129(v7) 138 + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 142 142 12 12 + 143: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 140 139(v8) 48 + 148: 103(fvec3) Load 145(gl_ObjectRayDirectionEXT) + Store 139(v8) 148 + 156: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 154 154 12 12 + 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 152 151(v9) 48 + 162: 24(float) Load 159(gl_RayTminEXT) + Store 151(v9) 162 + 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 166 166 12 12 + 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 164 163(v10) 48 + 174: 24(float) Load 169(gl_RayTmaxEXT) + Store 163(v10) 174 + 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 178 178 12 12 + 179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 176 175(v11) 48 + 181: 24(float) Load 169(gl_RayTmaxEXT) + Store 175(v11) 181 + 189: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 187 187 12 12 + 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 185 184(v12) 48 + 195: 7(int) Load 192(gl_HitKindEXT) + Store 184(v12) 195 + 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 207 207 12 12 + 208: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 205 204(v13) 48 + 215: 196 Load 212(gl_ObjectToWorldEXT) + Store 204(v13) 215 + 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 219 219 12 12 + 220: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 217 216(v14) 48 + 225: 196 Load 222(gl_WorldToObjectEXT) + Store 216(v14) 225 + 228: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 229 229 12 12 + Store 32(incomingPayload) 227 + 230: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 231 231 12 12 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.rt_nv_builtins.glsl.rahit.out b/third_party/glslang/Test/baseResults/spv.debuginfo.rt_nv_builtins.glsl.rahit.out new file mode 100644 index 0000000000..b9dcf112df --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.rt_nv_builtins.glsl.rahit.out @@ -0,0 +1,336 @@ +spv.debuginfo.rt_nv_builtins.glsl.rahit +// Module Version 10600 +// Generated by (magic number): 8000b +// Id's are bound by 232 + + Capability RayTracingNV + Extension "SPV_KHR_non_semantic_info" + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" + 3: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint AnyHitKHR 14 "main" 32 52 62 79 89 99 115 125 135 145 159 169 192 212 222 + 2: String "spv.debuginfo.rt_nv_builtins.glsl.rahit" + 8: String "uint" + 16: String "main" + 19: String "#version 460 +#extension GL_NV_ray_tracing : enable + +layout(location = 1) rayPayloadInNV vec4 incomingPayload; + +void main() +{ + uvec3 v0 = gl_LaunchIDNV; + uvec3 v1 = gl_LaunchSizeNV; + int v2 = gl_PrimitiveID; + int v3 = gl_InstanceID; + int v4 = gl_InstanceCustomIndexNV; + vec3 v5 = gl_WorldRayOriginNV; + vec3 v6 = gl_WorldRayDirectionNV; + vec3 v7 = gl_ObjectRayOriginNV; + vec3 v8 = gl_ObjectRayDirectionNV; + float v9 = gl_RayTminNV; + float v10 = gl_RayTmaxNV; + float v11 = gl_HitTNV; + uint v12 = gl_HitKindNV; + mat4x3 v13 = gl_ObjectToWorldNV; + mat4x3 v14 = gl_WorldToObjectNV; + incomingPayload = vec4(0.5f); +}" + 25: String "float" + 34: String "incomingPayload" + 46: String "v0" + 54: String "gl_LaunchIDNV" + 58: String "v1" + 64: String "gl_LaunchSizeNV" + 67: String "int" + 73: String "v2" + 81: String "gl_PrimitiveID" + 85: String "v3" + 91: String "gl_InstanceID" + 95: String "v4" + 101: String "gl_InstanceCustomIndexNV" + 109: String "v5" + 117: String "gl_WorldRayOriginNV" + 121: String "v6" + 127: String "gl_WorldRayDirectionNV" + 131: String "v7" + 137: String "gl_ObjectRayOriginNV" + 141: String "v8" + 147: String "gl_ObjectRayDirectionNV" + 153: String "v9" + 161: String "gl_RayTminNV" + 165: String "v10" + 171: String "gl_RayTmaxNV" + 173: String "gl_HitTNV" + 177: String "v11" + 186: String "v12" + 194: String "gl_HitKindNV" + 199: String "bool" + 206: String "v13" + 214: String "gl_ObjectToWorldNV" + 218: String "v14" + 224: String "gl_WorldToObjectNV" + SourceExtension "GL_NV_ray_tracing" + Name 14 "main" + Name 32 "incomingPayload" + Name 44 "v0" + Name 52 "gl_LaunchIDNV" + Name 56 "v1" + Name 62 "gl_LaunchSizeNV" + Name 71 "v2" + Name 79 "gl_PrimitiveID" + Name 83 "v3" + Name 89 "gl_InstanceID" + Name 93 "v4" + Name 99 "gl_InstanceCustomIndexNV" + Name 107 "v5" + Name 115 "gl_WorldRayOriginNV" + Name 119 "v6" + Name 125 "gl_WorldRayDirectionNV" + Name 129 "v7" + Name 135 "gl_ObjectRayOriginNV" + Name 139 "v8" + Name 145 "gl_ObjectRayDirectionNV" + Name 151 "v9" + Name 159 "gl_RayTminNV" + Name 163 "v10" + Name 169 "gl_RayTmaxNV" + Name 175 "v11" + Name 184 "v12" + Name 192 "gl_HitKindNV" + Name 204 "v13" + Name 212 "gl_ObjectToWorldNV" + Name 216 "v14" + Name 222 "gl_WorldToObjectNV" + ModuleProcessed "auto-map-locations" + ModuleProcessed "auto-map-bindings" + ModuleProcessed "client vulkan100" + ModuleProcessed "target-env spirv1.6" + ModuleProcessed "target-env vulkan1.4" + ModuleProcessed "keep-uncalled" + ModuleProcessed "entry-point main" + Decorate 32(incomingPayload) Location 1 + Decorate 52(gl_LaunchIDNV) BuiltIn LaunchIdKHR + Decorate 62(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR + Decorate 79(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 89(gl_InstanceID) BuiltIn InstanceId + Decorate 99(gl_InstanceCustomIndexNV) BuiltIn InstanceCustomIndexKHR + Decorate 115(gl_WorldRayOriginNV) BuiltIn WorldRayOriginKHR + Decorate 125(gl_WorldRayDirectionNV) BuiltIn WorldRayDirectionKHR + Decorate 135(gl_ObjectRayOriginNV) BuiltIn ObjectRayOriginKHR + Decorate 145(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionKHR + Decorate 159(gl_RayTminNV) BuiltIn RayTminKHR + Decorate 169(gl_RayTmaxNV) BuiltIn RayTmaxKHR + Decorate 192(gl_HitKindNV) BuiltIn HitKindKHR + Decorate 212(gl_ObjectToWorldNV) BuiltIn ObjectToWorldKHR + Decorate 222(gl_WorldToObjectNV) BuiltIn WorldToObjectKHR + 4: TypeVoid + 5: TypeFunction 4 + 7: TypeInt 32 0 + 10: 7(int) Constant 32 + 11: 7(int) Constant 6 + 12: 7(int) Constant 0 + 9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12 + 13: 7(int) Constant 3 + 6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 + 18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19 + 21: 7(int) Constant 1 + 22: 7(int) Constant 4 + 23: 7(int) Constant 2 + 20: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 21 22 18 23 + 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 11 12 20 16 13 11 + 24: TypeFloat 32 + 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 25 10 13 12 + 27: TypeVector 24(float) 4 + 28: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 26 22 + 29: TypePointer IncomingRayPayloadKHR 27(fvec4) + 30: 7(int) Constant 5342 + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 28 30 12 +32(incomingPayload): 29(ptr) Variable IncomingRayPayloadKHR + 35: 7(int) Constant 8 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 34 28 18 22 12 20 34 32(incomingPayload) 35 + 39: TypeVector 7(int) 3 + 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 9 13 + 41: TypePointer Function 39(ivec3) + 42: 7(int) Constant 7 + 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 40 42 12 + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 46 40 18 35 12 17 22 + 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 50: TypePointer Input 39(ivec3) + 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 40 21 12 +52(gl_LaunchIDNV): 50(ptr) Variable Input + 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 54 40 18 35 12 20 54 52(gl_LaunchIDNV) 35 + 59: 7(int) Constant 9 + 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 58 40 18 59 12 17 22 +62(gl_LaunchSizeNV): 50(ptr) Variable Input + 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 64 40 18 59 12 20 64 62(gl_LaunchSizeNV) 35 + 66: TypeInt 32 1 + 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 67 10 22 12 + 69: TypePointer Function 66(int) + 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 68 42 12 + 74: 7(int) Constant 10 + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 73 68 18 74 12 17 22 + 77: TypePointer Input 66(int) + 78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 68 21 12 +79(gl_PrimitiveID): 77(ptr) Variable Input + 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 81 68 18 74 12 20 81 79(gl_PrimitiveID) 35 + 86: 7(int) Constant 11 + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 85 68 18 86 12 17 22 +89(gl_InstanceID): 77(ptr) Variable Input + 90: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 91 68 18 86 12 20 91 89(gl_InstanceID) 35 + 96: 7(int) Constant 12 + 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 95 68 18 96 12 17 22 +99(gl_InstanceCustomIndexNV): 77(ptr) Variable Input + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 101 68 18 96 12 20 101 99(gl_InstanceCustomIndexNV) 35 + 103: TypeVector 24(float) 3 + 104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 26 13 + 105: TypePointer Function 103(fvec3) + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 104 42 12 + 110: 7(int) Constant 13 + 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 109 104 18 110 12 17 22 + 113: TypePointer Input 103(fvec3) + 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 104 21 12 +115(gl_WorldRayOriginNV): 113(ptr) Variable Input + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 117 104 18 110 12 20 117 115(gl_WorldRayOriginNV) 35 + 122: 7(int) Constant 14 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 121 104 18 122 12 17 22 +125(gl_WorldRayDirectionNV): 113(ptr) Variable Input + 126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 127 104 18 122 12 20 127 125(gl_WorldRayDirectionNV) 35 + 132: 7(int) Constant 15 + 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 131 104 18 132 12 17 22 +135(gl_ObjectRayOriginNV): 113(ptr) Variable Input + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 137 104 18 132 12 20 137 135(gl_ObjectRayOriginNV) 35 + 142: 7(int) Constant 16 + 140: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 141 104 18 142 12 17 22 +145(gl_ObjectRayDirectionNV): 113(ptr) Variable Input + 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 147 104 18 142 12 20 147 145(gl_ObjectRayDirectionNV) 35 + 149: TypePointer Function 24(float) + 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 26 42 12 + 154: 7(int) Constant 17 + 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 153 26 18 154 12 17 22 + 157: TypePointer Input 24(float) + 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 26 21 12 +159(gl_RayTminNV): 157(ptr) Variable Input + 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 161 26 18 154 12 20 161 159(gl_RayTminNV) 35 + 166: 7(int) Constant 18 + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 165 26 18 166 12 17 22 +169(gl_RayTmaxNV): 157(ptr) Variable Input + 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 171 26 18 166 12 20 171 169(gl_RayTmaxNV) 35 + 172: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 173 26 18 166 12 20 173 169(gl_RayTmaxNV) 35 + 178: 7(int) Constant 19 + 176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 177 26 18 178 12 17 22 + 182: TypePointer Function 7(int) + 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 42 12 + 187: 7(int) Constant 20 + 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 186 9 18 187 12 17 22 + 190: TypePointer Input 7(int) + 191: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 21 12 +192(gl_HitKindNV): 190(ptr) Variable Input + 193: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 194 9 18 187 12 20 194 192(gl_HitKindNV) 35 + 196: TypeMatrix 103(fvec3) 4 + 198: TypeBool + 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 199 10 23 12 + 201: 198(bool) ConstantTrue + 197: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108(DebugTypeMatrix) 104 22 201 + 202: TypePointer Function 196 + 203: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 197 42 12 + 207: 7(int) Constant 21 + 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 206 197 18 207 12 17 22 + 210: TypePointer Input 196 + 211: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 197 21 12 +212(gl_ObjectToWorldNV): 210(ptr) Variable Input + 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 214 197 18 207 12 20 214 212(gl_ObjectToWorldNV) 35 + 219: 7(int) Constant 22 + 217: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 218 197 18 219 12 17 22 +222(gl_WorldToObjectNV): 210(ptr) Variable Input + 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 224 197 18 219 12 20 224 222(gl_WorldToObjectNV) 35 + 226: 24(float) Constant 1056964608 + 227: 27(fvec4) ConstantComposite 226 226 226 226 + 229: 7(int) Constant 23 + 231: 7(int) Constant 24 + 14(main): 4 Function None 5 + 15: Label + 44(v0): 41(ptr) Variable Function + 56(v1): 41(ptr) Variable Function + 71(v2): 69(ptr) Variable Function + 83(v3): 69(ptr) Variable Function + 93(v4): 69(ptr) Variable Function + 107(v5): 105(ptr) Variable Function + 119(v6): 105(ptr) Variable Function + 129(v7): 105(ptr) Variable Function + 139(v8): 105(ptr) Variable Function + 151(v9): 149(ptr) Variable Function + 163(v10): 149(ptr) Variable Function + 175(v11): 149(ptr) Variable Function + 184(v12): 182(ptr) Variable Function + 204(v13): 202(ptr) Variable Function + 216(v14): 202(ptr) Variable Function + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 38: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 11 11 12 12 + 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 35 35 12 12 + 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 45 44(v0) 48 + 55: 39(ivec3) Load 52(gl_LaunchIDNV) + Store 44(v0) 55 + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 59 59 12 12 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 57 56(v1) 48 + 65: 39(ivec3) Load 62(gl_LaunchSizeNV) + Store 56(v1) 65 + 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 74 74 12 12 + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 72 71(v2) 48 + 82: 66(int) Load 79(gl_PrimitiveID) + Store 71(v2) 82 + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 86 86 12 12 + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 84 83(v3) 48 + 92: 66(int) Load 89(gl_InstanceID) + Store 83(v3) 92 + 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 96 96 12 12 + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 94 93(v4) 48 + 102: 66(int) Load 99(gl_InstanceCustomIndexNV) + Store 93(v4) 102 + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 110 110 12 12 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 108 107(v5) 48 + 118: 103(fvec3) Load 115(gl_WorldRayOriginNV) + Store 107(v5) 118 + 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 122 122 12 12 + 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 120 119(v6) 48 + 128: 103(fvec3) Load 125(gl_WorldRayDirectionNV) + Store 119(v6) 128 + 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 132 132 12 12 + 133: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 130 129(v7) 48 + 138: 103(fvec3) Load 135(gl_ObjectRayOriginNV) + Store 129(v7) 138 + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 142 142 12 12 + 143: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 140 139(v8) 48 + 148: 103(fvec3) Load 145(gl_ObjectRayDirectionNV) + Store 139(v8) 148 + 156: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 154 154 12 12 + 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 152 151(v9) 48 + 162: 24(float) Load 159(gl_RayTminNV) + Store 151(v9) 162 + 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 166 166 12 12 + 167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 164 163(v10) 48 + 174: 24(float) Load 169(gl_RayTmaxNV) + Store 163(v10) 174 + 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 178 178 12 12 + 179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 176 175(v11) 48 + 181: 24(float) Load 169(gl_RayTmaxNV) + Store 175(v11) 181 + 189: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 187 187 12 12 + 188: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 185 184(v12) 48 + 195: 7(int) Load 192(gl_HitKindNV) + Store 184(v12) 195 + 209: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 207 207 12 12 + 208: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 205 204(v13) 48 + 215: 196 Load 212(gl_ObjectToWorldNV) + Store 204(v13) 215 + 221: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 219 219 12 12 + 220: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 217 216(v14) 48 + 225: 196 Load 222(gl_WorldToObjectNV) + Store 216(v14) 225 + 228: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 229 229 12 12 + Store 32(incomingPayload) 227 + 230: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 231 231 12 12 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out b/third_party/glslang/Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out index 0438409783..c60aa7733f 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out @@ -1,31 +1,29 @@ spv.debuginfo.rt_types.glsl.rgen -// Module Version 10000 +// Module Version 10600 // Generated by (magic number): 8000b -// Id's are bound by 127 +// Id's are bound by 217 Capability RayQueryKHR Capability RayTracingNV + Capability ShaderInvocationReorderNV Extension "SPV_KHR_non_semantic_info" Extension "SPV_KHR_ray_query" Extension "SPV_NV_ray_tracing" + Extension "SPV_NV_shader_invocation_reorder" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint RayGenerationKHR 14 "main" + EntryPoint RayGenerationKHR 14 "main" 42 54 73 83 93 156 195 2: String "spv.debuginfo.rt_types.glsl.rgen" 8: String "uint" - 16: String "main" - 19: String "// OpModuleProcessed auto-map-locations -// OpModuleProcessed auto-map-bindings -// OpModuleProcessed client vulkan100 -// OpModuleProcessed target-env vulkan1.0 -// OpModuleProcessed keep-uncalled -// OpModuleProcessed entry-point main -#line 1 -#version 460 + 18: String "testRayQuery" + 21: String "#version 460 #extension GL_NV_ray_tracing : enable +#extension GL_NV_shader_invocation_reorder : enable #extension GL_EXT_ray_query : enable + layout(binding = 0, set = 0) uniform accelerationStructureEXT acc0; +layout(location = 1) rayPayloadEXT vec4 payload; layout(shaderRecordNV) buffer block { @@ -33,51 +31,98 @@ layout(shaderRecordNV) buffer block vec3 origin; }; -void main() -{ - rayQueryEXT localRayQuery; +rayQueryEXT globalRayQuery; +hitObjectNV globalHitObject; + +void testRayQuery() { uint rayFlags = gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT; float tMin = 0.f; float tMax = 1000.f; + + rayQueryInitializeEXT(globalRayQuery, acc0, rayFlags, 0xFF , origin, tMin, dir, tMax); + if (!rayQueryProceedEXT(globalRayQuery)) + { + rayQueryTerminateEXT(globalRayQuery); + } + + rayQueryEXT localRayQuery; rayQueryInitializeEXT(localRayQuery, acc0, rayFlags, 0xFF , origin, tMin, dir, tMax); if (!rayQueryProceedEXT(localRayQuery)) { rayQueryTerminateEXT(localRayQuery); } } + + +void testHitObject() { + + hitObjectTraceRayNV(globalHitObject, acc0, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 1); + + hitObjectNV localHitObject; + hitObjectTraceRayNV(localHitObject, acc0, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 1); +} + +void main() +{ + testRayQuery(); + testHitObject(); +} " - 33: String "rayFlags" - 40: String "float" - 46: String "tMin" - 53: String "tMax" - 60: String "rayQuery" - 62: String "@rayQuery" - 68: String "localRayQuery" - 72: String "accelerationStructure" - 73: String "@accelerationStructure" - 78: String "acc0" - 87: String "origin" - 90: String "block" - 96: String "" - 98: String "int" - 111: String "bool" + 29: String "testHitObject" + 32: String "main" + 37: String "accelerationStructure" + 38: String "@accelerationStructure" + 44: String "acc0" + 47: String "float" + 56: String "payload" + 62: String "dir" + 65: String "origin" + 68: String "block" + 75: String "" + 78: String "rayQuery" + 80: String "@rayQuery" + 85: String "globalRayQuery" + 88: String "hitObjectNV" + 90: String "@hitObjectNV" + 95: String "globalHitObject" + 103: String "rayFlags" + 112: String "tMin" + 119: String "tMax" + 130: String "int" + 143: String "bool" + 158: String "localRayQuery" + 197: String "localHitObject" SourceExtension "GL_EXT_ray_query" SourceExtension "GL_NV_ray_tracing" + SourceExtension "GL_NV_shader_invocation_reorder" Name 14 "main" - Name 31 "rayFlags" - Name 44 "tMin" - Name 51 "tMax" - Name 66 "localRayQuery" - Name 76 "acc0" - Name 85 "block" - MemberName 85(block) 0 "dir" - MemberName 85(block) 1 "origin" - Name 94 "" - Decorate 76(acc0) Binding 0 - Decorate 76(acc0) DescriptorSet 0 - Decorate 85(block) BufferBlock - MemberDecorate 85(block) 0 Offset 0 - MemberDecorate 85(block) 1 Offset 16 + Name 16 "testRayQuery(" + Name 27 "testHitObject(" + Name 42 "acc0" + Name 54 "payload" + Name 60 "block" + MemberName 60(block) 0 "dir" + MemberName 60(block) 1 "origin" + Name 73 "" + Name 83 "globalRayQuery" + Name 93 "globalHitObject" + Name 101 "rayFlags" + Name 110 "tMin" + Name 117 "tMax" + Name 156 "localRayQuery" + Name 195 "localHitObject" + ModuleProcessed "auto-map-locations" + ModuleProcessed "auto-map-bindings" + ModuleProcessed "client vulkan100" + ModuleProcessed "target-env spirv1.6" + ModuleProcessed "target-env vulkan1.4" + ModuleProcessed "keep-uncalled" + ModuleProcessed "entry-point main" + Decorate 42(acc0) Binding 0 + Decorate 42(acc0) DescriptorSet 0 + Decorate 60(block) Block + MemberDecorate 60(block) 0 Offset 0 + MemberDecorate 60(block) 1 Offset 16 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -87,109 +132,201 @@ void main() 9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12 13: 7(int) Constant 3 6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 - 18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19 - 20: 7(int) Constant 12 - 22: 7(int) Constant 1 - 23: 7(int) Constant 4 - 24: 7(int) Constant 2 - 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 - 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 - 28: TypePointer Function 7(int) - 29: 7(int) Constant 7 - 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 29 12 - 34: 7(int) Constant 15 - 32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 33 9 18 34 12 17 23 - 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) - 38: 7(int) Constant 9 - 39: TypeFloat 32 - 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 40 10 13 12 - 42: TypePointer Function 39(float) - 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 41 29 12 - 47: 7(int) Constant 16 - 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 46 41 18 47 12 17 23 - 50: 39(float) Constant 0 - 54: 7(int) Constant 17 - 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 53 41 18 54 12 17 23 - 57: 39(float) Constant 1148846080 - 58: TypeRayQueryKHR - 61: 7(int) Constant 18 - 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) - 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 60 22 18 61 12 21 62 63 13 - 64: TypePointer Private 58 - 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 59 11 12 -66(localRayQuery): 64(ptr) Variable Private - 69: 7(int) Constant 8 - 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 68 59 18 61 12 21 68 66(localRayQuery) 69 - 70: TypeAccelerationStructureKHR - 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 72 22 18 61 12 21 73 63 13 - 74: TypePointer UniformConstant 70 - 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 71 12 12 - 76(acc0): 74(ptr) Variable UniformConstant - 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 78 71 18 61 12 21 78 76(acc0) 69 - 82: 7(int) Constant 255 - 83: TypeVector 39(float) 3 - 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 41 13 - 85(block): TypeStruct 83(fvec3) 83(fvec3) - 86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 87 84 18 38 29 12 12 13 - 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 87 84 18 38 29 12 12 13 - 89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 90 22 18 61 12 21 90 12 13 86 88 - 91: TypePointer ShaderRecordBufferKHR 85(block) - 92: 7(int) Constant 5343 - 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 89 92 12 - 94: 91(ptr) Variable ShaderRecordBufferKHR - 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 96 89 18 61 12 21 96 94 69 - 97: TypeInt 32 1 - 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 98 10 23 12 - 100: 97(int) Constant 1 - 101: TypePointer ShaderRecordBufferKHR 83(fvec3) - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 84 92 12 - 106: 97(int) Constant 0 - 110: TypeBool - 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 111 10 24 12 - 115: 7(int) Constant 19 + 20: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 21 + 22: 7(int) Constant 18 + 24: 7(int) Constant 1 + 25: 7(int) Constant 4 + 26: 7(int) Constant 2 + 23: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 24 25 20 26 + 19: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 18 6 20 22 12 23 18 13 22 + 31: 7(int) Constant 38 + 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 29 6 20 31 12 23 29 13 31 + 34: 7(int) Constant 46 + 33: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 32 6 20 34 12 23 32 13 34 + 35: TypeAccelerationStructureKHR + 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) + 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 37 24 20 11 12 23 38 39 13 + 40: TypePointer UniformConstant 35 + 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 36 12 12 + 42(acc0): 40(ptr) Variable UniformConstant + 45: 7(int) Constant 8 + 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 44 36 20 11 12 23 44 42(acc0) 45 + 46: TypeFloat 32 + 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 47 10 13 12 + 49: TypeVector 46(float) 4 + 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 48 25 + 51: TypePointer RayPayloadKHR 49(fvec4) + 52: 7(int) Constant 5338 + 53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 50 52 12 + 54(payload): 51(ptr) Variable RayPayloadKHR + 57: 7(int) Constant 7 + 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 56 50 20 57 12 23 56 54(payload) 45 + 58: TypeVector 46(float) 3 + 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 48 13 + 60(block): TypeStruct 58(fvec3) 58(fvec3) + 63: 7(int) Constant 11 + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 62 59 20 63 57 12 12 13 + 66: 7(int) Constant 12 + 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 65 59 20 66 57 12 12 13 + 69: 7(int) Constant 9 + 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 68 24 20 69 12 23 68 12 13 61 64 + 70: TypePointer ShaderRecordBufferKHR 60(block) + 71: 7(int) Constant 5343 + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 67 71 12 + 73: 70(ptr) Variable ShaderRecordBufferKHR + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 75 67 20 69 12 23 75 73 45 + 76: TypeRayQueryKHR + 79: 7(int) Constant 15 + 77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 78 24 20 79 12 23 80 39 13 + 81: TypePointer Private 76 + 82: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 77 11 12 +83(globalRayQuery): 81(ptr) Variable Private + 84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 85 77 20 79 12 23 85 83(globalRayQuery) 45 + 86: TypeHitObjectNV + 89: 7(int) Constant 16 + 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 88 24 20 89 12 23 90 39 13 + 91: TypePointer Private 86 + 92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 87 11 12 +93(globalHitObject): 91(ptr) Variable Private + 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 95 87 20 89 12 23 95 93(globalHitObject) 45 + 99: TypePointer Function 7(int) + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 57 12 + 104: 7(int) Constant 19 + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 103 9 20 104 12 19 25 + 106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression) + 108: TypePointer Function 46(float) + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 48 57 12 + 113: 7(int) Constant 20 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 112 48 20 113 12 19 25 + 116: 46(float) Constant 0 120: 7(int) Constant 21 - 121: 7(int) Constant 30 - 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 18 120 121 17 + 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 119 48 20 120 12 19 25 + 123: 46(float) Constant 1148846080 126: 7(int) Constant 23 + 128: 7(int) Constant 255 + 129: TypeInt 32 1 + 131: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 130 10 25 12 + 132: 129(int) Constant 1 + 133: TypePointer ShaderRecordBufferKHR 58(fvec3) + 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 59 71 12 + 138: 129(int) Constant 0 + 142: TypeBool + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 143 10 26 12 + 147: 7(int) Constant 24 + 152: 7(int) Constant 26 + 153: 7(int) Constant 30 + 151: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 152 153 19 +156(localRayQuery): 81(ptr) Variable Private + 159: 7(int) Constant 29 + 157: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 158 77 20 159 12 19 25 + 174: 7(int) Constant 31 + 179: 7(int) Constant 33 + 178: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 21(DebugLexicalBlock) 20 179 153 19 + 184: 7(int) Constant 35 + 190: 7(int) Constant 40 + 191: 46(float) Constant 1056964608 + 192: 58(fvec3) ConstantComposite 191 191 191 + 193: 46(float) Constant 1065353216 + 194: 58(fvec3) ConstantComposite 193 193 193 +195(localHitObject): 91(ptr) Variable Private + 198: 7(int) Constant 42 + 196: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 197 87 20 198 12 30 25 + 203: 7(int) Constant 43 + 205: 7(int) Constant 44 + 211: 7(int) Constant 48 + 214: 7(int) Constant 49 + 216: 7(int) Constant 50 14(main): 4 Function None 5 15: Label - 31(rayFlags): 28(ptr) Variable Function - 44(tMin): 42(ptr) Variable Function - 51(tMax): 42(ptr) Variable Function - 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 - 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 34 34 12 12 - 35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 32 31(rayFlags) 36 - Store 31(rayFlags) 38 - 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 47 47 12 12 - 48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 45 44(tMin) 36 - Store 44(tMin) 50 - 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 54 54 12 12 - 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 52 51(tMax) 36 - Store 51(tMax) 57 - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 61 61 12 12 - 79: 70 Load 76(acc0) - 81: 7(int) Load 31(rayFlags) - 103: 101(ptr) AccessChain 94 100 - 104: 83(fvec3) Load 103 - 105: 39(float) Load 44(tMin) - 107: 101(ptr) AccessChain 94 106 - 108: 83(fvec3) Load 107 - 109: 39(float) Load 51(tMax) - RayQueryInitializeKHR 66(localRayQuery) 79 81 82 104 105 108 109 - 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 115 115 12 12 - 113: 110(bool) RayQueryProceedKHR 66(localRayQuery) - 116: 110(bool) LogicalNot 113 - SelectionMerge 118 None - BranchConditional 116 117 118 - 117: Label - 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 119 - 123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 120 120 12 12 - RayQueryTerminateKHR 66(localRayQuery) - Branch 118 - 118: Label - 124: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 126 126 12 12 + 207: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 33 + 208: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 34 34 12 12 + 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 33 14(main) + 210: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 211 211 12 12 + 209: 4 FunctionCall 16(testRayQuery() + 213: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 214 214 12 12 + 212: 4 FunctionCall 27(testHitObject() + 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 216 216 12 12 + Return + FunctionEnd +16(testRayQuery(): 4 Function None 5 + 17: Label + 101(rayFlags): 99(ptr) Variable Function + 110(tMin): 108(ptr) Variable Function + 117(tMax): 108(ptr) Variable Function + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19 + 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 22 22 12 12 + 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 19 16(testRayQuery() + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 104 104 12 12 + 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 102 101(rayFlags) 106 + Store 101(rayFlags) 69 + 115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 113 113 12 12 + 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 111 110(tMin) 106 + Store 110(tMin) 116 + 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 120 120 12 12 + 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 118 117(tMax) 106 + Store 117(tMax) 123 + 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 126 126 12 12 + 124: 35 Load 42(acc0) + 127: 7(int) Load 101(rayFlags) + 135: 133(ptr) AccessChain 73 132 + 136: 58(fvec3) Load 135 + 137: 46(float) Load 110(tMin) + 139: 133(ptr) AccessChain 73 138 + 140: 58(fvec3) Load 139 + 141: 46(float) Load 117(tMax) + RayQueryInitializeKHR 83(globalRayQuery) 124 127 128 136 137 140 141 + 146: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 147 147 12 12 + 145: 142(bool) RayQueryProceedKHR 83(globalRayQuery) + 148: 142(bool) LogicalNot 145 + SelectionMerge 150 None + BranchConditional 148 149 150 + 149: Label + 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 151 + 155: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 152 152 12 12 + RayQueryTerminateKHR 83(globalRayQuery) + Branch 150 + 150: Label + 161: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19 + 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 159 159 12 12 + 160: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 157 156(localRayQuery) 106 + 164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 153 153 12 12 + 163: 35 Load 42(acc0) + 165: 7(int) Load 101(rayFlags) + 166: 133(ptr) AccessChain 73 132 + 167: 58(fvec3) Load 166 + 168: 46(float) Load 110(tMin) + 169: 133(ptr) AccessChain 73 138 + 170: 58(fvec3) Load 169 + 171: 46(float) Load 117(tMax) + RayQueryInitializeKHR 156(localRayQuery) 163 165 128 167 168 170 171 + 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 174 174 12 12 + 172: 142(bool) RayQueryProceedKHR 156(localRayQuery) + 175: 142(bool) LogicalNot 172 + SelectionMerge 177 None + BranchConditional 175 176 177 + 176: Label + 180: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 178 + 181: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 179 179 12 12 + RayQueryTerminateKHR 156(localRayQuery) + Branch 177 + 177: Label + 182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19 + 183: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 184 184 12 12 + Return + FunctionEnd +27(testHitObject(): 4 Function None 5 + 28: Label + 186: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 30 + 187: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 31 31 12 12 + 185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 30 27(testHitObject() + 189: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 190 190 12 12 + 188: 35 Load 42(acc0) + HitObjectTraceRayNV 93(globalHitObject) 188 24 24 24 24 24 192 191 194 193 54(payload) + 200: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 198 198 12 12 + 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 196 195(localHitObject) 106 + 202: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 203 203 12 12 + 201: 35 Load 42(acc0) + HitObjectTraceRayNV 195(localHitObject) 201 24 24 24 24 24 192 191 194 193 54(payload) + 204: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 205 205 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.sampler_type.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.sampler_type.glsl.frag.out new file mode 100644 index 0000000000..dcfedabcbd --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.sampler_type.glsl.frag.out @@ -0,0 +1,173 @@ +spv.debuginfo.sampler_type.glsl.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 114 + + Capability Shader + Capability SampledCubeArray + Extension "SPV_KHR_non_semantic_info" + 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" + 3: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 14 "main" + ExecutionMode 14 OriginUpperLeft + 2: String "spv.debuginfo.sampler_type.glsl.frag" + 8: String "uint" + 16: String "main" + 19: String "// OpModuleProcessed auto-map-locations +// OpModuleProcessed auto-map-bindings +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed keep-uncalled +// OpModuleProcessed entry-point main +#line 1 +#version 460 + +layout(rgba8, binding = 0) uniform image2D test_image2D; + +layout(rgba8ui, binding = 1) uniform uimage2D test_uimage2D; + +layout(binding = 2) uniform sampler test_sampler; + +layout(binding = 3) uniform sampler2D test_sampler2D; + +layout(binding = 4) uniform usampler3D test_usampler3D; + +layout(binding = 5) uniform samplerCubeArray test_samplerCubeArray; + +layout(binding = 6) uniform texture2DArray test_texture2DArray; + +void main() { + +}" + 26: String "float" + 30: String "image2D" + 31: String "@image2D" + 37: String "test_image2D" + 41: String "uimage2D" + 43: String "@uimage2D" + 48: String "test_uimage2D" + 51: String "sampler" + 53: String "@sampler" + 58: String "test_sampler" + 61: String "texture2D" + 63: String "@texture2D" + 66: String "sampler2D" + 67: String "@sampler2D" + 72: String "test_sampler2D" + 75: String "utexture3D" + 77: String "@utexture3D" + 80: String "usampler3D" + 81: String "@usampler3D" + 86: String "test_usampler3D" + 89: String "textureCubeArray" + 91: String "@textureCubeArray" + 94: String "samplerCubeArray" + 95: String "@samplerCubeArray" + 100: String "test_samplerCubeArray" + 103: String "texture2DArray" + 105: String "@texture2DArray" + 110: String "test_texture2DArray" + Name 14 "main" + Name 35 "test_image2D" + Name 46 "test_uimage2D" + Name 56 "test_sampler" + Name 70 "test_sampler2D" + Name 84 "test_usampler3D" + Name 98 "test_samplerCubeArray" + Name 108 "test_texture2DArray" + Decorate 35(test_image2D) Binding 0 + Decorate 35(test_image2D) DescriptorSet 0 + Decorate 46(test_uimage2D) Binding 1 + Decorate 46(test_uimage2D) DescriptorSet 0 + Decorate 56(test_sampler) Binding 2 + Decorate 56(test_sampler) DescriptorSet 0 + Decorate 70(test_sampler2D) Binding 3 + Decorate 70(test_sampler2D) DescriptorSet 0 + Decorate 84(test_usampler3D) Binding 4 + Decorate 84(test_usampler3D) DescriptorSet 0 + Decorate 98(test_samplerCubeArray) Binding 5 + Decorate 98(test_samplerCubeArray) DescriptorSet 0 + Decorate 108(test_texture2DArray) Binding 6 + Decorate 108(test_texture2DArray) DescriptorSet 0 + 4: TypeVoid + 5: TypeFunction 4 + 7: TypeInt 32 0 + 10: 7(int) Constant 32 + 11: 7(int) Constant 6 + 12: 7(int) Constant 0 + 9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12 + 13: 7(int) Constant 3 + 6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 + 18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19 + 20: 7(int) Constant 17 + 22: 7(int) Constant 1 + 23: 7(int) Constant 4 + 24: 7(int) Constant 2 + 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 + 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 + 25: TypeFloat 32 + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 13 12 + 28: TypeImage 25(float) 2D nonsampled format:Rgba8 + 32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone) + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 30 22 18 13 12 21 31 32 13 + 33: TypePointer UniformConstant 28 + 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 12 12 +35(test_image2D): 33(ptr) Variable UniformConstant + 38: 7(int) Constant 8 + 36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 37 29 18 13 12 21 37 35(test_image2D) 38 + 39: TypeImage 7(int) 2D nonsampled format:Rgba8ui + 42: 7(int) Constant 5 + 40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 41 22 18 42 12 21 43 32 13 + 44: TypePointer UniformConstant 39 + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 40 12 12 +46(test_uimage2D): 44(ptr) Variable UniformConstant + 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 48 40 18 42 12 21 48 46(test_uimage2D) 38 + 49: TypeSampler + 52: 7(int) Constant 7 + 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 51 22 18 52 12 21 53 32 13 + 54: TypePointer UniformConstant 49 + 55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 50 12 12 +56(test_sampler): 54(ptr) Variable UniformConstant + 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 58 50 18 52 12 21 58 56(test_sampler) 38 + 59: TypeImage 25(float) 2D sampled format:Unknown + 62: 7(int) Constant 9 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 61 22 18 62 12 21 63 32 13 + 64: TypeSampledImage 59 + 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 66 22 18 62 12 21 67 32 13 + 68: TypePointer UniformConstant 64 + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 65 12 12 +70(test_sampler2D): 68(ptr) Variable UniformConstant + 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 72 65 18 62 12 21 72 70(test_sampler2D) 38 + 73: TypeImage 7(int) 3D sampled format:Unknown + 76: 7(int) Constant 11 + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 75 22 18 76 12 21 77 32 13 + 78: TypeSampledImage 73 + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 80 22 18 76 12 21 81 32 13 + 82: TypePointer UniformConstant 78 + 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 79 12 12 +84(test_usampler3D): 82(ptr) Variable UniformConstant + 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 86 79 18 76 12 21 86 84(test_usampler3D) 38 + 87: TypeImage 25(float) Cube array sampled format:Unknown + 90: 7(int) Constant 13 + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 89 22 18 90 12 21 91 32 13 + 92: TypeSampledImage 87 + 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 94 22 18 90 12 21 95 32 13 + 96: TypePointer UniformConstant 92 + 97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 12 12 +98(test_samplerCubeArray): 96(ptr) Variable UniformConstant + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 100 93 18 90 12 21 100 98(test_samplerCubeArray) 38 + 101: TypeImage 25(float) 2D array sampled format:Unknown + 104: 7(int) Constant 15 + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 103 22 18 104 12 21 105 32 13 + 106: TypePointer UniformConstant 101 + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 102 12 12 +108(test_texture2DArray): 106(ptr) Variable UniformConstant + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 110 102 18 104 12 21 110 108(test_texture2DArray) 38 + 14(main): 4 Function None 5 + 15: Label + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.scalar_types.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.scalar_types.glsl.frag.out index 019c0a0363..063dc7153e 100644 --- a/third_party/glslang/Test/baseResults/spv.debuginfo.scalar_types.glsl.frag.out +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.scalar_types.glsl.frag.out @@ -1,7 +1,7 @@ spv.debuginfo.scalar_types.glsl.frag // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 161 +// Id's are bound by 172 Capability Shader Capability Float16 @@ -80,43 +80,43 @@ void main() { VAR_uint64_t = uint64_t(0); VAR_float16_t = float16_t(0); }" - 29: String "bool" - 35: String "VAR_bool" - 41: String "int" - 47: String "VAR_int" - 55: String "VAR_uint" - 59: String "float" - 65: String "VAR_float" - 70: String "double" - 77: String "VAR_double" - 82: String "int8_t" - 88: String "VAR_int8_t" - 93: String "uint8_t" - 99: String "VAR_uint8_t" - 104: String "int16_t" - 111: String "VAR_int16_t" - 116: String "uint16_t" - 122: String "VAR_uint16_t" - 127: String "int64_t" - 133: String "VAR_int64_t" - 138: String "uint64_t" - 144: String "VAR_uint64_t" - 149: String "float16_t" - 155: String "VAR_float16_t" + 26: String "bool" + 32: String "VAR_bool" + 36: String "int" + 42: String "VAR_int" + 48: String "VAR_uint" + 51: String "float" + 57: String "VAR_float" + 59: String "double" + 66: String "VAR_double" + 69: String "int8_t" + 75: String "VAR_int8_t" + 78: String "uint8_t" + 84: String "VAR_uint8_t" + 87: String "int16_t" + 94: String "VAR_int16_t" + 97: String "uint16_t" + 103: String "VAR_uint16_t" + 106: String "int64_t" + 112: String "VAR_int64_t" + 115: String "uint64_t" + 121: String "VAR_uint64_t" + 124: String "float16_t" + 130: String "VAR_float16_t" SourceExtension "GL_EXT_shader_explicit_arithmetic_types" Name 14 "main" - Name 33 "VAR_bool" - Name 45 "VAR_int" - Name 53 "VAR_uint" - Name 63 "VAR_float" - Name 75 "VAR_double" - Name 86 "VAR_int8_t" - Name 97 "VAR_uint8_t" - Name 109 "VAR_int16_t" - Name 120 "VAR_uint16_t" - Name 131 "VAR_int64_t" - Name 142 "VAR_uint64_t" - Name 153 "VAR_float16_t" + Name 30 "VAR_bool" + Name 40 "VAR_int" + Name 46 "VAR_uint" + Name 55 "VAR_float" + Name 64 "VAR_double" + Name 73 "VAR_int8_t" + Name 82 "VAR_uint8_t" + Name 92 "VAR_int16_t" + Name 101 "VAR_uint16_t" + Name 110 "VAR_int64_t" + Name 119 "VAR_uint64_t" + Name 128 "VAR_float16_t" 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -133,132 +133,143 @@ void main() { 24: 7(int) Constant 2 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 - 28: TypeBool - 30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 29 10 24 12 - 31: TypePointer Private 28(bool) - 32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 11 12 - 33(VAR_bool): 31(ptr) Variable Private - 36: 7(int) Constant 43 - 37: 7(int) Constant 8 - 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 35 30 18 36 12 21 35 33(VAR_bool) 37 - 38: 28(bool) ConstantFalse - 40: TypeInt 32 1 - 42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 41 10 23 12 - 43: TypePointer Private 40(int) - 44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 42 11 12 - 45(VAR_int): 43(ptr) Variable Private - 48: 7(int) Constant 44 - 46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 47 42 18 48 12 21 47 45(VAR_int) 37 - 49: 40(int) Constant 0 - 51: TypePointer Private 7(int) - 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 11 12 - 53(VAR_uint): 51(ptr) Variable Private - 56: 7(int) Constant 45 - 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 55 9 18 56 12 21 55 53(VAR_uint) 37 - 58: TypeFloat 32 - 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 59 10 13 12 - 61: TypePointer Private 58(float) - 62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 60 11 12 - 63(VAR_float): 61(ptr) Variable Private - 66: 7(int) Constant 46 - 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 65 60 18 66 12 21 65 63(VAR_float) 37 - 67: 58(float) Constant 0 - 69: TypeFloat 64 - 72: 7(int) Constant 64 - 71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 70 72 13 12 - 73: TypePointer Private 69(float64_t) - 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 71 11 12 - 75(VAR_double): 73(ptr) Variable Private - 78: 7(int) Constant 47 - 76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 77 71 18 78 12 21 77 75(VAR_double) 37 - 79:69(float64_t) Constant 0 0 - 81: TypeInt 8 1 - 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 82 37 23 12 - 84: TypePointer Private 81(int8_t) - 85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 83 11 12 - 86(VAR_int8_t): 84(ptr) Variable Private - 89: 7(int) Constant 48 - 87: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 88 83 18 89 12 21 88 86(VAR_int8_t) 37 - 90: 81(int8_t) Constant 0 - 92: TypeInt 8 0 - 94: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 93 37 11 12 - 95: TypePointer Private 92(int8_t) - 96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 94 11 12 - 97(VAR_uint8_t): 95(ptr) Variable Private - 100: 7(int) Constant 49 - 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 99 94 18 100 12 21 99 97(VAR_uint8_t) 37 - 101: 92(int8_t) Constant 0 - 103: TypeInt 16 1 - 106: 7(int) Constant 16 - 105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 104 106 23 12 - 107: TypePointer Private 103(int16_t) - 108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 105 11 12 -109(VAR_int16_t): 107(ptr) Variable Private - 112: 7(int) Constant 50 - 110: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 111 105 18 112 12 21 111 109(VAR_int16_t) 37 - 113:103(int16_t) Constant 0 - 115: TypeInt 16 0 - 117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 116 106 11 12 - 118: TypePointer Private 115(int16_t) - 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 117 11 12 -120(VAR_uint16_t): 118(ptr) Variable Private - 123: 7(int) Constant 51 - 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 122 117 18 123 12 21 122 120(VAR_uint16_t) 37 - 124:115(int16_t) Constant 0 - 126: TypeInt 64 1 - 128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 127 72 23 12 - 129: TypePointer Private 126(int64_t) - 130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 128 11 12 -131(VAR_int64_t): 129(ptr) Variable Private - 134: 7(int) Constant 52 - 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 133 128 18 134 12 21 133 131(VAR_int64_t) 37 - 135:126(int64_t) Constant 0 0 - 137: TypeInt 64 0 - 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 138 72 11 12 - 140: TypePointer Private 137(int64_t) - 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 139 11 12 -142(VAR_uint64_t): 140(ptr) Variable Private - 145: 7(int) Constant 53 - 143: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 144 139 18 145 12 21 144 142(VAR_uint64_t) 37 - 146:137(int64_t) Constant 0 0 - 148: TypeFloat 16 - 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 149 106 13 12 - 151: TypePointer Private 148(float16_t) - 152: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 150 11 12 -153(VAR_float16_t): 151(ptr) Variable Private - 156: 7(int) Constant 54 - 154: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 155 150 18 156 12 21 155 153(VAR_float16_t) 37 - 157:148(float16_t) Constant 0 - 160: 7(int) Constant 55 + 25: TypeBool + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 24 12 + 28: TypePointer Private 25(bool) + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 27 11 12 + 30(VAR_bool): 28(ptr) Variable Private + 33: 7(int) Constant 29 + 34: 7(int) Constant 8 + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 32 27 18 33 12 21 32 30(VAR_bool) 34 + 35: TypeInt 32 1 + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 36 10 23 12 + 38: TypePointer Private 35(int) + 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 37 11 12 + 40(VAR_int): 38(ptr) Variable Private + 43: 7(int) Constant 30 + 41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 42 37 18 43 12 21 42 40(VAR_int) 34 + 44: TypePointer Private 7(int) + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 11 12 + 46(VAR_uint): 44(ptr) Variable Private + 49: 7(int) Constant 31 + 47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 48 9 18 49 12 21 48 46(VAR_uint) 34 + 50: TypeFloat 32 + 52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 51 10 13 12 + 53: TypePointer Private 50(float) + 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 52 11 12 + 55(VAR_float): 53(ptr) Variable Private + 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 57 52 18 10 12 21 57 55(VAR_float) 34 + 58: TypeFloat 64 + 61: 7(int) Constant 64 + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 59 61 13 12 + 62: TypePointer Private 58(float64_t) + 63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 60 11 12 + 64(VAR_double): 62(ptr) Variable Private + 67: 7(int) Constant 33 + 65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 66 60 18 67 12 21 66 64(VAR_double) 34 + 68: TypeInt 8 1 + 70: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 69 34 23 12 + 71: TypePointer Private 68(int8_t) + 72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 11 12 + 73(VAR_int8_t): 71(ptr) Variable Private + 76: 7(int) Constant 34 + 74: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 75 70 18 76 12 21 75 73(VAR_int8_t) 34 + 77: TypeInt 8 0 + 79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 78 34 11 12 + 80: TypePointer Private 77(int8_t) + 81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 79 11 12 + 82(VAR_uint8_t): 80(ptr) Variable Private + 85: 7(int) Constant 35 + 83: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 84 79 18 85 12 21 84 82(VAR_uint8_t) 34 + 86: TypeInt 16 1 + 89: 7(int) Constant 16 + 88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 87 89 23 12 + 90: TypePointer Private 86(int16_t) + 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 88 11 12 + 92(VAR_int16_t): 90(ptr) Variable Private + 95: 7(int) Constant 36 + 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 94 88 18 95 12 21 94 92(VAR_int16_t) 34 + 96: TypeInt 16 0 + 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 97 89 11 12 + 99: TypePointer Private 96(int16_t) + 100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 98 11 12 +101(VAR_uint16_t): 99(ptr) Variable Private + 104: 7(int) Constant 37 + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 103 98 18 104 12 21 103 101(VAR_uint16_t) 34 + 105: TypeInt 64 1 + 107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 106 61 23 12 + 108: TypePointer Private 105(int64_t) + 109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 107 11 12 +110(VAR_int64_t): 108(ptr) Variable Private + 113: 7(int) Constant 38 + 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 112 107 18 113 12 21 112 110(VAR_int64_t) 34 + 114: TypeInt 64 0 + 116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 115 61 11 12 + 117: TypePointer Private 114(int64_t) + 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 116 11 12 +119(VAR_uint64_t): 117(ptr) Variable Private + 122: 7(int) Constant 39 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 121 116 18 122 12 21 121 119(VAR_uint64_t) 34 + 123: TypeFloat 16 + 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 124 89 13 12 + 126: TypePointer Private 123(float16_t) + 127: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 125 11 12 +128(VAR_float16_t): 126(ptr) Variable Private + 131: 7(int) Constant 40 + 129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 130 125 18 131 12 21 130 128(VAR_float16_t) 34 + 135: 25(bool) ConstantFalse + 137: 7(int) Constant 43 + 138: 35(int) Constant 0 + 140: 7(int) Constant 44 + 142: 7(int) Constant 45 + 143: 50(float) Constant 0 + 145: 7(int) Constant 46 + 146:58(float64_t) Constant 0 0 + 148: 7(int) Constant 47 + 149: 68(int8_t) Constant 0 + 151: 7(int) Constant 48 + 152: 77(int8_t) Constant 0 + 154: 7(int) Constant 49 + 155: 86(int16_t) Constant 0 + 157: 7(int) Constant 50 + 158: 96(int16_t) Constant 0 + 160: 7(int) Constant 51 + 161:105(int64_t) Constant 0 0 + 163: 7(int) Constant 52 + 164:114(int64_t) Constant 0 0 + 166: 7(int) Constant 53 + 167:123(float16_t) Constant 0 + 169: 7(int) Constant 54 + 171: 7(int) Constant 55 14(main): 4 Function None 5 15: Label - 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 - 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) - 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 36 36 12 12 - Store 33(VAR_bool) 38 - 50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 48 48 12 12 - Store 45(VAR_int) 49 - 57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 56 56 12 12 - Store 53(VAR_uint) 12 - 68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 66 66 12 12 - Store 63(VAR_float) 67 - 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 78 78 12 12 - Store 75(VAR_double) 79 - 91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 89 89 12 12 - Store 86(VAR_int8_t) 90 - 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 100 100 12 12 - Store 97(VAR_uint8_t) 101 - 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 112 112 12 12 - Store 109(VAR_int16_t) 113 - 125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 123 123 12 12 - Store 120(VAR_uint16_t) 124 - 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 134 134 12 12 - Store 131(VAR_int64_t) 135 - 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 145 145 12 12 - Store 142(VAR_uint64_t) 146 - 158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 156 156 12 12 - Store 153(VAR_float16_t) 157 + 133: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 137 137 12 12 + Store 30(VAR_bool) 135 + 139: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 140 140 12 12 + Store 40(VAR_int) 138 + 141: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 142 142 12 12 + Store 46(VAR_uint) 12 + 144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 145 145 12 12 + Store 55(VAR_float) 143 + 147: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 148 148 12 12 + Store 64(VAR_double) 146 + 150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 151 151 12 12 + Store 73(VAR_int8_t) 149 + 153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 154 154 12 12 + Store 82(VAR_uint8_t) 152 + 156: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 157 157 12 12 + Store 92(VAR_int16_t) 155 159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 160 160 12 12 + Store 101(VAR_uint16_t) 158 + 162: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 163 163 12 12 + Store 110(VAR_int64_t) 161 + 165: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 166 166 12 12 + Store 119(VAR_uint64_t) 164 + 168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 169 169 12 12 + Store 128(VAR_float16_t) 167 + 170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 171 171 12 12 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.debuginfo.ubo.glsl.frag.out b/third_party/glslang/Test/baseResults/spv.debuginfo.ubo.glsl.frag.out new file mode 100644 index 0000000000..dd160ee216 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.debuginfo.ubo.glsl.frag.out @@ -0,0 +1,127 @@ +spv.debuginfo.ubo.glsl.frag +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 77 + + Capability Shader + Extension "SPV_KHR_non_semantic_info" + 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" + 3: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 14 "main" 55 + ExecutionMode 14 OriginUpperLeft + 2: String "spv.debuginfo.ubo.glsl.frag" + 8: String "uint" + 16: String "main" + 19: String "// OpModuleProcessed auto-map-locations +// OpModuleProcessed auto-map-bindings +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed keep-uncalled +// OpModuleProcessed entry-point main +#line 1 +#version 460 + +uniform UBO1 { + vec4 memberA; +}; + +uniform UBO2 { + vec4 memberB; +} uboInstance; + +out vec4 outColor; + +void main() { + outColor = memberA + uboInstance.memberB; +}" + 26: String "float" + 32: String "memberA" + 35: String "UBO1" + 40: String "" + 44: String "memberB" + 46: String "UBO2" + 52: String "uboInstance" + 57: String "outColor" + 63: String "int" + Name 14 "main" + Name 30 "UBO1" + MemberName 30(UBO1) 0 "memberA" + Name 38 "" + Name 42 "UBO2" + MemberName 42(UBO2) 0 "memberB" + Name 50 "uboInstance" + Name 55 "outColor" + Decorate 30(UBO1) Block + MemberDecorate 30(UBO1) 0 Offset 0 + Decorate 38 Binding 0 + Decorate 38 DescriptorSet 0 + Decorate 42(UBO2) Block + MemberDecorate 42(UBO2) 0 Offset 0 + Decorate 50(uboInstance) Binding 1 + Decorate 50(uboInstance) DescriptorSet 0 + Decorate 55(outColor) Location 0 + 4: TypeVoid + 5: TypeFunction 4 + 7: TypeInt 32 0 + 10: 7(int) Constant 32 + 11: 7(int) Constant 6 + 12: 7(int) Constant 0 + 9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12 + 13: 7(int) Constant 3 + 6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 + 18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19 + 20: 7(int) Constant 13 + 22: 7(int) Constant 1 + 23: 7(int) Constant 4 + 24: 7(int) Constant 2 + 21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24 + 17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20 + 25: TypeFloat 32 + 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 26 10 13 12 + 28: TypeVector 25(float) 4 + 29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 27 23 + 30(UBO1): TypeStruct 28(fvec4) + 33: 7(int) Constant 10 + 31: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 32 29 18 23 33 12 12 13 + 34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 35 22 18 13 12 21 35 12 13 31 + 36: TypePointer Uniform 30(UBO1) + 37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 34 24 12 + 38: 36(ptr) Variable Uniform + 41: 7(int) Constant 8 + 39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 40 34 18 13 12 21 40 38 41 + 42(UBO2): TypeStruct 28(fvec4) + 43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 44 29 18 41 33 12 12 13 + 47: 7(int) Constant 7 + 45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 46 22 18 47 12 21 46 12 13 43 + 48: TypePointer Uniform 42(UBO2) + 49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 45 24 12 + 50(uboInstance): 48(ptr) Variable Uniform + 51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 52 45 18 47 12 21 52 50(uboInstance) 41 + 53: TypePointer Output 28(fvec4) + 54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 13 12 + 55(outColor): 53(ptr) Variable Output + 58: 7(int) Constant 11 + 56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 57 29 18 58 12 21 57 55(outColor) 41 + 62: TypeInt 32 1 + 64: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 63 10 23 12 + 65: 62(int) Constant 0 + 66: TypePointer Uniform 28(fvec4) + 67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 29 24 12 + 70: 7(int) Constant 14 + 76: 7(int) Constant 15 + 14(main): 4 Function None 5 + 15: Label + 60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 + 59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) + 69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 70 70 12 12 + 68: 66(ptr) AccessChain 38 65 + 71: 28(fvec4) Load 68 + 72: 66(ptr) AccessChain 50(uboInstance) 65 + 73: 28(fvec4) Load 72 + 74: 28(fvec4) FAdd 71 73 + Store 55(outColor) 74 + 75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 76 76 12 12 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.AtomicImage.comp.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.AtomicImage.comp.out new file mode 100644 index 0000000000..b711578d05 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.AtomicImage.comp.out @@ -0,0 +1,43 @@ +spv.descriptorHeap.AtomicImage.comp +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 22 + + Capability Shader + Capability Image1D + Capability UntypedPointersKHR + Capability DescriptorHeapEXT + Extension "SPV_EXT_descriptor_heap" + Extension "SPV_KHR_untyped_pointers" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 7 + ExecutionMode 4 LocalSize 1 1 1 + Source GLSL 460 + SourceExtension "GL_EXT_descriptor_heap" + Name 4 "main" + Name 7 "resource_heap" + Decorate 7(resource_heap) BuiltIn ResourceHeapEXT + DecorateId 14 DecorationArrayStrideIdEXT 13 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeUntypedPointerKHR UniformConstant +7(resource_heap): 6(ptr) UntypedVariableKHR UniformConstant + 8: TypeInt 32 1 + 9: 8(int) Constant 1 + 10: TypeImage 8(int) 1D nonsampled format:R32i + 11: TypeUntypedPointerKHR Uniform + 13: 8(int) ConstantSizeOfEXT 10 + 14: TypeRuntimeArray 10 + 15: TypeInt 32 0 + 16: 15(int) Constant 0 + 17: TypePointer Image 8(int) + 18: TypeUntypedPointerKHR Image + 20: 15(int) Constant 1 + 4(main): 2 Function None 3 + 5: Label + 12: 6(ptr) UntypedAccessChainKHR 14 7(resource_heap) 9 + 19: 18(ptr) UntypedImageTexelPointerEXT 10 12 9 16 + 21: 8(int) AtomicIAdd 19 20 16 9 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.AtomicImage.error.comp.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.AtomicImage.error.comp.out new file mode 100644 index 0000000000..da018a2593 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.AtomicImage.error.comp.out @@ -0,0 +1,7 @@ +spv.descriptorHeap.AtomicImage.error.comp +ERROR: 0:13: 'imageAtomicOr' : only supported on image with format r32i or r32ui +ERROR: 0:18: 'format' : image formats must match +ERROR: 2 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.Buffer.comp.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.Buffer.comp.out new file mode 100644 index 0000000000..a531aafdd7 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.Buffer.comp.out @@ -0,0 +1,60 @@ +spv.descriptorHeap.Buffer.comp +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 30 + + Capability Shader + Capability UntypedPointersKHR + Capability DescriptorHeapEXT + Extension "SPV_EXT_descriptor_heap" + Extension "SPV_KHR_untyped_pointers" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 7 + ExecutionMode 4 LocalSize 1 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_descriptor_heap" + Name 4 "main" + Name 7 "resource_heap" + Name 11 "O" + MemberName 11(O) 0 "outputData" + Name 14 "U" + MemberName 14(U) 0 "inputData" + Decorate 7(resource_heap) BuiltIn ResourceHeapEXT + Decorate 11(O) Block + MemberDecorate 11(O) 0 Offset 0 + Decorate 14(U) Block + MemberDecorate 14(U) 0 Offset 0 + DecorateId 19 DecorationArrayStrideIdEXT 18 + DecorateId 27 DecorationArrayStrideIdEXT 26 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeUntypedPointerKHR UniformConstant +7(resource_heap): 6(ptr) UntypedVariableKHR UniformConstant + 8: TypeInt 32 1 + 9: 8(int) Constant 8 + 10: TypeInt 32 0 + 11(O): TypeStruct 10(int) + 12: 8(int) Constant 0 + 13: 8(int) Constant 9 + 14(U): TypeStruct 10(int) + 15: TypeUntypedPointerKHR Uniform + 17: TypeBufferEXT Uniform + 18: 8(int) ConstantSizeOfEXT 17 + 19: TypeRuntimeArray 17 + 23: TypeUntypedPointerKHR StorageBuffer + 25: TypeBufferEXT StorageBuffer + 26: 8(int) ConstantSizeOfEXT 25 + 27: TypeRuntimeArray 25 + 4(main): 2 Function None 3 + 5: Label + 16: 6(ptr) UntypedAccessChainKHR 19 7(resource_heap) 13 + 20: 15(ptr) BufferPointerEXT 16 + 21: 15(ptr) UntypedAccessChainKHR 14(U) 20 12 + 22: 10(int) Load 21 + 24: 6(ptr) UntypedAccessChainKHR 27 7(resource_heap) 9 + 28: 23(ptr) BufferPointerEXT 24 + 29: 23(ptr) UntypedAccessChainKHR 11(O) 28 12 + Store 29 22 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.DebugPrintf.comp.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.DebugPrintf.comp.out new file mode 100644 index 0000000000..0da6ce07b7 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.DebugPrintf.comp.out @@ -0,0 +1,44 @@ +spv.descriptorHeap.DebugPrintf.comp +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 20 + + Capability Shader + Capability UntypedPointersKHR + Capability DescriptorHeapEXT + Extension "SPV_EXT_descriptor_heap" + Extension "SPV_KHR_non_semantic_info" + Extension "SPV_KHR_untyped_pointers" + 1: ExtInstImport "GLSL.std.450" + 12: ExtInstImport "NonSemantic.DebugPrintf" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 19 + ExecutionMode 4 LocalSize 1 1 1 + 10: String "float == %f" + Source GLSL 450 + SourceExtension "GL_EXT_debug_printf" + SourceExtension "GL_EXT_descriptor_heap" + Name 4 "main" + Name 8 "myfloat" + Name 19 "resource_heap" + Decorate 17 BuiltIn WorkgroupSize + Decorate 19(resource_heap) BuiltIn ResourceHeapEXT + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Function 6(float) + 9: 6(float) Constant 1078529622 + 14: TypeInt 32 0 + 15: TypeVector 14(int) 3 + 16: 14(int) Constant 1 + 17: 15(ivec3) ConstantComposite 16 16 16 + 18: TypeUntypedPointerKHR UniformConstant +19(resource_heap): 18(ptr) UntypedVariableKHR UniformConstant + 4(main): 2 Function None 3 + 5: Label + 8(myfloat): 7(ptr) Variable Function + Store 8(myfloat) 9 + 11: 6(float) Load 8(myfloat) + 13: 2 ExtInst 12(NonSemantic.DebugPrintf) 1(DebugPrintf) 10 11 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapNotArray.error.comp.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapNotArray.error.comp.out new file mode 100644 index 0000000000..d0f8fec98a --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapNotArray.error.comp.out @@ -0,0 +1,6 @@ +spv.descriptorHeap.HeapNotArray.error.comp +ERROR: 0:3: 'img' : layout(descriptor_heap) decorated variable could only be declared as an array. +ERROR: 1 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapStrideNotHeap.error.comp.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapStrideNotHeap.error.comp.out new file mode 100644 index 0000000000..bea062ddff --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapStrideNotHeap.error.comp.out @@ -0,0 +1,6 @@ +spv.descriptorHeap.HeapStrideNotHeap.error.comp +ERROR: 0:4: 'descriptor_stride' : must specify 'descriptor_heap' to use 'descriptor_stride' +ERROR: 1 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapStrideNotPow2.error.comp.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapStrideNotPow2.error.comp.out new file mode 100644 index 0000000000..cdf07fc033 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.HeapStrideNotPow2.error.comp.out @@ -0,0 +1,6 @@ +spv.descriptorHeap.HeapStrideNotPow2.error.comp +ERROR: 0:4: 'descriptor_stride' : must be a power of 2 +ERROR: 1 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.PushConstant.comp.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.PushConstant.comp.out new file mode 100644 index 0000000000..f59d29c7b7 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.PushConstant.comp.out @@ -0,0 +1,91 @@ +spv.descriptorHeap.PushConstant.comp +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 47 + + Capability Shader + Capability UntypedPointersKHR + Capability DescriptorHeapEXT + Extension "SPV_EXT_descriptor_heap" + Extension "SPV_KHR_untyped_pointers" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 20 28 + ExecutionMode 4 LocalSize 1 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_descriptor_heap" + Name 4 "main" + Name 8 "i" + Name 16 "PUSH_LENGTH" + Name 20 "resource_heap" + Name 23 "O" + MemberName 23(O) 0 "outputBuffer" + Name 26 "P" + MemberName 26(P) 0 "pushData" + Name 28 "" + Decorate 16(PUSH_LENGTH) SpecId 0 + Decorate 20(resource_heap) BuiltIn ResourceHeapEXT + Decorate 22 ArrayStride 4 + Decorate 23(O) Block + MemberDecorate 23(O) 0 Offset 0 + Decorate 25 ArrayStride 4 + Decorate 26(P) Block + MemberDecorate 26(P) 0 Offset 0 + DecorateId 38 DecorationArrayStrideIdEXT 37 + Decorate 46 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Function 6(int) + 9: 6(int) Constant 0 + 16(PUSH_LENGTH): 6(int) SpecConstant 1 + 17: TypeBool + 19: TypeUntypedPointerKHR UniformConstant +20(resource_heap): 19(ptr) UntypedVariableKHR UniformConstant + 21: TypeInt 32 0 + 22: TypeRuntimeArray 21(int) + 23(O): TypeStruct 22 + 25: TypeArray 6(int) 16(PUSH_LENGTH) + 26(P): TypeStruct 25 + 27: TypePointer PushConstant 26(P) + 28: 27(ptr) Variable PushConstant + 30: TypePointer PushConstant 6(int) + 34: TypeUntypedPointerKHR StorageBuffer + 36: TypeBufferEXT StorageBuffer + 37: 6(int) ConstantSizeOfEXT 36 + 38: TypeRuntimeArray 36 + 42: 6(int) Constant 1 + 44: TypeVector 21(int) 3 + 45: 21(int) Constant 1 + 46: 44(ivec3) ConstantComposite 45 45 45 + 4(main): 2 Function None 3 + 5: Label + 8(i): 7(ptr) Variable Function + Store 8(i) 9 + Branch 10 + 10: Label + LoopMerge 12 13 None + Branch 14 + 14: Label + 15: 6(int) Load 8(i) + 18: 17(bool) SLessThan 15 16(PUSH_LENGTH) + BranchConditional 18 11 12 + 11: Label + 24: 6(int) Load 8(i) + 29: 6(int) Load 8(i) + 31: 30(ptr) AccessChain 28 9 29 + 32: 6(int) Load 31 + 33: 21(int) Bitcast 32 + 35: 19(ptr) UntypedAccessChainKHR 38 20(resource_heap) 9 + 39: 34(ptr) BufferPointerEXT 35 + 40: 34(ptr) UntypedAccessChainKHR 23(O) 39 9 24 + Store 40 33 + Branch 13 + 13: Label + 41: 6(int) Load 8(i) + 43: 6(int) IAdd 41 42 + Store 8(i) 43 + Branch 10 + 12: Label + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.descriptorHeap.valid.frag.out b/third_party/glslang/Test/baseResults/spv.descriptorHeap.valid.frag.out new file mode 100644 index 0000000000..e3f144c84b --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.descriptorHeap.valid.frag.out @@ -0,0 +1,151 @@ +spv.descriptorHeap.valid.frag +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 83 + + Capability Shader + Capability ShaderNonUniformEXT + Capability RuntimeDescriptorArrayEXT + Capability UniformBufferArrayNonUniformIndexingEXT + Capability StorageBufferArrayNonUniformIndexingEXT + Extension "SPV_EXT_descriptor_indexing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 9 15 25 34 40 42 54 67 82 + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_EXT_descriptor_heap" + SourceExtension "GL_EXT_nonuniform_qualifier" + Name 4 "main" + Name 9 "fragColor" + Name 15 "heapTexture2D" + Name 25 "heapSampler" + Name 34 "uvs" + Name 37 "UniformBuffer" + MemberName 37(UniformBuffer) 0 "colorOffset" + Name 40 "heapUniformBuffer" + Name 42 "index" + Name 50 "StorageBufferA" + MemberName 50(StorageBufferA) 0 "a" + Name 54 "heapStorageBufferA" + Name 64 "StorageBufferB" + MemberName 64(StorageBufferB) 0 "b" + Name 67 "heapStorageBufferB" + Name 82 "heapTexture3D" + Decorate 9(fragColor) Location 0 + Decorate 15(heapTexture2D) Binding 1 + Decorate 15(heapTexture2D) DescriptorSet 0 + Decorate 25(heapSampler) Binding 0 + Decorate 25(heapSampler) DescriptorSet 0 + Decorate 34(uvs) Location 0 + Decorate 37(UniformBuffer) Block + MemberDecorate 37(UniformBuffer) 0 Offset 0 + Decorate 40(heapUniformBuffer) Binding 4 + Decorate 40(heapUniformBuffer) DescriptorSet 0 + Decorate 42(index) Flat + Decorate 42(index) Location 1 + Decorate 44 DecorationNonUniformEXT + Decorate 46 DecorationNonUniformEXT + Decorate 47 DecorationNonUniformEXT + Decorate 49 DecorationNonUniformEXT + Decorate 50(StorageBufferA) Block + MemberDecorate 50(StorageBufferA) 0 Offset 0 + Decorate 54(heapStorageBufferA) Binding 2 + Decorate 54(heapStorageBufferA) DescriptorSet 0 + Decorate 64(StorageBufferB) Block + MemberDecorate 64(StorageBufferB) 0 Offset 0 + Decorate 67(heapStorageBufferB) Binding 3 + Decorate 67(heapStorageBufferB) DescriptorSet 0 + Decorate 69 DecorationNonUniformEXT + Decorate 72 DecorationNonUniformEXT + Decorate 73 DecorationNonUniformEXT + Decorate 77 DecorationNonUniformEXT + Decorate 82(heapTexture3D) Binding 0 + Decorate 82(heapTexture3D) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(fragColor): 8(ptr) Variable Output + 10: TypeImage 6(float) 2D sampled format:Unknown + 11: TypeInt 32 0 + 12: 11(int) Constant 28 + 13: TypeArray 10 12 + 14: TypePointer UniformConstant 13 +15(heapTexture2D): 14(ptr) Variable UniformConstant + 16: TypeInt 32 1 + 17: 16(int) Constant 27 + 18: TypePointer UniformConstant 10 + 21: TypeSampler + 22: 11(int) Constant 1 + 23: TypeArray 21 22 + 24: TypePointer UniformConstant 23 + 25(heapSampler): 24(ptr) Variable UniformConstant + 26: 16(int) Constant 0 + 27: TypePointer UniformConstant 21 + 30: TypeSampledImage 10 + 32: TypeVector 6(float) 2 + 33: TypePointer Input 32(fvec2) + 34(uvs): 33(ptr) Variable Input +37(UniformBuffer): TypeStruct 7(fvec4) + 38: TypeRuntimeArray 37(UniformBuffer) + 39: TypePointer Uniform 38 +40(heapUniformBuffer): 39(ptr) Variable Uniform + 41: TypePointer Input 11(int) + 42(index): 41(ptr) Variable Input + 45: TypePointer Uniform 7(fvec4) +50(StorageBufferA): TypeStruct 7(fvec4) + 51: 11(int) Constant 2 + 52: TypeArray 50(StorageBufferA) 51 + 53: TypePointer StorageBuffer 52 +54(heapStorageBufferA): 53(ptr) Variable StorageBuffer + 55: 16(int) Constant 1 + 56: 6(float) Constant 1065353216 + 57: 6(float) Constant 1073741824 + 58: 6(float) Constant 1077936128 + 59: 6(float) Constant 1082130432 + 60: 7(fvec4) ConstantComposite 56 57 58 59 + 61: TypePointer StorageBuffer 7(fvec4) + 63: TypeVector 6(float) 3 +64(StorageBufferB): TypeStruct 63(fvec3) + 65: TypeRuntimeArray 64(StorageBufferB) + 66: TypePointer StorageBuffer 65 +67(heapStorageBufferB): 66(ptr) Variable StorageBuffer + 70: 11(int) Constant 0 + 71: TypePointer StorageBuffer 6(float) + 74: TypePointer Output 6(float) + 79: TypeImage 6(float) 3D sampled format:Unknown + 80: TypeArray 79 22 + 81: TypePointer UniformConstant 80 +82(heapTexture3D): 81(ptr) Variable UniformConstant + 4(main): 2 Function None 3 + 5: Label + 19: 18(ptr) AccessChain 15(heapTexture2D) 17 + 20: 10 Load 19 + 28: 27(ptr) AccessChain 25(heapSampler) 26 + 29: 21 Load 28 + 31: 30 SampledImage 20 29 + 35: 32(fvec2) Load 34(uvs) + 36: 7(fvec4) ImageSampleImplicitLod 31 35 + Store 9(fragColor) 36 + 43: 11(int) Load 42(index) + 44: 11(int) CopyObject 43 + 46: 45(ptr) AccessChain 40(heapUniformBuffer) 44 26 + 47: 7(fvec4) Load 46 + 48: 7(fvec4) Load 9(fragColor) + 49: 7(fvec4) FAdd 48 47 + Store 9(fragColor) 49 + 62: 61(ptr) AccessChain 54(heapStorageBufferA) 55 26 + Store 62 60 + 68: 11(int) Load 42(index) + 69: 11(int) CopyObject 68 + 72: 71(ptr) AccessChain 67(heapStorageBufferB) 69 26 70 + 73: 6(float) Load 72 + 75: 74(ptr) AccessChain 9(fragColor) 70 + 76: 6(float) Load 75 + 77: 6(float) FAdd 76 73 + 78: 74(ptr) AccessChain 9(fragColor) 70 + Store 78 77 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rchit.out b/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rchit.out new file mode 100644 index 0000000000..c052397591 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rchit.out @@ -0,0 +1,215 @@ +spv.ext.hitobject-allops.rchit +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 113 + + Capability RayQueryKHR + Capability RayTracingKHR + Capability ShaderInvocationReorderEXT + Extension "SPV_EXT_shader_invocation_reorder" + Extension "SPV_KHR_ray_query" + Extension "SPV_KHR_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint ClosestHitKHR 4 "main" 9 14 22 25 36 42 43 44 49 56 112 + Source GLSL 460 + SourceExtension "GL_EXT_ray_query" + SourceExtension "GL_EXT_ray_tracing" + SourceExtension "GL_EXT_shader_invocation_reorder" + SourceExtension "GL_NV_ray_tracing_motion_blur" + Name 4 "main" + Name 9 "attr" + Name 12 "hBlock" + MemberName 12(hBlock) 0 "attrval" + Name 14 "" + Name 22 "hObj" + Name 25 "as" + Name 36 "payload" + Name 40 "pBlock" + MemberName 40(pBlock) 0 "val1" + MemberName 40(pBlock) 1 "val2" + Name 42 "" + Name 43 "hObjNop" + Name 44 "hObjMiss" + Name 49 "hObjHit" + Name 54 "block" + MemberName 54(block) 0 "op" + Name 56 "" + Name 71 "rayflags" + Name 74 "tmin" + Name 76 "tmax" + Name 79 "orig" + Name 81 "dir" + Name 83 "oorig" + Name 85 "odir" + Name 89 "otw" + Name 91 "wto" + Name 94 "cid" + Name 96 "iid" + Name 98 "pid" + Name 100 "gid" + Name 102 "hkind" + Name 106 "handle" + Name 108 "rid" + Name 112 "rq" + Decorate 12(hBlock) Block + Decorate 25(as) Binding 0 + Decorate 25(as) DescriptorSet 0 + Decorate 40(pBlock) Block + Decorate 54(block) Block + MemberDecorate 54(block) 0 Offset 0 + Decorate 56 Binding 1 + Decorate 56 DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypePointer HitObjectAttributeEXT 7(fvec2) + 9(attr): 8(ptr) Variable HitObjectAttributeEXT + 10: 6(float) Constant 1065353216 + 11: 7(fvec2) ConstantComposite 10 10 + 12(hBlock): TypeStruct 6(float) + 13: TypePointer HitObjectAttributeEXT 12(hBlock) + 14: 13(ptr) Variable HitObjectAttributeEXT + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: 6(float) Constant 1073741824 + 18: TypePointer HitObjectAttributeEXT 6(float) + 20: TypeHitObjectEXT + 21: TypePointer Private 20 + 22(hObj): 21(ptr) Variable Private + 23: TypeAccelerationStructureKHR + 24: TypePointer UniformConstant 23 + 25(as): 24(ptr) Variable UniformConstant + 27: TypeInt 32 0 + 28: 27(int) Constant 1 + 29: TypeVector 6(float) 3 + 30: 6(float) Constant 1056964608 + 31: 29(fvec3) ConstantComposite 30 30 30 + 32: 29(fvec3) ConstantComposite 10 10 10 + 33: 15(int) Constant 1 + 34: TypeVector 6(float) 4 + 35: TypePointer RayPayloadKHR 34(fvec4) + 36(payload): 35(ptr) Variable RayPayloadKHR + 38: 6(float) Constant 1092616192 + 39: 15(int) Constant 2 + 40(pBlock): TypeStruct 7(fvec2) 7(fvec2) + 41: TypePointer RayPayloadKHR 40(pBlock) + 42: 41(ptr) Variable RayPayloadKHR + 43(hObjNop): 21(ptr) Variable Private + 44(hObjMiss): 21(ptr) Variable Private + 45: 6(float) Constant 1069547520 + 46: 29(fvec3) ConstantComposite 45 45 45 + 47: 6(float) Constant 1084227584 + 48: 6(float) Constant 1090519040 + 49(hObjHit): 21(ptr) Variable Private + 50: TypeBool + 54(block): TypeStruct 6(float) + 55: TypePointer StorageBuffer 54(block) + 56: 55(ptr) Variable StorageBuffer + 57: TypePointer StorageBuffer 6(float) + 68: 6(float) Constant 1077936128 + 70: TypePointer Function 27(int) + 73: TypePointer Function 6(float) + 78: TypePointer Function 29(fvec3) + 87: TypeMatrix 29(fvec3) 4 + 88: TypePointer Function 87 + 93: TypePointer Function 15(int) + 104: TypeVector 27(int) 2 + 105: TypePointer Function 104(ivec2) + 110: TypeRayQueryKHR + 111: TypePointer Private 110 + 112(rq): 111(ptr) Variable Private + 4(main): 2 Function None 3 + 5: Label + 71(rayflags): 70(ptr) Variable Function + 74(tmin): 73(ptr) Variable Function + 76(tmax): 73(ptr) Variable Function + 79(orig): 78(ptr) Variable Function + 81(dir): 78(ptr) Variable Function + 83(oorig): 78(ptr) Variable Function + 85(odir): 78(ptr) Variable Function + 89(otw): 88(ptr) Variable Function + 91(wto): 88(ptr) Variable Function + 94(cid): 93(ptr) Variable Function + 96(iid): 93(ptr) Variable Function + 98(pid): 93(ptr) Variable Function + 100(gid): 93(ptr) Variable Function + 102(hkind): 70(ptr) Variable Function + 106(handle): 105(ptr) Variable Function + 108(rid): 70(ptr) Variable Function + Store 9(attr) 11 + 19: 18(ptr) AccessChain 14 16 + Store 19 17 + 26: 23 Load 25(as) + HitObjectTraceRayEXT 22(hObj) 26 28 28 28 28 28 31 30 32 10 36(payload) + 37: 23 Load 25(as) + HitObjectTraceRayMotionEXT 22(hObj) 37 28 28 28 28 28 31 30 32 10 38 42 + HitObjectRecordEmptyEXT 43(hObjNop) + HitObjectRecordMissEXT 44(hObjMiss) 28 28 31 17 46 47 + HitObjectRecordMissMotionEXT 44(hObjMiss) 28 28 31 17 46 47 48 + HitObjectExecuteShaderEXT 49(hObjHit) 36(payload) + 51: 50(bool) HitObjectIsHitEXT 22(hObj) + SelectionMerge 53 None + BranchConditional 51 52 59 + 52: Label + 58: 57(ptr) AccessChain 56 16 + Store 58 10 + Branch 53 + 59: Label + 60: 50(bool) HitObjectIsMissEXT 22(hObj) + SelectionMerge 62 None + BranchConditional 60 61 64 + 61: Label + 63: 57(ptr) AccessChain 56 16 + Store 63 17 + Branch 62 + 64: Label + 65: 50(bool) HitObjectIsEmptyEXT 22(hObj) + SelectionMerge 67 None + BranchConditional 65 66 67 + 66: Label + 69: 57(ptr) AccessChain 56 16 + Store 69 68 + Branch 67 + 67: Label + Branch 62 + 62: Label + Branch 53 + 53: Label + 72: 27(int) HitObjectGetRayFlagsEXT 49(hObjHit) + Store 71(rayflags) 72 + 75: 6(float) HitObjectGetRayTMinEXT 49(hObjHit) + Store 74(tmin) 75 + 77: 6(float) HitObjectGetRayTMaxEXT 49(hObjHit) + Store 76(tmax) 77 + 80: 29(fvec3) HitObjectGetWorldRayOriginEXT 49(hObjHit) + Store 79(orig) 80 + 82: 29(fvec3) HitObjectGetWorldRayDirectionEXT 49(hObjHit) + Store 81(dir) 82 + 84: 29(fvec3) HitObjectGetObjectRayOriginEXT 49(hObjHit) + Store 83(oorig) 84 + 86: 29(fvec3) HitObjectGetObjectRayDirectionEXT 49(hObjHit) + Store 85(odir) 86 + 90: 87 HitObjectGetObjectToWorldEXT 49(hObjHit) + Store 89(otw) 90 + 92: 87 HitObjectGetWorldToObjectEXT 49(hObjHit) + Store 91(wto) 92 + 95: 15(int) HitObjectGetInstanceCustomIndexEXT 44(hObjMiss) + Store 94(cid) 95 + 97: 15(int) HitObjectGetInstanceIdEXT 43(hObjNop) + Store 96(iid) 97 + 99: 15(int) HitObjectGetPrimitiveIndexEXT 22(hObj) + Store 98(pid) 99 + 101: 15(int) HitObjectGetGeometryIndexEXT 22(hObj) + Store 100(gid) 101 + 103: 27(int) HitObjectGetHitKindEXT 22(hObj) + Store 102(hkind) 103 + HitObjectGetAttributesEXT 22(hObj) 9(attr) + 107: 104(ivec2) HitObjectGetShaderRecordBufferHandleEXT 22(hObj) + Store 106(handle) 107 + 109: 27(int) HitObjectGetShaderBindingTableRecordIndexEXT 22(hObj) + Store 108(rid) 109 + HitObjectRecordFromQueryEXT 49(hObjHit) 112(rq) 28 9(attr) + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rgen.out b/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rgen.out new file mode 100644 index 0000000000..981963f914 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rgen.out @@ -0,0 +1,220 @@ +spv.ext.hitobject-allops.rgen +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 115 + + Capability RayQueryKHR + Capability RayTracingKHR + Capability ShaderInvocationReorderEXT + Extension "SPV_EXT_shader_invocation_reorder" + Extension "SPV_KHR_ray_query" + Extension "SPV_KHR_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint RayGenerationKHR 4 "main" 9 14 22 25 36 42 43 44 49 56 112 + Source GLSL 460 + SourceExtension "GL_EXT_ray_query" + SourceExtension "GL_EXT_ray_tracing" + SourceExtension "GL_EXT_shader_invocation_reorder" + SourceExtension "GL_NV_ray_tracing_motion_blur" + Name 4 "main" + Name 9 "attr" + Name 12 "hBlock" + MemberName 12(hBlock) 0 "attrval" + Name 14 "" + Name 22 "hObj" + Name 25 "as" + Name 36 "payload" + Name 40 "pBlock" + MemberName 40(pBlock) 0 "val1" + MemberName 40(pBlock) 1 "val2" + Name 42 "" + Name 43 "hObjNop" + Name 44 "hObjMiss" + Name 49 "hObjHit" + Name 54 "block" + MemberName 54(block) 0 "op" + Name 56 "" + Name 71 "rayflags" + Name 74 "tmin" + Name 76 "tmax" + Name 79 "orig" + Name 81 "dir" + Name 83 "oorig" + Name 85 "odir" + Name 89 "otw" + Name 91 "wto" + Name 94 "cid" + Name 96 "iid" + Name 98 "pid" + Name 100 "gid" + Name 102 "hkind" + Name 106 "handle" + Name 108 "rid" + Name 112 "rq" + Decorate 12(hBlock) Block + Decorate 25(as) Binding 0 + Decorate 25(as) DescriptorSet 0 + Decorate 40(pBlock) Block + Decorate 54(block) Block + MemberDecorate 54(block) 0 Offset 0 + Decorate 56 Binding 1 + Decorate 56 DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypePointer HitObjectAttributeEXT 7(fvec2) + 9(attr): 8(ptr) Variable HitObjectAttributeEXT + 10: 6(float) Constant 1065353216 + 11: 7(fvec2) ConstantComposite 10 10 + 12(hBlock): TypeStruct 6(float) + 13: TypePointer HitObjectAttributeEXT 12(hBlock) + 14: 13(ptr) Variable HitObjectAttributeEXT + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: 6(float) Constant 1073741824 + 18: TypePointer HitObjectAttributeEXT 6(float) + 20: TypeHitObjectEXT + 21: TypePointer Private 20 + 22(hObj): 21(ptr) Variable Private + 23: TypeAccelerationStructureKHR + 24: TypePointer UniformConstant 23 + 25(as): 24(ptr) Variable UniformConstant + 27: TypeInt 32 0 + 28: 27(int) Constant 1 + 29: TypeVector 6(float) 3 + 30: 6(float) Constant 1056964608 + 31: 29(fvec3) ConstantComposite 30 30 30 + 32: 29(fvec3) ConstantComposite 10 10 10 + 33: 15(int) Constant 1 + 34: TypeVector 6(float) 4 + 35: TypePointer RayPayloadKHR 34(fvec4) + 36(payload): 35(ptr) Variable RayPayloadKHR + 38: 6(float) Constant 1092616192 + 39: 15(int) Constant 2 + 40(pBlock): TypeStruct 7(fvec2) 7(fvec2) + 41: TypePointer RayPayloadKHR 40(pBlock) + 42: 41(ptr) Variable RayPayloadKHR + 43(hObjNop): 21(ptr) Variable Private + 44(hObjMiss): 21(ptr) Variable Private + 45: 6(float) Constant 1069547520 + 46: 29(fvec3) ConstantComposite 45 45 45 + 47: 6(float) Constant 1084227584 + 48: 6(float) Constant 1090519040 + 49(hObjHit): 21(ptr) Variable Private + 50: TypeBool + 54(block): TypeStruct 6(float) + 55: TypePointer StorageBuffer 54(block) + 56: 55(ptr) Variable StorageBuffer + 57: TypePointer StorageBuffer 6(float) + 68: 6(float) Constant 1077936128 + 70: TypePointer Function 27(int) + 73: TypePointer Function 6(float) + 78: TypePointer Function 29(fvec3) + 87: TypeMatrix 29(fvec3) 4 + 88: TypePointer Function 87 + 93: TypePointer Function 15(int) + 104: TypeVector 27(int) 2 + 105: TypePointer Function 104(ivec2) + 110: TypeRayQueryKHR + 111: TypePointer Private 110 + 112(rq): 111(ptr) Variable Private + 113: 27(int) Constant 4 + 114: 27(int) Constant 2 + 4(main): 2 Function None 3 + 5: Label + 71(rayflags): 70(ptr) Variable Function + 74(tmin): 73(ptr) Variable Function + 76(tmax): 73(ptr) Variable Function + 79(orig): 78(ptr) Variable Function + 81(dir): 78(ptr) Variable Function + 83(oorig): 78(ptr) Variable Function + 85(odir): 78(ptr) Variable Function + 89(otw): 88(ptr) Variable Function + 91(wto): 88(ptr) Variable Function + 94(cid): 93(ptr) Variable Function + 96(iid): 93(ptr) Variable Function + 98(pid): 93(ptr) Variable Function + 100(gid): 93(ptr) Variable Function + 102(hkind): 70(ptr) Variable Function + 106(handle): 105(ptr) Variable Function + 108(rid): 70(ptr) Variable Function + Store 9(attr) 11 + 19: 18(ptr) AccessChain 14 16 + Store 19 17 + 26: 23 Load 25(as) + HitObjectTraceRayEXT 22(hObj) 26 28 28 28 28 28 31 30 32 10 36(payload) + 37: 23 Load 25(as) + HitObjectTraceRayMotionEXT 22(hObj) 37 28 28 28 28 28 31 30 32 10 38 42 + HitObjectRecordEmptyEXT 43(hObjNop) + HitObjectRecordMissEXT 44(hObjMiss) 28 28 31 17 46 47 + HitObjectRecordMissMotionEXT 44(hObjMiss) 28 28 31 17 46 47 48 + HitObjectExecuteShaderEXT 49(hObjHit) 36(payload) + 51: 50(bool) HitObjectIsHitEXT 22(hObj) + SelectionMerge 53 None + BranchConditional 51 52 59 + 52: Label + 58: 57(ptr) AccessChain 56 16 + Store 58 10 + Branch 53 + 59: Label + 60: 50(bool) HitObjectIsMissEXT 22(hObj) + SelectionMerge 62 None + BranchConditional 60 61 64 + 61: Label + 63: 57(ptr) AccessChain 56 16 + Store 63 17 + Branch 62 + 64: Label + 65: 50(bool) HitObjectIsEmptyEXT 22(hObj) + SelectionMerge 67 None + BranchConditional 65 66 67 + 66: Label + 69: 57(ptr) AccessChain 56 16 + Store 69 68 + Branch 67 + 67: Label + Branch 62 + 62: Label + Branch 53 + 53: Label + 72: 27(int) HitObjectGetRayFlagsEXT 49(hObjHit) + Store 71(rayflags) 72 + 75: 6(float) HitObjectGetRayTMinEXT 49(hObjHit) + Store 74(tmin) 75 + 77: 6(float) HitObjectGetRayTMaxEXT 49(hObjHit) + Store 76(tmax) 77 + 80: 29(fvec3) HitObjectGetWorldRayOriginEXT 49(hObjHit) + Store 79(orig) 80 + 82: 29(fvec3) HitObjectGetWorldRayDirectionEXT 49(hObjHit) + Store 81(dir) 82 + 84: 29(fvec3) HitObjectGetObjectRayOriginEXT 49(hObjHit) + Store 83(oorig) 84 + 86: 29(fvec3) HitObjectGetObjectRayDirectionEXT 49(hObjHit) + Store 85(odir) 86 + 90: 87 HitObjectGetObjectToWorldEXT 49(hObjHit) + Store 89(otw) 90 + 92: 87 HitObjectGetWorldToObjectEXT 49(hObjHit) + Store 91(wto) 92 + 95: 15(int) HitObjectGetInstanceCustomIndexEXT 44(hObjMiss) + Store 94(cid) 95 + 97: 15(int) HitObjectGetInstanceIdEXT 43(hObjNop) + Store 96(iid) 97 + 99: 15(int) HitObjectGetPrimitiveIndexEXT 22(hObj) + Store 98(pid) 99 + 101: 15(int) HitObjectGetGeometryIndexEXT 22(hObj) + Store 100(gid) 101 + 103: 27(int) HitObjectGetHitKindEXT 22(hObj) + Store 102(hkind) 103 + HitObjectGetAttributesEXT 22(hObj) 9(attr) + 107: 104(ivec2) HitObjectGetShaderRecordBufferHandleEXT 22(hObj) + Store 106(handle) 107 + 109: 27(int) HitObjectGetShaderBindingTableRecordIndexEXT 22(hObj) + Store 108(rid) 109 + HitObjectRecordFromQueryEXT 49(hObjHit) 112(rq) 28 9(attr) + ReorderThreadWithHintEXT 113 113 + ReorderThreadWithHitObjectEXT 49(hObjHit) + ReorderThreadWithHitObjectEXT 49(hObjHit) 113 114 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rmiss.out b/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rmiss.out new file mode 100644 index 0000000000..24457054fa --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.ext.hitobject-allops.rmiss.out @@ -0,0 +1,215 @@ +spv.ext.hitobject-allops.rmiss +// Module Version 10400 +// Generated by (magic number): 8000b +// Id's are bound by 113 + + Capability RayQueryKHR + Capability RayTracingKHR + Capability ShaderInvocationReorderEXT + Extension "SPV_EXT_shader_invocation_reorder" + Extension "SPV_KHR_ray_query" + Extension "SPV_KHR_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MissKHR 4 "main" 9 14 22 25 36 42 43 44 49 56 112 + Source GLSL 460 + SourceExtension "GL_EXT_ray_query" + SourceExtension "GL_EXT_ray_tracing" + SourceExtension "GL_EXT_shader_invocation_reorder" + SourceExtension "GL_NV_ray_tracing_motion_blur" + Name 4 "main" + Name 9 "attr" + Name 12 "hBlock" + MemberName 12(hBlock) 0 "attrval" + Name 14 "" + Name 22 "hObj" + Name 25 "as" + Name 36 "payload" + Name 40 "pBlock" + MemberName 40(pBlock) 0 "val1" + MemberName 40(pBlock) 1 "val2" + Name 42 "" + Name 43 "hObjNop" + Name 44 "hObjMiss" + Name 49 "hObjHit" + Name 54 "block" + MemberName 54(block) 0 "op" + Name 56 "" + Name 71 "rayflags" + Name 74 "tmin" + Name 76 "tmax" + Name 79 "orig" + Name 81 "dir" + Name 83 "oorig" + Name 85 "odir" + Name 89 "otw" + Name 91 "wto" + Name 94 "cid" + Name 96 "iid" + Name 98 "pid" + Name 100 "gid" + Name 102 "hkind" + Name 106 "handle" + Name 108 "rid" + Name 112 "rq" + Decorate 12(hBlock) Block + Decorate 25(as) Binding 0 + Decorate 25(as) DescriptorSet 0 + Decorate 40(pBlock) Block + Decorate 54(block) Block + MemberDecorate 54(block) 0 Offset 0 + Decorate 56 Binding 1 + Decorate 56 DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypePointer HitObjectAttributeEXT 7(fvec2) + 9(attr): 8(ptr) Variable HitObjectAttributeEXT + 10: 6(float) Constant 1065353216 + 11: 7(fvec2) ConstantComposite 10 10 + 12(hBlock): TypeStruct 6(float) + 13: TypePointer HitObjectAttributeEXT 12(hBlock) + 14: 13(ptr) Variable HitObjectAttributeEXT + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: 6(float) Constant 1073741824 + 18: TypePointer HitObjectAttributeEXT 6(float) + 20: TypeHitObjectEXT + 21: TypePointer Private 20 + 22(hObj): 21(ptr) Variable Private + 23: TypeAccelerationStructureKHR + 24: TypePointer UniformConstant 23 + 25(as): 24(ptr) Variable UniformConstant + 27: TypeInt 32 0 + 28: 27(int) Constant 1 + 29: TypeVector 6(float) 3 + 30: 6(float) Constant 1056964608 + 31: 29(fvec3) ConstantComposite 30 30 30 + 32: 29(fvec3) ConstantComposite 10 10 10 + 33: 15(int) Constant 1 + 34: TypeVector 6(float) 4 + 35: TypePointer RayPayloadKHR 34(fvec4) + 36(payload): 35(ptr) Variable RayPayloadKHR + 38: 6(float) Constant 1092616192 + 39: 15(int) Constant 2 + 40(pBlock): TypeStruct 7(fvec2) 7(fvec2) + 41: TypePointer RayPayloadKHR 40(pBlock) + 42: 41(ptr) Variable RayPayloadKHR + 43(hObjNop): 21(ptr) Variable Private + 44(hObjMiss): 21(ptr) Variable Private + 45: 6(float) Constant 1069547520 + 46: 29(fvec3) ConstantComposite 45 45 45 + 47: 6(float) Constant 1084227584 + 48: 6(float) Constant 1090519040 + 49(hObjHit): 21(ptr) Variable Private + 50: TypeBool + 54(block): TypeStruct 6(float) + 55: TypePointer StorageBuffer 54(block) + 56: 55(ptr) Variable StorageBuffer + 57: TypePointer StorageBuffer 6(float) + 68: 6(float) Constant 1077936128 + 70: TypePointer Function 27(int) + 73: TypePointer Function 6(float) + 78: TypePointer Function 29(fvec3) + 87: TypeMatrix 29(fvec3) 4 + 88: TypePointer Function 87 + 93: TypePointer Function 15(int) + 104: TypeVector 27(int) 2 + 105: TypePointer Function 104(ivec2) + 110: TypeRayQueryKHR + 111: TypePointer Private 110 + 112(rq): 111(ptr) Variable Private + 4(main): 2 Function None 3 + 5: Label + 71(rayflags): 70(ptr) Variable Function + 74(tmin): 73(ptr) Variable Function + 76(tmax): 73(ptr) Variable Function + 79(orig): 78(ptr) Variable Function + 81(dir): 78(ptr) Variable Function + 83(oorig): 78(ptr) Variable Function + 85(odir): 78(ptr) Variable Function + 89(otw): 88(ptr) Variable Function + 91(wto): 88(ptr) Variable Function + 94(cid): 93(ptr) Variable Function + 96(iid): 93(ptr) Variable Function + 98(pid): 93(ptr) Variable Function + 100(gid): 93(ptr) Variable Function + 102(hkind): 70(ptr) Variable Function + 106(handle): 105(ptr) Variable Function + 108(rid): 70(ptr) Variable Function + Store 9(attr) 11 + 19: 18(ptr) AccessChain 14 16 + Store 19 17 + 26: 23 Load 25(as) + HitObjectTraceRayEXT 22(hObj) 26 28 28 28 28 28 31 30 32 10 36(payload) + 37: 23 Load 25(as) + HitObjectTraceRayMotionEXT 22(hObj) 37 28 28 28 28 28 31 30 32 10 38 42 + HitObjectRecordEmptyEXT 43(hObjNop) + HitObjectRecordMissEXT 44(hObjMiss) 28 28 31 17 46 47 + HitObjectRecordMissMotionEXT 44(hObjMiss) 28 28 31 17 46 47 48 + HitObjectExecuteShaderEXT 49(hObjHit) 36(payload) + 51: 50(bool) HitObjectIsHitEXT 22(hObj) + SelectionMerge 53 None + BranchConditional 51 52 59 + 52: Label + 58: 57(ptr) AccessChain 56 16 + Store 58 10 + Branch 53 + 59: Label + 60: 50(bool) HitObjectIsMissEXT 22(hObj) + SelectionMerge 62 None + BranchConditional 60 61 64 + 61: Label + 63: 57(ptr) AccessChain 56 16 + Store 63 17 + Branch 62 + 64: Label + 65: 50(bool) HitObjectIsEmptyEXT 22(hObj) + SelectionMerge 67 None + BranchConditional 65 66 67 + 66: Label + 69: 57(ptr) AccessChain 56 16 + Store 69 68 + Branch 67 + 67: Label + Branch 62 + 62: Label + Branch 53 + 53: Label + 72: 27(int) HitObjectGetRayFlagsEXT 49(hObjHit) + Store 71(rayflags) 72 + 75: 6(float) HitObjectGetRayTMinEXT 49(hObjHit) + Store 74(tmin) 75 + 77: 6(float) HitObjectGetRayTMaxEXT 49(hObjHit) + Store 76(tmax) 77 + 80: 29(fvec3) HitObjectGetWorldRayOriginEXT 49(hObjHit) + Store 79(orig) 80 + 82: 29(fvec3) HitObjectGetWorldRayDirectionEXT 49(hObjHit) + Store 81(dir) 82 + 84: 29(fvec3) HitObjectGetObjectRayOriginEXT 49(hObjHit) + Store 83(oorig) 84 + 86: 29(fvec3) HitObjectGetObjectRayDirectionEXT 49(hObjHit) + Store 85(odir) 86 + 90: 87 HitObjectGetObjectToWorldEXT 49(hObjHit) + Store 89(otw) 90 + 92: 87 HitObjectGetWorldToObjectEXT 49(hObjHit) + Store 91(wto) 92 + 95: 15(int) HitObjectGetInstanceCustomIndexEXT 44(hObjMiss) + Store 94(cid) 95 + 97: 15(int) HitObjectGetInstanceIdEXT 43(hObjNop) + Store 96(iid) 97 + 99: 15(int) HitObjectGetPrimitiveIndexEXT 22(hObj) + Store 98(pid) 99 + 101: 15(int) HitObjectGetGeometryIndexEXT 22(hObj) + Store 100(gid) 101 + 103: 27(int) HitObjectGetHitKindEXT 22(hObj) + Store 102(hkind) 103 + HitObjectGetAttributesEXT 22(hObj) 9(attr) + 107: 104(ivec2) HitObjectGetShaderRecordBufferHandleEXT 22(hObj) + Store 106(handle) 107 + 109: 27(int) HitObjectGetShaderBindingTableRecordIndexEXT 22(hObj) + Store 108(rid) 109 + HitObjectRecordFromQueryEXT 49(hObjHit) 112(rq) 28 9(attr) + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.ext.hitobject-errors.rgen.out b/third_party/glslang/Test/baseResults/spv.ext.hitobject-errors.rgen.out new file mode 100644 index 0000000000..357cebe66b --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.ext.hitobject-errors.rgen.out @@ -0,0 +1,9 @@ +spv.ext.hitobject-errors.rgen +ERROR: 0:7: 'hitObjectEXT' : hitObjectEXT can only be declared in global or function scope with no storage qualifier: uHitObj +ERROR: 0:9: 'hitObjectEXT' : hitObjectEXT can only be declared in global or function scope with no storage qualifier: hobjIn +ERROR: 0:10: 'hitObjectEXT' : hitObjectEXT can only be declared in global or function scope with no storage qualifier: hobjOut +ERROR: 0:21: 'hObjWrapper' : struct is not allowed to contain hitObjectEXT: wrapper +ERROR: 4 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.ext.meshShaderBuiltins.mesh.out b/third_party/glslang/Test/baseResults/spv.ext.meshShaderBuiltins.mesh.out index 7fac1a7e27..95efbe27f5 100644 --- a/third_party/glslang/Test/baseResults/spv.ext.meshShaderBuiltins.mesh.out +++ b/third_party/glslang/Test/baseResults/spv.ext.meshShaderBuiltins.mesh.out @@ -1,7 +1,7 @@ spv.ext.meshShaderBuiltins.mesh // Module Version 10400 // Generated by (magic number): 8000b -// Id's are bound by 158 +// Id's are bound by 107 Capability ClipDistance Capability CullDistance @@ -11,7 +11,7 @@ spv.ext.meshShaderBuiltins.mesh Extension "SPV_EXT_mesh_shader" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint MeshEXT 4 "main" 13 19 24 41 93 134 152 155 + EntryPoint MeshEXT 4 "main" 13 19 24 41 69 86 101 104 ExecutionMode 4 LocalSize 32 1 1 ExecutionMode 4 OutputVertices 81 ExecutionMode 4 OutputPrimitivesNV 32 @@ -36,17 +36,17 @@ spv.ext.meshShaderBuiltins.mesh MemberName 38(gl_MeshPerVertexEXT) 2 "gl_ClipDistance" MemberName 38(gl_MeshPerVertexEXT) 3 "gl_CullDistance" Name 41 "gl_MeshVerticesEXT" - Name 90 "gl_MeshPerPrimitiveEXT" - MemberName 90(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID" - MemberName 90(gl_MeshPerPrimitiveEXT) 1 "gl_Layer" - MemberName 90(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex" - MemberName 90(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT" - Name 93 "gl_MeshPrimitivesEXT" - Name 134 "gl_PrimitiveTriangleIndicesEXT" - Name 150 "id" - Name 152 "gl_DrawIDARB" - Name 154 "viewIdx" - Name 155 "gl_ViewIndex" + Name 66 "gl_MeshPerPrimitiveEXT" + MemberName 66(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID" + MemberName 66(gl_MeshPerPrimitiveEXT) 1 "gl_Layer" + MemberName 66(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex" + MemberName 66(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT" + Name 69 "gl_MeshPrimitivesEXT" + Name 86 "gl_PrimitiveTriangleIndicesEXT" + Name 99 "id" + Name 101 "gl_DrawIDARB" + Name 103 "viewIdx" + Name 104 "gl_ViewIndex" Decorate 13(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 19(gl_WorkGroupID) BuiltIn WorkgroupId Decorate 24(gl_NumWorkGroups) BuiltIn NumWorkgroups @@ -55,19 +55,19 @@ spv.ext.meshShaderBuiltins.mesh MemberDecorate 38(gl_MeshPerVertexEXT) 1 BuiltIn PointSize MemberDecorate 38(gl_MeshPerVertexEXT) 2 BuiltIn ClipDistance MemberDecorate 38(gl_MeshPerVertexEXT) 3 BuiltIn CullDistance - Decorate 90(gl_MeshPerPrimitiveEXT) Block - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV - Decorate 134(gl_PrimitiveTriangleIndicesEXT) BuiltIn PrimitiveTriangleIndicesEXT - Decorate 152(gl_DrawIDARB) BuiltIn DrawIndex - Decorate 155(gl_ViewIndex) BuiltIn ViewIndex - Decorate 157 BuiltIn WorkgroupSize + Decorate 66(gl_MeshPerPrimitiveEXT) Block + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV + Decorate 86(gl_PrimitiveTriangleIndicesEXT) BuiltIn PrimitiveTriangleIndicesEXT + Decorate 101(gl_DrawIDARB) BuiltIn DrawIndex + Decorate 104(gl_ViewIndex) BuiltIn ViewIndex + Decorate 106 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 8: TypeInt 32 0 @@ -107,29 +107,30 @@ spv.ext.meshShaderBuiltins.mesh 62: 8(int) Constant 1 63: 8(int) Constant 264 64: 8(int) Constant 2 - 89: TypeBool -90(gl_MeshPerPrimitiveEXT): TypeStruct 43(int) 43(int) 43(int) 89(bool) - 91: TypeArray 90(gl_MeshPerPrimitiveEXT) 29 - 92: TypePointer Output 91 -93(gl_MeshPrimitivesEXT): 92(ptr) Variable Output - 95: 43(int) Constant 6 - 96: TypePointer Output 43(int) - 99: 43(int) Constant 7 - 102: 43(int) Constant 8 - 105: 89(bool) ConstantFalse - 106: TypePointer Output 89(bool) - 132: TypeArray 11(ivec3) 29 - 133: TypePointer Output 132 -134(gl_PrimitiveTriangleIndicesEXT): 133(ptr) Variable Output - 135: 8(int) Constant 257 - 136: 11(ivec3) ConstantComposite 135 135 135 - 137: TypePointer Output 11(ivec3) - 141: 11(ivec3) ConstantComposite 64 64 64 - 149: TypePointer Function 43(int) - 151: TypePointer Input 43(int) -152(gl_DrawIDARB): 151(ptr) Variable Input -155(gl_ViewIndex): 151(ptr) Variable Input - 157: 11(ivec3) ConstantComposite 29 62 62 + 65: TypeBool +66(gl_MeshPerPrimitiveEXT): TypeStruct 43(int) 43(int) 43(int) 65(bool) + 67: TypeArray 66(gl_MeshPerPrimitiveEXT) 29 + 68: TypePointer Output 67 +69(gl_MeshPrimitivesEXT): 68(ptr) Variable Output + 71: 43(int) Constant 6 + 72: TypePointer Output 43(int) + 75: 43(int) Constant 7 + 78: 43(int) Constant 8 + 81: 65(bool) ConstantFalse + 82: TypePointer Output 65(bool) + 84: TypeArray 11(ivec3) 29 + 85: TypePointer Output 84 +86(gl_PrimitiveTriangleIndicesEXT): 85(ptr) Variable Output + 87: 8(int) Constant 257 + 88: 11(ivec3) ConstantComposite 87 87 87 + 89: TypePointer Output 11(ivec3) + 93: 11(ivec3) ConstantComposite 64 64 64 + 96: 11(ivec3) ConstantComposite 14 14 14 + 98: TypePointer Function 43(int) + 100: TypePointer Input 43(int) +101(gl_DrawIDARB): 100(ptr) Variable Input +104(gl_ViewIndex): 100(ptr) Variable Input + 106: 11(ivec3) ConstantComposite 29 62 62 4(main): 2 Function None 3 5: Label 10(iid): 9(ptr) Variable Function @@ -164,104 +165,40 @@ spv.ext.meshShaderBuiltins.mesh Store 61 60 MemoryBarrier 62 63 ControlBarrier 64 64 63 - 65: 8(int) Load 10(iid) - 66: 8(int) IAdd 65 62 - 67: 8(int) Load 10(iid) - 68: 47(ptr) AccessChain 41(gl_MeshVerticesEXT) 67 44 - 69: 33(fvec4) Load 68 - 70: 47(ptr) AccessChain 41(gl_MeshVerticesEXT) 66 44 - Store 70 69 - 71: 8(int) Load 10(iid) - 72: 8(int) IAdd 71 62 - 73: 8(int) Load 10(iid) - 74: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 73 50 - 75: 32(float) Load 74 - 76: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 72 50 + 70: 8(int) Load 10(iid) + 73: 72(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 70 44 + Store 73 71 + 74: 8(int) Load 10(iid) + 76: 72(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 74 50 Store 76 75 77: 8(int) Load 10(iid) - 78: 8(int) IAdd 77 62 - 79: 8(int) Load 10(iid) - 80: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 79 55 56 - 81: 32(float) Load 80 - 82: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 78 55 56 - Store 82 81 - 83: 8(int) Load 10(iid) - 84: 8(int) IAdd 83 62 - 85: 8(int) Load 10(iid) - 86: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 85 56 55 - 87: 32(float) Load 86 - 88: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 84 56 55 - Store 88 87 + 79: 72(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 77 55 + Store 79 78 + 80: 8(int) Load 10(iid) + 83: 82(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 80 56 + Store 83 81 MemoryBarrier 62 63 ControlBarrier 64 64 63 - 94: 8(int) Load 10(iid) - 97: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 94 44 - Store 97 95 - 98: 8(int) Load 10(iid) - 100: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 98 50 - Store 100 99 - 101: 8(int) Load 10(iid) - 103: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 101 55 - Store 103 102 - 104: 8(int) Load 10(iid) - 107: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 104 56 - Store 107 105 - MemoryBarrier 62 63 - ControlBarrier 64 64 63 - 108: 8(int) Load 10(iid) - 109: 8(int) IAdd 108 62 - 110: 8(int) Load 10(iid) - 111: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 110 44 - 112: 43(int) Load 111 - 113: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 109 44 - Store 113 112 - 114: 8(int) Load 10(iid) - 115: 8(int) IAdd 114 62 - 116: 8(int) Load 10(iid) - 117: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 116 50 - 118: 43(int) Load 117 - 119: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 115 50 - Store 119 118 - 120: 8(int) Load 10(iid) - 121: 8(int) IAdd 120 62 - 122: 8(int) Load 10(iid) - 123: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 122 55 - 124: 43(int) Load 123 - 125: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 121 55 - Store 125 124 - 126: 8(int) Load 10(iid) - 127: 8(int) IAdd 126 62 - 128: 8(int) Load 10(iid) - 129: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 128 56 - 130: 89(bool) Load 129 - 131: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 127 56 - Store 131 130 - MemoryBarrier 62 63 - ControlBarrier 64 64 63 - 138: 137(ptr) AccessChain 134(gl_PrimitiveTriangleIndicesEXT) 44 - Store 138 136 - 139: 8(int) Load 28(primitiveCount) - 140: 8(int) ISub 139 62 - 142: 137(ptr) AccessChain 134(gl_PrimitiveTriangleIndicesEXT) 140 - Store 142 141 - 143: 8(int) Load 18(gid) - 144: 8(int) Load 18(gid) - 145: 8(int) ISub 144 62 - 146: 137(ptr) AccessChain 134(gl_PrimitiveTriangleIndicesEXT) 145 - 147: 11(ivec3) Load 146 - 148: 137(ptr) AccessChain 134(gl_PrimitiveTriangleIndicesEXT) 143 - Store 148 147 + 90: 89(ptr) AccessChain 86(gl_PrimitiveTriangleIndicesEXT) 44 + Store 90 88 + 91: 8(int) Load 28(primitiveCount) + 92: 8(int) ISub 91 62 + 94: 89(ptr) AccessChain 86(gl_PrimitiveTriangleIndicesEXT) 92 + Store 94 93 + 95: 8(int) Load 18(gid) + 97: 89(ptr) AccessChain 86(gl_PrimitiveTriangleIndicesEXT) 95 + Store 97 96 MemoryBarrier 62 63 ControlBarrier 64 64 63 Return FunctionEnd 6(testAdditionalBuiltins(): 2 Function None 3 7: Label - 150(id): 149(ptr) Variable Function - 154(viewIdx): 149(ptr) Variable Function - 153: 43(int) Load 152(gl_DrawIDARB) - Store 150(id) 153 - 156: 43(int) Load 155(gl_ViewIndex) - Store 154(viewIdx) 156 + 99(id): 98(ptr) Variable Function + 103(viewIdx): 98(ptr) Variable Function + 102: 43(int) Load 101(gl_DrawIDARB) + Store 99(id) 102 + 105: 43(int) Load 104(gl_ViewIndex) + Store 103(viewIdx) 105 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.ext.meshShaderBuiltinsShadingRate.mesh.out b/third_party/glslang/Test/baseResults/spv.ext.meshShaderBuiltinsShadingRate.mesh.out index fc14ff6c04..ee051d6c1a 100644 --- a/third_party/glslang/Test/baseResults/spv.ext.meshShaderBuiltinsShadingRate.mesh.out +++ b/third_party/glslang/Test/baseResults/spv.ext.meshShaderBuiltinsShadingRate.mesh.out @@ -1,7 +1,7 @@ spv.ext.meshShaderBuiltinsShadingRate.mesh // Module Version 10400 // Generated by (magic number): 8000b -// Id's are bound by 164 +// Id's are bound by 110 Capability ClipDistance Capability CullDistance @@ -13,7 +13,7 @@ spv.ext.meshShaderBuiltinsShadingRate.mesh Extension "SPV_KHR_fragment_shading_rate" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint MeshEXT 4 "main" 13 19 24 41 93 140 158 161 + EntryPoint MeshEXT 4 "main" 13 19 24 41 69 89 104 107 ExecutionMode 4 LocalSize 32 1 1 ExecutionMode 4 OutputVertices 81 ExecutionMode 4 OutputPrimitivesNV 32 @@ -39,18 +39,18 @@ spv.ext.meshShaderBuiltinsShadingRate.mesh MemberName 38(gl_MeshPerVertexEXT) 2 "gl_ClipDistance" MemberName 38(gl_MeshPerVertexEXT) 3 "gl_CullDistance" Name 41 "gl_MeshVerticesEXT" - Name 90 "gl_MeshPerPrimitiveEXT" - MemberName 90(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID" - MemberName 90(gl_MeshPerPrimitiveEXT) 1 "gl_Layer" - MemberName 90(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex" - MemberName 90(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT" - MemberName 90(gl_MeshPerPrimitiveEXT) 4 "gl_PrimitiveShadingRateEXT" - Name 93 "gl_MeshPrimitivesEXT" - Name 140 "gl_PrimitiveTriangleIndicesEXT" - Name 156 "id" - Name 158 "gl_DrawIDARB" - Name 160 "viewIdx" - Name 161 "gl_ViewIndex" + Name 66 "gl_MeshPerPrimitiveEXT" + MemberName 66(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID" + MemberName 66(gl_MeshPerPrimitiveEXT) 1 "gl_Layer" + MemberName 66(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex" + MemberName 66(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT" + MemberName 66(gl_MeshPerPrimitiveEXT) 4 "gl_PrimitiveShadingRateEXT" + Name 69 "gl_MeshPrimitivesEXT" + Name 89 "gl_PrimitiveTriangleIndicesEXT" + Name 102 "id" + Name 104 "gl_DrawIDARB" + Name 106 "viewIdx" + Name 107 "gl_ViewIndex" Decorate 13(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 19(gl_WorkGroupID) BuiltIn WorkgroupId Decorate 24(gl_NumWorkGroups) BuiltIn NumWorkgroups @@ -59,21 +59,21 @@ spv.ext.meshShaderBuiltinsShadingRate.mesh MemberDecorate 38(gl_MeshPerVertexEXT) 1 BuiltIn PointSize MemberDecorate 38(gl_MeshPerVertexEXT) 2 BuiltIn ClipDistance MemberDecorate 38(gl_MeshPerVertexEXT) 3 BuiltIn CullDistance - Decorate 90(gl_MeshPerPrimitiveEXT) Block - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 4 BuiltIn PrimitiveShadingRateKHR - MemberDecorate 90(gl_MeshPerPrimitiveEXT) 4 PerPrimitiveNV - Decorate 140(gl_PrimitiveTriangleIndicesEXT) BuiltIn PrimitiveTriangleIndicesEXT - Decorate 158(gl_DrawIDARB) BuiltIn DrawIndex - Decorate 161(gl_ViewIndex) BuiltIn ViewIndex - Decorate 163 BuiltIn WorkgroupSize + Decorate 66(gl_MeshPerPrimitiveEXT) Block + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 4 BuiltIn PrimitiveShadingRateKHR + MemberDecorate 66(gl_MeshPerPrimitiveEXT) 4 PerPrimitiveNV + Decorate 89(gl_PrimitiveTriangleIndicesEXT) BuiltIn PrimitiveTriangleIndicesEXT + Decorate 104(gl_DrawIDARB) BuiltIn DrawIndex + Decorate 107(gl_ViewIndex) BuiltIn ViewIndex + Decorate 109 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 8: TypeInt 32 0 @@ -113,30 +113,31 @@ spv.ext.meshShaderBuiltinsShadingRate.mesh 62: 8(int) Constant 1 63: 8(int) Constant 264 64: 8(int) Constant 2 - 89: TypeBool -90(gl_MeshPerPrimitiveEXT): TypeStruct 43(int) 43(int) 43(int) 89(bool) 43(int) - 91: TypeArray 90(gl_MeshPerPrimitiveEXT) 29 - 92: TypePointer Output 91 -93(gl_MeshPrimitivesEXT): 92(ptr) Variable Output - 95: 43(int) Constant 6 - 96: TypePointer Output 43(int) - 99: 43(int) Constant 7 - 102: 43(int) Constant 8 - 105: 89(bool) ConstantFalse - 106: TypePointer Output 89(bool) - 109: 43(int) Constant 4 - 138: TypeArray 11(ivec3) 29 - 139: TypePointer Output 138 -140(gl_PrimitiveTriangleIndicesEXT): 139(ptr) Variable Output - 141: 8(int) Constant 257 - 142: 11(ivec3) ConstantComposite 141 141 141 - 143: TypePointer Output 11(ivec3) - 147: 11(ivec3) ConstantComposite 64 64 64 - 155: TypePointer Function 43(int) - 157: TypePointer Input 43(int) -158(gl_DrawIDARB): 157(ptr) Variable Input -161(gl_ViewIndex): 157(ptr) Variable Input - 163: 11(ivec3) ConstantComposite 29 62 62 + 65: TypeBool +66(gl_MeshPerPrimitiveEXT): TypeStruct 43(int) 43(int) 43(int) 65(bool) 43(int) + 67: TypeArray 66(gl_MeshPerPrimitiveEXT) 29 + 68: TypePointer Output 67 +69(gl_MeshPrimitivesEXT): 68(ptr) Variable Output + 71: 43(int) Constant 6 + 72: TypePointer Output 43(int) + 75: 43(int) Constant 7 + 78: 43(int) Constant 8 + 81: 65(bool) ConstantFalse + 82: TypePointer Output 65(bool) + 85: 43(int) Constant 4 + 87: TypeArray 11(ivec3) 29 + 88: TypePointer Output 87 +89(gl_PrimitiveTriangleIndicesEXT): 88(ptr) Variable Output + 90: 8(int) Constant 257 + 91: 11(ivec3) ConstantComposite 90 90 90 + 92: TypePointer Output 11(ivec3) + 96: 11(ivec3) ConstantComposite 64 64 64 + 99: 11(ivec3) ConstantComposite 14 14 14 + 101: TypePointer Function 43(int) + 103: TypePointer Input 43(int) +104(gl_DrawIDARB): 103(ptr) Variable Input +107(gl_ViewIndex): 103(ptr) Variable Input + 109: 11(ivec3) ConstantComposite 29 62 62 4(main): 2 Function None 3 5: Label 10(iid): 9(ptr) Variable Function @@ -171,111 +172,43 @@ spv.ext.meshShaderBuiltinsShadingRate.mesh Store 61 60 MemoryBarrier 62 63 ControlBarrier 64 64 63 - 65: 8(int) Load 10(iid) - 66: 8(int) IAdd 65 62 - 67: 8(int) Load 10(iid) - 68: 47(ptr) AccessChain 41(gl_MeshVerticesEXT) 67 44 - 69: 33(fvec4) Load 68 - 70: 47(ptr) AccessChain 41(gl_MeshVerticesEXT) 66 44 - Store 70 69 - 71: 8(int) Load 10(iid) - 72: 8(int) IAdd 71 62 - 73: 8(int) Load 10(iid) - 74: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 73 50 - 75: 32(float) Load 74 - 76: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 72 50 + 70: 8(int) Load 10(iid) + 73: 72(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 70 44 + Store 73 71 + 74: 8(int) Load 10(iid) + 76: 72(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 74 50 Store 76 75 77: 8(int) Load 10(iid) - 78: 8(int) IAdd 77 62 - 79: 8(int) Load 10(iid) - 80: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 79 55 56 - 81: 32(float) Load 80 - 82: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 78 55 56 - Store 82 81 - 83: 8(int) Load 10(iid) - 84: 8(int) IAdd 83 62 - 85: 8(int) Load 10(iid) - 86: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 85 56 55 - 87: 32(float) Load 86 - 88: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 84 56 55 - Store 88 87 + 79: 72(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 77 55 + Store 79 78 + 80: 8(int) Load 10(iid) + 83: 82(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 80 56 + Store 83 81 + 84: 8(int) Load 10(iid) + 86: 72(ptr) AccessChain 69(gl_MeshPrimitivesEXT) 84 85 + Store 86 44 MemoryBarrier 62 63 ControlBarrier 64 64 63 - 94: 8(int) Load 10(iid) - 97: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 94 44 - Store 97 95 - 98: 8(int) Load 10(iid) - 100: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 98 50 + 93: 92(ptr) AccessChain 89(gl_PrimitiveTriangleIndicesEXT) 44 + Store 93 91 + 94: 8(int) Load 28(primitiveCount) + 95: 8(int) ISub 94 62 + 97: 92(ptr) AccessChain 89(gl_PrimitiveTriangleIndicesEXT) 95 + Store 97 96 + 98: 8(int) Load 18(gid) + 100: 92(ptr) AccessChain 89(gl_PrimitiveTriangleIndicesEXT) 98 Store 100 99 - 101: 8(int) Load 10(iid) - 103: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 101 55 - Store 103 102 - 104: 8(int) Load 10(iid) - 107: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 104 56 - Store 107 105 - 108: 8(int) Load 10(iid) - 110: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 108 109 - Store 110 44 - MemoryBarrier 62 63 - ControlBarrier 64 64 63 - 111: 8(int) Load 10(iid) - 112: 8(int) IAdd 111 62 - 113: 8(int) Load 10(iid) - 114: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 113 44 - 115: 43(int) Load 114 - 116: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 112 44 - Store 116 115 - 117: 8(int) Load 10(iid) - 118: 8(int) IAdd 117 62 - 119: 8(int) Load 10(iid) - 120: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 119 50 - 121: 43(int) Load 120 - 122: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 118 50 - Store 122 121 - 123: 8(int) Load 10(iid) - 124: 8(int) IAdd 123 62 - 125: 8(int) Load 10(iid) - 126: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 125 55 - 127: 43(int) Load 126 - 128: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 124 55 - Store 128 127 - 129: 8(int) Load 10(iid) - 130: 8(int) IAdd 129 62 - 131: 8(int) Load 10(iid) - 132: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 131 56 - 133: 89(bool) Load 132 - 134: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 130 56 - Store 134 133 - 135: 8(int) Load 10(iid) - 136: 8(int) IAdd 135 62 - 137: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 136 109 - Store 137 44 - MemoryBarrier 62 63 - ControlBarrier 64 64 63 - 144: 143(ptr) AccessChain 140(gl_PrimitiveTriangleIndicesEXT) 44 - Store 144 142 - 145: 8(int) Load 28(primitiveCount) - 146: 8(int) ISub 145 62 - 148: 143(ptr) AccessChain 140(gl_PrimitiveTriangleIndicesEXT) 146 - Store 148 147 - 149: 8(int) Load 18(gid) - 150: 8(int) Load 18(gid) - 151: 8(int) ISub 150 62 - 152: 143(ptr) AccessChain 140(gl_PrimitiveTriangleIndicesEXT) 151 - 153: 11(ivec3) Load 152 - 154: 143(ptr) AccessChain 140(gl_PrimitiveTriangleIndicesEXT) 149 - Store 154 153 MemoryBarrier 62 63 ControlBarrier 64 64 63 Return FunctionEnd 6(testAdditionalBuiltins(): 2 Function None 3 7: Label - 156(id): 155(ptr) Variable Function - 160(viewIdx): 155(ptr) Variable Function - 159: 43(int) Load 158(gl_DrawIDARB) - Store 156(id) 159 - 162: 43(int) Load 161(gl_ViewIndex) - Store 160(viewIdx) 162 + 102(id): 101(ptr) Variable Function + 106(viewIdx): 101(ptr) Variable Function + 105: 43(int) Load 104(gl_DrawIDARB) + Store 102(id) 105 + 108: 43(int) Load 107(gl_ViewIndex) + Store 106(viewIdx) 108 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.ext.meshShaderRedeclBuiltins.mesh.out b/third_party/glslang/Test/baseResults/spv.ext.meshShaderRedeclBuiltins.mesh.out index 534cf403fb..e0db18ebd7 100644 --- a/third_party/glslang/Test/baseResults/spv.ext.meshShaderRedeclBuiltins.mesh.out +++ b/third_party/glslang/Test/baseResults/spv.ext.meshShaderRedeclBuiltins.mesh.out @@ -1,7 +1,7 @@ spv.ext.meshShaderRedeclBuiltins.mesh // Module Version 10400 // Generated by (magic number): 8000b -// Id's are bound by 128 +// Id's are bound by 80 Capability ClipDistance Capability CullDistance @@ -9,7 +9,7 @@ spv.ext.meshShaderRedeclBuiltins.mesh Extension "SPV_EXT_mesh_shader" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint MeshEXT 4 "main" 11 17 29 81 122 + EntryPoint MeshEXT 4 "main" 11 17 29 57 74 ExecutionMode 4 LocalSize 32 1 1 ExecutionMode 4 OutputVertices 81 ExecutionMode 4 OutputPrimitivesNV 32 @@ -27,13 +27,13 @@ spv.ext.meshShaderRedeclBuiltins.mesh MemberName 26(gl_MeshPerVertexEXT) 2 "gl_ClipDistance" MemberName 26(gl_MeshPerVertexEXT) 3 "gl_CullDistance" Name 29 "gl_MeshVerticesEXT" - Name 78 "gl_MeshPerPrimitiveEXT" - MemberName 78(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID" - MemberName 78(gl_MeshPerPrimitiveEXT) 1 "gl_Layer" - MemberName 78(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex" - MemberName 78(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT" - Name 81 "gl_MeshPrimitivesEXT" - Name 122 "gl_PrimitivePointIndicesEXT" + Name 54 "gl_MeshPerPrimitiveEXT" + MemberName 54(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID" + MemberName 54(gl_MeshPerPrimitiveEXT) 1 "gl_Layer" + MemberName 54(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex" + MemberName 54(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT" + Name 57 "gl_MeshPrimitivesEXT" + Name 74 "gl_PrimitivePointIndicesEXT" Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId Decorate 26(gl_MeshPerVertexEXT) Block @@ -41,17 +41,17 @@ spv.ext.meshShaderRedeclBuiltins.mesh MemberDecorate 26(gl_MeshPerVertexEXT) 1 BuiltIn PointSize MemberDecorate 26(gl_MeshPerVertexEXT) 2 BuiltIn ClipDistance MemberDecorate 26(gl_MeshPerVertexEXT) 3 BuiltIn CullDistance - Decorate 78(gl_MeshPerPrimitiveEXT) Block - MemberDecorate 78(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId - MemberDecorate 78(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV - MemberDecorate 78(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer - MemberDecorate 78(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV - MemberDecorate 78(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex - MemberDecorate 78(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV - MemberDecorate 78(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT - MemberDecorate 78(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV - Decorate 122(gl_PrimitivePointIndicesEXT) BuiltIn PrimitivePointIndicesEXT - Decorate 127 BuiltIn WorkgroupSize + Decorate 54(gl_MeshPerPrimitiveEXT) Block + MemberDecorate 54(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId + MemberDecorate 54(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV + MemberDecorate 54(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer + MemberDecorate 54(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV + MemberDecorate 54(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex + MemberDecorate 54(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV + MemberDecorate 54(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT + MemberDecorate 54(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV + Decorate 74(gl_PrimitivePointIndicesEXT) BuiltIn PrimitivePointIndicesEXT + Decorate 79 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -87,23 +87,23 @@ spv.ext.meshShaderRedeclBuiltins.mesh 50: 6(int) Constant 1 51: 6(int) Constant 264 52: 6(int) Constant 2 - 77: TypeBool -78(gl_MeshPerPrimitiveEXT): TypeStruct 31(int) 31(int) 31(int) 77(bool) - 79: TypeArray 78(gl_MeshPerPrimitiveEXT) 21 - 80: TypePointer Output 79 -81(gl_MeshPrimitivesEXT): 80(ptr) Variable Output - 83: 31(int) Constant 6 - 84: TypePointer Output 31(int) - 87: 31(int) Constant 7 - 90: 31(int) Constant 8 - 93: 77(bool) ConstantFalse - 94: TypePointer Output 77(bool) - 120: TypeArray 6(int) 21 - 121: TypePointer Output 120 -122(gl_PrimitivePointIndicesEXT): 121(ptr) Variable Output - 123: TypePointer Output 6(int) - 125: 31(int) Constant 31 - 127: 9(ivec3) ConstantComposite 21 50 50 + 53: TypeBool +54(gl_MeshPerPrimitiveEXT): TypeStruct 31(int) 31(int) 31(int) 53(bool) + 55: TypeArray 54(gl_MeshPerPrimitiveEXT) 21 + 56: TypePointer Output 55 +57(gl_MeshPrimitivesEXT): 56(ptr) Variable Output + 59: 31(int) Constant 6 + 60: TypePointer Output 31(int) + 63: 31(int) Constant 7 + 66: 31(int) Constant 8 + 69: 53(bool) ConstantFalse + 70: TypePointer Output 53(bool) + 72: TypeArray 6(int) 21 + 73: TypePointer Output 72 +74(gl_PrimitivePointIndicesEXT): 73(ptr) Variable Output + 75: TypePointer Output 6(int) + 77: 31(int) Constant 31 + 79: 9(ivec3) ConstantComposite 21 50 50 4(main): 2 Function None 3 5: Label 8(iid): 7(ptr) Variable Function @@ -129,83 +129,23 @@ spv.ext.meshShaderRedeclBuiltins.mesh Store 49 48 MemoryBarrier 50 51 ControlBarrier 52 52 51 - 53: 6(int) Load 8(iid) - 54: 6(int) IAdd 53 50 - 55: 6(int) Load 8(iid) - 56: 35(ptr) AccessChain 29(gl_MeshVerticesEXT) 55 32 - 57: 23(fvec4) Load 56 - 58: 35(ptr) AccessChain 29(gl_MeshVerticesEXT) 54 32 - Store 58 57 - 59: 6(int) Load 8(iid) - 60: 6(int) IAdd 59 50 - 61: 6(int) Load 8(iid) - 62: 40(ptr) AccessChain 29(gl_MeshVerticesEXT) 61 38 - 63: 22(float) Load 62 - 64: 40(ptr) AccessChain 29(gl_MeshVerticesEXT) 60 38 + 58: 6(int) Load 8(iid) + 61: 60(ptr) AccessChain 57(gl_MeshPrimitivesEXT) 58 32 + Store 61 59 + 62: 6(int) Load 8(iid) + 64: 60(ptr) AccessChain 57(gl_MeshPrimitivesEXT) 62 38 Store 64 63 65: 6(int) Load 8(iid) - 66: 6(int) IAdd 65 50 - 67: 6(int) Load 8(iid) - 68: 40(ptr) AccessChain 29(gl_MeshVerticesEXT) 67 43 44 - 69: 22(float) Load 68 - 70: 40(ptr) AccessChain 29(gl_MeshVerticesEXT) 66 43 44 - Store 70 69 - 71: 6(int) Load 8(iid) - 72: 6(int) IAdd 71 50 - 73: 6(int) Load 8(iid) - 74: 40(ptr) AccessChain 29(gl_MeshVerticesEXT) 73 44 43 - 75: 22(float) Load 74 - 76: 40(ptr) AccessChain 29(gl_MeshVerticesEXT) 72 44 43 - Store 76 75 + 67: 60(ptr) AccessChain 57(gl_MeshPrimitivesEXT) 65 43 + Store 67 66 + 68: 6(int) Load 8(iid) + 71: 70(ptr) AccessChain 57(gl_MeshPrimitivesEXT) 68 44 + Store 71 69 MemoryBarrier 50 51 ControlBarrier 52 52 51 - 82: 6(int) Load 8(iid) - 85: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 82 32 - Store 85 83 - 86: 6(int) Load 8(iid) - 88: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 86 38 - Store 88 87 - 89: 6(int) Load 8(iid) - 91: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 89 43 - Store 91 90 - 92: 6(int) Load 8(iid) - 95: 94(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 92 44 - Store 95 93 - MemoryBarrier 50 51 - ControlBarrier 52 52 51 - 96: 6(int) Load 8(iid) - 97: 6(int) IAdd 96 50 - 98: 6(int) Load 8(iid) - 99: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 98 32 - 100: 31(int) Load 99 - 101: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 97 32 - Store 101 100 - 102: 6(int) Load 8(iid) - 103: 6(int) IAdd 102 50 - 104: 6(int) Load 8(iid) - 105: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 104 38 - 106: 31(int) Load 105 - 107: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 103 38 - Store 107 106 - 108: 6(int) Load 8(iid) - 109: 6(int) IAdd 108 50 - 110: 6(int) Load 8(iid) - 111: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 110 43 - 112: 31(int) Load 111 - 113: 84(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 109 43 - Store 113 112 - 114: 6(int) Load 8(iid) - 115: 6(int) IAdd 114 50 - 116: 6(int) Load 8(iid) - 117: 94(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 116 44 - 118: 77(bool) Load 117 - 119: 94(ptr) AccessChain 81(gl_MeshPrimitivesEXT) 115 44 - Store 119 118 - MemoryBarrier 50 51 - ControlBarrier 52 52 51 - 124: 123(ptr) AccessChain 122(gl_PrimitivePointIndicesEXT) 32 - Store 124 50 - 126: 123(ptr) AccessChain 122(gl_PrimitivePointIndicesEXT) 125 - Store 126 52 + 76: 75(ptr) AccessChain 74(gl_PrimitivePointIndicesEXT) 32 + Store 76 50 + 78: 75(ptr) AccessChain 74(gl_PrimitivePointIndicesEXT) 77 + Store 78 52 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.ext.meshShaderUserDefined.mesh.out b/third_party/glslang/Test/baseResults/spv.ext.meshShaderUserDefined.mesh.out index 6fcd594e07..ff4d97a237 100644 --- a/third_party/glslang/Test/baseResults/spv.ext.meshShaderUserDefined.mesh.out +++ b/third_party/glslang/Test/baseResults/spv.ext.meshShaderUserDefined.mesh.out @@ -1,13 +1,13 @@ spv.ext.meshShaderUserDefined.mesh // Module Version 10400 // Generated by (magic number): 8000b -// Id's are bound by 141 +// Id's are bound by 125 Capability MeshShadingEXT Extension "SPV_EXT_mesh_shader" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint MeshEXT 4 "main" 11 17 34 104 + EntryPoint MeshEXT 4 "main" 11 17 34 100 ExecutionMode 4 LocalSize 32 1 1 ExecutionMode 4 OutputVertices 81 ExecutionMode 4 OutputPrimitivesNV 32 @@ -27,11 +27,11 @@ spv.ext.meshShaderUserDefined.mesh MemberName 30(myblock) 4 "m" MemberName 30(myblock) 5 "mArr" Name 34 "blk" - Name 100 "myblock2" - MemberName 100(myblock2) 0 "f" - MemberName 100(myblock2) 1 "pos" - MemberName 100(myblock2) 2 "m" - Name 104 "blk2" + Name 96 "myblock2" + MemberName 96(myblock2) 0 "f" + MemberName 96(myblock2) 1 "pos" + MemberName 96(myblock2) 2 "m" + Name 100 "blk2" Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId Decorate 30(myblock) Block @@ -42,9 +42,9 @@ spv.ext.meshShaderUserDefined.mesh MemberDecorate 30(myblock) 4 PerPrimitiveNV MemberDecorate 30(myblock) 5 PerPrimitiveNV Decorate 34(blk) Location 0 - Decorate 100(myblock2) Block - Decorate 104(blk2) Location 20 - Decorate 140 BuiltIn WorkgroupSize + Decorate 96(myblock2) Block + Decorate 100(blk2) Location 20 + Decorate 124 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -76,37 +76,37 @@ spv.ext.meshShaderUserDefined.mesh 39: TypePointer Output 20(float) 42: 6(int) Constant 1 44: 36(int) Constant 1 - 52: 36(int) Constant 2 - 53: 20(float) Constant 1096810496 - 54: 20(float) Constant 1097859072 - 55: 20(float) Constant 1095761920 - 56: 23(fvec3) ConstantComposite 53 54 55 - 57: TypePointer Output 23(fvec3) - 63: 36(int) Constant 3 - 72: 6(int) Constant 3 - 77: 36(int) Constant 4 - 78: 20(float) Constant 1098907648 - 79: 24(fvec4) ConstantComposite 55 53 54 78 - 80: TypePointer Output 24(fvec4) - 85: 36(int) Constant 5 - 94: 20(float) Constant 1099431936 - 95: 20(float) Constant 1099956224 - 96: 20(float) Constant 1100480512 - 97: 23(fvec3) ConstantComposite 94 95 96 - 99: 6(int) Constant 264 - 100(myblock2): TypeStruct 20(float) 24(fvec4) 26 - 101: 6(int) Constant 81 - 102: TypeArray 100(myblock2) 101 - 103: TypePointer Output 102 - 104(blk2): 103(ptr) Variable Output - 110: 20(float) Constant 1101004800 - 114: 20(float) Constant 1101529088 - 115: 20(float) Constant 1102053376 - 116: 20(float) Constant 1102577664 - 117: 20(float) Constant 1103101952 - 118: 24(fvec4) ConstantComposite 114 115 116 117 - 130: 20(float) Constant 1105723392 - 140: 9(ivec3) ConstantComposite 31 42 42 + 49: 36(int) Constant 2 + 50: 20(float) Constant 1096810496 + 51: 20(float) Constant 1097859072 + 52: 20(float) Constant 1095761920 + 53: 23(fvec3) ConstantComposite 50 51 52 + 62: 36(int) Constant 3 + 67: 6(int) Constant 3 + 72: 36(int) Constant 4 + 73: 20(float) Constant 1098907648 + 74: 24(fvec4) ConstantComposite 52 50 51 73 + 84: 36(int) Constant 5 + 89: 20(float) Constant 1099431936 + 90: 20(float) Constant 1099956224 + 91: 20(float) Constant 1100480512 + 92: 23(fvec3) ConstantComposite 89 90 91 + 93: TypePointer Output 23(fvec3) + 95: 6(int) Constant 264 + 96(myblock2): TypeStruct 20(float) 24(fvec4) 26 + 97: 6(int) Constant 81 + 98: TypeArray 96(myblock2) 97 + 99: TypePointer Output 98 + 100(blk2): 99(ptr) Variable Output + 102: 20(float) Constant 1101004800 + 105: 20(float) Constant 1101529088 + 106: 20(float) Constant 1102053376 + 107: 20(float) Constant 1102577664 + 108: 20(float) Constant 1103101952 + 109: 24(fvec4) ConstantComposite 105 106 107 108 + 110: TypePointer Output 24(fvec4) + 119: 20(float) Constant 1105723392 + 124: 9(ivec3) ConstantComposite 31 42 42 4(main): 2 Function None 3 5: Label 8(iid): 7(ptr) Variable Function @@ -123,86 +123,75 @@ spv.ext.meshShaderUserDefined.mesh 41: 6(int) Load 8(iid) 43: 6(int) IAdd 41 42 45: 6(int) Load 16(gid) - 46: 6(int) Load 8(iid) - 47: 39(ptr) AccessChain 34(blk) 46 37 - 48: 20(float) Load 47 - 49: 39(ptr) AccessChain 34(blk) 43 44 45 - Store 49 48 - 50: 6(int) Load 8(iid) - 51: 6(int) UDiv 50 28 - 58: 57(ptr) AccessChain 34(blk) 51 52 - 59: 23(fvec3) Load 58 - 60: 23(fvec3) VectorShuffle 59 56 5 3 4 - Store 58 60 - 61: 6(int) Load 8(iid) - 62: 6(int) IMul 61 28 - 64: 6(int) Load 8(iid) - 65: 6(int) UDiv 64 28 - 66: 57(ptr) AccessChain 34(blk) 65 52 - 67: 23(fvec3) Load 66 - 68: 39(ptr) AccessChain 34(blk) 62 63 44 42 - 69: 20(float) CompositeExtract 67 0 + 46: 39(ptr) AccessChain 34(blk) 43 44 45 + Store 46 38 + 47: 6(int) Load 8(iid) + 48: 6(int) UDiv 47 28 + 54: 39(ptr) AccessChain 34(blk) 48 49 42 + 55: 20(float) CompositeExtract 53 0 + Store 54 55 + 56: 39(ptr) AccessChain 34(blk) 48 49 28 + 57: 20(float) CompositeExtract 53 1 + Store 56 57 + 58: 39(ptr) AccessChain 34(blk) 48 49 12 + 59: 20(float) CompositeExtract 53 2 + Store 58 59 + 60: 6(int) Load 8(iid) + 61: 6(int) IMul 60 28 + 63: 39(ptr) AccessChain 34(blk) 61 62 44 42 + 64: 20(float) CompositeExtract 53 0 + Store 63 64 + 65: 39(ptr) AccessChain 34(blk) 61 62 44 28 + 66: 20(float) CompositeExtract 53 1 + Store 65 66 + 68: 39(ptr) AccessChain 34(blk) 61 62 44 67 + 69: 20(float) CompositeExtract 53 2 Store 68 69 - 70: 39(ptr) AccessChain 34(blk) 62 63 44 28 - 71: 20(float) CompositeExtract 67 1 - Store 70 71 - 73: 39(ptr) AccessChain 34(blk) 62 63 44 72 - 74: 20(float) CompositeExtract 67 2 - Store 73 74 - 75: 6(int) Load 8(iid) - 76: 6(int) UDiv 75 21 - 81: 80(ptr) AccessChain 34(blk) 76 77 52 - 82: 24(fvec4) Load 81 - 83: 24(fvec4) VectorShuffle 82 79 7 6 5 4 - Store 81 83 - 84: 6(int) Load 8(iid) + 70: 6(int) Load 8(iid) + 71: 6(int) UDiv 70 21 + 75: 39(ptr) AccessChain 34(blk) 71 72 49 67 + 76: 20(float) CompositeExtract 74 0 + Store 75 76 + 77: 39(ptr) AccessChain 34(blk) 71 72 49 28 + 78: 20(float) CompositeExtract 74 1 + Store 77 78 + 79: 39(ptr) AccessChain 34(blk) 71 72 49 42 + 80: 20(float) CompositeExtract 74 2 + Store 79 80 + 81: 39(ptr) AccessChain 34(blk) 71 72 49 12 + 82: 20(float) CompositeExtract 74 3 + Store 81 82 + 83: 6(int) Load 8(iid) + 85: 39(ptr) AccessChain 34(blk) 83 84 37 44 42 + Store 85 73 86: 6(int) Load 8(iid) - 87: 6(int) UDiv 86 21 - 88: 39(ptr) AccessChain 34(blk) 87 77 52 72 - 89: 20(float) Load 88 - 90: 39(ptr) AccessChain 34(blk) 84 85 37 44 42 - Store 90 89 - 91: 6(int) Load 8(iid) - 92: 6(int) IMul 91 21 - 93: 6(int) Load 16(gid) - 98: 57(ptr) AccessChain 34(blk) 92 85 44 93 - Store 98 97 - MemoryBarrier 42 99 - ControlBarrier 28 28 99 - 105: 6(int) Load 8(iid) - 106: 6(int) Load 8(iid) - 107: 6(int) ISub 106 42 - 108: 39(ptr) AccessChain 104(blk2) 107 37 - 109: 20(float) Load 108 - 111: 20(float) FAdd 109 110 - 112: 39(ptr) AccessChain 104(blk2) 105 37 - Store 112 111 - 113: 6(int) Load 8(iid) - 119: 80(ptr) AccessChain 104(blk2) 113 44 - Store 119 118 - 120: 6(int) Load 8(iid) - 121: 6(int) IAdd 120 42 - 122: 6(int) Load 16(gid) - 123: 6(int) Load 8(iid) - 124: 80(ptr) AccessChain 104(blk2) 123 44 - 125: 24(fvec4) Load 124 - 126: 80(ptr) AccessChain 104(blk2) 121 52 122 - Store 126 125 - 127: 6(int) Load 8(iid) - 128: 6(int) IAdd 127 42 - 129: 6(int) Load 16(gid) - 131: 39(ptr) AccessChain 104(blk2) 128 52 129 28 - Store 131 130 - 132: 6(int) Load 8(iid) - 133: 6(int) IAdd 132 28 - 134: 6(int) Load 8(iid) - 135: 6(int) IAdd 134 42 - 136: 6(int) Load 16(gid) - 137: 80(ptr) AccessChain 104(blk2) 135 52 136 - 138: 24(fvec4) Load 137 - 139: 80(ptr) AccessChain 104(blk2) 133 52 63 - Store 139 138 - MemoryBarrier 42 99 - ControlBarrier 28 28 99 + 87: 6(int) IMul 86 21 + 88: 6(int) Load 16(gid) + 94: 93(ptr) AccessChain 34(blk) 87 84 44 88 + Store 94 92 + MemoryBarrier 42 95 + ControlBarrier 28 28 95 + 101: 6(int) Load 8(iid) + 103: 39(ptr) AccessChain 100(blk2) 101 37 + Store 103 102 + 104: 6(int) Load 8(iid) + 111: 110(ptr) AccessChain 100(blk2) 104 44 + Store 111 109 + 112: 6(int) Load 8(iid) + 113: 6(int) IAdd 112 42 + 114: 6(int) Load 16(gid) + 115: 110(ptr) AccessChain 100(blk2) 113 49 114 + Store 115 109 + 116: 6(int) Load 8(iid) + 117: 6(int) IAdd 116 42 + 118: 6(int) Load 16(gid) + 120: 39(ptr) AccessChain 100(blk2) 117 49 118 28 + Store 120 119 + 121: 6(int) Load 8(iid) + 122: 6(int) IAdd 121 28 + 123: 110(ptr) AccessChain 100(blk2) 122 49 62 + Store 123 109 + MemoryBarrier 42 95 + ControlBarrier 28 28 95 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.floate4m3.comp.out b/third_party/glslang/Test/baseResults/spv.floate4m3.comp.out index b442a968f3..398330a487 100644 --- a/third_party/glslang/Test/baseResults/spv.floate4m3.comp.out +++ b/third_party/glslang/Test/baseResults/spv.floate4m3.comp.out @@ -9,8 +9,8 @@ spv.floate4m3.comp Capability Int64 Capability Int16 Capability Int8 - Capability CapabilityFloat8EXT - Capability CapabilityFloat8CooperativeMatrixEXT + Capability Float8EXT + Capability Float8CooperativeMatrixEXT Capability VulkanMemoryModelKHR Capability CooperativeMatrixConversionsNV Capability CooperativeMatrixKHR diff --git a/third_party/glslang/Test/baseResults/spv.floate4m3.const.comp.out b/third_party/glslang/Test/baseResults/spv.floate4m3.const.comp.out index 40ab218ce5..636900f7a0 100644 --- a/third_party/glslang/Test/baseResults/spv.floate4m3.const.comp.out +++ b/third_party/glslang/Test/baseResults/spv.floate4m3.const.comp.out @@ -5,7 +5,7 @@ spv.floate4m3.const.comp Capability Shader Capability Int8 - Capability CapabilityFloat8EXT + Capability Float8EXT Extension "SPV_EXT_float8" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.floate4m3_error.comp.out b/third_party/glslang/Test/baseResults/spv.floate4m3_error.comp.out index 1dcee128c0..ac71da32d2 100644 --- a/third_party/glslang/Test/baseResults/spv.floate4m3_error.comp.out +++ b/third_party/glslang/Test/baseResults/spv.floate4m3_error.comp.out @@ -37,7 +37,9 @@ ERROR: 0:74: '' : second parameter must not have floate5m2 or floate4m3 basic ty ERROR: 0:75: '' : requires exactly two parameters ERROR: 0:76: '' : types must match other than scalar type and coopmat Use ERROR: 0:77: '' : first parameter must have floate5m2 or floate4m3 basic type -ERROR: 38 compilation errors. No code generated. +ERROR: 0:79: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type ' temp floate4m3_t' and a right operand of type ' temp floate4m3_t' (or there is no acceptable conversion) +ERROR: 0:81: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type ' temp coopmat<3, 16, 16, 0> floate4m3_t' and a right operand of type ' temp coopmat<3, 16, 16, 0> floate4m3_t' (or there is no acceptable conversion) +ERROR: 40 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.floate5m2.comp.out b/third_party/glslang/Test/baseResults/spv.floate5m2.comp.out index 0dfed1df15..8ed56686fd 100644 --- a/third_party/glslang/Test/baseResults/spv.floate5m2.comp.out +++ b/third_party/glslang/Test/baseResults/spv.floate5m2.comp.out @@ -9,8 +9,8 @@ spv.floate5m2.comp Capability Int64 Capability Int16 Capability Int8 - Capability CapabilityFloat8EXT - Capability CapabilityFloat8CooperativeMatrixEXT + Capability Float8EXT + Capability Float8CooperativeMatrixEXT Capability VulkanMemoryModelKHR Capability CooperativeMatrixConversionsNV Capability CooperativeMatrixKHR diff --git a/third_party/glslang/Test/baseResults/spv.floate5m2.const.comp.out b/third_party/glslang/Test/baseResults/spv.floate5m2.const.comp.out index 3f281a64e1..46f929eecf 100644 --- a/third_party/glslang/Test/baseResults/spv.floate5m2.const.comp.out +++ b/third_party/glslang/Test/baseResults/spv.floate5m2.const.comp.out @@ -5,7 +5,7 @@ spv.floate5m2.const.comp Capability Shader Capability Int8 - Capability CapabilityFloat8EXT + Capability Float8EXT Extension "SPV_EXT_float8" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.floate5m2_error.comp.out b/third_party/glslang/Test/baseResults/spv.floate5m2_error.comp.out index 3acc9f91b7..2fa2d455a2 100644 --- a/third_party/glslang/Test/baseResults/spv.floate5m2_error.comp.out +++ b/third_party/glslang/Test/baseResults/spv.floate5m2_error.comp.out @@ -37,7 +37,9 @@ ERROR: 0:74: '' : second parameter must not have floate5m2 or floate4m3 basic ty ERROR: 0:75: '' : requires exactly two parameters ERROR: 0:76: '' : types must match other than scalar type and coopmat Use ERROR: 0:77: '' : first parameter must have floate5m2 or floate4m3 basic type -ERROR: 38 compilation errors. No code generated. +ERROR: 0:79: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type ' temp floate5m2_t' and a right operand of type ' temp floate5m2_t' (or there is no acceptable conversion) +ERROR: 0:81: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type ' temp coopmat<3, 16, 16, 0> floate5m2_t' and a right operand of type ' temp coopmat<3, 16, 16, 0> floate5m2_t' (or there is no acceptable conversion) +ERROR: 40 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.fsi.frag.out b/third_party/glslang/Test/baseResults/spv.fsi.frag.out index df9fc7c6f6..4802247934 100644 --- a/third_party/glslang/Test/baseResults/spv.fsi.frag.out +++ b/third_party/glslang/Test/baseResults/spv.fsi.frag.out @@ -4,7 +4,7 @@ spv.fsi.frag // Id's are bound by 24 Capability Shader - Capability CapabilityFragmentShaderSampleInterlockEXT + Capability FragmentShaderSampleInterlockEXT Extension "SPV_EXT_fragment_shader_interlock" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out b/third_party/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out index d68c0546af..289c01e795 100644 --- a/third_party/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out +++ b/third_party/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out @@ -12,7 +12,7 @@ spv.hlslDebugInfo.vert // OpModuleProcessed shift-sampler-binding 2 // OpModuleProcessed shift-texture-binding 4 // OpModuleProcessed shift-image-binding 1 -// OpModuleProcessed shift-UBO-binding 6 +// OpModuleProcessed shift-ubo-binding 6 // OpModuleProcessed shift-ssbo-binding 3 // OpModuleProcessed shift-uav-binding 5 // OpModuleProcessed no-storage-format diff --git a/third_party/glslang/Test/baseResults/spv.imageAtomic64.comp.out b/third_party/glslang/Test/baseResults/spv.imageAtomic64.comp.out index 1d0ffd8c08..d72ef10edb 100644 --- a/third_party/glslang/Test/baseResults/spv.imageAtomic64.comp.out +++ b/third_party/glslang/Test/baseResults/spv.imageAtomic64.comp.out @@ -1,7 +1,7 @@ spv.imageAtomic64.comp // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 28 +// Id's are bound by 29 Capability Shader Capability Int64 @@ -43,16 +43,17 @@ spv.imageAtomic64.comp 17: 10(int) Constant 0 18: TypePointer Uniform 6(int64_t) 21: 10(int) Constant 2048 - 22: TypeInt 32 0 - 23: 22(int) Constant 0 - 24: TypePointer Image 6(int64_t) - 26: 22(int) Constant 1 - 27: 22(int) Constant 2048 + 22: 10(int) Constant 4 + 23: TypeInt 32 0 + 24: 23(int) Constant 0 + 25: TypePointer Image 6(int64_t) + 27: 23(int) Constant 1 + 28: 23(int) Constant 2052 4(main): 2 Function None 3 5: Label 19: 18(ptr) AccessChain 16 17 20: 6(int64_t) Load 19 - 25: 24(ptr) ImageTexelPointer 9(z) 13 23 - AtomicStore 25 12 27 20 + 26: 25(ptr) ImageTexelPointer 9(z) 13 24 + AtomicStore 26 12 28 20 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.imageAtomic64.frag.out b/third_party/glslang/Test/baseResults/spv.imageAtomic64.frag.out index 35b6c51205..3d24984157 100644 --- a/third_party/glslang/Test/baseResults/spv.imageAtomic64.frag.out +++ b/third_party/glslang/Test/baseResults/spv.imageAtomic64.frag.out @@ -2,7 +2,7 @@ spv.imageAtomic64.frag Validation failed // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 503 +// Id's are bound by 506 Capability Shader Capability Int64 @@ -39,13 +39,13 @@ Validation failed Name 58 "i2DArray" Name 69 "i2DRect" Name 81 "i2DMSArray" - Name 194 "u2D" - Name 207 "uCube" - Name 218 "u1DArray" - Name 229 "uCubeArray" - Name 240 "u2DMS" - Name 458 "ResType" - Name 483 "ResType" + Name 198 "u2D" + Name 211 "uCube" + Name 222 "u1DArray" + Name 233 "uCubeArray" + Name 244 "u2DMS" + Name 461 "ResType" + Name 486 "ResType" Decorate 12(Buf) BufferBlock MemberDecorate 12(Buf) 0 Offset 0 MemberDecorate 12(Buf) 1 Offset 8 @@ -66,16 +66,16 @@ Validation failed Decorate 69(i2DRect) DescriptorSet 0 Decorate 81(i2DMSArray) Binding 10 Decorate 81(i2DMSArray) DescriptorSet 0 - Decorate 194(u2D) Binding 1 - Decorate 194(u2D) DescriptorSet 0 - Decorate 207(uCube) Binding 3 - Decorate 207(uCube) DescriptorSet 0 - Decorate 218(u1DArray) Binding 5 - Decorate 218(u1DArray) DescriptorSet 0 - Decorate 229(uCubeArray) Binding 7 - Decorate 229(uCubeArray) DescriptorSet 0 - Decorate 240(u2DMS) Binding 9 - Decorate 240(u2DMS) DescriptorSet 0 + Decorate 198(u2D) Binding 1 + Decorate 198(u2D) DescriptorSet 0 + Decorate 211(uCube) Binding 3 + Decorate 211(uCube) DescriptorSet 0 + Decorate 222(u1DArray) Binding 5 + Decorate 222(u1DArray) DescriptorSet 0 + Decorate 233(uCubeArray) Binding 7 + Decorate 233(uCubeArray) DescriptorSet 0 + Decorate 244(u2DMS) Binding 9 + Decorate 244(u2DMS) DescriptorSet 0 2: TypeVoid 3: TypeFunction 2 6: TypeInt 64 1 @@ -120,32 +120,35 @@ Validation failed 107: 6(int64_t) Constant 1 0 116: 10(int) Constant 1 117: 10(int) Constant 2048 - 119: 20(int) Constant 2048 - 192: TypeImage 7(int64_t) 2D nonsampled format:R64ui - 193: TypePointer UniformConstant 192 - 194(u2D): 193(ptr) Variable UniformConstant - 198: TypePointer Uniform 7(int64_t) - 201: TypePointer Image 7(int64_t) - 205: TypeImage 7(int64_t) Cube nonsampled format:R64ui - 206: TypePointer UniformConstant 205 - 207(uCube): 206(ptr) Variable UniformConstant - 216: TypeImage 7(int64_t) 1D array nonsampled format:R64ui - 217: TypePointer UniformConstant 216 - 218(u1DArray): 217(ptr) Variable UniformConstant - 227: TypeImage 7(int64_t) Cube array nonsampled format:R64ui - 228: TypePointer UniformConstant 227 - 229(uCubeArray): 228(ptr) Variable UniformConstant - 238: TypeImage 7(int64_t) 2D multi-sampled nonsampled format:R64ui - 239: TypePointer UniformConstant 238 - 240(u2DMS): 239(ptr) Variable UniformConstant - 244: 20(int) Constant 2 - 275: 7(int64_t) Constant 1 0 - 363: 10(int) Constant 2 - 368: TypePointer Uniform 8(i64vec4) - 423: 10(int) Constant 3 - 424: TypePointer Uniform 9(i64vec4) - 458(ResType): TypeStruct 10(int) 8(i64vec4) - 483(ResType): TypeStruct 10(int) 9(i64vec4) + 118: 10(int) Constant 8 + 120: 20(int) Constant 2056 + 179: 10(int) Constant 2 + 181: 20(int) Constant 2050 + 195: 20(int) Constant 2052 + 196: TypeImage 7(int64_t) 2D nonsampled format:R64ui + 197: TypePointer UniformConstant 196 + 198(u2D): 197(ptr) Variable UniformConstant + 202: TypePointer Uniform 7(int64_t) + 205: TypePointer Image 7(int64_t) + 209: TypeImage 7(int64_t) Cube nonsampled format:R64ui + 210: TypePointer UniformConstant 209 + 211(uCube): 210(ptr) Variable UniformConstant + 220: TypeImage 7(int64_t) 1D array nonsampled format:R64ui + 221: TypePointer UniformConstant 220 + 222(u1DArray): 221(ptr) Variable UniformConstant + 231: TypeImage 7(int64_t) Cube array nonsampled format:R64ui + 232: TypePointer UniformConstant 231 + 233(uCubeArray): 232(ptr) Variable UniformConstant + 242: TypeImage 7(int64_t) 2D multi-sampled nonsampled format:R64ui + 243: TypePointer UniformConstant 242 + 244(u2DMS): 243(ptr) Variable UniformConstant + 248: 20(int) Constant 2 + 279: 7(int64_t) Constant 1 0 + 371: TypePointer Uniform 8(i64vec4) + 426: 10(int) Constant 3 + 427: TypePointer Uniform 9(i64vec4) + 461(ResType): TypeStruct 10(int) 8(i64vec4) + 486(ResType): TypeStruct 10(int) 9(i64vec4) 4(main): 2 Function None 3 5: Label 23: 22(ptr) AccessChain 14 19 21 @@ -226,409 +229,409 @@ Validation failed 113: 10(int) Load 112 114: 25(ptr) AccessChain 14 15 115: 6(int64_t) Load 114 - 118: 28(ptr) ImageTexelPointer 18(i1D) 113 21 - 120: 6(int64_t) AtomicIAdd 118 116 119 115 - 121: 25(ptr) AccessChain 14 15 - Store 121 120 - 122: 37(ptr) AccessChain 14 19 - 123: 11(ivec4) Load 122 - 124: 36(ivec3) VectorShuffle 123 123 0 1 2 - 125: 25(ptr) AccessChain 14 15 - 126: 6(int64_t) Load 125 - 127: 28(ptr) ImageTexelPointer 35(i3D) 124 21 - 128: 6(int64_t) AtomicSMin 127 116 119 126 - 129: 25(ptr) AccessChain 14 15 - Store 129 128 - 130: 22(ptr) AccessChain 14 19 21 - 131: 10(int) Load 130 - 132: 25(ptr) AccessChain 14 15 - 133: 6(int64_t) Load 132 - 134: 28(ptr) ImageTexelPointer 48(iBuf) 131 21 - 135: 6(int64_t) AtomicSMax 134 116 119 133 - 136: 25(ptr) AccessChain 14 15 - Store 136 135 - 137: 37(ptr) AccessChain 14 19 - 138: 11(ivec4) Load 137 - 139: 36(ivec3) VectorShuffle 138 138 0 1 2 - 140: 25(ptr) AccessChain 14 15 - 141: 6(int64_t) Load 140 - 142: 28(ptr) ImageTexelPointer 58(i2DArray) 139 21 - 143: 6(int64_t) AtomicAnd 142 116 119 141 - 144: 25(ptr) AccessChain 14 15 - Store 144 143 - 145: 37(ptr) AccessChain 14 19 - 146: 11(ivec4) Load 145 - 147: 70(ivec2) VectorShuffle 146 146 0 1 - 148: 25(ptr) AccessChain 14 15 - 149: 6(int64_t) Load 148 - 150: 28(ptr) ImageTexelPointer 69(i2DRect) 147 21 - 151: 6(int64_t) AtomicOr 150 116 119 149 - 152: 25(ptr) AccessChain 14 15 - Store 152 151 - 153: 37(ptr) AccessChain 14 19 - 154: 11(ivec4) Load 153 - 155: 36(ivec3) VectorShuffle 154 154 0 1 2 - 156: 22(ptr) AccessChain 14 19 85 - 157: 10(int) Load 156 - 158: 25(ptr) AccessChain 14 15 - 159: 6(int64_t) Load 158 - 160: 28(ptr) ImageTexelPointer 81(i2DMSArray) 155 157 - 161: 6(int64_t) AtomicXor 160 116 119 159 - 162: 25(ptr) AccessChain 14 15 - Store 162 161 - 163: 22(ptr) AccessChain 14 19 21 - 164: 10(int) Load 163 - 165: 25(ptr) AccessChain 14 15 - 166: 6(int64_t) Load 165 - 167: 28(ptr) ImageTexelPointer 18(i1D) 164 21 - 168: 6(int64_t) AtomicExchange 167 116 119 166 - 169: 25(ptr) AccessChain 14 15 - Store 169 168 - 170: 37(ptr) AccessChain 14 19 - 171: 11(ivec4) Load 170 - 172: 36(ivec3) VectorShuffle 171 171 0 1 2 - 173: 25(ptr) AccessChain 14 15 - 174: 6(int64_t) Load 173 - 175: 25(ptr) AccessChain 14 15 - 176: 6(int64_t) Load 175 - 177: 6(int64_t) IAdd 176 107 - 178: 28(ptr) ImageTexelPointer 35(i3D) 172 21 - 179: 6(int64_t) AtomicCompareExchange 178 116 119 119 177 174 - 180: 25(ptr) AccessChain 14 15 - Store 180 179 - 181: 22(ptr) AccessChain 14 19 21 - 182: 10(int) Load 181 - 183: 28(ptr) ImageTexelPointer 48(iBuf) 182 21 - 184: 6(int64_t) AtomicLoad 183 116 119 - 185: 25(ptr) AccessChain 14 15 - Store 185 184 - 186: 37(ptr) AccessChain 14 19 - 187: 11(ivec4) Load 186 - 188: 36(ivec3) VectorShuffle 187 187 0 1 2 - 189: 25(ptr) AccessChain 14 15 - 190: 6(int64_t) Load 189 - 191: 28(ptr) ImageTexelPointer 58(i2DArray) 188 21 - AtomicStore 191 116 119 190 - 195: 37(ptr) AccessChain 14 19 - 196: 11(ivec4) Load 195 - 197: 70(ivec2) VectorShuffle 196 196 0 1 - 199: 198(ptr) AccessChain 14 116 - 200: 7(int64_t) Load 199 - 202: 201(ptr) ImageTexelPointer 194(u2D) 197 21 - 203: 7(int64_t) AtomicIAdd 202 30 21 200 - 204: 198(ptr) AccessChain 14 116 - Store 204 203 - 208: 37(ptr) AccessChain 14 19 - 209: 11(ivec4) Load 208 - 210: 36(ivec3) VectorShuffle 209 209 0 1 2 - 211: 198(ptr) AccessChain 14 116 - 212: 7(int64_t) Load 211 - 213: 201(ptr) ImageTexelPointer 207(uCube) 210 21 - 214: 7(int64_t) AtomicUMin 213 30 21 212 - 215: 198(ptr) AccessChain 14 116 - Store 215 214 - 219: 37(ptr) AccessChain 14 19 - 220: 11(ivec4) Load 219 - 221: 70(ivec2) VectorShuffle 220 220 0 1 - 222: 198(ptr) AccessChain 14 116 - 223: 7(int64_t) Load 222 - 224: 201(ptr) ImageTexelPointer 218(u1DArray) 221 21 - 225: 7(int64_t) AtomicUMax 224 30 21 223 - 226: 198(ptr) AccessChain 14 116 - Store 226 225 - 230: 37(ptr) AccessChain 14 19 - 231: 11(ivec4) Load 230 - 232: 36(ivec3) VectorShuffle 231 231 0 1 2 - 233: 198(ptr) AccessChain 14 116 - 234: 7(int64_t) Load 233 - 235: 201(ptr) ImageTexelPointer 229(uCubeArray) 232 21 - 236: 7(int64_t) AtomicAnd 235 30 21 234 - 237: 198(ptr) AccessChain 14 116 - Store 237 236 - 241: 37(ptr) AccessChain 14 19 - 242: 11(ivec4) Load 241 - 243: 70(ivec2) VectorShuffle 242 242 0 1 - 245: 22(ptr) AccessChain 14 19 244 - 246: 10(int) Load 245 - 247: 198(ptr) AccessChain 14 116 - 248: 7(int64_t) Load 247 - 249: 201(ptr) ImageTexelPointer 240(u2DMS) 243 246 - 250: 7(int64_t) AtomicOr 249 30 21 248 - 251: 198(ptr) AccessChain 14 116 - Store 251 250 - 252: 37(ptr) AccessChain 14 19 - 253: 11(ivec4) Load 252 - 254: 70(ivec2) VectorShuffle 253 253 0 1 - 255: 198(ptr) AccessChain 14 116 - 256: 7(int64_t) Load 255 - 257: 201(ptr) ImageTexelPointer 194(u2D) 254 21 - 258: 7(int64_t) AtomicXor 257 30 21 256 - 259: 198(ptr) AccessChain 14 116 - Store 259 258 - 260: 37(ptr) AccessChain 14 19 - 261: 11(ivec4) Load 260 - 262: 36(ivec3) VectorShuffle 261 261 0 1 2 - 263: 198(ptr) AccessChain 14 116 - 264: 7(int64_t) Load 263 - 265: 201(ptr) ImageTexelPointer 207(uCube) 262 21 - 266: 7(int64_t) AtomicExchange 265 30 21 264 - 267: 198(ptr) AccessChain 14 116 - Store 267 266 - 268: 37(ptr) AccessChain 14 19 - 269: 11(ivec4) Load 268 - 270: 70(ivec2) VectorShuffle 269 269 0 1 - 271: 198(ptr) AccessChain 14 116 - 272: 7(int64_t) Load 271 - 273: 198(ptr) AccessChain 14 116 - 274: 7(int64_t) Load 273 - 276: 7(int64_t) IAdd 274 275 - 277: 201(ptr) ImageTexelPointer 218(u1DArray) 270 21 - 278: 7(int64_t) AtomicCompareExchange 277 30 21 21 276 272 - 279: 198(ptr) AccessChain 14 116 - Store 279 278 - 280: 37(ptr) AccessChain 14 19 - 281: 11(ivec4) Load 280 - 282: 70(ivec2) VectorShuffle 281 281 0 1 - 283: 198(ptr) AccessChain 14 116 - 284: 7(int64_t) Load 283 - 285: 201(ptr) ImageTexelPointer 194(u2D) 282 21 - 286: 7(int64_t) AtomicIAdd 285 116 119 284 - 287: 198(ptr) AccessChain 14 116 - Store 287 286 - 288: 37(ptr) AccessChain 14 19 - 289: 11(ivec4) Load 288 - 290: 36(ivec3) VectorShuffle 289 289 0 1 2 - 291: 198(ptr) AccessChain 14 116 - 292: 7(int64_t) Load 291 - 293: 201(ptr) ImageTexelPointer 207(uCube) 290 21 - 294: 7(int64_t) AtomicUMin 293 116 119 292 - 295: 198(ptr) AccessChain 14 116 - Store 295 294 - 296: 37(ptr) AccessChain 14 19 - 297: 11(ivec4) Load 296 - 298: 70(ivec2) VectorShuffle 297 297 0 1 - 299: 198(ptr) AccessChain 14 116 - 300: 7(int64_t) Load 299 - 301: 201(ptr) ImageTexelPointer 218(u1DArray) 298 21 - 302: 7(int64_t) AtomicUMax 301 116 119 300 - 303: 198(ptr) AccessChain 14 116 - Store 303 302 - 304: 37(ptr) AccessChain 14 19 - 305: 11(ivec4) Load 304 - 306: 36(ivec3) VectorShuffle 305 305 0 1 2 - 307: 198(ptr) AccessChain 14 116 - 308: 7(int64_t) Load 307 - 309: 201(ptr) ImageTexelPointer 229(uCubeArray) 306 21 - 310: 7(int64_t) AtomicAnd 309 116 119 308 - 311: 198(ptr) AccessChain 14 116 - Store 311 310 - 312: 37(ptr) AccessChain 14 19 - 313: 11(ivec4) Load 312 - 314: 70(ivec2) VectorShuffle 313 313 0 1 - 315: 22(ptr) AccessChain 14 19 244 - 316: 10(int) Load 315 - 317: 198(ptr) AccessChain 14 116 - 318: 7(int64_t) Load 317 - 319: 201(ptr) ImageTexelPointer 240(u2DMS) 314 316 - 320: 7(int64_t) AtomicOr 319 116 119 318 - 321: 198(ptr) AccessChain 14 116 - Store 321 320 - 322: 37(ptr) AccessChain 14 19 - 323: 11(ivec4) Load 322 - 324: 70(ivec2) VectorShuffle 323 323 0 1 - 325: 198(ptr) AccessChain 14 116 - 326: 7(int64_t) Load 325 - 327: 201(ptr) ImageTexelPointer 194(u2D) 324 21 - 328: 7(int64_t) AtomicXor 327 116 119 326 - 329: 198(ptr) AccessChain 14 116 - Store 329 328 - 330: 37(ptr) AccessChain 14 19 - 331: 11(ivec4) Load 330 - 332: 36(ivec3) VectorShuffle 331 331 0 1 2 - 333: 198(ptr) AccessChain 14 116 - 334: 7(int64_t) Load 333 - 335: 201(ptr) ImageTexelPointer 207(uCube) 332 21 - 336: 7(int64_t) AtomicExchange 335 116 119 334 - 337: 198(ptr) AccessChain 14 116 - Store 337 336 - 338: 37(ptr) AccessChain 14 19 - 339: 11(ivec4) Load 338 - 340: 70(ivec2) VectorShuffle 339 339 0 1 - 341: 198(ptr) AccessChain 14 116 - 342: 7(int64_t) Load 341 - 343: 198(ptr) AccessChain 14 116 - 344: 7(int64_t) Load 343 - 345: 7(int64_t) IAdd 344 275 - 346: 201(ptr) ImageTexelPointer 218(u1DArray) 340 21 - 347: 7(int64_t) AtomicCompareExchange 346 116 119 119 345 342 - 348: 198(ptr) AccessChain 14 116 - Store 348 347 - 349: 37(ptr) AccessChain 14 19 - 350: 11(ivec4) Load 349 - 351: 36(ivec3) VectorShuffle 350 350 0 1 2 - 352: 201(ptr) ImageTexelPointer 229(uCubeArray) 351 21 - 353: 7(int64_t) AtomicLoad 352 116 119 - 354: 198(ptr) AccessChain 14 116 - Store 354 353 - 355: 37(ptr) AccessChain 14 19 - 356: 11(ivec4) Load 355 - 357: 70(ivec2) VectorShuffle 356 356 0 1 - 358: 22(ptr) AccessChain 14 19 244 - 359: 10(int) Load 358 - 360: 198(ptr) AccessChain 14 116 - 361: 7(int64_t) Load 360 - 362: 201(ptr) ImageTexelPointer 240(u2DMS) 357 359 - AtomicStore 362 116 119 361 - 364: 16 Load 18(i1D) - 365: 22(ptr) AccessChain 14 19 21 - 366: 10(int) Load 365 - 367: 8(i64vec4) ImageRead 364 366 - 369: 368(ptr) AccessChain 14 363 - 370: 8(i64vec4) Load 369 - 371: 8(i64vec4) IAdd 370 367 - 372: 368(ptr) AccessChain 14 363 - Store 372 371 - 373: 33 Load 35(i3D) - 374: 37(ptr) AccessChain 14 19 - 375: 11(ivec4) Load 374 - 376: 36(ivec3) VectorShuffle 375 375 0 1 2 - 377: 8(i64vec4) ImageRead 373 376 - 378: 368(ptr) AccessChain 14 363 - 379: 8(i64vec4) Load 378 - 380: 8(i64vec4) IAdd 379 377 - 381: 368(ptr) AccessChain 14 363 - Store 381 380 - 382: 46 Load 48(iBuf) - 383: 22(ptr) AccessChain 14 19 21 - 384: 10(int) Load 383 - 385: 8(i64vec4) ImageRead 382 384 - 386: 368(ptr) AccessChain 14 363 - 387: 8(i64vec4) Load 386 - 388: 8(i64vec4) IAdd 387 385 - 389: 368(ptr) AccessChain 14 363 - Store 389 388 - 390: 56 Load 58(i2DArray) - 391: 37(ptr) AccessChain 14 19 - 392: 11(ivec4) Load 391 - 393: 36(ivec3) VectorShuffle 392 392 0 1 2 - 394: 8(i64vec4) ImageRead 390 393 - 395: 368(ptr) AccessChain 14 363 - 396: 8(i64vec4) Load 395 - 397: 8(i64vec4) IAdd 396 394 - 398: 368(ptr) AccessChain 14 363 - Store 398 397 - 399: 67 Load 69(i2DRect) - 400: 37(ptr) AccessChain 14 19 - 401: 11(ivec4) Load 400 - 402: 70(ivec2) VectorShuffle 401 401 0 1 - 403: 8(i64vec4) ImageRead 399 402 - 404: 368(ptr) AccessChain 14 363 - 405: 8(i64vec4) Load 404 - 406: 8(i64vec4) IAdd 405 403 - 407: 368(ptr) AccessChain 14 363 - Store 407 406 - 408: 79 Load 81(i2DMSArray) - 409: 37(ptr) AccessChain 14 19 - 410: 11(ivec4) Load 409 - 411: 36(ivec3) VectorShuffle 410 410 0 1 2 - 412: 22(ptr) AccessChain 14 19 85 - 413: 10(int) Load 412 - 414: 8(i64vec4) ImageRead 408 411 Sample 413 - 415: 368(ptr) AccessChain 14 363 - 416: 8(i64vec4) Load 415 - 417: 8(i64vec4) IAdd 416 414 - 418: 368(ptr) AccessChain 14 363 - Store 418 417 - 419: 192 Load 194(u2D) - 420: 37(ptr) AccessChain 14 19 - 421: 11(ivec4) Load 420 - 422: 70(ivec2) VectorShuffle 421 421 0 1 - 425: 424(ptr) AccessChain 14 423 - 426: 9(i64vec4) Load 425 - ImageWrite 419 422 426 - 427: 205 Load 207(uCube) - 428: 37(ptr) AccessChain 14 19 - 429: 11(ivec4) Load 428 - 430: 36(ivec3) VectorShuffle 429 429 0 1 2 - 431: 424(ptr) AccessChain 14 423 - 432: 9(i64vec4) Load 431 - ImageWrite 427 430 432 - 433: 216 Load 218(u1DArray) - 434: 37(ptr) AccessChain 14 19 - 435: 11(ivec4) Load 434 - 436: 70(ivec2) VectorShuffle 435 435 0 1 - 437: 424(ptr) AccessChain 14 423 - 438: 9(i64vec4) Load 437 - ImageWrite 433 436 438 - 439: 227 Load 229(uCubeArray) - 440: 37(ptr) AccessChain 14 19 - 441: 11(ivec4) Load 440 - 442: 36(ivec3) VectorShuffle 441 441 0 1 2 - 443: 424(ptr) AccessChain 14 423 - 444: 9(i64vec4) Load 443 - ImageWrite 439 442 444 - 445: 238 Load 240(u2DMS) - 446: 37(ptr) AccessChain 14 19 - 447: 11(ivec4) Load 446 - 448: 70(ivec2) VectorShuffle 447 447 0 1 - 449: 22(ptr) AccessChain 14 19 244 - 450: 10(int) Load 449 - 451: 424(ptr) AccessChain 14 423 - 452: 9(i64vec4) Load 451 - ImageWrite 445 448 452 Sample 450 - 453: 33 Load 35(i3D) - 454: 37(ptr) AccessChain 14 19 - 455: 11(ivec4) Load 454 - 456: 36(ivec3) VectorShuffle 455 455 0 1 2 - 457: 368(ptr) AccessChain 14 363 - 459:458(ResType) ImageSparseRead 453 456 - 460: 8(i64vec4) CompositeExtract 459 1 - Store 457 460 - 461: 10(int) CompositeExtract 459 0 - 462: 56 Load 58(i2DArray) - 463: 37(ptr) AccessChain 14 19 - 464: 11(ivec4) Load 463 - 465: 36(ivec3) VectorShuffle 464 464 0 1 2 - 466: 368(ptr) AccessChain 14 363 - 467:458(ResType) ImageSparseRead 462 465 - 468: 8(i64vec4) CompositeExtract 467 1 - Store 466 468 - 469: 10(int) CompositeExtract 467 0 - 470: 67 Load 69(i2DRect) - 471: 37(ptr) AccessChain 14 19 - 472: 11(ivec4) Load 471 - 473: 70(ivec2) VectorShuffle 472 472 0 1 - 474: 368(ptr) AccessChain 14 363 - 475:458(ResType) ImageSparseRead 470 473 - 476: 8(i64vec4) CompositeExtract 475 1 - Store 474 476 - 477: 10(int) CompositeExtract 475 0 - 478: 192 Load 194(u2D) - 479: 37(ptr) AccessChain 14 19 - 480: 11(ivec4) Load 479 - 481: 70(ivec2) VectorShuffle 480 480 0 1 - 482: 424(ptr) AccessChain 14 423 - 484:483(ResType) ImageSparseRead 478 481 - 485: 9(i64vec4) CompositeExtract 484 1 - Store 482 485 - 486: 10(int) CompositeExtract 484 0 - 487: 205 Load 207(uCube) - 488: 37(ptr) AccessChain 14 19 - 489: 11(ivec4) Load 488 - 490: 36(ivec3) VectorShuffle 489 489 0 1 2 - 491: 424(ptr) AccessChain 14 423 - 492:483(ResType) ImageSparseRead 487 490 - 493: 9(i64vec4) CompositeExtract 492 1 - Store 491 493 - 494: 10(int) CompositeExtract 492 0 - 495: 227 Load 229(uCubeArray) - 496: 37(ptr) AccessChain 14 19 - 497: 11(ivec4) Load 496 - 498: 36(ivec3) VectorShuffle 497 497 0 1 2 - 499: 424(ptr) AccessChain 14 423 - 500:483(ResType) ImageSparseRead 495 498 - 501: 9(i64vec4) CompositeExtract 500 1 - Store 499 501 - 502: 10(int) CompositeExtract 500 0 + 119: 28(ptr) ImageTexelPointer 18(i1D) 113 21 + 121: 6(int64_t) AtomicIAdd 119 116 120 115 + 122: 25(ptr) AccessChain 14 15 + Store 122 121 + 123: 37(ptr) AccessChain 14 19 + 124: 11(ivec4) Load 123 + 125: 36(ivec3) VectorShuffle 124 124 0 1 2 + 126: 25(ptr) AccessChain 14 15 + 127: 6(int64_t) Load 126 + 128: 28(ptr) ImageTexelPointer 35(i3D) 125 21 + 129: 6(int64_t) AtomicSMin 128 116 120 127 + 130: 25(ptr) AccessChain 14 15 + Store 130 129 + 131: 22(ptr) AccessChain 14 19 21 + 132: 10(int) Load 131 + 133: 25(ptr) AccessChain 14 15 + 134: 6(int64_t) Load 133 + 135: 28(ptr) ImageTexelPointer 48(iBuf) 132 21 + 136: 6(int64_t) AtomicSMax 135 116 120 134 + 137: 25(ptr) AccessChain 14 15 + Store 137 136 + 138: 37(ptr) AccessChain 14 19 + 139: 11(ivec4) Load 138 + 140: 36(ivec3) VectorShuffle 139 139 0 1 2 + 141: 25(ptr) AccessChain 14 15 + 142: 6(int64_t) Load 141 + 143: 28(ptr) ImageTexelPointer 58(i2DArray) 140 21 + 144: 6(int64_t) AtomicAnd 143 116 120 142 + 145: 25(ptr) AccessChain 14 15 + Store 145 144 + 146: 37(ptr) AccessChain 14 19 + 147: 11(ivec4) Load 146 + 148: 70(ivec2) VectorShuffle 147 147 0 1 + 149: 25(ptr) AccessChain 14 15 + 150: 6(int64_t) Load 149 + 151: 28(ptr) ImageTexelPointer 69(i2DRect) 148 21 + 152: 6(int64_t) AtomicOr 151 116 120 150 + 153: 25(ptr) AccessChain 14 15 + Store 153 152 + 154: 37(ptr) AccessChain 14 19 + 155: 11(ivec4) Load 154 + 156: 36(ivec3) VectorShuffle 155 155 0 1 2 + 157: 22(ptr) AccessChain 14 19 85 + 158: 10(int) Load 157 + 159: 25(ptr) AccessChain 14 15 + 160: 6(int64_t) Load 159 + 161: 28(ptr) ImageTexelPointer 81(i2DMSArray) 156 158 + 162: 6(int64_t) AtomicXor 161 116 120 160 + 163: 25(ptr) AccessChain 14 15 + Store 163 162 + 164: 22(ptr) AccessChain 14 19 21 + 165: 10(int) Load 164 + 166: 25(ptr) AccessChain 14 15 + 167: 6(int64_t) Load 166 + 168: 28(ptr) ImageTexelPointer 18(i1D) 165 21 + 169: 6(int64_t) AtomicExchange 168 116 120 167 + 170: 25(ptr) AccessChain 14 15 + Store 170 169 + 171: 37(ptr) AccessChain 14 19 + 172: 11(ivec4) Load 171 + 173: 36(ivec3) VectorShuffle 172 172 0 1 2 + 174: 25(ptr) AccessChain 14 15 + 175: 6(int64_t) Load 174 + 176: 25(ptr) AccessChain 14 15 + 177: 6(int64_t) Load 176 + 178: 6(int64_t) IAdd 177 107 + 180: 28(ptr) ImageTexelPointer 35(i3D) 173 21 + 182: 6(int64_t) AtomicCompareExchange 180 116 120 181 178 175 + 183: 25(ptr) AccessChain 14 15 + Store 183 182 + 184: 22(ptr) AccessChain 14 19 21 + 185: 10(int) Load 184 + 186: 28(ptr) ImageTexelPointer 48(iBuf) 185 21 + 187: 6(int64_t) AtomicLoad 186 116 181 + 188: 25(ptr) AccessChain 14 15 + Store 188 187 + 189: 37(ptr) AccessChain 14 19 + 190: 11(ivec4) Load 189 + 191: 36(ivec3) VectorShuffle 190 190 0 1 2 + 192: 25(ptr) AccessChain 14 15 + 193: 6(int64_t) Load 192 + 194: 28(ptr) ImageTexelPointer 58(i2DArray) 191 21 + AtomicStore 194 116 195 193 + 199: 37(ptr) AccessChain 14 19 + 200: 11(ivec4) Load 199 + 201: 70(ivec2) VectorShuffle 200 200 0 1 + 203: 202(ptr) AccessChain 14 116 + 204: 7(int64_t) Load 203 + 206: 205(ptr) ImageTexelPointer 198(u2D) 201 21 + 207: 7(int64_t) AtomicIAdd 206 30 21 204 + 208: 202(ptr) AccessChain 14 116 + Store 208 207 + 212: 37(ptr) AccessChain 14 19 + 213: 11(ivec4) Load 212 + 214: 36(ivec3) VectorShuffle 213 213 0 1 2 + 215: 202(ptr) AccessChain 14 116 + 216: 7(int64_t) Load 215 + 217: 205(ptr) ImageTexelPointer 211(uCube) 214 21 + 218: 7(int64_t) AtomicUMin 217 30 21 216 + 219: 202(ptr) AccessChain 14 116 + Store 219 218 + 223: 37(ptr) AccessChain 14 19 + 224: 11(ivec4) Load 223 + 225: 70(ivec2) VectorShuffle 224 224 0 1 + 226: 202(ptr) AccessChain 14 116 + 227: 7(int64_t) Load 226 + 228: 205(ptr) ImageTexelPointer 222(u1DArray) 225 21 + 229: 7(int64_t) AtomicUMax 228 30 21 227 + 230: 202(ptr) AccessChain 14 116 + Store 230 229 + 234: 37(ptr) AccessChain 14 19 + 235: 11(ivec4) Load 234 + 236: 36(ivec3) VectorShuffle 235 235 0 1 2 + 237: 202(ptr) AccessChain 14 116 + 238: 7(int64_t) Load 237 + 239: 205(ptr) ImageTexelPointer 233(uCubeArray) 236 21 + 240: 7(int64_t) AtomicAnd 239 30 21 238 + 241: 202(ptr) AccessChain 14 116 + Store 241 240 + 245: 37(ptr) AccessChain 14 19 + 246: 11(ivec4) Load 245 + 247: 70(ivec2) VectorShuffle 246 246 0 1 + 249: 22(ptr) AccessChain 14 19 248 + 250: 10(int) Load 249 + 251: 202(ptr) AccessChain 14 116 + 252: 7(int64_t) Load 251 + 253: 205(ptr) ImageTexelPointer 244(u2DMS) 247 250 + 254: 7(int64_t) AtomicOr 253 30 21 252 + 255: 202(ptr) AccessChain 14 116 + Store 255 254 + 256: 37(ptr) AccessChain 14 19 + 257: 11(ivec4) Load 256 + 258: 70(ivec2) VectorShuffle 257 257 0 1 + 259: 202(ptr) AccessChain 14 116 + 260: 7(int64_t) Load 259 + 261: 205(ptr) ImageTexelPointer 198(u2D) 258 21 + 262: 7(int64_t) AtomicXor 261 30 21 260 + 263: 202(ptr) AccessChain 14 116 + Store 263 262 + 264: 37(ptr) AccessChain 14 19 + 265: 11(ivec4) Load 264 + 266: 36(ivec3) VectorShuffle 265 265 0 1 2 + 267: 202(ptr) AccessChain 14 116 + 268: 7(int64_t) Load 267 + 269: 205(ptr) ImageTexelPointer 211(uCube) 266 21 + 270: 7(int64_t) AtomicExchange 269 30 21 268 + 271: 202(ptr) AccessChain 14 116 + Store 271 270 + 272: 37(ptr) AccessChain 14 19 + 273: 11(ivec4) Load 272 + 274: 70(ivec2) VectorShuffle 273 273 0 1 + 275: 202(ptr) AccessChain 14 116 + 276: 7(int64_t) Load 275 + 277: 202(ptr) AccessChain 14 116 + 278: 7(int64_t) Load 277 + 280: 7(int64_t) IAdd 278 279 + 281: 205(ptr) ImageTexelPointer 222(u1DArray) 274 21 + 282: 7(int64_t) AtomicCompareExchange 281 30 21 21 280 276 + 283: 202(ptr) AccessChain 14 116 + Store 283 282 + 284: 37(ptr) AccessChain 14 19 + 285: 11(ivec4) Load 284 + 286: 70(ivec2) VectorShuffle 285 285 0 1 + 287: 202(ptr) AccessChain 14 116 + 288: 7(int64_t) Load 287 + 289: 205(ptr) ImageTexelPointer 198(u2D) 286 21 + 290: 7(int64_t) AtomicIAdd 289 116 120 288 + 291: 202(ptr) AccessChain 14 116 + Store 291 290 + 292: 37(ptr) AccessChain 14 19 + 293: 11(ivec4) Load 292 + 294: 36(ivec3) VectorShuffle 293 293 0 1 2 + 295: 202(ptr) AccessChain 14 116 + 296: 7(int64_t) Load 295 + 297: 205(ptr) ImageTexelPointer 211(uCube) 294 21 + 298: 7(int64_t) AtomicUMin 297 116 120 296 + 299: 202(ptr) AccessChain 14 116 + Store 299 298 + 300: 37(ptr) AccessChain 14 19 + 301: 11(ivec4) Load 300 + 302: 70(ivec2) VectorShuffle 301 301 0 1 + 303: 202(ptr) AccessChain 14 116 + 304: 7(int64_t) Load 303 + 305: 205(ptr) ImageTexelPointer 222(u1DArray) 302 21 + 306: 7(int64_t) AtomicUMax 305 116 120 304 + 307: 202(ptr) AccessChain 14 116 + Store 307 306 + 308: 37(ptr) AccessChain 14 19 + 309: 11(ivec4) Load 308 + 310: 36(ivec3) VectorShuffle 309 309 0 1 2 + 311: 202(ptr) AccessChain 14 116 + 312: 7(int64_t) Load 311 + 313: 205(ptr) ImageTexelPointer 233(uCubeArray) 310 21 + 314: 7(int64_t) AtomicAnd 313 116 120 312 + 315: 202(ptr) AccessChain 14 116 + Store 315 314 + 316: 37(ptr) AccessChain 14 19 + 317: 11(ivec4) Load 316 + 318: 70(ivec2) VectorShuffle 317 317 0 1 + 319: 22(ptr) AccessChain 14 19 248 + 320: 10(int) Load 319 + 321: 202(ptr) AccessChain 14 116 + 322: 7(int64_t) Load 321 + 323: 205(ptr) ImageTexelPointer 244(u2DMS) 318 320 + 324: 7(int64_t) AtomicOr 323 116 120 322 + 325: 202(ptr) AccessChain 14 116 + Store 325 324 + 326: 37(ptr) AccessChain 14 19 + 327: 11(ivec4) Load 326 + 328: 70(ivec2) VectorShuffle 327 327 0 1 + 329: 202(ptr) AccessChain 14 116 + 330: 7(int64_t) Load 329 + 331: 205(ptr) ImageTexelPointer 198(u2D) 328 21 + 332: 7(int64_t) AtomicXor 331 116 120 330 + 333: 202(ptr) AccessChain 14 116 + Store 333 332 + 334: 37(ptr) AccessChain 14 19 + 335: 11(ivec4) Load 334 + 336: 36(ivec3) VectorShuffle 335 335 0 1 2 + 337: 202(ptr) AccessChain 14 116 + 338: 7(int64_t) Load 337 + 339: 205(ptr) ImageTexelPointer 211(uCube) 336 21 + 340: 7(int64_t) AtomicExchange 339 116 120 338 + 341: 202(ptr) AccessChain 14 116 + Store 341 340 + 342: 37(ptr) AccessChain 14 19 + 343: 11(ivec4) Load 342 + 344: 70(ivec2) VectorShuffle 343 343 0 1 + 345: 202(ptr) AccessChain 14 116 + 346: 7(int64_t) Load 345 + 347: 202(ptr) AccessChain 14 116 + 348: 7(int64_t) Load 347 + 349: 7(int64_t) IAdd 348 279 + 350: 205(ptr) ImageTexelPointer 222(u1DArray) 344 21 + 351: 7(int64_t) AtomicCompareExchange 350 116 120 181 349 346 + 352: 202(ptr) AccessChain 14 116 + Store 352 351 + 353: 37(ptr) AccessChain 14 19 + 354: 11(ivec4) Load 353 + 355: 36(ivec3) VectorShuffle 354 354 0 1 2 + 356: 205(ptr) ImageTexelPointer 233(uCubeArray) 355 21 + 357: 7(int64_t) AtomicLoad 356 116 181 + 358: 202(ptr) AccessChain 14 116 + Store 358 357 + 359: 37(ptr) AccessChain 14 19 + 360: 11(ivec4) Load 359 + 361: 70(ivec2) VectorShuffle 360 360 0 1 + 362: 22(ptr) AccessChain 14 19 248 + 363: 10(int) Load 362 + 364: 202(ptr) AccessChain 14 116 + 365: 7(int64_t) Load 364 + 366: 205(ptr) ImageTexelPointer 244(u2DMS) 361 363 + AtomicStore 366 116 195 365 + 367: 16 Load 18(i1D) + 368: 22(ptr) AccessChain 14 19 21 + 369: 10(int) Load 368 + 370: 8(i64vec4) ImageRead 367 369 + 372: 371(ptr) AccessChain 14 179 + 373: 8(i64vec4) Load 372 + 374: 8(i64vec4) IAdd 373 370 + 375: 371(ptr) AccessChain 14 179 + Store 375 374 + 376: 33 Load 35(i3D) + 377: 37(ptr) AccessChain 14 19 + 378: 11(ivec4) Load 377 + 379: 36(ivec3) VectorShuffle 378 378 0 1 2 + 380: 8(i64vec4) ImageRead 376 379 + 381: 371(ptr) AccessChain 14 179 + 382: 8(i64vec4) Load 381 + 383: 8(i64vec4) IAdd 382 380 + 384: 371(ptr) AccessChain 14 179 + Store 384 383 + 385: 46 Load 48(iBuf) + 386: 22(ptr) AccessChain 14 19 21 + 387: 10(int) Load 386 + 388: 8(i64vec4) ImageRead 385 387 + 389: 371(ptr) AccessChain 14 179 + 390: 8(i64vec4) Load 389 + 391: 8(i64vec4) IAdd 390 388 + 392: 371(ptr) AccessChain 14 179 + Store 392 391 + 393: 56 Load 58(i2DArray) + 394: 37(ptr) AccessChain 14 19 + 395: 11(ivec4) Load 394 + 396: 36(ivec3) VectorShuffle 395 395 0 1 2 + 397: 8(i64vec4) ImageRead 393 396 + 398: 371(ptr) AccessChain 14 179 + 399: 8(i64vec4) Load 398 + 400: 8(i64vec4) IAdd 399 397 + 401: 371(ptr) AccessChain 14 179 + Store 401 400 + 402: 67 Load 69(i2DRect) + 403: 37(ptr) AccessChain 14 19 + 404: 11(ivec4) Load 403 + 405: 70(ivec2) VectorShuffle 404 404 0 1 + 406: 8(i64vec4) ImageRead 402 405 + 407: 371(ptr) AccessChain 14 179 + 408: 8(i64vec4) Load 407 + 409: 8(i64vec4) IAdd 408 406 + 410: 371(ptr) AccessChain 14 179 + Store 410 409 + 411: 79 Load 81(i2DMSArray) + 412: 37(ptr) AccessChain 14 19 + 413: 11(ivec4) Load 412 + 414: 36(ivec3) VectorShuffle 413 413 0 1 2 + 415: 22(ptr) AccessChain 14 19 85 + 416: 10(int) Load 415 + 417: 8(i64vec4) ImageRead 411 414 Sample 416 + 418: 371(ptr) AccessChain 14 179 + 419: 8(i64vec4) Load 418 + 420: 8(i64vec4) IAdd 419 417 + 421: 371(ptr) AccessChain 14 179 + Store 421 420 + 422: 196 Load 198(u2D) + 423: 37(ptr) AccessChain 14 19 + 424: 11(ivec4) Load 423 + 425: 70(ivec2) VectorShuffle 424 424 0 1 + 428: 427(ptr) AccessChain 14 426 + 429: 9(i64vec4) Load 428 + ImageWrite 422 425 429 + 430: 209 Load 211(uCube) + 431: 37(ptr) AccessChain 14 19 + 432: 11(ivec4) Load 431 + 433: 36(ivec3) VectorShuffle 432 432 0 1 2 + 434: 427(ptr) AccessChain 14 426 + 435: 9(i64vec4) Load 434 + ImageWrite 430 433 435 + 436: 220 Load 222(u1DArray) + 437: 37(ptr) AccessChain 14 19 + 438: 11(ivec4) Load 437 + 439: 70(ivec2) VectorShuffle 438 438 0 1 + 440: 427(ptr) AccessChain 14 426 + 441: 9(i64vec4) Load 440 + ImageWrite 436 439 441 + 442: 231 Load 233(uCubeArray) + 443: 37(ptr) AccessChain 14 19 + 444: 11(ivec4) Load 443 + 445: 36(ivec3) VectorShuffle 444 444 0 1 2 + 446: 427(ptr) AccessChain 14 426 + 447: 9(i64vec4) Load 446 + ImageWrite 442 445 447 + 448: 242 Load 244(u2DMS) + 449: 37(ptr) AccessChain 14 19 + 450: 11(ivec4) Load 449 + 451: 70(ivec2) VectorShuffle 450 450 0 1 + 452: 22(ptr) AccessChain 14 19 248 + 453: 10(int) Load 452 + 454: 427(ptr) AccessChain 14 426 + 455: 9(i64vec4) Load 454 + ImageWrite 448 451 455 Sample 453 + 456: 33 Load 35(i3D) + 457: 37(ptr) AccessChain 14 19 + 458: 11(ivec4) Load 457 + 459: 36(ivec3) VectorShuffle 458 458 0 1 2 + 460: 371(ptr) AccessChain 14 179 + 462:461(ResType) ImageSparseRead 456 459 + 463: 8(i64vec4) CompositeExtract 462 1 + Store 460 463 + 464: 10(int) CompositeExtract 462 0 + 465: 56 Load 58(i2DArray) + 466: 37(ptr) AccessChain 14 19 + 467: 11(ivec4) Load 466 + 468: 36(ivec3) VectorShuffle 467 467 0 1 2 + 469: 371(ptr) AccessChain 14 179 + 470:461(ResType) ImageSparseRead 465 468 + 471: 8(i64vec4) CompositeExtract 470 1 + Store 469 471 + 472: 10(int) CompositeExtract 470 0 + 473: 67 Load 69(i2DRect) + 474: 37(ptr) AccessChain 14 19 + 475: 11(ivec4) Load 474 + 476: 70(ivec2) VectorShuffle 475 475 0 1 + 477: 371(ptr) AccessChain 14 179 + 478:461(ResType) ImageSparseRead 473 476 + 479: 8(i64vec4) CompositeExtract 478 1 + Store 477 479 + 480: 10(int) CompositeExtract 478 0 + 481: 196 Load 198(u2D) + 482: 37(ptr) AccessChain 14 19 + 483: 11(ivec4) Load 482 + 484: 70(ivec2) VectorShuffle 483 483 0 1 + 485: 427(ptr) AccessChain 14 426 + 487:486(ResType) ImageSparseRead 481 484 + 488: 9(i64vec4) CompositeExtract 487 1 + Store 485 488 + 489: 10(int) CompositeExtract 487 0 + 490: 209 Load 211(uCube) + 491: 37(ptr) AccessChain 14 19 + 492: 11(ivec4) Load 491 + 493: 36(ivec3) VectorShuffle 492 492 0 1 2 + 494: 427(ptr) AccessChain 14 426 + 495:486(ResType) ImageSparseRead 490 493 + 496: 9(i64vec4) CompositeExtract 495 1 + Store 494 496 + 497: 10(int) CompositeExtract 495 0 + 498: 231 Load 233(uCubeArray) + 499: 37(ptr) AccessChain 14 19 + 500: 11(ivec4) Load 499 + 501: 36(ivec3) VectorShuffle 500 500 0 1 2 + 502: 427(ptr) AccessChain 14 426 + 503:486(ResType) ImageSparseRead 498 501 + 504: 9(i64vec4) CompositeExtract 503 1 + Store 502 504 + 505: 10(int) CompositeExtract 503 0 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVector.comp.out b/third_party/glslang/Test/baseResults/spv.longVector.comp.out new file mode 100644 index 0000000000..792c24b5a3 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVector.comp.out @@ -0,0 +1,355 @@ +spv.longVector.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 230 + + Capability Shader + Capability Float16 + Capability StorageUniformBufferBlock16 + Capability StorageBuffer8BitAccess + Capability LongVectorEXT + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_nonuniform_qualifier" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 11 "foo(f161<1>;" + Name 10 "x" + Name 17 "foo(f161<2>;" + Name 16 "x" + Name 24 "funcvec4(vf4;" + Name 23 "a" + Name 27 "funcvector4(f1<4>;" + Name 26 "a" + Name 29 "testfuncs(" + Name 33 "v" + Name 38 "x" + Name 41 "y" + Name 44 "v2" + Name 53 "v3" + Name 55 "x3" + Name 60 "y3" + Name 65 "v4" + Name 78 "v5" + Name 81 "v6" + Name 107 "f" + Name 117 "len" + Name 132 "f162" + Name 138 "f161" + Name 140 "f16" + Name 145 "v11" + Name 147 "v12" + Name 158 "v13" + Name 183 "vecA" + Name 201 "a" + Name 202 "b" + Name 205 "param" + Name 208 "param" + Name 211 "x" + Name 212 "param" + Name 221 "MatrixBuf" + MemberName 221(MatrixBuf) 0 "matrixData" + Name 223 "matrixBuf" + Name 226 "MatrixBuf2" + MemberName 226(MatrixBuf2) 0 "matrixData" + Name 228 "matrixBuf2" + Name 229 "matrixLayout" + Decorate 219 BuiltIn WorkgroupSize + Decorate 220 ArrayStride 2 + Decorate 221(MatrixBuf) Block + MemberDecorate 221(MatrixBuf) 0 Offset 0 + Decorate 223(matrixBuf) Binding 0 + Decorate 223(matrixBuf) DescriptorSet 0 + Decorate 225 ArrayStride 1 + Decorate 226(MatrixBuf2) Block + MemberDecorate 226(MatrixBuf2) 0 Offset 0 + Decorate 228(matrixBuf2) Binding 0 + Decorate 228(matrixBuf2) DescriptorSet 0 + Decorate 229(matrixLayout) SpecId 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 16 + 7: TypeVector 6(float16_t) 1 + 8: TypePointer Function 7(f16vec) + 9: TypeFunction 7(f16vec) 8(ptr) + 13: TypeVector 6(float16_t) 2 + 14: TypePointer Function 13(f16vec2) + 15: TypeFunction 13(f16vec2) 14(ptr) + 19: TypeFloat 32 + 20: TypeVector 19(float) 4 + 21: TypePointer Function 20(fvec4) + 22: TypeFunction 20(fvec4) 21(ptr) + 31: TypeVector 19(float) 5 + 32: TypePointer Function 31(fvec) + 34: 19(float) Constant 0 + 35: 31(fvec) ConstantComposite 34 34 34 34 34 + 36: TypeVector 19(float) 3 + 37: TypePointer Function 36(fvec3) + 39: 19(float) Constant 1065353216 + 40: 36(fvec3) ConstantComposite 39 39 39 + 42: 19(float) Constant 1073741824 + 43: 36(fvec3) ConstantComposite 42 42 42 + 54: 31(fvec) ConstantComposite 39 39 39 42 42 + 56: 19(float) Constant 1082130432 + 57: 19(float) Constant 1084227584 + 58: 19(float) Constant 1086324736 + 59: 36(fvec3) ConstantComposite 56 57 58 + 61: 19(float) Constant 1088421888 + 62: 19(float) Constant 1090519040 + 63: 19(float) Constant 1091567616 + 64: 36(fvec3) ConstantComposite 61 62 63 + 76: TypeVector 6(float16_t) 5 + 77: TypePointer Function 76(f16vec) + 106: TypePointer Function 19(float) + 115: TypeInt 32 1 + 116: TypePointer Function 115(int) + 118: 115(int) Constant 5 + 120: 115(int) Constant 0 + 123: 115(int) Constant 4 + 133: TypeVector 19(float) 20 + 134: 115(int) Constant 20 + 139: TypePointer Function 6(float16_t) + 143: TypeVector 6(float16_t) 7 + 144: TypePointer Function 143(f16vec) + 185:6(float16_t) Constant 11264 + 186: 13(f16vec2) ConstantComposite 185 185 + 215: TypeInt 32 0 + 216: TypeVector 215(int) 3 + 217: 215(int) Constant 64 + 218: 215(int) Constant 1 + 219: 216(ivec3) ConstantComposite 217 218 218 + 220: TypeRuntimeArray 6(float16_t) + 221(MatrixBuf): TypeStruct 220 + 222: TypePointer StorageBuffer 221(MatrixBuf) + 223(matrixBuf): 222(ptr) Variable StorageBuffer + 224: TypeInt 8 1 + 225: TypeRuntimeArray 224(int8_t) + 226(MatrixBuf2): TypeStruct 225 + 227: TypePointer StorageBuffer 226(MatrixBuf2) + 228(matrixBuf2): 227(ptr) Variable StorageBuffer +229(matrixLayout): 115(int) SpecConstant 1 + 4(main): 2 Function None 3 + 5: Label + 33(v): 32(ptr) Variable Function + 38(x): 37(ptr) Variable Function + 41(y): 37(ptr) Variable Function + 44(v2): 32(ptr) Variable Function + 53(v3): 32(ptr) Variable Function + 55(x3): 37(ptr) Variable Function + 60(y3): 37(ptr) Variable Function + 65(v4): 32(ptr) Variable Function + 78(v5): 77(ptr) Variable Function + 81(v6): 32(ptr) Variable Function + 107(f): 106(ptr) Variable Function + 117(len): 116(ptr) Variable Function + 132(f162): 14(ptr) Variable Function + 138(f161): 8(ptr) Variable Function + 140(f16): 139(ptr) Variable Function + 145(v11): 144(ptr) Variable Function + 147(v12): 144(ptr) Variable Function + 158(v13): 144(ptr) Variable Function + 183(vecA): 14(ptr) Variable Function + Store 33(v) 35 + Store 38(x) 40 + Store 41(y) 43 + 45: 36(fvec3) Load 38(x) + 46: 36(fvec3) Load 41(y) + 47: 19(float) CompositeExtract 45 0 + 48: 19(float) CompositeExtract 45 1 + 49: 19(float) CompositeExtract 45 2 + 50: 19(float) CompositeExtract 46 0 + 51: 19(float) CompositeExtract 46 1 + 52: 31(fvec) CompositeConstruct 47 48 49 50 51 + Store 44(v2) 52 + Store 53(v3) 54 + Store 55(x3) 59 + Store 60(y3) 64 + 66: 36(fvec3) Load 55(x3) + 67: 36(fvec3) VectorShuffle 66 66 2 1 0 + 68: 36(fvec3) Load 60(y3) + 69: 36(fvec3) VectorShuffle 68 68 2 2 1 + 70: 19(float) CompositeExtract 67 0 + 71: 19(float) CompositeExtract 67 1 + 72: 19(float) CompositeExtract 67 2 + 73: 19(float) CompositeExtract 69 0 + 74: 19(float) CompositeExtract 69 1 + 75: 31(fvec) CompositeConstruct 70 71 72 73 74 + Store 65(v4) 75 + 79: 31(fvec) Load 65(v4) + 80: 76(f16vec) FConvert 79 + Store 78(v5) 80 + 82: 31(fvec) Load 33(v) + 83: 31(fvec) Load 44(v2) + 84: 31(fvec) FAdd 82 83 + Store 81(v6) 84 + 85: 31(fvec) Load 33(v) + 86: 31(fvec) Load 44(v2) + 87: 31(fvec) FSub 85 86 + Store 81(v6) 87 + 88: 31(fvec) Load 33(v) + 89: 31(fvec) Load 44(v2) + 90: 31(fvec) FMul 88 89 + Store 81(v6) 90 + 91: 31(fvec) Load 33(v) + 92: 31(fvec) Load 44(v2) + 93: 31(fvec) FDiv 91 92 + Store 81(v6) 93 + 94: 31(fvec) Load 33(v) + 95: 31(fvec) Load 81(v6) + 96: 31(fvec) FAdd 95 94 + Store 81(v6) 96 + 97: 31(fvec) Load 33(v) + 98: 31(fvec) Load 81(v6) + 99: 31(fvec) FSub 98 97 + Store 81(v6) 99 + 100: 31(fvec) Load 33(v) + 101: 31(fvec) Load 81(v6) + 102: 31(fvec) FMul 101 100 + Store 81(v6) 102 + 103: 31(fvec) Load 33(v) + 104: 31(fvec) Load 81(v6) + 105: 31(fvec) FDiv 104 103 + Store 81(v6) 105 + 108: 19(float) Load 107(f) + 109: 31(fvec) Load 81(v6) + 110: 31(fvec) CompositeConstruct 108 108 108 108 108 + 111: 31(fvec) FMul 109 110 + Store 81(v6) 111 + 112: 31(fvec) Load 81(v6) + 113: 31(fvec) CompositeConstruct 57 57 57 57 57 + 114: 31(fvec) FMul 112 113 + Store 81(v6) 114 + 119: 115(int) Bitcast 118 + Store 117(len) 119 + 121: 19(float) Load 107(f) + 122: 106(ptr) AccessChain 81(v6) 120 + Store 122 121 + 124: 106(ptr) AccessChain 81(v6) 123 + Store 124 57 + 125: 31(fvec) Load 33(v) + 126: 31(fvec) Load 33(v) + 127: 31(fvec) FAdd 126 125 + Store 33(v) 127 + 128: 19(float) CompositeExtract 127 4 + 129: 19(float) Load 107(f) + 130: 19(float) FAdd 129 128 + Store 107(f) 130 + 131: 31(fvec) Load 33(v) + Store 81(v6) 131 + 135: 115(int) Bitcast 134 + 136:6(float16_t) ConvertSToF 135 + 137: 13(f16vec2) CompositeConstruct 136 136 + Store 132(f162) 137 + 141:6(float16_t) Load 140(f16) + 142: 7(f16vec) CompositeConstruct 141 + Store 138(f161) 142 + 146: 143(f16vec) Load 145(v11) + 148: 143(f16vec) Load 147(v12) + 149: 143(f16vec) ExtInst 1(GLSL.std.450) 40(FMax) 146 148 + Store 145(v11) 149 + 150: 143(f16vec) Load 145(v11) + 151: 143(f16vec) Load 147(v12) + 152: 143(f16vec) ExtInst 1(GLSL.std.450) 37(FMin) 150 151 + Store 145(v11) 152 + 153: 143(f16vec) Load 145(v11) + 154: 143(f16vec) Load 147(v12) + 155: 143(f16vec) ExtInst 1(GLSL.std.450) 48(Step) 153 154 + Store 145(v11) 155 + 156: 143(f16vec) Load 145(v11) + 157: 143(f16vec) Load 147(v12) + 159: 143(f16vec) Load 158(v13) + 160: 143(f16vec) ExtInst 1(GLSL.std.450) 43(FClamp) 156 157 159 + Store 145(v11) 160 + 161: 143(f16vec) Load 145(v11) + 162: 143(f16vec) ExtInst 1(GLSL.std.450) 27(Exp) 161 + Store 145(v11) 162 + 163: 143(f16vec) Load 145(v11) + 164: 143(f16vec) ExtInst 1(GLSL.std.450) 28(Log) 163 + Store 145(v11) 164 + 165: 143(f16vec) Load 145(v11) + 166: 143(f16vec) ExtInst 1(GLSL.std.450) 21(Tanh) 165 + Store 145(v11) 166 + 167: 143(f16vec) Load 145(v11) + 168: 143(f16vec) ExtInst 1(GLSL.std.450) 18(Atan) 167 + Store 145(v11) 168 + 169: 143(f16vec) Load 145(v11) + 170: 143(f16vec) Load 147(v12) + 171: 143(f16vec) Load 158(v13) + 172: 143(f16vec) ExtInst 1(GLSL.std.450) 50(Fma) 169 170 171 + Store 145(v11) 172 + 173: 31(fvec) Load 33(v) + 174: 31(fvec) Load 33(v) + 175: 31(fvec) FAdd 174 173 + Store 33(v) 175 + 176: 115(int) Load 117(len) + 177: 19(float) VectorExtractDynamic 175 176 + 178: 19(float) Load 107(f) + 179: 19(float) FAdd 178 177 + Store 107(f) 179 + 180: 143(f16vec) Load 158(v13) + Store 158(v13) 180 + 181: 143(f16vec) Load 158(v13) + 182:6(float16_t) CompositeExtract 181 0 + Store 140(f16) 182 + 184: 13(f16vec2) Load 183(vecA) + 187: 13(f16vec2) FMul 184 186 + 188: 13(f16vec2) ExtInst 1(GLSL.std.450) 27(Exp) 187 + Store 183(vecA) 188 + Return + FunctionEnd +11(foo(f161<1>;): 7(f16vec) Function None 9 + 10(x): 8(ptr) FunctionParameter + 12: Label + 189: 7(f16vec) Load 10(x) + ReturnValue 189 + FunctionEnd +17(foo(f161<2>;): 13(f16vec2) Function None 15 + 16(x): 14(ptr) FunctionParameter + 18: Label + 192: 13(f16vec2) Load 16(x) + ReturnValue 192 + FunctionEnd +24(funcvec4(vf4;): 20(fvec4) Function None 22 + 23(a): 21(ptr) FunctionParameter + 25: Label + 195: 20(fvec4) Load 23(a) + ReturnValue 195 + FunctionEnd +27(funcvector4(f1<4>;): 20(fvec4) Function None 22 + 26(a): 21(ptr) FunctionParameter + 28: Label + 198: 20(fvec4) Load 26(a) + ReturnValue 198 + FunctionEnd + 29(testfuncs(): 2 Function None 3 + 30: Label + 201(a): 21(ptr) Variable Function + 202(b): 21(ptr) Variable Function + 205(param): 21(ptr) Variable Function + 208(param): 21(ptr) Variable Function + 211(x): 8(ptr) Variable Function + 212(param): 8(ptr) Variable Function + 203: 20(fvec4) Load 202(b) + Store 201(a) 203 + 204: 20(fvec4) Load 201(a) + Store 202(b) 204 + 206: 20(fvec4) Load 202(b) + Store 205(param) 206 + 207: 20(fvec4) FunctionCall 24(funcvec4(vf4;) 205(param) + 209: 20(fvec4) Load 201(a) + Store 208(param) 209 + 210: 20(fvec4) FunctionCall 27(funcvector4(f1<4>;) 208(param) + 213: 7(f16vec) Load 211(x) + Store 212(param) 213 + 214: 7(f16vec) FunctionCall 11(foo(f161<1>;) 212(param) + Store 211(x) 214 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltins.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltins.comp.out new file mode 100644 index 0000000000..089ef16864 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltins.comp.out @@ -0,0 +1,469 @@ +spv.longVectorBuiltins.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 320 + + Capability Shader + Capability Float16 + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vf" + Name 14 "f" + Name 28 "vf16" + Name 102 "tempReturn" + Name 104 "tempArg" + Name 105 "ResType" + Name 149 "vb" + Name 176 "vi" + Name 182 "vu" + Name 194 "ResType" + Name 241 "b" + Name 248 "tempReturn" + Name 251 "tempArg" + Name 252 "ResType" + Name 258 "tempReturn" + Name 261 "tempArg" + Name 269 "tempArg" + Name 270 "tempArg" + Name 278 "tempArg" + Name 279 "tempArg" + Name 280 "ResType" + Name 288 "i" + Decorate 319 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 5 + 8: TypePointer Function 7(fvec) + 13: TypePointer Function 6(float) + 25: TypeFloat 16 + 26: TypeVector 25(float16_t) 5 + 27: TypePointer Function 26(f16vec) + 105(ResType): TypeStruct 7(fvec) 7(fvec) + 146: TypeBool + 147: TypeVector 146(bool) 5 + 148: TypePointer Function 147(bvec) + 173: TypeInt 32 1 + 174: TypeVector 173(int) 5 + 175: TypePointer Function 174(ivec) + 179: TypeInt 32 0 + 180: TypeVector 179(int) 5 + 181: TypePointer Function 180(ivec) + 194(ResType): TypeStruct 7(fvec) 174(ivec) + 240: TypePointer Function 146(bool) + 252(ResType): TypeStruct 180(ivec) 180(ivec) + 280(ResType): TypeStruct 174(ivec) 174(ivec) + 287: TypePointer Function 173(int) + 316: TypeVector 179(int) 3 + 317: 179(int) Constant 64 + 318: 179(int) Constant 1 + 319: 316(ivec3) ConstantComposite 317 318 318 + 4(main): 2 Function None 3 + 5: Label + 9(vf): 8(ptr) Variable Function + 14(f): 13(ptr) Variable Function + 28(vf16): 27(ptr) Variable Function + 102(tempReturn): 8(ptr) Variable Function + 104(tempArg): 8(ptr) Variable Function + 149(vb): 148(ptr) Variable Function + 176(vi): 175(ptr) Variable Function + 182(vu): 181(ptr) Variable Function + 241(b): 240(ptr) Variable Function + 248(tempReturn): 181(ptr) Variable Function + 251(tempArg): 181(ptr) Variable Function + 258(tempReturn): 181(ptr) Variable Function + 261(tempArg): 181(ptr) Variable Function + 269(tempArg): 181(ptr) Variable Function + 270(tempArg): 181(ptr) Variable Function + 278(tempArg): 175(ptr) Variable Function + 279(tempArg): 175(ptr) Variable Function + 288(i): 287(ptr) Variable Function + 10: 7(fvec) Load 9(vf) + 11: 7(fvec) Load 9(vf) + 12: 7(fvec) ExtInst 1(GLSL.std.450) 40(FMax) 10 11 + Store 9(vf) 12 + 15: 6(float) Load 14(f) + 16: 6(float) Load 14(f) + 17: 7(fvec) Load 9(vf) + 18: 7(fvec) CompositeConstruct 15 15 15 15 15 + 19: 7(fvec) CompositeConstruct 16 16 16 16 16 + 20: 7(fvec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 18 19 17 + Store 9(vf) 20 + 21: 7(fvec) Load 9(vf) + 22: 7(fvec) Load 9(vf) + 23: 7(fvec) Load 9(vf) + 24: 7(fvec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 21 22 23 + Store 9(vf) 24 + 29: 26(f16vec) Load 28(vf16) + 30: 26(f16vec) Load 28(vf16) + 31: 26(f16vec) Load 28(vf16) + 32: 26(f16vec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 29 30 31 + Store 28(vf16) 32 + 33: 7(fvec) Load 9(vf) + 34: 7(fvec) ExtInst 1(GLSL.std.450) 11(Radians) 33 + Store 9(vf) 34 + 35: 7(fvec) Load 9(vf) + 36: 7(fvec) ExtInst 1(GLSL.std.450) 12(Degrees) 35 + Store 9(vf) 36 + 37: 7(fvec) Load 9(vf) + 38: 7(fvec) ExtInst 1(GLSL.std.450) 13(Sin) 37 + Store 9(vf) 38 + 39: 7(fvec) Load 9(vf) + 40: 7(fvec) ExtInst 1(GLSL.std.450) 14(Cos) 39 + Store 9(vf) 40 + 41: 7(fvec) Load 9(vf) + 42: 7(fvec) ExtInst 1(GLSL.std.450) 15(Tan) 41 + Store 9(vf) 42 + 43: 7(fvec) Load 9(vf) + 44: 7(fvec) ExtInst 1(GLSL.std.450) 16(Asin) 43 + Store 9(vf) 44 + 45: 7(fvec) Load 9(vf) + 46: 7(fvec) ExtInst 1(GLSL.std.450) 17(Acos) 45 + Store 9(vf) 46 + 47: 7(fvec) Load 9(vf) + 48: 7(fvec) ExtInst 1(GLSL.std.450) 18(Atan) 47 + Store 9(vf) 48 + 49: 7(fvec) Load 9(vf) + 50: 7(fvec) Load 9(vf) + 51: 7(fvec) ExtInst 1(GLSL.std.450) 25(Atan2) 49 50 + Store 9(vf) 51 + 52: 7(fvec) Load 9(vf) + 53: 7(fvec) ExtInst 1(GLSL.std.450) 19(Sinh) 52 + Store 9(vf) 53 + 54: 7(fvec) Load 9(vf) + 55: 7(fvec) ExtInst 1(GLSL.std.450) 20(Cosh) 54 + Store 9(vf) 55 + 56: 7(fvec) Load 9(vf) + 57: 7(fvec) ExtInst 1(GLSL.std.450) 21(Tanh) 56 + Store 9(vf) 57 + 58: 7(fvec) Load 9(vf) + 59: 7(fvec) ExtInst 1(GLSL.std.450) 22(Asinh) 58 + Store 9(vf) 59 + 60: 7(fvec) Load 9(vf) + 61: 7(fvec) ExtInst 1(GLSL.std.450) 23(Acosh) 60 + Store 9(vf) 61 + 62: 7(fvec) Load 9(vf) + 63: 7(fvec) ExtInst 1(GLSL.std.450) 24(Atanh) 62 + Store 9(vf) 63 + 64: 7(fvec) Load 9(vf) + 65: 7(fvec) Load 9(vf) + 66: 7(fvec) ExtInst 1(GLSL.std.450) 26(Pow) 64 65 + Store 9(vf) 66 + 67: 7(fvec) Load 9(vf) + 68: 7(fvec) ExtInst 1(GLSL.std.450) 27(Exp) 67 + Store 9(vf) 68 + 69: 7(fvec) Load 9(vf) + 70: 7(fvec) ExtInst 1(GLSL.std.450) 28(Log) 69 + Store 9(vf) 70 + 71: 7(fvec) Load 9(vf) + 72: 7(fvec) ExtInst 1(GLSL.std.450) 29(Exp2) 71 + Store 9(vf) 72 + 73: 7(fvec) Load 9(vf) + 74: 7(fvec) ExtInst 1(GLSL.std.450) 30(Log2) 73 + Store 9(vf) 74 + 75: 7(fvec) Load 9(vf) + 76: 7(fvec) ExtInst 1(GLSL.std.450) 31(Sqrt) 75 + Store 9(vf) 76 + 77: 7(fvec) Load 9(vf) + 78: 7(fvec) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 77 + Store 9(vf) 78 + 79: 7(fvec) Load 9(vf) + 80: 7(fvec) ExtInst 1(GLSL.std.450) 4(FAbs) 79 + Store 9(vf) 80 + 81: 7(fvec) Load 9(vf) + 82: 7(fvec) ExtInst 1(GLSL.std.450) 6(FSign) 81 + Store 9(vf) 82 + 83: 7(fvec) Load 9(vf) + 84: 7(fvec) ExtInst 1(GLSL.std.450) 8(Floor) 83 + Store 9(vf) 84 + 85: 7(fvec) Load 9(vf) + 86: 7(fvec) ExtInst 1(GLSL.std.450) 3(Trunc) 85 + Store 9(vf) 86 + 87: 7(fvec) Load 9(vf) + 88: 7(fvec) ExtInst 1(GLSL.std.450) 1(Round) 87 + Store 9(vf) 88 + 89: 7(fvec) Load 9(vf) + 90: 7(fvec) ExtInst 1(GLSL.std.450) 2(RoundEven) 89 + Store 9(vf) 90 + 91: 7(fvec) Load 9(vf) + 92: 7(fvec) ExtInst 1(GLSL.std.450) 9(Ceil) 91 + Store 9(vf) 92 + 93: 7(fvec) Load 9(vf) + 94: 7(fvec) ExtInst 1(GLSL.std.450) 10(Fract) 93 + Store 9(vf) 94 + 95: 7(fvec) Load 9(vf) + 96: 6(float) Load 14(f) + 97: 7(fvec) CompositeConstruct 96 96 96 96 96 + 98: 7(fvec) FMod 95 97 + Store 9(vf) 98 + 99: 7(fvec) Load 9(vf) + 100: 7(fvec) Load 9(vf) + 101: 7(fvec) FMod 99 100 + Store 9(vf) 101 + 103: 7(fvec) Load 9(vf) + 106:105(ResType) ExtInst 1(GLSL.std.450) 36(ModfStruct) 103 + 107: 7(fvec) CompositeExtract 106 1 + Store 104(tempArg) 107 + 108: 7(fvec) CompositeExtract 106 0 + Store 102(tempReturn) 108 + 109: 7(fvec) Load 104(tempArg) + Store 9(vf) 109 + 110: 7(fvec) Load 102(tempReturn) + Store 9(vf) 110 + 111: 7(fvec) Load 9(vf) + 112: 6(float) Load 14(f) + 113: 7(fvec) CompositeConstruct 112 112 112 112 112 + 114: 7(fvec) ExtInst 1(GLSL.std.450) 37(FMin) 111 113 + Store 9(vf) 114 + 115: 7(fvec) Load 9(vf) + 116: 7(fvec) Load 9(vf) + 117: 7(fvec) ExtInst 1(GLSL.std.450) 37(FMin) 115 116 + Store 9(vf) 117 + 118: 7(fvec) Load 9(vf) + 119: 6(float) Load 14(f) + 120: 7(fvec) CompositeConstruct 119 119 119 119 119 + 121: 7(fvec) ExtInst 1(GLSL.std.450) 40(FMax) 118 120 + Store 9(vf) 121 + 122: 7(fvec) Load 9(vf) + 123: 7(fvec) Load 9(vf) + 124: 7(fvec) ExtInst 1(GLSL.std.450) 40(FMax) 122 123 + Store 9(vf) 124 + 125: 7(fvec) Load 9(vf) + 126: 6(float) Load 14(f) + 127: 6(float) Load 14(f) + 128: 7(fvec) CompositeConstruct 126 126 126 126 126 + 129: 7(fvec) CompositeConstruct 127 127 127 127 127 + 130: 7(fvec) ExtInst 1(GLSL.std.450) 43(FClamp) 125 128 129 + Store 9(vf) 130 + 131: 7(fvec) Load 9(vf) + 132: 7(fvec) Load 9(vf) + 133: 7(fvec) Load 9(vf) + 134: 7(fvec) ExtInst 1(GLSL.std.450) 43(FClamp) 131 132 133 + Store 9(vf) 134 + 135: 7(fvec) Load 9(vf) + 136: 7(fvec) Load 9(vf) + 137: 6(float) Load 14(f) + 138: 7(fvec) CompositeConstruct 137 137 137 137 137 + 139: 7(fvec) ExtInst 1(GLSL.std.450) 46(FMix) 135 136 138 + Store 9(vf) 139 + 140: 7(fvec) Load 9(vf) + 141: 7(fvec) Load 9(vf) + 142: 7(fvec) Load 9(vf) + 143: 7(fvec) ExtInst 1(GLSL.std.450) 46(FMix) 140 141 142 + Store 9(vf) 143 + 144: 7(fvec) Load 9(vf) + 145: 7(fvec) Load 9(vf) + 150: 147(bvec) Load 149(vb) + 151: 7(fvec) Select 150 145 144 + Store 9(vf) 151 + 152: 7(fvec) Load 9(vf) + 153: 7(fvec) Load 9(vf) + 154: 7(fvec) ExtInst 1(GLSL.std.450) 48(Step) 152 153 + Store 9(vf) 154 + 155: 6(float) Load 14(f) + 156: 7(fvec) Load 9(vf) + 157: 7(fvec) CompositeConstruct 155 155 155 155 155 + 158: 7(fvec) ExtInst 1(GLSL.std.450) 48(Step) 157 156 + Store 9(vf) 158 + 159: 7(fvec) Load 9(vf) + 160: 7(fvec) Load 9(vf) + 161: 7(fvec) Load 9(vf) + 162: 7(fvec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 159 160 161 + Store 9(vf) 162 + 163: 6(float) Load 14(f) + 164: 6(float) Load 14(f) + 165: 7(fvec) Load 9(vf) + 166: 7(fvec) CompositeConstruct 163 163 163 163 163 + 167: 7(fvec) CompositeConstruct 164 164 164 164 164 + 168: 7(fvec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 166 167 165 + Store 9(vf) 168 + 169: 7(fvec) Load 9(vf) + 170: 147(bvec) IsNan 169 + Store 149(vb) 170 + 171: 7(fvec) Load 9(vf) + 172: 147(bvec) IsInf 171 + Store 149(vb) 172 + 177: 7(fvec) Load 9(vf) + 178: 174(ivec) Bitcast 177 + Store 176(vi) 178 + 183: 7(fvec) Load 9(vf) + 184: 180(ivec) Bitcast 183 + Store 182(vu) 184 + 185: 174(ivec) Load 176(vi) + 186: 7(fvec) Bitcast 185 + Store 9(vf) 186 + 187: 180(ivec) Load 182(vu) + 188: 7(fvec) Bitcast 187 + Store 9(vf) 188 + 189: 7(fvec) Load 9(vf) + 190: 7(fvec) Load 9(vf) + 191: 7(fvec) Load 9(vf) + 192: 7(fvec) ExtInst 1(GLSL.std.450) 50(Fma) 189 190 191 + Store 9(vf) 192 + 193: 7(fvec) Load 9(vf) + 195:194(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 193 + 196: 174(ivec) CompositeExtract 195 1 + Store 176(vi) 196 + 197: 7(fvec) CompositeExtract 195 0 + Store 9(vf) 197 + 198: 7(fvec) Load 9(vf) + 199: 174(ivec) Load 176(vi) + 200: 7(fvec) ExtInst 1(GLSL.std.450) 53(Ldexp) 198 199 + Store 9(vf) 200 + 201: 7(fvec) Load 9(vf) + 202: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 201 + Store 14(f) 202 + 203: 7(fvec) Load 9(vf) + 204: 7(fvec) Load 9(vf) + 205: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 203 204 + Store 14(f) 205 + 206: 7(fvec) Load 9(vf) + 207: 7(fvec) Load 9(vf) + 208: 6(float) Dot 206 207 + Store 14(f) 208 + 209: 7(fvec) Load 9(vf) + 210: 7(fvec) ExtInst 1(GLSL.std.450) 69(Normalize) 209 + Store 9(vf) 210 + 211: 7(fvec) Load 9(vf) + 212: 7(fvec) Load 9(vf) + 213: 7(fvec) Load 9(vf) + 214: 7(fvec) ExtInst 1(GLSL.std.450) 70(FaceForward) 211 212 213 + Store 9(vf) 214 + 215: 7(fvec) Load 9(vf) + 216: 7(fvec) Load 9(vf) + 217: 7(fvec) ExtInst 1(GLSL.std.450) 71(Reflect) 215 216 + Store 9(vf) 217 + 218: 7(fvec) Load 9(vf) + 219: 7(fvec) Load 9(vf) + 220: 6(float) Load 14(f) + 221: 7(fvec) ExtInst 1(GLSL.std.450) 72(Refract) 218 219 220 + Store 9(vf) 221 + 222: 7(fvec) Load 9(vf) + 223: 7(fvec) Load 9(vf) + 224: 147(bvec) FOrdLessThan 222 223 + Store 149(vb) 224 + 225: 7(fvec) Load 9(vf) + 226: 7(fvec) Load 9(vf) + 227: 147(bvec) FOrdLessThanEqual 225 226 + Store 149(vb) 227 + 228: 7(fvec) Load 9(vf) + 229: 7(fvec) Load 9(vf) + 230: 147(bvec) FOrdGreaterThan 228 229 + Store 149(vb) 230 + 231: 7(fvec) Load 9(vf) + 232: 7(fvec) Load 9(vf) + 233: 147(bvec) FOrdGreaterThanEqual 231 232 + Store 149(vb) 233 + 234: 7(fvec) Load 9(vf) + 235: 7(fvec) Load 9(vf) + 236: 147(bvec) FOrdEqual 234 235 + Store 149(vb) 236 + 237: 7(fvec) Load 9(vf) + 238: 7(fvec) Load 9(vf) + 239: 147(bvec) FUnordNotEqual 237 238 + Store 149(vb) 239 + 242: 147(bvec) Load 149(vb) + 243: 146(bool) Any 242 + Store 241(b) 243 + 244: 147(bvec) Load 149(vb) + 245: 146(bool) All 244 + Store 241(b) 245 + 246: 147(bvec) Load 149(vb) + 247: 147(bvec) LogicalNot 246 + Store 149(vb) 247 + 249: 180(ivec) Load 182(vu) + 250: 180(ivec) Load 182(vu) + 253:252(ResType) IAddCarry 249 250 + 254: 180(ivec) CompositeExtract 253 1 + Store 251(tempArg) 254 + 255: 180(ivec) CompositeExtract 253 0 + Store 248(tempReturn) 255 + 256: 180(ivec) Load 251(tempArg) + Store 182(vu) 256 + 257: 180(ivec) Load 248(tempReturn) + Store 182(vu) 257 + 259: 180(ivec) Load 182(vu) + 260: 180(ivec) Load 182(vu) + 262:252(ResType) ISubBorrow 259 260 + 263: 180(ivec) CompositeExtract 262 1 + Store 261(tempArg) 263 + 264: 180(ivec) CompositeExtract 262 0 + Store 258(tempReturn) 264 + 265: 180(ivec) Load 261(tempArg) + Store 182(vu) 265 + 266: 180(ivec) Load 258(tempReturn) + Store 182(vu) 266 + 267: 180(ivec) Load 182(vu) + 268: 180(ivec) Load 182(vu) + 271:252(ResType) UMulExtended 267 268 + 272: 180(ivec) CompositeExtract 271 0 + Store 270(tempArg) 272 + 273: 180(ivec) CompositeExtract 271 1 + Store 269(tempArg) 273 + 274: 180(ivec) Load 269(tempArg) + Store 182(vu) 274 + 275: 180(ivec) Load 270(tempArg) + Store 182(vu) 275 + 276: 174(ivec) Load 176(vi) + 277: 174(ivec) Load 176(vi) + 281:280(ResType) SMulExtended 276 277 + 282: 174(ivec) CompositeExtract 281 0 + Store 279(tempArg) 282 + 283: 174(ivec) CompositeExtract 281 1 + Store 278(tempArg) 283 + 284: 174(ivec) Load 278(tempArg) + Store 176(vi) 284 + 285: 174(ivec) Load 279(tempArg) + Store 176(vi) 285 + 286: 180(ivec) Load 182(vu) + 289: 173(int) Load 288(i) + 290: 173(int) Load 288(i) + 291: 180(ivec) BitFieldUExtract 286 289 290 + Store 182(vu) 291 + 292: 180(ivec) Load 182(vu) + 293: 180(ivec) Load 182(vu) + 294: 173(int) Load 288(i) + 295: 173(int) Load 288(i) + 296: 180(ivec) BitFieldInsert 292 293 294 295 + Store 182(vu) 296 + 297: 180(ivec) Load 182(vu) + 298: 180(ivec) BitReverse 297 + Store 182(vu) 298 + 299: 180(ivec) Load 182(vu) + 300: 174(ivec) BitCount 299 + Store 176(vi) 300 + 301: 180(ivec) Load 182(vu) + 302: 174(ivec) ExtInst 1(GLSL.std.450) 73(FindILsb) 301 + Store 176(vi) 302 + 303: 180(ivec) Load 182(vu) + 304: 174(ivec) ExtInst 1(GLSL.std.450) 75(FindUMsb) 303 + Store 176(vi) 304 + 305: 180(ivec) Load 182(vu) + 306: 180(ivec) Load 182(vu) + 307: 147(bvec) Load 149(vb) + 308: 180(ivec) Select 307 306 305 + Store 182(vu) 308 + 309: 147(bvec) Load 149(vb) + 310: 147(bvec) Load 149(vb) + 311: 147(bvec) Load 149(vb) + 312: 147(bvec) Select 311 310 309 + Store 149(vb) 312 + 313: 180(ivec) Load 182(vu) + 314: 180(ivec) Load 182(vu) + 315: 180(ivec) ExpectKHR 313 314 + Store 182(vu) 315 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltins.frag.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltins.frag.out new file mode 100644 index 0000000000..ee0da47e38 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltins.frag.out @@ -0,0 +1,57 @@ +spv.longVectorBuiltins.frag +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 28 + + Capability Shader + Capability DerivativeControl + Capability LongVectorEXT + Extension "SPV_EXT_long_vector" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vf" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 5 + 8: TypePointer Function 7(fvec) + 4(main): 2 Function None 3 + 5: Label + 9(vf): 8(ptr) Variable Function + 10: 7(fvec) Load 9(vf) + 11: 7(fvec) DPdx 10 + Store 9(vf) 11 + 12: 7(fvec) Load 9(vf) + 13: 7(fvec) DPdy 12 + Store 9(vf) 13 + 14: 7(fvec) Load 9(vf) + 15: 7(fvec) Fwidth 14 + Store 9(vf) 15 + 16: 7(fvec) Load 9(vf) + 17: 7(fvec) DPdxFine 16 + Store 9(vf) 17 + 18: 7(fvec) Load 9(vf) + 19: 7(fvec) DPdyFine 18 + Store 9(vf) 19 + 20: 7(fvec) Load 9(vf) + 21: 7(fvec) FwidthFine 20 + Store 9(vf) 21 + 22: 7(fvec) Load 9(vf) + 23: 7(fvec) DPdxCoarse 22 + Store 9(vf) 23 + 24: 7(fvec) Load 9(vf) + 25: 7(fvec) DPdyCoarse 24 + Store 9(vf) 25 + 26: 7(fvec) Load 9(vf) + 27: 7(fvec) FwidthCoarse 26 + Store 9(vf) 27 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsBitcast.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsBitcast.comp.out new file mode 100644 index 0000000000..3d51bd5876 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsBitcast.comp.out @@ -0,0 +1,204 @@ +spv.longVectorBuiltinsBitcast.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 126 + + Capability Shader + Capability Float16 + Capability Float64 + Capability Int64 + Capability Int16 + Capability Int8 + Capability Float8EXT + Capability BFloat16TypeKHR + Capability LongVectorEXT + Extension "SPV_EXT_float8" + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_bfloat16" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_bfloat16" + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_float_e4m3" + SourceExtension "GL_EXT_float_e5m2" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vi16" + Name 13 "vf16" + Name 19 "vu16" + Name 37 "vbf16" + Name 49 "vi32" + Name 53 "vf32" + Name 59 "vu32" + Name 69 "vi64" + Name 73 "vf64" + Name 79 "vu64" + Name 89 "vi8" + Name 93 "vfe5m2" + Name 99 "vu8" + Name 109 "vfe4m3" + Decorate 119 DecorationSaturatedToLargestFloat8NormalConversionEXT + Decorate 121 DecorationSaturatedToLargestFloat8NormalConversionEXT + Decorate 125 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 16 1 + 7: TypeVector 6(int16_t) 5 + 8: TypePointer Function 7(i16vec) + 10: TypeFloat 16 + 11: TypeVector 10(float16_t) 5 + 12: TypePointer Function 11(f16vec) + 16: TypeInt 16 0 + 17: TypeVector 16(int16_t) 5 + 18: TypePointer Function 17(i16vec) + 34: TypeFloat 16 0 + 35: TypeVector 34(bfloat16_t) 5 + 36: TypePointer Function 35(bf16vec) + 46: TypeInt 32 1 + 47: TypeVector 46(int) 5 + 48: TypePointer Function 47(ivec) + 50: TypeFloat 32 + 51: TypeVector 50(float) 5 + 52: TypePointer Function 51(fvec) + 56: TypeInt 32 0 + 57: TypeVector 56(int) 5 + 58: TypePointer Function 57(ivec) + 66: TypeInt 64 1 + 67: TypeVector 66(int64_t) 5 + 68: TypePointer Function 67(i64vec) + 70: TypeFloat 64 + 71: TypeVector 70(float64_t) 5 + 72: TypePointer Function 71(f64vec) + 76: TypeInt 64 0 + 77: TypeVector 76(int64_t) 5 + 78: TypePointer Function 77(i64vec) + 86: TypeInt 8 1 + 87: TypeVector 86(int8_t) 5 + 88: TypePointer Function 87(i8vec) + 90: TypeFloat 8 4215 + 91: TypeVector 90(floate5m2_t) 5 + 92: TypePointer Function 91(fvec) + 96: TypeInt 8 0 + 97: TypeVector 96(int8_t) 5 + 98: TypePointer Function 97(i8vec) + 106: TypeFloat 8 4214 + 107: TypeVector 106(floate4m3_t) 5 + 108: TypePointer Function 107(fvec) + 122: TypeVector 56(int) 3 + 123: 56(int) Constant 64 + 124: 56(int) Constant 1 + 125: 122(ivec3) ConstantComposite 123 124 124 + 4(main): 2 Function None 3 + 5: Label + 9(vi16): 8(ptr) Variable Function + 13(vf16): 12(ptr) Variable Function + 19(vu16): 18(ptr) Variable Function + 37(vbf16): 36(ptr) Variable Function + 49(vi32): 48(ptr) Variable Function + 53(vf32): 52(ptr) Variable Function + 59(vu32): 58(ptr) Variable Function + 69(vi64): 68(ptr) Variable Function + 73(vf64): 72(ptr) Variable Function + 79(vu64): 78(ptr) Variable Function + 89(vi8): 88(ptr) Variable Function + 93(vfe5m2): 92(ptr) Variable Function + 99(vu8): 98(ptr) Variable Function + 109(vfe4m3): 108(ptr) Variable Function + 14: 11(f16vec) Load 13(vf16) + 15: 7(i16vec) Bitcast 14 + Store 9(vi16) 15 + 20: 11(f16vec) Load 13(vf16) + 21: 17(i16vec) Bitcast 20 + Store 19(vu16) 21 + 22: 7(i16vec) Load 9(vi16) + 23: 11(f16vec) Bitcast 22 + Store 13(vf16) 23 + 24: 17(i16vec) Load 19(vu16) + 25: 11(f16vec) Bitcast 24 + Store 13(vf16) 25 + 26: 11(f16vec) Load 13(vf16) + 27: 7(i16vec) Bitcast 26 + Store 9(vi16) 27 + 28: 11(f16vec) Load 13(vf16) + 29: 17(i16vec) Bitcast 28 + Store 19(vu16) 29 + 30: 7(i16vec) Load 9(vi16) + 31: 11(f16vec) Bitcast 30 + Store 13(vf16) 31 + 32: 17(i16vec) Load 19(vu16) + 33: 11(f16vec) Bitcast 32 + Store 13(vf16) 33 + 38: 35(bf16vec) Load 37(vbf16) + 39: 7(i16vec) Bitcast 38 + Store 9(vi16) 39 + 40: 35(bf16vec) Load 37(vbf16) + 41: 17(i16vec) Bitcast 40 + Store 19(vu16) 41 + 42: 7(i16vec) Load 9(vi16) + 43: 35(bf16vec) Bitcast 42 + Store 37(vbf16) 43 + 44: 17(i16vec) Load 19(vu16) + 45: 35(bf16vec) Bitcast 44 + Store 37(vbf16) 45 + 54: 51(fvec) Load 53(vf32) + 55: 47(ivec) Bitcast 54 + Store 49(vi32) 55 + 60: 51(fvec) Load 53(vf32) + 61: 57(ivec) Bitcast 60 + Store 59(vu32) 61 + 62: 47(ivec) Load 49(vi32) + 63: 51(fvec) Bitcast 62 + Store 53(vf32) 63 + 64: 57(ivec) Load 59(vu32) + 65: 51(fvec) Bitcast 64 + Store 53(vf32) 65 + 74: 71(f64vec) Load 73(vf64) + 75: 67(i64vec) Bitcast 74 + Store 69(vi64) 75 + 80: 71(f64vec) Load 73(vf64) + 81: 77(i64vec) Bitcast 80 + Store 79(vu64) 81 + 82: 67(i64vec) Load 69(vi64) + 83: 71(f64vec) Bitcast 82 + Store 73(vf64) 83 + 84: 77(i64vec) Load 79(vu64) + 85: 71(f64vec) Bitcast 84 + Store 73(vf64) 85 + 94: 91(fvec) Load 93(vfe5m2) + 95: 87(i8vec) Bitcast 94 + Store 89(vi8) 95 + 100: 91(fvec) Load 93(vfe5m2) + 101: 97(i8vec) Bitcast 100 + Store 99(vu8) 101 + 102: 87(i8vec) Load 89(vi8) + 103: 91(fvec) Bitcast 102 + Store 93(vfe5m2) 103 + 104: 97(i8vec) Load 99(vu8) + 105: 91(fvec) Bitcast 104 + Store 93(vfe5m2) 105 + 110: 107(fvec) Load 109(vfe4m3) + 111: 87(i8vec) Bitcast 110 + Store 89(vi8) 111 + 112: 107(fvec) Load 109(vfe4m3) + 113: 97(i8vec) Bitcast 112 + Store 99(vu8) 113 + 114: 87(i8vec) Load 89(vi8) + 115: 107(fvec) Bitcast 114 + Store 109(vfe4m3) 115 + 116: 97(i8vec) Load 99(vu8) + 117: 107(fvec) Bitcast 116 + Store 109(vfe4m3) 117 + 118: 11(f16vec) Load 13(vf16) + 119: 91(fvec) FConvert 118 + Store 93(vfe5m2) 119 + 120: 51(fvec) Load 53(vf32) + 121: 107(fvec) FConvert 120 + Store 109(vfe4m3) 121 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsError.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsError.comp.out new file mode 100644 index 0000000000..ea3e136342 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsError.comp.out @@ -0,0 +1,26 @@ +spv.longVectorBuiltinsError.comp +ERROR: 0:27: 'max' : can't resolve types (ambiguous long vector overload) +ERROR: 0:27: 'assign' : cannot convert from ' temp void' to ' temp vector<5> float' +ERROR: 0:28: 'max' : can't resolve types (ambiguous long vector overload) +ERROR: 0:28: 'assign' : cannot convert from ' temp void' to ' temp vector<5> uint' +ERROR: 0:29: 'max' : can't resolve types (ambiguous long vector overload) +ERROR: 0:29: 'assign' : cannot convert from ' temp void' to ' temp vector<5> uint' +ERROR: 0:30: 'max' : can't resolve types (ambiguous long vector overload) +ERROR: 0:30: 'assign' : cannot convert from ' temp void' to ' temp vector<5> uint' +ERROR: 0:31: 'smoothstep' : ambiguous best function under implicit type conversion +ERROR: 0:32: 'radians' : can't resolve types (ambiguous long vector overload) +ERROR: 0:32: 'assign' : cannot convert from ' temp void' to ' temp vector<5> double' +ERROR: 0:33: 'sin' : can't resolve types (ambiguous long vector overload) +ERROR: 0:33: 'assign' : cannot convert from ' temp void' to ' temp vector<5> double' +ERROR: 0:34: 'atanh' : can't resolve types (ambiguous long vector overload) +ERROR: 0:34: 'assign' : cannot convert from ' temp void' to ' temp vector<5> double' +ERROR: 0:35: 'abs' : can't resolve types (ambiguous long vector overload) +ERROR: 0:35: 'assign' : cannot convert from ' temp void' to ' temp vector<5> uint' +ERROR: 0:36: 'max' : can't resolve types (ambiguous long vector overload) +ERROR: 0:36: 'assign' : cannot convert from ' temp void' to ' temp vector<5> uint' +ERROR: 0:37: 'max' : can't resolve types (ambiguous long vector overload) +ERROR: 0:37: 'assign' : cannot convert from ' temp void' to ' temp vector<5> uint' +ERROR: 21 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSpecConst.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSpecConst.comp.out new file mode 100644 index 0000000000..ec6671c685 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSpecConst.comp.out @@ -0,0 +1,472 @@ +spv.longVectorBuiltinsSpecConst.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 321 + + Capability Shader + Capability Float16 + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 8 "c0" + Name 11 "vf" + Name 16 "f" + Name 30 "vf16" + Name 104 "tempReturn" + Name 106 "tempArg" + Name 107 "ResType" + Name 151 "vb" + Name 178 "vi" + Name 183 "vu" + Name 195 "ResType" + Name 242 "b" + Name 249 "tempReturn" + Name 252 "tempArg" + Name 253 "ResType" + Name 259 "tempReturn" + Name 262 "tempArg" + Name 270 "tempArg" + Name 271 "tempArg" + Name 279 "tempArg" + Name 280 "tempArg" + Name 281 "ResType" + Name 289 "i" + Decorate 8(c0) SpecId 0 + Decorate 320 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeInt 32 0 + 8(c0): 7(int) SpecConstant 0 + 9: TypeCooperativeVectorNV 6(float) 8(c0) + 10: TypePointer Function 9 + 15: TypePointer Function 6(float) + 27: TypeFloat 16 + 28: TypeCooperativeVectorNV 27(float16_t) 8(c0) + 29: TypePointer Function 28 + 107(ResType): TypeStruct 9 9 + 148: TypeBool + 149: TypeCooperativeVectorNV 148(bool) 8(c0) + 150: TypePointer Function 149 + 175: TypeInt 32 1 + 176: TypeCooperativeVectorNV 175(int) 8(c0) + 177: TypePointer Function 176 + 181: TypeCooperativeVectorNV 7(int) 8(c0) + 182: TypePointer Function 181 + 195(ResType): TypeStruct 9 176 + 241: TypePointer Function 148(bool) + 253(ResType): TypeStruct 181 181 + 281(ResType): TypeStruct 176 176 + 288: TypePointer Function 175(int) + 317: TypeVector 7(int) 3 + 318: 7(int) Constant 64 + 319: 7(int) Constant 1 + 320: 317(ivec3) ConstantComposite 318 319 319 + 4(main): 2 Function None 3 + 5: Label + 11(vf): 10(ptr) Variable Function + 16(f): 15(ptr) Variable Function + 30(vf16): 29(ptr) Variable Function + 104(tempReturn): 10(ptr) Variable Function + 106(tempArg): 10(ptr) Variable Function + 151(vb): 150(ptr) Variable Function + 178(vi): 177(ptr) Variable Function + 183(vu): 182(ptr) Variable Function + 242(b): 241(ptr) Variable Function + 249(tempReturn): 182(ptr) Variable Function + 252(tempArg): 182(ptr) Variable Function + 259(tempReturn): 182(ptr) Variable Function + 262(tempArg): 182(ptr) Variable Function + 270(tempArg): 182(ptr) Variable Function + 271(tempArg): 182(ptr) Variable Function + 279(tempArg): 177(ptr) Variable Function + 280(tempArg): 177(ptr) Variable Function + 289(i): 288(ptr) Variable Function + 12: 9 Load 11(vf) + 13: 9 Load 11(vf) + 14: 9 ExtInst 1(GLSL.std.450) 40(FMax) 12 13 + Store 11(vf) 14 + 17: 6(float) Load 16(f) + 18: 6(float) Load 16(f) + 19: 9 Load 11(vf) + 20: 9 CompositeConstruct + 21: 9 CompositeConstruct + 22: 9 ExtInst 1(GLSL.std.450) 49(SmoothStep) 20 21 19 + Store 11(vf) 22 + 23: 9 Load 11(vf) + 24: 9 Load 11(vf) + 25: 9 Load 11(vf) + 26: 9 ExtInst 1(GLSL.std.450) 49(SmoothStep) 23 24 25 + Store 11(vf) 26 + 31: 28 Load 30(vf16) + 32: 28 Load 30(vf16) + 33: 28 Load 30(vf16) + 34: 28 ExtInst 1(GLSL.std.450) 49(SmoothStep) 31 32 33 + Store 30(vf16) 34 + 35: 9 Load 11(vf) + 36: 9 ExtInst 1(GLSL.std.450) 11(Radians) 35 + Store 11(vf) 36 + 37: 9 Load 11(vf) + 38: 9 ExtInst 1(GLSL.std.450) 12(Degrees) 37 + Store 11(vf) 38 + 39: 9 Load 11(vf) + 40: 9 ExtInst 1(GLSL.std.450) 13(Sin) 39 + Store 11(vf) 40 + 41: 9 Load 11(vf) + 42: 9 ExtInst 1(GLSL.std.450) 14(Cos) 41 + Store 11(vf) 42 + 43: 9 Load 11(vf) + 44: 9 ExtInst 1(GLSL.std.450) 15(Tan) 43 + Store 11(vf) 44 + 45: 9 Load 11(vf) + 46: 9 ExtInst 1(GLSL.std.450) 16(Asin) 45 + Store 11(vf) 46 + 47: 9 Load 11(vf) + 48: 9 ExtInst 1(GLSL.std.450) 17(Acos) 47 + Store 11(vf) 48 + 49: 9 Load 11(vf) + 50: 9 ExtInst 1(GLSL.std.450) 18(Atan) 49 + Store 11(vf) 50 + 51: 9 Load 11(vf) + 52: 9 Load 11(vf) + 53: 9 ExtInst 1(GLSL.std.450) 25(Atan2) 51 52 + Store 11(vf) 53 + 54: 9 Load 11(vf) + 55: 9 ExtInst 1(GLSL.std.450) 19(Sinh) 54 + Store 11(vf) 55 + 56: 9 Load 11(vf) + 57: 9 ExtInst 1(GLSL.std.450) 20(Cosh) 56 + Store 11(vf) 57 + 58: 9 Load 11(vf) + 59: 9 ExtInst 1(GLSL.std.450) 21(Tanh) 58 + Store 11(vf) 59 + 60: 9 Load 11(vf) + 61: 9 ExtInst 1(GLSL.std.450) 22(Asinh) 60 + Store 11(vf) 61 + 62: 9 Load 11(vf) + 63: 9 ExtInst 1(GLSL.std.450) 23(Acosh) 62 + Store 11(vf) 63 + 64: 9 Load 11(vf) + 65: 9 ExtInst 1(GLSL.std.450) 24(Atanh) 64 + Store 11(vf) 65 + 66: 9 Load 11(vf) + 67: 9 Load 11(vf) + 68: 9 ExtInst 1(GLSL.std.450) 26(Pow) 66 67 + Store 11(vf) 68 + 69: 9 Load 11(vf) + 70: 9 ExtInst 1(GLSL.std.450) 27(Exp) 69 + Store 11(vf) 70 + 71: 9 Load 11(vf) + 72: 9 ExtInst 1(GLSL.std.450) 28(Log) 71 + Store 11(vf) 72 + 73: 9 Load 11(vf) + 74: 9 ExtInst 1(GLSL.std.450) 29(Exp2) 73 + Store 11(vf) 74 + 75: 9 Load 11(vf) + 76: 9 ExtInst 1(GLSL.std.450) 30(Log2) 75 + Store 11(vf) 76 + 77: 9 Load 11(vf) + 78: 9 ExtInst 1(GLSL.std.450) 31(Sqrt) 77 + Store 11(vf) 78 + 79: 9 Load 11(vf) + 80: 9 ExtInst 1(GLSL.std.450) 32(InverseSqrt) 79 + Store 11(vf) 80 + 81: 9 Load 11(vf) + 82: 9 ExtInst 1(GLSL.std.450) 4(FAbs) 81 + Store 11(vf) 82 + 83: 9 Load 11(vf) + 84: 9 ExtInst 1(GLSL.std.450) 6(FSign) 83 + Store 11(vf) 84 + 85: 9 Load 11(vf) + 86: 9 ExtInst 1(GLSL.std.450) 8(Floor) 85 + Store 11(vf) 86 + 87: 9 Load 11(vf) + 88: 9 ExtInst 1(GLSL.std.450) 3(Trunc) 87 + Store 11(vf) 88 + 89: 9 Load 11(vf) + 90: 9 ExtInst 1(GLSL.std.450) 1(Round) 89 + Store 11(vf) 90 + 91: 9 Load 11(vf) + 92: 9 ExtInst 1(GLSL.std.450) 2(RoundEven) 91 + Store 11(vf) 92 + 93: 9 Load 11(vf) + 94: 9 ExtInst 1(GLSL.std.450) 9(Ceil) 93 + Store 11(vf) 94 + 95: 9 Load 11(vf) + 96: 9 ExtInst 1(GLSL.std.450) 10(Fract) 95 + Store 11(vf) 96 + 97: 9 Load 11(vf) + 98: 6(float) Load 16(f) + 99: 9 CompositeConstruct + 100: 9 FMod 97 99 + Store 11(vf) 100 + 101: 9 Load 11(vf) + 102: 9 Load 11(vf) + 103: 9 FMod 101 102 + Store 11(vf) 103 + 105: 9 Load 11(vf) + 108:107(ResType) ExtInst 1(GLSL.std.450) 36(ModfStruct) 105 + 109: 9 CompositeExtract 108 1 + Store 106(tempArg) 109 + 110: 9 CompositeExtract 108 0 + Store 104(tempReturn) 110 + 111: 9 Load 106(tempArg) + Store 11(vf) 111 + 112: 9 Load 104(tempReturn) + Store 11(vf) 112 + 113: 9 Load 11(vf) + 114: 6(float) Load 16(f) + 115: 9 CompositeConstruct + 116: 9 ExtInst 1(GLSL.std.450) 37(FMin) 113 115 + Store 11(vf) 116 + 117: 9 Load 11(vf) + 118: 9 Load 11(vf) + 119: 9 ExtInst 1(GLSL.std.450) 37(FMin) 117 118 + Store 11(vf) 119 + 120: 9 Load 11(vf) + 121: 6(float) Load 16(f) + 122: 9 CompositeConstruct + 123: 9 ExtInst 1(GLSL.std.450) 40(FMax) 120 122 + Store 11(vf) 123 + 124: 9 Load 11(vf) + 125: 9 Load 11(vf) + 126: 9 ExtInst 1(GLSL.std.450) 40(FMax) 124 125 + Store 11(vf) 126 + 127: 9 Load 11(vf) + 128: 6(float) Load 16(f) + 129: 6(float) Load 16(f) + 130: 9 CompositeConstruct + 131: 9 CompositeConstruct + 132: 9 ExtInst 1(GLSL.std.450) 43(FClamp) 127 130 131 + Store 11(vf) 132 + 133: 9 Load 11(vf) + 134: 9 Load 11(vf) + 135: 9 Load 11(vf) + 136: 9 ExtInst 1(GLSL.std.450) 43(FClamp) 133 134 135 + Store 11(vf) 136 + 137: 9 Load 11(vf) + 138: 9 Load 11(vf) + 139: 6(float) Load 16(f) + 140: 9 CompositeConstruct + 141: 9 ExtInst 1(GLSL.std.450) 46(FMix) 137 138 140 + Store 11(vf) 141 + 142: 9 Load 11(vf) + 143: 9 Load 11(vf) + 144: 9 Load 11(vf) + 145: 9 ExtInst 1(GLSL.std.450) 46(FMix) 142 143 144 + Store 11(vf) 145 + 146: 9 Load 11(vf) + 147: 9 Load 11(vf) + 152: 149 Load 151(vb) + 153: 9 Select 152 147 146 + Store 11(vf) 153 + 154: 9 Load 11(vf) + 155: 9 Load 11(vf) + 156: 9 ExtInst 1(GLSL.std.450) 48(Step) 154 155 + Store 11(vf) 156 + 157: 6(float) Load 16(f) + 158: 9 Load 11(vf) + 159: 9 CompositeConstruct + 160: 9 ExtInst 1(GLSL.std.450) 48(Step) 159 158 + Store 11(vf) 160 + 161: 9 Load 11(vf) + 162: 9 Load 11(vf) + 163: 9 Load 11(vf) + 164: 9 ExtInst 1(GLSL.std.450) 49(SmoothStep) 161 162 163 + Store 11(vf) 164 + 165: 6(float) Load 16(f) + 166: 6(float) Load 16(f) + 167: 9 Load 11(vf) + 168: 9 CompositeConstruct + 169: 9 CompositeConstruct + 170: 9 ExtInst 1(GLSL.std.450) 49(SmoothStep) 168 169 167 + Store 11(vf) 170 + 171: 9 Load 11(vf) + 172: 149 IsNan 171 + Store 151(vb) 172 + 173: 9 Load 11(vf) + 174: 149 IsInf 173 + Store 151(vb) 174 + 179: 9 Load 11(vf) + 180: 176 Bitcast 179 + Store 178(vi) 180 + 184: 9 Load 11(vf) + 185: 181 Bitcast 184 + Store 183(vu) 185 + 186: 176 Load 178(vi) + 187: 9 Bitcast 186 + Store 11(vf) 187 + 188: 181 Load 183(vu) + 189: 9 Bitcast 188 + Store 11(vf) 189 + 190: 9 Load 11(vf) + 191: 9 Load 11(vf) + 192: 9 Load 11(vf) + 193: 9 ExtInst 1(GLSL.std.450) 50(Fma) 190 191 192 + Store 11(vf) 193 + 194: 9 Load 11(vf) + 196:195(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 194 + 197: 176 CompositeExtract 196 1 + Store 178(vi) 197 + 198: 9 CompositeExtract 196 0 + Store 11(vf) 198 + 199: 9 Load 11(vf) + 200: 176 Load 178(vi) + 201: 9 ExtInst 1(GLSL.std.450) 53(Ldexp) 199 200 + Store 11(vf) 201 + 202: 9 Load 11(vf) + 203: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 202 + Store 16(f) 203 + 204: 9 Load 11(vf) + 205: 9 Load 11(vf) + 206: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 204 205 + Store 16(f) 206 + 207: 9 Load 11(vf) + 208: 9 Load 11(vf) + 209: 6(float) Dot 207 208 + Store 16(f) 209 + 210: 9 Load 11(vf) + 211: 9 ExtInst 1(GLSL.std.450) 69(Normalize) 210 + Store 11(vf) 211 + 212: 9 Load 11(vf) + 213: 9 Load 11(vf) + 214: 9 Load 11(vf) + 215: 9 ExtInst 1(GLSL.std.450) 70(FaceForward) 212 213 214 + Store 11(vf) 215 + 216: 9 Load 11(vf) + 217: 9 Load 11(vf) + 218: 9 ExtInst 1(GLSL.std.450) 71(Reflect) 216 217 + Store 11(vf) 218 + 219: 9 Load 11(vf) + 220: 9 Load 11(vf) + 221: 6(float) Load 16(f) + 222: 9 ExtInst 1(GLSL.std.450) 72(Refract) 219 220 221 + Store 11(vf) 222 + 223: 9 Load 11(vf) + 224: 9 Load 11(vf) + 225: 149 FOrdLessThan 223 224 + Store 151(vb) 225 + 226: 9 Load 11(vf) + 227: 9 Load 11(vf) + 228: 149 FOrdLessThanEqual 226 227 + Store 151(vb) 228 + 229: 9 Load 11(vf) + 230: 9 Load 11(vf) + 231: 149 FOrdGreaterThan 229 230 + Store 151(vb) 231 + 232: 9 Load 11(vf) + 233: 9 Load 11(vf) + 234: 149 FOrdGreaterThanEqual 232 233 + Store 151(vb) 234 + 235: 9 Load 11(vf) + 236: 9 Load 11(vf) + 237: 149 FOrdEqual 235 236 + Store 151(vb) 237 + 238: 9 Load 11(vf) + 239: 9 Load 11(vf) + 240: 149 FUnordNotEqual 238 239 + Store 151(vb) 240 + 243: 149 Load 151(vb) + 244: 148(bool) Any 243 + Store 242(b) 244 + 245: 149 Load 151(vb) + 246: 148(bool) All 245 + Store 242(b) 246 + 247: 149 Load 151(vb) + 248: 149 LogicalNot 247 + Store 151(vb) 248 + 250: 181 Load 183(vu) + 251: 181 Load 183(vu) + 254:253(ResType) IAddCarry 250 251 + 255: 181 CompositeExtract 254 1 + Store 252(tempArg) 255 + 256: 181 CompositeExtract 254 0 + Store 249(tempReturn) 256 + 257: 181 Load 252(tempArg) + Store 183(vu) 257 + 258: 181 Load 249(tempReturn) + Store 183(vu) 258 + 260: 181 Load 183(vu) + 261: 181 Load 183(vu) + 263:253(ResType) ISubBorrow 260 261 + 264: 181 CompositeExtract 263 1 + Store 262(tempArg) 264 + 265: 181 CompositeExtract 263 0 + Store 259(tempReturn) 265 + 266: 181 Load 262(tempArg) + Store 183(vu) 266 + 267: 181 Load 259(tempReturn) + Store 183(vu) 267 + 268: 181 Load 183(vu) + 269: 181 Load 183(vu) + 272:253(ResType) UMulExtended 268 269 + 273: 181 CompositeExtract 272 0 + Store 271(tempArg) 273 + 274: 181 CompositeExtract 272 1 + Store 270(tempArg) 274 + 275: 181 Load 270(tempArg) + Store 183(vu) 275 + 276: 181 Load 271(tempArg) + Store 183(vu) 276 + 277: 176 Load 178(vi) + 278: 176 Load 178(vi) + 282:281(ResType) SMulExtended 277 278 + 283: 176 CompositeExtract 282 0 + Store 280(tempArg) 283 + 284: 176 CompositeExtract 282 1 + Store 279(tempArg) 284 + 285: 176 Load 279(tempArg) + Store 178(vi) 285 + 286: 176 Load 280(tempArg) + Store 178(vi) 286 + 287: 181 Load 183(vu) + 290: 175(int) Load 289(i) + 291: 175(int) Load 289(i) + 292: 181 BitFieldUExtract 287 290 291 + Store 183(vu) 292 + 293: 181 Load 183(vu) + 294: 181 Load 183(vu) + 295: 175(int) Load 289(i) + 296: 175(int) Load 289(i) + 297: 181 BitFieldInsert 293 294 295 296 + Store 183(vu) 297 + 298: 181 Load 183(vu) + 299: 181 BitReverse 298 + Store 183(vu) 299 + 300: 181 Load 183(vu) + 301: 176 BitCount 300 + Store 178(vi) 301 + 302: 181 Load 183(vu) + 303: 176 ExtInst 1(GLSL.std.450) 73(FindILsb) 302 + Store 178(vi) 303 + 304: 181 Load 183(vu) + 305: 176 ExtInst 1(GLSL.std.450) 75(FindUMsb) 304 + Store 178(vi) 305 + 306: 181 Load 183(vu) + 307: 181 Load 183(vu) + 308: 149 Load 151(vb) + 309: 181 Select 308 307 306 + Store 183(vu) 309 + 310: 149 Load 151(vb) + 311: 149 Load 151(vb) + 312: 149 Load 151(vb) + 313: 149 Select 312 311 310 + Store 151(vb) 313 + 314: 181 Load 183(vu) + 315: 181 Load 183(vu) + 316: 181 ExpectKHR 314 315 + Store 183(vu) 316 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSpecConstint32.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSpecConstint32.comp.out new file mode 100644 index 0000000000..f8f391fca0 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSpecConstint32.comp.out @@ -0,0 +1,162 @@ +spv.longVectorBuiltinsSpecConstint32.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 106 + + Capability Shader + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 8 "c0" + Name 11 "vi" + Name 14 "i" + Name 43 "vb" + Name 66 "tempArg" + Name 67 "tempArg" + Name 68 "ResType" + Decorate 8(c0) SpecId 0 + Decorate 105 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypeInt 32 0 + 8(c0): 7(int) SpecConstant 0 + 9: TypeCooperativeVectorNV 6(int) 8(c0) + 10: TypePointer Function 9 + 13: TypePointer Function 6(int) + 40: TypeBool + 41: TypeCooperativeVectorNV 40(bool) 8(c0) + 42: TypePointer Function 41 + 68(ResType): TypeStruct 9 9 + 102: TypeVector 7(int) 3 + 103: 7(int) Constant 64 + 104: 7(int) Constant 1 + 105: 102(ivec3) ConstantComposite 103 104 104 + 4(main): 2 Function None 3 + 5: Label + 11(vi): 10(ptr) Variable Function + 14(i): 13(ptr) Variable Function + 43(vb): 42(ptr) Variable Function + 66(tempArg): 10(ptr) Variable Function + 67(tempArg): 10(ptr) Variable Function + 12: 9 Load 11(vi) + 15: 6(int) Load 14(i) + 16: 9 CompositeConstruct + 17: 9 ExtInst 1(GLSL.std.450) 39(SMin) 12 16 + Store 11(vi) 17 + 18: 9 Load 11(vi) + 19: 9 Load 11(vi) + 20: 9 ExtInst 1(GLSL.std.450) 39(SMin) 18 19 + Store 11(vi) 20 + 21: 9 Load 11(vi) + 22: 6(int) Load 14(i) + 23: 9 CompositeConstruct + 24: 9 ExtInst 1(GLSL.std.450) 42(SMax) 21 23 + Store 11(vi) 24 + 25: 9 Load 11(vi) + 26: 9 Load 11(vi) + 27: 9 ExtInst 1(GLSL.std.450) 42(SMax) 25 26 + Store 11(vi) 27 + 28: 9 Load 11(vi) + 29: 6(int) Load 14(i) + 30: 6(int) Load 14(i) + 31: 9 CompositeConstruct + 32: 9 CompositeConstruct + 33: 9 ExtInst 1(GLSL.std.450) 45(SClamp) 28 31 32 + Store 11(vi) 33 + 34: 9 Load 11(vi) + 35: 9 Load 11(vi) + 36: 9 Load 11(vi) + 37: 9 ExtInst 1(GLSL.std.450) 45(SClamp) 34 35 36 + Store 11(vi) 37 + 38: 9 Load 11(vi) + 39: 9 Load 11(vi) + 44: 41 Load 43(vb) + 45: 9 Select 44 39 38 + Store 11(vi) 45 + 46: 9 Load 11(vi) + 47: 9 Load 11(vi) + 48: 41 SLessThan 46 47 + Store 43(vb) 48 + 49: 9 Load 11(vi) + 50: 9 Load 11(vi) + 51: 41 SLessThanEqual 49 50 + Store 43(vb) 51 + 52: 9 Load 11(vi) + 53: 9 Load 11(vi) + 54: 41 SGreaterThan 52 53 + Store 43(vb) 54 + 55: 9 Load 11(vi) + 56: 9 Load 11(vi) + 57: 41 SGreaterThanEqual 55 56 + Store 43(vb) 57 + 58: 9 Load 11(vi) + 59: 9 Load 11(vi) + 60: 41 IEqual 58 59 + Store 43(vb) 60 + 61: 9 Load 11(vi) + 62: 9 Load 11(vi) + 63: 41 INotEqual 61 62 + Store 43(vb) 63 + 64: 9 Load 11(vi) + 65: 9 Load 11(vi) + 69: 68(ResType) SMulExtended 64 65 + 70: 9 CompositeExtract 69 0 + Store 67(tempArg) 70 + 71: 9 CompositeExtract 69 1 + Store 66(tempArg) 71 + 72: 9 Load 66(tempArg) + Store 11(vi) 72 + 73: 9 Load 67(tempArg) + Store 11(vi) 73 + 74: 9 Load 11(vi) + 75: 6(int) Load 14(i) + 76: 6(int) Load 14(i) + 77: 9 BitFieldSExtract 74 75 76 + Store 11(vi) 77 + 78: 9 Load 11(vi) + 79: 9 Load 11(vi) + 80: 6(int) Load 14(i) + 81: 6(int) Load 14(i) + 82: 9 BitFieldInsert 78 79 80 81 + Store 11(vi) 82 + 83: 9 Load 11(vi) + 84: 9 BitReverse 83 + Store 11(vi) 84 + 85: 9 Load 11(vi) + 86: 9 BitCount 85 + Store 11(vi) 86 + 87: 9 Load 11(vi) + 88: 9 ExtInst 1(GLSL.std.450) 73(FindILsb) 87 + Store 11(vi) 88 + 89: 9 Load 11(vi) + 90: 9 ExtInst 1(GLSL.std.450) 74(FindSMsb) 89 + Store 11(vi) 90 + 91: 9 Load 11(vi) + 92: 9 Load 11(vi) + 93: 41 Load 43(vb) + 94: 9 Select 93 92 91 + Store 11(vi) 94 + 95: 41 Load 43(vb) + 96: 41 Load 43(vb) + 97: 41 Load 43(vb) + 98: 41 Select 97 96 95 + Store 43(vb) 98 + 99: 9 Load 11(vi) + 100: 9 Load 11(vi) + 101: 9 ExpectKHR 99 100 + Store 11(vi) 101 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSubgroup.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSubgroup.comp.out new file mode 100644 index 0000000000..a23b711ece --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsSubgroup.comp.out @@ -0,0 +1,936 @@ +spv.longVectorBuiltinsSubgroup.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 636 + + Capability Shader + Capability Float64 + Capability Int64 + Capability GroupNonUniform + Capability GroupNonUniformVote + Capability GroupNonUniformArithmetic + Capability GroupNonUniformBallot + Capability GroupNonUniformShuffle + Capability GroupNonUniformShuffleRelative + Capability GroupNonUniformClustered + Capability GroupNonUniformQuad + Capability GroupNonUniformPartitionedNV + Capability LongVectorEXT + Capability GroupNonUniformRotateKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_subgroup_rotate" + Extension "SPV_NV_shader_subgroup_partitioned" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_bfloat16" + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int64" + SourceExtension "GL_EXT_shader_subgroup_extended_types_int64" + SourceExtension "GL_KHR_memory_scope_semantics" + SourceExtension "GL_KHR_shader_subgroup_arithmetic" + SourceExtension "GL_KHR_shader_subgroup_ballot" + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_KHR_shader_subgroup_clustered" + SourceExtension "GL_KHR_shader_subgroup_quad" + SourceExtension "GL_KHR_shader_subgroup_rotate" + SourceExtension "GL_KHR_shader_subgroup_shuffle" + SourceExtension "GL_KHR_shader_subgroup_shuffle_relative" + SourceExtension "GL_KHR_shader_subgroup_vote" + SourceExtension "GL_NV_shader_subgroup_partitioned" + Name 4 "main" + Name 8 "b" + Name 12 "vu32" + Name 23 "u" + Name 110 "vu4" + Name 179 "vf32" + Name 285 "vf64" + Name 390 "vb" + Name 479 "vu64" + Decorate 635 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeBool + 7: TypePointer Function 6(bool) + 9: TypeInt 32 0 + 10: TypeVector 9(int) 5 + 11: TypePointer Function 10(ivec) + 14: 9(int) Constant 3 + 17: 9(int) Constant 1 + 22: TypePointer Function 9(int) + 40: 9(int) Constant 4 + 101: 9(int) Constant 0 + 106: 9(int) Constant 2 + 108: TypeVector 9(int) 4 + 109: TypePointer Function 108(ivec4) + 176: TypeFloat 32 + 177: TypeVector 176(float) 5 + 178: TypePointer Function 177(fvec) + 282: TypeFloat 64 + 283: TypeVector 282(float64_t) 5 + 284: TypePointer Function 283(f64vec) + 388: TypeVector 6(bool) 5 + 389: TypePointer Function 388(bvec) + 476: TypeInt 64 0 + 477: TypeVector 476(int64_t) 5 + 478: TypePointer Function 477(i64vec) + 633: TypeVector 9(int) 3 + 634: 9(int) Constant 64 + 635: 633(ivec3) ConstantComposite 634 17 17 + 4(main): 2 Function None 3 + 5: Label + 8(b): 7(ptr) Variable Function + 12(vu32): 11(ptr) Variable Function + 23(u): 22(ptr) Variable Function + 110(vu4): 109(ptr) Variable Function + 179(vf32): 178(ptr) Variable Function + 285(vf64): 284(ptr) Variable Function + 390(vb): 389(ptr) Variable Function + 479(vu64): 478(ptr) Variable Function + 13: 10(ivec) Load 12(vu32) + 15: 6(bool) GroupNonUniformAllEqual 14 13 + Store 8(b) 15 + 16: 10(ivec) Load 12(vu32) + 18: 10(ivec) GroupNonUniformBroadcast 14 16 17 + Store 12(vu32) 18 + 19: 10(ivec) Load 12(vu32) + 20: 10(ivec) GroupNonUniformBroadcastFirst 14 19 + Store 12(vu32) 20 + 21: 10(ivec) Load 12(vu32) + 24: 9(int) Load 23(u) + 25: 10(ivec) GroupNonUniformShuffle 14 21 24 + Store 12(vu32) 25 + 26: 10(ivec) Load 12(vu32) + 27: 9(int) Load 23(u) + 28: 10(ivec) GroupNonUniformShuffleXor 14 26 27 + Store 12(vu32) 28 + 29: 10(ivec) Load 12(vu32) + 30: 9(int) Load 23(u) + 31: 10(ivec) GroupNonUniformShuffleUp 14 29 30 + Store 12(vu32) 31 + 32: 10(ivec) Load 12(vu32) + 33: 9(int) Load 23(u) + 34: 10(ivec) GroupNonUniformShuffleDown 14 32 33 + Store 12(vu32) 34 + 35: 10(ivec) Load 12(vu32) + 36: 9(int) Load 23(u) + 37: 10(ivec) GroupNonUniformRotateKHR 14 35 36 + Store 12(vu32) 37 + 38: 10(ivec) Load 12(vu32) + 39: 9(int) Load 23(u) + 41: 10(ivec) GroupNonUniformRotateKHR 14 38 39 40 + Store 12(vu32) 41 + 42: 10(ivec) Load 12(vu32) + 43: 10(ivec) GroupNonUniformIAdd 14 Reduce 42 + Store 12(vu32) 43 + 44: 10(ivec) Load 12(vu32) + 45: 10(ivec) GroupNonUniformIMul 14 Reduce 44 + Store 12(vu32) 45 + 46: 10(ivec) Load 12(vu32) + 47: 10(ivec) GroupNonUniformUMin 14 Reduce 46 + Store 12(vu32) 47 + 48: 10(ivec) Load 12(vu32) + 49: 10(ivec) GroupNonUniformUMax 14 Reduce 48 + Store 12(vu32) 49 + 50: 10(ivec) Load 12(vu32) + 51: 10(ivec) GroupNonUniformBitwiseAnd 14 Reduce 50 + Store 12(vu32) 51 + 52: 10(ivec) Load 12(vu32) + 53: 10(ivec) GroupNonUniformBitwiseOr 14 Reduce 52 + Store 12(vu32) 53 + 54: 10(ivec) Load 12(vu32) + 55: 10(ivec) GroupNonUniformBitwiseXor 14 Reduce 54 + Store 12(vu32) 55 + 56: 10(ivec) Load 12(vu32) + 57: 10(ivec) GroupNonUniformIAdd 14 InclusiveScan 56 + Store 12(vu32) 57 + 58: 10(ivec) Load 12(vu32) + 59: 10(ivec) GroupNonUniformIMul 14 InclusiveScan 58 + Store 12(vu32) 59 + 60: 10(ivec) Load 12(vu32) + 61: 10(ivec) GroupNonUniformUMin 14 InclusiveScan 60 + Store 12(vu32) 61 + 62: 10(ivec) Load 12(vu32) + 63: 10(ivec) GroupNonUniformUMax 14 InclusiveScan 62 + Store 12(vu32) 63 + 64: 10(ivec) Load 12(vu32) + 65: 10(ivec) GroupNonUniformBitwiseAnd 14 InclusiveScan 64 + Store 12(vu32) 65 + 66: 10(ivec) Load 12(vu32) + 67: 10(ivec) GroupNonUniformBitwiseOr 14 InclusiveScan 66 + Store 12(vu32) 67 + 68: 10(ivec) Load 12(vu32) + 69: 10(ivec) GroupNonUniformBitwiseXor 14 InclusiveScan 68 + Store 12(vu32) 69 + 70: 10(ivec) Load 12(vu32) + 71: 10(ivec) GroupNonUniformIAdd 14 ExclusiveScan 70 + Store 12(vu32) 71 + 72: 10(ivec) Load 12(vu32) + 73: 10(ivec) GroupNonUniformIMul 14 ExclusiveScan 72 + Store 12(vu32) 73 + 74: 10(ivec) Load 12(vu32) + 75: 10(ivec) GroupNonUniformUMin 14 ExclusiveScan 74 + Store 12(vu32) 75 + 76: 10(ivec) Load 12(vu32) + 77: 10(ivec) GroupNonUniformUMax 14 ExclusiveScan 76 + Store 12(vu32) 77 + 78: 10(ivec) Load 12(vu32) + 79: 10(ivec) GroupNonUniformBitwiseAnd 14 ExclusiveScan 78 + Store 12(vu32) 79 + 80: 10(ivec) Load 12(vu32) + 81: 10(ivec) GroupNonUniformBitwiseOr 14 ExclusiveScan 80 + Store 12(vu32) 81 + 82: 10(ivec) Load 12(vu32) + 83: 10(ivec) GroupNonUniformBitwiseXor 14 ExclusiveScan 82 + Store 12(vu32) 83 + 84: 10(ivec) Load 12(vu32) + 85: 10(ivec) GroupNonUniformIAdd 14 ClusteredReduce 84 40 + Store 12(vu32) 85 + 86: 10(ivec) Load 12(vu32) + 87: 10(ivec) GroupNonUniformIMul 14 ClusteredReduce 86 40 + Store 12(vu32) 87 + 88: 10(ivec) Load 12(vu32) + 89: 10(ivec) GroupNonUniformUMin 14 ClusteredReduce 88 40 + Store 12(vu32) 89 + 90: 10(ivec) Load 12(vu32) + 91: 10(ivec) GroupNonUniformUMax 14 ClusteredReduce 90 40 + Store 12(vu32) 91 + 92: 10(ivec) Load 12(vu32) + 93: 10(ivec) GroupNonUniformBitwiseAnd 14 ClusteredReduce 92 40 + Store 12(vu32) 93 + 94: 10(ivec) Load 12(vu32) + 95: 10(ivec) GroupNonUniformBitwiseOr 14 ClusteredReduce 94 40 + Store 12(vu32) 95 + 96: 10(ivec) Load 12(vu32) + 97: 10(ivec) GroupNonUniformBitwiseXor 14 ClusteredReduce 96 40 + Store 12(vu32) 97 + 98: 10(ivec) Load 12(vu32) + 99: 10(ivec) GroupNonUniformQuadBroadcast 14 98 17 + Store 12(vu32) 99 + 100: 10(ivec) Load 12(vu32) + 102: 10(ivec) GroupNonUniformQuadSwap 14 100 101 + Store 12(vu32) 102 + 103: 10(ivec) Load 12(vu32) + 104: 10(ivec) GroupNonUniformQuadSwap 14 103 17 + Store 12(vu32) 104 + 105: 10(ivec) Load 12(vu32) + 107: 10(ivec) GroupNonUniformQuadSwap 14 105 106 + Store 12(vu32) 107 + 111: 10(ivec) Load 12(vu32) + 112: 108(ivec4) GroupNonUniformPartitionNV 111 + Store 110(vu4) 112 + 113: 10(ivec) Load 12(vu32) + 114: 108(ivec4) Load 110(vu4) + 115: 10(ivec) GroupNonUniformIAdd 14 PartitionedReduceNV 113 114 + Store 12(vu32) 115 + 116: 10(ivec) Load 12(vu32) + 117: 108(ivec4) Load 110(vu4) + 118: 10(ivec) GroupNonUniformIMul 14 PartitionedReduceNV 116 117 + Store 12(vu32) 118 + 119: 10(ivec) Load 12(vu32) + 120: 108(ivec4) Load 110(vu4) + 121: 10(ivec) GroupNonUniformUMin 14 PartitionedReduceNV 119 120 + Store 12(vu32) 121 + 122: 10(ivec) Load 12(vu32) + 123: 108(ivec4) Load 110(vu4) + 124: 10(ivec) GroupNonUniformUMax 14 PartitionedReduceNV 122 123 + Store 12(vu32) 124 + 125: 10(ivec) Load 12(vu32) + 126: 108(ivec4) Load 110(vu4) + 127: 10(ivec) GroupNonUniformBitwiseAnd 14 PartitionedReduceNV 125 126 + Store 12(vu32) 127 + 128: 10(ivec) Load 12(vu32) + 129: 108(ivec4) Load 110(vu4) + 130: 10(ivec) GroupNonUniformBitwiseOr 14 PartitionedReduceNV 128 129 + Store 12(vu32) 130 + 131: 10(ivec) Load 12(vu32) + 132: 108(ivec4) Load 110(vu4) + 133: 10(ivec) GroupNonUniformBitwiseXor 14 PartitionedReduceNV 131 132 + Store 12(vu32) 133 + 134: 10(ivec) Load 12(vu32) + 135: 108(ivec4) Load 110(vu4) + 136: 10(ivec) GroupNonUniformIAdd 14 PartitionedInclusiveScanNV 134 135 + Store 12(vu32) 136 + 137: 10(ivec) Load 12(vu32) + 138: 108(ivec4) Load 110(vu4) + 139: 10(ivec) GroupNonUniformIMul 14 PartitionedInclusiveScanNV 137 138 + Store 12(vu32) 139 + 140: 10(ivec) Load 12(vu32) + 141: 108(ivec4) Load 110(vu4) + 142: 10(ivec) GroupNonUniformUMin 14 PartitionedInclusiveScanNV 140 141 + Store 12(vu32) 142 + 143: 10(ivec) Load 12(vu32) + 144: 108(ivec4) Load 110(vu4) + 145: 10(ivec) GroupNonUniformUMax 14 PartitionedInclusiveScanNV 143 144 + Store 12(vu32) 145 + 146: 10(ivec) Load 12(vu32) + 147: 108(ivec4) Load 110(vu4) + 148: 10(ivec) GroupNonUniformBitwiseAnd 14 PartitionedInclusiveScanNV 146 147 + Store 12(vu32) 148 + 149: 10(ivec) Load 12(vu32) + 150: 108(ivec4) Load 110(vu4) + 151: 10(ivec) GroupNonUniformBitwiseOr 14 PartitionedInclusiveScanNV 149 150 + Store 12(vu32) 151 + 152: 10(ivec) Load 12(vu32) + 153: 108(ivec4) Load 110(vu4) + 154: 10(ivec) GroupNonUniformBitwiseXor 14 PartitionedInclusiveScanNV 152 153 + Store 12(vu32) 154 + 155: 10(ivec) Load 12(vu32) + 156: 108(ivec4) Load 110(vu4) + 157: 10(ivec) GroupNonUniformIAdd 14 PartitionedExclusiveScanNV 155 156 + Store 12(vu32) 157 + 158: 10(ivec) Load 12(vu32) + 159: 108(ivec4) Load 110(vu4) + 160: 10(ivec) GroupNonUniformIMul 14 PartitionedExclusiveScanNV 158 159 + Store 12(vu32) 160 + 161: 10(ivec) Load 12(vu32) + 162: 108(ivec4) Load 110(vu4) + 163: 10(ivec) GroupNonUniformUMin 14 PartitionedExclusiveScanNV 161 162 + Store 12(vu32) 163 + 164: 10(ivec) Load 12(vu32) + 165: 108(ivec4) Load 110(vu4) + 166: 10(ivec) GroupNonUniformUMax 14 PartitionedExclusiveScanNV 164 165 + Store 12(vu32) 166 + 167: 10(ivec) Load 12(vu32) + 168: 108(ivec4) Load 110(vu4) + 169: 10(ivec) GroupNonUniformBitwiseAnd 14 PartitionedExclusiveScanNV 167 168 + Store 12(vu32) 169 + 170: 10(ivec) Load 12(vu32) + 171: 108(ivec4) Load 110(vu4) + 172: 10(ivec) GroupNonUniformBitwiseOr 14 PartitionedExclusiveScanNV 170 171 + Store 12(vu32) 172 + 173: 10(ivec) Load 12(vu32) + 174: 108(ivec4) Load 110(vu4) + 175: 10(ivec) GroupNonUniformBitwiseXor 14 PartitionedExclusiveScanNV 173 174 + Store 12(vu32) 175 + 180: 177(fvec) Load 179(vf32) + 181: 6(bool) GroupNonUniformAllEqual 14 180 + Store 8(b) 181 + 182: 177(fvec) Load 179(vf32) + 183: 177(fvec) GroupNonUniformBroadcast 14 182 17 + Store 179(vf32) 183 + 184: 177(fvec) Load 179(vf32) + 185: 177(fvec) GroupNonUniformBroadcastFirst 14 184 + Store 179(vf32) 185 + 186: 177(fvec) Load 179(vf32) + 187: 9(int) Load 23(u) + 188: 177(fvec) GroupNonUniformShuffle 14 186 187 + Store 179(vf32) 188 + 189: 177(fvec) Load 179(vf32) + 190: 9(int) Load 23(u) + 191: 177(fvec) GroupNonUniformShuffleXor 14 189 190 + Store 179(vf32) 191 + 192: 177(fvec) Load 179(vf32) + 193: 9(int) Load 23(u) + 194: 177(fvec) GroupNonUniformShuffleUp 14 192 193 + Store 179(vf32) 194 + 195: 177(fvec) Load 179(vf32) + 196: 9(int) Load 23(u) + 197: 177(fvec) GroupNonUniformShuffleDown 14 195 196 + Store 179(vf32) 197 + 198: 177(fvec) Load 179(vf32) + 199: 9(int) Load 23(u) + 200: 177(fvec) GroupNonUniformRotateKHR 14 198 199 + Store 179(vf32) 200 + 201: 177(fvec) Load 179(vf32) + 202: 9(int) Load 23(u) + 203: 177(fvec) GroupNonUniformRotateKHR 14 201 202 40 + Store 179(vf32) 203 + 204: 177(fvec) Load 179(vf32) + 205: 177(fvec) GroupNonUniformFAdd 14 Reduce 204 + Store 179(vf32) 205 + 206: 177(fvec) Load 179(vf32) + 207: 177(fvec) GroupNonUniformFMul 14 Reduce 206 + Store 179(vf32) 207 + 208: 177(fvec) Load 179(vf32) + 209: 177(fvec) GroupNonUniformFMin 14 Reduce 208 + Store 179(vf32) 209 + 210: 177(fvec) Load 179(vf32) + 211: 177(fvec) GroupNonUniformFMax 14 Reduce 210 + Store 179(vf32) 211 + 212: 177(fvec) Load 179(vf32) + 213: 177(fvec) GroupNonUniformFAdd 14 InclusiveScan 212 + Store 179(vf32) 213 + 214: 177(fvec) Load 179(vf32) + 215: 177(fvec) GroupNonUniformFMul 14 InclusiveScan 214 + Store 179(vf32) 215 + 216: 177(fvec) Load 179(vf32) + 217: 177(fvec) GroupNonUniformFMin 14 InclusiveScan 216 + Store 179(vf32) 217 + 218: 177(fvec) Load 179(vf32) + 219: 177(fvec) GroupNonUniformFMax 14 InclusiveScan 218 + Store 179(vf32) 219 + 220: 177(fvec) Load 179(vf32) + 221: 177(fvec) GroupNonUniformFAdd 14 ExclusiveScan 220 + Store 179(vf32) 221 + 222: 177(fvec) Load 179(vf32) + 223: 177(fvec) GroupNonUniformFMul 14 ExclusiveScan 222 + Store 179(vf32) 223 + 224: 177(fvec) Load 179(vf32) + 225: 177(fvec) GroupNonUniformFMin 14 ExclusiveScan 224 + Store 179(vf32) 225 + 226: 177(fvec) Load 179(vf32) + 227: 177(fvec) GroupNonUniformFMax 14 ExclusiveScan 226 + Store 179(vf32) 227 + 228: 177(fvec) Load 179(vf32) + 229: 177(fvec) GroupNonUniformFAdd 14 ClusteredReduce 228 40 + Store 179(vf32) 229 + 230: 177(fvec) Load 179(vf32) + 231: 177(fvec) GroupNonUniformFMul 14 ClusteredReduce 230 40 + Store 179(vf32) 231 + 232: 177(fvec) Load 179(vf32) + 233: 177(fvec) GroupNonUniformFMin 14 ClusteredReduce 232 40 + Store 179(vf32) 233 + 234: 177(fvec) Load 179(vf32) + 235: 177(fvec) GroupNonUniformFMax 14 ClusteredReduce 234 40 + Store 179(vf32) 235 + 236: 177(fvec) Load 179(vf32) + 237: 177(fvec) GroupNonUniformQuadBroadcast 14 236 17 + Store 179(vf32) 237 + 238: 177(fvec) Load 179(vf32) + 239: 177(fvec) GroupNonUniformQuadSwap 14 238 101 + Store 179(vf32) 239 + 240: 177(fvec) Load 179(vf32) + 241: 177(fvec) GroupNonUniformQuadSwap 14 240 17 + Store 179(vf32) 241 + 242: 177(fvec) Load 179(vf32) + 243: 177(fvec) GroupNonUniformQuadSwap 14 242 106 + Store 179(vf32) 243 + 244: 177(fvec) Load 179(vf32) + 245: 108(ivec4) GroupNonUniformPartitionNV 244 + Store 110(vu4) 245 + 246: 177(fvec) Load 179(vf32) + 247: 108(ivec4) Load 110(vu4) + 248: 177(fvec) GroupNonUniformFAdd 14 PartitionedReduceNV 246 247 + Store 179(vf32) 248 + 249: 177(fvec) Load 179(vf32) + 250: 108(ivec4) Load 110(vu4) + 251: 177(fvec) GroupNonUniformFMul 14 PartitionedReduceNV 249 250 + Store 179(vf32) 251 + 252: 177(fvec) Load 179(vf32) + 253: 108(ivec4) Load 110(vu4) + 254: 177(fvec) GroupNonUniformFMin 14 PartitionedReduceNV 252 253 + Store 179(vf32) 254 + 255: 177(fvec) Load 179(vf32) + 256: 108(ivec4) Load 110(vu4) + 257: 177(fvec) GroupNonUniformFMax 14 PartitionedReduceNV 255 256 + Store 179(vf32) 257 + 258: 177(fvec) Load 179(vf32) + 259: 108(ivec4) Load 110(vu4) + 260: 177(fvec) GroupNonUniformFAdd 14 PartitionedInclusiveScanNV 258 259 + Store 179(vf32) 260 + 261: 177(fvec) Load 179(vf32) + 262: 108(ivec4) Load 110(vu4) + 263: 177(fvec) GroupNonUniformFMul 14 PartitionedInclusiveScanNV 261 262 + Store 179(vf32) 263 + 264: 177(fvec) Load 179(vf32) + 265: 108(ivec4) Load 110(vu4) + 266: 177(fvec) GroupNonUniformFMin 14 PartitionedInclusiveScanNV 264 265 + Store 179(vf32) 266 + 267: 177(fvec) Load 179(vf32) + 268: 108(ivec4) Load 110(vu4) + 269: 177(fvec) GroupNonUniformFMax 14 PartitionedInclusiveScanNV 267 268 + Store 179(vf32) 269 + 270: 177(fvec) Load 179(vf32) + 271: 108(ivec4) Load 110(vu4) + 272: 177(fvec) GroupNonUniformFAdd 14 PartitionedExclusiveScanNV 270 271 + Store 179(vf32) 272 + 273: 177(fvec) Load 179(vf32) + 274: 108(ivec4) Load 110(vu4) + 275: 177(fvec) GroupNonUniformFMul 14 PartitionedExclusiveScanNV 273 274 + Store 179(vf32) 275 + 276: 177(fvec) Load 179(vf32) + 277: 108(ivec4) Load 110(vu4) + 278: 177(fvec) GroupNonUniformFMin 14 PartitionedExclusiveScanNV 276 277 + Store 179(vf32) 278 + 279: 177(fvec) Load 179(vf32) + 280: 108(ivec4) Load 110(vu4) + 281: 177(fvec) GroupNonUniformFMax 14 PartitionedExclusiveScanNV 279 280 + Store 179(vf32) 281 + 286: 283(f64vec) Load 285(vf64) + 287: 6(bool) GroupNonUniformAllEqual 14 286 + Store 8(b) 287 + 288: 283(f64vec) Load 285(vf64) + 289: 283(f64vec) GroupNonUniformBroadcast 14 288 17 + Store 285(vf64) 289 + 290: 283(f64vec) Load 285(vf64) + 291: 283(f64vec) GroupNonUniformBroadcastFirst 14 290 + Store 285(vf64) 291 + 292: 283(f64vec) Load 285(vf64) + 293: 9(int) Load 23(u) + 294: 283(f64vec) GroupNonUniformShuffle 14 292 293 + Store 285(vf64) 294 + 295: 283(f64vec) Load 285(vf64) + 296: 9(int) Load 23(u) + 297: 283(f64vec) GroupNonUniformShuffleXor 14 295 296 + Store 285(vf64) 297 + 298: 283(f64vec) Load 285(vf64) + 299: 9(int) Load 23(u) + 300: 283(f64vec) GroupNonUniformShuffleUp 14 298 299 + Store 285(vf64) 300 + 301: 283(f64vec) Load 285(vf64) + 302: 9(int) Load 23(u) + 303: 283(f64vec) GroupNonUniformShuffleDown 14 301 302 + Store 285(vf64) 303 + 304: 283(f64vec) Load 285(vf64) + 305: 9(int) Load 23(u) + 306: 283(f64vec) GroupNonUniformRotateKHR 14 304 305 + Store 285(vf64) 306 + 307: 283(f64vec) Load 285(vf64) + 308: 9(int) Load 23(u) + 309: 283(f64vec) GroupNonUniformRotateKHR 14 307 308 40 + Store 285(vf64) 309 + 310: 283(f64vec) Load 285(vf64) + 311: 283(f64vec) GroupNonUniformFAdd 14 Reduce 310 + Store 285(vf64) 311 + 312: 283(f64vec) Load 285(vf64) + 313: 283(f64vec) GroupNonUniformFMul 14 Reduce 312 + Store 285(vf64) 313 + 314: 283(f64vec) Load 285(vf64) + 315: 283(f64vec) GroupNonUniformFMin 14 Reduce 314 + Store 285(vf64) 315 + 316: 283(f64vec) Load 285(vf64) + 317: 283(f64vec) GroupNonUniformFMax 14 Reduce 316 + Store 285(vf64) 317 + 318: 283(f64vec) Load 285(vf64) + 319: 283(f64vec) GroupNonUniformFAdd 14 InclusiveScan 318 + Store 285(vf64) 319 + 320: 283(f64vec) Load 285(vf64) + 321: 283(f64vec) GroupNonUniformFMul 14 InclusiveScan 320 + Store 285(vf64) 321 + 322: 283(f64vec) Load 285(vf64) + 323: 283(f64vec) GroupNonUniformFMin 14 InclusiveScan 322 + Store 285(vf64) 323 + 324: 283(f64vec) Load 285(vf64) + 325: 283(f64vec) GroupNonUniformFMax 14 InclusiveScan 324 + Store 285(vf64) 325 + 326: 283(f64vec) Load 285(vf64) + 327: 283(f64vec) GroupNonUniformFAdd 14 ExclusiveScan 326 + Store 285(vf64) 327 + 328: 283(f64vec) Load 285(vf64) + 329: 283(f64vec) GroupNonUniformFMul 14 ExclusiveScan 328 + Store 285(vf64) 329 + 330: 283(f64vec) Load 285(vf64) + 331: 283(f64vec) GroupNonUniformFMin 14 ExclusiveScan 330 + Store 285(vf64) 331 + 332: 283(f64vec) Load 285(vf64) + 333: 283(f64vec) GroupNonUniformFMax 14 ExclusiveScan 332 + Store 285(vf64) 333 + 334: 283(f64vec) Load 285(vf64) + 335: 283(f64vec) GroupNonUniformFAdd 14 ClusteredReduce 334 40 + Store 285(vf64) 335 + 336: 283(f64vec) Load 285(vf64) + 337: 283(f64vec) GroupNonUniformFMul 14 ClusteredReduce 336 40 + Store 285(vf64) 337 + 338: 283(f64vec) Load 285(vf64) + 339: 283(f64vec) GroupNonUniformFMin 14 ClusteredReduce 338 40 + Store 285(vf64) 339 + 340: 283(f64vec) Load 285(vf64) + 341: 283(f64vec) GroupNonUniformFMax 14 ClusteredReduce 340 40 + Store 285(vf64) 341 + 342: 283(f64vec) Load 285(vf64) + 343: 283(f64vec) GroupNonUniformQuadBroadcast 14 342 17 + Store 285(vf64) 343 + 344: 283(f64vec) Load 285(vf64) + 345: 283(f64vec) GroupNonUniformQuadSwap 14 344 101 + Store 285(vf64) 345 + 346: 283(f64vec) Load 285(vf64) + 347: 283(f64vec) GroupNonUniformQuadSwap 14 346 17 + Store 285(vf64) 347 + 348: 283(f64vec) Load 285(vf64) + 349: 283(f64vec) GroupNonUniformQuadSwap 14 348 106 + Store 285(vf64) 349 + 350: 283(f64vec) Load 285(vf64) + 351: 108(ivec4) GroupNonUniformPartitionNV 350 + Store 110(vu4) 351 + 352: 283(f64vec) Load 285(vf64) + 353: 108(ivec4) Load 110(vu4) + 354: 283(f64vec) GroupNonUniformFAdd 14 PartitionedReduceNV 352 353 + Store 285(vf64) 354 + 355: 283(f64vec) Load 285(vf64) + 356: 108(ivec4) Load 110(vu4) + 357: 283(f64vec) GroupNonUniformFMul 14 PartitionedReduceNV 355 356 + Store 285(vf64) 357 + 358: 283(f64vec) Load 285(vf64) + 359: 108(ivec4) Load 110(vu4) + 360: 283(f64vec) GroupNonUniformFMin 14 PartitionedReduceNV 358 359 + Store 285(vf64) 360 + 361: 283(f64vec) Load 285(vf64) + 362: 108(ivec4) Load 110(vu4) + 363: 283(f64vec) GroupNonUniformFMax 14 PartitionedReduceNV 361 362 + Store 285(vf64) 363 + 364: 283(f64vec) Load 285(vf64) + 365: 108(ivec4) Load 110(vu4) + 366: 283(f64vec) GroupNonUniformFAdd 14 PartitionedInclusiveScanNV 364 365 + Store 285(vf64) 366 + 367: 283(f64vec) Load 285(vf64) + 368: 108(ivec4) Load 110(vu4) + 369: 283(f64vec) GroupNonUniformFMul 14 PartitionedInclusiveScanNV 367 368 + Store 285(vf64) 369 + 370: 283(f64vec) Load 285(vf64) + 371: 108(ivec4) Load 110(vu4) + 372: 283(f64vec) GroupNonUniformFMin 14 PartitionedInclusiveScanNV 370 371 + Store 285(vf64) 372 + 373: 283(f64vec) Load 285(vf64) + 374: 108(ivec4) Load 110(vu4) + 375: 283(f64vec) GroupNonUniformFMax 14 PartitionedInclusiveScanNV 373 374 + Store 285(vf64) 375 + 376: 283(f64vec) Load 285(vf64) + 377: 108(ivec4) Load 110(vu4) + 378: 283(f64vec) GroupNonUniformFAdd 14 PartitionedExclusiveScanNV 376 377 + Store 285(vf64) 378 + 379: 283(f64vec) Load 285(vf64) + 380: 108(ivec4) Load 110(vu4) + 381: 283(f64vec) GroupNonUniformFMul 14 PartitionedExclusiveScanNV 379 380 + Store 285(vf64) 381 + 382: 283(f64vec) Load 285(vf64) + 383: 108(ivec4) Load 110(vu4) + 384: 283(f64vec) GroupNonUniformFMin 14 PartitionedExclusiveScanNV 382 383 + Store 285(vf64) 384 + 385: 283(f64vec) Load 285(vf64) + 386: 108(ivec4) Load 110(vu4) + 387: 283(f64vec) GroupNonUniformFMax 14 PartitionedExclusiveScanNV 385 386 + Store 285(vf64) 387 + 391: 388(bvec) Load 390(vb) + 392: 6(bool) GroupNonUniformAllEqual 14 391 + Store 8(b) 392 + 393: 388(bvec) Load 390(vb) + 394: 388(bvec) GroupNonUniformBroadcast 14 393 17 + Store 390(vb) 394 + 395: 388(bvec) Load 390(vb) + 396: 388(bvec) GroupNonUniformBroadcastFirst 14 395 + Store 390(vb) 396 + 397: 388(bvec) Load 390(vb) + 398: 9(int) Load 23(u) + 399: 388(bvec) GroupNonUniformShuffle 14 397 398 + Store 390(vb) 399 + 400: 388(bvec) Load 390(vb) + 401: 9(int) Load 23(u) + 402: 388(bvec) GroupNonUniformShuffleXor 14 400 401 + Store 390(vb) 402 + 403: 388(bvec) Load 390(vb) + 404: 9(int) Load 23(u) + 405: 388(bvec) GroupNonUniformShuffleUp 14 403 404 + Store 390(vb) 405 + 406: 388(bvec) Load 390(vb) + 407: 9(int) Load 23(u) + 408: 388(bvec) GroupNonUniformShuffleDown 14 406 407 + Store 390(vb) 408 + 409: 388(bvec) Load 390(vb) + 410: 9(int) Load 23(u) + 411: 388(bvec) GroupNonUniformRotateKHR 14 409 410 + Store 390(vb) 411 + 412: 388(bvec) Load 390(vb) + 413: 9(int) Load 23(u) + 414: 388(bvec) GroupNonUniformRotateKHR 14 412 413 40 + Store 390(vb) 414 + 415: 388(bvec) Load 390(vb) + 416: 388(bvec) GroupNonUniformLogicalAnd 14 Reduce 415 + Store 390(vb) 416 + 417: 388(bvec) Load 390(vb) + 418: 388(bvec) GroupNonUniformLogicalOr 14 Reduce 417 + Store 390(vb) 418 + 419: 388(bvec) Load 390(vb) + 420: 388(bvec) GroupNonUniformLogicalXor 14 Reduce 419 + Store 390(vb) 420 + 421: 388(bvec) Load 390(vb) + 422: 388(bvec) GroupNonUniformLogicalAnd 14 InclusiveScan 421 + Store 390(vb) 422 + 423: 388(bvec) Load 390(vb) + 424: 388(bvec) GroupNonUniformLogicalOr 14 InclusiveScan 423 + Store 390(vb) 424 + 425: 388(bvec) Load 390(vb) + 426: 388(bvec) GroupNonUniformLogicalXor 14 InclusiveScan 425 + Store 390(vb) 426 + 427: 388(bvec) Load 390(vb) + 428: 388(bvec) GroupNonUniformLogicalAnd 14 ExclusiveScan 427 + Store 390(vb) 428 + 429: 388(bvec) Load 390(vb) + 430: 388(bvec) GroupNonUniformLogicalOr 14 ExclusiveScan 429 + Store 390(vb) 430 + 431: 388(bvec) Load 390(vb) + 432: 388(bvec) GroupNonUniformLogicalXor 14 ExclusiveScan 431 + Store 390(vb) 432 + 433: 388(bvec) Load 390(vb) + 434: 388(bvec) GroupNonUniformLogicalAnd 14 ClusteredReduce 433 40 + Store 390(vb) 434 + 435: 388(bvec) Load 390(vb) + 436: 388(bvec) GroupNonUniformLogicalOr 14 ClusteredReduce 435 40 + Store 390(vb) 436 + 437: 388(bvec) Load 390(vb) + 438: 388(bvec) GroupNonUniformLogicalXor 14 ClusteredReduce 437 40 + Store 390(vb) 438 + 439: 388(bvec) Load 390(vb) + 440: 388(bvec) GroupNonUniformQuadBroadcast 14 439 17 + Store 390(vb) 440 + 441: 388(bvec) Load 390(vb) + 442: 388(bvec) GroupNonUniformQuadSwap 14 441 101 + Store 390(vb) 442 + 443: 388(bvec) Load 390(vb) + 444: 388(bvec) GroupNonUniformQuadSwap 14 443 17 + Store 390(vb) 444 + 445: 388(bvec) Load 390(vb) + 446: 388(bvec) GroupNonUniformQuadSwap 14 445 106 + Store 390(vb) 446 + 447: 388(bvec) Load 390(vb) + 448: 108(ivec4) GroupNonUniformPartitionNV 447 + Store 110(vu4) 448 + 449: 388(bvec) Load 390(vb) + 450: 108(ivec4) Load 110(vu4) + 451: 388(bvec) GroupNonUniformLogicalAnd 14 PartitionedReduceNV 449 450 + Store 390(vb) 451 + 452: 388(bvec) Load 390(vb) + 453: 108(ivec4) Load 110(vu4) + 454: 388(bvec) GroupNonUniformLogicalOr 14 PartitionedReduceNV 452 453 + Store 390(vb) 454 + 455: 388(bvec) Load 390(vb) + 456: 108(ivec4) Load 110(vu4) + 457: 388(bvec) GroupNonUniformLogicalXor 14 PartitionedReduceNV 455 456 + Store 390(vb) 457 + 458: 388(bvec) Load 390(vb) + 459: 108(ivec4) Load 110(vu4) + 460: 388(bvec) GroupNonUniformLogicalAnd 14 PartitionedInclusiveScanNV 458 459 + Store 390(vb) 460 + 461: 388(bvec) Load 390(vb) + 462: 108(ivec4) Load 110(vu4) + 463: 388(bvec) GroupNonUniformLogicalOr 14 PartitionedInclusiveScanNV 461 462 + Store 390(vb) 463 + 464: 388(bvec) Load 390(vb) + 465: 108(ivec4) Load 110(vu4) + 466: 388(bvec) GroupNonUniformLogicalXor 14 PartitionedInclusiveScanNV 464 465 + Store 390(vb) 466 + 467: 388(bvec) Load 390(vb) + 468: 108(ivec4) Load 110(vu4) + 469: 388(bvec) GroupNonUniformLogicalAnd 14 PartitionedExclusiveScanNV 467 468 + Store 390(vb) 469 + 470: 388(bvec) Load 390(vb) + 471: 108(ivec4) Load 110(vu4) + 472: 388(bvec) GroupNonUniformLogicalOr 14 PartitionedExclusiveScanNV 470 471 + Store 390(vb) 472 + 473: 388(bvec) Load 390(vb) + 474: 108(ivec4) Load 110(vu4) + 475: 388(bvec) GroupNonUniformLogicalXor 14 PartitionedExclusiveScanNV 473 474 + Store 390(vb) 475 + 480: 477(i64vec) Load 479(vu64) + 481: 6(bool) GroupNonUniformAllEqual 14 480 + Store 8(b) 481 + 482: 477(i64vec) Load 479(vu64) + 483: 477(i64vec) GroupNonUniformBroadcast 14 482 17 + Store 479(vu64) 483 + 484: 477(i64vec) Load 479(vu64) + 485: 477(i64vec) GroupNonUniformBroadcastFirst 14 484 + Store 479(vu64) 485 + 486: 477(i64vec) Load 479(vu64) + 487: 9(int) Load 23(u) + 488: 477(i64vec) GroupNonUniformShuffle 14 486 487 + Store 479(vu64) 488 + 489: 477(i64vec) Load 479(vu64) + 490: 9(int) Load 23(u) + 491: 477(i64vec) GroupNonUniformShuffleXor 14 489 490 + Store 479(vu64) 491 + 492: 477(i64vec) Load 479(vu64) + 493: 9(int) Load 23(u) + 494: 477(i64vec) GroupNonUniformShuffleUp 14 492 493 + Store 479(vu64) 494 + 495: 477(i64vec) Load 479(vu64) + 496: 9(int) Load 23(u) + 497: 477(i64vec) GroupNonUniformShuffleDown 14 495 496 + Store 479(vu64) 497 + 498: 477(i64vec) Load 479(vu64) + 499: 9(int) Load 23(u) + 500: 477(i64vec) GroupNonUniformRotateKHR 14 498 499 + Store 479(vu64) 500 + 501: 477(i64vec) Load 479(vu64) + 502: 9(int) Load 23(u) + 503: 477(i64vec) GroupNonUniformRotateKHR 14 501 502 40 + Store 479(vu64) 503 + 504: 477(i64vec) Load 479(vu64) + 505: 477(i64vec) GroupNonUniformIAdd 14 Reduce 504 + Store 479(vu64) 505 + 506: 477(i64vec) Load 479(vu64) + 507: 477(i64vec) GroupNonUniformIMul 14 Reduce 506 + Store 479(vu64) 507 + 508: 477(i64vec) Load 479(vu64) + 509: 477(i64vec) GroupNonUniformUMin 14 Reduce 508 + Store 479(vu64) 509 + 510: 477(i64vec) Load 479(vu64) + 511: 477(i64vec) GroupNonUniformUMax 14 Reduce 510 + Store 479(vu64) 511 + 512: 477(i64vec) Load 479(vu64) + 513: 477(i64vec) GroupNonUniformBitwiseAnd 14 Reduce 512 + Store 479(vu64) 513 + 514: 477(i64vec) Load 479(vu64) + 515: 477(i64vec) GroupNonUniformBitwiseOr 14 Reduce 514 + Store 479(vu64) 515 + 516: 477(i64vec) Load 479(vu64) + 517: 477(i64vec) GroupNonUniformBitwiseXor 14 Reduce 516 + Store 479(vu64) 517 + 518: 477(i64vec) Load 479(vu64) + 519: 477(i64vec) GroupNonUniformIAdd 14 InclusiveScan 518 + Store 479(vu64) 519 + 520: 477(i64vec) Load 479(vu64) + 521: 477(i64vec) GroupNonUniformIMul 14 InclusiveScan 520 + Store 479(vu64) 521 + 522: 477(i64vec) Load 479(vu64) + 523: 477(i64vec) GroupNonUniformUMin 14 InclusiveScan 522 + Store 479(vu64) 523 + 524: 477(i64vec) Load 479(vu64) + 525: 477(i64vec) GroupNonUniformUMax 14 InclusiveScan 524 + Store 479(vu64) 525 + 526: 477(i64vec) Load 479(vu64) + 527: 477(i64vec) GroupNonUniformBitwiseAnd 14 InclusiveScan 526 + Store 479(vu64) 527 + 528: 477(i64vec) Load 479(vu64) + 529: 477(i64vec) GroupNonUniformBitwiseOr 14 InclusiveScan 528 + Store 479(vu64) 529 + 530: 477(i64vec) Load 479(vu64) + 531: 477(i64vec) GroupNonUniformBitwiseXor 14 InclusiveScan 530 + Store 479(vu64) 531 + 532: 477(i64vec) Load 479(vu64) + 533: 477(i64vec) GroupNonUniformIAdd 14 ExclusiveScan 532 + Store 479(vu64) 533 + 534: 477(i64vec) Load 479(vu64) + 535: 477(i64vec) GroupNonUniformIMul 14 ExclusiveScan 534 + Store 479(vu64) 535 + 536: 477(i64vec) Load 479(vu64) + 537: 477(i64vec) GroupNonUniformUMin 14 ExclusiveScan 536 + Store 479(vu64) 537 + 538: 477(i64vec) Load 479(vu64) + 539: 477(i64vec) GroupNonUniformUMax 14 ExclusiveScan 538 + Store 479(vu64) 539 + 540: 477(i64vec) Load 479(vu64) + 541: 477(i64vec) GroupNonUniformBitwiseAnd 14 ExclusiveScan 540 + Store 479(vu64) 541 + 542: 477(i64vec) Load 479(vu64) + 543: 477(i64vec) GroupNonUniformBitwiseOr 14 ExclusiveScan 542 + Store 479(vu64) 543 + 544: 477(i64vec) Load 479(vu64) + 545: 477(i64vec) GroupNonUniformBitwiseXor 14 ExclusiveScan 544 + Store 479(vu64) 545 + 546: 477(i64vec) Load 479(vu64) + 547: 477(i64vec) GroupNonUniformIAdd 14 ClusteredReduce 546 40 + Store 479(vu64) 547 + 548: 477(i64vec) Load 479(vu64) + 549: 477(i64vec) GroupNonUniformIMul 14 ClusteredReduce 548 40 + Store 479(vu64) 549 + 550: 477(i64vec) Load 479(vu64) + 551: 477(i64vec) GroupNonUniformUMin 14 ClusteredReduce 550 40 + Store 479(vu64) 551 + 552: 477(i64vec) Load 479(vu64) + 553: 477(i64vec) GroupNonUniformUMax 14 ClusteredReduce 552 40 + Store 479(vu64) 553 + 554: 477(i64vec) Load 479(vu64) + 555: 477(i64vec) GroupNonUniformBitwiseAnd 14 ClusteredReduce 554 40 + Store 479(vu64) 555 + 556: 477(i64vec) Load 479(vu64) + 557: 477(i64vec) GroupNonUniformBitwiseOr 14 ClusteredReduce 556 40 + Store 479(vu64) 557 + 558: 477(i64vec) Load 479(vu64) + 559: 477(i64vec) GroupNonUniformBitwiseXor 14 ClusteredReduce 558 40 + Store 479(vu64) 559 + 560: 477(i64vec) Load 479(vu64) + 561: 477(i64vec) GroupNonUniformQuadBroadcast 14 560 17 + Store 479(vu64) 561 + 562: 477(i64vec) Load 479(vu64) + 563: 477(i64vec) GroupNonUniformQuadSwap 14 562 101 + Store 479(vu64) 563 + 564: 477(i64vec) Load 479(vu64) + 565: 477(i64vec) GroupNonUniformQuadSwap 14 564 17 + Store 479(vu64) 565 + 566: 477(i64vec) Load 479(vu64) + 567: 477(i64vec) GroupNonUniformQuadSwap 14 566 106 + Store 479(vu64) 567 + 568: 477(i64vec) Load 479(vu64) + 569: 108(ivec4) GroupNonUniformPartitionNV 568 + Store 110(vu4) 569 + 570: 477(i64vec) Load 479(vu64) + 571: 108(ivec4) Load 110(vu4) + 572: 477(i64vec) GroupNonUniformIAdd 14 PartitionedReduceNV 570 571 + Store 479(vu64) 572 + 573: 477(i64vec) Load 479(vu64) + 574: 108(ivec4) Load 110(vu4) + 575: 477(i64vec) GroupNonUniformIMul 14 PartitionedReduceNV 573 574 + Store 479(vu64) 575 + 576: 477(i64vec) Load 479(vu64) + 577: 108(ivec4) Load 110(vu4) + 578: 477(i64vec) GroupNonUniformUMin 14 PartitionedReduceNV 576 577 + Store 479(vu64) 578 + 579: 477(i64vec) Load 479(vu64) + 580: 108(ivec4) Load 110(vu4) + 581: 477(i64vec) GroupNonUniformUMax 14 PartitionedReduceNV 579 580 + Store 479(vu64) 581 + 582: 477(i64vec) Load 479(vu64) + 583: 108(ivec4) Load 110(vu4) + 584: 477(i64vec) GroupNonUniformBitwiseAnd 14 PartitionedReduceNV 582 583 + Store 479(vu64) 584 + 585: 477(i64vec) Load 479(vu64) + 586: 108(ivec4) Load 110(vu4) + 587: 477(i64vec) GroupNonUniformBitwiseOr 14 PartitionedReduceNV 585 586 + Store 479(vu64) 587 + 588: 477(i64vec) Load 479(vu64) + 589: 108(ivec4) Load 110(vu4) + 590: 477(i64vec) GroupNonUniformBitwiseXor 14 PartitionedReduceNV 588 589 + Store 479(vu64) 590 + 591: 477(i64vec) Load 479(vu64) + 592: 108(ivec4) Load 110(vu4) + 593: 477(i64vec) GroupNonUniformIAdd 14 PartitionedInclusiveScanNV 591 592 + Store 479(vu64) 593 + 594: 477(i64vec) Load 479(vu64) + 595: 108(ivec4) Load 110(vu4) + 596: 477(i64vec) GroupNonUniformIMul 14 PartitionedInclusiveScanNV 594 595 + Store 479(vu64) 596 + 597: 477(i64vec) Load 479(vu64) + 598: 108(ivec4) Load 110(vu4) + 599: 477(i64vec) GroupNonUniformUMin 14 PartitionedInclusiveScanNV 597 598 + Store 479(vu64) 599 + 600: 477(i64vec) Load 479(vu64) + 601: 108(ivec4) Load 110(vu4) + 602: 477(i64vec) GroupNonUniformUMax 14 PartitionedInclusiveScanNV 600 601 + Store 479(vu64) 602 + 603: 477(i64vec) Load 479(vu64) + 604: 108(ivec4) Load 110(vu4) + 605: 477(i64vec) GroupNonUniformBitwiseAnd 14 PartitionedInclusiveScanNV 603 604 + Store 479(vu64) 605 + 606: 477(i64vec) Load 479(vu64) + 607: 108(ivec4) Load 110(vu4) + 608: 477(i64vec) GroupNonUniformBitwiseOr 14 PartitionedInclusiveScanNV 606 607 + Store 479(vu64) 608 + 609: 477(i64vec) Load 479(vu64) + 610: 108(ivec4) Load 110(vu4) + 611: 477(i64vec) GroupNonUniformBitwiseXor 14 PartitionedInclusiveScanNV 609 610 + Store 479(vu64) 611 + 612: 477(i64vec) Load 479(vu64) + 613: 108(ivec4) Load 110(vu4) + 614: 477(i64vec) GroupNonUniformIAdd 14 PartitionedExclusiveScanNV 612 613 + Store 479(vu64) 614 + 615: 477(i64vec) Load 479(vu64) + 616: 108(ivec4) Load 110(vu4) + 617: 477(i64vec) GroupNonUniformIMul 14 PartitionedExclusiveScanNV 615 616 + Store 479(vu64) 617 + 618: 477(i64vec) Load 479(vu64) + 619: 108(ivec4) Load 110(vu4) + 620: 477(i64vec) GroupNonUniformUMin 14 PartitionedExclusiveScanNV 618 619 + Store 479(vu64) 620 + 621: 477(i64vec) Load 479(vu64) + 622: 108(ivec4) Load 110(vu4) + 623: 477(i64vec) GroupNonUniformUMax 14 PartitionedExclusiveScanNV 621 622 + Store 479(vu64) 623 + 624: 477(i64vec) Load 479(vu64) + 625: 108(ivec4) Load 110(vu4) + 626: 477(i64vec) GroupNonUniformBitwiseAnd 14 PartitionedExclusiveScanNV 624 625 + Store 479(vu64) 626 + 627: 477(i64vec) Load 479(vu64) + 628: 108(ivec4) Load 110(vu4) + 629: 477(i64vec) GroupNonUniformBitwiseOr 14 PartitionedExclusiveScanNV 627 628 + Store 479(vu64) 629 + 630: 477(i64vec) Load 479(vu64) + 631: 108(ivec4) Load 110(vu4) + 632: 477(i64vec) GroupNonUniformBitwiseXor 14 PartitionedExclusiveScanNV 630 631 + Store 479(vu64) 632 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsfp16.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsfp16.comp.out new file mode 100644 index 0000000000..ebee7aea8f --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsfp16.comp.out @@ -0,0 +1,323 @@ +spv.longVectorBuiltinsfp16.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 220 + + Capability Shader + Capability Float16 + Capability Int16 + Capability LongVectorEXT + Extension "SPV_AMD_gpu_shader_int16" + Extension "SPV_EXT_long_vector" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vf" + Name 74 "f" + Name 81 "tempReturn" + Name 83 "tempArg" + Name 84 "ResType" + Name 128 "vb" + Name 160 "vi" + Name 161 "ResType" + Name 208 "b" + Decorate 219 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 16 + 7: TypeVector 6(float16_t) 5 + 8: TypePointer Function 7(f16vec) + 73: TypePointer Function 6(float16_t) + 84(ResType): TypeStruct 7(f16vec) 7(f16vec) + 125: TypeBool + 126: TypeVector 125(bool) 5 + 127: TypePointer Function 126(bvec) + 157: TypeInt 16 1 + 158: TypeVector 157(int16_t) 5 + 159: TypePointer Function 158(i16vec) + 161(ResType): TypeStruct 7(f16vec) 158(i16vec) + 207: TypePointer Function 125(bool) + 215: TypeInt 32 0 + 216: TypeVector 215(int) 3 + 217: 215(int) Constant 64 + 218: 215(int) Constant 1 + 219: 216(ivec3) ConstantComposite 217 218 218 + 4(main): 2 Function None 3 + 5: Label + 9(vf): 8(ptr) Variable Function + 74(f): 73(ptr) Variable Function + 81(tempReturn): 8(ptr) Variable Function + 83(tempArg): 8(ptr) Variable Function + 128(vb): 127(ptr) Variable Function + 160(vi): 159(ptr) Variable Function + 208(b): 207(ptr) Variable Function + 10: 7(f16vec) Load 9(vf) + 11: 7(f16vec) ExtInst 1(GLSL.std.450) 11(Radians) 10 + Store 9(vf) 11 + 12: 7(f16vec) Load 9(vf) + 13: 7(f16vec) ExtInst 1(GLSL.std.450) 12(Degrees) 12 + Store 9(vf) 13 + 14: 7(f16vec) Load 9(vf) + 15: 7(f16vec) ExtInst 1(GLSL.std.450) 13(Sin) 14 + Store 9(vf) 15 + 16: 7(f16vec) Load 9(vf) + 17: 7(f16vec) ExtInst 1(GLSL.std.450) 14(Cos) 16 + Store 9(vf) 17 + 18: 7(f16vec) Load 9(vf) + 19: 7(f16vec) ExtInst 1(GLSL.std.450) 15(Tan) 18 + Store 9(vf) 19 + 20: 7(f16vec) Load 9(vf) + 21: 7(f16vec) ExtInst 1(GLSL.std.450) 16(Asin) 20 + Store 9(vf) 21 + 22: 7(f16vec) Load 9(vf) + 23: 7(f16vec) ExtInst 1(GLSL.std.450) 17(Acos) 22 + Store 9(vf) 23 + 24: 7(f16vec) Load 9(vf) + 25: 7(f16vec) ExtInst 1(GLSL.std.450) 18(Atan) 24 + Store 9(vf) 25 + 26: 7(f16vec) Load 9(vf) + 27: 7(f16vec) Load 9(vf) + 28: 7(f16vec) ExtInst 1(GLSL.std.450) 25(Atan2) 26 27 + Store 9(vf) 28 + 29: 7(f16vec) Load 9(vf) + 30: 7(f16vec) ExtInst 1(GLSL.std.450) 19(Sinh) 29 + Store 9(vf) 30 + 31: 7(f16vec) Load 9(vf) + 32: 7(f16vec) ExtInst 1(GLSL.std.450) 20(Cosh) 31 + Store 9(vf) 32 + 33: 7(f16vec) Load 9(vf) + 34: 7(f16vec) ExtInst 1(GLSL.std.450) 21(Tanh) 33 + Store 9(vf) 34 + 35: 7(f16vec) Load 9(vf) + 36: 7(f16vec) ExtInst 1(GLSL.std.450) 22(Asinh) 35 + Store 9(vf) 36 + 37: 7(f16vec) Load 9(vf) + 38: 7(f16vec) ExtInst 1(GLSL.std.450) 23(Acosh) 37 + Store 9(vf) 38 + 39: 7(f16vec) Load 9(vf) + 40: 7(f16vec) ExtInst 1(GLSL.std.450) 24(Atanh) 39 + Store 9(vf) 40 + 41: 7(f16vec) Load 9(vf) + 42: 7(f16vec) Load 9(vf) + 43: 7(f16vec) ExtInst 1(GLSL.std.450) 26(Pow) 41 42 + Store 9(vf) 43 + 44: 7(f16vec) Load 9(vf) + 45: 7(f16vec) ExtInst 1(GLSL.std.450) 27(Exp) 44 + Store 9(vf) 45 + 46: 7(f16vec) Load 9(vf) + 47: 7(f16vec) ExtInst 1(GLSL.std.450) 28(Log) 46 + Store 9(vf) 47 + 48: 7(f16vec) Load 9(vf) + 49: 7(f16vec) ExtInst 1(GLSL.std.450) 29(Exp2) 48 + Store 9(vf) 49 + 50: 7(f16vec) Load 9(vf) + 51: 7(f16vec) ExtInst 1(GLSL.std.450) 30(Log2) 50 + Store 9(vf) 51 + 52: 7(f16vec) Load 9(vf) + 53: 7(f16vec) ExtInst 1(GLSL.std.450) 31(Sqrt) 52 + Store 9(vf) 53 + 54: 7(f16vec) Load 9(vf) + 55: 7(f16vec) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 54 + Store 9(vf) 55 + 56: 7(f16vec) Load 9(vf) + 57: 7(f16vec) ExtInst 1(GLSL.std.450) 4(FAbs) 56 + Store 9(vf) 57 + 58: 7(f16vec) Load 9(vf) + 59: 7(f16vec) ExtInst 1(GLSL.std.450) 6(FSign) 58 + Store 9(vf) 59 + 60: 7(f16vec) Load 9(vf) + 61: 7(f16vec) ExtInst 1(GLSL.std.450) 8(Floor) 60 + Store 9(vf) 61 + 62: 7(f16vec) Load 9(vf) + 63: 7(f16vec) ExtInst 1(GLSL.std.450) 3(Trunc) 62 + Store 9(vf) 63 + 64: 7(f16vec) Load 9(vf) + 65: 7(f16vec) ExtInst 1(GLSL.std.450) 1(Round) 64 + Store 9(vf) 65 + 66: 7(f16vec) Load 9(vf) + 67: 7(f16vec) ExtInst 1(GLSL.std.450) 2(RoundEven) 66 + Store 9(vf) 67 + 68: 7(f16vec) Load 9(vf) + 69: 7(f16vec) ExtInst 1(GLSL.std.450) 9(Ceil) 68 + Store 9(vf) 69 + 70: 7(f16vec) Load 9(vf) + 71: 7(f16vec) ExtInst 1(GLSL.std.450) 10(Fract) 70 + Store 9(vf) 71 + 72: 7(f16vec) Load 9(vf) + 75:6(float16_t) Load 74(f) + 76: 7(f16vec) CompositeConstruct 75 75 75 75 75 + 77: 7(f16vec) FMod 72 76 + Store 9(vf) 77 + 78: 7(f16vec) Load 9(vf) + 79: 7(f16vec) Load 9(vf) + 80: 7(f16vec) FMod 78 79 + Store 9(vf) 80 + 82: 7(f16vec) Load 9(vf) + 85: 84(ResType) ExtInst 1(GLSL.std.450) 36(ModfStruct) 82 + 86: 7(f16vec) CompositeExtract 85 1 + Store 83(tempArg) 86 + 87: 7(f16vec) CompositeExtract 85 0 + Store 81(tempReturn) 87 + 88: 7(f16vec) Load 83(tempArg) + Store 9(vf) 88 + 89: 7(f16vec) Load 81(tempReturn) + Store 9(vf) 89 + 90: 7(f16vec) Load 9(vf) + 91:6(float16_t) Load 74(f) + 92: 7(f16vec) CompositeConstruct 91 91 91 91 91 + 93: 7(f16vec) ExtInst 1(GLSL.std.450) 37(FMin) 90 92 + Store 9(vf) 93 + 94: 7(f16vec) Load 9(vf) + 95: 7(f16vec) Load 9(vf) + 96: 7(f16vec) ExtInst 1(GLSL.std.450) 37(FMin) 94 95 + Store 9(vf) 96 + 97: 7(f16vec) Load 9(vf) + 98:6(float16_t) Load 74(f) + 99: 7(f16vec) CompositeConstruct 98 98 98 98 98 + 100: 7(f16vec) ExtInst 1(GLSL.std.450) 40(FMax) 97 99 + Store 9(vf) 100 + 101: 7(f16vec) Load 9(vf) + 102: 7(f16vec) Load 9(vf) + 103: 7(f16vec) ExtInst 1(GLSL.std.450) 40(FMax) 101 102 + Store 9(vf) 103 + 104: 7(f16vec) Load 9(vf) + 105:6(float16_t) Load 74(f) + 106:6(float16_t) Load 74(f) + 107: 7(f16vec) CompositeConstruct 105 105 105 105 105 + 108: 7(f16vec) CompositeConstruct 106 106 106 106 106 + 109: 7(f16vec) ExtInst 1(GLSL.std.450) 43(FClamp) 104 107 108 + Store 9(vf) 109 + 110: 7(f16vec) Load 9(vf) + 111: 7(f16vec) Load 9(vf) + 112: 7(f16vec) Load 9(vf) + 113: 7(f16vec) ExtInst 1(GLSL.std.450) 43(FClamp) 110 111 112 + Store 9(vf) 113 + 114: 7(f16vec) Load 9(vf) + 115: 7(f16vec) Load 9(vf) + 116:6(float16_t) Load 74(f) + 117: 7(f16vec) CompositeConstruct 116 116 116 116 116 + 118: 7(f16vec) ExtInst 1(GLSL.std.450) 46(FMix) 114 115 117 + Store 9(vf) 118 + 119: 7(f16vec) Load 9(vf) + 120: 7(f16vec) Load 9(vf) + 121: 7(f16vec) Load 9(vf) + 122: 7(f16vec) ExtInst 1(GLSL.std.450) 46(FMix) 119 120 121 + Store 9(vf) 122 + 123: 7(f16vec) Load 9(vf) + 124: 7(f16vec) Load 9(vf) + 129: 126(bvec) Load 128(vb) + 130: 7(f16vec) Select 129 124 123 + Store 9(vf) 130 + 131: 7(f16vec) Load 9(vf) + 132: 7(f16vec) Load 9(vf) + 133: 7(f16vec) ExtInst 1(GLSL.std.450) 48(Step) 131 132 + Store 9(vf) 133 + 134:6(float16_t) Load 74(f) + 135: 7(f16vec) Load 9(vf) + 136: 7(f16vec) CompositeConstruct 134 134 134 134 134 + 137: 7(f16vec) ExtInst 1(GLSL.std.450) 48(Step) 136 135 + Store 9(vf) 137 + 138: 7(f16vec) Load 9(vf) + 139: 7(f16vec) Load 9(vf) + 140: 7(f16vec) Load 9(vf) + 141: 7(f16vec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 138 139 140 + Store 9(vf) 141 + 142:6(float16_t) Load 74(f) + 143:6(float16_t) Load 74(f) + 144: 7(f16vec) Load 9(vf) + 145: 7(f16vec) CompositeConstruct 142 142 142 142 142 + 146: 7(f16vec) CompositeConstruct 143 143 143 143 143 + 147: 7(f16vec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 145 146 144 + Store 9(vf) 147 + 148: 7(f16vec) Load 9(vf) + 149: 126(bvec) IsNan 148 + Store 128(vb) 149 + 150: 7(f16vec) Load 9(vf) + 151: 126(bvec) IsInf 150 + Store 128(vb) 151 + 152: 7(f16vec) Load 9(vf) + 153: 7(f16vec) Load 9(vf) + 154: 7(f16vec) Load 9(vf) + 155: 7(f16vec) ExtInst 1(GLSL.std.450) 50(Fma) 152 153 154 + Store 9(vf) 155 + 156: 7(f16vec) Load 9(vf) + 162:161(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 156 + 163: 158(i16vec) CompositeExtract 162 1 + Store 160(vi) 163 + 164: 7(f16vec) CompositeExtract 162 0 + Store 9(vf) 164 + 165: 7(f16vec) Load 9(vf) + 166: 158(i16vec) Load 160(vi) + 167: 7(f16vec) ExtInst 1(GLSL.std.450) 53(Ldexp) 165 166 + Store 9(vf) 167 + 168: 7(f16vec) Load 9(vf) + 169:6(float16_t) ExtInst 1(GLSL.std.450) 66(Length) 168 + Store 74(f) 169 + 170: 7(f16vec) Load 9(vf) + 171: 7(f16vec) Load 9(vf) + 172:6(float16_t) ExtInst 1(GLSL.std.450) 67(Distance) 170 171 + Store 74(f) 172 + 173: 7(f16vec) Load 9(vf) + 174: 7(f16vec) Load 9(vf) + 175:6(float16_t) Dot 173 174 + Store 74(f) 175 + 176: 7(f16vec) Load 9(vf) + 177: 7(f16vec) ExtInst 1(GLSL.std.450) 69(Normalize) 176 + Store 9(vf) 177 + 178: 7(f16vec) Load 9(vf) + 179: 7(f16vec) Load 9(vf) + 180: 7(f16vec) Load 9(vf) + 181: 7(f16vec) ExtInst 1(GLSL.std.450) 70(FaceForward) 178 179 180 + Store 9(vf) 181 + 182: 7(f16vec) Load 9(vf) + 183: 7(f16vec) Load 9(vf) + 184: 7(f16vec) ExtInst 1(GLSL.std.450) 71(Reflect) 182 183 + Store 9(vf) 184 + 185: 7(f16vec) Load 9(vf) + 186: 7(f16vec) Load 9(vf) + 187:6(float16_t) Load 74(f) + 188: 7(f16vec) ExtInst 1(GLSL.std.450) 72(Refract) 185 186 187 + Store 9(vf) 188 + 189: 7(f16vec) Load 9(vf) + 190: 7(f16vec) Load 9(vf) + 191: 126(bvec) FOrdLessThan 189 190 + Store 128(vb) 191 + 192: 7(f16vec) Load 9(vf) + 193: 7(f16vec) Load 9(vf) + 194: 126(bvec) FOrdLessThanEqual 192 193 + Store 128(vb) 194 + 195: 7(f16vec) Load 9(vf) + 196: 7(f16vec) Load 9(vf) + 197: 126(bvec) FOrdGreaterThan 195 196 + Store 128(vb) 197 + 198: 7(f16vec) Load 9(vf) + 199: 7(f16vec) Load 9(vf) + 200: 126(bvec) FOrdGreaterThanEqual 198 199 + Store 128(vb) 200 + 201: 7(f16vec) Load 9(vf) + 202: 7(f16vec) Load 9(vf) + 203: 126(bvec) FOrdEqual 201 202 + Store 128(vb) 203 + 204: 7(f16vec) Load 9(vf) + 205: 7(f16vec) Load 9(vf) + 206: 126(bvec) FUnordNotEqual 204 205 + Store 128(vb) 206 + 209: 126(bvec) Load 128(vb) + 210: 125(bool) Any 209 + Store 208(b) 210 + 211: 126(bvec) Load 128(vb) + 212: 125(bool) All 211 + Store 208(b) 212 + 213: 126(bvec) Load 128(vb) + 214: 126(bvec) LogicalNot 213 + Store 128(vb) 214 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsfp64.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsfp64.comp.out new file mode 100644 index 0000000000..2be7167679 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsfp64.comp.out @@ -0,0 +1,270 @@ +spv.longVectorBuiltinsfp64.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 186 + + Capability Shader + Capability Float64 + Capability Int64 + Capability LongVectorEXT + Extension "SPV_EXT_long_vector" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vf" + Name 32 "f" + Name 39 "tempReturn" + Name 41 "tempArg" + Name 42 "ResType" + Name 86 "vb" + Name 113 "vi" + Name 119 "vu" + Name 134 "vi32" + Name 135 "ResType" + Decorate 185 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 64 + 7: TypeVector 6(float64_t) 5 + 8: TypePointer Function 7(f64vec) + 31: TypePointer Function 6(float64_t) + 42(ResType): TypeStruct 7(f64vec) 7(f64vec) + 83: TypeBool + 84: TypeVector 83(bool) 5 + 85: TypePointer Function 84(bvec) + 110: TypeInt 64 1 + 111: TypeVector 110(int64_t) 5 + 112: TypePointer Function 111(i64vec) + 116: TypeInt 64 0 + 117: TypeVector 116(int64_t) 5 + 118: TypePointer Function 117(i64vec) + 131: TypeInt 32 1 + 132: TypeVector 131(int) 5 + 133: TypePointer Function 132(ivec) + 135(ResType): TypeStruct 7(f64vec) 132(ivec) + 181: TypeInt 32 0 + 182: TypeVector 181(int) 3 + 183: 181(int) Constant 64 + 184: 181(int) Constant 1 + 185: 182(ivec3) ConstantComposite 183 184 184 + 4(main): 2 Function None 3 + 5: Label + 9(vf): 8(ptr) Variable Function + 32(f): 31(ptr) Variable Function + 39(tempReturn): 8(ptr) Variable Function + 41(tempArg): 8(ptr) Variable Function + 86(vb): 85(ptr) Variable Function + 113(vi): 112(ptr) Variable Function + 119(vu): 118(ptr) Variable Function + 134(vi32): 133(ptr) Variable Function + 10: 7(f64vec) Load 9(vf) + 11: 7(f64vec) ExtInst 1(GLSL.std.450) 31(Sqrt) 10 + Store 9(vf) 11 + 12: 7(f64vec) Load 9(vf) + 13: 7(f64vec) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 12 + Store 9(vf) 13 + 14: 7(f64vec) Load 9(vf) + 15: 7(f64vec) ExtInst 1(GLSL.std.450) 4(FAbs) 14 + Store 9(vf) 15 + 16: 7(f64vec) Load 9(vf) + 17: 7(f64vec) ExtInst 1(GLSL.std.450) 6(FSign) 16 + Store 9(vf) 17 + 18: 7(f64vec) Load 9(vf) + 19: 7(f64vec) ExtInst 1(GLSL.std.450) 8(Floor) 18 + Store 9(vf) 19 + 20: 7(f64vec) Load 9(vf) + 21: 7(f64vec) ExtInst 1(GLSL.std.450) 3(Trunc) 20 + Store 9(vf) 21 + 22: 7(f64vec) Load 9(vf) + 23: 7(f64vec) ExtInst 1(GLSL.std.450) 1(Round) 22 + Store 9(vf) 23 + 24: 7(f64vec) Load 9(vf) + 25: 7(f64vec) ExtInst 1(GLSL.std.450) 2(RoundEven) 24 + Store 9(vf) 25 + 26: 7(f64vec) Load 9(vf) + 27: 7(f64vec) ExtInst 1(GLSL.std.450) 9(Ceil) 26 + Store 9(vf) 27 + 28: 7(f64vec) Load 9(vf) + 29: 7(f64vec) ExtInst 1(GLSL.std.450) 10(Fract) 28 + Store 9(vf) 29 + 30: 7(f64vec) Load 9(vf) + 33:6(float64_t) Load 32(f) + 34: 7(f64vec) CompositeConstruct 33 33 33 33 33 + 35: 7(f64vec) FMod 30 34 + Store 9(vf) 35 + 36: 7(f64vec) Load 9(vf) + 37: 7(f64vec) Load 9(vf) + 38: 7(f64vec) FMod 36 37 + Store 9(vf) 38 + 40: 7(f64vec) Load 9(vf) + 43: 42(ResType) ExtInst 1(GLSL.std.450) 36(ModfStruct) 40 + 44: 7(f64vec) CompositeExtract 43 1 + Store 41(tempArg) 44 + 45: 7(f64vec) CompositeExtract 43 0 + Store 39(tempReturn) 45 + 46: 7(f64vec) Load 41(tempArg) + Store 9(vf) 46 + 47: 7(f64vec) Load 39(tempReturn) + Store 9(vf) 47 + 48: 7(f64vec) Load 9(vf) + 49:6(float64_t) Load 32(f) + 50: 7(f64vec) CompositeConstruct 49 49 49 49 49 + 51: 7(f64vec) ExtInst 1(GLSL.std.450) 37(FMin) 48 50 + Store 9(vf) 51 + 52: 7(f64vec) Load 9(vf) + 53: 7(f64vec) Load 9(vf) + 54: 7(f64vec) ExtInst 1(GLSL.std.450) 37(FMin) 52 53 + Store 9(vf) 54 + 55: 7(f64vec) Load 9(vf) + 56:6(float64_t) Load 32(f) + 57: 7(f64vec) CompositeConstruct 56 56 56 56 56 + 58: 7(f64vec) ExtInst 1(GLSL.std.450) 40(FMax) 55 57 + Store 9(vf) 58 + 59: 7(f64vec) Load 9(vf) + 60: 7(f64vec) Load 9(vf) + 61: 7(f64vec) ExtInst 1(GLSL.std.450) 40(FMax) 59 60 + Store 9(vf) 61 + 62: 7(f64vec) Load 9(vf) + 63:6(float64_t) Load 32(f) + 64:6(float64_t) Load 32(f) + 65: 7(f64vec) CompositeConstruct 63 63 63 63 63 + 66: 7(f64vec) CompositeConstruct 64 64 64 64 64 + 67: 7(f64vec) ExtInst 1(GLSL.std.450) 43(FClamp) 62 65 66 + Store 9(vf) 67 + 68: 7(f64vec) Load 9(vf) + 69: 7(f64vec) Load 9(vf) + 70: 7(f64vec) Load 9(vf) + 71: 7(f64vec) ExtInst 1(GLSL.std.450) 43(FClamp) 68 69 70 + Store 9(vf) 71 + 72: 7(f64vec) Load 9(vf) + 73: 7(f64vec) Load 9(vf) + 74:6(float64_t) Load 32(f) + 75: 7(f64vec) CompositeConstruct 74 74 74 74 74 + 76: 7(f64vec) ExtInst 1(GLSL.std.450) 46(FMix) 72 73 75 + Store 9(vf) 76 + 77: 7(f64vec) Load 9(vf) + 78: 7(f64vec) Load 9(vf) + 79: 7(f64vec) Load 9(vf) + 80: 7(f64vec) ExtInst 1(GLSL.std.450) 46(FMix) 77 78 79 + Store 9(vf) 80 + 81: 7(f64vec) Load 9(vf) + 82: 7(f64vec) Load 9(vf) + 87: 84(bvec) Load 86(vb) + 88: 7(f64vec) Select 87 82 81 + Store 9(vf) 88 + 89: 7(f64vec) Load 9(vf) + 90: 7(f64vec) Load 9(vf) + 91: 7(f64vec) ExtInst 1(GLSL.std.450) 48(Step) 89 90 + Store 9(vf) 91 + 92:6(float64_t) Load 32(f) + 93: 7(f64vec) Load 9(vf) + 94: 7(f64vec) CompositeConstruct 92 92 92 92 92 + 95: 7(f64vec) ExtInst 1(GLSL.std.450) 48(Step) 94 93 + Store 9(vf) 95 + 96: 7(f64vec) Load 9(vf) + 97: 7(f64vec) Load 9(vf) + 98: 7(f64vec) Load 9(vf) + 99: 7(f64vec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 96 97 98 + Store 9(vf) 99 + 100:6(float64_t) Load 32(f) + 101:6(float64_t) Load 32(f) + 102: 7(f64vec) Load 9(vf) + 103: 7(f64vec) CompositeConstruct 100 100 100 100 100 + 104: 7(f64vec) CompositeConstruct 101 101 101 101 101 + 105: 7(f64vec) ExtInst 1(GLSL.std.450) 49(SmoothStep) 103 104 102 + Store 9(vf) 105 + 106: 7(f64vec) Load 9(vf) + 107: 84(bvec) IsNan 106 + Store 86(vb) 107 + 108: 7(f64vec) Load 9(vf) + 109: 84(bvec) IsInf 108 + Store 86(vb) 109 + 114: 7(f64vec) Load 9(vf) + 115: 111(i64vec) Bitcast 114 + Store 113(vi) 115 + 120: 7(f64vec) Load 9(vf) + 121: 117(i64vec) Bitcast 120 + Store 119(vu) 121 + 122: 111(i64vec) Load 113(vi) + 123: 7(f64vec) Bitcast 122 + Store 9(vf) 123 + 124: 117(i64vec) Load 119(vu) + 125: 7(f64vec) Bitcast 124 + Store 9(vf) 125 + 126: 7(f64vec) Load 9(vf) + 127: 7(f64vec) Load 9(vf) + 128: 7(f64vec) Load 9(vf) + 129: 7(f64vec) ExtInst 1(GLSL.std.450) 50(Fma) 126 127 128 + Store 9(vf) 129 + 130: 7(f64vec) Load 9(vf) + 136:135(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 130 + 137: 132(ivec) CompositeExtract 136 1 + Store 134(vi32) 137 + 138: 7(f64vec) CompositeExtract 136 0 + Store 9(vf) 138 + 139: 7(f64vec) Load 9(vf) + 140: 132(ivec) Load 134(vi32) + 141: 7(f64vec) ExtInst 1(GLSL.std.450) 53(Ldexp) 139 140 + Store 9(vf) 141 + 142: 7(f64vec) Load 9(vf) + 143:6(float64_t) ExtInst 1(GLSL.std.450) 66(Length) 142 + Store 32(f) 143 + 144: 7(f64vec) Load 9(vf) + 145: 7(f64vec) Load 9(vf) + 146:6(float64_t) ExtInst 1(GLSL.std.450) 67(Distance) 144 145 + Store 32(f) 146 + 147: 7(f64vec) Load 9(vf) + 148: 7(f64vec) Load 9(vf) + 149:6(float64_t) Dot 147 148 + Store 32(f) 149 + 150: 7(f64vec) Load 9(vf) + 151: 7(f64vec) ExtInst 1(GLSL.std.450) 69(Normalize) 150 + Store 9(vf) 151 + 152: 7(f64vec) Load 9(vf) + 153: 7(f64vec) Load 9(vf) + 154: 7(f64vec) Load 9(vf) + 155: 7(f64vec) ExtInst 1(GLSL.std.450) 70(FaceForward) 152 153 154 + Store 9(vf) 155 + 156: 7(f64vec) Load 9(vf) + 157: 7(f64vec) Load 9(vf) + 158: 7(f64vec) ExtInst 1(GLSL.std.450) 71(Reflect) 156 157 + Store 9(vf) 158 + 159: 7(f64vec) Load 9(vf) + 160: 7(f64vec) Load 9(vf) + 161:6(float64_t) Load 32(f) + 162: 7(f64vec) ExtInst 1(GLSL.std.450) 72(Refract) 159 160 161 + Store 9(vf) 162 + 163: 7(f64vec) Load 9(vf) + 164: 7(f64vec) Load 9(vf) + 165: 84(bvec) FOrdLessThan 163 164 + Store 86(vb) 165 + 166: 7(f64vec) Load 9(vf) + 167: 7(f64vec) Load 9(vf) + 168: 84(bvec) FOrdLessThanEqual 166 167 + Store 86(vb) 168 + 169: 7(f64vec) Load 9(vf) + 170: 7(f64vec) Load 9(vf) + 171: 84(bvec) FOrdGreaterThan 169 170 + Store 86(vb) 171 + 172: 7(f64vec) Load 9(vf) + 173: 7(f64vec) Load 9(vf) + 174: 84(bvec) FOrdGreaterThanEqual 172 173 + Store 86(vb) 174 + 175: 7(f64vec) Load 9(vf) + 176: 7(f64vec) Load 9(vf) + 177: 84(bvec) FOrdEqual 175 176 + Store 86(vb) 177 + 178: 7(f64vec) Load 9(vf) + 179: 7(f64vec) Load 9(vf) + 180: 84(bvec) FUnordNotEqual 178 179 + Store 86(vb) 180 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint16.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint16.comp.out new file mode 100644 index 0000000000..0613c983f9 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint16.comp.out @@ -0,0 +1,159 @@ +spv.longVectorBuiltinsint16.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 106 + + Capability Shader + Capability Int16 + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vi" + Name 12 "i" + Name 41 "vb" + Name 64 "tempArg" + Name 65 "tempArg" + Name 66 "ResType" + Decorate 105 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 16 1 + 7: TypeVector 6(int16_t) 5 + 8: TypePointer Function 7(i16vec) + 11: TypePointer Function 6(int16_t) + 38: TypeBool + 39: TypeVector 38(bool) 5 + 40: TypePointer Function 39(bvec) + 66(ResType): TypeStruct 7(i16vec) 7(i16vec) + 74: TypeInt 32 1 + 101: TypeInt 32 0 + 102: TypeVector 101(int) 3 + 103: 101(int) Constant 64 + 104: 101(int) Constant 1 + 105: 102(ivec3) ConstantComposite 103 104 104 + 4(main): 2 Function None 3 + 5: Label + 9(vi): 8(ptr) Variable Function + 12(i): 11(ptr) Variable Function + 41(vb): 40(ptr) Variable Function + 64(tempArg): 8(ptr) Variable Function + 65(tempArg): 8(ptr) Variable Function + 10: 7(i16vec) Load 9(vi) + 13: 6(int16_t) Load 12(i) + 14: 7(i16vec) CompositeConstruct 13 13 13 13 13 + 15: 7(i16vec) ExtInst 1(GLSL.std.450) 39(SMin) 10 14 + Store 9(vi) 15 + 16: 7(i16vec) Load 9(vi) + 17: 7(i16vec) Load 9(vi) + 18: 7(i16vec) ExtInst 1(GLSL.std.450) 39(SMin) 16 17 + Store 9(vi) 18 + 19: 7(i16vec) Load 9(vi) + 20: 6(int16_t) Load 12(i) + 21: 7(i16vec) CompositeConstruct 20 20 20 20 20 + 22: 7(i16vec) ExtInst 1(GLSL.std.450) 42(SMax) 19 21 + Store 9(vi) 22 + 23: 7(i16vec) Load 9(vi) + 24: 7(i16vec) Load 9(vi) + 25: 7(i16vec) ExtInst 1(GLSL.std.450) 42(SMax) 23 24 + Store 9(vi) 25 + 26: 7(i16vec) Load 9(vi) + 27: 6(int16_t) Load 12(i) + 28: 6(int16_t) Load 12(i) + 29: 7(i16vec) CompositeConstruct 27 27 27 27 27 + 30: 7(i16vec) CompositeConstruct 28 28 28 28 28 + 31: 7(i16vec) ExtInst 1(GLSL.std.450) 45(SClamp) 26 29 30 + Store 9(vi) 31 + 32: 7(i16vec) Load 9(vi) + 33: 7(i16vec) Load 9(vi) + 34: 7(i16vec) Load 9(vi) + 35: 7(i16vec) ExtInst 1(GLSL.std.450) 45(SClamp) 32 33 34 + Store 9(vi) 35 + 36: 7(i16vec) Load 9(vi) + 37: 7(i16vec) Load 9(vi) + 42: 39(bvec) Load 41(vb) + 43: 7(i16vec) Select 42 37 36 + Store 9(vi) 43 + 44: 7(i16vec) Load 9(vi) + 45: 7(i16vec) Load 9(vi) + 46: 39(bvec) SLessThan 44 45 + Store 41(vb) 46 + 47: 7(i16vec) Load 9(vi) + 48: 7(i16vec) Load 9(vi) + 49: 39(bvec) SLessThanEqual 47 48 + Store 41(vb) 49 + 50: 7(i16vec) Load 9(vi) + 51: 7(i16vec) Load 9(vi) + 52: 39(bvec) SGreaterThan 50 51 + Store 41(vb) 52 + 53: 7(i16vec) Load 9(vi) + 54: 7(i16vec) Load 9(vi) + 55: 39(bvec) SGreaterThanEqual 53 54 + Store 41(vb) 55 + 56: 7(i16vec) Load 9(vi) + 57: 7(i16vec) Load 9(vi) + 58: 39(bvec) IEqual 56 57 + Store 41(vb) 58 + 59: 7(i16vec) Load 9(vi) + 60: 7(i16vec) Load 9(vi) + 61: 39(bvec) INotEqual 59 60 + Store 41(vb) 61 + 62: 7(i16vec) Load 9(vi) + 63: 7(i16vec) Load 9(vi) + 67: 66(ResType) SMulExtended 62 63 + 68: 7(i16vec) CompositeExtract 67 0 + Store 65(tempArg) 68 + 69: 7(i16vec) CompositeExtract 67 1 + Store 64(tempArg) 69 + 70: 7(i16vec) Load 64(tempArg) + Store 9(vi) 70 + 71: 7(i16vec) Load 65(tempArg) + Store 9(vi) 71 + 72: 7(i16vec) Load 9(vi) + 73: 6(int16_t) Load 12(i) + 75: 74(int) SConvert 73 + 76: 6(int16_t) Load 12(i) + 77: 74(int) SConvert 76 + 78: 7(i16vec) BitFieldSExtract 72 75 77 + Store 9(vi) 78 + 79: 7(i16vec) Load 9(vi) + 80: 7(i16vec) Load 9(vi) + 81: 6(int16_t) Load 12(i) + 82: 74(int) SConvert 81 + 83: 6(int16_t) Load 12(i) + 84: 74(int) SConvert 83 + 85: 7(i16vec) BitFieldInsert 79 80 82 84 + Store 9(vi) 85 + 86: 7(i16vec) Load 9(vi) + 87: 7(i16vec) BitReverse 86 + Store 9(vi) 87 + 88: 7(i16vec) Load 9(vi) + 89: 7(i16vec) BitCount 88 + Store 9(vi) 89 + 90: 7(i16vec) Load 9(vi) + 91: 7(i16vec) Load 9(vi) + 92: 39(bvec) Load 41(vb) + 93: 7(i16vec) Select 92 91 90 + Store 9(vi) 93 + 94: 39(bvec) Load 41(vb) + 95: 39(bvec) Load 41(vb) + 96: 39(bvec) Load 41(vb) + 97: 39(bvec) Select 96 95 94 + Store 41(vb) 97 + 98: 7(i16vec) Load 9(vi) + 99: 7(i16vec) Load 9(vi) + 100: 7(i16vec) ExpectKHR 98 99 + Store 9(vi) 100 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint32.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint32.comp.out new file mode 100644 index 0000000000..9edfd7b967 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint32.comp.out @@ -0,0 +1,159 @@ +spv.longVectorBuiltinsint32.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 105 + + Capability Shader + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vi" + Name 12 "i" + Name 41 "vb" + Name 64 "tempArg" + Name 65 "tempArg" + Name 66 "ResType" + Decorate 104 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypeVector 6(int) 5 + 8: TypePointer Function 7(ivec) + 11: TypePointer Function 6(int) + 38: TypeBool + 39: TypeVector 38(bool) 5 + 40: TypePointer Function 39(bvec) + 66(ResType): TypeStruct 7(ivec) 7(ivec) + 100: TypeInt 32 0 + 101: TypeVector 100(int) 3 + 102: 100(int) Constant 64 + 103: 100(int) Constant 1 + 104: 101(ivec3) ConstantComposite 102 103 103 + 4(main): 2 Function None 3 + 5: Label + 9(vi): 8(ptr) Variable Function + 12(i): 11(ptr) Variable Function + 41(vb): 40(ptr) Variable Function + 64(tempArg): 8(ptr) Variable Function + 65(tempArg): 8(ptr) Variable Function + 10: 7(ivec) Load 9(vi) + 13: 6(int) Load 12(i) + 14: 7(ivec) CompositeConstruct 13 13 13 13 13 + 15: 7(ivec) ExtInst 1(GLSL.std.450) 39(SMin) 10 14 + Store 9(vi) 15 + 16: 7(ivec) Load 9(vi) + 17: 7(ivec) Load 9(vi) + 18: 7(ivec) ExtInst 1(GLSL.std.450) 39(SMin) 16 17 + Store 9(vi) 18 + 19: 7(ivec) Load 9(vi) + 20: 6(int) Load 12(i) + 21: 7(ivec) CompositeConstruct 20 20 20 20 20 + 22: 7(ivec) ExtInst 1(GLSL.std.450) 42(SMax) 19 21 + Store 9(vi) 22 + 23: 7(ivec) Load 9(vi) + 24: 7(ivec) Load 9(vi) + 25: 7(ivec) ExtInst 1(GLSL.std.450) 42(SMax) 23 24 + Store 9(vi) 25 + 26: 7(ivec) Load 9(vi) + 27: 6(int) Load 12(i) + 28: 6(int) Load 12(i) + 29: 7(ivec) CompositeConstruct 27 27 27 27 27 + 30: 7(ivec) CompositeConstruct 28 28 28 28 28 + 31: 7(ivec) ExtInst 1(GLSL.std.450) 45(SClamp) 26 29 30 + Store 9(vi) 31 + 32: 7(ivec) Load 9(vi) + 33: 7(ivec) Load 9(vi) + 34: 7(ivec) Load 9(vi) + 35: 7(ivec) ExtInst 1(GLSL.std.450) 45(SClamp) 32 33 34 + Store 9(vi) 35 + 36: 7(ivec) Load 9(vi) + 37: 7(ivec) Load 9(vi) + 42: 39(bvec) Load 41(vb) + 43: 7(ivec) Select 42 37 36 + Store 9(vi) 43 + 44: 7(ivec) Load 9(vi) + 45: 7(ivec) Load 9(vi) + 46: 39(bvec) SLessThan 44 45 + Store 41(vb) 46 + 47: 7(ivec) Load 9(vi) + 48: 7(ivec) Load 9(vi) + 49: 39(bvec) SLessThanEqual 47 48 + Store 41(vb) 49 + 50: 7(ivec) Load 9(vi) + 51: 7(ivec) Load 9(vi) + 52: 39(bvec) SGreaterThan 50 51 + Store 41(vb) 52 + 53: 7(ivec) Load 9(vi) + 54: 7(ivec) Load 9(vi) + 55: 39(bvec) SGreaterThanEqual 53 54 + Store 41(vb) 55 + 56: 7(ivec) Load 9(vi) + 57: 7(ivec) Load 9(vi) + 58: 39(bvec) IEqual 56 57 + Store 41(vb) 58 + 59: 7(ivec) Load 9(vi) + 60: 7(ivec) Load 9(vi) + 61: 39(bvec) INotEqual 59 60 + Store 41(vb) 61 + 62: 7(ivec) Load 9(vi) + 63: 7(ivec) Load 9(vi) + 67: 66(ResType) SMulExtended 62 63 + 68: 7(ivec) CompositeExtract 67 0 + Store 65(tempArg) 68 + 69: 7(ivec) CompositeExtract 67 1 + Store 64(tempArg) 69 + 70: 7(ivec) Load 64(tempArg) + Store 9(vi) 70 + 71: 7(ivec) Load 65(tempArg) + Store 9(vi) 71 + 72: 7(ivec) Load 9(vi) + 73: 6(int) Load 12(i) + 74: 6(int) Load 12(i) + 75: 7(ivec) BitFieldSExtract 72 73 74 + Store 9(vi) 75 + 76: 7(ivec) Load 9(vi) + 77: 7(ivec) Load 9(vi) + 78: 6(int) Load 12(i) + 79: 6(int) Load 12(i) + 80: 7(ivec) BitFieldInsert 76 77 78 79 + Store 9(vi) 80 + 81: 7(ivec) Load 9(vi) + 82: 7(ivec) BitReverse 81 + Store 9(vi) 82 + 83: 7(ivec) Load 9(vi) + 84: 7(ivec) BitCount 83 + Store 9(vi) 84 + 85: 7(ivec) Load 9(vi) + 86: 7(ivec) ExtInst 1(GLSL.std.450) 73(FindILsb) 85 + Store 9(vi) 86 + 87: 7(ivec) Load 9(vi) + 88: 7(ivec) ExtInst 1(GLSL.std.450) 74(FindSMsb) 87 + Store 9(vi) 88 + 89: 7(ivec) Load 9(vi) + 90: 7(ivec) Load 9(vi) + 91: 39(bvec) Load 41(vb) + 92: 7(ivec) Select 91 90 89 + Store 9(vi) 92 + 93: 39(bvec) Load 41(vb) + 94: 39(bvec) Load 41(vb) + 95: 39(bvec) Load 41(vb) + 96: 39(bvec) Select 95 94 93 + Store 41(vb) 96 + 97: 7(ivec) Load 9(vi) + 98: 7(ivec) Load 9(vi) + 99: 7(ivec) ExpectKHR 97 98 + Store 9(vi) 99 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint64.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint64.comp.out new file mode 100644 index 0000000000..121907b36f --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint64.comp.out @@ -0,0 +1,140 @@ +spv.longVectorBuiltinsint64.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 90 + + Capability Shader + Capability Int64 + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vi" + Name 12 "i" + Name 41 "vb" + Name 64 "tempArg" + Name 65 "tempArg" + Name 66 "ResType" + Decorate 89 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 64 1 + 7: TypeVector 6(int64_t) 5 + 8: TypePointer Function 7(i64vec) + 11: TypePointer Function 6(int64_t) + 38: TypeBool + 39: TypeVector 38(bool) 5 + 40: TypePointer Function 39(bvec) + 66(ResType): TypeStruct 7(i64vec) 7(i64vec) + 85: TypeInt 32 0 + 86: TypeVector 85(int) 3 + 87: 85(int) Constant 64 + 88: 85(int) Constant 1 + 89: 86(ivec3) ConstantComposite 87 88 88 + 4(main): 2 Function None 3 + 5: Label + 9(vi): 8(ptr) Variable Function + 12(i): 11(ptr) Variable Function + 41(vb): 40(ptr) Variable Function + 64(tempArg): 8(ptr) Variable Function + 65(tempArg): 8(ptr) Variable Function + 10: 7(i64vec) Load 9(vi) + 13: 6(int64_t) Load 12(i) + 14: 7(i64vec) CompositeConstruct 13 13 13 13 13 + 15: 7(i64vec) ExtInst 1(GLSL.std.450) 39(SMin) 10 14 + Store 9(vi) 15 + 16: 7(i64vec) Load 9(vi) + 17: 7(i64vec) Load 9(vi) + 18: 7(i64vec) ExtInst 1(GLSL.std.450) 39(SMin) 16 17 + Store 9(vi) 18 + 19: 7(i64vec) Load 9(vi) + 20: 6(int64_t) Load 12(i) + 21: 7(i64vec) CompositeConstruct 20 20 20 20 20 + 22: 7(i64vec) ExtInst 1(GLSL.std.450) 42(SMax) 19 21 + Store 9(vi) 22 + 23: 7(i64vec) Load 9(vi) + 24: 7(i64vec) Load 9(vi) + 25: 7(i64vec) ExtInst 1(GLSL.std.450) 42(SMax) 23 24 + Store 9(vi) 25 + 26: 7(i64vec) Load 9(vi) + 27: 6(int64_t) Load 12(i) + 28: 6(int64_t) Load 12(i) + 29: 7(i64vec) CompositeConstruct 27 27 27 27 27 + 30: 7(i64vec) CompositeConstruct 28 28 28 28 28 + 31: 7(i64vec) ExtInst 1(GLSL.std.450) 45(SClamp) 26 29 30 + Store 9(vi) 31 + 32: 7(i64vec) Load 9(vi) + 33: 7(i64vec) Load 9(vi) + 34: 7(i64vec) Load 9(vi) + 35: 7(i64vec) ExtInst 1(GLSL.std.450) 45(SClamp) 32 33 34 + Store 9(vi) 35 + 36: 7(i64vec) Load 9(vi) + 37: 7(i64vec) Load 9(vi) + 42: 39(bvec) Load 41(vb) + 43: 7(i64vec) Select 42 37 36 + Store 9(vi) 43 + 44: 7(i64vec) Load 9(vi) + 45: 7(i64vec) Load 9(vi) + 46: 39(bvec) SLessThan 44 45 + Store 41(vb) 46 + 47: 7(i64vec) Load 9(vi) + 48: 7(i64vec) Load 9(vi) + 49: 39(bvec) SLessThanEqual 47 48 + Store 41(vb) 49 + 50: 7(i64vec) Load 9(vi) + 51: 7(i64vec) Load 9(vi) + 52: 39(bvec) SGreaterThan 50 51 + Store 41(vb) 52 + 53: 7(i64vec) Load 9(vi) + 54: 7(i64vec) Load 9(vi) + 55: 39(bvec) SGreaterThanEqual 53 54 + Store 41(vb) 55 + 56: 7(i64vec) Load 9(vi) + 57: 7(i64vec) Load 9(vi) + 58: 39(bvec) IEqual 56 57 + Store 41(vb) 58 + 59: 7(i64vec) Load 9(vi) + 60: 7(i64vec) Load 9(vi) + 61: 39(bvec) INotEqual 59 60 + Store 41(vb) 61 + 62: 7(i64vec) Load 9(vi) + 63: 7(i64vec) Load 9(vi) + 67: 66(ResType) SMulExtended 62 63 + 68: 7(i64vec) CompositeExtract 67 0 + Store 65(tempArg) 68 + 69: 7(i64vec) CompositeExtract 67 1 + Store 64(tempArg) 69 + 70: 7(i64vec) Load 64(tempArg) + Store 9(vi) 70 + 71: 7(i64vec) Load 65(tempArg) + Store 9(vi) 71 + 72: 7(i64vec) Load 9(vi) + 73: 7(i64vec) BitCount 72 + Store 9(vi) 73 + 74: 7(i64vec) Load 9(vi) + 75: 7(i64vec) Load 9(vi) + 76: 39(bvec) Load 41(vb) + 77: 7(i64vec) Select 76 75 74 + Store 9(vi) 77 + 78: 39(bvec) Load 41(vb) + 79: 39(bvec) Load 41(vb) + 80: 39(bvec) Load 41(vb) + 81: 39(bvec) Select 80 79 78 + Store 41(vb) 81 + 82: 7(i64vec) Load 9(vi) + 83: 7(i64vec) Load 9(vi) + 84: 7(i64vec) ExpectKHR 82 83 + Store 9(vi) 84 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint8.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint8.comp.out new file mode 100644 index 0000000000..dae18dd5af --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsint8.comp.out @@ -0,0 +1,159 @@ +spv.longVectorBuiltinsint8.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 106 + + Capability Shader + Capability Int8 + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vi" + Name 12 "i" + Name 41 "vb" + Name 64 "tempArg" + Name 65 "tempArg" + Name 66 "ResType" + Decorate 105 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 8 1 + 7: TypeVector 6(int8_t) 5 + 8: TypePointer Function 7(i8vec) + 11: TypePointer Function 6(int8_t) + 38: TypeBool + 39: TypeVector 38(bool) 5 + 40: TypePointer Function 39(bvec) + 66(ResType): TypeStruct 7(i8vec) 7(i8vec) + 74: TypeInt 32 1 + 101: TypeInt 32 0 + 102: TypeVector 101(int) 3 + 103: 101(int) Constant 64 + 104: 101(int) Constant 1 + 105: 102(ivec3) ConstantComposite 103 104 104 + 4(main): 2 Function None 3 + 5: Label + 9(vi): 8(ptr) Variable Function + 12(i): 11(ptr) Variable Function + 41(vb): 40(ptr) Variable Function + 64(tempArg): 8(ptr) Variable Function + 65(tempArg): 8(ptr) Variable Function + 10: 7(i8vec) Load 9(vi) + 13: 6(int8_t) Load 12(i) + 14: 7(i8vec) CompositeConstruct 13 13 13 13 13 + 15: 7(i8vec) ExtInst 1(GLSL.std.450) 39(SMin) 10 14 + Store 9(vi) 15 + 16: 7(i8vec) Load 9(vi) + 17: 7(i8vec) Load 9(vi) + 18: 7(i8vec) ExtInst 1(GLSL.std.450) 39(SMin) 16 17 + Store 9(vi) 18 + 19: 7(i8vec) Load 9(vi) + 20: 6(int8_t) Load 12(i) + 21: 7(i8vec) CompositeConstruct 20 20 20 20 20 + 22: 7(i8vec) ExtInst 1(GLSL.std.450) 42(SMax) 19 21 + Store 9(vi) 22 + 23: 7(i8vec) Load 9(vi) + 24: 7(i8vec) Load 9(vi) + 25: 7(i8vec) ExtInst 1(GLSL.std.450) 42(SMax) 23 24 + Store 9(vi) 25 + 26: 7(i8vec) Load 9(vi) + 27: 6(int8_t) Load 12(i) + 28: 6(int8_t) Load 12(i) + 29: 7(i8vec) CompositeConstruct 27 27 27 27 27 + 30: 7(i8vec) CompositeConstruct 28 28 28 28 28 + 31: 7(i8vec) ExtInst 1(GLSL.std.450) 45(SClamp) 26 29 30 + Store 9(vi) 31 + 32: 7(i8vec) Load 9(vi) + 33: 7(i8vec) Load 9(vi) + 34: 7(i8vec) Load 9(vi) + 35: 7(i8vec) ExtInst 1(GLSL.std.450) 45(SClamp) 32 33 34 + Store 9(vi) 35 + 36: 7(i8vec) Load 9(vi) + 37: 7(i8vec) Load 9(vi) + 42: 39(bvec) Load 41(vb) + 43: 7(i8vec) Select 42 37 36 + Store 9(vi) 43 + 44: 7(i8vec) Load 9(vi) + 45: 7(i8vec) Load 9(vi) + 46: 39(bvec) SLessThan 44 45 + Store 41(vb) 46 + 47: 7(i8vec) Load 9(vi) + 48: 7(i8vec) Load 9(vi) + 49: 39(bvec) SLessThanEqual 47 48 + Store 41(vb) 49 + 50: 7(i8vec) Load 9(vi) + 51: 7(i8vec) Load 9(vi) + 52: 39(bvec) SGreaterThan 50 51 + Store 41(vb) 52 + 53: 7(i8vec) Load 9(vi) + 54: 7(i8vec) Load 9(vi) + 55: 39(bvec) SGreaterThanEqual 53 54 + Store 41(vb) 55 + 56: 7(i8vec) Load 9(vi) + 57: 7(i8vec) Load 9(vi) + 58: 39(bvec) IEqual 56 57 + Store 41(vb) 58 + 59: 7(i8vec) Load 9(vi) + 60: 7(i8vec) Load 9(vi) + 61: 39(bvec) INotEqual 59 60 + Store 41(vb) 61 + 62: 7(i8vec) Load 9(vi) + 63: 7(i8vec) Load 9(vi) + 67: 66(ResType) SMulExtended 62 63 + 68: 7(i8vec) CompositeExtract 67 0 + Store 65(tempArg) 68 + 69: 7(i8vec) CompositeExtract 67 1 + Store 64(tempArg) 69 + 70: 7(i8vec) Load 64(tempArg) + Store 9(vi) 70 + 71: 7(i8vec) Load 65(tempArg) + Store 9(vi) 71 + 72: 7(i8vec) Load 9(vi) + 73: 6(int8_t) Load 12(i) + 75: 74(int) SConvert 73 + 76: 6(int8_t) Load 12(i) + 77: 74(int) SConvert 76 + 78: 7(i8vec) BitFieldSExtract 72 75 77 + Store 9(vi) 78 + 79: 7(i8vec) Load 9(vi) + 80: 7(i8vec) Load 9(vi) + 81: 6(int8_t) Load 12(i) + 82: 74(int) SConvert 81 + 83: 6(int8_t) Load 12(i) + 84: 74(int) SConvert 83 + 85: 7(i8vec) BitFieldInsert 79 80 82 84 + Store 9(vi) 85 + 86: 7(i8vec) Load 9(vi) + 87: 7(i8vec) BitReverse 86 + Store 9(vi) 87 + 88: 7(i8vec) Load 9(vi) + 89: 7(i8vec) BitCount 88 + Store 9(vi) 89 + 90: 7(i8vec) Load 9(vi) + 91: 7(i8vec) Load 9(vi) + 92: 39(bvec) Load 41(vb) + 93: 7(i8vec) Select 92 91 90 + Store 9(vi) 93 + 94: 39(bvec) Load 41(vb) + 95: 39(bvec) Load 41(vb) + 96: 39(bvec) Load 41(vb) + 97: 39(bvec) Select 96 95 94 + Store 41(vb) 97 + 98: 7(i8vec) Load 9(vi) + 99: 7(i8vec) Load 9(vi) + 100: 7(i8vec) ExpectKHR 98 99 + Store 9(vi) 100 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint16.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint16.comp.out new file mode 100644 index 0000000000..99142ffe54 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint16.comp.out @@ -0,0 +1,197 @@ +spv.longVectorBuiltinsuint16.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 130 + + Capability Shader + Capability Int16 + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vu" + Name 12 "u" + Name 41 "vb" + Name 62 "tempReturn" + Name 65 "tempArg" + Name 66 "ResType" + Name 72 "tempReturn" + Name 75 "tempArg" + Name 83 "tempArg" + Name 84 "tempArg" + Name 93 "i" + Name 111 "vi" + Decorate 129 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 16 0 + 7: TypeVector 6(int16_t) 5 + 8: TypePointer Function 7(i16vec) + 11: TypePointer Function 6(int16_t) + 38: TypeBool + 39: TypeVector 38(bool) 5 + 40: TypePointer Function 39(bvec) + 66(ResType): TypeStruct 7(i16vec) 7(i16vec) + 91: TypeInt 16 1 + 92: TypePointer Function 91(int16_t) + 95: TypeInt 32 1 + 109: TypeVector 91(int16_t) 5 + 110: TypePointer Function 109(i16vec) + 125: TypeInt 32 0 + 126: TypeVector 125(int) 3 + 127: 125(int) Constant 64 + 128: 125(int) Constant 1 + 129: 126(ivec3) ConstantComposite 127 128 128 + 4(main): 2 Function None 3 + 5: Label + 9(vu): 8(ptr) Variable Function + 12(u): 11(ptr) Variable Function + 41(vb): 40(ptr) Variable Function + 62(tempReturn): 8(ptr) Variable Function + 65(tempArg): 8(ptr) Variable Function + 72(tempReturn): 8(ptr) Variable Function + 75(tempArg): 8(ptr) Variable Function + 83(tempArg): 8(ptr) Variable Function + 84(tempArg): 8(ptr) Variable Function + 93(i): 92(ptr) Variable Function + 111(vi): 110(ptr) Variable Function + 10: 7(i16vec) Load 9(vu) + 13: 6(int16_t) Load 12(u) + 14: 7(i16vec) CompositeConstruct 13 13 13 13 13 + 15: 7(i16vec) ExtInst 1(GLSL.std.450) 38(UMin) 10 14 + Store 9(vu) 15 + 16: 7(i16vec) Load 9(vu) + 17: 7(i16vec) Load 9(vu) + 18: 7(i16vec) ExtInst 1(GLSL.std.450) 38(UMin) 16 17 + Store 9(vu) 18 + 19: 7(i16vec) Load 9(vu) + 20: 6(int16_t) Load 12(u) + 21: 7(i16vec) CompositeConstruct 20 20 20 20 20 + 22: 7(i16vec) ExtInst 1(GLSL.std.450) 41(UMax) 19 21 + Store 9(vu) 22 + 23: 7(i16vec) Load 9(vu) + 24: 7(i16vec) Load 9(vu) + 25: 7(i16vec) ExtInst 1(GLSL.std.450) 41(UMax) 23 24 + Store 9(vu) 25 + 26: 7(i16vec) Load 9(vu) + 27: 6(int16_t) Load 12(u) + 28: 6(int16_t) Load 12(u) + 29: 7(i16vec) CompositeConstruct 27 27 27 27 27 + 30: 7(i16vec) CompositeConstruct 28 28 28 28 28 + 31: 7(i16vec) ExtInst 1(GLSL.std.450) 44(UClamp) 26 29 30 + Store 9(vu) 31 + 32: 7(i16vec) Load 9(vu) + 33: 7(i16vec) Load 9(vu) + 34: 7(i16vec) Load 9(vu) + 35: 7(i16vec) ExtInst 1(GLSL.std.450) 44(UClamp) 32 33 34 + Store 9(vu) 35 + 36: 7(i16vec) Load 9(vu) + 37: 7(i16vec) Load 9(vu) + 42: 39(bvec) Load 41(vb) + 43: 7(i16vec) Select 42 37 36 + Store 9(vu) 43 + 44: 7(i16vec) Load 9(vu) + 45: 7(i16vec) Load 9(vu) + 46: 39(bvec) ULessThan 44 45 + Store 41(vb) 46 + 47: 7(i16vec) Load 9(vu) + 48: 7(i16vec) Load 9(vu) + 49: 39(bvec) ULessThanEqual 47 48 + Store 41(vb) 49 + 50: 7(i16vec) Load 9(vu) + 51: 7(i16vec) Load 9(vu) + 52: 39(bvec) UGreaterThan 50 51 + Store 41(vb) 52 + 53: 7(i16vec) Load 9(vu) + 54: 7(i16vec) Load 9(vu) + 55: 39(bvec) UGreaterThanEqual 53 54 + Store 41(vb) 55 + 56: 7(i16vec) Load 9(vu) + 57: 7(i16vec) Load 9(vu) + 58: 39(bvec) IEqual 56 57 + Store 41(vb) 58 + 59: 7(i16vec) Load 9(vu) + 60: 7(i16vec) Load 9(vu) + 61: 39(bvec) INotEqual 59 60 + Store 41(vb) 61 + 63: 7(i16vec) Load 9(vu) + 64: 7(i16vec) Load 9(vu) + 67: 66(ResType) IAddCarry 63 64 + 68: 7(i16vec) CompositeExtract 67 1 + Store 65(tempArg) 68 + 69: 7(i16vec) CompositeExtract 67 0 + Store 62(tempReturn) 69 + 70: 7(i16vec) Load 65(tempArg) + Store 9(vu) 70 + 71: 7(i16vec) Load 62(tempReturn) + Store 9(vu) 71 + 73: 7(i16vec) Load 9(vu) + 74: 7(i16vec) Load 9(vu) + 76: 66(ResType) ISubBorrow 73 74 + 77: 7(i16vec) CompositeExtract 76 1 + Store 75(tempArg) 77 + 78: 7(i16vec) CompositeExtract 76 0 + Store 72(tempReturn) 78 + 79: 7(i16vec) Load 75(tempArg) + Store 9(vu) 79 + 80: 7(i16vec) Load 72(tempReturn) + Store 9(vu) 80 + 81: 7(i16vec) Load 9(vu) + 82: 7(i16vec) Load 9(vu) + 85: 66(ResType) UMulExtended 81 82 + 86: 7(i16vec) CompositeExtract 85 0 + Store 84(tempArg) 86 + 87: 7(i16vec) CompositeExtract 85 1 + Store 83(tempArg) 87 + 88: 7(i16vec) Load 83(tempArg) + Store 9(vu) 88 + 89: 7(i16vec) Load 84(tempArg) + Store 9(vu) 89 + 90: 7(i16vec) Load 9(vu) + 94: 91(int16_t) Load 93(i) + 96: 95(int) SConvert 94 + 97: 91(int16_t) Load 93(i) + 98: 95(int) SConvert 97 + 99: 7(i16vec) BitFieldUExtract 90 96 98 + Store 9(vu) 99 + 100: 7(i16vec) Load 9(vu) + 101: 7(i16vec) Load 9(vu) + 102: 91(int16_t) Load 93(i) + 103: 95(int) SConvert 102 + 104: 91(int16_t) Load 93(i) + 105: 95(int) SConvert 104 + 106: 7(i16vec) BitFieldInsert 100 101 103 105 + Store 9(vu) 106 + 107: 7(i16vec) Load 9(vu) + 108: 7(i16vec) BitReverse 107 + Store 9(vu) 108 + 112: 7(i16vec) Load 9(vu) + 113: 109(i16vec) BitCount 112 + Store 111(vi) 113 + 114: 7(i16vec) Load 9(vu) + 115: 7(i16vec) Load 9(vu) + 116: 39(bvec) Load 41(vb) + 117: 7(i16vec) Select 116 115 114 + Store 9(vu) 117 + 118: 39(bvec) Load 41(vb) + 119: 39(bvec) Load 41(vb) + 120: 39(bvec) Load 41(vb) + 121: 39(bvec) Select 120 119 118 + Store 41(vb) 121 + 122: 7(i16vec) Load 9(vu) + 123: 7(i16vec) Load 9(vu) + 124: 7(i16vec) ExpectKHR 122 123 + Store 9(vu) 124 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint32.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint32.comp.out new file mode 100644 index 0000000000..0315676366 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint32.comp.out @@ -0,0 +1,196 @@ +spv.longVectorBuiltinsuint32.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 128 + + Capability Shader + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vu" + Name 12 "u" + Name 41 "vb" + Name 62 "tempReturn" + Name 65 "tempArg" + Name 66 "ResType" + Name 72 "tempReturn" + Name 75 "tempArg" + Name 83 "tempArg" + Name 84 "tempArg" + Name 93 "i" + Name 106 "vi" + Decorate 127 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 5 + 8: TypePointer Function 7(ivec) + 11: TypePointer Function 6(int) + 38: TypeBool + 39: TypeVector 38(bool) 5 + 40: TypePointer Function 39(bvec) + 66(ResType): TypeStruct 7(ivec) 7(ivec) + 91: TypeInt 32 1 + 92: TypePointer Function 91(int) + 104: TypeVector 91(int) 5 + 105: TypePointer Function 104(ivec) + 124: TypeVector 6(int) 3 + 125: 6(int) Constant 64 + 126: 6(int) Constant 1 + 127: 124(ivec3) ConstantComposite 125 126 126 + 4(main): 2 Function None 3 + 5: Label + 9(vu): 8(ptr) Variable Function + 12(u): 11(ptr) Variable Function + 41(vb): 40(ptr) Variable Function + 62(tempReturn): 8(ptr) Variable Function + 65(tempArg): 8(ptr) Variable Function + 72(tempReturn): 8(ptr) Variable Function + 75(tempArg): 8(ptr) Variable Function + 83(tempArg): 8(ptr) Variable Function + 84(tempArg): 8(ptr) Variable Function + 93(i): 92(ptr) Variable Function + 106(vi): 105(ptr) Variable Function + 10: 7(ivec) Load 9(vu) + 13: 6(int) Load 12(u) + 14: 7(ivec) CompositeConstruct 13 13 13 13 13 + 15: 7(ivec) ExtInst 1(GLSL.std.450) 38(UMin) 10 14 + Store 9(vu) 15 + 16: 7(ivec) Load 9(vu) + 17: 7(ivec) Load 9(vu) + 18: 7(ivec) ExtInst 1(GLSL.std.450) 38(UMin) 16 17 + Store 9(vu) 18 + 19: 7(ivec) Load 9(vu) + 20: 6(int) Load 12(u) + 21: 7(ivec) CompositeConstruct 20 20 20 20 20 + 22: 7(ivec) ExtInst 1(GLSL.std.450) 41(UMax) 19 21 + Store 9(vu) 22 + 23: 7(ivec) Load 9(vu) + 24: 7(ivec) Load 9(vu) + 25: 7(ivec) ExtInst 1(GLSL.std.450) 41(UMax) 23 24 + Store 9(vu) 25 + 26: 7(ivec) Load 9(vu) + 27: 6(int) Load 12(u) + 28: 6(int) Load 12(u) + 29: 7(ivec) CompositeConstruct 27 27 27 27 27 + 30: 7(ivec) CompositeConstruct 28 28 28 28 28 + 31: 7(ivec) ExtInst 1(GLSL.std.450) 44(UClamp) 26 29 30 + Store 9(vu) 31 + 32: 7(ivec) Load 9(vu) + 33: 7(ivec) Load 9(vu) + 34: 7(ivec) Load 9(vu) + 35: 7(ivec) ExtInst 1(GLSL.std.450) 44(UClamp) 32 33 34 + Store 9(vu) 35 + 36: 7(ivec) Load 9(vu) + 37: 7(ivec) Load 9(vu) + 42: 39(bvec) Load 41(vb) + 43: 7(ivec) Select 42 37 36 + Store 9(vu) 43 + 44: 7(ivec) Load 9(vu) + 45: 7(ivec) Load 9(vu) + 46: 39(bvec) ULessThan 44 45 + Store 41(vb) 46 + 47: 7(ivec) Load 9(vu) + 48: 7(ivec) Load 9(vu) + 49: 39(bvec) ULessThanEqual 47 48 + Store 41(vb) 49 + 50: 7(ivec) Load 9(vu) + 51: 7(ivec) Load 9(vu) + 52: 39(bvec) UGreaterThan 50 51 + Store 41(vb) 52 + 53: 7(ivec) Load 9(vu) + 54: 7(ivec) Load 9(vu) + 55: 39(bvec) UGreaterThanEqual 53 54 + Store 41(vb) 55 + 56: 7(ivec) Load 9(vu) + 57: 7(ivec) Load 9(vu) + 58: 39(bvec) IEqual 56 57 + Store 41(vb) 58 + 59: 7(ivec) Load 9(vu) + 60: 7(ivec) Load 9(vu) + 61: 39(bvec) INotEqual 59 60 + Store 41(vb) 61 + 63: 7(ivec) Load 9(vu) + 64: 7(ivec) Load 9(vu) + 67: 66(ResType) IAddCarry 63 64 + 68: 7(ivec) CompositeExtract 67 1 + Store 65(tempArg) 68 + 69: 7(ivec) CompositeExtract 67 0 + Store 62(tempReturn) 69 + 70: 7(ivec) Load 65(tempArg) + Store 9(vu) 70 + 71: 7(ivec) Load 62(tempReturn) + Store 9(vu) 71 + 73: 7(ivec) Load 9(vu) + 74: 7(ivec) Load 9(vu) + 76: 66(ResType) ISubBorrow 73 74 + 77: 7(ivec) CompositeExtract 76 1 + Store 75(tempArg) 77 + 78: 7(ivec) CompositeExtract 76 0 + Store 72(tempReturn) 78 + 79: 7(ivec) Load 75(tempArg) + Store 9(vu) 79 + 80: 7(ivec) Load 72(tempReturn) + Store 9(vu) 80 + 81: 7(ivec) Load 9(vu) + 82: 7(ivec) Load 9(vu) + 85: 66(ResType) UMulExtended 81 82 + 86: 7(ivec) CompositeExtract 85 0 + Store 84(tempArg) 86 + 87: 7(ivec) CompositeExtract 85 1 + Store 83(tempArg) 87 + 88: 7(ivec) Load 83(tempArg) + Store 9(vu) 88 + 89: 7(ivec) Load 84(tempArg) + Store 9(vu) 89 + 90: 7(ivec) Load 9(vu) + 94: 91(int) Load 93(i) + 95: 91(int) Load 93(i) + 96: 7(ivec) BitFieldUExtract 90 94 95 + Store 9(vu) 96 + 97: 7(ivec) Load 9(vu) + 98: 7(ivec) Load 9(vu) + 99: 91(int) Load 93(i) + 100: 91(int) Load 93(i) + 101: 7(ivec) BitFieldInsert 97 98 99 100 + Store 9(vu) 101 + 102: 7(ivec) Load 9(vu) + 103: 7(ivec) BitReverse 102 + Store 9(vu) 103 + 107: 7(ivec) Load 9(vu) + 108: 104(ivec) BitCount 107 + Store 106(vi) 108 + 109: 7(ivec) Load 9(vu) + 110: 104(ivec) ExtInst 1(GLSL.std.450) 73(FindILsb) 109 + Store 106(vi) 110 + 111: 7(ivec) Load 9(vu) + 112: 104(ivec) ExtInst 1(GLSL.std.450) 75(FindUMsb) 111 + Store 106(vi) 112 + 113: 7(ivec) Load 9(vu) + 114: 7(ivec) Load 9(vu) + 115: 39(bvec) Load 41(vb) + 116: 7(ivec) Select 115 114 113 + Store 9(vu) 116 + 117: 39(bvec) Load 41(vb) + 118: 39(bvec) Load 41(vb) + 119: 39(bvec) Load 41(vb) + 120: 39(bvec) Select 119 118 117 + Store 41(vb) 120 + 121: 7(ivec) Load 9(vu) + 122: 7(ivec) Load 9(vu) + 123: 7(ivec) ExpectKHR 121 122 + Store 9(vu) 123 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint64.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint64.comp.out new file mode 100644 index 0000000000..1f0907a2ff --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint64.comp.out @@ -0,0 +1,175 @@ +spv.longVectorBuiltinsuint64.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 112 + + Capability Shader + Capability Int64 + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vu" + Name 12 "u" + Name 41 "vb" + Name 62 "tempReturn" + Name 65 "tempArg" + Name 66 "ResType" + Name 72 "tempReturn" + Name 75 "tempArg" + Name 83 "tempArg" + Name 84 "tempArg" + Name 93 "vi" + Decorate 111 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 64 0 + 7: TypeVector 6(int64_t) 5 + 8: TypePointer Function 7(i64vec) + 11: TypePointer Function 6(int64_t) + 38: TypeBool + 39: TypeVector 38(bool) 5 + 40: TypePointer Function 39(bvec) + 66(ResType): TypeStruct 7(i64vec) 7(i64vec) + 90: TypeInt 64 1 + 91: TypeVector 90(int64_t) 5 + 92: TypePointer Function 91(i64vec) + 107: TypeInt 32 0 + 108: TypeVector 107(int) 3 + 109: 107(int) Constant 64 + 110: 107(int) Constant 1 + 111: 108(ivec3) ConstantComposite 109 110 110 + 4(main): 2 Function None 3 + 5: Label + 9(vu): 8(ptr) Variable Function + 12(u): 11(ptr) Variable Function + 41(vb): 40(ptr) Variable Function + 62(tempReturn): 8(ptr) Variable Function + 65(tempArg): 8(ptr) Variable Function + 72(tempReturn): 8(ptr) Variable Function + 75(tempArg): 8(ptr) Variable Function + 83(tempArg): 8(ptr) Variable Function + 84(tempArg): 8(ptr) Variable Function + 93(vi): 92(ptr) Variable Function + 10: 7(i64vec) Load 9(vu) + 13: 6(int64_t) Load 12(u) + 14: 7(i64vec) CompositeConstruct 13 13 13 13 13 + 15: 7(i64vec) ExtInst 1(GLSL.std.450) 38(UMin) 10 14 + Store 9(vu) 15 + 16: 7(i64vec) Load 9(vu) + 17: 7(i64vec) Load 9(vu) + 18: 7(i64vec) ExtInst 1(GLSL.std.450) 38(UMin) 16 17 + Store 9(vu) 18 + 19: 7(i64vec) Load 9(vu) + 20: 6(int64_t) Load 12(u) + 21: 7(i64vec) CompositeConstruct 20 20 20 20 20 + 22: 7(i64vec) ExtInst 1(GLSL.std.450) 41(UMax) 19 21 + Store 9(vu) 22 + 23: 7(i64vec) Load 9(vu) + 24: 7(i64vec) Load 9(vu) + 25: 7(i64vec) ExtInst 1(GLSL.std.450) 41(UMax) 23 24 + Store 9(vu) 25 + 26: 7(i64vec) Load 9(vu) + 27: 6(int64_t) Load 12(u) + 28: 6(int64_t) Load 12(u) + 29: 7(i64vec) CompositeConstruct 27 27 27 27 27 + 30: 7(i64vec) CompositeConstruct 28 28 28 28 28 + 31: 7(i64vec) ExtInst 1(GLSL.std.450) 44(UClamp) 26 29 30 + Store 9(vu) 31 + 32: 7(i64vec) Load 9(vu) + 33: 7(i64vec) Load 9(vu) + 34: 7(i64vec) Load 9(vu) + 35: 7(i64vec) ExtInst 1(GLSL.std.450) 44(UClamp) 32 33 34 + Store 9(vu) 35 + 36: 7(i64vec) Load 9(vu) + 37: 7(i64vec) Load 9(vu) + 42: 39(bvec) Load 41(vb) + 43: 7(i64vec) Select 42 37 36 + Store 9(vu) 43 + 44: 7(i64vec) Load 9(vu) + 45: 7(i64vec) Load 9(vu) + 46: 39(bvec) ULessThan 44 45 + Store 41(vb) 46 + 47: 7(i64vec) Load 9(vu) + 48: 7(i64vec) Load 9(vu) + 49: 39(bvec) ULessThanEqual 47 48 + Store 41(vb) 49 + 50: 7(i64vec) Load 9(vu) + 51: 7(i64vec) Load 9(vu) + 52: 39(bvec) UGreaterThan 50 51 + Store 41(vb) 52 + 53: 7(i64vec) Load 9(vu) + 54: 7(i64vec) Load 9(vu) + 55: 39(bvec) UGreaterThanEqual 53 54 + Store 41(vb) 55 + 56: 7(i64vec) Load 9(vu) + 57: 7(i64vec) Load 9(vu) + 58: 39(bvec) IEqual 56 57 + Store 41(vb) 58 + 59: 7(i64vec) Load 9(vu) + 60: 7(i64vec) Load 9(vu) + 61: 39(bvec) INotEqual 59 60 + Store 41(vb) 61 + 63: 7(i64vec) Load 9(vu) + 64: 7(i64vec) Load 9(vu) + 67: 66(ResType) IAddCarry 63 64 + 68: 7(i64vec) CompositeExtract 67 1 + Store 65(tempArg) 68 + 69: 7(i64vec) CompositeExtract 67 0 + Store 62(tempReturn) 69 + 70: 7(i64vec) Load 65(tempArg) + Store 9(vu) 70 + 71: 7(i64vec) Load 62(tempReturn) + Store 9(vu) 71 + 73: 7(i64vec) Load 9(vu) + 74: 7(i64vec) Load 9(vu) + 76: 66(ResType) ISubBorrow 73 74 + 77: 7(i64vec) CompositeExtract 76 1 + Store 75(tempArg) 77 + 78: 7(i64vec) CompositeExtract 76 0 + Store 72(tempReturn) 78 + 79: 7(i64vec) Load 75(tempArg) + Store 9(vu) 79 + 80: 7(i64vec) Load 72(tempReturn) + Store 9(vu) 80 + 81: 7(i64vec) Load 9(vu) + 82: 7(i64vec) Load 9(vu) + 85: 66(ResType) UMulExtended 81 82 + 86: 7(i64vec) CompositeExtract 85 0 + Store 84(tempArg) 86 + 87: 7(i64vec) CompositeExtract 85 1 + Store 83(tempArg) 87 + 88: 7(i64vec) Load 83(tempArg) + Store 9(vu) 88 + 89: 7(i64vec) Load 84(tempArg) + Store 9(vu) 89 + 94: 7(i64vec) Load 9(vu) + 95: 91(i64vec) BitCount 94 + Store 93(vi) 95 + 96: 7(i64vec) Load 9(vu) + 97: 7(i64vec) Load 9(vu) + 98: 39(bvec) Load 41(vb) + 99: 7(i64vec) Select 98 97 96 + Store 9(vu) 99 + 100: 39(bvec) Load 41(vb) + 101: 39(bvec) Load 41(vb) + 102: 39(bvec) Load 41(vb) + 103: 39(bvec) Select 102 101 100 + Store 41(vb) 103 + 104: 7(i64vec) Load 9(vu) + 105: 7(i64vec) Load 9(vu) + 106: 7(i64vec) ExpectKHR 104 105 + Store 9(vu) 106 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint8.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint8.comp.out new file mode 100644 index 0000000000..c2b344fe33 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorBuiltinsuint8.comp.out @@ -0,0 +1,197 @@ +spv.longVectorBuiltinsuint8.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 130 + + Capability Shader + Capability Int8 + Capability LongVectorEXT + Capability ExpectAssumeKHR + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "vu" + Name 12 "u" + Name 41 "vb" + Name 62 "tempReturn" + Name 65 "tempArg" + Name 66 "ResType" + Name 72 "tempReturn" + Name 75 "tempArg" + Name 83 "tempArg" + Name 84 "tempArg" + Name 93 "i" + Name 111 "vi" + Decorate 129 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 8 0 + 7: TypeVector 6(int8_t) 5 + 8: TypePointer Function 7(i8vec) + 11: TypePointer Function 6(int8_t) + 38: TypeBool + 39: TypeVector 38(bool) 5 + 40: TypePointer Function 39(bvec) + 66(ResType): TypeStruct 7(i8vec) 7(i8vec) + 91: TypeInt 8 1 + 92: TypePointer Function 91(int8_t) + 95: TypeInt 32 1 + 109: TypeVector 91(int8_t) 5 + 110: TypePointer Function 109(i8vec) + 125: TypeInt 32 0 + 126: TypeVector 125(int) 3 + 127: 125(int) Constant 64 + 128: 125(int) Constant 1 + 129: 126(ivec3) ConstantComposite 127 128 128 + 4(main): 2 Function None 3 + 5: Label + 9(vu): 8(ptr) Variable Function + 12(u): 11(ptr) Variable Function + 41(vb): 40(ptr) Variable Function + 62(tempReturn): 8(ptr) Variable Function + 65(tempArg): 8(ptr) Variable Function + 72(tempReturn): 8(ptr) Variable Function + 75(tempArg): 8(ptr) Variable Function + 83(tempArg): 8(ptr) Variable Function + 84(tempArg): 8(ptr) Variable Function + 93(i): 92(ptr) Variable Function + 111(vi): 110(ptr) Variable Function + 10: 7(i8vec) Load 9(vu) + 13: 6(int8_t) Load 12(u) + 14: 7(i8vec) CompositeConstruct 13 13 13 13 13 + 15: 7(i8vec) ExtInst 1(GLSL.std.450) 38(UMin) 10 14 + Store 9(vu) 15 + 16: 7(i8vec) Load 9(vu) + 17: 7(i8vec) Load 9(vu) + 18: 7(i8vec) ExtInst 1(GLSL.std.450) 38(UMin) 16 17 + Store 9(vu) 18 + 19: 7(i8vec) Load 9(vu) + 20: 6(int8_t) Load 12(u) + 21: 7(i8vec) CompositeConstruct 20 20 20 20 20 + 22: 7(i8vec) ExtInst 1(GLSL.std.450) 41(UMax) 19 21 + Store 9(vu) 22 + 23: 7(i8vec) Load 9(vu) + 24: 7(i8vec) Load 9(vu) + 25: 7(i8vec) ExtInst 1(GLSL.std.450) 41(UMax) 23 24 + Store 9(vu) 25 + 26: 7(i8vec) Load 9(vu) + 27: 6(int8_t) Load 12(u) + 28: 6(int8_t) Load 12(u) + 29: 7(i8vec) CompositeConstruct 27 27 27 27 27 + 30: 7(i8vec) CompositeConstruct 28 28 28 28 28 + 31: 7(i8vec) ExtInst 1(GLSL.std.450) 44(UClamp) 26 29 30 + Store 9(vu) 31 + 32: 7(i8vec) Load 9(vu) + 33: 7(i8vec) Load 9(vu) + 34: 7(i8vec) Load 9(vu) + 35: 7(i8vec) ExtInst 1(GLSL.std.450) 44(UClamp) 32 33 34 + Store 9(vu) 35 + 36: 7(i8vec) Load 9(vu) + 37: 7(i8vec) Load 9(vu) + 42: 39(bvec) Load 41(vb) + 43: 7(i8vec) Select 42 37 36 + Store 9(vu) 43 + 44: 7(i8vec) Load 9(vu) + 45: 7(i8vec) Load 9(vu) + 46: 39(bvec) ULessThan 44 45 + Store 41(vb) 46 + 47: 7(i8vec) Load 9(vu) + 48: 7(i8vec) Load 9(vu) + 49: 39(bvec) ULessThanEqual 47 48 + Store 41(vb) 49 + 50: 7(i8vec) Load 9(vu) + 51: 7(i8vec) Load 9(vu) + 52: 39(bvec) UGreaterThan 50 51 + Store 41(vb) 52 + 53: 7(i8vec) Load 9(vu) + 54: 7(i8vec) Load 9(vu) + 55: 39(bvec) UGreaterThanEqual 53 54 + Store 41(vb) 55 + 56: 7(i8vec) Load 9(vu) + 57: 7(i8vec) Load 9(vu) + 58: 39(bvec) IEqual 56 57 + Store 41(vb) 58 + 59: 7(i8vec) Load 9(vu) + 60: 7(i8vec) Load 9(vu) + 61: 39(bvec) INotEqual 59 60 + Store 41(vb) 61 + 63: 7(i8vec) Load 9(vu) + 64: 7(i8vec) Load 9(vu) + 67: 66(ResType) IAddCarry 63 64 + 68: 7(i8vec) CompositeExtract 67 1 + Store 65(tempArg) 68 + 69: 7(i8vec) CompositeExtract 67 0 + Store 62(tempReturn) 69 + 70: 7(i8vec) Load 65(tempArg) + Store 9(vu) 70 + 71: 7(i8vec) Load 62(tempReturn) + Store 9(vu) 71 + 73: 7(i8vec) Load 9(vu) + 74: 7(i8vec) Load 9(vu) + 76: 66(ResType) ISubBorrow 73 74 + 77: 7(i8vec) CompositeExtract 76 1 + Store 75(tempArg) 77 + 78: 7(i8vec) CompositeExtract 76 0 + Store 72(tempReturn) 78 + 79: 7(i8vec) Load 75(tempArg) + Store 9(vu) 79 + 80: 7(i8vec) Load 72(tempReturn) + Store 9(vu) 80 + 81: 7(i8vec) Load 9(vu) + 82: 7(i8vec) Load 9(vu) + 85: 66(ResType) UMulExtended 81 82 + 86: 7(i8vec) CompositeExtract 85 0 + Store 84(tempArg) 86 + 87: 7(i8vec) CompositeExtract 85 1 + Store 83(tempArg) 87 + 88: 7(i8vec) Load 83(tempArg) + Store 9(vu) 88 + 89: 7(i8vec) Load 84(tempArg) + Store 9(vu) 89 + 90: 7(i8vec) Load 9(vu) + 94: 91(int8_t) Load 93(i) + 96: 95(int) SConvert 94 + 97: 91(int8_t) Load 93(i) + 98: 95(int) SConvert 97 + 99: 7(i8vec) BitFieldUExtract 90 96 98 + Store 9(vu) 99 + 100: 7(i8vec) Load 9(vu) + 101: 7(i8vec) Load 9(vu) + 102: 91(int8_t) Load 93(i) + 103: 95(int) SConvert 102 + 104: 91(int8_t) Load 93(i) + 105: 95(int) SConvert 104 + 106: 7(i8vec) BitFieldInsert 100 101 103 105 + Store 9(vu) 106 + 107: 7(i8vec) Load 9(vu) + 108: 7(i8vec) BitReverse 107 + Store 9(vu) 108 + 112: 7(i8vec) Load 9(vu) + 113: 109(i8vec) BitCount 112 + Store 111(vi) 113 + 114: 7(i8vec) Load 9(vu) + 115: 7(i8vec) Load 9(vu) + 116: 39(bvec) Load 41(vb) + 117: 7(i8vec) Select 116 115 114 + Store 9(vu) 117 + 118: 39(bvec) Load 41(vb) + 119: 39(bvec) Load 41(vb) + 120: 39(bvec) Load 41(vb) + 121: 39(bvec) Select 120 119 118 + Store 41(vb) 121 + 122: 7(i8vec) Load 9(vu) + 123: 7(i8vec) Load 9(vu) + 124: 7(i8vec) ExpectKHR 122 123 + Store 9(vu) 124 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorMatMul.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorMatMul.comp.out new file mode 100644 index 0000000000..acd2f73acc --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorMatMul.comp.out @@ -0,0 +1,109 @@ +spv.longVectorMatMul.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 54 + + Capability Shader + Capability Float16 + Capability StorageUniformBufferBlock16 + Capability StorageBuffer8BitAccess + Capability VulkanMemoryModelKHR + Capability CooperativeVectorNV + Capability LongVectorEXT + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_8bit_storage" + Extension "SPV_KHR_vulkan_memory_model" + Extension "SPV_NV_cooperative_vector" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical VulkanKHR + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_nonuniform_qualifier" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + SourceExtension "GL_NV_cooperative_vector" + Name 4 "main" + Name 9 "v7" + Name 16 "cv7" + Name 22 "tempArg" + Name 28 "MatrixBuf" + MemberName 28(MatrixBuf) 0 "matrixData" + Name 30 "matrixBuf" + Name 38 "cv8" + Name 42 "v8" + Name 51 "MatrixBuf2" + MemberName 51(MatrixBuf2) 0 "matrixData" + Name 53 "matrixBuf2" + Decorate 27 ArrayStride 2 + Decorate 28(MatrixBuf) Block + MemberDecorate 28(MatrixBuf) 0 Offset 0 + Decorate 30(matrixBuf) Binding 0 + Decorate 30(matrixBuf) DescriptorSet 0 + Decorate 48 BuiltIn WorkgroupSize + Decorate 50 ArrayStride 1 + Decorate 51(MatrixBuf2) Block + MemberDecorate 51(MatrixBuf2) 0 Offset 0 + Decorate 53(matrixBuf2) Binding 0 + Decorate 53(matrixBuf2) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 20 + 8: TypePointer Function 7(fvec) + 10: 6(float) Constant 1065353216 + 11: 7(fvec) ConstantComposite 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 12: TypeInt 32 0 + 13: 12(int) Constant 20 + 14: TypeCooperativeVectorNV 6(float) 13 + 15: TypePointer Function 14 + 19: 12(int) Constant 100 + 20: TypeCooperativeVectorNV 6(float) 19 + 21: TypePointer Function 20 + 24: TypeInt 32 1 + 25: 24(int) Constant 0 + 26: TypeFloat 16 + 27: TypeRuntimeArray 26(float16_t) + 28(MatrixBuf): TypeStruct 27 + 29: TypePointer StorageBuffer 28(MatrixBuf) + 30(matrixBuf): 29(ptr) Variable StorageBuffer + 31: TypePointer StorageBuffer 27 + 33: 12(int) Constant 11 + 34: TypeBool + 35: 34(bool) ConstantFalse + 36: 12(int) Constant 300 + 40: TypeVector 6(float) 100 + 41: TypePointer Function 40(fvec) + 45: TypeVector 12(int) 3 + 46: 12(int) Constant 64 + 47: 12(int) Constant 1 + 48: 45(ivec3) ConstantComposite 46 47 47 + 49: TypeInt 8 1 + 50: TypeRuntimeArray 49(int8_t) + 51(MatrixBuf2): TypeStruct 50 + 52: TypePointer StorageBuffer 51(MatrixBuf2) + 53(matrixBuf2): 52(ptr) Variable StorageBuffer + 4(main): 2 Function None 3 + 5: Label + 9(v7): 8(ptr) Variable Function + 16(cv7): 15(ptr) Variable Function + 22(tempArg): 21(ptr) Variable Function + 38(cv8): 21(ptr) Variable Function + 42(v8): 41(ptr) Variable Function + Store 9(v7) 11 + 17: 7(fvec) Load 9(v7) + 18: 14 Bitcast 17 + Store 16(cv7) 18 + 23: 14 Load 16(cv7) + 32: 31(ptr) AccessChain 30(matrixBuf) 25 + 37: 20 CooperativeVectorMatrixMulNV 23 25 32 33 25 19 13 25 35 36 + Store 22(tempArg) 37 + 39: 20 Load 22(tempArg) + Store 38(cv8) 39 + 43: 20 Load 38(cv8) + 44: 40(fvec) Bitcast 43 + Store 42(v8) 44 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorNotReserved.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorNotReserved.comp.out new file mode 100644 index 0000000000..c7f4fbd6c6 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorNotReserved.comp.out @@ -0,0 +1,35 @@ +spv.longVectorNotReserved.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 19 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + Name 4 "main" + Name 8 "f" + Name 11 "vector" + Decorate 18 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Function 6(float) + 9: TypeVector 6(float) 4 + 10: TypePointer Function 9(fvec4) + 12: TypeInt 32 0 + 13: 12(int) Constant 1 + 16: TypeVector 12(int) 3 + 17: 12(int) Constant 64 + 18: 16(ivec3) ConstantComposite 17 13 13 + 4(main): 2 Function None 3 + 5: Label + 8(f): 7(ptr) Variable Function + 11(vector): 10(ptr) Variable Function + 14: 7(ptr) AccessChain 11(vector) 13 + 15: 6(float) Load 14 + Store 8(f) 15 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorOperators.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorOperators.comp.out new file mode 100644 index 0000000000..9b4b52108e --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorOperators.comp.out @@ -0,0 +1,696 @@ +spv.longVectorOperators.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 512 + + Capability Shader + Capability LongVectorEXT + Extension "SPV_EXT_long_vector" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + Name 4 "main" + Name 6 "foo(" + Name 11 "f0" + Name 13 "f1" + Name 27 "f" + Name 76 "u0" + Name 78 "u1" + Name 110 "u" + Name 238 "b0" + Name 240 "b1" + Name 247 "b" + Name 264 "f0" + Name 266 "f1" + Name 279 "f" + Name 327 "u0" + Name 329 "u1" + Name 360 "u" + Name 485 "b0" + Name 487 "b1" + Name 493 "b" + Decorate 511 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 8: TypeFloat 32 + 9: TypeVector 8(float) 5 + 10: TypePointer Function 9(fvec) + 26: TypePointer Function 8(float) + 73: TypeInt 32 0 + 74: TypeVector 73(int) 5 + 75: TypePointer Function 74(ivec) + 109: TypePointer Function 73(int) + 221: TypeInt 32 1 + 222: 221(int) Constant 1 + 223: TypeVector 221(int) 5 + 235: TypeBool + 236: TypeVector 235(bool) 5 + 237: TypePointer Function 236(bvec) + 246: TypePointer Function 235(bool) + 262: TypeVector 8(float) 1 + 263: TypePointer Function 262(fvec) + 325: TypeVector 73(int) 1 + 326: TypePointer Function 325(ivec) + 471: TypeVector 221(int) 1 + 483: TypeVector 235(bool) 1 + 484: TypePointer Function 483(bvec) + 508: TypeVector 73(int) 3 + 509: 73(int) Constant 64 + 510: 73(int) Constant 1 + 511: 508(ivec3) ConstantComposite 509 510 510 + 4(main): 2 Function None 3 + 5: Label + 11(f0): 10(ptr) Variable Function + 13(f1): 10(ptr) Variable Function + 27(f): 26(ptr) Variable Function + 76(u0): 75(ptr) Variable Function + 78(u1): 75(ptr) Variable Function + 110(u): 109(ptr) Variable Function + 238(b0): 237(ptr) Variable Function + 240(b1): 237(ptr) Variable Function + 247(b): 246(ptr) Variable Function + 255: 10(ptr) Variable Function + 12: 9(fvec) Load 11(f0) + 14: 9(fvec) Load 13(f1) + 15: 9(fvec) FAdd 12 14 + Store 11(f0) 15 + 16: 9(fvec) Load 11(f0) + 17: 9(fvec) Load 13(f1) + 18: 9(fvec) FSub 16 17 + Store 11(f0) 18 + 19: 9(fvec) Load 11(f0) + 20: 9(fvec) Load 13(f1) + 21: 9(fvec) FMul 19 20 + Store 11(f0) 21 + 22: 9(fvec) Load 11(f0) + 23: 9(fvec) Load 13(f1) + 24: 9(fvec) FDiv 22 23 + Store 11(f0) 24 + 25: 9(fvec) Load 11(f0) + 28: 8(float) Load 27(f) + 29: 9(fvec) CompositeConstruct 28 28 28 28 28 + 30: 9(fvec) FAdd 25 29 + Store 11(f0) 30 + 31: 9(fvec) Load 11(f0) + 32: 8(float) Load 27(f) + 33: 9(fvec) CompositeConstruct 32 32 32 32 32 + 34: 9(fvec) FSub 31 33 + Store 11(f0) 34 + 35: 9(fvec) Load 11(f0) + 36: 8(float) Load 27(f) + 37: 9(fvec) CompositeConstruct 36 36 36 36 36 + 38: 9(fvec) FMul 35 37 + Store 11(f0) 38 + 39: 9(fvec) Load 11(f0) + 40: 8(float) Load 27(f) + 41: 9(fvec) CompositeConstruct 40 40 40 40 40 + 42: 9(fvec) FDiv 39 41 + Store 11(f0) 42 + 43: 9(fvec) Load 11(f0) + 44: 9(fvec) FNegate 43 + Store 11(f0) 44 + 45: 9(fvec) Load 13(f1) + 46: 9(fvec) Load 11(f0) + 47: 9(fvec) FAdd 46 45 + Store 11(f0) 47 + 48: 9(fvec) Load 13(f1) + 49: 9(fvec) Load 11(f0) + 50: 9(fvec) FSub 49 48 + Store 11(f0) 50 + 51: 9(fvec) Load 13(f1) + 52: 9(fvec) Load 11(f0) + 53: 9(fvec) FMul 52 51 + Store 11(f0) 53 + 54: 9(fvec) Load 13(f1) + 55: 9(fvec) Load 11(f0) + 56: 9(fvec) FDiv 55 54 + Store 11(f0) 56 + 57: 8(float) Load 27(f) + 58: 9(fvec) Load 11(f0) + 59: 9(fvec) CompositeConstruct 57 57 57 57 57 + 60: 9(fvec) FAdd 58 59 + Store 11(f0) 60 + 61: 8(float) Load 27(f) + 62: 9(fvec) Load 11(f0) + 63: 9(fvec) CompositeConstruct 61 61 61 61 61 + 64: 9(fvec) FSub 62 63 + Store 11(f0) 64 + 65: 8(float) Load 27(f) + 66: 9(fvec) Load 11(f0) + 67: 9(fvec) CompositeConstruct 65 65 65 65 65 + 68: 9(fvec) FMul 66 67 + Store 11(f0) 68 + 69: 8(float) Load 27(f) + 70: 9(fvec) Load 11(f0) + 71: 9(fvec) CompositeConstruct 69 69 69 69 69 + 72: 9(fvec) FDiv 70 71 + Store 11(f0) 72 + 77: 74(ivec) Load 76(u0) + 79: 74(ivec) Load 78(u1) + 80: 74(ivec) IAdd 77 79 + Store 76(u0) 80 + 81: 74(ivec) Load 76(u0) + 82: 74(ivec) Load 78(u1) + 83: 74(ivec) ISub 81 82 + Store 76(u0) 83 + 84: 74(ivec) Load 76(u0) + 85: 74(ivec) Load 78(u1) + 86: 74(ivec) IMul 84 85 + Store 76(u0) 86 + 87: 74(ivec) Load 76(u0) + 88: 74(ivec) Load 78(u1) + 89: 74(ivec) UDiv 87 88 + Store 76(u0) 89 + 90: 74(ivec) Load 76(u0) + 91: 74(ivec) Load 78(u1) + 92: 74(ivec) UMod 90 91 + Store 76(u0) 92 + 93: 74(ivec) Load 76(u0) + 94: 74(ivec) Load 78(u1) + 95: 74(ivec) BitwiseAnd 93 94 + Store 76(u0) 95 + 96: 74(ivec) Load 76(u0) + 97: 74(ivec) Load 78(u1) + 98: 74(ivec) BitwiseOr 96 97 + Store 76(u0) 98 + 99: 74(ivec) Load 76(u0) + 100: 74(ivec) Load 78(u1) + 101: 74(ivec) BitwiseXor 99 100 + Store 76(u0) 101 + 102: 74(ivec) Load 76(u0) + 103: 74(ivec) Load 78(u1) + 104: 74(ivec) ShiftLeftLogical 102 103 + Store 76(u0) 104 + 105: 74(ivec) Load 76(u0) + 106: 74(ivec) Load 78(u1) + 107: 74(ivec) ShiftRightLogical 105 106 + Store 76(u0) 107 + 108: 74(ivec) Load 76(u0) + 111: 73(int) Load 110(u) + 112: 74(ivec) CompositeConstruct 111 111 111 111 111 + 113: 74(ivec) IAdd 108 112 + Store 76(u0) 113 + 114: 74(ivec) Load 76(u0) + 115: 73(int) Load 110(u) + 116: 74(ivec) CompositeConstruct 115 115 115 115 115 + 117: 74(ivec) ISub 114 116 + Store 76(u0) 117 + 118: 74(ivec) Load 76(u0) + 119: 73(int) Load 110(u) + 120: 74(ivec) CompositeConstruct 119 119 119 119 119 + 121: 74(ivec) IMul 118 120 + Store 76(u0) 121 + 122: 74(ivec) Load 76(u0) + 123: 73(int) Load 110(u) + 124: 74(ivec) CompositeConstruct 123 123 123 123 123 + 125: 74(ivec) UDiv 122 124 + Store 76(u0) 125 + 126: 74(ivec) Load 76(u0) + 127: 73(int) Load 110(u) + 128: 74(ivec) CompositeConstruct 127 127 127 127 127 + 129: 74(ivec) UMod 126 128 + Store 76(u0) 129 + 130: 74(ivec) Load 76(u0) + 131: 73(int) Load 110(u) + 132: 74(ivec) CompositeConstruct 131 131 131 131 131 + 133: 74(ivec) BitwiseAnd 130 132 + Store 76(u0) 133 + 134: 74(ivec) Load 76(u0) + 135: 73(int) Load 110(u) + 136: 74(ivec) CompositeConstruct 135 135 135 135 135 + 137: 74(ivec) BitwiseOr 134 136 + Store 76(u0) 137 + 138: 74(ivec) Load 76(u0) + 139: 73(int) Load 110(u) + 140: 74(ivec) CompositeConstruct 139 139 139 139 139 + 141: 74(ivec) BitwiseXor 138 140 + Store 76(u0) 141 + 142: 74(ivec) Load 76(u0) + 143: 73(int) Load 110(u) + 144: 74(ivec) CompositeConstruct 143 143 143 143 143 + 145: 74(ivec) ShiftLeftLogical 142 144 + Store 76(u0) 145 + 146: 74(ivec) Load 76(u0) + 147: 73(int) Load 110(u) + 148: 74(ivec) CompositeConstruct 147 147 147 147 147 + 149: 74(ivec) ShiftRightLogical 146 148 + Store 76(u0) 149 + 150: 74(ivec) Load 78(u1) + 151: 74(ivec) Load 76(u0) + 152: 74(ivec) IAdd 151 150 + Store 76(u0) 152 + 153: 74(ivec) Load 78(u1) + 154: 74(ivec) Load 76(u0) + 155: 74(ivec) ISub 154 153 + Store 76(u0) 155 + 156: 74(ivec) Load 78(u1) + 157: 74(ivec) Load 76(u0) + 158: 74(ivec) IMul 157 156 + Store 76(u0) 158 + 159: 74(ivec) Load 78(u1) + 160: 74(ivec) Load 76(u0) + 161: 74(ivec) UDiv 160 159 + Store 76(u0) 161 + 162: 74(ivec) Load 78(u1) + 163: 74(ivec) Load 76(u0) + 164: 74(ivec) UMod 163 162 + Store 76(u0) 164 + 165: 74(ivec) Load 78(u1) + 166: 74(ivec) Load 76(u0) + 167: 74(ivec) BitwiseAnd 166 165 + Store 76(u0) 167 + 168: 74(ivec) Load 78(u1) + 169: 74(ivec) Load 76(u0) + 170: 74(ivec) BitwiseOr 169 168 + Store 76(u0) 170 + 171: 74(ivec) Load 78(u1) + 172: 74(ivec) Load 76(u0) + 173: 74(ivec) BitwiseXor 172 171 + Store 76(u0) 173 + 174: 74(ivec) Load 78(u1) + 175: 74(ivec) Load 76(u0) + 176: 74(ivec) ShiftLeftLogical 175 174 + Store 76(u0) 176 + 177: 74(ivec) Load 78(u1) + 178: 74(ivec) Load 76(u0) + 179: 74(ivec) ShiftRightLogical 178 177 + Store 76(u0) 179 + 180: 73(int) Load 110(u) + 181: 74(ivec) Load 76(u0) + 182: 74(ivec) CompositeConstruct 180 180 180 180 180 + 183: 74(ivec) IAdd 181 182 + Store 76(u0) 183 + 184: 73(int) Load 110(u) + 185: 74(ivec) Load 76(u0) + 186: 74(ivec) CompositeConstruct 184 184 184 184 184 + 187: 74(ivec) ISub 185 186 + Store 76(u0) 187 + 188: 73(int) Load 110(u) + 189: 74(ivec) Load 76(u0) + 190: 74(ivec) CompositeConstruct 188 188 188 188 188 + 191: 74(ivec) IMul 189 190 + Store 76(u0) 191 + 192: 73(int) Load 110(u) + 193: 74(ivec) Load 76(u0) + 194: 74(ivec) CompositeConstruct 192 192 192 192 192 + 195: 74(ivec) UDiv 193 194 + Store 76(u0) 195 + 196: 73(int) Load 110(u) + 197: 74(ivec) Load 76(u0) + 198: 74(ivec) CompositeConstruct 196 196 196 196 196 + 199: 74(ivec) UMod 197 198 + Store 76(u0) 199 + 200: 73(int) Load 110(u) + 201: 74(ivec) Load 76(u0) + 202: 74(ivec) CompositeConstruct 200 200 200 200 200 + 203: 74(ivec) BitwiseAnd 201 202 + Store 76(u0) 203 + 204: 73(int) Load 110(u) + 205: 74(ivec) Load 76(u0) + 206: 74(ivec) CompositeConstruct 204 204 204 204 204 + 207: 74(ivec) BitwiseXor 205 206 + Store 76(u0) 207 + 208: 73(int) Load 110(u) + 209: 74(ivec) Load 76(u0) + 210: 74(ivec) CompositeConstruct 208 208 208 208 208 + 211: 74(ivec) BitwiseOr 209 210 + Store 76(u0) 211 + 212: 73(int) Load 110(u) + 213: 74(ivec) Load 76(u0) + 214: 74(ivec) CompositeConstruct 212 212 212 212 212 + 215: 74(ivec) ShiftLeftLogical 213 214 + Store 76(u0) 215 + 216: 73(int) Load 110(u) + 217: 74(ivec) Load 76(u0) + 218: 74(ivec) CompositeConstruct 216 216 216 216 216 + 219: 74(ivec) ShiftRightLogical 217 218 + Store 76(u0) 219 + 220: 74(ivec) Load 76(u0) + 224: 223(ivec) CompositeConstruct 222 222 222 222 222 + 225: 74(ivec) IAdd 220 224 + Store 76(u0) 225 + 226: 74(ivec) Load 76(u0) + 227: 223(ivec) CompositeConstruct 222 222 222 222 222 + 228: 74(ivec) ISub 226 227 + Store 76(u0) 228 + 229: 74(ivec) Load 76(u0) + 230: 223(ivec) CompositeConstruct 222 222 222 222 222 + 231: 74(ivec) IAdd 229 230 + Store 76(u0) 231 + 232: 74(ivec) Load 76(u0) + 233: 223(ivec) CompositeConstruct 222 222 222 222 222 + 234: 74(ivec) ISub 232 233 + Store 76(u0) 234 + 239: 236(bvec) Load 238(b0) + 241: 236(bvec) Load 240(b1) + 242: 236(bvec) LogicalEqual 239 241 + Store 238(b0) 242 + 243: 236(bvec) Load 238(b0) + 244: 236(bvec) Load 240(b1) + 245: 236(bvec) LogicalNotEqual 243 244 + Store 238(b0) 245 + 248: 236(bvec) Load 238(b0) + 249: 235(bool) Any 248 + Store 247(b) 249 + 250: 236(bvec) Load 238(b0) + 251: 235(bool) All 250 + Store 247(b) 251 + 252: 236(bvec) Load 238(b0) + 253: 236(bvec) LogicalNot 252 + Store 238(b0) 253 + 254: 235(bool) Load 247(b) + SelectionMerge 257 None + BranchConditional 254 256 259 + 256: Label + 258: 9(fvec) Load 11(f0) + Store 255 258 + Branch 257 + 259: Label + 260: 9(fvec) Load 13(f1) + Store 255 260 + Branch 257 + 257: Label + 261: 9(fvec) Load 255 + Store 11(f0) 261 + Return + FunctionEnd + 6(foo(): 2 Function None 3 + 7: Label + 264(f0): 263(ptr) Variable Function + 266(f1): 263(ptr) Variable Function + 279(f): 26(ptr) Variable Function + 327(u0): 326(ptr) Variable Function + 329(u1): 326(ptr) Variable Function + 360(u): 109(ptr) Variable Function + 485(b0): 484(ptr) Variable Function + 487(b1): 484(ptr) Variable Function + 493(b): 246(ptr) Variable Function + 501: 263(ptr) Variable Function + 265: 262(fvec) Load 264(f0) + 267: 262(fvec) Load 266(f1) + 268: 262(fvec) FAdd 265 267 + Store 264(f0) 268 + 269: 262(fvec) Load 264(f0) + 270: 262(fvec) Load 266(f1) + 271: 262(fvec) FSub 269 270 + Store 264(f0) 271 + 272: 262(fvec) Load 264(f0) + 273: 262(fvec) Load 266(f1) + 274: 262(fvec) FMul 272 273 + Store 264(f0) 274 + 275: 262(fvec) Load 264(f0) + 276: 262(fvec) Load 266(f1) + 277: 262(fvec) FDiv 275 276 + Store 264(f0) 277 + 278: 262(fvec) Load 264(f0) + 280: 8(float) Load 279(f) + 281: 262(fvec) CompositeConstruct 280 + 282: 262(fvec) FAdd 278 281 + Store 264(f0) 282 + 283: 262(fvec) Load 264(f0) + 284: 8(float) Load 279(f) + 285: 262(fvec) CompositeConstruct 284 + 286: 262(fvec) FSub 283 285 + Store 264(f0) 286 + 287: 262(fvec) Load 264(f0) + 288: 8(float) Load 279(f) + 289: 262(fvec) CompositeConstruct 288 + 290: 262(fvec) FMul 287 289 + Store 264(f0) 290 + 291: 262(fvec) Load 264(f0) + 292: 8(float) Load 279(f) + 293: 262(fvec) CompositeConstruct 292 + 294: 262(fvec) FDiv 291 293 + Store 264(f0) 294 + 295: 262(fvec) Load 264(f0) + 296: 262(fvec) FNegate 295 + Store 264(f0) 296 + 297: 262(fvec) Load 266(f1) + 298: 262(fvec) Load 264(f0) + 299: 262(fvec) FAdd 298 297 + Store 264(f0) 299 + 300: 262(fvec) Load 266(f1) + 301: 262(fvec) Load 264(f0) + 302: 262(fvec) FSub 301 300 + Store 264(f0) 302 + 303: 262(fvec) Load 266(f1) + 304: 262(fvec) Load 264(f0) + 305: 262(fvec) FMul 304 303 + Store 264(f0) 305 + 306: 262(fvec) Load 266(f1) + 307: 262(fvec) Load 264(f0) + 308: 262(fvec) FDiv 307 306 + Store 264(f0) 308 + 309: 8(float) Load 279(f) + 310: 262(fvec) Load 264(f0) + 311: 262(fvec) CompositeConstruct 309 + 312: 262(fvec) FAdd 310 311 + Store 264(f0) 312 + 313: 8(float) Load 279(f) + 314: 262(fvec) Load 264(f0) + 315: 262(fvec) CompositeConstruct 313 + 316: 262(fvec) FSub 314 315 + Store 264(f0) 316 + 317: 8(float) Load 279(f) + 318: 262(fvec) Load 264(f0) + 319: 262(fvec) CompositeConstruct 317 + 320: 262(fvec) FMul 318 319 + Store 264(f0) 320 + 321: 8(float) Load 279(f) + 322: 262(fvec) Load 264(f0) + 323: 262(fvec) CompositeConstruct 321 + 324: 262(fvec) FDiv 322 323 + Store 264(f0) 324 + 328: 325(ivec) Load 327(u0) + 330: 325(ivec) Load 329(u1) + 331: 325(ivec) IAdd 328 330 + Store 327(u0) 331 + 332: 325(ivec) Load 327(u0) + 333: 325(ivec) Load 329(u1) + 334: 325(ivec) ISub 332 333 + Store 327(u0) 334 + 335: 325(ivec) Load 327(u0) + 336: 325(ivec) Load 329(u1) + 337: 325(ivec) IMul 335 336 + Store 327(u0) 337 + 338: 325(ivec) Load 327(u0) + 339: 325(ivec) Load 329(u1) + 340: 325(ivec) UDiv 338 339 + Store 327(u0) 340 + 341: 325(ivec) Load 327(u0) + 342: 325(ivec) Load 329(u1) + 343: 325(ivec) UMod 341 342 + Store 327(u0) 343 + 344: 325(ivec) Load 327(u0) + 345: 325(ivec) Load 329(u1) + 346: 325(ivec) BitwiseAnd 344 345 + Store 327(u0) 346 + 347: 325(ivec) Load 327(u0) + 348: 325(ivec) Load 329(u1) + 349: 325(ivec) BitwiseOr 347 348 + Store 327(u0) 349 + 350: 325(ivec) Load 327(u0) + 351: 325(ivec) Load 329(u1) + 352: 325(ivec) BitwiseXor 350 351 + Store 327(u0) 352 + 353: 325(ivec) Load 327(u0) + 354: 325(ivec) Load 329(u1) + 355: 325(ivec) ShiftLeftLogical 353 354 + Store 327(u0) 355 + 356: 325(ivec) Load 327(u0) + 357: 325(ivec) Load 329(u1) + 358: 325(ivec) ShiftRightLogical 356 357 + Store 327(u0) 358 + 359: 325(ivec) Load 327(u0) + 361: 73(int) Load 360(u) + 362: 325(ivec) CompositeConstruct 361 + 363: 325(ivec) IAdd 359 362 + Store 327(u0) 363 + 364: 325(ivec) Load 327(u0) + 365: 73(int) Load 360(u) + 366: 325(ivec) CompositeConstruct 365 + 367: 325(ivec) ISub 364 366 + Store 327(u0) 367 + 368: 325(ivec) Load 327(u0) + 369: 73(int) Load 360(u) + 370: 325(ivec) CompositeConstruct 369 + 371: 325(ivec) IMul 368 370 + Store 327(u0) 371 + 372: 325(ivec) Load 327(u0) + 373: 73(int) Load 360(u) + 374: 325(ivec) CompositeConstruct 373 + 375: 325(ivec) UDiv 372 374 + Store 327(u0) 375 + 376: 325(ivec) Load 327(u0) + 377: 73(int) Load 360(u) + 378: 325(ivec) CompositeConstruct 377 + 379: 325(ivec) UMod 376 378 + Store 327(u0) 379 + 380: 325(ivec) Load 327(u0) + 381: 73(int) Load 360(u) + 382: 325(ivec) CompositeConstruct 381 + 383: 325(ivec) BitwiseAnd 380 382 + Store 327(u0) 383 + 384: 325(ivec) Load 327(u0) + 385: 73(int) Load 360(u) + 386: 325(ivec) CompositeConstruct 385 + 387: 325(ivec) BitwiseOr 384 386 + Store 327(u0) 387 + 388: 325(ivec) Load 327(u0) + 389: 73(int) Load 360(u) + 390: 325(ivec) CompositeConstruct 389 + 391: 325(ivec) BitwiseXor 388 390 + Store 327(u0) 391 + 392: 325(ivec) Load 327(u0) + 393: 73(int) Load 360(u) + 394: 325(ivec) CompositeConstruct 393 + 395: 325(ivec) ShiftLeftLogical 392 394 + Store 327(u0) 395 + 396: 325(ivec) Load 327(u0) + 397: 73(int) Load 360(u) + 398: 325(ivec) CompositeConstruct 397 + 399: 325(ivec) ShiftRightLogical 396 398 + Store 327(u0) 399 + 400: 325(ivec) Load 329(u1) + 401: 325(ivec) Load 327(u0) + 402: 325(ivec) IAdd 401 400 + Store 327(u0) 402 + 403: 325(ivec) Load 329(u1) + 404: 325(ivec) Load 327(u0) + 405: 325(ivec) ISub 404 403 + Store 327(u0) 405 + 406: 325(ivec) Load 329(u1) + 407: 325(ivec) Load 327(u0) + 408: 325(ivec) IMul 407 406 + Store 327(u0) 408 + 409: 325(ivec) Load 329(u1) + 410: 325(ivec) Load 327(u0) + 411: 325(ivec) UDiv 410 409 + Store 327(u0) 411 + 412: 325(ivec) Load 329(u1) + 413: 325(ivec) Load 327(u0) + 414: 325(ivec) UMod 413 412 + Store 327(u0) 414 + 415: 325(ivec) Load 329(u1) + 416: 325(ivec) Load 327(u0) + 417: 325(ivec) BitwiseAnd 416 415 + Store 327(u0) 417 + 418: 325(ivec) Load 329(u1) + 419: 325(ivec) Load 327(u0) + 420: 325(ivec) BitwiseOr 419 418 + Store 327(u0) 420 + 421: 325(ivec) Load 329(u1) + 422: 325(ivec) Load 327(u0) + 423: 325(ivec) BitwiseXor 422 421 + Store 327(u0) 423 + 424: 325(ivec) Load 329(u1) + 425: 325(ivec) Load 327(u0) + 426: 325(ivec) ShiftLeftLogical 425 424 + Store 327(u0) 426 + 427: 325(ivec) Load 329(u1) + 428: 325(ivec) Load 327(u0) + 429: 325(ivec) ShiftRightLogical 428 427 + Store 327(u0) 429 + 430: 73(int) Load 360(u) + 431: 325(ivec) Load 327(u0) + 432: 325(ivec) CompositeConstruct 430 + 433: 325(ivec) IAdd 431 432 + Store 327(u0) 433 + 434: 73(int) Load 360(u) + 435: 325(ivec) Load 327(u0) + 436: 325(ivec) CompositeConstruct 434 + 437: 325(ivec) ISub 435 436 + Store 327(u0) 437 + 438: 73(int) Load 360(u) + 439: 325(ivec) Load 327(u0) + 440: 325(ivec) CompositeConstruct 438 + 441: 325(ivec) IMul 439 440 + Store 327(u0) 441 + 442: 73(int) Load 360(u) + 443: 325(ivec) Load 327(u0) + 444: 325(ivec) CompositeConstruct 442 + 445: 325(ivec) UDiv 443 444 + Store 327(u0) 445 + 446: 73(int) Load 360(u) + 447: 325(ivec) Load 327(u0) + 448: 325(ivec) CompositeConstruct 446 + 449: 325(ivec) UMod 447 448 + Store 327(u0) 449 + 450: 73(int) Load 360(u) + 451: 325(ivec) Load 327(u0) + 452: 325(ivec) CompositeConstruct 450 + 453: 325(ivec) BitwiseAnd 451 452 + Store 327(u0) 453 + 454: 73(int) Load 360(u) + 455: 325(ivec) Load 327(u0) + 456: 325(ivec) CompositeConstruct 454 + 457: 325(ivec) BitwiseXor 455 456 + Store 327(u0) 457 + 458: 73(int) Load 360(u) + 459: 325(ivec) Load 327(u0) + 460: 325(ivec) CompositeConstruct 458 + 461: 325(ivec) BitwiseOr 459 460 + Store 327(u0) 461 + 462: 73(int) Load 360(u) + 463: 325(ivec) Load 327(u0) + 464: 325(ivec) CompositeConstruct 462 + 465: 325(ivec) ShiftLeftLogical 463 464 + Store 327(u0) 465 + 466: 73(int) Load 360(u) + 467: 325(ivec) Load 327(u0) + 468: 325(ivec) CompositeConstruct 466 + 469: 325(ivec) ShiftRightLogical 467 468 + Store 327(u0) 469 + 470: 325(ivec) Load 327(u0) + 472: 471(ivec) CompositeConstruct 222 + 473: 325(ivec) IAdd 470 472 + Store 327(u0) 473 + 474: 325(ivec) Load 327(u0) + 475: 471(ivec) CompositeConstruct 222 + 476: 325(ivec) ISub 474 475 + Store 327(u0) 476 + 477: 325(ivec) Load 327(u0) + 478: 471(ivec) CompositeConstruct 222 + 479: 325(ivec) IAdd 477 478 + Store 327(u0) 479 + 480: 325(ivec) Load 327(u0) + 481: 471(ivec) CompositeConstruct 222 + 482: 325(ivec) ISub 480 481 + Store 327(u0) 482 + 486: 483(bvec) Load 485(b0) + 488: 483(bvec) Load 487(b1) + 489: 483(bvec) LogicalEqual 486 488 + Store 485(b0) 489 + 490: 483(bvec) Load 485(b0) + 491: 483(bvec) Load 487(b1) + 492: 483(bvec) LogicalNotEqual 490 491 + Store 485(b0) 492 + 494: 483(bvec) Load 485(b0) + 495: 235(bool) Any 494 + Store 493(b) 495 + 496: 483(bvec) Load 485(b0) + 497: 235(bool) All 496 + Store 493(b) 497 + 498: 483(bvec) Load 485(b0) + 499: 483(bvec) LogicalNot 498 + Store 485(b0) 499 + 500: 235(bool) Load 493(b) + SelectionMerge 503 None + BranchConditional 500 502 505 + 502: Label + 504: 262(fvec) Load 264(f0) + Store 501 504 + Branch 503 + 505: Label + 506: 262(fvec) Load 266(f1) + Store 501 506 + Branch 503 + 503: Label + 507: 262(fvec) Load 501 + Store 264(f0) 507 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorSpecConst.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorSpecConst.comp.out new file mode 100644 index 0000000000..ca9dfeed9a --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorSpecConst.comp.out @@ -0,0 +1,266 @@ +spv.longVectorSpecConst.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 164 + + Capability Shader + Capability Float16 + Capability StorageUniformBufferBlock16 + Capability StorageBuffer8BitAccess + Capability LongVectorEXT + Capability ReplicatedCompositesEXT + Extension "SPV_EXT_long_vector" + Extension "SPV_EXT_replicated_composites" + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_nonuniform_qualifier" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 8 "c0" + Name 13 "foo(f161;" + Name 12 "x" + Name 18 "v" + Name 22 "x" + Name 25 "y" + Name 28 "v2" + Name 34 "v3" + Name 35 "x3" + Name 40 "y3" + Name 45 "v4" + Name 50 "v5" + Name 53 "v6" + Name 78 "f" + Name 88 "len" + Name 102 "f162" + Name 108 "f161" + Name 110 "f16" + Name 113 "v11" + Name 115 "v12" + Name 126 "v13" + Name 156 "MatrixBuf" + MemberName 156(MatrixBuf) 0 "matrixData" + Name 158 "matrixBuf" + Name 161 "MatrixBuf2" + MemberName 161(MatrixBuf2) 0 "matrixData" + Name 163 "matrixBuf2" + Decorate 8(c0) SpecId 0 + Decorate 154 BuiltIn WorkgroupSize + Decorate 155 ArrayStride 2 + Decorate 156(MatrixBuf) Block + MemberDecorate 156(MatrixBuf) 0 Offset 0 + Decorate 158(matrixBuf) Binding 0 + Decorate 158(matrixBuf) DescriptorSet 0 + Decorate 160 ArrayStride 1 + Decorate 161(MatrixBuf2) Block + MemberDecorate 161(MatrixBuf2) 0 Offset 0 + Decorate 163(matrixBuf2) Binding 0 + Decorate 163(matrixBuf2) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 16 + 7: TypeInt 32 0 + 8(c0): 7(int) SpecConstant 0 + 9: TypeCooperativeVectorNV 6(float16_t) 8(c0) + 10: TypePointer Function 9 + 11: TypeFunction 9 10(ptr) + 15: TypeFloat 32 + 16: TypeCooperativeVectorNV 15(float) 8(c0) + 17: TypePointer Function 16 + 19: 16 ConstantComposite + 20: TypeVector 15(float) 3 + 21: TypePointer Function 20(fvec3) + 23: 15(float) Constant 1065353216 + 24: 20(fvec3) ConstantComposite 23 23 23 + 26: 15(float) Constant 1073741824 + 27: 20(fvec3) ConstantComposite 26 26 26 + 29: 7(int) Constant 0 + 30: TypePointer Function 15(float) + 36: 15(float) Constant 1082130432 + 37: 15(float) Constant 1084227584 + 38: 15(float) Constant 1086324736 + 39: 20(fvec3) ConstantComposite 36 37 38 + 41: 15(float) Constant 1088421888 + 42: 15(float) Constant 1090519040 + 43: 15(float) Constant 1091567616 + 44: 20(fvec3) ConstantComposite 41 42 43 + 46: 7(int) Constant 2 + 86: TypeInt 32 1 + 87: TypePointer Function 86(int) + 90: 86(int) Constant 0 + 93: 86(int) Constant 4 + 103: TypeVector 15(float) 20 + 104: 86(int) Constant 20 + 109: TypePointer Function 6(float16_t) + 151: TypeVector 7(int) 3 + 152: 7(int) Constant 64 + 153: 7(int) Constant 1 + 154: 151(ivec3) ConstantComposite 152 153 153 + 155: TypeRuntimeArray 6(float16_t) + 156(MatrixBuf): TypeStruct 155 + 157: TypePointer StorageBuffer 156(MatrixBuf) + 158(matrixBuf): 157(ptr) Variable StorageBuffer + 159: TypeInt 8 1 + 160: TypeRuntimeArray 159(int8_t) + 161(MatrixBuf2): TypeStruct 160 + 162: TypePointer StorageBuffer 161(MatrixBuf2) + 163(matrixBuf2): 162(ptr) Variable StorageBuffer + 4(main): 2 Function None 3 + 5: Label + 18(v): 17(ptr) Variable Function + 22(x): 21(ptr) Variable Function + 25(y): 21(ptr) Variable Function + 28(v2): 17(ptr) Variable Function + 34(v3): 17(ptr) Variable Function + 35(x3): 21(ptr) Variable Function + 40(y3): 21(ptr) Variable Function + 45(v4): 17(ptr) Variable Function + 50(v5): 10(ptr) Variable Function + 53(v6): 17(ptr) Variable Function + 78(f): 30(ptr) Variable Function + 88(len): 87(ptr) Variable Function + 102(f162): 10(ptr) Variable Function + 108(f161): 10(ptr) Variable Function + 110(f16): 109(ptr) Variable Function + 113(v11): 10(ptr) Variable Function + 115(v12): 10(ptr) Variable Function + 126(v13): 10(ptr) Variable Function + Store 18(v) 19 + Store 22(x) 24 + Store 25(y) 27 + 31: 30(ptr) AccessChain 22(x) 29 + 32: 15(float) Load 31 + 33: 16 CompositeConstructReplicateEXT 32 + Store 28(v2) 33 + Store 34(v3) 19 + Store 35(x3) 39 + Store 40(y3) 44 + 47: 30(ptr) AccessChain 35(x3) 46 + 48: 15(float) Load 47 + 49: 16 CompositeConstructReplicateEXT 48 + Store 45(v4) 49 + 51: 16 Load 45(v4) + 52: 9 FConvert 51 + Store 50(v5) 52 + 54: 16 Load 18(v) + 55: 16 Load 28(v2) + 56: 16 FAdd 54 55 + Store 53(v6) 56 + 57: 16 Load 18(v) + 58: 16 Load 28(v2) + 59: 16 FSub 57 58 + Store 53(v6) 59 + 60: 16 Load 18(v) + 61: 16 Load 28(v2) + 62: 16 FMul 60 61 + Store 53(v6) 62 + 63: 16 Load 18(v) + 64: 16 Load 28(v2) + 65: 16 FDiv 63 64 + Store 53(v6) 65 + 66: 16 Load 18(v) + 67: 16 Load 53(v6) + 68: 16 FAdd 67 66 + Store 53(v6) 68 + 69: 16 Load 18(v) + 70: 16 Load 53(v6) + 71: 16 FSub 70 69 + Store 53(v6) 71 + 72: 16 Load 18(v) + 73: 16 Load 53(v6) + 74: 16 FMul 73 72 + Store 53(v6) 74 + 75: 16 Load 18(v) + 76: 16 Load 53(v6) + 77: 16 FDiv 76 75 + Store 53(v6) 77 + 79: 15(float) Load 78(f) + 80: 16 Load 53(v6) + 81: 16 CompositeConstruct + 82: 16 FMul 80 81 + Store 53(v6) 82 + 83: 16 Load 53(v6) + 84: 16 CompositeConstruct + 85: 16 FMul 83 84 + Store 53(v6) 85 + 89: 86(int) Bitcast 8(c0) + Store 88(len) 89 + 91: 15(float) Load 78(f) + 92: 30(ptr) AccessChain 53(v6) 90 + Store 92 91 + 94: 30(ptr) AccessChain 53(v6) 93 + Store 94 37 + 95: 16 Load 18(v) + 96: 16 Load 18(v) + 97: 16 FAdd 96 95 + Store 18(v) 97 + 98: 15(float) CompositeExtract 97 4 + 99: 15(float) Load 78(f) + 100: 15(float) FAdd 99 98 + Store 78(f) 100 + 101: 16 Load 18(v) + Store 53(v6) 101 + 105: 86(int) Bitcast 104 + 106:6(float16_t) ConvertSToF 105 + 107: 9 CompositeConstructReplicateEXT 106 + Store 102(f162) 107 + 111:6(float16_t) Load 110(f16) + 112: 9 CompositeConstructReplicateEXT 111 + Store 108(f161) 112 + 114: 9 Load 113(v11) + 116: 9 Load 115(v12) + 117: 9 ExtInst 1(GLSL.std.450) 40(FMax) 114 116 + Store 113(v11) 117 + 118: 9 Load 113(v11) + 119: 9 Load 115(v12) + 120: 9 ExtInst 1(GLSL.std.450) 37(FMin) 118 119 + Store 113(v11) 120 + 121: 9 Load 113(v11) + 122: 9 Load 115(v12) + 123: 9 ExtInst 1(GLSL.std.450) 48(Step) 121 122 + Store 113(v11) 123 + 124: 9 Load 113(v11) + 125: 9 Load 115(v12) + 127: 9 Load 126(v13) + 128: 9 ExtInst 1(GLSL.std.450) 43(FClamp) 124 125 127 + Store 113(v11) 128 + 129: 9 Load 113(v11) + 130: 9 ExtInst 1(GLSL.std.450) 27(Exp) 129 + Store 113(v11) 130 + 131: 9 Load 113(v11) + 132: 9 ExtInst 1(GLSL.std.450) 28(Log) 131 + Store 113(v11) 132 + 133: 9 Load 113(v11) + 134: 9 ExtInst 1(GLSL.std.450) 21(Tanh) 133 + Store 113(v11) 134 + 135: 9 Load 113(v11) + 136: 9 ExtInst 1(GLSL.std.450) 18(Atan) 135 + Store 113(v11) 136 + 137: 9 Load 113(v11) + 138: 9 Load 115(v12) + 139: 9 Load 126(v13) + 140: 9 ExtInst 1(GLSL.std.450) 50(Fma) 137 138 139 + Store 113(v11) 140 + 141: 16 Load 18(v) + 142: 16 Load 18(v) + 143: 16 FAdd 142 141 + Store 18(v) 143 + 144: 86(int) Load 88(len) + 145: 15(float) VectorExtractDynamic 143 144 + 146: 15(float) Load 78(f) + 147: 15(float) FAdd 146 145 + Store 78(f) 147 + Return + FunctionEnd +13(foo(f161;): 9 Function None 11 + 12(x): 10(ptr) FunctionParameter + 14: Label + 148: 9 Load 12(x) + ReturnValue 148 + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.longVectorStorage.comp.out b/third_party/glslang/Test/baseResults/spv.longVectorStorage.comp.out new file mode 100644 index 0000000000..753879c584 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.longVectorStorage.comp.out @@ -0,0 +1,238 @@ +spv.longVectorStorage.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 116 + + Capability Shader + Capability PhysicalStorageBufferAddressesEXT + Capability LongVectorEXT + Extension "SPV_EXT_long_vector" + Extension "SPV_KHR_physical_storage_buffer" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_long_vector" + SourceExtension "GL_EXT_scalar_block_layout" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 9 "v1" + Name 15 "Buf140" + MemberName 15(Buf140) 0 "v5" + MemberName 15(Buf140) 1 "v7" + MemberName 15(Buf140) 2 "v1" + Name 17 "buf140" + Name 26 "Buf430" + MemberName 26(Buf430) 0 "v5" + MemberName 26(Buf430) 1 "v7" + MemberName 26(Buf430) 2 "v1" + Name 28 "buf430" + Name 34 "BufScalar" + MemberName 34(BufScalar) 0 "v5" + MemberName 34(BufScalar) 1 "v7" + MemberName 34(BufScalar) 2 "v1" + Name 36 "bufScalar" + Name 41 "UBO" + MemberName 41(UBO) 0 "v5" + MemberName 41(UBO) 1 "v7" + MemberName 41(UBO) 2 "v1" + Name 43 "ubo" + Name 50 "BufScalarRef" + MemberName 50(BufScalarRef) 0 "v5" + MemberName 50(BufScalarRef) 1 "v7" + MemberName 50(BufScalarRef) 2 "v1" + Name 52 "ref" + Name 58 "v5" + Name 69 "PC" + MemberName 69(PC) 0 "v5" + MemberName 69(PC) 1 "v7" + Name 71 "pc" + Name 80 "v7" + Name 100 "v9" + Name 102 "s9" + Name 105 "c0" + Name 108 "vc" + Name 110 "s5" + Decorate 12 ArrayStride 32 + Decorate 14 ArrayStride 16 + Decorate 15(Buf140) Block + MemberDecorate 15(Buf140) 0 Offset 0 + MemberDecorate 15(Buf140) 1 Offset 64 + MemberDecorate 15(Buf140) 2 Offset 96 + Decorate 17(buf140) Binding 0 + Decorate 17(buf140) DescriptorSet 0 + Decorate 24 ArrayStride 32 + Decorate 25 ArrayStride 4 + Decorate 26(Buf430) Block + MemberDecorate 26(Buf430) 0 Offset 0 + MemberDecorate 26(Buf430) 1 Offset 64 + MemberDecorate 26(Buf430) 2 Offset 92 + Decorate 28(buf430) Binding 0 + Decorate 28(buf430) DescriptorSet 0 + Decorate 32 ArrayStride 20 + Decorate 33 ArrayStride 4 + Decorate 34(BufScalar) Block + MemberDecorate 34(BufScalar) 0 Offset 0 + MemberDecorate 34(BufScalar) 1 Offset 40 + MemberDecorate 34(BufScalar) 2 Offset 68 + Decorate 36(bufScalar) Binding 0 + Decorate 36(bufScalar) DescriptorSet 0 + Decorate 39 ArrayStride 32 + Decorate 40 ArrayStride 16 + Decorate 41(UBO) Block + MemberDecorate 41(UBO) 0 Offset 0 + MemberDecorate 41(UBO) 1 Offset 64 + MemberDecorate 41(UBO) 2 Offset 96 + Decorate 43(ubo) Binding 1 + Decorate 43(ubo) DescriptorSet 0 + Decorate 48 ArrayStride 20 + Decorate 49 ArrayStride 4 + Decorate 50(BufScalarRef) Block + MemberDecorate 50(BufScalarRef) 0 Offset 0 + MemberDecorate 50(BufScalarRef) 1 Offset 40 + MemberDecorate 50(BufScalarRef) 2 Offset 68 + Decorate 52(ref) DecorationAliasedPointerEXT + Decorate 69(PC) Block + MemberDecorate 69(PC) 0 Offset 0 + MemberDecorate 69(PC) 1 Offset 28 + Decorate 105(c0) SpecId 0 + Decorate 115 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 1 + 8: TypePointer Function 7(ivec) + 10: TypeVector 6(int) 5 + 11: 6(int) Constant 2 + 12: TypeArray 10(ivec) 11 + 13: TypeVector 6(int) 7 + 14: TypeArray 7(ivec) 11 + 15(Buf140): TypeStruct 12 13(ivec) 14 + 16: TypePointer StorageBuffer 15(Buf140) + 17(buf140): 16(ptr) Variable StorageBuffer + 18: TypeInt 32 1 + 19: 18(int) Constant 2 + 20: 18(int) Constant 0 + 21: TypePointer StorageBuffer 7(ivec) + 24: TypeArray 10(ivec) 11 + 25: TypeArray 7(ivec) 11 + 26(Buf430): TypeStruct 24 13(ivec) 25 + 27: TypePointer StorageBuffer 26(Buf430) + 28(buf430): 27(ptr) Variable StorageBuffer + 29: 18(int) Constant 1 + 32: TypeArray 10(ivec) 11 + 33: TypeArray 7(ivec) 11 + 34(BufScalar): TypeStruct 32 13(ivec) 33 + 35: TypePointer StorageBuffer 34(BufScalar) + 36(bufScalar): 35(ptr) Variable StorageBuffer + 39: TypeArray 10(ivec) 11 + 40: TypeArray 7(ivec) 11 + 41(UBO): TypeStruct 39 13(ivec) 40 + 42: TypePointer Uniform 41(UBO) + 43(ubo): 42(ptr) Variable Uniform + 44: TypePointer Uniform 7(ivec) + TypeForwardPointer 47 PhysicalStorageBufferEXT + 48: TypeArray 10(ivec) 11 + 49: TypeArray 7(ivec) 11 +50(BufScalarRef): TypeStruct 48 13(ivec) 49 + 47: TypePointer PhysicalStorageBufferEXT 50(BufScalarRef) + 51: TypePointer Function 47(ptr) + 54: TypePointer PhysicalStorageBufferEXT 7(ivec) + 57: TypePointer Function 10(ivec) + 59: TypePointer StorageBuffer 10(ivec) + 66: TypePointer Uniform 10(ivec) + 69(PC): TypeStruct 10(ivec) 13(ivec) + 70: TypePointer PushConstant 69(PC) + 71(pc): 70(ptr) Variable PushConstant + 72: TypePointer PushConstant 10(ivec) + 76: TypePointer PhysicalStorageBufferEXT 10(ivec) + 79: TypePointer Function 13(ivec) + 81: TypePointer StorageBuffer 13(ivec) + 88: TypePointer Uniform 13(ivec) + 91: TypePointer PushConstant 13(ivec) + 95: TypePointer PhysicalStorageBufferEXT 13(ivec) + 98: TypeVector 6(int) 9 + 99: TypePointer Function 98(ivec) + 101: TypePointer Workgroup 98(ivec) + 102(s9): 101(ptr) Variable Workgroup + 104: TypeFloat 32 + 105(c0): 6(int) SpecConstant 0 + 106: TypeCooperativeVectorNV 104(float) 105(c0) + 107: TypePointer Function 106 + 109: TypePointer Workgroup 106 + 110(s5): 109(ptr) Variable Workgroup + 112: TypeVector 6(int) 3 + 113: 6(int) Constant 64 + 114: 6(int) Constant 1 + 115: 112(ivec3) ConstantComposite 113 114 114 + 4(main): 2 Function None 3 + 5: Label + 9(v1): 8(ptr) Variable Function + 52(ref): 51(ptr) Variable Function + 58(v5): 57(ptr) Variable Function + 80(v7): 79(ptr) Variable Function + 100(v9): 99(ptr) Variable Function + 108(vc): 107(ptr) Variable Function + 22: 21(ptr) AccessChain 17(buf140) 19 20 + 23: 7(ivec) Load 22 + Store 9(v1) 23 + 30: 21(ptr) AccessChain 28(buf430) 19 29 + 31: 7(ivec) Load 30 + Store 9(v1) 31 + 37: 21(ptr) AccessChain 36(bufScalar) 19 29 + 38: 7(ivec) Load 37 + Store 9(v1) 38 + 45: 44(ptr) AccessChain 43(ubo) 19 29 + 46: 7(ivec) Load 45 + Store 9(v1) 46 + 53: 47(ptr) Load 52(ref) + 55: 54(ptr) AccessChain 53 19 29 + 56: 7(ivec) Load 55 Aligned 4 + Store 9(v1) 56 + 60: 59(ptr) AccessChain 17(buf140) 20 29 + 61: 10(ivec) Load 60 + Store 58(v5) 61 + 62: 59(ptr) AccessChain 28(buf430) 20 29 + 63: 10(ivec) Load 62 + Store 58(v5) 63 + 64: 59(ptr) AccessChain 36(bufScalar) 20 29 + 65: 10(ivec) Load 64 + Store 58(v5) 65 + 67: 66(ptr) AccessChain 43(ubo) 20 29 + 68: 10(ivec) Load 67 + Store 58(v5) 68 + 73: 72(ptr) AccessChain 71(pc) 20 + 74: 10(ivec) Load 73 + Store 58(v5) 74 + 75: 47(ptr) Load 52(ref) + 77: 76(ptr) AccessChain 75 20 29 + 78: 10(ivec) Load 77 Aligned 4 + Store 58(v5) 78 + 82: 81(ptr) AccessChain 17(buf140) 29 + 83: 13(ivec) Load 82 + Store 80(v7) 83 + 84: 81(ptr) AccessChain 28(buf430) 29 + 85: 13(ivec) Load 84 + Store 80(v7) 85 + 86: 81(ptr) AccessChain 36(bufScalar) 29 + 87: 13(ivec) Load 86 + Store 80(v7) 87 + 89: 88(ptr) AccessChain 43(ubo) 29 + 90: 13(ivec) Load 89 + Store 80(v7) 90 + 92: 91(ptr) AccessChain 71(pc) 29 + 93: 13(ivec) Load 92 + Store 80(v7) 93 + 94: 47(ptr) Load 52(ref) + 96: 95(ptr) AccessChain 94 29 + 97: 13(ivec) Load 96 Aligned 8 + Store 80(v7) 97 + 103: 98(ivec) Load 102(s9) + Store 100(v9) 103 + 111: 106 Load 110(s5) + Store 108(vc) 111 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.memoryScopeSemantics.comp.out b/third_party/glslang/Test/baseResults/spv.memoryScopeSemantics.comp.out index 96a7f3ca98..974a00bfc8 100644 --- a/third_party/glslang/Test/baseResults/spv.memoryScopeSemantics.comp.out +++ b/third_party/glslang/Test/baseResults/spv.memoryScopeSemantics.comp.out @@ -1,7 +1,7 @@ spv.memoryScopeSemantics.comp // Module Version 10300 // Generated by (magic number): 8000b -// Id's are bound by 169 +// Id's are bound by 245 Capability Shader Capability Int64 @@ -182,6 +182,33 @@ spv.memoryScopeSemantics.comp 164: TypePointer UniformConstant 163 165(imageMS): 164(ptr) Variable UniformConstant 167: 6(int) Constant 4294967289 + 169: 6(int) Constant 8 + 170: 15(int) Constant 72 + 171: 15(int) Constant 328 + 172: 6(int) Constant 16386 + 173: 15(int) Constant 16450 + 174: 6(int) Constant 8196 + 175: 15(int) Constant 8260 + 176: 6(int) Constant 24584 + 177: 15(int) Constant 24904 + 182: 6(int) Constant 32770 + 183: 15(int) Constant 32834 + 186: 6(int) Constant 49154 + 187: 15(int) Constant 49474 + 189: 6(int) Constant 32772 + 190: 15(int) Constant 32836 + 191: 6(int) Constant 40964 + 192: 15(int) Constant 41284 + 200: 6(int) Constant 32776 + 201: 15(int) Constant 32840 + 205: 15(int) Constant 24648 + 208: 6(int) Constant 57352 + 209: 15(int) Constant 57672 + 211: 15(int) Constant 20 + 235: 6(int) Constant 16392 + 236: 15(int) Constant 16456 + 238: 6(int) Constant 8200 + 239: 15(int) Constant 8264 4(main): 2 Function None 3 5: Label 8(origi): 7(ptr) Variable Function @@ -221,9 +248,6 @@ spv.memoryScopeSemantics.comp Store 21(origu) 65 70: 69(ptr) AccessChain 68(bufferu) 38 72: 15(int) AtomicIAdd 70 12 18 71 - MemoryBarrier 26 18 - ControlBarrier 26 26 64 - ControlBarrier 26 26 17 74: 69(ptr) AccessChain 68(bufferu) 38 75: 15(int) Load 74 MakePointerVisibleKHR NonPrivatePointerKHR 26 Store 73(y) 75 @@ -283,5 +307,96 @@ spv.memoryScopeSemantics.comp AtomicStore 166 12 33 14 168: 40(ptr) ImageTexelPointer 36(imagei) 39 17 AtomicStore 168 12 33 167 + ControlBarrier 26 26 17 + ControlBarrier 26 26 30 + ControlBarrier 26 26 33 + ControlBarrier 26 26 170 + ControlBarrier 26 26 171 + ControlBarrier 26 26 173 + ControlBarrier 26 26 175 + ControlBarrier 26 26 177 + MemoryBarrier 26 30 + MemoryBarrier 26 33 + MemoryBarrier 26 170 + MemoryBarrier 26 171 + MemoryBarrier 26 173 + MemoryBarrier 26 175 + MemoryBarrier 26 177 + 178: 15(int) AtomicLoad 23(atomu) 12 17 + Store 21(origu) 178 + 179: 15(int) AtomicLoad 23(atomu) 12 42 + Store 21(origu) 179 + 180: 15(int) AtomicLoad 23(atomu) 12 30 + Store 21(origu) 180 + 181: 15(int) AtomicLoad 23(atomu) 12 64 + Store 21(origu) 181 + 184: 15(int) AtomicLoad 23(atomu) 12 183 + Store 21(origu) 184 + 185: 15(int) AtomicLoad 23(atomu) 12 173 + Store 21(origu) 185 + 188: 15(int) AtomicLoad 23(atomu) 12 187 + Store 21(origu) 188 + AtomicStore 23(atomu) 12 17 62 + AtomicStore 23(atomu) 12 42 62 + AtomicStore 23(atomu) 12 33 62 + AtomicStore 23(atomu) 12 18 62 + AtomicStore 23(atomu) 12 190 62 + AtomicStore 23(atomu) 12 175 62 + AtomicStore 23(atomu) 12 192 62 + 193: 15(int) AtomicAnd 23(atomu) 12 17 62 + Store 21(origu) 193 + 194: 15(int) AtomicAnd 23(atomu) 12 42 62 + Store 21(origu) 194 + 195: 15(int) AtomicAnd 23(atomu) 12 30 62 + Store 21(origu) 195 + 196: 15(int) AtomicAnd 23(atomu) 12 33 62 + Store 21(origu) 196 + 197: 15(int) AtomicAnd 23(atomu) 12 170 62 + Store 21(origu) 197 + 198: 15(int) AtomicAnd 23(atomu) 12 183 62 + Store 21(origu) 198 + 199: 15(int) AtomicAnd 23(atomu) 12 190 62 + Store 21(origu) 199 + 202: 15(int) AtomicAnd 23(atomu) 12 201 62 + Store 21(origu) 202 + 203: 15(int) AtomicAnd 23(atomu) 12 173 62 + Store 21(origu) 203 + 204: 15(int) AtomicAnd 23(atomu) 12 175 62 + Store 21(origu) 204 + 206: 15(int) AtomicAnd 23(atomu) 12 205 62 + Store 21(origu) 206 + 207: 15(int) AtomicAnd 23(atomu) 12 177 62 + Store 21(origu) 207 + 210: 15(int) AtomicAnd 23(atomu) 12 209 62 + Store 21(origu) 210 + 212: 15(int) AtomicCompareExchange 23(atomu) 12 17 17 211 62 + 213: 15(int) AtomicCompareExchange 23(atomu) 12 42 42 211 62 + 214: 15(int) AtomicCompareExchange 23(atomu) 12 30 17 211 62 + 215: 15(int) AtomicCompareExchange 23(atomu) 12 33 17 211 62 + 216: 15(int) AtomicCompareExchange 23(atomu) 12 170 17 211 62 + 217: 15(int) AtomicCompareExchange 23(atomu) 12 183 42 211 62 + 218: 15(int) AtomicCompareExchange 23(atomu) 12 190 42 211 62 + 219: 15(int) AtomicCompareExchange 23(atomu) 12 201 42 211 62 + 220: 15(int) AtomicCompareExchange 23(atomu) 12 173 17 211 62 + 221: 15(int) AtomicCompareExchange 23(atomu) 12 175 17 211 62 + 222: 15(int) AtomicCompareExchange 23(atomu) 12 177 17 211 62 + 223: 15(int) AtomicCompareExchange 23(atomu) 12 209 42 211 62 + 224: 15(int) AtomicCompareExchange 23(atomu) 12 30 30 211 62 + 225: 15(int) AtomicCompareExchange 23(atomu) 12 183 183 211 62 + 226: 15(int) AtomicCompareExchange 23(atomu) 12 64 30 211 62 + 227: 15(int) AtomicCompareExchange 23(atomu) 12 64 64 211 62 + 228: 15(int) AtomicCompareExchange 23(atomu) 12 173 30 211 62 + 229: 15(int) AtomicCompareExchange 23(atomu) 12 173 173 211 62 + 230: 15(int) AtomicCompareExchange 23(atomu) 12 187 187 211 62 + 231: 15(int) AtomicCompareExchange 23(atomu) 12 170 30 211 62 + 232: 15(int) AtomicCompareExchange 23(atomu) 12 201 183 211 62 + 233: 15(int) AtomicCompareExchange 23(atomu) 12 171 30 211 62 + 234: 15(int) AtomicCompareExchange 23(atomu) 12 171 64 211 62 + 237: 15(int) AtomicCompareExchange 23(atomu) 12 236 30 211 62 + 240: 15(int) AtomicCompareExchange 23(atomu) 12 239 30 211 62 + 241: 15(int) AtomicCompareExchange 23(atomu) 12 205 30 211 62 + 242: 15(int) AtomicCompareExchange 23(atomu) 12 236 173 211 62 + 243: 15(int) AtomicCompareExchange 23(atomu) 12 205 173 211 62 + 244: 15(int) AtomicCompareExchange 23(atomu) 12 209 187 211 62 Return FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.memoryScopeSemantics_Error.comp.out b/third_party/glslang/Test/baseResults/spv.memoryScopeSemantics_Error.comp.out index 6de93fde4e..ba144e3893 100644 --- a/third_party/glslang/Test/baseResults/spv.memoryScopeSemantics_Error.comp.out +++ b/third_party/glslang/Test/baseResults/spv.memoryScopeSemantics_Error.comp.out @@ -1,19 +1,54 @@ spv.memoryScopeSemantics_Error.comp -ERROR: 0:15: 'atomicStore' : gl_SemanticsAcquire must not be used with (image) atomic store -ERROR: 0:16: 'imageAtomicLoad' : gl_SemanticsRelease must not be used with (image) atomic load -ERROR: 0:17: 'atomicStore' : gl_SemanticsAcquireRelease must not be used with (image) atomic load/store -ERROR: 0:18: 'atomicStore' : Invalid semantics value -ERROR: 0:19: 'imageAtomicLoad' : Invalid storage class semantics value -ERROR: 0:20: 'memoryBarrier' : Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease -ERROR: 0:21: 'memoryBarrier' : Storage class semantics must not be zero -ERROR: 0:22: 'memoryBarrier' : Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease -ERROR: 0:23: 'atomicAdd' : Semantics must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease -ERROR: 0:24: 'atomicCompSwap' : semUnequal must not be gl_SemanticsRelease or gl_SemanticsAcquireRelease -ERROR: 0:25: 'memoryBarrier' : gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease -ERROR: 0:26: 'memoryBarrier' : gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease -ERROR: 0:27: 'memoryBarrier' : gl_SemanticsVolatile must not be used with memoryBarrier or controlBarrier -ERROR: 0:28: 'atomicCompSwap' : semEqual and semUnequal must either both include gl_SemanticsVolatile or neither -ERROR: 14 compilation errors. No code generated. +ERROR: 0:13: 'atomicStore' : gl_SemanticsAcquire must not be used with (image) atomic store +ERROR: 0:14: 'imageAtomicStore' : gl_SemanticsAcquire must not be used with (image) atomic store +ERROR: 0:17: 'atomicLoad' : gl_SemanticsRelease must not be used with (image) atomic load +ERROR: 0:18: 'imageAtomicLoad' : gl_SemanticsRelease must not be used with (image) atomic load +ERROR: 0:21: 'atomicStore' : gl_SemanticsAcquireRelease must not be used with (image) atomic load/store +ERROR: 0:22: 'imageAtomicStore' : gl_SemanticsAcquireRelease must not be used with (image) atomic load/store +ERROR: 0:23: 'atomicLoad' : gl_SemanticsAcquireRelease must not be used with (image) atomic load/store +ERROR: 0:24: 'imageAtomicLoad' : gl_SemanticsAcquireRelease must not be used with (image) atomic load/store +ERROR: 0:27: 'memoryBarrier' : Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease when used with memoryBarrier +ERROR: 0:30: 'atomicCompSwap' : Invalid semantics value +ERROR: 0:31: 'atomicCompSwap' : Invalid semantics value +ERROR: 0:32: 'atomicCompSwap' : Invalid semantics value +ERROR: 0:33: 'atomicCompSwap' : Invalid semantics value +ERROR: 0:36: 'atomicCompSwap' : Invalid storage class semantics value +ERROR: 0:37: 'atomicCompSwap' : Invalid storage class semantics value +ERROR: 0:40: 'atomicCompSwap' : Semantics must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease +ERROR: 0:41: 'atomicCompSwap' : Semantics must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease +ERROR: 0:44: 'atomicCompSwap' : Storage class semantics must not be zero when used with gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease +ERROR: 0:45: 'atomicCompSwap' : Storage class semantics must not be zero when used with gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease +ERROR: 0:48: 'atomicCompSwap' : Semantics must be gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease when used with non-zero storage class semantics +ERROR: 0:49: 'atomicCompSwap' : Semantics must be gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease when used with non-zero storage class semantics +ERROR: 0:50: 'atomicCompSwap' : Semantics must be gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease when used with non-zero storage class semantics +ERROR: 0:51: 'atomicCompSwap' : Semantics must be gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease when used with non-zero storage class semantics +ERROR: 0:52: 'imageAtomicAdd' : Semantics must be gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease when used with non-zero storage class semantics +ERROR: 0:53: 'imageAtomicAdd' : Semantics must be gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease when used with non-zero storage class semantics +ERROR: 0:56: 'atomicCompSwap' : gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease +ERROR: 0:57: 'atomicCompSwap' : gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease +ERROR: 0:58: 'atomicCompSwap' : gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease +ERROR: 0:59: 'atomicCompSwap' : gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease +ERROR: 0:62: 'atomicCompSwap' : gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease +ERROR: 0:63: 'atomicCompSwap' : gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease +ERROR: 0:64: 'atomicCompSwap' : gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease +ERROR: 0:67: 'memoryBarrier' : gl_SemanticsVolatile must not be used with memoryBarrier or controlBarrier +ERROR: 0:68: 'controlBarrier' : gl_SemanticsVolatile must not be used with memoryBarrier or controlBarrier +ERROR: 0:69: 'controlBarrier' : gl_SemanticsVolatile must not be used with memoryBarrier or controlBarrier +ERROR: 0:72: 'atomicCompSwap' : semUnequal must not be gl_SemanticsRelease or gl_SemanticsAcquireRelease +ERROR: 0:73: 'atomicCompSwap' : semUnequal must not be gl_SemanticsRelease or gl_SemanticsAcquireRelease +ERROR: 0:76: 'atomicCompSwap' : semUnequal must not be gl_SemanticsAcquire unless semEqual is gl_SemanticsAcquire or gl_SemanticsAcquireRelease +ERROR: 0:76: 'atomicCompSwap' : semStorageUnequal must not include any option that is not present in semStorageEqual +ERROR: 0:77: 'atomicCompSwap' : semUnequal must not be gl_SemanticsAcquire unless semEqual is gl_SemanticsAcquire or gl_SemanticsAcquireRelease +ERROR: 0:80: 'atomicCompSwap' : semUnequal must not include gl_SemanticsMakeVisible unless semEqual also includes gl_SemanticsMakeVisible +ERROR: 0:81: 'atomicCompSwap' : semUnequal must not include gl_SemanticsMakeVisible unless semEqual also includes gl_SemanticsMakeVisible +ERROR: 0:84: 'atomicCompSwap' : semStorageUnequal must not include any option that is not present in semStorageEqual +ERROR: 0:85: 'atomicCompSwap' : semStorageUnequal must not include any option that is not present in semStorageEqual +ERROR: 0:86: 'atomicCompSwap' : semStorageUnequal must not include any option that is not present in semStorageEqual +ERROR: 0:89: 'atomicCompSwap' : semEqual and semUnequal must either both include gl_SemanticsVolatile or neither +ERROR: 0:90: 'atomicCompSwap' : semEqual and semUnequal must either both include gl_SemanticsVolatile or neither +ERROR: 0:91: 'atomicCompSwap' : semEqual and semUnequal must either both include gl_SemanticsVolatile or neither +ERROR: 0:92: 'atomicCompSwap' : semEqual and semUnequal must either both include gl_SemanticsVolatile or neither +ERROR: 49 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rahit.out b/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rahit.out index 565511951c..bc51a566d7 100644 --- a/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rahit.out +++ b/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rahit.out @@ -4,7 +4,7 @@ spv.nv.dmm-allops.rahit // Id's are bound by 77 Capability RayTracingKHR - Capability CapabilityRayTracingDisplacementMicromapNV + Capability RayTracingDisplacementMicromapNV Extension "SPV_KHR_ray_tracing" Extension "SPV_NV_displacement_micromap" 1: ExtInstImport "GLSL.std.450" diff --git a/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rchit.out b/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rchit.out index 291b51485b..5d42445f12 100644 --- a/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rchit.out +++ b/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rchit.out @@ -4,7 +4,7 @@ spv.nv.dmm-allops.rchit // Id's are bound by 77 Capability RayTracingKHR - Capability CapabilityRayTracingDisplacementMicromapNV + Capability RayTracingDisplacementMicromapNV Extension "SPV_KHR_ray_tracing" Extension "SPV_NV_displacement_micromap" 1: ExtInstImport "GLSL.std.450" diff --git a/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rgen.out b/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rgen.out index aaff10ff4b..10e17c9e7e 100644 --- a/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rgen.out +++ b/third_party/glslang/Test/baseResults/spv.nv.dmm-allops.rgen.out @@ -5,7 +5,7 @@ spv.nv.dmm-allops.rgen Capability RayTracingKHR Capability DisplacementMicromapNV - Capability CapabilityRayTracingDisplacementMicromapNV + Capability RayTracingDisplacementMicromapNV Extension "SPV_KHR_ray_tracing" Extension "SPV_NV_displacement_micromap" 1: ExtInstImport "GLSL.std.450" diff --git a/third_party/glslang/Test/baseResults/spv.pp.line.frag.out b/third_party/glslang/Test/baseResults/spv.pp.line.frag.out index 807ecaef08..c9b6cf7310 100644 --- a/third_party/glslang/Test/baseResults/spv.pp.line.frag.out +++ b/third_party/glslang/Test/baseResults/spv.pp.line.frag.out @@ -10,7 +10,7 @@ WARNING: spv.pp.line.frag:8: varying deprecated in version 130; may be removed i Capability Sampled1D 2: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 5 "main" 60 72 75 78 + EntryPoint Fragment 5 "main" 23 26 29 76 ExecutionMode 5 OriginUpperLeft 1: String "spv.pp.line.frag" 7: String "header.h" @@ -63,111 +63,111 @@ void main() Name 5 "main" Name 12 "myAbs(f1;" Name 11 "x" - Name 27 "blendscale" - Name 29 "param" - Name 31 "bias" - Name 33 "coords1D" - Name 36 "color" - Name 41 "texSampler1D" - Name 56 "texSampler2D" - Name 60 "coords2D" - Name 72 "gl_FragColor" - Name 75 "u" - Name 78 "blend" - Decorate 41(texSampler1D) Binding 0 - Decorate 41(texSampler1D) DescriptorSet 0 - Decorate 56(texSampler2D) Binding 1 - Decorate 56(texSampler2D) DescriptorSet 0 - Decorate 60(coords2D) Location 2 - Decorate 72(gl_FragColor) Location 0 - Decorate 75(u) Location 1 - Decorate 78(blend) Location 0 + Name 17 "texSampler1D" + Name 21 "texSampler2D" + Name 23 "blend" + Name 26 "u" + Name 29 "coords2D" + Name 43 "blendscale" + Name 45 "param" + Name 47 "bias" + Name 49 "coords1D" + Name 51 "color" + Name 76 "gl_FragColor" + Decorate 17(texSampler1D) Binding 0 + Decorate 17(texSampler1D) DescriptorSet 0 + Decorate 21(texSampler2D) Binding 1 + Decorate 21(texSampler2D) DescriptorSet 0 + Decorate 23(blend) Location 0 + Decorate 26(u) Location 1 + Decorate 29(coords2D) Location 2 + Decorate 76(gl_FragColor) Location 0 3: TypeVoid 4: TypeFunction 3 8: TypeFloat 32 9: TypePointer Function 8(float) 10: TypeFunction 8(float) 9(ptr) - 15: 8(float) Constant 0 - 16: TypeBool - 28: 8(float) Constant 1071971828 - 32: 8(float) Constant 1073741824 - 34: TypeVector 8(float) 4 - 35: TypePointer Function 34(fvec4) - 37: 34(fvec4) ConstantComposite 15 15 15 15 - 38: TypeImage 8(float) 1D sampled format:Unknown - 39: TypeSampledImage 38 - 40: TypePointer UniformConstant 39 -41(texSampler1D): 40(ptr) Variable UniformConstant - 53: TypeImage 8(float) 2D sampled format:Unknown - 54: TypeSampledImage 53 - 55: TypePointer UniformConstant 54 -56(texSampler2D): 55(ptr) Variable UniformConstant - 58: TypeVector 8(float) 2 - 59: TypePointer Input 58(fvec2) - 60(coords2D): 59(ptr) Variable Input - 71: TypePointer Output 34(fvec4) -72(gl_FragColor): 71(ptr) Variable Output - 74: TypePointer Input 34(fvec4) - 75(u): 74(ptr) Variable Input - 77: TypePointer Input 8(float) - 78(blend): 77(ptr) Variable Input + 14: TypeImage 8(float) 1D sampled format:Unknown + 15: TypeSampledImage 14 + 16: TypePointer UniformConstant 15 +17(texSampler1D): 16(ptr) Variable UniformConstant + 18: TypeImage 8(float) 2D sampled format:Unknown + 19: TypeSampledImage 18 + 20: TypePointer UniformConstant 19 +21(texSampler2D): 20(ptr) Variable UniformConstant + 22: TypePointer Input 8(float) + 23(blend): 22(ptr) Variable Input + 24: TypeVector 8(float) 4 + 25: TypePointer Input 24(fvec4) + 26(u): 25(ptr) Variable Input + 27: TypeVector 8(float) 2 + 28: TypePointer Input 27(fvec2) + 29(coords2D): 28(ptr) Variable Input + 31: 8(float) Constant 0 + 32: TypeBool + 44: 8(float) Constant 1071971828 + 48: 8(float) Constant 1073741824 + 50: TypePointer Function 24(fvec4) + 52: 24(fvec4) ConstantComposite 31 31 31 31 + 75: TypePointer Output 24(fvec4) +76(gl_FragColor): 75(ptr) Variable Output Line 1 23 11 5(main): 3 Function None 4 6: Label - 27(blendscale): 9(ptr) Variable Function - 29(param): 9(ptr) Variable Function - 31(bias): 9(ptr) Variable Function - 33(coords1D): 9(ptr) Variable Function - 36(color): 35(ptr) Variable Function + 43(blendscale): 9(ptr) Variable Function + 45(param): 9(ptr) Variable Function + 47(bias): 9(ptr) Variable Function + 49(coords1D): 9(ptr) Variable Function + 51(color): 50(ptr) Variable Function Line 1 25 0 - Store 29(param) 28 - 30: 8(float) FunctionCall 12(myAbs(f1;) 29(param) - Store 27(blendscale) 30 + Store 45(param) 44 + 46: 8(float) FunctionCall 12(myAbs(f1;) 45(param) + Store 43(blendscale) 46 Line 1 26 0 - Store 31(bias) 32 + Store 47(bias) 48 Line 1 27 0 - Store 33(coords1D) 28 + Store 49(coords1D) 44 Line 1 28 0 - Store 36(color) 37 + Store 51(color) 52 Line 1 54 0 - 42: 39 Load 41(texSampler1D) - 43: 8(float) Load 33(coords1D) - 44: 34(fvec4) ImageSampleImplicitLod 42 43 - 45: 34(fvec4) Load 36(color) - 46: 34(fvec4) FAdd 45 44 - Store 36(color) 46 + 53: 15 Load 17(texSampler1D) + 54: 8(float) Load 49(coords1D) + 55: 24(fvec4) ImageSampleImplicitLod 53 54 + 56: 24(fvec4) Load 51(color) + 57: 24(fvec4) FAdd 56 55 + Store 51(color) 57 Line 1 55 0 - 47: 39 Load 41(texSampler1D) - 48: 8(float) Load 33(coords1D) - 49: 8(float) Load 31(bias) - 50: 34(fvec4) ImageSampleImplicitLod 47 48 Bias 49 - 51: 34(fvec4) Load 36(color) - 52: 34(fvec4) FAdd 51 50 - Store 36(color) 52 + 58: 15 Load 17(texSampler1D) + 59: 8(float) Load 49(coords1D) + 60: 8(float) Load 47(bias) + 61: 24(fvec4) ImageSampleImplicitLod 58 59 Bias 60 + 62: 24(fvec4) Load 51(color) + 63: 24(fvec4) FAdd 62 61 + Store 51(color) 63 Line 1 103 0 - 57: 54 Load 56(texSampler2D) - 61: 58(fvec2) Load 60(coords2D) - 62: 34(fvec4) ImageSampleImplicitLod 57 61 - 63: 34(fvec4) Load 36(color) - 64: 34(fvec4) FAdd 63 62 - Store 36(color) 64 + 64: 19 Load 21(texSampler2D) + 65: 27(fvec2) Load 29(coords2D) + 66: 24(fvec4) ImageSampleImplicitLod 64 65 + 67: 24(fvec4) Load 51(color) + 68: 24(fvec4) FAdd 67 66 + Store 51(color) 68 Line 1 104 0 - 65: 54 Load 56(texSampler2D) - 66: 58(fvec2) Load 60(coords2D) - 67: 8(float) Load 31(bias) - 68: 34(fvec4) ImageSampleImplicitLod 65 66 Bias 67 - 69: 34(fvec4) Load 36(color) - 70: 34(fvec4) FAdd 69 68 - Store 36(color) 70 + 69: 19 Load 21(texSampler2D) + 70: 27(fvec2) Load 29(coords2D) + 71: 8(float) Load 47(bias) + 72: 24(fvec4) ImageSampleImplicitLod 69 70 Bias 71 + 73: 24(fvec4) Load 51(color) + 74: 24(fvec4) FAdd 73 72 + Store 51(color) 74 Line 1 106 0 - 73: 34(fvec4) Load 36(color) - 76: 34(fvec4) Load 75(u) - 79: 8(float) Load 78(blend) - 80: 8(float) Load 27(blendscale) + 77: 24(fvec4) Load 51(color) + 78: 24(fvec4) Load 26(u) + 79: 8(float) Load 23(blend) + 80: 8(float) Load 43(blendscale) 81: 8(float) FMul 79 80 - 82: 34(fvec4) CompositeConstruct 81 81 81 81 - 83: 34(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 73 76 82 - Store 72(gl_FragColor) 83 + 82: 24(fvec4) CompositeConstruct 81 81 81 81 + 83: 24(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 77 78 82 + Store 76(gl_FragColor) 83 Line 1 107 0 Return FunctionEnd @@ -176,19 +176,19 @@ void main() 11(x): 9(ptr) FunctionParameter 13: Label Line 7 2 0 - 14: 8(float) Load 11(x) - 17: 16(bool) FOrdGreaterThan 14 15 - SelectionMerge 19 None - BranchConditional 17 18 22 - 18: Label + 30: 8(float) Load 11(x) + 33: 32(bool) FOrdGreaterThan 30 31 + SelectionMerge 35 None + BranchConditional 33 34 38 + 34: Label Line 7 3 0 - 20: 8(float) Load 11(x) - ReturnValue 20 - 22: Label + 36: 8(float) Load 11(x) + ReturnValue 36 + 38: Label Line 7 6 0 - 23: 8(float) Load 11(x) - 24: 8(float) FNegate 23 - ReturnValue 24 - 19: Label + 39: 8(float) Load 11(x) + 40: 8(float) FNegate 39 + ReturnValue 40 + 35: Label Unreachable FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.promote_uint32_indices.comp.out b/third_party/glslang/Test/baseResults/spv.promote_uint32_indices.comp.out new file mode 100644 index 0000000000..7d0e18a580 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.promote_uint32_indices.comp.out @@ -0,0 +1,72 @@ +spv.promote_uint32_indices.comp +// Module Version 10600 +// Generated by (magic number): 8000b +// Id's are bound by 36 + + Capability Shader + Capability Int64 + Capability PhysicalStorageBufferAddressesEXT + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT GLSL450 + EntryPoint GLCompute 4 "main" 16 + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_shader_64bit_indexing" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_cooperative_matrix" + SourceExtension "GL_KHR_memory_scope_semantics" + SourceExtension "GL_NV_cooperative_vector" + Name 4 "main" + Name 8 "element" + Name 12 "y" + Name 14 "Block" + MemberName 14(Block) 0 "x" + Name 16 "block" + Decorate 13 ArrayStride 4 + Decorate 14(Block) Block + MemberDecorate 14(Block) 0 Coherent + MemberDecorate 14(Block) 0 Offset 0 + Decorate 16(block) Coherent + Decorate 16(block) Binding 0 + Decorate 16(block) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: 6(int) Constant 3000000000 + 10: TypeFloat 32 + 11: TypePointer Function 10(float) + 13: TypeRuntimeArray 10(float) + 14(Block): TypeStruct 13 + 15: TypePointer StorageBuffer 14(Block) + 16(block): 15(ptr) Variable StorageBuffer + 17: TypeInt 32 1 + 18: 17(int) Constant 0 + 20: TypeInt 64 1 + 21: TypeInt 64 0 + 23: TypePointer StorageBuffer 10(float) + 26: 20(int64_t) Constant 4000000000 0 + 29: 20(int64_t) Constant 705032704 1 + 32: TypeVector 6(int) 3 + 33: 6(int) Constant 64 + 34: 6(int) Constant 1 + 35: 32(ivec3) ConstantComposite 33 34 34 + 4(main): 2 Function None 3 + 5: Label + 8(element): 7(ptr) Variable Function + 12(y): 11(ptr) Variable Function + Store 8(element) 9 + 19: 6(int) Load 8(element) + 22: 21(int64_t) UConvert 19 + 24: 23(ptr) AccessChain 16(block) 18 22 + 25: 10(float) Load 24 + Store 12(y) 25 + 27: 23(ptr) AccessChain 16(block) 18 26 + 28: 10(float) Load 27 + Store 12(y) 28 + 30: 23(ptr) AccessChain 16(block) 18 29 + 31: 10(float) Load 30 + Store 12(y) 31 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.pushConstantBank.vert.out b/third_party/glslang/Test/baseResults/spv.pushConstantBank.vert.out new file mode 100644 index 0000000000..d2741c2805 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.pushConstantBank.vert.out @@ -0,0 +1,164 @@ +spv.pushConstantBank.vert +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 75 + + Capability Shader + Capability PushConstantBanksNV + Extension "SPV_NV_push_constant_bank" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 70 + Source GLSL 460 + SourceExtension "GL_NV_push_constant_bank" + Name 4 "main" + Name 9 "ResultData" + MemberName 9(ResultData) 0 "bank" + Name 11 "resultData" + Name 14 "PushConstantBank0" + MemberName 14(PushConstantBank0) 0 "data" + Name 16 "bank0" + Name 23 "PushConstantBank1" + MemberName 23(PushConstantBank1) 0 "data" + Name 25 "bank1" + Name 30 "PushConstantBank2" + MemberName 30(PushConstantBank2) 0 "data" + Name 32 "bank2" + Name 37 "PushConstantBank3" + MemberName 37(PushConstantBank3) 0 "data" + Name 39 "bank3" + Name 44 "PushConstantBank4" + MemberName 44(PushConstantBank4) 0 "data" + Name 46 "bank4" + Name 51 "PushConstantBank5" + MemberName 51(PushConstantBank5) 0 "data" + Name 53 "bank5" + Name 58 "PushConstantBank6" + MemberName 58(PushConstantBank6) 0 "data" + Name 60 "bank6_offset" + Name 68 "gl_PerVertex" + MemberName 68(gl_PerVertex) 0 "gl_Position" + MemberName 68(gl_PerVertex) 1 "gl_PointSize" + MemberName 68(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 68(gl_PerVertex) 3 "gl_CullDistance" + Name 70 "" + Decorate 8 ArrayStride 4 + Decorate 9(ResultData) BufferBlock + MemberDecorate 9(ResultData) 0 Offset 0 + Decorate 11(resultData) Binding 0 + Decorate 11(resultData) DescriptorSet 0 + Decorate 14(PushConstantBank0) Block + MemberDecorate 14(PushConstantBank0) 0 Offset 0 + Decorate 23(PushConstantBank1) Block + Decorate 23(PushConstantBank1) BankNV 1 + MemberDecorate 23(PushConstantBank1) 0 Offset 0 + Decorate 25(bank1) BankNV 1 + Decorate 30(PushConstantBank2) Block + Decorate 30(PushConstantBank2) BankNV 2 + MemberDecorate 30(PushConstantBank2) 0 Offset 0 + Decorate 32(bank2) BankNV 2 + Decorate 37(PushConstantBank3) Block + Decorate 37(PushConstantBank3) BankNV 3 + MemberDecorate 37(PushConstantBank3) 0 Offset 0 + Decorate 39(bank3) BankNV 3 + Decorate 44(PushConstantBank4) Block + Decorate 44(PushConstantBank4) BankNV 4 + MemberDecorate 44(PushConstantBank4) 0 Offset 0 + Decorate 46(bank4) BankNV 4 + Decorate 51(PushConstantBank5) Block + Decorate 51(PushConstantBank5) BankNV 5 + MemberDecorate 51(PushConstantBank5) 0 Offset 0 + Decorate 53(bank5) BankNV 5 + Decorate 58(PushConstantBank6) Block + Decorate 58(PushConstantBank6) BankNV 6 + MemberDecorate 58(PushConstantBank6) 0 Offset 0 + Decorate 60(bank6_offset) MemberOffsetNV 64 + Decorate 60(bank6_offset) BankNV 6 + Decorate 68(gl_PerVertex) Block + MemberDecorate 68(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 68(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 68(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 68(gl_PerVertex) 3 BuiltIn CullDistance + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: 6(int) Constant 8 + 8: TypeArray 6(int) 7 + 9(ResultData): TypeStruct 8 + 10: TypePointer Uniform 9(ResultData) + 11(resultData): 10(ptr) Variable Uniform + 12: TypeInt 32 1 + 13: 12(int) Constant 0 +14(PushConstantBank0): TypeStruct 6(int) + 15: TypePointer PushConstant 14(PushConstantBank0) + 16(bank0): 15(ptr) Variable PushConstant + 17: TypePointer PushConstant 6(int) + 20: TypePointer Uniform 6(int) + 22: 12(int) Constant 1 +23(PushConstantBank1): TypeStruct 6(int) + 24: TypePointer PushConstant 23(PushConstantBank1) + 25(bank1): 24(ptr) Variable PushConstant + 29: 12(int) Constant 2 +30(PushConstantBank2): TypeStruct 6(int) + 31: TypePointer PushConstant 30(PushConstantBank2) + 32(bank2): 31(ptr) Variable PushConstant + 36: 12(int) Constant 3 +37(PushConstantBank3): TypeStruct 6(int) + 38: TypePointer PushConstant 37(PushConstantBank3) + 39(bank3): 38(ptr) Variable PushConstant + 43: 12(int) Constant 4 +44(PushConstantBank4): TypeStruct 6(int) + 45: TypePointer PushConstant 44(PushConstantBank4) + 46(bank4): 45(ptr) Variable PushConstant + 50: 12(int) Constant 5 +51(PushConstantBank5): TypeStruct 6(int) + 52: TypePointer PushConstant 51(PushConstantBank5) + 53(bank5): 52(ptr) Variable PushConstant + 57: 12(int) Constant 6 +58(PushConstantBank6): TypeStruct 6(int) + 59: TypePointer PushConstant 58(PushConstantBank6) +60(bank6_offset): 59(ptr) Variable PushConstant + 64: TypeFloat 32 + 65: TypeVector 64(float) 4 + 66: 6(int) Constant 1 + 67: TypeArray 64(float) 66 +68(gl_PerVertex): TypeStruct 65(fvec4) 64(float) 67 67 + 69: TypePointer Output 68(gl_PerVertex) + 70: 69(ptr) Variable Output + 71: 64(float) Constant 0 + 72: 65(fvec4) ConstantComposite 71 71 71 71 + 73: TypePointer Output 65(fvec4) + 4(main): 2 Function None 3 + 5: Label + 18: 17(ptr) AccessChain 16(bank0) 13 + 19: 6(int) Load 18 + 21: 20(ptr) AccessChain 11(resultData) 13 13 + Store 21 19 + 26: 17(ptr) AccessChain 25(bank1) 13 + 27: 6(int) Load 26 + 28: 20(ptr) AccessChain 11(resultData) 13 22 + Store 28 27 + 33: 17(ptr) AccessChain 32(bank2) 13 + 34: 6(int) Load 33 + 35: 20(ptr) AccessChain 11(resultData) 13 29 + Store 35 34 + 40: 17(ptr) AccessChain 39(bank3) 13 + 41: 6(int) Load 40 + 42: 20(ptr) AccessChain 11(resultData) 13 36 + Store 42 41 + 47: 17(ptr) AccessChain 46(bank4) 13 + 48: 6(int) Load 47 + 49: 20(ptr) AccessChain 11(resultData) 13 43 + Store 49 48 + 54: 17(ptr) AccessChain 53(bank5) 13 + 55: 6(int) Load 54 + 56: 20(ptr) AccessChain 11(resultData) 13 50 + Store 56 55 + 61: 17(ptr) AccessChain 60(bank6_offset) 13 + 62: 6(int) Load 61 + 63: 20(ptr) AccessChain 11(resultData) 13 57 + Store 63 62 + 74: 73(ptr) AccessChain 70 13 + Store 74 72 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.qcom.coopmatConversion.1.comp.out b/third_party/glslang/Test/baseResults/spv.qcom.coopmatConversion.1.comp.out new file mode 100644 index 0000000000..d58a5984ed --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.qcom.coopmatConversion.1.comp.out @@ -0,0 +1,459 @@ +spv.qcom.coopmatConversion.1.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 279 + + Capability Shader + Capability Float16 + Capability Int8 + Capability CooperativeMatrixConversionQCOM + Capability VulkanMemoryModelKHR + Capability CooperativeMatrixKHR + Extension "SPV_KHR_cooperative_matrix" + Extension "SPV_KHR_vulkan_memory_model" + Extension "SPV_QCOM_cooperative_matrix_conversion" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical VulkanKHR + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 2 2 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_control_flow_attributes" + SourceExtension "GL_EXT_scalar_block_layout" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int8" + SourceExtension "GL_KHR_cooperative_matrix" + SourceExtension "GL_KHR_memory_scope_semantics" + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_QCOM_cooperative_matrix_conversion" + Name 4 "main" + Name 10 "uvec8A" + Name 15 "hvec8A" + Name 23 "vec8A" + Name 27 "ivec8A" + Name 35 "ivec32B" + Name 39 "hvec32B" + Name 46 "vec32B" + Name 49 "uvec32B" + Name 56 "ivec64Acc" + Name 59 "uvec64Acc" + Name 66 "vec64Acc" + Name 89 "hvec8A_4" + Name 95 "matA_f32_64_8" + Name 102 "matA_f16_64_16" + Name 110 "matA_i8_64_32" + Name 113 "i8vec8A" + Name 121 "matA_u8_64_32" + Name 124 "u8vec8A" + Name 132 "matB_f32_8_64" + Name 139 "matB_f16_16_64" + Name 146 "matB_i8_32_64" + Name 147 "i8vec8B" + Name 154 "matB_u8_32_64" + Name 155 "u8vec8B" + Name 162 "matB_f16_16_32" + Name 169 "matB_i8_32_16" + Name 177 "matAcc_f32_64_64" + Name 184 "matAcc_f16_64_64" + Name 185 "hvec64Acc" + Name 192 "matAcc_i32_64_64" + Name 199 "matAcc_u32_64_64" + Name 210 "i8vec8A" + Name 215 "u8vec8A" + Name 228 "i8vec8B" + Name 233 "u8vec8B" + Name 250 "hvec64Acc" + Name 262 "InputA" + MemberName 262(InputA) 0 "x" + Name 264 "inputA" + Name 266 "InputB" + MemberName 266(InputB) 0 "x" + Name 268 "inputB" + Name 270 "InputC" + MemberName 270(InputC) 0 "x" + Name 272 "inputC" + Name 274 "Output" + MemberName 274(Output) 0 "x" + Name 276 "outputO" + Decorate 261 ArrayStride 4 + Decorate 262(InputA) Block + MemberDecorate 262(InputA) 0 NonWritable + MemberDecorate 262(InputA) 0 Offset 0 + Decorate 264(inputA) NonWritable + Decorate 264(inputA) Binding 0 + Decorate 264(inputA) DescriptorSet 0 + Decorate 265 ArrayStride 4 + Decorate 266(InputB) Block + MemberDecorate 266(InputB) 0 NonWritable + MemberDecorate 266(InputB) 0 Offset 0 + Decorate 268(inputB) NonWritable + Decorate 268(inputB) Binding 1 + Decorate 268(inputB) DescriptorSet 0 + Decorate 269 ArrayStride 4 + Decorate 270(InputC) Block + MemberDecorate 270(InputC) 0 NonWritable + MemberDecorate 270(InputC) 0 Offset 0 + Decorate 272(inputC) NonWritable + Decorate 272(inputC) Binding 2 + Decorate 272(inputC) DescriptorSet 0 + Decorate 273 ArrayStride 4 + Decorate 274(Output) Block + MemberDecorate 274(Output) 0 Offset 0 + Decorate 276(outputO) Binding 3 + Decorate 276(outputO) DescriptorSet 0 + Decorate 278 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: 6(int) Constant 8 + 8: TypeArray 6(int) 7 + 9: TypePointer Function 8 + 11: TypeFloat 16 + 12: 6(int) Constant 16 + 13: TypeArray 11(float16_t) 12 + 14: TypePointer Function 13 + 20: TypeFloat 32 + 21: TypeArray 20(float) 7 + 22: TypePointer Function 21 + 24: TypeInt 32 1 + 25: TypeArray 24(int) 7 + 26: TypePointer Function 25 + 32: 6(int) Constant 32 + 33: TypeArray 24(int) 32 + 34: TypePointer Function 33 + 36: 6(int) Constant 64 + 37: TypeArray 11(float16_t) 36 + 38: TypePointer Function 37 + 44: TypeArray 20(float) 32 + 45: TypePointer Function 44 + 47: TypeArray 6(int) 32 + 48: TypePointer Function 47 + 54: TypeArray 24(int) 36 + 55: TypePointer Function 54 + 57: TypeArray 6(int) 36 + 58: TypePointer Function 57 + 64: TypeArray 20(float) 36 + 65: TypePointer Function 64 + 72: 6(int) Constant 0 + 83: 6(int) Constant 4 + 87: TypeArray 11(float16_t) 83 + 88: TypePointer Function 87 + 92: 6(int) Constant 3 + 93: TypeCooperativeMatrixKHR 20(float) 92 36 7 72 + 94: TypePointer Function 93 + 100: TypeCooperativeMatrixKHR 11(float16_t) 92 36 12 72 + 101: TypePointer Function 100 + 107: TypeInt 8 1 + 108: TypeCooperativeMatrixKHR 107(int8_t) 92 36 32 72 + 109: TypePointer Function 108 + 111: TypeArray 107(int8_t) 32 + 112: TypePointer Function 111 + 118: TypeInt 8 0 + 119: TypeCooperativeMatrixKHR 118(int8_t) 92 36 32 72 + 120: TypePointer Function 119 + 122: TypeArray 118(int8_t) 32 + 123: TypePointer Function 122 + 129: 6(int) Constant 1 + 130: TypeCooperativeMatrixKHR 20(float) 92 7 36 129 + 131: TypePointer Function 130 + 137: TypeCooperativeMatrixKHR 11(float16_t) 92 12 36 129 + 138: TypePointer Function 137 + 144: TypeCooperativeMatrixKHR 107(int8_t) 92 32 36 129 + 145: TypePointer Function 144 + 152: TypeCooperativeMatrixKHR 118(int8_t) 92 32 36 129 + 153: TypePointer Function 152 + 160: TypeCooperativeMatrixKHR 11(float16_t) 92 12 32 129 + 161: TypePointer Function 160 + 167: TypeCooperativeMatrixKHR 107(int8_t) 92 32 12 129 + 168: TypePointer Function 167 + 174: 6(int) Constant 2 + 175: TypeCooperativeMatrixKHR 20(float) 92 36 36 174 + 176: TypePointer Function 175 + 182: TypeCooperativeMatrixKHR 11(float16_t) 92 36 36 174 + 183: TypePointer Function 182 + 190: TypeCooperativeMatrixKHR 24(int) 92 36 36 174 + 191: TypePointer Function 190 + 197: TypeCooperativeMatrixKHR 6(int) 92 36 36 174 + 198: TypePointer Function 197 + 261: TypeRuntimeArray 20(float) + 262(InputA): TypeStruct 261 + 263: TypePointer StorageBuffer 262(InputA) + 264(inputA): 263(ptr) Variable StorageBuffer + 265: TypeRuntimeArray 20(float) + 266(InputB): TypeStruct 265 + 267: TypePointer StorageBuffer 266(InputB) + 268(inputB): 267(ptr) Variable StorageBuffer + 269: TypeRuntimeArray 20(float) + 270(InputC): TypeStruct 269 + 271: TypePointer StorageBuffer 270(InputC) + 272(inputC): 271(ptr) Variable StorageBuffer + 273: TypeRuntimeArray 20(float) + 274(Output): TypeStruct 273 + 275: TypePointer StorageBuffer 274(Output) + 276(outputO): 275(ptr) Variable StorageBuffer + 277: TypeVector 6(int) 3 + 278: 277(ivec3) ConstantComposite 36 174 174 + 4(main): 2 Function None 3 + 5: Label + 10(uvec8A): 9(ptr) Variable Function + 15(hvec8A): 14(ptr) Variable Function + 23(vec8A): 22(ptr) Variable Function + 27(ivec8A): 26(ptr) Variable Function + 35(ivec32B): 34(ptr) Variable Function + 39(hvec32B): 38(ptr) Variable Function + 46(vec32B): 45(ptr) Variable Function + 49(uvec32B): 48(ptr) Variable Function + 56(ivec64Acc): 55(ptr) Variable Function + 59(uvec64Acc): 58(ptr) Variable Function + 66(vec64Acc): 65(ptr) Variable Function + 89(hvec8A_4): 88(ptr) Variable Function +95(matA_f32_64_8): 94(ptr) Variable Function +102(matA_f16_64_16): 101(ptr) Variable Function +110(matA_i8_64_32): 109(ptr) Variable Function + 113(i8vec8A): 112(ptr) Variable Function +121(matA_u8_64_32): 120(ptr) Variable Function + 124(u8vec8A): 123(ptr) Variable Function +132(matB_f32_8_64): 131(ptr) Variable Function +139(matB_f16_16_64): 138(ptr) Variable Function +146(matB_i8_32_64): 145(ptr) Variable Function + 147(i8vec8B): 112(ptr) Variable Function +154(matB_u8_32_64): 153(ptr) Variable Function + 155(u8vec8B): 123(ptr) Variable Function +162(matB_f16_16_32): 161(ptr) Variable Function +169(matB_i8_32_16): 168(ptr) Variable Function +177(matAcc_f32_64_64): 176(ptr) Variable Function +184(matAcc_f16_64_64): 183(ptr) Variable Function + 185(hvec64Acc): 38(ptr) Variable Function +192(matAcc_i32_64_64): 191(ptr) Variable Function +199(matAcc_u32_64_64): 198(ptr) Variable Function + 210(i8vec8A): 112(ptr) Variable Function + 215(u8vec8A): 123(ptr) Variable Function + 228(i8vec8B): 112(ptr) Variable Function + 233(u8vec8B): 123(ptr) Variable Function + 250(hvec64Acc): 38(ptr) Variable Function + 16: 13 Load 15(hvec8A) + 17: 8 BitCastArrayQCOM 16 + Store 10(uvec8A) 17 + 18: 8 Load 10(uvec8A) + 19: 13 BitCastArrayQCOM 18 + Store 15(hvec8A) 19 + 28: 25 Load 27(ivec8A) + 29: 21 BitCastArrayQCOM 28 + Store 23(vec8A) 29 + 30: 21 Load 23(vec8A) + 31: 25 BitCastArrayQCOM 30 + Store 27(ivec8A) 31 + 40: 37 Load 39(hvec32B) + 41: 33 BitCastArrayQCOM 40 + Store 35(ivec32B) 41 + 42: 33 Load 35(ivec32B) + 43: 37 BitCastArrayQCOM 42 + Store 39(hvec32B) 43 + 50: 47 Load 49(uvec32B) + 51: 44 BitCastArrayQCOM 50 + Store 46(vec32B) 51 + 52: 44 Load 46(vec32B) + 53: 47 BitCastArrayQCOM 52 + Store 49(uvec32B) 53 + 60: 57 Load 59(uvec64Acc) + 61: 54 BitCastArrayQCOM 60 + Store 56(ivec64Acc) 61 + 62: 54 Load 56(ivec64Acc) + 63: 57 BitCastArrayQCOM 62 + Store 59(uvec64Acc) 63 + 67: 57 Load 59(uvec64Acc) + 68: 64 BitCastArrayQCOM 67 + Store 66(vec64Acc) 68 + 69: 64 Load 66(vec64Acc) + 70: 57 BitCastArrayQCOM 69 + Store 59(uvec64Acc) 70 + 71: 54 Load 56(ivec64Acc) + 73: 25 ExtractSubArrayQCOM 71 72 + Store 27(ivec8A) 73 + 74: 54 Load 56(ivec64Acc) + 75: 33 ExtractSubArrayQCOM 74 7 + Store 35(ivec32B) 75 + 76: 57 Load 59(uvec64Acc) + 77: 8 ExtractSubArrayQCOM 76 72 + Store 10(uvec8A) 77 + 78: 57 Load 59(uvec64Acc) + 79: 47 ExtractSubArrayQCOM 78 7 + Store 49(uvec32B) 79 + 80: 64 Load 66(vec64Acc) + 81: 21 ExtractSubArrayQCOM 80 72 + Store 23(vec8A) 81 + 82: 64 Load 66(vec64Acc) + 84: 44 ExtractSubArrayQCOM 82 83 + Store 46(vec32B) 84 + 85: 37 Load 39(hvec32B) + 86: 13 ExtractSubArrayQCOM 85 72 + Store 15(hvec8A) 86 + 90: 37 Load 39(hvec32B) + 91: 87 ExtractSubArrayQCOM 90 83 + Store 89(hvec8A_4) 91 + 96: 21 Load 23(vec8A) + 97: 93 CompositeConstructCoopMatQCOM 96 + Store 95(matA_f32_64_8) 97 + 98: 8 Load 10(uvec8A) + 99: 93 CompositeConstructCoopMatQCOM 98 + Store 95(matA_f32_64_8) 99 + 103: 13 Load 15(hvec8A) + 104: 100 CompositeConstructCoopMatQCOM 103 + Store 102(matA_f16_64_16) 104 + 105: 8 Load 10(uvec8A) + 106: 100 CompositeConstructCoopMatQCOM 105 + Store 102(matA_f16_64_16) 106 + 114: 111 Load 113(i8vec8A) + 115: 108 CompositeConstructCoopMatQCOM 114 + Store 110(matA_i8_64_32) 115 + 116: 8 Load 10(uvec8A) + 117: 108 CompositeConstructCoopMatQCOM 116 + Store 110(matA_i8_64_32) 117 + 125: 122 Load 124(u8vec8A) + 126: 119 CompositeConstructCoopMatQCOM 125 + Store 121(matA_u8_64_32) 126 + 127: 8 Load 10(uvec8A) + 128: 119 CompositeConstructCoopMatQCOM 127 + Store 121(matA_u8_64_32) 128 + 133: 21 Load 23(vec8A) + 134: 130 CompositeConstructCoopMatQCOM 133 + Store 132(matB_f32_8_64) 134 + 135: 8 Load 10(uvec8A) + 136: 130 CompositeConstructCoopMatQCOM 135 + Store 132(matB_f32_8_64) 136 + 140: 13 Load 15(hvec8A) + 141: 137 CompositeConstructCoopMatQCOM 140 + Store 139(matB_f16_16_64) 141 + 142: 8 Load 10(uvec8A) + 143: 137 CompositeConstructCoopMatQCOM 142 + Store 139(matB_f16_16_64) 143 + 148: 111 Load 147(i8vec8B) + 149: 144 CompositeConstructCoopMatQCOM 148 + Store 146(matB_i8_32_64) 149 + 150: 8 Load 10(uvec8A) + 151: 144 CompositeConstructCoopMatQCOM 150 + Store 146(matB_i8_32_64) 151 + 156: 122 Load 155(u8vec8B) + 157: 152 CompositeConstructCoopMatQCOM 156 + Store 154(matB_u8_32_64) 157 + 158: 8 Load 10(uvec8A) + 159: 152 CompositeConstructCoopMatQCOM 158 + Store 154(matB_u8_32_64) 159 + 163: 13 Load 15(hvec8A) + 164: 160 CompositeConstructCoopMatQCOM 163 + Store 162(matB_f16_16_32) 164 + 165: 8 Load 10(uvec8A) + 166: 160 CompositeConstructCoopMatQCOM 165 + Store 162(matB_f16_16_32) 166 + 170: 111 Load 147(i8vec8B) + 171: 167 CompositeConstructCoopMatQCOM 170 + Store 169(matB_i8_32_16) 171 + 172: 8 Load 10(uvec8A) + 173: 167 CompositeConstructCoopMatQCOM 172 + Store 169(matB_i8_32_16) 173 + 178: 64 Load 66(vec64Acc) + 179: 175 CompositeConstructCoopMatQCOM 178 + Store 177(matAcc_f32_64_64) 179 + 180: 57 Load 59(uvec64Acc) + 181: 175 CompositeConstructCoopMatQCOM 180 + Store 177(matAcc_f32_64_64) 181 + 186: 37 Load 185(hvec64Acc) + 187: 182 CompositeConstructCoopMatQCOM 186 + Store 184(matAcc_f16_64_64) 187 + 188: 47 Load 49(uvec32B) + 189: 182 CompositeConstructCoopMatQCOM 188 + Store 184(matAcc_f16_64_64) 189 + 193: 54 Load 56(ivec64Acc) + 194: 190 CompositeConstructCoopMatQCOM 193 + Store 192(matAcc_i32_64_64) 194 + 195: 57 Load 59(uvec64Acc) + 196: 190 CompositeConstructCoopMatQCOM 195 + Store 192(matAcc_i32_64_64) 196 + 200: 57 Load 59(uvec64Acc) + 201: 197 CompositeConstructCoopMatQCOM 200 + Store 199(matAcc_u32_64_64) 201 + 202: 93 Load 95(matA_f32_64_8) + 203: 21 CompositeExtractCoopMatQCOM 202 + Store 23(vec8A) 203 + 204: 93 Load 95(matA_f32_64_8) + 205: 8 CompositeExtractCoopMatQCOM 204 + Store 10(uvec8A) 205 + 206: 100 Load 102(matA_f16_64_16) + 207: 13 CompositeExtractCoopMatQCOM 206 + Store 15(hvec8A) 207 + 208: 100 Load 102(matA_f16_64_16) + 209: 8 CompositeExtractCoopMatQCOM 208 + Store 10(uvec8A) 209 + 211: 108 Load 110(matA_i8_64_32) + 212: 111 CompositeExtractCoopMatQCOM 211 + Store 210(i8vec8A) 212 + 213: 108 Load 110(matA_i8_64_32) + 214: 8 CompositeExtractCoopMatQCOM 213 + Store 10(uvec8A) 214 + 216: 119 Load 121(matA_u8_64_32) + 217: 122 CompositeExtractCoopMatQCOM 216 + Store 215(u8vec8A) 217 + 218: 119 Load 121(matA_u8_64_32) + 219: 8 CompositeExtractCoopMatQCOM 218 + Store 10(uvec8A) 219 + 220: 130 Load 132(matB_f32_8_64) + 221: 21 CompositeExtractCoopMatQCOM 220 + Store 23(vec8A) 221 + 222: 130 Load 132(matB_f32_8_64) + 223: 8 CompositeExtractCoopMatQCOM 222 + Store 10(uvec8A) 223 + 224: 137 Load 139(matB_f16_16_64) + 225: 13 CompositeExtractCoopMatQCOM 224 + Store 15(hvec8A) 225 + 226: 137 Load 139(matB_f16_16_64) + 227: 8 CompositeExtractCoopMatQCOM 226 + Store 10(uvec8A) 227 + 229: 144 Load 146(matB_i8_32_64) + 230: 111 CompositeExtractCoopMatQCOM 229 + Store 228(i8vec8B) 230 + 231: 144 Load 146(matB_i8_32_64) + 232: 8 CompositeExtractCoopMatQCOM 231 + Store 10(uvec8A) 232 + 234: 152 Load 154(matB_u8_32_64) + 235: 122 CompositeExtractCoopMatQCOM 234 + Store 233(u8vec8B) 235 + 236: 152 Load 154(matB_u8_32_64) + 237: 8 CompositeExtractCoopMatQCOM 236 + Store 10(uvec8A) 237 + 238: 160 Load 162(matB_f16_16_32) + 239: 13 CompositeExtractCoopMatQCOM 238 + Store 15(hvec8A) 239 + 240: 160 Load 162(matB_f16_16_32) + 241: 8 CompositeExtractCoopMatQCOM 240 + Store 10(uvec8A) 241 + 242: 167 Load 169(matB_i8_32_16) + 243: 111 CompositeExtractCoopMatQCOM 242 + Store 228(i8vec8B) 243 + 244: 167 Load 169(matB_i8_32_16) + 245: 8 CompositeExtractCoopMatQCOM 244 + Store 10(uvec8A) 245 + 246: 175 Load 177(matAcc_f32_64_64) + 247: 64 CompositeExtractCoopMatQCOM 246 + Store 66(vec64Acc) 247 + 248: 175 Load 177(matAcc_f32_64_64) + 249: 57 CompositeExtractCoopMatQCOM 248 + Store 59(uvec64Acc) 249 + 251: 182 Load 184(matAcc_f16_64_64) + 252: 37 CompositeExtractCoopMatQCOM 251 + Store 250(hvec64Acc) 252 + 253: 182 Load 184(matAcc_f16_64_64) + 254: 47 CompositeExtractCoopMatQCOM 253 + Store 49(uvec32B) 254 + 255: 190 Load 192(matAcc_i32_64_64) + 256: 54 CompositeExtractCoopMatQCOM 255 + Store 56(ivec64Acc) 256 + 257: 190 Load 192(matAcc_i32_64_64) + 258: 57 CompositeExtractCoopMatQCOM 257 + Store 59(uvec64Acc) 258 + 259: 197 Load 199(matAcc_u32_64_64) + 260: 57 CompositeExtractCoopMatQCOM 259 + Store 59(uvec64Acc) 260 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.qcom.coopmatConversion.2.comp.out b/third_party/glslang/Test/baseResults/spv.qcom.coopmatConversion.2.comp.out new file mode 100644 index 0000000000..919f387379 --- /dev/null +++ b/third_party/glslang/Test/baseResults/spv.qcom.coopmatConversion.2.comp.out @@ -0,0 +1,458 @@ +spv.qcom.coopmatConversion.2.comp +// Module Version 10300 +// Generated by (magic number): 8000b +// Id's are bound by 268 + + Capability Shader + Capability Float16 + Capability Int8 + Capability CooperativeMatrixConversionQCOM + Capability VulkanMemoryModelKHR + Capability CooperativeMatrixKHR + Extension "SPV_KHR_cooperative_matrix" + Extension "SPV_KHR_vulkan_memory_model" + Extension "SPV_QCOM_cooperative_matrix_conversion" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical VulkanKHR + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 2 2 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_control_flow_attributes" + SourceExtension "GL_EXT_scalar_block_layout" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int8" + SourceExtension "GL_KHR_cooperative_matrix" + SourceExtension "GL_KHR_memory_scope_semantics" + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_QCOM_cooperative_matrix_conversion" + Name 4 "main" + Name 8 "TILE_K" + Name 11 "f32vecSC" + Name 15 "uvec8" + Name 20 "vec8" + Name 23 "uvecSC" + Name 32 "uvecSC2" + Name 37 "uvecSC" + Name 41 "uvec64Acc" + Name 45 "TILE_N" + Name 48 "uvec64AccSC" + Name 61 "uvec64AccSC2" + Name 65 "TILE_M" + Name 68 "V2C_matA_f32_SC_M8" + Name 73 "V2C_matA_f32_SC_MK" + Name 74 "uvecSC_K11" + Name 79 "V2C_matA_f32_SC_64_8" + Name 80 "TILE_K2" + Name 83 "uvecSC_K12" + Name 89 "V2C_matA_f16_SC_MK" + Name 93 "TILE_K4" + Name 96 "V2C_matA_i8_SC_64K" + Name 102 "V2C_matA_u8_SC_64K" + Name 108 "V2C_matB_f32_SC_8N" + Name 113 "V2C_matB_f32_SC_KN" + Name 114 "uvecSC_K21" + Name 119 "V2C_matB_f32_SC_8_64" + Name 120 "uvecSC_K22" + Name 125 "V2C_matB_f16_SC_KN" + Name 130 "V2C_matB_i8_SC_K64" + Name 135 "V2C_matB_u8_SC_K64" + Name 141 "V2C_matB_f32_SC_K32" + Name 147 "V2C_matB_f32_SC_K16" + Name 152 "V2C_matAcc_f32_SC_MN" + Name 153 "uvecSC_N31" + Name 158 "V2C_matAcc_f32_SC_64_64" + Name 159 "TILE_N2" + Name 162 "uvecSC_N32" + Name 167 "V2C_matAcc_f16_SC_MN" + Name 171 "TILE_N4" + Name 174 "V2C_matAcc_i32_SC_64N" + Name 179 "V2C_matAcc_u32_SC_64N" + Name 182 "C2V_matA_f32_SC_M8" + Name 185 "uvecSC_K11" + Name 186 "C2V_matA_f32_SC_MK" + Name 189 "uvecSC_K12" + Name 190 "C2V_matA_f32_SC_64_8" + Name 193 "C2V_matA_f16_SC_MK" + Name 196 "C2V_matA_i8_SC_64K" + Name 199 "C2V_matA_u8_SC_64K" + Name 202 "C2V_matB_f32_SC_8N" + Name 205 "uvecSC_K21" + Name 206 "C2V_matB_f32_SC_KN" + Name 209 "uvecSC_K22" + Name 210 "C2V_matB_f32_SC_8_64" + Name 213 "C2V_matB_f16_SC_KN" + Name 216 "C2V_matB_i8_SC_K64" + Name 219 "C2V_matB_u8_SC_K64" + Name 222 "C2V_matB_f32_SC_K32" + Name 225 "C2V_matB_f32_SC_K16" + Name 228 "uvecSC_N31" + Name 229 "C2V_matAcc_f32_SC_MN" + Name 234 "C2V_matAcc_f32_SC_64N" + Name 237 "uvecSC_N32" + Name 238 "C2V_matAcc_f32_SC_64_64" + Name 241 "C2V_matAcc_f16_SC_MN" + Name 244 "C2V_matAcc_i32_SC_64N" + Name 247 "C2V_matAcc_u32_SC_64N" + Name 251 "InputA" + MemberName 251(InputA) 0 "x" + Name 253 "inputA" + Name 255 "InputB" + MemberName 255(InputB) 0 "x" + Name 257 "inputB" + Name 259 "InputC" + MemberName 259(InputC) 0 "x" + Name 261 "inputC" + Name 263 "Output" + MemberName 263(Output) 0 "x" + Name 265 "outputO" + Decorate 8(TILE_K) SpecId 7 + Decorate 45(TILE_N) SpecId 4 + Decorate 65(TILE_M) SpecId 3 + Decorate 80(TILE_K2) SpecId 8 + Decorate 93(TILE_K4) SpecId 9 + Decorate 159(TILE_N2) SpecId 5 + Decorate 171(TILE_N4) SpecId 6 + Decorate 250 ArrayStride 4 + Decorate 251(InputA) Block + MemberDecorate 251(InputA) 0 NonWritable + MemberDecorate 251(InputA) 0 Offset 0 + Decorate 253(inputA) NonWritable + Decorate 253(inputA) Binding 0 + Decorate 253(inputA) DescriptorSet 0 + Decorate 254 ArrayStride 4 + Decorate 255(InputB) Block + MemberDecorate 255(InputB) 0 NonWritable + MemberDecorate 255(InputB) 0 Offset 0 + Decorate 257(inputB) NonWritable + Decorate 257(inputB) Binding 1 + Decorate 257(inputB) DescriptorSet 0 + Decorate 258 ArrayStride 4 + Decorate 259(InputC) Block + MemberDecorate 259(InputC) 0 NonWritable + MemberDecorate 259(InputC) 0 Offset 0 + Decorate 261(inputC) NonWritable + Decorate 261(inputC) Binding 2 + Decorate 261(inputC) DescriptorSet 0 + Decorate 262 ArrayStride 4 + Decorate 263(Output) Block + MemberDecorate 263(Output) 0 Offset 0 + Decorate 265(outputO) Binding 3 + Decorate 265(outputO) DescriptorSet 0 + Decorate 267 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeInt 32 0 + 8(TILE_K): 7(int) SpecConstant 1 + 9: TypeArray 6(float) 8(TILE_K) + 10: TypePointer Function 9 + 12: 7(int) Constant 8 + 13: TypeArray 7(int) 12 + 14: TypePointer Function 13 + 18: TypeArray 6(float) 12 + 19: TypePointer Function 18 + 21: TypeArray 7(int) 8(TILE_K) + 22: TypePointer Function 21 + 28: 7(int) Constant 2 + 29: 7(int) SpecConstantOp 134 8(TILE_K) 28 + 30: TypeArray 7(int) 29 + 31: TypePointer Function 30 + 34: 7(int) SpecConstantOp 134 8(TILE_K) 28 + 35: TypeArray 6(float) 34 + 38: 7(int) Constant 64 + 39: TypeArray 7(int) 38 + 40: TypePointer Function 39 + 43: 7(int) Constant 0 + 45(TILE_N): 7(int) SpecConstant 1 + 46: TypeArray 7(int) 45(TILE_N) + 47: TypePointer Function 46 + 50: 7(int) Constant 4 + 55: 7(int) SpecConstantOp 134 8(TILE_K) 28 + 56: TypeArray 7(int) 55 + 58: 7(int) SpecConstantOp 134 45(TILE_N) 28 + 59: TypeArray 7(int) 58 + 60: TypePointer Function 59 + 64: 7(int) Constant 3 + 65(TILE_M): 7(int) SpecConstant 1 + 66: TypeCooperativeMatrixKHR 6(float) 64 65(TILE_M) 12 43 + 67: TypePointer Function 66 + 71: TypeCooperativeMatrixKHR 6(float) 64 65(TILE_M) 8(TILE_K) 43 + 72: TypePointer Function 71 + 77: TypeCooperativeMatrixKHR 6(float) 64 38 12 43 + 78: TypePointer Function 77 + 80(TILE_K2): 7(int) SpecConstant 2 + 81: TypeArray 7(int) 80(TILE_K2) + 82: TypePointer Function 81 + 86: TypeFloat 16 + 87: TypeCooperativeMatrixKHR 86(float16_t) 64 65(TILE_M) 80(TILE_K2) 43 + 88: TypePointer Function 87 + 92: TypeInt 8 1 + 93(TILE_K4): 7(int) SpecConstant 4 + 94: TypeCooperativeMatrixKHR 92(int8_t) 64 38 93(TILE_K4) 43 + 95: TypePointer Function 94 + 99: TypeInt 8 0 + 100: TypeCooperativeMatrixKHR 99(int8_t) 64 38 93(TILE_K4) 43 + 101: TypePointer Function 100 + 105: 7(int) Constant 1 + 106: TypeCooperativeMatrixKHR 6(float) 64 12 45(TILE_N) 105 + 107: TypePointer Function 106 + 111: TypeCooperativeMatrixKHR 6(float) 64 8(TILE_K) 45(TILE_N) 105 + 112: TypePointer Function 111 + 117: TypeCooperativeMatrixKHR 6(float) 64 12 38 105 + 118: TypePointer Function 117 + 123: TypeCooperativeMatrixKHR 86(float16_t) 64 80(TILE_K2) 45(TILE_N) 105 + 124: TypePointer Function 123 + 128: TypeCooperativeMatrixKHR 92(int8_t) 64 93(TILE_K4) 38 105 + 129: TypePointer Function 128 + 133: TypeCooperativeMatrixKHR 99(int8_t) 64 93(TILE_K4) 38 105 + 134: TypePointer Function 133 + 138: 7(int) Constant 32 + 139: TypeCooperativeMatrixKHR 6(float) 64 8(TILE_K) 138 105 + 140: TypePointer Function 139 + 144: 7(int) Constant 16 + 145: TypeCooperativeMatrixKHR 6(float) 64 8(TILE_K) 144 105 + 146: TypePointer Function 145 + 150: TypeCooperativeMatrixKHR 6(float) 64 65(TILE_M) 45(TILE_N) 28 + 151: TypePointer Function 150 + 156: TypeCooperativeMatrixKHR 6(float) 64 38 38 28 + 157: TypePointer Function 156 + 159(TILE_N2): 7(int) SpecConstant 2 + 160: TypeArray 7(int) 159(TILE_N2) + 161: TypePointer Function 160 + 165: TypeCooperativeMatrixKHR 86(float16_t) 64 65(TILE_M) 159(TILE_N2) 28 + 166: TypePointer Function 165 + 170: TypeInt 32 1 + 171(TILE_N4): 7(int) SpecConstant 4 + 172: TypeCooperativeMatrixKHR 170(int) 64 38 171(TILE_N4) 28 + 173: TypePointer Function 172 + 177: TypeCooperativeMatrixKHR 7(int) 64 38 171(TILE_N4) 28 + 178: TypePointer Function 177 + 232: TypeCooperativeMatrixKHR 6(float) 64 38 45(TILE_N) 28 + 233: TypePointer Function 232 + 250: TypeRuntimeArray 6(float) + 251(InputA): TypeStruct 250 + 252: TypePointer StorageBuffer 251(InputA) + 253(inputA): 252(ptr) Variable StorageBuffer + 254: TypeRuntimeArray 6(float) + 255(InputB): TypeStruct 254 + 256: TypePointer StorageBuffer 255(InputB) + 257(inputB): 256(ptr) Variable StorageBuffer + 258: TypeRuntimeArray 6(float) + 259(InputC): TypeStruct 258 + 260: TypePointer StorageBuffer 259(InputC) + 261(inputC): 260(ptr) Variable StorageBuffer + 262: TypeRuntimeArray 6(float) + 263(Output): TypeStruct 262 + 264: TypePointer StorageBuffer 263(Output) + 265(outputO): 264(ptr) Variable StorageBuffer + 266: TypeVector 7(int) 3 + 267: 266(ivec3) ConstantComposite 38 28 28 + 4(main): 2 Function None 3 + 5: Label + 11(f32vecSC): 10(ptr) Variable Function + 15(uvec8): 14(ptr) Variable Function + 20(vec8): 19(ptr) Variable Function + 23(uvecSC): 22(ptr) Variable Function + 32(uvecSC2): 31(ptr) Variable Function + 37(uvecSC): 22(ptr) Variable Function + 41(uvec64Acc): 40(ptr) Variable Function + 48(uvec64AccSC): 47(ptr) Variable Function +61(uvec64AccSC2): 60(ptr) Variable Function +68(V2C_matA_f32_SC_M8): 67(ptr) Variable Function +73(V2C_matA_f32_SC_MK): 72(ptr) Variable Function + 74(uvecSC_K11): 22(ptr) Variable Function +79(V2C_matA_f32_SC_64_8): 78(ptr) Variable Function + 83(uvecSC_K12): 82(ptr) Variable Function +89(V2C_matA_f16_SC_MK): 88(ptr) Variable Function +96(V2C_matA_i8_SC_64K): 95(ptr) Variable Function +102(V2C_matA_u8_SC_64K): 101(ptr) Variable Function +108(V2C_matB_f32_SC_8N): 107(ptr) Variable Function +113(V2C_matB_f32_SC_KN): 112(ptr) Variable Function + 114(uvecSC_K21): 22(ptr) Variable Function +119(V2C_matB_f32_SC_8_64): 118(ptr) Variable Function + 120(uvecSC_K22): 82(ptr) Variable Function +125(V2C_matB_f16_SC_KN): 124(ptr) Variable Function +130(V2C_matB_i8_SC_K64): 129(ptr) Variable Function +135(V2C_matB_u8_SC_K64): 134(ptr) Variable Function +141(V2C_matB_f32_SC_K32): 140(ptr) Variable Function +147(V2C_matB_f32_SC_K16): 146(ptr) Variable Function +152(V2C_matAcc_f32_SC_MN): 151(ptr) Variable Function + 153(uvecSC_N31): 47(ptr) Variable Function +158(V2C_matAcc_f32_SC_64_64): 157(ptr) Variable Function + 162(uvecSC_N32): 161(ptr) Variable Function +167(V2C_matAcc_f16_SC_MN): 166(ptr) Variable Function +174(V2C_matAcc_i32_SC_64N): 173(ptr) Variable Function +179(V2C_matAcc_u32_SC_64N): 178(ptr) Variable Function +182(C2V_matA_f32_SC_M8): 67(ptr) Variable Function + 185(uvecSC_K11): 22(ptr) Variable Function +186(C2V_matA_f32_SC_MK): 72(ptr) Variable Function + 189(uvecSC_K12): 82(ptr) Variable Function +190(C2V_matA_f32_SC_64_8): 78(ptr) Variable Function +193(C2V_matA_f16_SC_MK): 88(ptr) Variable Function +196(C2V_matA_i8_SC_64K): 95(ptr) Variable Function +199(C2V_matA_u8_SC_64K): 101(ptr) Variable Function +202(C2V_matB_f32_SC_8N): 107(ptr) Variable Function + 205(uvecSC_K21): 22(ptr) Variable Function +206(C2V_matB_f32_SC_KN): 112(ptr) Variable Function + 209(uvecSC_K22): 82(ptr) Variable Function +210(C2V_matB_f32_SC_8_64): 118(ptr) Variable Function +213(C2V_matB_f16_SC_KN): 124(ptr) Variable Function +216(C2V_matB_i8_SC_K64): 129(ptr) Variable Function +219(C2V_matB_u8_SC_K64): 134(ptr) Variable Function +222(C2V_matB_f32_SC_K32): 140(ptr) Variable Function +225(C2V_matB_f32_SC_K16): 146(ptr) Variable Function + 228(uvecSC_N31): 47(ptr) Variable Function +229(C2V_matAcc_f32_SC_MN): 151(ptr) Variable Function +234(C2V_matAcc_f32_SC_64N): 233(ptr) Variable Function + 237(uvecSC_N32): 161(ptr) Variable Function +238(C2V_matAcc_f32_SC_64_64): 157(ptr) Variable Function +241(C2V_matAcc_f16_SC_MN): 166(ptr) Variable Function +244(C2V_matAcc_i32_SC_64N): 173(ptr) Variable Function +247(C2V_matAcc_u32_SC_64N): 178(ptr) Variable Function + 16: 13 Load 15(uvec8) + 17: 9 BitCastArrayQCOM 16 + Store 11(f32vecSC) 17 + 24: 21 Load 23(uvecSC) + 25: 18 BitCastArrayQCOM 24 + Store 20(vec8) 25 + 26: 21 Load 23(uvecSC) + 27: 9 BitCastArrayQCOM 26 + Store 11(f32vecSC) 27 + 33: 30 Load 32(uvecSC2) + 36: 35 BitCastArrayQCOM 33 + 42: 39 Load 41(uvec64Acc) + 44: 21 ExtractSubArrayQCOM 42 43 + Store 37(uvecSC) 44 + 49: 46 Load 48(uvec64AccSC) + 51: 13 ExtractSubArrayQCOM 49 50 + Store 15(uvec8) 51 + 52: 46 Load 48(uvec64AccSC) + 53: 21 ExtractSubArrayQCOM 52 12 + Store 37(uvecSC) 53 + 54: 39 Load 41(uvec64Acc) + 57: 56 ExtractSubArrayQCOM 54 28 + 62: 59 Load 61(uvec64AccSC2) + 63: 13 ExtractSubArrayQCOM 62 28 + Store 15(uvec8) 63 + 69: 13 Load 15(uvec8) + 70: 66 CompositeConstructCoopMatQCOM 69 + Store 68(V2C_matA_f32_SC_M8) 70 + 75: 21 Load 74(uvecSC_K11) + 76: 71 CompositeConstructCoopMatQCOM 75 + Store 73(V2C_matA_f32_SC_MK) 76 + 84: 81 Load 83(uvecSC_K12) + 85: 77 CompositeConstructCoopMatQCOM 84 + Store 79(V2C_matA_f32_SC_64_8) 85 + 90: 21 Load 74(uvecSC_K11) + 91: 87 CompositeConstructCoopMatQCOM 90 + Store 89(V2C_matA_f16_SC_MK) 91 + 97: 21 Load 74(uvecSC_K11) + 98: 94 CompositeConstructCoopMatQCOM 97 + Store 96(V2C_matA_i8_SC_64K) 98 + 103: 21 Load 74(uvecSC_K11) + 104: 100 CompositeConstructCoopMatQCOM 103 + Store 102(V2C_matA_u8_SC_64K) 104 + 109: 13 Load 15(uvec8) + 110: 106 CompositeConstructCoopMatQCOM 109 + Store 108(V2C_matB_f32_SC_8N) 110 + 115: 21 Load 114(uvecSC_K21) + 116: 111 CompositeConstructCoopMatQCOM 115 + Store 113(V2C_matB_f32_SC_KN) 116 + 121: 81 Load 120(uvecSC_K22) + 122: 117 CompositeConstructCoopMatQCOM 121 + Store 119(V2C_matB_f32_SC_8_64) 122 + 126: 21 Load 114(uvecSC_K21) + 127: 123 CompositeConstructCoopMatQCOM 126 + Store 125(V2C_matB_f16_SC_KN) 127 + 131: 21 Load 114(uvecSC_K21) + 132: 128 CompositeConstructCoopMatQCOM 131 + Store 130(V2C_matB_i8_SC_K64) 132 + 136: 21 Load 114(uvecSC_K21) + 137: 133 CompositeConstructCoopMatQCOM 136 + Store 135(V2C_matB_u8_SC_K64) 137 + 142: 21 Load 114(uvecSC_K21) + 143: 139 CompositeConstructCoopMatQCOM 142 + Store 141(V2C_matB_f32_SC_K32) 143 + 148: 21 Load 114(uvecSC_K21) + 149: 145 CompositeConstructCoopMatQCOM 148 + Store 147(V2C_matB_f32_SC_K16) 149 + 154: 46 Load 153(uvecSC_N31) + 155: 150 CompositeConstructCoopMatQCOM 154 + Store 152(V2C_matAcc_f32_SC_MN) 155 + 163: 160 Load 162(uvecSC_N32) + 164: 156 CompositeConstructCoopMatQCOM 163 + Store 158(V2C_matAcc_f32_SC_64_64) 164 + 168: 46 Load 153(uvecSC_N31) + 169: 165 CompositeConstructCoopMatQCOM 168 + Store 167(V2C_matAcc_f16_SC_MN) 169 + 175: 46 Load 153(uvecSC_N31) + 176: 172 CompositeConstructCoopMatQCOM 175 + Store 174(V2C_matAcc_i32_SC_64N) 176 + 180: 46 Load 153(uvecSC_N31) + 181: 177 CompositeConstructCoopMatQCOM 180 + Store 179(V2C_matAcc_u32_SC_64N) 181 + 183: 66 Load 182(C2V_matA_f32_SC_M8) + 184: 13 CompositeExtractCoopMatQCOM 183 + Store 15(uvec8) 184 + 187: 71 Load 186(C2V_matA_f32_SC_MK) + 188: 21 CompositeExtractCoopMatQCOM 187 + Store 185(uvecSC_K11) 188 + 191: 77 Load 190(C2V_matA_f32_SC_64_8) + 192: 81 CompositeExtractCoopMatQCOM 191 + Store 189(uvecSC_K12) 192 + 194: 87 Load 193(C2V_matA_f16_SC_MK) + 195: 21 CompositeExtractCoopMatQCOM 194 + Store 185(uvecSC_K11) 195 + 197: 94 Load 196(C2V_matA_i8_SC_64K) + 198: 21 CompositeExtractCoopMatQCOM 197 + Store 185(uvecSC_K11) 198 + 200: 100 Load 199(C2V_matA_u8_SC_64K) + 201: 21 CompositeExtractCoopMatQCOM 200 + Store 185(uvecSC_K11) 201 + 203: 106 Load 202(C2V_matB_f32_SC_8N) + 204: 13 CompositeExtractCoopMatQCOM 203 + Store 15(uvec8) 204 + 207: 111 Load 206(C2V_matB_f32_SC_KN) + 208: 21 CompositeExtractCoopMatQCOM 207 + Store 205(uvecSC_K21) 208 + 211: 117 Load 210(C2V_matB_f32_SC_8_64) + 212: 81 CompositeExtractCoopMatQCOM 211 + Store 209(uvecSC_K22) 212 + 214: 123 Load 213(C2V_matB_f16_SC_KN) + 215: 21 CompositeExtractCoopMatQCOM 214 + Store 205(uvecSC_K21) 215 + 217: 128 Load 216(C2V_matB_i8_SC_K64) + 218: 21 CompositeExtractCoopMatQCOM 217 + Store 205(uvecSC_K21) 218 + 220: 133 Load 219(C2V_matB_u8_SC_K64) + 221: 21 CompositeExtractCoopMatQCOM 220 + Store 205(uvecSC_K21) 221 + 223: 139 Load 222(C2V_matB_f32_SC_K32) + 224: 21 CompositeExtractCoopMatQCOM 223 + Store 205(uvecSC_K21) 224 + 226: 145 Load 225(C2V_matB_f32_SC_K16) + 227: 21 CompositeExtractCoopMatQCOM 226 + Store 205(uvecSC_K21) 227 + 230: 150 Load 229(C2V_matAcc_f32_SC_MN) + 231: 46 CompositeExtractCoopMatQCOM 230 + Store 228(uvecSC_N31) 231 + 235: 232 Load 234(C2V_matAcc_f32_SC_64N) + 236: 46 CompositeExtractCoopMatQCOM 235 + Store 228(uvecSC_N31) 236 + 239: 156 Load 238(C2V_matAcc_f32_SC_64_64) + 240: 160 CompositeExtractCoopMatQCOM 239 + Store 237(uvecSC_N32) 240 + 242: 165 Load 241(C2V_matAcc_f16_SC_MN) + 243: 46 CompositeExtractCoopMatQCOM 242 + Store 228(uvecSC_N31) 243 + 245: 172 Load 244(C2V_matAcc_i32_SC_64N) + 246: 46 CompositeExtractCoopMatQCOM 245 + Store 228(uvecSC_N31) 246 + 248: 177 Load 247(C2V_matAcc_u32_SC_64N) + 249: 46 CompositeExtractCoopMatQCOM 248 + Store 228(uvecSC_N31) 249 + Return + FunctionEnd diff --git a/third_party/glslang/Test/baseResults/spv.rankShift.comp.out b/third_party/glslang/Test/baseResults/spv.rankShift.comp.out index a091ec1bdc..ab881e78f9 100644 --- a/third_party/glslang/Test/baseResults/spv.rankShift.comp.out +++ b/third_party/glslang/Test/baseResults/spv.rankShift.comp.out @@ -16,10 +16,8 @@ spv.rankShift.comp Name 11 "arg0" Name 15 "arg1" Decorate 11(arg0) Location 4 - Decorate 11(arg0) Binding 0 Decorate 11(arg0) DescriptorSet 0 Decorate 15(arg1) Location 5 - Decorate 15(arg1) Binding 1 Decorate 15(arg1) DescriptorSet 0 Decorate 32 BuiltIn WorkgroupSize 2: TypeVoid diff --git a/third_party/glslang/Test/baseResults/spv.replicate.comp.out b/third_party/glslang/Test/baseResults/spv.replicate.comp.out index bbcf8af0ab..dbda05536e 100644 --- a/third_party/glslang/Test/baseResults/spv.replicate.comp.out +++ b/third_party/glslang/Test/baseResults/spv.replicate.comp.out @@ -6,7 +6,7 @@ spv.replicate.comp Capability Shader Capability VulkanMemoryModelKHR Capability CooperativeMatrixKHR - Capability CapabilityReplicatedCompositesEXT + Capability ReplicatedCompositesEXT Extension "SPV_EXT_replicated_composites" Extension "SPV_KHR_cooperative_matrix" Extension "SPV_KHR_vulkan_memory_model" diff --git a/third_party/glslang/Test/baseResults/spv.replicatespec.comp.out b/third_party/glslang/Test/baseResults/spv.replicatespec.comp.out index 3c54ead87b..2699f34893 100644 --- a/third_party/glslang/Test/baseResults/spv.replicatespec.comp.out +++ b/third_party/glslang/Test/baseResults/spv.replicatespec.comp.out @@ -6,7 +6,7 @@ spv.replicatespec.comp Capability Shader Capability VulkanMemoryModelKHR Capability CooperativeMatrixKHR - Capability CapabilityReplicatedCompositesEXT + Capability ReplicatedCompositesEXT Extension "SPV_EXT_replicated_composites" Extension "SPV_KHR_cooperative_matrix" Extension "SPV_KHR_vulkan_memory_model" diff --git a/third_party/glslang/Test/baseResults/spv.subgroupExtendedTypesRotate.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupExtendedTypesRotate.comp.out index cb13289c5c..901f0f6c1b 100644 --- a/third_party/glslang/Test/baseResults/spv.subgroupExtendedTypesRotate.comp.out +++ b/third_party/glslang/Test/baseResults/spv.subgroupExtendedTypesRotate.comp.out @@ -10,7 +10,7 @@ spv.subgroupExtendedTypesRotate.comp Capability Int8 Capability StorageUniformBufferBlock16 Capability StorageBuffer8BitAccess - Capability CapabilityGroupNonUniformRotateKHR + Capability GroupNonUniformRotateKHR Extension "SPV_KHR_8bit_storage" Extension "SPV_KHR_subgroup_rotate" 1: ExtInstImport "GLSL.std.450" diff --git a/third_party/glslang/Test/baseResults/spv.subgroupRotate.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupRotate.comp.out index 147b37fbae..ae2412e88a 100644 --- a/third_party/glslang/Test/baseResults/spv.subgroupRotate.comp.out +++ b/third_party/glslang/Test/baseResults/spv.subgroupRotate.comp.out @@ -5,7 +5,7 @@ spv.subgroupRotate.comp Capability Shader Capability Float64 - Capability CapabilityGroupNonUniformRotateKHR + Capability GroupNonUniformRotateKHR Extension "SPV_KHR_subgroup_rotate" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/third_party/glslang/Test/baseResults/spv.tensorARM.params.comp.out b/third_party/glslang/Test/baseResults/spv.tensorARM.params.comp.out index 6de837428f..846f2e27ce 100644 --- a/third_party/glslang/Test/baseResults/spv.tensorARM.params.comp.out +++ b/third_party/glslang/Test/baseResults/spv.tensorARM.params.comp.out @@ -1,5 +1,4 @@ spv.tensorARM.params.comp -Validation failed // Module Version 10000 // Generated by (magic number): 8000b // Id's are bound by 45 diff --git a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchGatherSAD.frag.out b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchGatherSAD.frag.out index 63e4e15c04..ecd4901cd6 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchGatherSAD.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchGatherSAD.frag.out @@ -1,5 +1,5 @@ spv.tpipBlockMatchGatherSAD.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 72 @@ -10,7 +10,7 @@ spv.tpipBlockMatchGatherSAD.frag Extension "SPV_QCOM_image_processing2" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 13 41 + EntryPoint Fragment 4 "main" 13 41 44 48 53 61 64 71 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchGatherSSD.frag.out b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchGatherSSD.frag.out index f5aa4cb830..5d2989cb74 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchGatherSSD.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchGatherSSD.frag.out @@ -1,5 +1,5 @@ spv.tpipBlockMatchGatherSSD.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 72 @@ -10,7 +10,7 @@ spv.tpipBlockMatchGatherSSD.frag Extension "SPV_QCOM_image_processing2" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 13 41 + EntryPoint Fragment 4 "main" 13 41 44 48 53 61 64 71 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchSAD.frag.out b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchSAD.frag.out index eb5f474470..670c9c225a 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchSAD.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchSAD.frag.out @@ -1,5 +1,5 @@ spv.tpipBlockMatchSAD.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 72 @@ -8,7 +8,7 @@ spv.tpipBlockMatchSAD.frag Extension "SPV_QCOM_image_processing" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 13 41 + EntryPoint Fragment 4 "main" 13 41 44 48 53 61 64 71 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchSSD.frag.out b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchSSD.frag.out index d758c0b127..ad0874e5b3 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchSSD.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchSSD.frag.out @@ -1,5 +1,5 @@ spv.tpipBlockMatchSSD.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 72 @@ -8,7 +8,7 @@ spv.tpipBlockMatchSSD.frag Extension "SPV_QCOM_image_processing" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 13 41 + EntryPoint Fragment 4 "main" 13 41 44 48 53 61 64 71 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchWindowSAD.frag.out b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchWindowSAD.frag.out index a27c016f77..db44be6b9e 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchWindowSAD.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchWindowSAD.frag.out @@ -1,5 +1,5 @@ spv.tpipBlockMatchWindowSAD.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 72 @@ -10,7 +10,7 @@ spv.tpipBlockMatchWindowSAD.frag Extension "SPV_QCOM_image_processing2" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 13 41 + EntryPoint Fragment 4 "main" 13 41 44 48 53 61 64 71 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchWindowSSD.frag.out b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchWindowSSD.frag.out index e22097ffe5..08cf71239a 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipBlockMatchWindowSSD.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipBlockMatchWindowSSD.frag.out @@ -1,5 +1,5 @@ spv.tpipBlockMatchWindowSSD.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 72 @@ -10,7 +10,7 @@ spv.tpipBlockMatchWindowSSD.frag Extension "SPV_QCOM_image_processing2" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 13 41 + EntryPoint Fragment 4 "main" 13 41 44 48 53 61 64 71 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.tpipBoxFilter.frag.out b/third_party/glslang/Test/baseResults/spv.tpipBoxFilter.frag.out index 46d802c42f..2f74f5ef02 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipBoxFilter.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipBoxFilter.frag.out @@ -1,5 +1,5 @@ spv.tpipBoxFilter.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 43 @@ -8,7 +8,7 @@ spv.tpipBoxFilter.frag Extension "SPV_QCOM_image_processing" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 15 27 + EntryPoint Fragment 4 "main" 15 18 22 27 33 41 42 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.tpipSampleWeighted.frag.out b/third_party/glslang/Test/baseResults/spv.tpipSampleWeighted.frag.out index 652143c7f8..a755e64443 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipSampleWeighted.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipSampleWeighted.frag.out @@ -1,5 +1,5 @@ spv.tpipSampleWeighted.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 43 @@ -8,7 +8,7 @@ spv.tpipSampleWeighted.frag Extension "SPV_QCOM_image_processing" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 9 21 + EntryPoint Fragment 4 "main" 9 12 16 21 27 34 39 42 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.tpipTextureArrays.frag.out b/third_party/glslang/Test/baseResults/spv.tpipTextureArrays.frag.out index cb5a62adbe..fc407900a1 100644 --- a/third_party/glslang/Test/baseResults/spv.tpipTextureArrays.frag.out +++ b/third_party/glslang/Test/baseResults/spv.tpipTextureArrays.frag.out @@ -1,5 +1,5 @@ spv.tpipTextureArrays.frag -// Module Version 10000 +// Module Version 10400 // Generated by (magic number): 8000b // Id's are bound by 84 @@ -8,7 +8,7 @@ spv.tpipTextureArrays.frag Extension "SPV_QCOM_image_processing" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 13 46 + EntryPoint Fragment 4 "main" 13 46 51 60 67 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_QCOM_image_processing" diff --git a/third_party/glslang/Test/baseResults/spv.uniformInitializer.frag.out b/third_party/glslang/Test/baseResults/spv.uniformInitializer.frag.out index da32af5582..729148c7ad 100644 --- a/third_party/glslang/Test/baseResults/spv.uniformInitializer.frag.out +++ b/third_party/glslang/Test/baseResults/spv.uniformInitializer.frag.out @@ -14,7 +14,6 @@ spv.uniformInitializer.frag Name 14 "in_color" Decorate 9(color) Location 0 Decorate 14(in_color) Location 0 - Decorate 14(in_color) Binding 0 Decorate 14(in_color) DescriptorSet 0 2: TypeVoid 3: TypeFunction 2 diff --git a/third_party/glslang/Test/baseResults/stringInvalidOps.frag.out b/third_party/glslang/Test/baseResults/stringInvalidOps.frag.out new file mode 100644 index 0000000000..7bb8b354be --- /dev/null +++ b/third_party/glslang/Test/baseResults/stringInvalidOps.frag.out @@ -0,0 +1,40 @@ +stringInvalidOps.frag +ERROR: 0:5: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const string' and a right operand of type ' const string' (or there is no acceptable conversion) +ERROR: 0:6: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type ' const string' and a right operand of type ' const string' (or there is no acceptable conversion) +ERROR: 0:7: '*' : wrong operand types: no operation '*' exists that takes a left-hand operand of type ' const string' and a right operand of type ' const string' (or there is no acceptable conversion) +ERROR: 0:7: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type ' const string' and a right operand of type ' const string' (or there is no acceptable conversion) +ERROR: 4 compilation errors. No code generated. + + +Shader version: 450 +Requested GL_EXT_debug_printf +ERROR: node is still EOpNull! +0:4 Function Definition: main( ( global void) +0:4 Function Parameters: +0:5 Sequence +0:5 Constant: +0:5 "def" +0:6 Constant: +0:6 "o" +0:7 Constant: +0:7 "o" +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +Requested GL_EXT_debug_printf +ERROR: node is still EOpNull! +0:4 Function Definition: main( ( global void) +0:4 Function Parameters: +0:5 Sequence +0:5 Constant: +0:5 "def" +0:6 Constant: +0:6 "o" +0:7 Constant: +0:7 "o" +0:? Linker Objects + diff --git a/third_party/glslang/Test/baseResults/tokenPaste.vert.out b/third_party/glslang/Test/baseResults/tokenPaste.vert.out index 5ae1f75184..85009d22d0 100644 --- a/third_party/glslang/Test/baseResults/tokenPaste.vert.out +++ b/third_party/glslang/Test/baseResults/tokenPaste.vert.out @@ -1,14 +1,13 @@ tokenPaste.vert ERROR: 0:38: '##' : unexpected location -ERROR: 0:40: '##' : unexpected location; end of replacement list +ERROR: 0:40: '#' : Macro ended with incomplete '#' paste/stringify operators ERROR: 0:49: '##' : combined tokens are too long ERROR: 0:52: '##' : not supported for these tokens ERROR: 0:81: '##' : combined token is invalid +ERROR: 0:94: '#' : Macro ended with incomplete '#' paste/stringify operators ERROR: 0:94: 'macro expansion' : Too few args in Macro rec -ERROR: 0:94: '##' : unexpected location -ERROR: 0:94: '##' : unexpected location ERROR: 0:98: '##' : unexpected location; end of argument -ERROR: 9 compilation errors. No code generated. +ERROR: 8 compilation errors. No code generated. Shader version: 450 diff --git a/third_party/glslang/Test/baseResults/validation_fails.txt b/third_party/glslang/Test/baseResults/validation_fails.txt index c4498eb7c3..213fd51305 100644 --- a/third_party/glslang/Test/baseResults/validation_fails.txt +++ b/third_party/glslang/Test/baseResults/validation_fails.txt @@ -47,6 +47,7 @@ Test/baseResults/link.vk.crossStageIO.1.vert.out Test/baseResults/link.vk.differentPC.0.0.frag.out Test/baseResults/link.vk.differentPC.1.0.frag.out Test/baseResults/link.vk.missingCrossStageIO.0.vert.out +Test/baseResults/link.vk.multiUnitLayout.2.comp.out Test/baseResults/link.vk.pcNamingInvalid.0.0.vert.out Test/baseResults/spv.130.frag.out Test/baseResults/spv.140.frag.out @@ -77,5 +78,5 @@ Test/baseResults/spv.queryL.frag.out Test/baseResults/spv.separate.frag.out Test/baseResults/spv.sparseTextureClamp.frag.out Test/baseResults/spv.sparseTexture.frag.out -Test/baseResults/spv.tensorARM.params.comp.out Test/baseResults/vk.relaxed.errorcheck.vert.out +Test/baseResults/vk.relaxed.syntaxerror.vert.out diff --git a/third_party/glslang/Test/baseResults/vk.relaxed.syntaxerror.vert.out b/third_party/glslang/Test/baseResults/vk.relaxed.syntaxerror.vert.out new file mode 100644 index 0000000000..dfaeca100c --- /dev/null +++ b/third_party/glslang/Test/baseResults/vk.relaxed.syntaxerror.vert.out @@ -0,0 +1,94 @@ +vk.relaxed.syntaxerror.vert +Shader version: 460 +0:? Sequence +0:5 Function Definition: main( ( global void) +0:5 Function Parameters: +0:6 Sequence +0:6 move second child to first child ( temp highp 4-component vector of float) +0:6 'io' (layout( location=0) smooth out highp 4-component vector of float) +0:6 Constant: +0:6 0.000000 +0:6 0.000000 +0:6 0.000000 +0:6 0.000000 +0:? Linker Objects +0:? 'io' (layout( location=0) smooth out highp 4-component vector of float) +0:? 'gl_VertexIndex' ( in int VertexIndex) +0:? 'gl_InstanceIndex' ( in int InstanceIndex) + +vk.relaxed.syntaxerror.frag +ERROR: 0:20: '' : syntax error, unexpected SAMPLER, expecting RIGHT_PAREN +ERROR: 1 compilation errors. No code generated. + + +Shader version: 460 +gl_FragCoord origin is upper left +ERROR: node is still EOpNull! +0:16 Function Definition: main( ( global void) +0:16 Function Parameters: +0:17 Sequence +0:17 move second child to first child ( temp highp 4-component vector of float) +0:17 'o' ( out highp 4-component vector of float) +0:17 add ( temp highp 4-component vector of float) +0:17 'io' (layout( location=0) smooth in highp 4-component vector of float) +0:17 Function Call: foo(struct-OpaqueInStruct-s211;s21; ( global highp 4-component vector of float) +0:17 uniformStruct: direct index for structure ( uniform structure{ global highp int /*smp*/}) +0:17 'anon@0' (layout( column_major std140) uniform block{ uniform structure{ global highp int /*smp*/} uniformStruct}) +0:17 Constant: +0:17 0 (const uint) +0:17 'uniformStruct.smp' ( uniform highp sampler2D) +0:? Linker Objects +0:? 'io' (layout( location=0) smooth in highp 4-component vector of float) +0:? 'o' ( out highp 4-component vector of float) +0:? 'uniformStruct.smp' ( uniform highp sampler2D) +0:? 'anon@0' (layout( column_major std140) uniform block{ uniform structure{ global highp int /*smp*/} uniformStruct}) + + +Linked vertex stage: + + +Linked fragment stage: + +ERROR: Linking fragment stage: No function definition (body) found: + foo(struct-OpaqueInStruct-s211;s21; + +Shader version: 460 +0:? Sequence +0:5 Function Definition: main( ( global void) +0:5 Function Parameters: +0:6 Sequence +0:6 move second child to first child ( temp highp 4-component vector of float) +0:6 'io' (layout( location=0) smooth out highp 4-component vector of float) +0:6 Constant: +0:6 0.000000 +0:6 0.000000 +0:6 0.000000 +0:6 0.000000 +0:? Linker Objects +0:? 'io' (layout( location=0) smooth out highp 4-component vector of float) +0:? 'gl_VertexIndex' ( in int VertexIndex) +0:? 'gl_InstanceIndex' ( in int InstanceIndex) +Shader version: 460 +gl_FragCoord origin is upper left +ERROR: node is still EOpNull! +0:16 Function Definition: main( ( global void) +0:16 Function Parameters: +0:17 Sequence +0:17 move second child to first child ( temp highp 4-component vector of float) +0:17 'o' ( out highp 4-component vector of float) +0:17 add ( temp highp 4-component vector of float) +0:17 'io' (layout( location=0) smooth in highp 4-component vector of float) +0:17 Function Call: foo(struct-OpaqueInStruct-s211;s21; ( global highp 4-component vector of float) +0:17 uniformStruct: direct index for structure ( uniform structure{ global highp int /*smp*/}) +0:17 'anon@0' (layout( column_major std140) uniform block{ uniform structure{ global highp int /*smp*/} uniformStruct}) +0:17 Constant: +0:17 0 (const uint) +0:17 'uniformStruct.smp' ( uniform highp sampler2D) +0:? Linker Objects +0:? 'io' (layout( location=0) smooth in highp 4-component vector of float) +0:? 'o' ( out highp 4-component vector of float) +0:? 'uniformStruct.smp' ( uniform highp sampler2D) +0:? 'anon@0' (layout( column_major std140) uniform block{ uniform structure{ global highp int /*smp*/} uniformStruct}) + +Validation failed +SPIR-V is not generated for failed compile or link diff --git a/third_party/glslang/Test/baseResults/whileLoop.frag.out b/third_party/glslang/Test/baseResults/whileLoop.frag.out index cfe972da93..567dddb368 100644 --- a/third_party/glslang/Test/baseResults/whileLoop.frag.out +++ b/third_party/glslang/Test/baseResults/whileLoop.frag.out @@ -21,9 +21,24 @@ Shader version: 110 0:12 add second child into first child ( temp 4-component vector of float) 0:12 'color' ( temp 4-component vector of float) 0:12 'bigColor' ( uniform 4-component vector of float) -0:15 move second child to first child ( temp 4-component vector of float) -0:15 'gl_FragColor' ( fragColor 4-component vector of float FragColor) -0:15 'color' ( temp 4-component vector of float) +0:15 Loop with condition tested first +0:15 Loop Condition +0:15 move second child to first child ( temp bool) +0:15 'test' ( temp bool) +0:15 Compare Less Than ( temp bool) +0:15 direct index ( temp float) +0:15 'color' ( temp 4-component vector of float) +0:15 Constant: +0:15 1 (const int) +0:15 'd' ( uniform float) +0:15 Loop Body +0:16 Sequence +0:16 add second child into first child ( temp 4-component vector of float) +0:16 'color' ( temp 4-component vector of float) +0:16 'bigColor' ( uniform 4-component vector of float) +0:19 move second child to first child ( temp 4-component vector of float) +0:19 'gl_FragColor' ( fragColor 4-component vector of float FragColor) +0:19 'color' ( temp 4-component vector of float) 0:? Linker Objects 0:? 'bigColor' ( uniform 4-component vector of float) 0:? 'BaseColor' ( smooth in 4-component vector of float) @@ -55,9 +70,24 @@ Shader version: 110 0:12 add second child into first child ( temp 4-component vector of float) 0:12 'color' ( temp 4-component vector of float) 0:12 'bigColor' ( uniform 4-component vector of float) -0:15 move second child to first child ( temp 4-component vector of float) -0:15 'gl_FragColor' ( fragColor 4-component vector of float FragColor) -0:15 'color' ( temp 4-component vector of float) +0:15 Loop with condition tested first +0:15 Loop Condition +0:15 move second child to first child ( temp bool) +0:15 'test' ( temp bool) +0:15 Compare Less Than ( temp bool) +0:15 direct index ( temp float) +0:15 'color' ( temp 4-component vector of float) +0:15 Constant: +0:15 1 (const int) +0:15 'd' ( uniform float) +0:15 Loop Body +0:16 Sequence +0:16 add second child into first child ( temp 4-component vector of float) +0:16 'color' ( temp 4-component vector of float) +0:16 'bigColor' ( uniform 4-component vector of float) +0:19 move second child to first child ( temp 4-component vector of float) +0:19 'gl_FragColor' ( fragColor 4-component vector of float FragColor) +0:19 'color' ( temp 4-component vector of float) 0:? Linker Objects 0:? 'bigColor' ( uniform 4-component vector of float) 0:? 'BaseColor' ( smooth in 4-component vector of float) diff --git a/third_party/glslang/Test/boolinput.error.frag b/third_party/glslang/Test/boolinput.error.frag new file mode 100644 index 0000000000..b8a82d4be4 --- /dev/null +++ b/third_party/glslang/Test/boolinput.error.frag @@ -0,0 +1,16 @@ +#version 460 + +in bool a; + +struct S { + bool b; +}; + +in S s; + +in Block { + bool c; +}; + +void main() { +} \ No newline at end of file diff --git a/third_party/glslang/Test/booloutput.error.vert b/third_party/glslang/Test/booloutput.error.vert new file mode 100644 index 0000000000..e491063297 --- /dev/null +++ b/third_party/glslang/Test/booloutput.error.vert @@ -0,0 +1,16 @@ +#version 460 + +out bool a; + +struct S { + bool b; +}; + +out S s; + +out Block { + bool c; +}; + +void main() { +} \ No newline at end of file diff --git a/third_party/glslang/Test/conservativeDepth.frag b/third_party/glslang/Test/conservativeDepth.frag new file mode 100644 index 0000000000..0db4f5a8db --- /dev/null +++ b/third_party/glslang/Test/conservativeDepth.frag @@ -0,0 +1,6 @@ +#version 300 es +#extension GL_EXT_conservative_depth: require +layout (depth_any) out highp float gl_FragDepth; +void main() { + gl_FragDepth = 1.0; +} diff --git a/third_party/glslang/Test/find_package/CMakeLists.txt b/third_party/glslang/Test/find_package/CMakeLists.txt index 5eef2fb49d..3d27848995 100644 --- a/third_party/glslang/Test/find_package/CMakeLists.txt +++ b/third_party/glslang/Test/find_package/CMakeLists.txt @@ -55,18 +55,10 @@ target_link_libraries(example PRIVATE glslang::glslang-default-resource-limits ) -if (NOT TARGET glslang::SPVRemapper) - message(FATAL_ERROR "glslang::SPVRemapper does not exist!") -endif() - if (NOT TARGET glslang::glslang-standalone) message(FATAL_ERROR "glslang::glslang-standalone does not exist!") endif() -if (NOT TARGET glslang::spirv-remap) - message(FATAL_ERROR "glslang::spirv-remap does not exist!") -endif() - if (target_type STREQUAL STATIC_LIBRARY) # When these stub libraries are removed from the future. Simply remove this code. # For now it ensures backcompat is preserved. @@ -81,6 +73,5 @@ if (target_type STREQUAL STATIC_LIBRARY) # Ensure these executables run without issue add_custom_target(test-executables ALL COMMAND glslang::glslang-standalone --version - COMMAND glslang::spirv-remap --help ) endif() diff --git a/third_party/glslang/Test/iomap.bindingPerResourceType.frag b/third_party/glslang/Test/iomap.bindingPerResourceType.frag new file mode 100644 index 0000000000..b380afc29b --- /dev/null +++ b/third_party/glslang/Test/iomap.bindingPerResourceType.frag @@ -0,0 +1,41 @@ +#version 460 + +layout(std140) uniform UBO1 { + vec4 a; +}; + +layout(std430) buffer SSBO1 { + float c[40]; +}; + +layout(rgba8) uniform image2D Image1; + +uniform sampler2D Sampler1; + +layout(std140) uniform UBO2 { + vec4 b; +}; + +layout(std430) buffer SSBO2 { + vec2 d[]; +}; + +layout(rgba8) uniform image2D Image2; + +uniform sampler2D Sampler2; + +layout(location = 0) out vec4 Output; + +void main() +{ + vec4 result = vec4(0.0); + result += a; + result += b; + result.x += c[5]; + result.yz += d[5]; + result += imageLoad(Image1, ivec2(5, 10)); + result += imageLoad(Image2, ivec2(5, 10)); + result += texture(Sampler1, vec2(0.5, 0.5)); + result += texture(Sampler2, vec2(0.5, 0.5)); + Output = result; +} diff --git a/third_party/glslang/Test/iomap.bindingPerResourceType.vert b/third_party/glslang/Test/iomap.bindingPerResourceType.vert new file mode 100644 index 0000000000..5ff4cfb150 --- /dev/null +++ b/third_party/glslang/Test/iomap.bindingPerResourceType.vert @@ -0,0 +1,39 @@ +#version 460 + +layout(std140) uniform UBO1 { + vec4 a; +}; + +layout(std430) buffer SSBO1 { + float c[40]; +}; + +layout(rgba8) uniform image2D Image1; + +uniform sampler2D Sampler1; + +layout(std140) uniform UBO2 { + vec4 b; +}; + +layout(std430) buffer SSBO2 { + vec2 d[]; +}; + +layout(rgba8) uniform image2D Image2; + +uniform sampler2D Sampler2; + +void main() +{ + vec4 result = vec4(0.0); + result += a; + result += b; + result.x += c[5]; + result.yz += d[5]; + result += imageLoad(Image1, ivec2(5, 10)); + result += imageLoad(Image2, ivec2(5, 10)); + result += texture(Sampler1, vec2(0.5, 0.5)); + result += texture(Sampler2, vec2(0.5, 0.5)); + gl_Position = result; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.0.frag b/third_party/glslang/Test/link.multiUnitLayout.0.frag new file mode 100644 index 0000000000..da475f0210 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.0.frag @@ -0,0 +1,11 @@ +#version 450 + +layout (depth_greater) out float gl_FragDepth; + +void outputColor(vec4 color); + +void main() +{ + outputColor(vec4(1.0, 0.0, 0.0, 1.0)); + gl_FragDepth = 0.5; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.0.mesh b/third_party/glslang/Test/link.multiUnitLayout.0.mesh new file mode 100644 index 0000000000..80740b444f --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.0.mesh @@ -0,0 +1,14 @@ +#version 460 +#extension GL_EXT_mesh_shader : enable + +layout(local_size_x = 1) in; +layout(max_vertices=81) out; +layout(max_primitives=32) out; +layout(triangles) out; + +void do_process(); + +void main() +{ + do_process(); +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.0.tese b/third_party/glslang/Test/link.multiUnitLayout.0.tese new file mode 100644 index 0000000000..7042c34a09 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.0.tese @@ -0,0 +1,13 @@ +#version 410 + +layout(triangles, equal_spacing, cw) in; + +vec4 transformPosition(vec4 position); + +void main() +{ + vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position; + vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position; + vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position; + gl_Position = transformPosition(p0 + p1 + p2); +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.0.vert b/third_party/glslang/Test/link.multiUnitLayout.0.vert new file mode 100644 index 0000000000..ce7feb6223 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.0.vert @@ -0,0 +1,12 @@ +#version 450 + +layout(xfb_buffer = 1, xfb_stride = 32) out; + +layout(location = 0) in vec4 in_position; + +vec4 computePosition(vec4 position); + +void main() +{ + gl_Position = computePosition(in_position); +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.1.frag b/third_party/glslang/Test/link.multiUnitLayout.1.frag new file mode 100644 index 0000000000..fff2d20c38 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.1.frag @@ -0,0 +1,8 @@ +#version 450 + +layout(location=0) out vec4 FragColor; + +void outputColor(vec4 color) +{ + FragColor = color; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.1.mesh b/third_party/glslang/Test/link.multiUnitLayout.1.mesh new file mode 100644 index 0000000000..d8407d7d67 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.1.mesh @@ -0,0 +1,12 @@ +#version 460 +#extension GL_EXT_mesh_shader : enable + +layout(std430) buffer DataBuffer +{ + uint data[]; +} dataBuffer; + +void do_process() +{ + dataBuffer.data[gl_LocalInvocationID.x] = gl_WorkGroupID.x; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.1.tese b/third_party/glslang/Test/link.multiUnitLayout.1.tese new file mode 100644 index 0000000000..07333dafe2 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.1.tese @@ -0,0 +1,6 @@ +#version 410 + +vec4 transformPosition(vec4 position) +{ + return 2.0 * position; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.1.vert b/third_party/glslang/Test/link.multiUnitLayout.1.vert new file mode 100644 index 0000000000..623b24f3d0 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.1.vert @@ -0,0 +1,6 @@ +#version 450 + +vec4 computePosition(vec4 position) +{ + return vec4(1.0) + 2.0 * position; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.2.frag b/third_party/glslang/Test/link.multiUnitLayout.2.frag new file mode 100644 index 0000000000..302fef2a41 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.2.frag @@ -0,0 +1,11 @@ +#version 450 + +// Should generate a contradictory depth layout error +layout (depth_less) out float gl_FragDepth; + +layout(location=0) out vec4 FragColor; + +void outputColor(vec4 color) +{ + FragColor = color; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.2.mesh b/third_party/glslang/Test/link.multiUnitLayout.2.mesh new file mode 100644 index 0000000000..3caf60ccd3 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.2.mesh @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_mesh_shader : enable + +// Should generate a contradictory max_primitives value layout error +layout(max_primitives=34) out; + +layout(std430) buffer DataBuffer +{ + uint data[]; +} dataBuffer; + +void do_process() +{ + dataBuffer.data[gl_LocalInvocationID.x] = gl_WorkGroupID.x; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.2.tese b/third_party/glslang/Test/link.multiUnitLayout.2.tese new file mode 100644 index 0000000000..5a1fa38591 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.2.tese @@ -0,0 +1,9 @@ +#version 410 + +// Should generate contradictory input vertex spacing and triangle ordering errors +layout(triangles, fractional_even_spacing, ccw) in; + +vec4 transformPosition(vec4 position) +{ + return 2.0 * position; +} diff --git a/third_party/glslang/Test/link.multiUnitLayout.2.vert b/third_party/glslang/Test/link.multiUnitLayout.2.vert new file mode 100644 index 0000000000..f569ec8db1 --- /dev/null +++ b/third_party/glslang/Test/link.multiUnitLayout.2.vert @@ -0,0 +1,9 @@ +#version 450 + +// Should generate a contradictory xfb_stride error +layout(xfb_buffer = 1, xfb_stride = 34) out; + +vec4 computePosition(vec4 position) +{ + return vec4(1.0) + 2.0 * position; +} diff --git a/third_party/glslang/Test/link.vk.multiUnitLayout.0.comp b/third_party/glslang/Test/link.vk.multiUnitLayout.0.comp new file mode 100644 index 0000000000..8503ebfd31 --- /dev/null +++ b/third_party/glslang/Test/link.vk.multiUnitLayout.0.comp @@ -0,0 +1,10 @@ +#version 450 core + +layout(local_size_x_id = 0, local_size_y = 1, local_size_z = 1) in; + +void do_compute(uint index); + +void main() +{ + do_compute(gl_GlobalInvocationID.x); +} diff --git a/third_party/glslang/Test/link.vk.multiUnitLayout.1.comp b/third_party/glslang/Test/link.vk.multiUnitLayout.1.comp new file mode 100644 index 0000000000..792dcaeb97 --- /dev/null +++ b/third_party/glslang/Test/link.vk.multiUnitLayout.1.comp @@ -0,0 +1,10 @@ +#version 450 core + +layout(set = 0, binding = 0) buffer DataBuf { + vec4 data[]; +} dataBuf; + +void do_compute(uint index) +{ + dataBuf.data[index] += vec4(1.0); +} diff --git a/third_party/glslang/Test/link.vk.multiUnitLayout.2.comp b/third_party/glslang/Test/link.vk.multiUnitLayout.2.comp new file mode 100644 index 0000000000..39286d8d7c --- /dev/null +++ b/third_party/glslang/Test/link.vk.multiUnitLayout.2.comp @@ -0,0 +1,13 @@ +#version 450 core + +// Should generate a contradictory local size specialization ids error +layout(local_size_x_id = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer DataBuf { + vec4 data[]; +} dataBuf; + +void do_compute(uint index) +{ + dataBuf.data[index] += vec4(1.0); +} diff --git a/third_party/glslang/Test/preprocessor.paste_stringify.vert b/third_party/glslang/Test/preprocessor.paste_stringify.vert new file mode 100644 index 0000000000..9fac00d91e --- /dev/null +++ b/third_party/glslang/Test/preprocessor.paste_stringify.vert @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_debug_printf : enable + +#define PASTE(arg) pasted_##arg +#define STRINGIFY(arg) #arg +#define STRINGIFY_TWICE(arg, regular) before, #arg, #arg, after, regular +#define STRINGIFY_WITH_SPACE(arg) debugPrintfEXT( # arg +#define PASTE_WITH_SPACE(arg) pasted_## arg +#define BOTH(arg1, arg2) debugPrintf##arg1( #arg2 +#define NOARGS(arg) 1 1 1 1 + +#define REGULAR(arg1, arg2) arg1 == arg2 ? arg2 :arg1 +#define STR(a) STRHELP(a) +#define STRHELP(a) #a + +#define LEGAL(arg) a######arg + +bool before, after; + +void main() { + REGULAR(8,9); + STRINGIFY(12 3); + debugPrintfEXT("%d", (STRINGIFY_TWICE(letters_too, 1))); + STRINGIFY_WITH_SPACE(aaa1)); + + int PASTE(symbol); + float PASTE_WITH_SPACE(symbol2); + BOTH(EXT, string)); + STRHELP(REGULAR(3, 4)); + STR(REGULAR(3, 4)); + STR(aaa ); + STR(STR(hello)); + debugPrintfEXT("regular string"); + debugPrintfEXT(""); +} diff --git a/third_party/glslang/Test/preprocessor.stringify_invalid.vert b/third_party/glslang/Test/preprocessor.stringify_invalid.vert new file mode 100644 index 0000000000..9c1f07c7a8 --- /dev/null +++ b/third_party/glslang/Test/preprocessor.stringify_invalid.vert @@ -0,0 +1,8 @@ +#version 450 +#extension GL_EXT_debug_printf : enable + +#define WRONG(arg) ###arg +#define OK(arg) a######arg + +void main() { +} diff --git a/third_party/glslang/Test/remap.basic.dcefunc.frag b/third_party/glslang/Test/remap.basic.dcefunc.frag deleted file mode 100644 index 714120ab85..0000000000 --- a/third_party/glslang/Test/remap.basic.dcefunc.frag +++ /dev/null @@ -1,11 +0,0 @@ -#version 450 - -in float inf; -out vec4 outf4; - -vec3 dead_fn() { return vec3(0); } - -void main() -{ - outf4 = vec4(inf); -} diff --git a/third_party/glslang/Test/remap.basic.everything.frag b/third_party/glslang/Test/remap.basic.everything.frag deleted file mode 100644 index 714120ab85..0000000000 --- a/third_party/glslang/Test/remap.basic.everything.frag +++ /dev/null @@ -1,11 +0,0 @@ -#version 450 - -in float inf; -out vec4 outf4; - -vec3 dead_fn() { return vec3(0); } - -void main() -{ - outf4 = vec4(inf); -} diff --git a/third_party/glslang/Test/remap.basic.none.frag b/third_party/glslang/Test/remap.basic.none.frag deleted file mode 100644 index 714120ab85..0000000000 --- a/third_party/glslang/Test/remap.basic.none.frag +++ /dev/null @@ -1,11 +0,0 @@ -#version 450 - -in float inf; -out vec4 outf4; - -vec3 dead_fn() { return vec3(0); } - -void main() -{ - outf4 = vec4(inf); -} diff --git a/third_party/glslang/Test/remap.basic.strip.frag b/third_party/glslang/Test/remap.basic.strip.frag deleted file mode 100644 index 714120ab85..0000000000 --- a/third_party/glslang/Test/remap.basic.strip.frag +++ /dev/null @@ -1,11 +0,0 @@ -#version 450 - -in float inf; -out vec4 outf4; - -vec3 dead_fn() { return vec3(0); } - -void main() -{ - outf4 = vec4(inf); -} diff --git a/third_party/glslang/Test/remap.hlsl.sample.basic.everything.frag b/third_party/glslang/Test/remap.hlsl.sample.basic.everything.frag deleted file mode 100644 index 03e83ef9bc..0000000000 --- a/third_party/glslang/Test/remap.hlsl.sample.basic.everything.frag +++ /dev/null @@ -1,90 +0,0 @@ -SamplerState g_sSamp : register(s0); -uniform sampler2D g_sSamp2d -{ - AddressU = MIRROR; - AddressV = WRAP; - MinLOD = 0; - MaxLOD = 10; - MaxAnisotropy = 2; - MipLodBias = 0.2; -}, g_sSamp2D_b; - -Texture1D g_tTex1df4a : register(t1); - -uniform Texture1D g_tTex1df4 : register(t0); -Texture1D g_tTex1di4; -Texture1D g_tTex1du4; - -Texture2D g_tTex2df4; -Texture2D g_tTex2di4; -Texture2D g_tTex2du4; - -Texture3D g_tTex3df4; -Texture3D g_tTex3di4; -Texture3D g_tTex3du4; - -TextureCube g_tTexcdf4; -TextureCube g_tTexcdi4; -TextureCube g_tTexcdu4; - -struct MemberTest -{ - int Sample; // in HLSL, method names are valid struct members. - int CalculateLevelOfDetail; // ... - int CalculateLevelOfDetailUnclamped; // ... - int Gather; // ... - int GetDimensions; // ... - int GetSamplePosition; // ... - int Load; // ... - int SampleBias; // ... - int SampleCmp; // ... - int SampleCmpLevelZero; // ... - int SampleGrad; // ... - int SampleLevel; // ... -}; - -struct PS_OUTPUT -{ - float4 Color : SV_Target0; - float Depth : SV_Depth; -}; - -PS_OUTPUT main() -{ - PS_OUTPUT psout; - - MemberTest mtest; - mtest.CalculateLevelOfDetail = 1; // in HLSL, method names are valid struct members. - mtest.CalculateLevelOfDetailUnclamped = 1; // ... - mtest.Gather = 1; // ... - mtest.GetDimensions = 1; // ... - mtest.GetSamplePosition = 1; // ... - mtest.Load = 1; // ... - mtest.Sample = 1; // ... - mtest.SampleBias = 1; // ... - mtest.SampleCmp = 1; // ... - mtest.SampleCmpLevelZero = 1; // ... - mtest.SampleGrad = 1; // ... - mtest.SampleLevel = 1; // ... - - float4 txval10 = g_tTex1df4 . Sample(g_sSamp, 0.1); - int4 txval11 = g_tTex1di4 . Sample(g_sSamp, 0.2); - uint4 txval12 = g_tTex1du4 . Sample(g_sSamp, 0.3); - - float4 txval20 = g_tTex2df4 . Sample(g_sSamp, float2(0.1, 0.2)); - int4 txval21 = g_tTex2di4 . Sample(g_sSamp, float2(0.3, 0.4)); - uint4 txval22 = g_tTex2du4 . Sample(g_sSamp, float2(0.5, 0.6)); - - float4 txval30 = g_tTex3df4 . Sample(g_sSamp, float3(0.1, 0.2, 0.3)); - int4 txval31 = g_tTex3di4 . Sample(g_sSamp, float3(0.4, 0.5, 0.6)); - uint4 txval32 = g_tTex3du4 . Sample(g_sSamp, float3(0.7, 0.8, 0.9)); - - float4 txval40 = g_tTexcdf4 . Sample(g_sSamp, float3(0.1, 0.2, 0.3)); - int4 txval41 = g_tTexcdi4 . Sample(g_sSamp, float3(0.4, 0.5, 0.6)); - uint4 txval42 = g_tTexcdu4 . Sample(g_sSamp, float3(0.7, 0.8, 0.9)); - - psout.Color = 1.0; - psout.Depth = 1.0; - - return psout; -} diff --git a/third_party/glslang/Test/remap.hlsl.sample.basic.none.frag b/third_party/glslang/Test/remap.hlsl.sample.basic.none.frag deleted file mode 100644 index 03e83ef9bc..0000000000 --- a/third_party/glslang/Test/remap.hlsl.sample.basic.none.frag +++ /dev/null @@ -1,90 +0,0 @@ -SamplerState g_sSamp : register(s0); -uniform sampler2D g_sSamp2d -{ - AddressU = MIRROR; - AddressV = WRAP; - MinLOD = 0; - MaxLOD = 10; - MaxAnisotropy = 2; - MipLodBias = 0.2; -}, g_sSamp2D_b; - -Texture1D g_tTex1df4a : register(t1); - -uniform Texture1D g_tTex1df4 : register(t0); -Texture1D g_tTex1di4; -Texture1D g_tTex1du4; - -Texture2D g_tTex2df4; -Texture2D g_tTex2di4; -Texture2D g_tTex2du4; - -Texture3D g_tTex3df4; -Texture3D g_tTex3di4; -Texture3D g_tTex3du4; - -TextureCube g_tTexcdf4; -TextureCube g_tTexcdi4; -TextureCube g_tTexcdu4; - -struct MemberTest -{ - int Sample; // in HLSL, method names are valid struct members. - int CalculateLevelOfDetail; // ... - int CalculateLevelOfDetailUnclamped; // ... - int Gather; // ... - int GetDimensions; // ... - int GetSamplePosition; // ... - int Load; // ... - int SampleBias; // ... - int SampleCmp; // ... - int SampleCmpLevelZero; // ... - int SampleGrad; // ... - int SampleLevel; // ... -}; - -struct PS_OUTPUT -{ - float4 Color : SV_Target0; - float Depth : SV_Depth; -}; - -PS_OUTPUT main() -{ - PS_OUTPUT psout; - - MemberTest mtest; - mtest.CalculateLevelOfDetail = 1; // in HLSL, method names are valid struct members. - mtest.CalculateLevelOfDetailUnclamped = 1; // ... - mtest.Gather = 1; // ... - mtest.GetDimensions = 1; // ... - mtest.GetSamplePosition = 1; // ... - mtest.Load = 1; // ... - mtest.Sample = 1; // ... - mtest.SampleBias = 1; // ... - mtest.SampleCmp = 1; // ... - mtest.SampleCmpLevelZero = 1; // ... - mtest.SampleGrad = 1; // ... - mtest.SampleLevel = 1; // ... - - float4 txval10 = g_tTex1df4 . Sample(g_sSamp, 0.1); - int4 txval11 = g_tTex1di4 . Sample(g_sSamp, 0.2); - uint4 txval12 = g_tTex1du4 . Sample(g_sSamp, 0.3); - - float4 txval20 = g_tTex2df4 . Sample(g_sSamp, float2(0.1, 0.2)); - int4 txval21 = g_tTex2di4 . Sample(g_sSamp, float2(0.3, 0.4)); - uint4 txval22 = g_tTex2du4 . Sample(g_sSamp, float2(0.5, 0.6)); - - float4 txval30 = g_tTex3df4 . Sample(g_sSamp, float3(0.1, 0.2, 0.3)); - int4 txval31 = g_tTex3di4 . Sample(g_sSamp, float3(0.4, 0.5, 0.6)); - uint4 txval32 = g_tTex3du4 . Sample(g_sSamp, float3(0.7, 0.8, 0.9)); - - float4 txval40 = g_tTexcdf4 . Sample(g_sSamp, float3(0.1, 0.2, 0.3)); - int4 txval41 = g_tTexcdi4 . Sample(g_sSamp, float3(0.4, 0.5, 0.6)); - uint4 txval42 = g_tTexcdu4 . Sample(g_sSamp, float3(0.7, 0.8, 0.9)); - - psout.Color = 1.0; - psout.Depth = 1.0; - - return psout; -} diff --git a/third_party/glslang/Test/remap.hlsl.sample.basic.strip.frag b/third_party/glslang/Test/remap.hlsl.sample.basic.strip.frag deleted file mode 100644 index 03e83ef9bc..0000000000 --- a/third_party/glslang/Test/remap.hlsl.sample.basic.strip.frag +++ /dev/null @@ -1,90 +0,0 @@ -SamplerState g_sSamp : register(s0); -uniform sampler2D g_sSamp2d -{ - AddressU = MIRROR; - AddressV = WRAP; - MinLOD = 0; - MaxLOD = 10; - MaxAnisotropy = 2; - MipLodBias = 0.2; -}, g_sSamp2D_b; - -Texture1D g_tTex1df4a : register(t1); - -uniform Texture1D g_tTex1df4 : register(t0); -Texture1D g_tTex1di4; -Texture1D g_tTex1du4; - -Texture2D g_tTex2df4; -Texture2D g_tTex2di4; -Texture2D g_tTex2du4; - -Texture3D g_tTex3df4; -Texture3D g_tTex3di4; -Texture3D g_tTex3du4; - -TextureCube g_tTexcdf4; -TextureCube g_tTexcdi4; -TextureCube g_tTexcdu4; - -struct MemberTest -{ - int Sample; // in HLSL, method names are valid struct members. - int CalculateLevelOfDetail; // ... - int CalculateLevelOfDetailUnclamped; // ... - int Gather; // ... - int GetDimensions; // ... - int GetSamplePosition; // ... - int Load; // ... - int SampleBias; // ... - int SampleCmp; // ... - int SampleCmpLevelZero; // ... - int SampleGrad; // ... - int SampleLevel; // ... -}; - -struct PS_OUTPUT -{ - float4 Color : SV_Target0; - float Depth : SV_Depth; -}; - -PS_OUTPUT main() -{ - PS_OUTPUT psout; - - MemberTest mtest; - mtest.CalculateLevelOfDetail = 1; // in HLSL, method names are valid struct members. - mtest.CalculateLevelOfDetailUnclamped = 1; // ... - mtest.Gather = 1; // ... - mtest.GetDimensions = 1; // ... - mtest.GetSamplePosition = 1; // ... - mtest.Load = 1; // ... - mtest.Sample = 1; // ... - mtest.SampleBias = 1; // ... - mtest.SampleCmp = 1; // ... - mtest.SampleCmpLevelZero = 1; // ... - mtest.SampleGrad = 1; // ... - mtest.SampleLevel = 1; // ... - - float4 txval10 = g_tTex1df4 . Sample(g_sSamp, 0.1); - int4 txval11 = g_tTex1di4 . Sample(g_sSamp, 0.2); - uint4 txval12 = g_tTex1du4 . Sample(g_sSamp, 0.3); - - float4 txval20 = g_tTex2df4 . Sample(g_sSamp, float2(0.1, 0.2)); - int4 txval21 = g_tTex2di4 . Sample(g_sSamp, float2(0.3, 0.4)); - uint4 txval22 = g_tTex2du4 . Sample(g_sSamp, float2(0.5, 0.6)); - - float4 txval30 = g_tTex3df4 . Sample(g_sSamp, float3(0.1, 0.2, 0.3)); - int4 txval31 = g_tTex3di4 . Sample(g_sSamp, float3(0.4, 0.5, 0.6)); - uint4 txval32 = g_tTex3du4 . Sample(g_sSamp, float3(0.7, 0.8, 0.9)); - - float4 txval40 = g_tTexcdf4 . Sample(g_sSamp, float3(0.1, 0.2, 0.3)); - int4 txval41 = g_tTexcdi4 . Sample(g_sSamp, float3(0.4, 0.5, 0.6)); - uint4 txval42 = g_tTexcdu4 . Sample(g_sSamp, float3(0.7, 0.8, 0.9)); - - psout.Color = 1.0; - psout.Depth = 1.0; - - return psout; -} diff --git a/third_party/glslang/Test/remap.hlsl.templatetypes.everything.frag b/third_party/glslang/Test/remap.hlsl.templatetypes.everything.frag deleted file mode 100644 index f48c98a74b..0000000000 --- a/third_party/glslang/Test/remap.hlsl.templatetypes.everything.frag +++ /dev/null @@ -1,47 +0,0 @@ - -float main(float4 input) : COLOR0 -{ - vector r00 = float4(1,2,3,4); // vector means float4 - float4 r01 = vector(2,3,4,5); // vector means float4 - - vector r12 = bool1(false); - vector r13 = int1(1); - vector r14 = float1(1); - vector r15 = double1(1); - vector r16 = uint1(1); - - vector r20 = bool2(false, true); - vector r21 = int2(1,2); - vector r22 = float2(1,2); - vector r23 = double2(1,2); - vector r24 = uint2(1,2); - - vector r30 = bool3(false, true, true); - vector r31 = int3(1,2,3); - vector r32 = float3(1,2,3); - vector r33 = double3(1,2,3); - vector r34 = uint3(1,2,3); - - vector r40 = bool4(false, true, true, false); - vector r41 = int4(1,2,3,4); - vector r42 = float4(1,2,3,4); - vector r43 = double4(1,2,3,4); - vector r44 = uint4(1,2,3,4); - - matrix r50 = float4x4(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); // matrix means float4x4 - float4x4 r51 = matrix(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); // matrix means float4x4 - - // matrix r60 = bool2x3(false, true, false, true, false, true); // TODO: - matrix r61 = float2x3(1,2,3,4,5,6); - matrix r62 = float3x2(1,2,3,4,5,6); - // matrix r63 = float4x1(1,2,3,4); // TODO: - // matrix r64 = float1x4(1,2,3,4); // TODO: - matrix r65 = float4x2(1,2,3,4,5,6,7,8); - matrix r66 = float4x3(1,2,3,4,5,6,7,8,9,10,11,12); - - // TODO: bool mats - // TODO: int mats - - return 0.0; -} - diff --git a/third_party/glslang/Test/remap.hlsl.templatetypes.none.frag b/third_party/glslang/Test/remap.hlsl.templatetypes.none.frag deleted file mode 100644 index f48c98a74b..0000000000 --- a/third_party/glslang/Test/remap.hlsl.templatetypes.none.frag +++ /dev/null @@ -1,47 +0,0 @@ - -float main(float4 input) : COLOR0 -{ - vector r00 = float4(1,2,3,4); // vector means float4 - float4 r01 = vector(2,3,4,5); // vector means float4 - - vector r12 = bool1(false); - vector r13 = int1(1); - vector r14 = float1(1); - vector r15 = double1(1); - vector r16 = uint1(1); - - vector r20 = bool2(false, true); - vector r21 = int2(1,2); - vector r22 = float2(1,2); - vector r23 = double2(1,2); - vector r24 = uint2(1,2); - - vector r30 = bool3(false, true, true); - vector r31 = int3(1,2,3); - vector r32 = float3(1,2,3); - vector r33 = double3(1,2,3); - vector r34 = uint3(1,2,3); - - vector r40 = bool4(false, true, true, false); - vector r41 = int4(1,2,3,4); - vector r42 = float4(1,2,3,4); - vector r43 = double4(1,2,3,4); - vector r44 = uint4(1,2,3,4); - - matrix r50 = float4x4(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); // matrix means float4x4 - float4x4 r51 = matrix(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); // matrix means float4x4 - - // matrix r60 = bool2x3(false, true, false, true, false, true); // TODO: - matrix r61 = float2x3(1,2,3,4,5,6); - matrix r62 = float3x2(1,2,3,4,5,6); - // matrix r63 = float4x1(1,2,3,4); // TODO: - // matrix r64 = float1x4(1,2,3,4); // TODO: - matrix r65 = float4x2(1,2,3,4,5,6,7,8); - matrix r66 = float4x3(1,2,3,4,5,6,7,8,9,10,11,12); - - // TODO: bool mats - // TODO: int mats - - return 0.0; -} - diff --git a/third_party/glslang/Test/remap.if.everything.frag b/third_party/glslang/Test/remap.if.everything.frag deleted file mode 100644 index 3fedfc437a..0000000000 --- a/third_party/glslang/Test/remap.if.everything.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 450 - -in float inf; -out vec4 outf4; - -void main() -{ - if (inf > 2.0) - outf4 = vec4(inf); - else - outf4 = vec4(inf + -.5); -} diff --git a/third_party/glslang/Test/remap.if.none.frag b/third_party/glslang/Test/remap.if.none.frag deleted file mode 100644 index 3fedfc437a..0000000000 --- a/third_party/glslang/Test/remap.if.none.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 450 - -in float inf; -out vec4 outf4; - -void main() -{ - if (inf > 2.0) - outf4 = vec4(inf); - else - outf4 = vec4(inf + -.5); -} diff --git a/third_party/glslang/Test/remap.invalid-spirv-1.spv b/third_party/glslang/Test/remap.invalid-spirv-1.spv deleted file mode 100644 index e5d59d4fbf..0000000000 Binary files a/third_party/glslang/Test/remap.invalid-spirv-1.spv and /dev/null differ diff --git a/third_party/glslang/Test/remap.invalid-spirv-2.spv b/third_party/glslang/Test/remap.invalid-spirv-2.spv deleted file mode 100644 index df8c96d8aa..0000000000 Binary files a/third_party/glslang/Test/remap.invalid-spirv-2.spv and /dev/null differ diff --git a/third_party/glslang/Test/remap.literal64.everything.spv b/third_party/glslang/Test/remap.literal64.everything.spv deleted file mode 100644 index 88103c4948..0000000000 Binary files a/third_party/glslang/Test/remap.literal64.everything.spv and /dev/null differ diff --git a/third_party/glslang/Test/remap.literal64.none.spv b/third_party/glslang/Test/remap.literal64.none.spv deleted file mode 100644 index 88103c4948..0000000000 Binary files a/third_party/glslang/Test/remap.literal64.none.spv and /dev/null differ diff --git a/third_party/glslang/Test/remap.similar_1a.everything.frag b/third_party/glslang/Test/remap.similar_1a.everything.frag deleted file mode 100644 index 6eddbc51a9..0000000000 --- a/third_party/glslang/Test/remap.similar_1a.everything.frag +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 - -in float inf; -in flat ivec4 ini4; -out vec4 outf4; - -float Test1(int bound) -{ - float r = 0; - for (int x=0; x 2) - return Test1(bound); - else - return float(bound * 2 + - ini4.y * ini4.z + - ini4.x); -} - -void main() -{ - outf4 = vec4(Test1(int(inf)) + - Test2(int(inf))); -} diff --git a/third_party/glslang/Test/remap.similar_1a.none.frag b/third_party/glslang/Test/remap.similar_1a.none.frag deleted file mode 100644 index 6eddbc51a9..0000000000 --- a/third_party/glslang/Test/remap.similar_1a.none.frag +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 - -in float inf; -in flat ivec4 ini4; -out vec4 outf4; - -float Test1(int bound) -{ - float r = 0; - for (int x=0; x 2) - return Test1(bound); - else - return float(bound * 2 + - ini4.y * ini4.z + - ini4.x); -} - -void main() -{ - outf4 = vec4(Test1(int(inf)) + - Test2(int(inf))); -} diff --git a/third_party/glslang/Test/remap.similar_1b.everything.frag b/third_party/glslang/Test/remap.similar_1b.everything.frag deleted file mode 100644 index 460094515c..0000000000 --- a/third_party/glslang/Test/remap.similar_1b.everything.frag +++ /dev/null @@ -1,30 +0,0 @@ -#version 450 - -out vec4 outf4; -in flat ivec4 ini4; -in float inf; - -float Test1(int bound) -{ - float r = 0; - for (int x=0; x 2) { - return Test1(bound * 2); - } else - return float(bound * 4 + - ini4.y * ini4.z + - ini4.x); -} - -void main() -{ - outf4 = vec4(Test1(int(inf)) + - Test2(int(inf))); -} diff --git a/third_party/glslang/Test/remap.similar_1b.none.frag b/third_party/glslang/Test/remap.similar_1b.none.frag deleted file mode 100644 index 460094515c..0000000000 --- a/third_party/glslang/Test/remap.similar_1b.none.frag +++ /dev/null @@ -1,30 +0,0 @@ -#version 450 - -out vec4 outf4; -in flat ivec4 ini4; -in float inf; - -float Test1(int bound) -{ - float r = 0; - for (int x=0; x 2) { - return Test1(bound * 2); - } else - return float(bound * 4 + - ini4.y * ini4.z + - ini4.x); -} - -void main() -{ - outf4 = vec4(Test1(int(inf)) + - Test2(int(inf))); -} diff --git a/third_party/glslang/Test/remap.specconst.comp b/third_party/glslang/Test/remap.specconst.comp deleted file mode 100644 index 52ac07aa05..0000000000 --- a/third_party/glslang/Test/remap.specconst.comp +++ /dev/null @@ -1,7 +0,0 @@ -#version 450 - -layout (local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in; - -shared int foo[gl_WorkGroupSize.x + gl_WorkGroupSize.y * gl_WorkGroupSize.z]; - -void main () {} diff --git a/third_party/glslang/Test/remap.switch.everything.frag b/third_party/glslang/Test/remap.switch.everything.frag deleted file mode 100644 index 140c0792b0..0000000000 --- a/third_party/glslang/Test/remap.switch.everything.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 450 - -precision highp float; - -layout(location = 0) out mediump vec4 FragColor; -layout(location = 0) in vec4 in0; - -void main() -{ - switch(int(in0.w)) { - case 0: FragColor = vec4(in0.x + 0); break; - case 1: FragColor = vec4(in0.y + 1); break; - case 2: FragColor = vec4(in0.z + 2); break; - default: FragColor = vec4(-1); - } -} diff --git a/third_party/glslang/Test/remap.switch.none.frag b/third_party/glslang/Test/remap.switch.none.frag deleted file mode 100644 index 140c0792b0..0000000000 --- a/third_party/glslang/Test/remap.switch.none.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 450 - -precision highp float; - -layout(location = 0) out mediump vec4 FragColor; -layout(location = 0) in vec4 in0; - -void main() -{ - switch(int(in0.w)) { - case 0: FragColor = vec4(in0.x + 0); break; - case 1: FragColor = vec4(in0.y + 1); break; - case 2: FragColor = vec4(in0.z + 2); break; - default: FragColor = vec4(-1); - } -} diff --git a/third_party/glslang/Test/remap.uniformarray.everything.frag b/third_party/glslang/Test/remap.uniformarray.everything.frag deleted file mode 100644 index 4f642e6e97..0000000000 --- a/third_party/glslang/Test/remap.uniformarray.everything.frag +++ /dev/null @@ -1,17 +0,0 @@ -#version 140 - -uniform sampler2D texSampler2D; -in vec3 inColor; -in vec4 color[6]; -in float alpha[16]; - -void main() -{ - vec4 texColor = color[1] + color[1]; - - texColor.xyz += inColor; - - texColor.a += alpha[12]; - - gl_FragColor = texColor; -} diff --git a/third_party/glslang/Test/remap.uniformarray.none.frag b/third_party/glslang/Test/remap.uniformarray.none.frag deleted file mode 100644 index 4f642e6e97..0000000000 --- a/third_party/glslang/Test/remap.uniformarray.none.frag +++ /dev/null @@ -1,17 +0,0 @@ -#version 140 - -uniform sampler2D texSampler2D; -in vec3 inColor; -in vec4 color[6]; -in float alpha[16]; - -void main() -{ - vec4 texColor = color[1] + color[1]; - - texColor.xyz += inColor; - - texColor.a += alpha[12]; - - gl_FragColor = texColor; -} diff --git a/third_party/glslang/Test/runtests b/third_party/glslang/Test/runtests index 4c09067c1f..f797c9eb79 100755 --- a/third_party/glslang/Test/runtests +++ b/third_party/glslang/Test/runtests @@ -3,12 +3,10 @@ # Arguments: # 1- TargetDirectory, where to write test results and intermediary files # 2- Path to glslang -# 3- Path to spirv-remap TARGETDIR=${1:-localResults} BASEDIR=baseResults EXE=${2:-../build/install/bin/glslang} -REMAPEXE=${3:-../build/install/bin/spirv-remap} HASERROR=0 mkdir -p "$TARGETDIR" @@ -246,15 +244,6 @@ diff -b $BASEDIR/glsl.entryPointRename.vert.bad.out "$TARGETDIR/glsl.entryPointR run -H -e foo --source-entrypoint main glsl.entryPointRename2.vert > "$TARGETDIR/glsl.entryPointRename2.vert.out" diff -b $BASEDIR/glsl.entryPointRename2.vert.out "$TARGETDIR/glsl.entryPointRename2.vert.out" || HASERROR=1 -# -# Testing remapper error handling -# -echo "Testing remapper error handling" -"$REMAPEXE" --do-everything -i remap.invalid-spirv-1.spv -o "$TARGETDIR" > "$TARGETDIR/remap.invalid-spirv-1.out" && HASERROR=1 -diff -b $BASEDIR/remap.invalid-spirv-1.out "$TARGETDIR/remap.invalid-spirv-1.out" || HASERROR=1 -"$REMAPEXE" --do-everything -i remap.invalid-spirv-2.spv -o "$TARGETDIR" > "$TARGETDIR/remap.invalid-spirv-2.out" && HASERROR=1 -diff -b $BASEDIR/remap.invalid-spirv-2.out "$TARGETDIR/remap.invalid-spirv-2.out" || HASERROR=1 - # # Testing position Y inversion # diff --git a/third_party/glslang/Test/spv.460.subgroupEXT.mesh b/third_party/glslang/Test/spv.460.subgroupEXT.mesh index 8ccc14e2ee..4d021280cf 100644 --- a/third_party/glslang/Test/spv.460.subgroupEXT.mesh +++ b/third_party/glslang/Test/spv.460.subgroupEXT.mesh @@ -32,32 +32,17 @@ void main() BARRIER(); - gl_MeshVerticesEXT[iid+1].gl_Position = gl_MeshVerticesEXT[iid].gl_Position; - gl_MeshVerticesEXT[iid+1].gl_PointSize = gl_MeshVerticesEXT[iid].gl_PointSize; - gl_MeshVerticesEXT[iid+1].gl_ClipDistance[3] = gl_MeshVerticesEXT[iid].gl_ClipDistance[3]; - gl_MeshVerticesEXT[iid+1].gl_CullDistance[2] = gl_MeshVerticesEXT[iid].gl_CullDistance[2]; - - BARRIER(); - gl_MeshPrimitivesEXT[iid].gl_PrimitiveID = 6; gl_MeshPrimitivesEXT[iid].gl_Layer = 7; gl_MeshPrimitivesEXT[iid].gl_ViewportIndex = 8; gl_MeshPrimitivesEXT[iid].gl_CullPrimitiveEXT = false; - BARRIER(); - - gl_MeshPrimitivesEXT[iid+1].gl_PrimitiveID = gl_MeshPrimitivesEXT[iid].gl_PrimitiveID; - gl_MeshPrimitivesEXT[iid+1].gl_Layer = gl_MeshPrimitivesEXT[iid].gl_Layer; - gl_MeshPrimitivesEXT[iid+1].gl_ViewportIndex = gl_MeshPrimitivesEXT[iid].gl_ViewportIndex; - gl_MeshPrimitivesEXT[iid+1].gl_CullPrimitiveEXT = false; BARRIER(); // check bound limits gl_PrimitiveTriangleIndicesEXT[0] = uvec3(1, 1, 1); // range is between [0, vertexCount-1] gl_PrimitiveTriangleIndicesEXT[primitiveCount - 1] = uvec3(2, 2, 2); // array size is primitiveCount*3 for triangle - gl_PrimitiveTriangleIndicesEXT[gid] = gl_PrimitiveTriangleIndicesEXT[gid-1]; - BARRIER(); } diff --git a/third_party/glslang/Test/spv.64bit_indexing.comp b/third_party/glslang/Test/spv.64bit_indexing.comp new file mode 100644 index 0000000000..17097353c0 --- /dev/null +++ b/third_party/glslang/Test/spv.64bit_indexing.comp @@ -0,0 +1,35 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_KHR_cooperative_matrix : enable +#extension GL_NV_cooperative_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_shader_64bit_indexing : enable + +#pragma shader_64bit_indexing + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, buffer_reference) coherent buffer Block { + float x[]; +} block; + +void main() +{ + uint64_t element = 0; + coopmat m; + coopMatLoad(m, block.x, element, 128, gl_CooperativeMatrixLayoutRowMajor); + coopMatStore(m, block.x, element, 128, gl_CooperativeMatrixLayoutRowMajor); + + coopvecNV vec; + coopVecMatMulAddNV(vec, vec, 0, block.x, element, 0, block.x, element, 0, 2, 2, 0, false, 0); + coopVecMatMulNV(vec, vec, 0, block.x, element, 0, 2, 2, 0, false, 0); + coopVecLoadNV(vec, block.x, element); + coopVecStoreNV(vec, block.x, element); + coopVecOuterProductAccumulateNV(vec, vec, block.x, element, 0, 0, 0); + coopVecReduceSumAccumulateNV(vec, block.x, element); + + float y = block.x[element]; + int32_t len = block.x.length(); + int64_t len64 = block.x.length64(); +} diff --git a/third_party/glslang/Test/spv.64bit_indexing_error.comp b/third_party/glslang/Test/spv.64bit_indexing_error.comp new file mode 100644 index 0000000000..b72d5a59c4 --- /dev/null +++ b/third_party/glslang/Test/spv.64bit_indexing_error.comp @@ -0,0 +1,34 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_KHR_cooperative_matrix : enable +#extension GL_NV_cooperative_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, buffer_reference) coherent buffer Block { + float x[]; +} block; + +void main() +{ + uint64_t element = 0; + coopmat m; + + // errors missing 64bit_indexing + coopMatLoad(m, block.x, element, 128, gl_CooperativeMatrixLayoutRowMajor); + coopMatStore(m, block.x, element, 128, gl_CooperativeMatrixLayoutRowMajor); + + coopvecNV vec; + coopVecMatMulAddNV(vec, vec, 0, block.x, element, 0, block.x, element, 0, 2, 2, 0, false, 0); + coopVecMatMulNV(vec, vec, 0, block.x, element, 0, 2, 2, 0, false, 0); + coopVecLoadNV(vec, block.x, element); + coopVecStoreNV(vec, block.x, element); + coopVecOuterProductAccumulateNV(vec, vec, block.x, element, 0, 0, 0); + coopVecReduceSumAccumulateNV(vec, block.x, element); + + float y = block.x[element]; + int32_t len = block.x.length(); + int64_t len64 = block.x.length64(); +} diff --git a/third_party/glslang/Test/spv.atomicFloat.comp b/third_party/glslang/Test/spv.atomicFloat.comp index 2022734cf2..8277baf41d 100644 --- a/third_party/glslang/Test/spv.atomicFloat.comp +++ b/third_party/glslang/Test/spv.atomicFloat.comp @@ -29,169 +29,169 @@ void main() //atomicAdd float resultf = 0; resultf = atomicAdd(atomf, 3.0); - resultf = atomicAdd(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicAdd(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultf = atomicAdd(buf.dataf, 3.0); - resultf = atomicAdd(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicAdd(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); double resultd = 0; resultd = atomicAdd(atomd, 3.0); - resultd = atomicAdd(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultd = atomicAdd(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultd = atomicAdd(buf.datad, 3.0); - resultd = atomicAdd(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultd = atomicAdd(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); //atomicExchange resultf = atomicExchange(buf.dataf, resultf); buf.dataf += resultf; - resultf = atomicExchange(buf.dataf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicExchange(buf.dataf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.dataf += resultf; resultf = atomicExchange(atomf, resultf); buf.dataf += resultf; - resultf = atomicExchange(atomf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicExchange(atomf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.dataf += resultf; resultd = atomicExchange(buf.datad, resultd); buf.datad += resultd; - resultd = atomicExchange(buf.datad, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultd = atomicExchange(buf.datad, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.datad += resultd; resultd = atomicExchange(atomd, resultd); buf.datad += resultd; - resultd = atomicExchange(atomd, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultd = atomicExchange(atomd, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.datad += resultd; //atomic load/store - resultf = atomicLoad(buf.dataf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(buf.dataf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicLoad(buf.dataf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(buf.dataf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); buf.dataf += resultf; - resultf = atomicLoad(atomf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(atomf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicLoad(atomf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(atomf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); buf.dataf += resultf; - resultd = atomicLoad(buf.datad, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(buf.datad, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultd = atomicLoad(buf.datad, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(buf.datad, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); buf.datad += resultd; - resultd = atomicLoad(atomd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(atomd, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultd = atomicLoad(atomd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(atomd, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); buf.datad += resultd; // image atomics on 1D: atomf = imageAtomicAdd(fimage1D, int(0), 2.0); buf.dataf += atomf; - atomf = imageAtomicAdd(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicExchange(fimage1D, int(1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimage1D, int(1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicLoad(fimage1D, int(1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicLoad(fimage1D, int(1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); buf.dataf += atomf; - imageAtomicStore(fimage1D, int(2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(fimage1D, int(2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; // image atomics on 1D Array: atomf = imageAtomicAdd(fimage1DArray, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicAdd(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicExchange(fimage1DArray, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimage1DArray, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicLoad(fimage1DArray, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicLoad(fimage1DArray, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); buf.dataf += atomf; - imageAtomicStore(fimage1DArray, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(fimage1DArray, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; // image atomics on 2D: atomf = imageAtomicAdd(fimage2D, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicAdd(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicExchange(fimage2D, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimage2D, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicLoad(fimage2D, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicLoad(fimage2D, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); buf.dataf += atomf; - imageAtomicStore(fimage2D, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(fimage2D, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; // image atomics on 2D Rect: atomf = imageAtomicAdd(fimage2DRect, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicAdd(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicExchange(fimage2DRect, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimage2DRect, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicLoad(fimage2DRect, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicLoad(fimage2DRect, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); buf.dataf += atomf; - imageAtomicStore(fimage2DRect, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(fimage2DRect, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; // image atomics on 2D Array: atomf = imageAtomicAdd(fimage2DArray, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicAdd(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicExchange(fimage2DArray, ivec3(1,0,1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimage2DArray, ivec3(1,0,1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicLoad(fimage2DArray, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicLoad(fimage2DArray, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); buf.dataf += atomf; - imageAtomicStore(fimage2DArray, ivec3(2,2,0), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(fimage2DArray, ivec3(2,2,0), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; // image atomics on Cube: atomf = imageAtomicAdd(fimageCube, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicAdd(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicExchange(fimageCube, ivec3(1,0,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimageCube, ivec3(1,0,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicLoad(fimageCube, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicLoad(fimageCube, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); buf.dataf += atomf; - imageAtomicStore(fimageCube, ivec3(2,2,1), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(fimageCube, ivec3(2,2,1), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; // image atomics on Cube Array: atomf = imageAtomicAdd(fimageCubeArray, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicAdd(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicExchange(fimageCubeArray, ivec3(1,0,1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimageCubeArray, ivec3(1,0,1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicLoad(fimageCubeArray, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicLoad(fimageCubeArray, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); buf.dataf += atomf; - imageAtomicStore(fimageCubeArray, ivec3(2,2,0), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(fimageCubeArray, ivec3(2,2,0), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; // image atomics on 3D: atomf = imageAtomicAdd(fimage3D, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicAdd(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicExchange(fimage3D, ivec3(1,0,1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimage3D, ivec3(1,0,1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); buf.dataf += atomf; - atomf = imageAtomicLoad(fimage3D, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicLoad(fimage3D, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); buf.dataf += atomf; - imageAtomicStore(fimage3D, ivec3(2,2,0), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(fimage3D, ivec3(2,2,0), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; } \ No newline at end of file diff --git a/third_party/glslang/Test/spv.atomicFloat2.comp b/third_party/glslang/Test/spv.atomicFloat2.comp index 09235c5e6b..230a606103 100644 --- a/third_party/glslang/Test/spv.atomicFloat2.comp +++ b/third_party/glslang/Test/spv.atomicFloat2.comp @@ -32,148 +32,148 @@ void main() //atomicAdd float16_t resulth = float16_t(0.0); resulth = atomicAdd(atomh, float16_t(3.0)); - resulth = atomicAdd(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resulth = atomicAdd(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resulth = atomicAdd(buf.datah, float16_t(3.0)); - resulth = atomicAdd(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resulth = atomicAdd(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); //atomicMin resulth = atomicMin(atomh, float16_t(3.0)); - resulth = atomicMin(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resulth = atomicMin(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resulth = atomicMin(buf.datah, float16_t(3.0)); - resulth = atomicMin(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resulth = atomicMin(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); float resultf = 0.0; resultf = atomicMin(atomf, 3.0); - resultf = atomicMin(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicMin(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultf = atomicMin(buf.dataf, 3.0); - resultf = atomicMin(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicMin(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); double resultd = 0.0; resultd = atomicMin(atomd, 3.0); - resultd = atomicMin(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultd = atomicMin(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultd = atomicMin(buf.datad, 3.0); - resultd = atomicMin(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultd = atomicMin(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); //atomicMax resulth = atomicMax(atomh, float16_t(3.0)); - resulth = atomicMax(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resulth = atomicMax(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resulth = atomicMax(buf.datah, float16_t(3.0)); - resulth = atomicMax(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resulth = atomicMax(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultf = atomicMax(atomf, 3.0); - resultf = atomicMax(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicMax(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultf = atomicMax(buf.dataf, 3.0); - resultf = atomicMax(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicMax(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultd = atomicMax(atomd, 3.0); - resultd = atomicMax(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultd = atomicMax(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultd = atomicMax(buf.datad, 3.0); - resultd = atomicMax(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultd = atomicMax(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); //atomicExchange resulth = atomicExchange(buf.datah, resulth); buf.datah += resulth; - resulth = atomicExchange(buf.datah, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resulth = atomicExchange(buf.datah, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.datah += resulth; resulth = atomicExchange(atomh, resulth); buf.datah += resulth; - resulth = atomicExchange(atomh, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resulth = atomicExchange(atomh, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.datah += resulth; //atomic load/store - resulth = atomicLoad(buf.datah, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(buf.datah, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resulth = atomicLoad(buf.datah, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(buf.datah, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); buf.datah += resulth; - resulth = atomicLoad(atomh, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(atomh, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resulth = atomicLoad(atomh, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(atomh, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); buf.datah += resulth; // image atomics on 1D: atomf = imageAtomicMin(fimage1D, int(0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMin(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMin(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; atomf = imageAtomicMax(fimage1D, int(0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMax(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMax(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; // image atomics on 1D Array: atomf = imageAtomicMin(fimage1DArray, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMin(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMin(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; atomf = imageAtomicMax(fimage1DArray, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMax(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMax(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; // image atomics on 2D: atomf = imageAtomicMin(fimage2D, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMin(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMin(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; atomf = imageAtomicMax(fimage2D, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMax(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMax(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; // image atomics on 2D Rect: atomf = imageAtomicMin(fimage2DRect, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMin(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMin(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; atomf = imageAtomicMax(fimage2DRect, ivec2(0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMax(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMax(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; // image atomics on 2D Array: atomf = imageAtomicMin(fimage2DArray, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMin(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMin(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; atomf = imageAtomicMax(fimage2DArray, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMax(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMax(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; // image atomics on Cube: atomf = imageAtomicMin(fimageCube, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMin(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMin(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; atomf = imageAtomicMax(fimageCube, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMax(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMax(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; // image atomics on Cube Array: atomf = imageAtomicMin(fimageCubeArray, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMin(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMin(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; atomf = imageAtomicMax(fimageCubeArray, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMax(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMax(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; // image atomics on 3D: atomf = imageAtomicMin(fimage3D, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMin(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMin(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; atomf = imageAtomicMax(fimage3D, ivec3(0,0,0), 2.0); buf.dataf += atomf; - atomf = imageAtomicMax(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); + atomf = imageAtomicMax(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); buf.dataf += atomf; } diff --git a/third_party/glslang/Test/spv.atomicFloat_Error.comp b/third_party/glslang/Test/spv.atomicFloat_Error.comp index b90b97f115..2f2b524aa2 100644 --- a/third_party/glslang/Test/spv.atomicFloat_Error.comp +++ b/third_party/glslang/Test/spv.atomicFloat_Error.comp @@ -23,48 +23,48 @@ void undeclared_errors() //atomicAdd float resultf = 0; resultf = atomicAdd(atomf, 3.0); - resultf = atomicAdd(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicAdd(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultf = atomicAdd(buf.dataf, 3.0); - resultf = atomicAdd(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicAdd(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); double resultd = 0; resultd = atomicAdd(atomd, 3.0); - resultd = atomicAdd(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultd = atomicAdd(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); resultd = atomicAdd(buf.datad, 3.0); - resultd = atomicAdd(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultd = atomicAdd(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); //atomicExchange resultf = atomicExchange(buf.dataf, resultf); - resultf = atomicExchange(buf.dataf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicExchange(buf.dataf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); resultf = atomicExchange(atomf, resultf); - resultf = atomicExchange(atomf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicExchange(atomf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.dataf += resultf; resultd = atomicExchange(buf.datad, resultd); - resultd = atomicExchange(buf.datad, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultd = atomicExchange(buf.datad, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); resultd = atomicExchange(atomd, resultd); - resultd = atomicExchange(atomd, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultd = atomicExchange(atomd, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.datad += resultd; //atomic load/store - resultf = atomicLoad(buf.dataf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(buf.dataf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - resultf = atomicLoad(atomf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(atomf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicLoad(buf.dataf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(buf.dataf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); + resultf = atomicLoad(atomf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(atomf, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); buf.dataf += resultf; - resultd = atomicLoad(buf.datad, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(buf.datad, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - resultd = atomicLoad(atomd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(atomd, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultd = atomicLoad(buf.datad, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(buf.datad, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); + resultd = atomicLoad(atomd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(atomd, resultd, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelease); buf.datad += resultd; // image atomics: atomf = imageAtomicAdd(fimage2D, ivec2(0,0), 2.0); - atomf = imageAtomicAdd(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed); - atomf = imageAtomicExchange(fimage2D, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - atomf = imageAtomicLoad(fimage2D, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - imageAtomicStore(fimage2D, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicAdd(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsAcquireRelease); + atomf = imageAtomicExchange(fimage2D, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + atomf = imageAtomicLoad(fimage2D, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); + imageAtomicStore(fimage2D, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; } @@ -79,34 +79,34 @@ void main() //atomicAdd resultf = atomicAdd(atomi); resultf = atomicAdd(atomi, 3.0); - resultf = atomicAdd(atomi, resultf, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); - resultf = atomicAdd(atomi, resultf, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + resultf = atomicAdd(atomi, resultf, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + resultf = atomicAdd(atomi, resultf, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); //atomicExchange resultf = atomicExchange(buf.datai); resultf = atomicExchange(buf.datai, resultf); - resultf = atomicExchange(buf.datai, resultf, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - resultf = atomicExchange(buf.datai, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicExchange(buf.datai, resultf, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); + resultf = atomicExchange(buf.datai, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); resultf = atomicExchange(atomi, resultf); - resultf = atomicExchange(atomi, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicExchange(atomi, resultf, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); buf.dataf += resultf; //atomic load/store - resultf = atomicLoad(buf.datai, gl_StorageSemanticsShared, gl_SemanticsRelaxed); - atomicStore(buf.datai, resulti, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + resultf = atomicLoad(buf.datai, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicStore(buf.datai, resulti, gl_StorageSemanticsShared, gl_SemanticsRelease); // image atomics: atomf = imageAtomicAdd(fimage1D, ivec2(0,0), 2.0); atomf = imageAtomicAdd(fimage2D, ivec3(0,0,0), 2.0); atomf = imageAtomicAdd(fimage2D, 2.0); - atomf = imageAtomicExchange(fimage1D, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - atomf = imageAtomicExchange(fimage2D, 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - atomf = imageAtomicExchange(fimage2D, ivec3(1,0,1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - atomf = imageAtomicLoad(fimage1D, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - atomf = imageAtomicLoad(fimage2D, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - atomf = imageAtomicLoad(fimage2D, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - imageAtomicStore(fimage1D, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - imageAtomicStore(fimage2D, atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - imageAtomicStore(fimage2D, ivec3(2,2,1), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + atomf = imageAtomicExchange(fimage1D, ivec2(1,0), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + atomf = imageAtomicExchange(fimage2D, 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + atomf = imageAtomicExchange(fimage2D, ivec3(1,0,1), 4.0, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + atomf = imageAtomicLoad(fimage1D, ivec2(1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); + atomf = imageAtomicLoad(fimage2D, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); + atomf = imageAtomicLoad(fimage2D, ivec3(1,1,1), gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); + imageAtomicStore(fimage1D, ivec2(2,2), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); + imageAtomicStore(fimage2D, atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); + imageAtomicStore(fimage2D, ivec3(2,2,1), atomf, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); buf.dataf += atomf; } \ No newline at end of file diff --git a/third_party/glslang/Test/spv.atomicStoreInt64.comp b/third_party/glslang/Test/spv.atomicStoreInt64.comp index 879c37a876..91aa0a8107 100644 --- a/third_party/glslang/Test/spv.atomicStoreInt64.comp +++ b/third_party/glslang/Test/spv.atomicStoreInt64.comp @@ -7,5 +7,5 @@ layout(set = 0, binding = 0) buffer ssbo { uint64_t y; }; layout(set = 0, binding = 1) uniform ubo { uint64_t z; }; void main() { - atomicStore(y, z, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed); + atomicStore(y, z, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); } diff --git a/third_party/glslang/Test/spv.bufferhandle20.frag b/third_party/glslang/Test/spv.bufferhandle20.frag new file mode 100644 index 0000000000..85f805687b --- /dev/null +++ b/third_party/glslang/Test/spv.bufferhandle20.frag @@ -0,0 +1,27 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require +#extension GL_EXT_buffer_reference2 : require + +layout(set = 0, binding = 0) restrict readonly buffer SSBO_0 { + uint64_t address; +}; + +struct Data { + uint a; + uint b; + uint c; + int d; + uint e; +}; + +layout(set = 0, binding = 1) restrict readonly buffer SSBO_1 { + Data data[]; +} InBuffer; + +layout(buffer_reference) buffer MyBuffer { + Data data[]; +}; + +void main() { + MyBuffer(address).data[0] = InBuffer.data[0]; +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.bufferhandle21.frag b/third_party/glslang/Test/spv.bufferhandle21.frag new file mode 100644 index 0000000000..4de404bbd7 --- /dev/null +++ b/third_party/glslang/Test/spv.bufferhandle21.frag @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require +#extension GL_EXT_buffer_reference2 : require + +struct Data { + uint a; + uint b; + uint c; + int d; + uint e; +}; + +layout(set = 0, binding = 1) restrict readonly buffer SSBO_1 { + Data data; +} InBuffer; + +layout(buffer_reference) buffer MyBuffer { + Data data; +}; + +void main() { + MyBuffer x; + x.data = InBuffer.data; +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.bufferhandle22.frag b/third_party/glslang/Test/spv.bufferhandle22.frag new file mode 100644 index 0000000000..8ed325b057 --- /dev/null +++ b/third_party/glslang/Test/spv.bufferhandle22.frag @@ -0,0 +1,52 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require +#extension GL_EXT_buffer_reference2 : require + +layout(buffer_reference) buffer MyBuffer; + +struct A { + uint64_t a; + uint b; +}; +struct B { + A a; +}; + +struct S1 { uint64_t x; }; +struct S2 { float x; }; +struct S3 { uvec3 x; }; +struct S4 { uvec3 x[3][3][2][1][2]; }; +struct S5 { mat3x3 x; }; +struct S6 { MyBuffer x; }; +struct S7 { B x; }; + +layout(set = 0, binding = 1) restrict readonly buffer SSBO { + S1 s1; + S2 s2; + S3 s3; + S4 s4; + S5 s5; + S6 s6; + S7 s7; +} InBuffer; + +layout(buffer_reference) buffer MyBuffer { + S1 s1; + S2 s2; + S3 s3; + S4 s4; + S5 s5; + S6 s6; + S7 s7; +}; + +void main() { + MyBuffer payload; + payload.s1 = InBuffer.s1; + payload.s2 = InBuffer.s2; + payload.s3 = InBuffer.s3; + payload.s4 = InBuffer.s4; + payload.s5 = InBuffer.s5; + payload.s6 = InBuffer.s6; + payload.s7 = InBuffer.s7; +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.bufferhandle23.frag b/third_party/glslang/Test/spv.bufferhandle23.frag new file mode 100644 index 0000000000..b0e42c3d52 --- /dev/null +++ b/third_party/glslang/Test/spv.bufferhandle23.frag @@ -0,0 +1,19 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : enable +#extension GL_EXT_buffer_reference : enable + +layout(buffer_reference) buffer S4; + +layout(buffer_reference, buffer_reference_align = 8, std430) readonly buffer S3 { + S4 e; +}; + +// Set buffer_reference_align to 8 and it generates valid code +layout(buffer_reference, buffer_reference_align = 4, std430) readonly buffer S4 { + uint f; +}; + +void main() { + S3 x; + S4 y = x.e; +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.bufferhandle24.frag b/third_party/glslang/Test/spv.bufferhandle24.frag new file mode 100644 index 0000000000..64e96fe071 --- /dev/null +++ b/third_party/glslang/Test/spv.bufferhandle24.frag @@ -0,0 +1,19 @@ +#version 460 +#extension GL_EXT_buffer_reference : enable + + +layout(buffer_reference, buffer_reference_align = 4) buffer A { + uint x; +}; + +layout(buffer_reference, buffer_reference_align = 16) buffer B { + A a; +}; + +layout(set=0, binding=0) buffer SSBO { + B b; +}; + +void main() { + b.a.x = 0; +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.bufferhandle25.frag b/third_party/glslang/Test/spv.bufferhandle25.frag new file mode 100644 index 0000000000..37b98ed24d --- /dev/null +++ b/third_party/glslang/Test/spv.bufferhandle25.frag @@ -0,0 +1,19 @@ +#version 460 +#extension GL_EXT_buffer_reference : enable + + +layout(buffer_reference, buffer_reference_align = 64) buffer A { + uint x; +}; + +layout(buffer_reference, buffer_reference_align = 4) buffer B { + A a; +}; + +layout(set=0, binding=0) buffer SSBO { + B b; +}; + +void main() { + b.a.x = 0; +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.bufferhandleRuntimeArray.frag b/third_party/glslang/Test/spv.bufferhandleRuntimeArray.frag new file mode 100644 index 0000000000..f4d1e28fee --- /dev/null +++ b/third_party/glslang/Test/spv.bufferhandleRuntimeArray.frag @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_buffer_reference : require + +layout(buffer_reference) buffer A { + uint x; + }; + +layout(buffer_reference) buffer B { A a[]; }; + +layout(push_constant) uniform PushConstants { + B b; + uint c; +}; + +void main() {} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.coopmat.comp b/third_party/glslang/Test/spv.coopmat.comp index ab4292fe7a..891de569b5 100644 --- a/third_party/glslang/Test/spv.coopmat.comp +++ b/third_party/glslang/Test/spv.coopmat.comp @@ -31,6 +31,7 @@ layout(set = 0, binding = 0, buffer_reference) coherent buffer Block { } block; layout(set = 0, binding = 0) coherent buffer Block16 { + float16_t arr[256][256]; float16_t y[1024*1024]; float16_t x[]; @@ -111,5 +112,8 @@ void main() fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> ms; coopMatLoadNV(ms, shmatrix, 1, 2, false); coopMatStoreNV(ms, shmatrix, 1, 2, false); + + coopMatLoadNV(ms, block16.arr[8], 1, 2, false); + coopMatStoreNV(ms, block16.arr[16], 1, 2, false); } diff --git a/third_party/glslang/Test/spv.coopmat2_error.comp b/third_party/glslang/Test/spv.coopmat2_error.comp index 5376225236..ef73b8bc4b 100644 --- a/third_party/glslang/Test/spv.coopmat2_error.comp +++ b/third_party/glslang/Test/spv.coopmat2_error.comp @@ -76,4 +76,9 @@ void main() coopMatPerElementNV(A, A, add, float16_t(1.0), float16_t(1.0)); coopMatPerElementNV(Af32, A, perelemf32); coopMatPerElementNV(Af32, A, relu); + + float16_t larr[16]; + coopMatLoadTensorNV(A, larr, 0, t); + coopMatStoreTensorNV(A, larr, 0, t); + } diff --git a/third_party/glslang/Test/spv.coopmat2_tensor.comp b/third_party/glslang/Test/spv.coopmat2_tensor.comp index d43b16ed02..0f44c75d9d 100644 --- a/third_party/glslang/Test/spv.coopmat2_tensor.comp +++ b/third_party/glslang/Test/spv.coopmat2_tensor.comp @@ -8,6 +8,7 @@ layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; buffer BufType { + float16_t arr[256][256]; float16_t x[]; } Buf; @@ -31,6 +32,7 @@ layout(std430, binding = 0) buffer SBuf { } sbuf; layout(constant_id = 0) const uint32_t Clamp = gl_CooperativeMatrixClampModeConstantNV; +layout(constant_id = 1) const int32_t Clamp_signed = gl_CooperativeMatrixClampModeConstantNV; void main() { @@ -66,4 +68,10 @@ void main() coopmat Arr[2]; coopMatLoadTensorNV(Arr[1], Buf.x, 0, t); + + coopMatLoadTensorNV(A, Buf.arr[8], 0, t); + coopMatStoreTensorNV(A, Buf.arr[16], 0, t); + + tensorLayoutNV<2, Clamp_signed> tc_s = createTensorLayoutNV(2, Clamp_signed); + tensorViewNV v4 = createTensorViewNV(Clamp, true); } diff --git a/third_party/glslang/Test/spv.coopmatKHR.comp b/third_party/glslang/Test/spv.coopmatKHR.comp index 3bcee7f58e..ede8ba1706 100644 --- a/third_party/glslang/Test/spv.coopmatKHR.comp +++ b/third_party/glslang/Test/spv.coopmatKHR.comp @@ -28,6 +28,7 @@ layout(set = 0, binding = 0, buffer_reference) coherent buffer Block { } block; layout(set = 0, binding = 0) coherent buffer Block16 { + float16_t arr[256][256]; float16_t y[1024*1024]; float16_t x[]; @@ -109,6 +110,9 @@ void main() coopMatLoad(ms, shmatrix, 1, 2, gl_CooperativeMatrixLayoutRowMajor); coopMatStore(ms, shmatrix, 1, 2, gl_CooperativeMatrixLayoutRowMajor); + coopMatLoad(ms, block16.arr[8], 1, 2, gl_CooperativeMatrixLayoutRowMajor); + coopMatStore(ms, block16.arr[16], 1, 2, gl_CooperativeMatrixLayoutRowMajor); + coopmat ms8A; coopmat ms8B; coopmat ms8C; diff --git a/third_party/glslang/Test/spv.coopmatKHR_Error.comp b/third_party/glslang/Test/spv.coopmatKHR_Error.comp index f2e5a52626..959ce6d2cc 100644 --- a/third_party/glslang/Test/spv.coopmatKHR_Error.comp +++ b/third_party/glslang/Test/spv.coopmatKHR_Error.comp @@ -66,4 +66,11 @@ void main() f16_16_8.x; transpose(f16_8_8); + + //buf[] argument needs be in Shared/StorageBuffer storage classes + float16_t larr[16]; + coopmat lvar; + coopMatLoad(lvar, larr, 1, 2, gl_CooperativeMatrixLayoutRowMajor); + coopMatStore(lvar, larr, 1, 2, gl_CooperativeMatrixLayoutRowMajor); + } diff --git a/third_party/glslang/Test/spv.coopmatKHR_matmuladd_Error.comp b/third_party/glslang/Test/spv.coopmatKHR_matmuladd_Error.comp new file mode 100644 index 0000000000..9802ce12da --- /dev/null +++ b/third_party/glslang/Test/spv.coopmatKHR_matmuladd_Error.comp @@ -0,0 +1,61 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_KHR_cooperative_matrix : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable + +layout(constant_id = 0) const int M = 3; +layout(constant_id = 1) const int N = 3; + +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) coherent buffer Block16 { + float16_t x[]; +} block; + +void main() { + coopmat a; + coopmat b; + coopMatLoad(a, block.x, 0, 3, gl_CooperativeMatrixLayoutRowMajor); + coopMatLoad(b, block.x, 0, 3, gl_CooperativeMatrixLayoutRowMajor); + + coopmat c = + coopmat(1.0); + + // Incompatible dimensions (inside doesn't match): (3, 4) x (3, 4) + c = coopMatMulAdd(a, b, c); + + coopmat i; + coopmat j; + coopMatLoad(a, block.x, 0, M, gl_CooperativeMatrixLayoutRowMajor); + coopMatLoad(b, block.x, 0, M, gl_CooperativeMatrixLayoutRowMajor); + + coopmat k = + coopmat(2.0); + + // Incompatible dimensions (inside doesn't match): (M, N) x (M, N) + k = coopMatMulAdd(i, j, k); + + coopmat d; + coopMatLoad(d, block.x, 0, 4, gl_CooperativeMatrixLayoutRowMajor); + coopmat e = + coopmat(3.0); + + // Incompatible dimensions (product doesn't match sum): (3, 4) * (4, 3) = (3, 3) + (4, 4) + e = coopMatMulAdd(a, d, e); + + // Improper usage type: A + coopmat f; + coopMatLoad(f, block.x, 0, 3, gl_CooperativeMatrixLayoutRowMajor); + c = coopMatMulAdd(f, d, c); + + // Improper usage type: B + coopmat g; + coopMatLoad(g, block.x, 0, 4, gl_CooperativeMatrixLayoutRowMajor); + c = coopMatMulAdd(a, g, c); + + // Improper usage type: Accum + coopmat h = + coopmat(1.0); + e = coopMatMulAdd(a, d, h); +} diff --git a/third_party/glslang/Test/spv.coopmat_Error.comp b/third_party/glslang/Test/spv.coopmat_Error.comp index 220aa980c2..4ceb97a539 100644 --- a/third_party/glslang/Test/spv.coopmat_Error.comp +++ b/third_party/glslang/Test/spv.coopmat_Error.comp @@ -73,4 +73,11 @@ void main() float16_t(2.0)*f32_16_8; transpose(f16_8_8); + + //Buf[] argument needs be in Shared/StorageBuffer storage classes + float16_t larr[16]; + fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> lvar; + coopMatLoadNV(lvar, larr, 1, 2, false); + coopMatStoreNV(lvar, larr, 1, 2, false); + } diff --git a/third_party/glslang/Test/spv.coopmat_armlayout.comp b/third_party/glslang/Test/spv.coopmat_armlayout.comp index b63ea5e7cb..6de88126f0 100644 --- a/third_party/glslang/Test/spv.coopmat_armlayout.comp +++ b/third_party/glslang/Test/spv.coopmat_armlayout.comp @@ -58,12 +58,12 @@ void main() float x = m[1]; m[0] = x; - coopMatLoad(m, block.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); - coopMatStore(m, block.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); - coopMatLoad(m2, block16.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); - coopMatStore(m2, block16.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); - coopMatLoad(m, block16.b.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); - coopMatStore(m, block16.b.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatLoad(m, block.x, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatStore(m, block.x, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatLoad(m2, block16.x, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatStore(m2, block16.x, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatLoad(m, block16.b.x, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatStore(m, block16.b.x, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopmat A; coopmat B; @@ -86,10 +86,10 @@ void main() mC2[1] = mC2[2]; - coopMatLoad(m, block.y, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); - coopMatStore(m, block.y, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); - coopMatLoad(m2, block16.y, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); - coopMatStore(m2, block16.y, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatLoad(m, block.y, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatStore(m, block.y, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatLoad(m2, block16.y, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); + coopMatStore(m2, block16.y, 16, 1, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopmat p1; coopmat p2; @@ -105,7 +105,7 @@ void main() p1 *= float16_t(2.0); p2 *= 4.0; - coopmat ms; + coopmat ms; coopMatLoad(ms, shmatrix, 1, 2, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatStore(ms, shmatrix, 1, 2, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); @@ -116,6 +116,6 @@ void main() coopMatMulAdd(ms8A, ms8B, ms8C, 0); coopMatMulAdd(ms8A, ms8B, ms8C, gl_MatrixOperandsSaturatingAccumulation); - coopmat m16; + coopmat m16; coopMatStore(m16, shmatrix, 1, 2, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); } diff --git a/third_party/glslang/Test/spv.coopvecStoreLocal.comp b/third_party/glslang/Test/spv.coopvecStoreLocal.comp new file mode 100644 index 0000000000..4e168cb66f --- /dev/null +++ b/third_party/glslang/Test/spv.coopvecStoreLocal.comp @@ -0,0 +1,20 @@ +#version 450 core +#extension GL_NV_gpu_shader5 : require +#extension GL_NV_cooperative_vector : require + +layout(local_size_x = 8, local_size_y = 8) in; +layout(binding = 0, rgba8) uniform image2D image; + +layout(std430, binding = 1) buffer MatrixBuffer +{ + float matrix[]; +}; + +void main() +{ + float vecOut[4]; + coopvecNV coopVecOut; + + coopVecStoreNV(coopVecOut, vecOut, 0); +} + diff --git a/third_party/glslang/Test/spv.coopvecloadstore_Error.comp b/third_party/glslang/Test/spv.coopvecloadstore_Error.comp new file mode 100644 index 0000000000..be6f765d50 --- /dev/null +++ b/third_party/glslang/Test/spv.coopvecloadstore_Error.comp @@ -0,0 +1,40 @@ +#version 450 core +#extension GL_NV_gpu_shader5 : require +#extension GL_NV_cooperative_vector : require + +layout(local_size_x = 8, local_size_y = 8) in; +layout(binding = 0, rgba8) uniform image2D image; + +layout(std430, binding = 1) buffer MatrixBuffer +{ + float matrix[]; +}; + +shared float sharedArray[16]; + +void main() +{ + // Test error: storing to local variable (should fail) + float vecOut[4]; + coopvecNV coopVecOut; + coopVecStoreNV(coopVecOut, vecOut, 0); // ERROR: vecOut is local + + // Test error: loading from local variable (should fail) + float vecIn[4]; + coopvecNV coopVecIn; + coopVecLoadNV(coopVecIn, vecIn, 0); // ERROR: vecIn is local + + // These should work correctly: + // Store to buffer storage + coopVecStoreNV(coopVecOut, matrix, 0); + + // Load from buffer storage + coopVecLoadNV(coopVecIn, matrix, 0); + + // Store to shared storage + coopVecStoreNV(coopVecOut, sharedArray, 0); + + // Load from shared storage + coopVecLoadNV(coopVecIn, sharedArray, 0); +} + diff --git a/third_party/glslang/Test/spv.debuginfo.const_variables.glsl.frag b/third_party/glslang/Test/spv.debuginfo.const_variables.glsl.frag new file mode 100644 index 0000000000..a73ef9c435 --- /dev/null +++ b/third_party/glslang/Test/spv.debuginfo.const_variables.glsl.frag @@ -0,0 +1,10 @@ +#version 460 + +const vec4 constGlobal = vec4(1.0, 0.0, 0.0, 1.0); + +out vec4 outColor; + +void main() { + const float constLocal = 3.14; + outColor = constGlobal * constLocal; +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.debuginfo.declaration.glsl.frag b/third_party/glslang/Test/spv.debuginfo.declaration.glsl.frag new file mode 100644 index 0000000000..de801891ae --- /dev/null +++ b/third_party/glslang/Test/spv.debuginfo.declaration.glsl.frag @@ -0,0 +1,24 @@ +#version 460 + +uniform UBO { + int x; +}; + +out vec4 outColor; + +void main() { + int x = 41; + { + int x = 42; + + while (bool test = x < 45) { + x += 1; + } + + for (int x = 50; bool test = x < 53; ) { + x += 1; + } + + outColor = vec4(x); + } +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.debuginfo.interface_bool.glsl.comp b/third_party/glslang/Test/spv.debuginfo.interface_bool.glsl.comp new file mode 100644 index 0000000000..5aa42190bb --- /dev/null +++ b/third_party/glslang/Test/spv.debuginfo.interface_bool.glsl.comp @@ -0,0 +1,27 @@ +#version 450 + +layout (local_size_x = 32, local_size_y = 1) in; + +uniform UBO +{ + bool b; + bvec4 bv; + bool[4] ba; +}; + +buffer SSBO { + bool b; + bvec4 bv; + bool[4] ba; +} ssbo; + +void main() +{ + if (gl_GlobalInvocationID.x == 0 && gl_GlobalInvocationID.y == 0) { + ssbo.b = b; + ssbo.bv = bv; + for (int i = 0; i < 4; ++i) { + ssbo.ba[i] = ba[i]; + } + } +} diff --git a/third_party/glslang/Test/spv.debuginfo.rt_ext_builtins.glsl.rahit b/third_party/glslang/Test/spv.debuginfo.rt_ext_builtins.glsl.rahit new file mode 100644 index 0000000000..d4dfe6fa74 --- /dev/null +++ b/third_party/glslang/Test/spv.debuginfo.rt_ext_builtins.glsl.rahit @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable + +layout(location = 1) rayPayloadInEXT vec4 incomingPayload; + +void main() +{ + uvec3 v0 = gl_LaunchIDEXT; + uvec3 v1 = gl_LaunchSizeEXT; + int v2 = gl_PrimitiveID; + int v3 = gl_InstanceID; + int v4 = gl_InstanceCustomIndexEXT; + vec3 v5 = gl_WorldRayOriginEXT; + vec3 v6 = gl_WorldRayDirectionEXT; + vec3 v7 = gl_ObjectRayOriginEXT; + vec3 v8 = gl_ObjectRayDirectionEXT; + float v9 = gl_RayTminEXT; + float v10 = gl_RayTmaxEXT; + float v11 = gl_HitTEXT; + uint v12 = gl_HitKindEXT; + mat4x3 v13 = gl_ObjectToWorldEXT; + mat4x3 v14 = gl_WorldToObjectEXT; + incomingPayload = vec4(0.5f); +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.debuginfo.rt_nv_builtins.glsl.rahit b/third_party/glslang/Test/spv.debuginfo.rt_nv_builtins.glsl.rahit new file mode 100644 index 0000000000..9bf6224583 --- /dev/null +++ b/third_party/glslang/Test/spv.debuginfo.rt_nv_builtins.glsl.rahit @@ -0,0 +1,24 @@ +#version 460 +#extension GL_NV_ray_tracing : enable + +layout(location = 1) rayPayloadInNV vec4 incomingPayload; + +void main() +{ + uvec3 v0 = gl_LaunchIDNV; + uvec3 v1 = gl_LaunchSizeNV; + int v2 = gl_PrimitiveID; + int v3 = gl_InstanceID; + int v4 = gl_InstanceCustomIndexNV; + vec3 v5 = gl_WorldRayOriginNV; + vec3 v6 = gl_WorldRayDirectionNV; + vec3 v7 = gl_ObjectRayOriginNV; + vec3 v8 = gl_ObjectRayDirectionNV; + float v9 = gl_RayTminNV; + float v10 = gl_RayTmaxNV; + float v11 = gl_HitTNV; + uint v12 = gl_HitKindNV; + mat4x3 v13 = gl_ObjectToWorldNV; + mat4x3 v14 = gl_WorldToObjectNV; + incomingPayload = vec4(0.5f); +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.debuginfo.rt_types.glsl.rgen b/third_party/glslang/Test/spv.debuginfo.rt_types.glsl.rgen index 8d5638fd8c..0debe580cf 100644 --- a/third_party/glslang/Test/spv.debuginfo.rt_types.glsl.rgen +++ b/third_party/glslang/Test/spv.debuginfo.rt_types.glsl.rgen @@ -1,7 +1,10 @@ #version 460 #extension GL_NV_ray_tracing : enable +#extension GL_NV_shader_invocation_reorder : enable #extension GL_EXT_ray_query : enable + layout(binding = 0, set = 0) uniform accelerationStructureEXT acc0; +layout(location = 1) rayPayloadEXT vec4 payload; layout(shaderRecordNV) buffer block { @@ -9,15 +12,39 @@ layout(shaderRecordNV) buffer block vec3 origin; }; -void main() -{ - rayQueryEXT localRayQuery; +rayQueryEXT globalRayQuery; +hitObjectNV globalHitObject; + +void testRayQuery() { uint rayFlags = gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT; float tMin = 0.f; float tMax = 1000.f; + + rayQueryInitializeEXT(globalRayQuery, acc0, rayFlags, 0xFF , origin, tMin, dir, tMax); + if (!rayQueryProceedEXT(globalRayQuery)) + { + rayQueryTerminateEXT(globalRayQuery); + } + + rayQueryEXT localRayQuery; rayQueryInitializeEXT(localRayQuery, acc0, rayFlags, 0xFF , origin, tMin, dir, tMax); if (!rayQueryProceedEXT(localRayQuery)) { rayQueryTerminateEXT(localRayQuery); } } + + +void testHitObject() { + + hitObjectTraceRayNV(globalHitObject, acc0, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 1); + + hitObjectNV localHitObject; + hitObjectTraceRayNV(localHitObject, acc0, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 1); +} + +void main() +{ + testRayQuery(); + testHitObject(); +} diff --git a/third_party/glslang/Test/spv.debuginfo.sampler_type.glsl.frag b/third_party/glslang/Test/spv.debuginfo.sampler_type.glsl.frag new file mode 100644 index 0000000000..5bc12a613e --- /dev/null +++ b/third_party/glslang/Test/spv.debuginfo.sampler_type.glsl.frag @@ -0,0 +1,19 @@ +#version 460 + +layout(rgba8, binding = 0) uniform image2D test_image2D; + +layout(rgba8ui, binding = 1) uniform uimage2D test_uimage2D; + +layout(binding = 2) uniform sampler test_sampler; + +layout(binding = 3) uniform sampler2D test_sampler2D; + +layout(binding = 4) uniform usampler3D test_usampler3D; + +layout(binding = 5) uniform samplerCubeArray test_samplerCubeArray; + +layout(binding = 6) uniform texture2DArray test_texture2DArray; + +void main() { + +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.debuginfo.ubo.glsl.frag b/third_party/glslang/Test/spv.debuginfo.ubo.glsl.frag new file mode 100644 index 0000000000..1f41fbc37a --- /dev/null +++ b/third_party/glslang/Test/spv.debuginfo.ubo.glsl.frag @@ -0,0 +1,15 @@ +#version 460 + +uniform UBO1 { + vec4 memberA; +}; + +uniform UBO2 { + vec4 memberB; +} uboInstance; + +out vec4 outColor; + +void main() { + outColor = memberA + uboInstance.memberB; +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.descriptorHeap.AtomicImage.comp b/third_party/glslang/Test/spv.descriptorHeap.AtomicImage.comp new file mode 100644 index 0000000000..bf20336705 --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.AtomicImage.comp @@ -0,0 +1,8 @@ +#version 460 core +#extension GL_EXT_descriptor_heap: enable +layout(descriptor_heap, r32i) uniform iimage1D img[]; + +void main() +{ + imageAtomicAdd(img[1], 1, 1); +} diff --git a/third_party/glslang/Test/spv.descriptorHeap.AtomicImage.error.comp b/third_party/glslang/Test/spv.descriptorHeap.AtomicImage.error.comp new file mode 100644 index 0000000000..05cfa6df3d --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.AtomicImage.error.comp @@ -0,0 +1,19 @@ +#version 450 +#extension GL_ARB_gpu_shader_int64: require +#extension GL_EXT_descriptor_heap: require +#extension GL_EXT_nonuniform_qualifier: require +#extension GL_EXT_shader_image_int64: require +#extension GL_EXT_shader_atomic_int64: require + +layout(local_size_x = 1) in; +layout(descriptor_heap, r32ui) uniform uimage1D img[]; + +void Apply(uimage1D image) +{ + imageAtomicOr(image, 0, 0xcafebeef); +} + +void main() +{ + Apply(img[gl_GlobalInvocationID.x]); +} diff --git a/third_party/glslang/Test/spv.descriptorHeap.Buffer.comp b/third_party/glslang/Test/spv.descriptorHeap.Buffer.comp new file mode 100644 index 0000000000..b2b6bd72df --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.Buffer.comp @@ -0,0 +1,10 @@ +#version 450 +#extension GL_EXT_descriptor_heap: require + +layout(descriptor_heap) uniform U { uint inputData; } ubo[]; +layout(descriptor_heap) buffer O { uint outputData; } ssbo[]; + +void main() +{ + ssbo[8].outputData = ubo[9].inputData; +} diff --git a/third_party/glslang/Test/spv.descriptorHeap.DebugPrintf.comp b/third_party/glslang/Test/spv.descriptorHeap.DebugPrintf.comp new file mode 100644 index 0000000000..523215fdc9 --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.DebugPrintf.comp @@ -0,0 +1,14 @@ +#version 450 +#extension GL_EXT_descriptor_heap: require +#extension GL_EXT_debug_printf: require + +layout(local_size_x = 1) in; +layout(descriptor_heap, r32ui) uniform uimage1D img[]; + + +void main() +{ + float myfloat = 3.1415f; + debugPrintfEXT("float == %f", myfloat); + +} diff --git a/third_party/glslang/Test/spv.descriptorHeap.HeapNotArray.error.comp b/third_party/glslang/Test/spv.descriptorHeap.HeapNotArray.error.comp new file mode 100644 index 0000000000..359d0c6d10 --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.HeapNotArray.error.comp @@ -0,0 +1,8 @@ +#version 460 core +#extension GL_EXT_descriptor_heap: enable +layout(descriptor_heap, r32i) uniform iimage1D img; + +void main() +{ + imageAtomicAdd(img, 1, 1); +} diff --git a/third_party/glslang/Test/spv.descriptorHeap.HeapStrideNotHeap.error.comp b/third_party/glslang/Test/spv.descriptorHeap.HeapStrideNotHeap.error.comp new file mode 100644 index 0000000000..73c64103fa --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.HeapStrideNotHeap.error.comp @@ -0,0 +1,10 @@ +#version 450 +#extension GL_EXT_descriptor_heap: require + +layout(descriptor_stride = 2) uniform U { uint inputData; } ubo[]; +layout(descriptor_heap) buffer O { uint outputData; } ssbo[]; + +void main() +{ + ssbo[8].outputData = ubo[9].inputData; +} diff --git a/third_party/glslang/Test/spv.descriptorHeap.HeapStrideNotPow2.error.comp b/third_party/glslang/Test/spv.descriptorHeap.HeapStrideNotPow2.error.comp new file mode 100644 index 0000000000..60ad63a52b --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.HeapStrideNotPow2.error.comp @@ -0,0 +1,10 @@ +#version 450 +#extension GL_EXT_descriptor_heap: require + +layout(descriptor_heap, descriptor_stride = 3) uniform U { uint inputData; } ubo[]; +layout(descriptor_heap) buffer O { uint outputData; } ssbo[]; + +void main() +{ + ssbo[8].outputData = ubo[9].inputData; +} diff --git a/third_party/glslang/Test/spv.descriptorHeap.PushConstant.comp b/third_party/glslang/Test/spv.descriptorHeap.PushConstant.comp new file mode 100644 index 0000000000..b1594ce3d8 --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.PushConstant.comp @@ -0,0 +1,17 @@ +#version 450 +#extension GL_EXT_descriptor_heap: require +layout(local_size_x = 1) in; + +layout(descriptor_heap) buffer O { uint outputBuffer[]; } buffers[]; + +layout(constant_id = 0) const int PUSH_LENGTH = 1; + +layout(push_constant, std430) uniform P { + int pushData[PUSH_LENGTH]; +}; + +void main() { + for (int i = 0; i < PUSH_LENGTH; ++i) { + buffers[0].outputBuffer[i] = pushData[i]; + } +} diff --git a/third_party/glslang/Test/spv.descriptorHeap.valid.frag b/third_party/glslang/Test/spv.descriptorHeap.valid.frag new file mode 100644 index 0000000000..ea826f589c --- /dev/null +++ b/third_party/glslang/Test/spv.descriptorHeap.valid.frag @@ -0,0 +1,35 @@ +#version 460 core + +#extension GL_EXT_descriptor_heap : enable +#extension GL_EXT_nonuniform_qualifier : enable + +// Sampler array aliased to the sampler heap +uniform sampler heapSampler[]; + +// Different image arrays aliased to the image heap +uniform texture2D heapTexture2D[]; +uniform texture3D heapTexture3D[]; + +// Different buffer arrays aliased to the buffer heap +buffer StorageBufferA { + vec4 a; +} heapStorageBufferA[]; +buffer StorageBufferB { + vec3 b; +} heapStorageBufferB[]; +uniform UniformBuffer { + vec4 colorOffset; +} heapUniformBuffer[]; + +layout (location = 0) in vec2 uvs; +layout (location = 1) flat in uint index; + +layout (location = 0) out vec4 fragColor; + +void main() +{ + fragColor = texture(sampler2D(heapTexture2D[27], heapSampler[0]), uvs); + fragColor += heapUniformBuffer[nonuniformEXT(index)].colorOffset; + heapStorageBufferA[1].a = vec4(1, 2, 3, 4); + fragColor.x += heapStorageBufferB[nonuniformEXT(index)].b.x; +} diff --git a/third_party/glslang/Test/spv.ext.hitobject-allops.rchit b/third_party/glslang/Test/spv.ext.hitobject-allops.rchit new file mode 100644 index 0000000000..42cf6e9ac8 --- /dev/null +++ b/third_party/glslang/Test/spv.ext.hitobject-allops.rchit @@ -0,0 +1,53 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable +#extension GL_EXT_shader_invocation_reorder : enable +#extension GL_NV_ray_tracing_motion_blur : enable +#extension GL_EXT_ray_query : enable +layout(location = 1) rayPayloadEXT vec4 payload; +layout(location = 2) rayPayloadEXT pBlock { vec2 val1; vec2 val2; }; +layout(location = 2) hitObjectAttributeEXT vec2 attr; +layout(location = 3) hitObjectAttributeEXT hBlock { float attrval;}; +layout(binding = 0) uniform accelerationStructureEXT as; +layout(binding = 1) buffer block { + float op; +}; +void main() +{ + hitObjectEXT hObj; + hitObjectEXT hObjHit, hObjMiss, hObjNop; + rayQueryEXT rq; + attr = vec2(1.0); + attrval = 2.0; + hitObjectTraceRayEXT(hObj, as, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 1); + hitObjectTraceRayMotionEXT(hObj, as, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 10.0, 2); + hitObjectRecordEmptyEXT(hObjNop); + hitObjectRecordMissEXT(hObjMiss, 1U, 1U, vec3(0.5), 2.0, vec3(1.5), 5.0); + hitObjectRecordMissMotionEXT(hObjMiss,1U, 1U, vec3(0.5), 2.0, vec3(1.5), 5.0, 8.0f); + hitObjectExecuteShaderEXT(hObjHit, 1); + if (hitObjectIsHitEXT(hObj)) { + op = 1.0f; + } else if (hitObjectIsMissEXT(hObj)) { + op = 2.0f; + } else if (hitObjectIsEmptyEXT(hObj)) { + op = 3.0f; + } + + uint rayflags = hitObjectGetRayFlagsEXT(hObjHit); + float tmin = hitObjectGetRayTMinEXT(hObjHit); + float tmax = hitObjectGetRayTMaxEXT(hObjHit); + vec3 orig = hitObjectGetWorldRayOriginEXT(hObjHit); + vec3 dir = hitObjectGetWorldRayDirectionEXT(hObjHit); + vec3 oorig = hitObjectGetObjectRayOriginEXT(hObjHit); + vec3 odir = hitObjectGetObjectRayDirectionEXT(hObjHit); + mat4x3 otw = hitObjectGetObjectToWorldEXT(hObjHit); + mat4x3 wto = hitObjectGetWorldToObjectEXT(hObjHit); + int cid = hitObjectGetInstanceCustomIndexEXT(hObjMiss); + int iid = hitObjectGetInstanceIdEXT(hObjNop); + int pid = hitObjectGetPrimitiveIndexEXT(hObj); + int gid = hitObjectGetGeometryIndexEXT(hObj); + uint hkind = hitObjectGetHitKindEXT(hObj); + hitObjectGetAttributesEXT(hObj, 2); + uvec2 handle = hitObjectGetShaderRecordBufferHandleEXT(hObj); + uint rid = hitObjectGetShaderBindingTableRecordIndexEXT(hObj); + hitObjectRecordFromQueryEXT(hObjHit, rq, 1U, 2); +} diff --git a/third_party/glslang/Test/spv.ext.hitobject-allops.rgen b/third_party/glslang/Test/spv.ext.hitobject-allops.rgen new file mode 100644 index 0000000000..e73ade590e --- /dev/null +++ b/third_party/glslang/Test/spv.ext.hitobject-allops.rgen @@ -0,0 +1,61 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable +#extension GL_EXT_shader_invocation_reorder : enable +#extension GL_NV_ray_tracing_motion_blur : enable +#extension GL_EXT_ray_query : enable +layout(location = 1) rayPayloadEXT vec4 payload; +layout(location = 2) rayPayloadEXT pBlock { vec2 val1; vec2 val2; }; +layout(location = 2) hitObjectAttributeEXT vec2 attr; +layout(location = 3) hitObjectAttributeEXT hBlock { float attrval;}; +layout(binding = 0) uniform accelerationStructureEXT as; +layout(binding = 1) buffer block { + float op; +}; +void main() +{ + hitObjectEXT hObj; + hitObjectEXT hObjHit, hObjMiss, hObjNop; + rayQueryEXT rq; + attr = vec2(1.0); + attrval = 2.0; + hitObjectTraceRayEXT(hObj, as, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 1); + hitObjectTraceRayMotionEXT(hObj, as, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 10.0, 2); + hitObjectRecordEmptyEXT(hObjNop); + hitObjectRecordMissEXT(hObjMiss, 1U, 1U, vec3(0.5), 2.0, vec3(1.5), 5.0); + hitObjectRecordMissMotionEXT(hObjMiss,1U, 1U, vec3(0.5), 2.0, vec3(1.5), 5.0, 8.0f); + hitObjectExecuteShaderEXT(hObjHit, 1); + if (hitObjectIsHitEXT(hObj)) { + op = 1.0f; + } else if (hitObjectIsMissEXT(hObj)) { + op = 2.0f; + } else if (hitObjectIsEmptyEXT(hObj)) { + op = 3.0f; + } + + uint rayflags = hitObjectGetRayFlagsEXT(hObjHit); + float tmin = hitObjectGetRayTMinEXT(hObjHit); + float tmax = hitObjectGetRayTMaxEXT(hObjHit); + vec3 orig = hitObjectGetWorldRayOriginEXT(hObjHit); + vec3 dir = hitObjectGetWorldRayDirectionEXT(hObjHit); + vec3 oorig = hitObjectGetObjectRayOriginEXT(hObjHit); + vec3 odir = hitObjectGetObjectRayDirectionEXT(hObjHit); + mat4x3 otw = hitObjectGetObjectToWorldEXT(hObjHit); + mat4x3 wto = hitObjectGetWorldToObjectEXT(hObjHit); + int cid = hitObjectGetInstanceCustomIndexEXT(hObjMiss); + int iid = hitObjectGetInstanceIdEXT(hObjNop); + int pid = hitObjectGetPrimitiveIndexEXT(hObj); + int gid = hitObjectGetGeometryIndexEXT(hObj); + uint hkind = hitObjectGetHitKindEXT(hObj); + hitObjectGetAttributesEXT(hObj, 2); + uvec2 handle = hitObjectGetShaderRecordBufferHandleEXT(hObj); + uint rid = hitObjectGetShaderBindingTableRecordIndexEXT(hObj); + hitObjectRecordFromQueryEXT(hObjHit, rq, 1U, 2); + + reorderThreadEXT(4,4); + reorderThreadEXT(hObjHit); + reorderThreadEXT(hObjHit, 4, 2); + + + + +} diff --git a/third_party/glslang/Test/spv.ext.hitobject-allops.rmiss b/third_party/glslang/Test/spv.ext.hitobject-allops.rmiss new file mode 100644 index 0000000000..7833291222 --- /dev/null +++ b/third_party/glslang/Test/spv.ext.hitobject-allops.rmiss @@ -0,0 +1,54 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable +#extension GL_EXT_shader_invocation_reorder : enable +#extension GL_NV_ray_tracing_motion_blur : enable +#extension GL_EXT_ray_query : enable +layout(location = 1) rayPayloadEXT vec4 payload; +layout(location = 2) rayPayloadEXT pBlock { vec2 val1; vec2 val2; }; +layout(location = 2) hitObjectAttributeEXT vec2 attr; +layout(location = 3) hitObjectAttributeEXT hBlock { float attrval;}; +layout(binding = 0) uniform accelerationStructureEXT as; +layout(binding = 1) buffer block { + float op; +}; +void main() +{ + hitObjectEXT hObj; + hitObjectEXT hObjHit, hObjMiss, hObjNop; + rayQueryEXT rq; + attr = vec2(1.0); + attrval = 2.0; + hitObjectTraceRayEXT(hObj, as, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 1); + hitObjectTraceRayMotionEXT(hObj, as, 1U, 1U, 1U, 1U, 1U, vec3(0.5), 0.5, vec3(1), 1.0, 10.0, 2); + hitObjectRecordEmptyEXT(hObjNop); + hitObjectRecordMissEXT(hObjMiss, 1U, 1U, vec3(0.5), 2.0, vec3(1.5), 5.0); + hitObjectRecordMissMotionEXT(hObjMiss,1U, 1U, vec3(0.5), 2.0, vec3(1.5), 5.0, 8.0f); + hitObjectExecuteShaderEXT(hObjHit, 1); + if (hitObjectIsHitEXT(hObj)) { + op = 1.0f; + } else if (hitObjectIsMissEXT(hObj)) { + op = 2.0f; + } else if (hitObjectIsEmptyEXT(hObj)) { + op = 3.0f; + } + + uint rayflags = hitObjectGetRayFlagsEXT(hObjHit); + float tmin = hitObjectGetRayTMinEXT(hObjHit); + float tmax = hitObjectGetRayTMaxEXT(hObjHit); + vec3 orig = hitObjectGetWorldRayOriginEXT(hObjHit); + vec3 dir = hitObjectGetWorldRayDirectionEXT(hObjHit); + vec3 oorig = hitObjectGetObjectRayOriginEXT(hObjHit); + vec3 odir = hitObjectGetObjectRayDirectionEXT(hObjHit); + mat4x3 otw = hitObjectGetObjectToWorldEXT(hObjHit); + mat4x3 wto = hitObjectGetWorldToObjectEXT(hObjHit); + int cid = hitObjectGetInstanceCustomIndexEXT(hObjMiss); + int iid = hitObjectGetInstanceIdEXT(hObjNop); + int pid = hitObjectGetPrimitiveIndexEXT(hObj); + int gid = hitObjectGetGeometryIndexEXT(hObj); + uint hkind = hitObjectGetHitKindEXT(hObj); + hitObjectGetAttributesEXT(hObj, 2); + uvec2 handle = hitObjectGetShaderRecordBufferHandleEXT(hObj); + uint rid = hitObjectGetShaderBindingTableRecordIndexEXT(hObj); + hitObjectRecordFromQueryEXT(hObjHit, rq, 1U, 2); + +} diff --git a/third_party/glslang/Test/spv.ext.hitobject-errors.rgen b/third_party/glslang/Test/spv.ext.hitobject-errors.rgen new file mode 100644 index 0000000000..4f9ccec69f --- /dev/null +++ b/third_party/glslang/Test/spv.ext.hitobject-errors.rgen @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_ray_tracing : enable +#extension GL_EXT_shader_invocation_reorder : enable + + +hitObjectEXT hObjGlob; // OK +uniform hitObjectEXT uHitObj; // ERROR + +layout(location=0) in hitObjectEXT hobjIn; // ERROR +out hitObjectEXT hobjOut; // ERROR + +struct hObjWrapper{ + hitObjectEXT objField; + vec3 v; +}; + +void foo(hitObjectEXT hObjArg) {} // OK + +void main() +{ + hObjWrapper wrapper; // ERROR + hitObjectEXT localHitObj; // OK + foo(localHitObj); // OK +} diff --git a/third_party/glslang/Test/spv.ext.meshShaderBuiltins.mesh b/third_party/glslang/Test/spv.ext.meshShaderBuiltins.mesh index 70a97360d7..640b6b877d 100644 --- a/third_party/glslang/Test/spv.ext.meshShaderBuiltins.mesh +++ b/third_party/glslang/Test/spv.ext.meshShaderBuiltins.mesh @@ -33,13 +33,6 @@ void main() BARRIER(); - gl_MeshVerticesEXT[iid+1].gl_Position = gl_MeshVerticesEXT[iid].gl_Position; - gl_MeshVerticesEXT[iid+1].gl_PointSize = gl_MeshVerticesEXT[iid].gl_PointSize; - gl_MeshVerticesEXT[iid+1].gl_ClipDistance[3] = gl_MeshVerticesEXT[iid].gl_ClipDistance[3]; - gl_MeshVerticesEXT[iid+1].gl_CullDistance[2] = gl_MeshVerticesEXT[iid].gl_CullDistance[2]; - - BARRIER(); - gl_MeshPrimitivesEXT[iid].gl_PrimitiveID = 6; gl_MeshPrimitivesEXT[iid].gl_Layer = 7; gl_MeshPrimitivesEXT[iid].gl_ViewportIndex = 8; @@ -47,17 +40,10 @@ void main() BARRIER(); - gl_MeshPrimitivesEXT[iid+1].gl_PrimitiveID = gl_MeshPrimitivesEXT[iid].gl_PrimitiveID; - gl_MeshPrimitivesEXT[iid+1].gl_Layer = gl_MeshPrimitivesEXT[iid].gl_Layer; - gl_MeshPrimitivesEXT[iid+1].gl_ViewportIndex = gl_MeshPrimitivesEXT[iid].gl_ViewportIndex; - gl_MeshPrimitivesEXT[iid+1].gl_CullPrimitiveEXT = gl_MeshPrimitivesEXT[iid].gl_CullPrimitiveEXT; - - BARRIER(); - // check bound limits gl_PrimitiveTriangleIndicesEXT[0] = uvec3(257); // should truncate 257 -> 1, range is between [0, vertexCount-1] gl_PrimitiveTriangleIndicesEXT[primitiveCount - 1] = uvec3(2); // array size is primitiveCount*3 for triangle - gl_PrimitiveTriangleIndicesEXT[gid] = gl_PrimitiveTriangleIndicesEXT[gid-1]; + gl_PrimitiveTriangleIndicesEXT[gid] = uvec3(0); BARRIER(); } @@ -70,5 +56,5 @@ void testAdditionalBuiltins() { int id = gl_DrawIDARB; // GL_ARB_shader_draw_parameters int viewIdx = gl_ViewIndex; // GL_EXT_multiview - + } \ No newline at end of file diff --git a/third_party/glslang/Test/spv.ext.meshShaderBuiltinsShadingRate.mesh b/third_party/glslang/Test/spv.ext.meshShaderBuiltinsShadingRate.mesh index b99125dc22..efb3e0fe5c 100644 --- a/third_party/glslang/Test/spv.ext.meshShaderBuiltinsShadingRate.mesh +++ b/third_party/glslang/Test/spv.ext.meshShaderBuiltinsShadingRate.mesh @@ -34,13 +34,6 @@ void main() BARRIER(); - gl_MeshVerticesEXT[iid+1].gl_Position = gl_MeshVerticesEXT[iid].gl_Position; - gl_MeshVerticesEXT[iid+1].gl_PointSize = gl_MeshVerticesEXT[iid].gl_PointSize; - gl_MeshVerticesEXT[iid+1].gl_ClipDistance[3] = gl_MeshVerticesEXT[iid].gl_ClipDistance[3]; - gl_MeshVerticesEXT[iid+1].gl_CullDistance[2] = gl_MeshVerticesEXT[iid].gl_CullDistance[2]; - - BARRIER(); - gl_MeshPrimitivesEXT[iid].gl_PrimitiveID = 6; gl_MeshPrimitivesEXT[iid].gl_Layer = 7; gl_MeshPrimitivesEXT[iid].gl_ViewportIndex = 8; @@ -49,18 +42,10 @@ void main() BARRIER(); - gl_MeshPrimitivesEXT[iid+1].gl_PrimitiveID = gl_MeshPrimitivesEXT[iid].gl_PrimitiveID; - gl_MeshPrimitivesEXT[iid+1].gl_Layer = gl_MeshPrimitivesEXT[iid].gl_Layer; - gl_MeshPrimitivesEXT[iid+1].gl_ViewportIndex = gl_MeshPrimitivesEXT[iid].gl_ViewportIndex; - gl_MeshPrimitivesEXT[iid+1].gl_CullPrimitiveEXT = gl_MeshPrimitivesEXT[iid].gl_CullPrimitiveEXT; - gl_MeshPrimitivesEXT[iid+1].gl_PrimitiveShadingRateEXT = 0; - - BARRIER(); - // check bound limits gl_PrimitiveTriangleIndicesEXT[0] = uvec3(257); // should truncate 257 -> 1, range is between [0, vertexCount-1] gl_PrimitiveTriangleIndicesEXT[primitiveCount - 1] = uvec3(2); // array size is primitiveCount*3 for triangle - gl_PrimitiveTriangleIndicesEXT[gid] = gl_PrimitiveTriangleIndicesEXT[gid-1]; + gl_PrimitiveTriangleIndicesEXT[gid] = uvec3(0); BARRIER(); } @@ -73,5 +58,5 @@ void testAdditionalBuiltins() { int id = gl_DrawIDARB; // GL_ARB_shader_draw_parameters int viewIdx = gl_ViewIndex; // GL_EXT_multiview - + } \ No newline at end of file diff --git a/third_party/glslang/Test/spv.ext.meshShaderRedeclBuiltins.mesh b/third_party/glslang/Test/spv.ext.meshShaderRedeclBuiltins.mesh index 8b6703450c..32520b3926 100644 --- a/third_party/glslang/Test/spv.ext.meshShaderRedeclBuiltins.mesh +++ b/third_party/glslang/Test/spv.ext.meshShaderRedeclBuiltins.mesh @@ -46,12 +46,6 @@ void main() gl_MeshVerticesEXT[iid].gl_ClipDistance[3] = 3.0; gl_MeshVerticesEXT[iid].gl_CullDistance[2] = 4.0; - BARRIER(); - - gl_MeshVerticesEXT[iid+1].gl_Position = gl_MeshVerticesEXT[iid].gl_Position; - gl_MeshVerticesEXT[iid+1].gl_PointSize = gl_MeshVerticesEXT[iid].gl_PointSize; - gl_MeshVerticesEXT[iid+1].gl_ClipDistance[3] = gl_MeshVerticesEXT[iid].gl_ClipDistance[3]; - gl_MeshVerticesEXT[iid+1].gl_CullDistance[2] = gl_MeshVerticesEXT[iid].gl_CullDistance[2]; BARRIER(); @@ -62,13 +56,6 @@ void main() BARRIER(); - gl_MeshPrimitivesEXT[iid+1].gl_PrimitiveID = gl_MeshPrimitivesEXT[iid].gl_PrimitiveID; - gl_MeshPrimitivesEXT[iid+1].gl_Layer = gl_MeshPrimitivesEXT[iid].gl_Layer; - gl_MeshPrimitivesEXT[iid+1].gl_ViewportIndex = gl_MeshPrimitivesEXT[iid].gl_ViewportIndex; - gl_MeshPrimitivesEXT[iid+1].gl_CullPrimitiveEXT = gl_MeshPrimitivesEXT[iid].gl_CullPrimitiveEXT; - - BARRIER(); - // check bound limits gl_PrimitivePointIndicesEXT[0] = 1; gl_PrimitivePointIndicesEXT[MAX_PRIM - 1] = 2; diff --git a/third_party/glslang/Test/spv.ext.meshShaderUserDefined.mesh b/third_party/glslang/Test/spv.ext.meshShaderUserDefined.mesh index c8035e2b35..7bf5efee47 100644 --- a/third_party/glslang/Test/spv.ext.meshShaderUserDefined.mesh +++ b/third_party/glslang/Test/spv.ext.meshShaderUserDefined.mesh @@ -40,20 +40,20 @@ void main() uint gid = gl_WorkGroupID.x; blk[iid].f = 11.0; - blk[iid+1].fArr[gid] = blk[iid].f; + blk[iid+1].fArr[gid] = 11.0; blk[iid/2].pos.yzx = vec3(14.0, 15.0, 13.0); - blk[iid*2].posArr[1].yzw = blk[iid/2].pos; + blk[iid*2].posArr[1].yzw = vec3(14.0, 15.0, 13.0); blk[iid/4].m[2].wzyx = vec4(13.0, 14.0, 15.0, 16.0); - blk[iid].mArr[0][1][1] = blk[iid/4].m[2].w; + blk[iid].mArr[0][1][1] = 16.0; blk[iid*4].mArr[1][gid] = vec3(17.0, 18.0, 19.0); BARRIER(); - blk2[iid].f = blk2[iid-1].f + 20.0; + blk2[iid].f = 20.0; blk2[iid].pos = vec4(21.0, 22.0, 23.0, 24.0); - blk2[iid+1].m[gid] = blk2[iid].pos; + blk2[iid+1].m[gid] = vec4(21.0, 22.0, 23.0, 24.0); blk2[iid+1].m[gid][2] = 29.0; - blk2[iid+2].m[3] = blk2[iid+1].m[gid]; + blk2[iid+2].m[3] = vec4(21.0, 22.0, 23.0, 24.0); BARRIER(); } diff --git a/third_party/glslang/Test/spv.floate4m3_error.comp b/third_party/glslang/Test/spv.floate4m3_error.comp index 50d652da59..36eae74205 100644 --- a/third_party/glslang/Test/spv.floate4m3_error.comp +++ b/third_party/glslang/Test/spv.floate4m3_error.comp @@ -75,5 +75,9 @@ void main() saturatedConvertEXT(b, f16, f16); saturatedConvertEXT(b, f16vec2(f16)); saturatedConvertEXT(u8, u8); + + b+b; + coopmat cmA; + cmA+cmA; } diff --git a/third_party/glslang/Test/spv.floate5m2_error.comp b/third_party/glslang/Test/spv.floate5m2_error.comp index ba5c9f4084..82fc339d9d 100644 --- a/third_party/glslang/Test/spv.floate5m2_error.comp +++ b/third_party/glslang/Test/spv.floate5m2_error.comp @@ -75,5 +75,9 @@ void main() saturatedConvertEXT(b, f16, f16); saturatedConvertEXT(b, f16vec2(f16)); saturatedConvertEXT(u8, u8); + + b+b; + coopmat cmA; + cmA+cmA; } diff --git a/third_party/glslang/Test/spv.imageAtomic64.comp b/third_party/glslang/Test/spv.imageAtomic64.comp index f09abf777e..aa43a7014a 100644 --- a/third_party/glslang/Test/spv.imageAtomic64.comp +++ b/third_party/glslang/Test/spv.imageAtomic64.comp @@ -8,5 +8,5 @@ layout(set = 0, binding = 1, r64ui) uniform u64image2D z; void main() { // Test imageAtomicStore exclusively. Do NOT add other atomic operations to this test. - imageAtomicStore(z, ivec2(1, 1), y, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + imageAtomicStore(z, ivec2(1, 1), y, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); } diff --git a/third_party/glslang/Test/spv.imageAtomic64.frag b/third_party/glslang/Test/spv.imageAtomic64.frag index bd671d9856..ab1ac33d23 100644 --- a/third_party/glslang/Test/spv.imageAtomic64.frag +++ b/third_party/glslang/Test/spv.imageAtomic64.frag @@ -37,17 +37,17 @@ void main() i64 = imageAtomicExchange(i1D, i32v4.x, i64); i64 = imageAtomicCompSwap(i3D, i32v4.xyz, i64, i64 + 1); - i64 = imageAtomicAdd(i1D, i32v4.x, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - i64 = imageAtomicMin(i3D, i32v4.xyz, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - i64 = imageAtomicMax(iBuf, i32v4.x, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - i64 = imageAtomicAnd(i2DArray, i32v4.xyz, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - i64 = imageAtomicOr(i2DRect, i32v4.xy, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - i64 = imageAtomicXor(i2DMSArray, i32v4.xyz, i32v4.w, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - i64 = imageAtomicExchange(i1D, i32v4.x, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + i64 = imageAtomicAdd(i1D, i32v4.x, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + i64 = imageAtomicMin(i3D, i32v4.xyz, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + i64 = imageAtomicMax(iBuf, i32v4.x, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + i64 = imageAtomicAnd(i2DArray, i32v4.xyz, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + i64 = imageAtomicOr(i2DRect, i32v4.xy, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + i64 = imageAtomicXor(i2DMSArray, i32v4.xyz, i32v4.w, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + i64 = imageAtomicExchange(i1D, i32v4.x, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); i64 = imageAtomicCompSwap(i3D, i32v4.xyz, i64, i64 + 1, gl_ScopeDevice, - gl_StorageSemanticsImage, gl_SemanticsRelaxed, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - i64 = imageAtomicLoad(iBuf, i32v4.x, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - imageAtomicStore(i2DArray, i32v4.xyz, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + gl_StorageSemanticsImage, gl_SemanticsAcquireRelease, gl_StorageSemanticsImage, gl_SemanticsAcquire); + i64 = imageAtomicLoad(iBuf, i32v4.x, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); + imageAtomicStore(i2DArray, i32v4.xyz, i64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); u64 = imageAtomicAdd(u2D, i32v4.xy, u64); u64 = imageAtomicMin(uCube, i32v4.xyz, u64); @@ -58,17 +58,17 @@ void main() u64 = imageAtomicExchange(uCube, i32v4.xyz, u64); u64 = imageAtomicCompSwap(u1DArray, i32v4.xy, u64, u64 + 1); - u64 = imageAtomicAdd(u2D, i32v4.xy, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - u64 = imageAtomicMin(uCube, i32v4.xyz, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - u64 = imageAtomicMax(u1DArray, i32v4.xy, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - u64 = imageAtomicAnd(uCubeArray, i32v4.xyz, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - u64 = imageAtomicOr(u2DMS, i32v4.xy, i32v4.z, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - u64 = imageAtomicXor(u2D, i32v4.xy, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - u64 = imageAtomicExchange(uCube, i32v4.xyz, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + u64 = imageAtomicAdd(u2D, i32v4.xy, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + u64 = imageAtomicMin(uCube, i32v4.xyz, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + u64 = imageAtomicMax(u1DArray, i32v4.xy, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + u64 = imageAtomicAnd(uCubeArray, i32v4.xyz, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + u64 = imageAtomicOr(u2DMS, i32v4.xy, i32v4.z, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + u64 = imageAtomicXor(u2D, i32v4.xy, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); + u64 = imageAtomicExchange(uCube, i32v4.xyz, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquireRelease); u64 = imageAtomicCompSwap(u1DArray, i32v4.xy, u64, u64 + 1, gl_ScopeDevice, - gl_StorageSemanticsImage, gl_SemanticsRelaxed, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - u64 = imageAtomicLoad(uCubeArray, i32v4.xyz, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); - imageAtomicStore(u2DMS, i32v4.xy, i32v4.z, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed); + gl_StorageSemanticsImage, gl_SemanticsAcquireRelease, gl_StorageSemanticsImage, gl_SemanticsAcquire); + u64 = imageAtomicLoad(uCubeArray, i32v4.xyz, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsAcquire); + imageAtomicStore(u2DMS, i32v4.xy, i32v4.z, u64, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelease); i64v4 += imageLoad(i1D, i32v4.x); i64v4 += imageLoad(i3D, i32v4.xyz); diff --git a/third_party/glslang/Test/spv.longVector.comp b/third_party/glslang/Test/spv.longVector.comp new file mode 100644 index 0000000000..e2e517bf5a --- /dev/null +++ b/third_party/glslang/Test/spv.longVector.comp @@ -0,0 +1,103 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_nonuniform_qualifier : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer MatrixBuf { + float16_t matrixData[]; +} matrixBuf; + +layout(set = 0, binding = 0) buffer MatrixBuf2 { + int8_t matrixData[]; +} matrixBuf2; + +layout(constant_id = 0) const int matrixLayout = gl_CooperativeVectorMatrixLayoutColumnMajorNV; + +void main() +{ + vector v = vector(0.0); + + vec3 x = vec3(1.0), y = vec3(2.0); + vector v2 = vector(x, y); + + const vec3 x2 = vec3(1.0), y2 = vec3(2.0); + vector v3 = vector(x2, y2); + + vec3 x3 = vec3(4, 5, 6), y3 = vec3(7, 8, 9); + + vector v4 = vector(x3.zyx, y3.zzy); + + vector v5 = vector(v4); + + vector v6; + + v6 = v + v2; + v6 = v - v2; + v6 = v * v2; + v6 = v / v2; + + v6 += v; + v6 -= v; + v6 *= v; + v6 /= v; + + float f; + v6 *= f; + v6 *= 5.0; + + int len = v6.length(); + + v6[0] = f; + v6[4] = 5.0; + + f += (v += v)[4]; + v6 = v; + + vector v7; + vector f162 = vector(v7.length()); + + float16_t f16; + vector f161 = vector(f16); + + vector v11, v12, v13; + + v11 = max(v11, v12); + v11 = min(v11, v12); + v11 = step(v11, v12); + v11 = clamp(v11, v12, v13); + v11 = exp(v11); + v11 = log(v11); + v11 = tanh(v11); + v11 = atan(v11); + v11 = fma(v11, v12, v13); + + f += (v += v)[len]; + + v13 = vector(v13); + f16 = float16_t(v13); + vector vecA; + vecA = exp(vecA * vector(0.0625)); + +} + +vector foo(vector x) { return x; } +vector foo(vector x) { return x; } + +vec4 funcvec4(vec4 a) { return a; } +vector funcvector4(vector a) { return a; } + +void testfuncs() +{ + vec4 a; + vector b; + a = b; + b = a; + funcvec4(b); + funcvector4(a); + vector x; + x = foo(x); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltins.comp b/third_party/glslang/Test/spv.longVectorBuiltins.comp new file mode 100644 index 0000000000..edb69c9704 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltins.comp @@ -0,0 +1,128 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vf; + float f; + vector vu; + uint32_t u; + vector vi; + int32_t i; + vector vf16; + float16_t f16; + vector vb; + bool b; + + vf = max(vf, vf); + vf = smoothstep(f, f, vf); + vf = smoothstep(vf, vf, vf); + + vf16 = smoothstep(vf16, vf16, vf16); + + // 8.1 + vf = radians(vf); + vf = degrees(vf); + vf = sin(vf); + vf = cos(vf); + vf = tan(vf); + vf = asin(vf); + vf = acos(vf); + vf = atan(vf); + vf = atan(vf, vf); + vf = sinh(vf); + vf = cosh(vf); + vf = tanh(vf); + vf = asinh(vf); + vf = acosh(vf); + vf = atanh(vf); + + // 8.2 + vf = pow(vf, vf); + vf = exp(vf); + vf = log(vf); + vf = exp2(vf); + vf = log2(vf); + vf = sqrt(vf); + vf = inversesqrt(vf); + + // 8.3 + vf = abs(vf); + vf = sign(vf); + vf = floor(vf); + vf = trunc(vf); + vf = round(vf); + vf = roundEven(vf); + vf = ceil(vf); + vf = fract(vf); + vf = mod(vf, f); + vf = mod(vf, vf); + vf = modf(vf, vf); + vf = min(vf, f); + vf = min(vf, vf); + vf = max(vf, f); + vf = max(vf, vf); + vf = clamp(vf, f, f); + vf = clamp(vf, vf, vf); + vf = mix(vf, vf, f); + vf = mix(vf, vf, vf); + vf = mix(vf, vf, vb); + vf = step(vf, vf); + vf = step(f, vf); + vf = smoothstep(vf, vf, vf); + vf = smoothstep(f, f, vf); + vb = isnan(vf); + vb = isinf(vf); + vi = floatBitsToInt(vf); + vu = floatBitsToUint(vf); + vf = intBitsToFloat(vi); + vf = uintBitsToFloat(vu); + vf = fma(vf, vf, vf); + vf = frexp(vf, vi); + vf = ldexp(vf, vi); + + // 8.5 + f = length(vf); + f = distance(vf, vf); + f = dot(vf, vf); + vf = normalize(vf); + vf = faceforward(vf, vf, vf); + vf = reflect(vf, vf); + vf = refract(vf, vf, f); + + // 8.7 + vb = lessThan(vf, vf); + vb = lessThanEqual(vf, vf); + vb = greaterThan(vf, vf); + vb = greaterThanEqual(vf, vf); + vb = equal(vf, vf); + vb = notEqual(vf, vf); + b = any(vb); + b = all(vb); + vb = not(vb); + + // 8.8 + vu = uaddCarry(vu, vu, vu); + vu = usubBorrow(vu, vu, vu); + umulExtended(vu, vu, vu, vu); + imulExtended(vi, vi, vi, vi); + vu = bitfieldExtract(vu, i, i); + vu = bitfieldInsert(vu, vu, i, i); + vu = bitfieldReverse(vu); + vi = bitCount(vu); + vi = findLSB(vu); + vi = findMSB(vu); + + // GL_EXT_shader_integer_mix + vu = mix(vu, vu, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vu = expectEXT(vu, vu); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltins.frag b/third_party/glslang/Test/spv.longVectorBuiltins.frag new file mode 100644 index 0000000000..2856096345 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltins.frag @@ -0,0 +1,30 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable + +void main() +{ + vector vf; + float f; + vector vu; + uint32_t u; + vector vi; + int32_t i; + vector vf16; + float16_t f16; + vector vb; + bool b; + + // 8.14 + vf = dFdx(vf); + vf = dFdy(vf); + vf = fwidth(vf); + vf = dFdxFine(vf); + vf = dFdyFine(vf); + vf = fwidthFine(vf); + vf = dFdxCoarse(vf); + vf = dFdyCoarse(vf); + vf = fwidthCoarse(vf); +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsBitcast.comp b/third_party/glslang/Test/spv.longVectorBuiltinsBitcast.comp new file mode 100644 index 0000000000..c60e792123 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsBitcast.comp @@ -0,0 +1,67 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable +#extension GL_EXT_bfloat16 : enable +#extension GL_EXT_float_e5m2 : enable +#extension GL_EXT_float_e4m3 : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vbf16; + vector vf16; + vector vf32; + vector vf64; + vector vu16; + vector vi16; + vector vu32; + vector vi32; + vector vu64; + vector vi64; + vector vfe5m2; + vector vfe4m3; + vector vi8; + vector vu8; + + vi16 = halfBitsToInt16(vf16); + vu16 = halfBitsToUint16(vf16); + vf16 = int16BitsToHalf(vi16); + vf16 = uint16BitsToHalf(vu16); + + vi16 = float16BitsToInt16(vf16); + vu16 = float16BitsToUint16(vf16); + vf16 = int16BitsToFloat16(vi16); + vf16 = uint16BitsToFloat16(vu16); + + vi16 = bfloat16BitsToIntEXT(vbf16); + vu16 = bfloat16BitsToUintEXT(vbf16); + vbf16 = intBitsToBFloat16EXT(vi16); + vbf16 = uintBitsToBFloat16EXT(vu16); + + vi32 = floatBitsToInt(vf32); + vu32 = floatBitsToUint(vf32); + vf32 = intBitsToFloat(vi32); + vf32 = uintBitsToFloat(vu32); + + vi64 = doubleBitsToInt64(vf64); + vu64 = doubleBitsToUint64(vf64); + vf64 = int64BitsToDouble(vi64); + vf64 = uint64BitsToDouble(vu64); + + vi8 = floate5m2BitsToIntEXT(vfe5m2); + vu8 = floate5m2BitsToUintEXT(vfe5m2); + vfe5m2 = intBitsToFloate5m2EXT(vi8); + vfe5m2 = uintBitsToFloate5m2EXT(vu8); + + vi8 = floate4m3BitsToIntEXT(vfe4m3); + vu8 = floate4m3BitsToUintEXT(vfe4m3); + vfe4m3 = intBitsToFloate4m3EXT(vi8); + vfe4m3 = uintBitsToFloate4m3EXT(vu8); + + saturatedConvertEXT(vfe5m2, vf16); + saturatedConvertEXT(vfe4m3, vf32); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsError.comp b/third_party/glslang/Test/spv.longVectorBuiltinsError.comp new file mode 100644 index 0000000000..5bf421ad06 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsError.comp @@ -0,0 +1,38 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const uint32_t c0 = 0; + +void main() +{ + vector vf; + float f; + vector vu; + uint32_t u; + vector vi; + int32_t i; + vector vf16; + float16_t f16; + vector vb; + bool b; + vector vf64; + vector vuc; + + vf = max(vf, vu); + vu = max(vu, vector(0)); + vu = max(vu, i); + vu = max(vu, f); + vf = smoothstep(f, f16, vf); + vf64 = radians(vf64); + vf64 = sin(vf64); + vf64 = atanh(vf64); + vu = abs(vu); + vu = max(vu, vector(0)); + vu = max(vu, vuc); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsSpecConst.comp b/third_party/glslang/Test/spv.longVectorBuiltinsSpecConst.comp new file mode 100644 index 0000000000..5935a5386d --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsSpecConst.comp @@ -0,0 +1,130 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const uint32_t c0 = 0; + +void main() +{ + vector vf; + float f; + vector vu; + uint32_t u; + vector vi; + int32_t i; + vector vf16; + float16_t f16; + vector vb; + bool b; + + vf = max(vf, vf); + vf = smoothstep(f, f, vf); + vf = smoothstep(vf, vf, vf); + + vf16 = smoothstep(vf16, vf16, vf16); + + // 8.1 + vf = radians(vf); + vf = degrees(vf); + vf = sin(vf); + vf = cos(vf); + vf = tan(vf); + vf = asin(vf); + vf = acos(vf); + vf = atan(vf); + vf = atan(vf, vf); + vf = sinh(vf); + vf = cosh(vf); + vf = tanh(vf); + vf = asinh(vf); + vf = acosh(vf); + vf = atanh(vf); + + // 8.2 + vf = pow(vf, vf); + vf = exp(vf); + vf = log(vf); + vf = exp2(vf); + vf = log2(vf); + vf = sqrt(vf); + vf = inversesqrt(vf); + + // 8.3 + vf = abs(vf); + vf = sign(vf); + vf = floor(vf); + vf = trunc(vf); + vf = round(vf); + vf = roundEven(vf); + vf = ceil(vf); + vf = fract(vf); + vf = mod(vf, f); + vf = mod(vf, vf); + vf = modf(vf, vf); + vf = min(vf, f); + vf = min(vf, vf); + vf = max(vf, f); + vf = max(vf, vf); + vf = clamp(vf, f, f); + vf = clamp(vf, vf, vf); + vf = mix(vf, vf, f); + vf = mix(vf, vf, vf); + vf = mix(vf, vf, vb); + vf = step(vf, vf); + vf = step(f, vf); + vf = smoothstep(vf, vf, vf); + vf = smoothstep(f, f, vf); + vb = isnan(vf); + vb = isinf(vf); + vi = floatBitsToInt(vf); + vu = floatBitsToUint(vf); + vf = intBitsToFloat(vi); + vf = uintBitsToFloat(vu); + vf = fma(vf, vf, vf); + vf = frexp(vf, vi); + vf = ldexp(vf, vi); + + // 8.5 + f = length(vf); + f = distance(vf, vf); + f = dot(vf, vf); + vf = normalize(vf); + vf = faceforward(vf, vf, vf); + vf = reflect(vf, vf); + vf = refract(vf, vf, f); + + // 8.7 + vb = lessThan(vf, vf); + vb = lessThanEqual(vf, vf); + vb = greaterThan(vf, vf); + vb = greaterThanEqual(vf, vf); + vb = equal(vf, vf); + vb = notEqual(vf, vf); + b = any(vb); + b = all(vb); + vb = not(vb); + + // 8.8 + vu = uaddCarry(vu, vu, vu); + vu = usubBorrow(vu, vu, vu); + umulExtended(vu, vu, vu, vu); + imulExtended(vi, vi, vi, vi); + vu = bitfieldExtract(vu, i, i); + vu = bitfieldInsert(vu, vu, i, i); + vu = bitfieldReverse(vu); + vi = bitCount(vu); + vi = findLSB(vu); + vi = findMSB(vu); + + // GL_EXT_shader_integer_mix + vu = mix(vu, vu, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vu = expectEXT(vu, vu); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsSpecConstint32.comp b/third_party/glslang/Test/spv.longVectorBuiltinsSpecConstint32.comp new file mode 100644 index 0000000000..1d78685362 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsSpecConstint32.comp @@ -0,0 +1,61 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const uint32_t c0 = 0; + +void main() +{ + vector vi; + int32_t i; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vi = abs(vi); + //vi = sign(vi); + vi = min(vi, i); + vi = min(vi, vi); + vi = max(vi, i); + vi = max(vi, vi); + vi = clamp(vi, i, i); + vi = clamp(vi, vi, vi); + vi = mix(vi, vi, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vi, vi); + vb = lessThanEqual(vi, vi); + vb = greaterThan(vi, vi); + vb = greaterThanEqual(vi, vi); + vb = equal(vi, vi); + vb = notEqual(vi, vi); + + // 8.8 + //vi = uaddCarry(vi, vi, vi); + //vi = usubBorrow(vi, vi, vi); + imulExtended(vi, vi, vi, vi); + vi = bitfieldExtract(vi, i, i); + vi = bitfieldInsert(vi, vi, i, i); + vi = bitfieldReverse(vi); + vi = bitCount(vi); + vi = findLSB(vi); + vi = findMSB(vi); + + // GL_EXT_shader_integer_mix + vi = mix(vi, vi, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vi = expectEXT(vi, vi); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsSubgroup.comp b/third_party/glslang/Test/spv.longVectorBuiltinsSubgroup.comp new file mode 100644 index 0000000000..1c1d706315 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsSubgroup.comp @@ -0,0 +1,361 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable +#extension GL_EXT_bfloat16 : enable +#extension GL_KHR_shader_subgroup_arithmetic : enable +#extension GL_KHR_shader_subgroup_clustered : enable +#extension GL_NV_shader_subgroup_partitioned : enable +#extension GL_KHR_shader_subgroup_quad : enable +#extension GL_KHR_shader_subgroup_shuffle : enable +#extension GL_KHR_shader_subgroup_shuffle_relative : enable +#extension GL_KHR_shader_subgroup_rotate : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_shader_subgroup_extended_types_int64 : enable + + + + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vf16; + vector vf32; + vector vf64; + vector vu16; + vector vi16; + vector vu32; + vector vi32; + vector vu64; + vector vi64; + vector vb; + + bool b; + uint u; + uvec4 vu4; + + b = subgroupAllEqual(vu32); + vu32 = subgroupBroadcast(vu32, 1u); + vu32 = subgroupBroadcastFirst(vu32); + vu32 = subgroupShuffle(vu32, u); + vu32 = subgroupShuffleXor(vu32, u); + vu32 = subgroupShuffleUp(vu32, u); + vu32 = subgroupShuffleDown(vu32, u); + vu32 = subgroupRotate(vu32, u); + vu32 = subgroupClusteredRotate(vu32, u, 4); + vu32 = subgroupAdd(vu32); + vu32 = subgroupMul(vu32); + vu32 = subgroupMin(vu32); + vu32 = subgroupMax(vu32); + vu32 = subgroupAnd(vu32); + vu32 = subgroupOr(vu32); + vu32 = subgroupXor(vu32); + vu32 = subgroupInclusiveAdd(vu32); + vu32 = subgroupInclusiveMul(vu32); + vu32 = subgroupInclusiveMin(vu32); + vu32 = subgroupInclusiveMax(vu32); + vu32 = subgroupInclusiveAnd(vu32); + vu32 = subgroupInclusiveOr(vu32); + vu32 = subgroupInclusiveXor(vu32); + vu32 = subgroupExclusiveAdd(vu32); + vu32 = subgroupExclusiveMul(vu32); + vu32 = subgroupExclusiveMin(vu32); + vu32 = subgroupExclusiveMax(vu32); + vu32 = subgroupExclusiveAnd(vu32); + vu32 = subgroupExclusiveOr(vu32); + vu32 = subgroupExclusiveXor(vu32); + vu32 = subgroupClusteredAdd(vu32, 4); + vu32 = subgroupClusteredMul(vu32, 4); + vu32 = subgroupClusteredMin(vu32, 4); + vu32 = subgroupClusteredMax(vu32, 4); + vu32 = subgroupClusteredAnd(vu32, 4); + vu32 = subgroupClusteredOr(vu32, 4); + vu32 = subgroupClusteredXor(vu32, 4); + vu32 = subgroupQuadBroadcast(vu32, 1); + vu32 = subgroupQuadSwapHorizontal(vu32); + vu32 = subgroupQuadSwapVertical(vu32); + vu32 = subgroupQuadSwapDiagonal(vu32); + vu4 = subgroupPartitionNV(vu32); + vu32 = subgroupPartitionedAddNV(vu32, vu4); + vu32 = subgroupPartitionedMulNV(vu32, vu4); + vu32 = subgroupPartitionedMinNV(vu32, vu4); + vu32 = subgroupPartitionedMaxNV(vu32, vu4); + vu32 = subgroupPartitionedAndNV(vu32, vu4); + vu32 = subgroupPartitionedOrNV(vu32, vu4); + vu32 = subgroupPartitionedXorNV(vu32, vu4); + vu32 = subgroupPartitionedInclusiveAddNV(vu32, vu4); + vu32 = subgroupPartitionedInclusiveMulNV(vu32, vu4); + vu32 = subgroupPartitionedInclusiveMinNV(vu32, vu4); + vu32 = subgroupPartitionedInclusiveMaxNV(vu32, vu4); + vu32 = subgroupPartitionedInclusiveAndNV(vu32, vu4); + vu32 = subgroupPartitionedInclusiveOrNV(vu32, vu4); + vu32 = subgroupPartitionedInclusiveXorNV(vu32, vu4); + vu32 = subgroupPartitionedExclusiveAddNV(vu32, vu4); + vu32 = subgroupPartitionedExclusiveMulNV(vu32, vu4); + vu32 = subgroupPartitionedExclusiveMinNV(vu32, vu4); + vu32 = subgroupPartitionedExclusiveMaxNV(vu32, vu4); + vu32 = subgroupPartitionedExclusiveAndNV(vu32, vu4); + vu32 = subgroupPartitionedExclusiveOrNV(vu32, vu4); + vu32 = subgroupPartitionedExclusiveXorNV(vu32, vu4); + + b = subgroupAllEqual(vf32); + vf32 = subgroupBroadcast(vf32, 1u); + vf32 = subgroupBroadcastFirst(vf32); + vf32 = subgroupShuffle(vf32, u); + vf32 = subgroupShuffleXor(vf32, u); + vf32 = subgroupShuffleUp(vf32, u); + vf32 = subgroupShuffleDown(vf32, u); + vf32 = subgroupRotate(vf32, u); + vf32 = subgroupClusteredRotate(vf32, u, 4); + vf32 = subgroupAdd(vf32); + vf32 = subgroupMul(vf32); + vf32 = subgroupMin(vf32); + vf32 = subgroupMax(vf32); + //vf32 = subgroupAnd(vf32); + //vf32 = subgroupOr(vf32); + //vf32 = subgroupXor(vf32); + vf32 = subgroupInclusiveAdd(vf32); + vf32 = subgroupInclusiveMul(vf32); + vf32 = subgroupInclusiveMin(vf32); + vf32 = subgroupInclusiveMax(vf32); + //vf32 = subgroupInclusiveAnd(vf32); + //vf32 = subgroupInclusiveOr(vf32); + //vf32 = subgroupInclusiveXor(vf32); + vf32 = subgroupExclusiveAdd(vf32); + vf32 = subgroupExclusiveMul(vf32); + vf32 = subgroupExclusiveMin(vf32); + vf32 = subgroupExclusiveMax(vf32); + //vf32 = subgroupExclusiveAnd(vf32); + //vf32 = subgroupExclusiveOr(vf32); + //vf32 = subgroupExclusiveXor(vf32); + vf32 = subgroupClusteredAdd(vf32, 4); + vf32 = subgroupClusteredMul(vf32, 4); + vf32 = subgroupClusteredMin(vf32, 4); + vf32 = subgroupClusteredMax(vf32, 4); + //vf32 = subgroupClusteredAnd(vf32, 4); + //vf32 = subgroupClusteredOr(vf32, 4); + //vf32 = subgroupClusteredXor(vf32, 4); + vf32 = subgroupQuadBroadcast(vf32, 1); + vf32 = subgroupQuadSwapHorizontal(vf32); + vf32 = subgroupQuadSwapVertical(vf32); + vf32 = subgroupQuadSwapDiagonal(vf32); + vu4 = subgroupPartitionNV(vf32); + vf32 = subgroupPartitionedAddNV(vf32, vu4); + vf32 = subgroupPartitionedMulNV(vf32, vu4); + vf32 = subgroupPartitionedMinNV(vf32, vu4); + vf32 = subgroupPartitionedMaxNV(vf32, vu4); + //vf32 = subgroupPartitionedAndNV(vf32, vu4); + //vf32 = subgroupPartitionedOrNV(vf32, vu4); + //vf32 = subgroupPartitionedXorNV(vf32, vu4); + vf32 = subgroupPartitionedInclusiveAddNV(vf32, vu4); + vf32 = subgroupPartitionedInclusiveMulNV(vf32, vu4); + vf32 = subgroupPartitionedInclusiveMinNV(vf32, vu4); + vf32 = subgroupPartitionedInclusiveMaxNV(vf32, vu4); + //vf32 = subgroupPartitionedInclusiveAndNV(vf32, vu4); + //vf32 = subgroupPartitionedInclusiveOrNV(vf32, vu4); + //vf32 = subgroupPartitionedInclusiveXorNV(vf32, vu4); + vf32 = subgroupPartitionedExclusiveAddNV(vf32, vu4); + vf32 = subgroupPartitionedExclusiveMulNV(vf32, vu4); + vf32 = subgroupPartitionedExclusiveMinNV(vf32, vu4); + vf32 = subgroupPartitionedExclusiveMaxNV(vf32, vu4); + //vf32 = subgroupPartitionedExclusiveAndNV(vf32, vu4); + //vf32 = subgroupPartitionedExclusiveOrNV(vf32, vu4); + //vf32 = subgroupPartitionedExclusiveXorNV(vf32, vu4); + + b = subgroupAllEqual(vf64); + vf64 = subgroupBroadcast(vf64, 1u); + vf64 = subgroupBroadcastFirst(vf64); + vf64 = subgroupShuffle(vf64, u); + vf64 = subgroupShuffleXor(vf64, u); + vf64 = subgroupShuffleUp(vf64, u); + vf64 = subgroupShuffleDown(vf64, u); + vf64 = subgroupRotate(vf64, u); + vf64 = subgroupClusteredRotate(vf64, u, 4); + vf64 = subgroupAdd(vf64); + vf64 = subgroupMul(vf64); + vf64 = subgroupMin(vf64); + vf64 = subgroupMax(vf64); + //vf64 = subgroupAnd(vf64); + //vf64 = subgroupOr(vf64); + //vf64 = subgroupXor(vf64); + vf64 = subgroupInclusiveAdd(vf64); + vf64 = subgroupInclusiveMul(vf64); + vf64 = subgroupInclusiveMin(vf64); + vf64 = subgroupInclusiveMax(vf64); + //vf64 = subgroupInclusiveAnd(vf64); + //vf64 = subgroupInclusiveOr(vf64); + //vf64 = subgroupInclusiveXor(vf64); + vf64 = subgroupExclusiveAdd(vf64); + vf64 = subgroupExclusiveMul(vf64); + vf64 = subgroupExclusiveMin(vf64); + vf64 = subgroupExclusiveMax(vf64); + //vf64 = subgroupExclusiveAnd(vf64); + //vf64 = subgroupExclusiveOr(vf64); + //vf64 = subgroupExclusiveXor(vf64); + vf64 = subgroupClusteredAdd(vf64, 4); + vf64 = subgroupClusteredMul(vf64, 4); + vf64 = subgroupClusteredMin(vf64, 4); + vf64 = subgroupClusteredMax(vf64, 4); + //vf64 = subgroupClusteredAnd(vf64, 4); + //vf64 = subgroupClusteredOr(vf64, 4); + //vf64 = subgroupClusteredXor(vf64, 4); + vf64 = subgroupQuadBroadcast(vf64, 1); + vf64 = subgroupQuadSwapHorizontal(vf64); + vf64 = subgroupQuadSwapVertical(vf64); + vf64 = subgroupQuadSwapDiagonal(vf64); + vu4 = subgroupPartitionNV(vf64); + vf64 = subgroupPartitionedAddNV(vf64, vu4); + vf64 = subgroupPartitionedMulNV(vf64, vu4); + vf64 = subgroupPartitionedMinNV(vf64, vu4); + vf64 = subgroupPartitionedMaxNV(vf64, vu4); + //vf64 = subgroupPartitionedAndNV(vf64, vu4); + //vf64 = subgroupPartitionedOrNV(vf64, vu4); + //vf64 = subgroupPartitionedXorNV(vf64, vu4); + vf64 = subgroupPartitionedInclusiveAddNV(vf64, vu4); + vf64 = subgroupPartitionedInclusiveMulNV(vf64, vu4); + vf64 = subgroupPartitionedInclusiveMinNV(vf64, vu4); + vf64 = subgroupPartitionedInclusiveMaxNV(vf64, vu4); + //vf64 = subgroupPartitionedInclusiveAndNV(vf64, vu4); + //vf64 = subgroupPartitionedInclusiveOrNV(vf64, vu4); + //vf64 = subgroupPartitionedInclusiveXorNV(vf64, vu4); + vf64 = subgroupPartitionedExclusiveAddNV(vf64, vu4); + vf64 = subgroupPartitionedExclusiveMulNV(vf64, vu4); + vf64 = subgroupPartitionedExclusiveMinNV(vf64, vu4); + vf64 = subgroupPartitionedExclusiveMaxNV(vf64, vu4); + //vf64 = subgroupPartitionedExclusiveAndNV(vf64, vu4); + //vf64 = subgroupPartitionedExclusiveOrNV(vf64, vu4); + //vf64 = subgroupPartitionedExclusiveXorNV(vf64, vu4); + + b = subgroupAllEqual(vb); + vb = subgroupBroadcast(vb, 1u); + vb = subgroupBroadcastFirst(vb); + vb = subgroupShuffle(vb, u); + vb = subgroupShuffleXor(vb, u); + vb = subgroupShuffleUp(vb, u); + vb = subgroupShuffleDown(vb, u); + vb = subgroupRotate(vb, u); + vb = subgroupClusteredRotate(vb, u, 4); + //vb = subgroupAdd(vb); + //vb = subgroupMul(vb); + //vb = subgroupMin(vb); + //vb = subgroupMax(vb); + vb = subgroupAnd(vb); + vb = subgroupOr(vb); + vb = subgroupXor(vb); + //vb = subgroupInclusiveAdd(vb); + //vb = subgroupInclusiveMul(vb); + //vb = subgroupInclusiveMin(vb); + //vb = subgroupInclusiveMax(vb); + vb = subgroupInclusiveAnd(vb); + vb = subgroupInclusiveOr(vb); + vb = subgroupInclusiveXor(vb); + //vb = subgroupExclusiveAdd(vb); + //vb = subgroupExclusiveMul(vb); + //vb = subgroupExclusiveMin(vb); + //vb = subgroupExclusiveMax(vb); + vb = subgroupExclusiveAnd(vb); + vb = subgroupExclusiveOr(vb); + vb = subgroupExclusiveXor(vb); + //vb = subgroupClusteredAdd(vb, 4); + //vb = subgroupClusteredMul(vb, 4); + //vb = subgroupClusteredMin(vb, 4); + //vb = subgroupClusteredMax(vb, 4); + vb = subgroupClusteredAnd(vb, 4); + vb = subgroupClusteredOr(vb, 4); + vb = subgroupClusteredXor(vb, 4); + vb = subgroupQuadBroadcast(vb, 1); + vb = subgroupQuadSwapHorizontal(vb); + vb = subgroupQuadSwapVertical(vb); + vb = subgroupQuadSwapDiagonal(vb); + vu4 = subgroupPartitionNV(vb); + //vb = subgroupPartitionedAddNV(vb, vu4); + //vb = subgroupPartitionedMulNV(vb, vu4); + //vb = subgroupPartitionedMinNV(vb, vu4); + //vb = subgroupPartitionedMaxNV(vb, vu4); + vb = subgroupPartitionedAndNV(vb, vu4); + vb = subgroupPartitionedOrNV(vb, vu4); + vb = subgroupPartitionedXorNV(vb, vu4); + //vb = subgroupPartitionedInclusiveAddNV(vb, vu4); + //vb = subgroupPartitionedInclusiveMulNV(vb, vu4); + //vb = subgroupPartitionedInclusiveMinNV(vb, vu4); + //vb = subgroupPartitionedInclusiveMaxNV(vb, vu4); + vb = subgroupPartitionedInclusiveAndNV(vb, vu4); + vb = subgroupPartitionedInclusiveOrNV(vb, vu4); + vb = subgroupPartitionedInclusiveXorNV(vb, vu4); + //vb = subgroupPartitionedExclusiveAddNV(vb, vu4); + //vb = subgroupPartitionedExclusiveMulNV(vb, vu4); + //vb = subgroupPartitionedExclusiveMinNV(vb, vu4); + //vb = subgroupPartitionedExclusiveMaxNV(vb, vu4); + vb = subgroupPartitionedExclusiveAndNV(vb, vu4); + vb = subgroupPartitionedExclusiveOrNV(vb, vu4); + vb = subgroupPartitionedExclusiveXorNV(vb, vu4); + + b = subgroupAllEqual(vu64); + vu64 = subgroupBroadcast(vu64, 1u); + vu64 = subgroupBroadcastFirst(vu64); + vu64 = subgroupShuffle(vu64, u); + vu64 = subgroupShuffleXor(vu64, u); + vu64 = subgroupShuffleUp(vu64, u); + vu64 = subgroupShuffleDown(vu64, u); + vu64 = subgroupRotate(vu64, u); + vu64 = subgroupClusteredRotate(vu64, u, 4); + vu64 = subgroupAdd(vu64); + vu64 = subgroupMul(vu64); + vu64 = subgroupMin(vu64); + vu64 = subgroupMax(vu64); + vu64 = subgroupAnd(vu64); + vu64 = subgroupOr(vu64); + vu64 = subgroupXor(vu64); + vu64 = subgroupInclusiveAdd(vu64); + vu64 = subgroupInclusiveMul(vu64); + vu64 = subgroupInclusiveMin(vu64); + vu64 = subgroupInclusiveMax(vu64); + vu64 = subgroupInclusiveAnd(vu64); + vu64 = subgroupInclusiveOr(vu64); + vu64 = subgroupInclusiveXor(vu64); + vu64 = subgroupExclusiveAdd(vu64); + vu64 = subgroupExclusiveMul(vu64); + vu64 = subgroupExclusiveMin(vu64); + vu64 = subgroupExclusiveMax(vu64); + vu64 = subgroupExclusiveAnd(vu64); + vu64 = subgroupExclusiveOr(vu64); + vu64 = subgroupExclusiveXor(vu64); + vu64 = subgroupClusteredAdd(vu64, 4); + vu64 = subgroupClusteredMul(vu64, 4); + vu64 = subgroupClusteredMin(vu64, 4); + vu64 = subgroupClusteredMax(vu64, 4); + vu64 = subgroupClusteredAnd(vu64, 4); + vu64 = subgroupClusteredOr(vu64, 4); + vu64 = subgroupClusteredXor(vu64, 4); + vu64 = subgroupQuadBroadcast(vu64, 1); + vu64 = subgroupQuadSwapHorizontal(vu64); + vu64 = subgroupQuadSwapVertical(vu64); + vu64 = subgroupQuadSwapDiagonal(vu64); + vu4 = subgroupPartitionNV(vu64); + vu64 = subgroupPartitionedAddNV(vu64, vu4); + vu64 = subgroupPartitionedMulNV(vu64, vu4); + vu64 = subgroupPartitionedMinNV(vu64, vu4); + vu64 = subgroupPartitionedMaxNV(vu64, vu4); + vu64 = subgroupPartitionedAndNV(vu64, vu4); + vu64 = subgroupPartitionedOrNV(vu64, vu4); + vu64 = subgroupPartitionedXorNV(vu64, vu4); + vu64 = subgroupPartitionedInclusiveAddNV(vu64, vu4); + vu64 = subgroupPartitionedInclusiveMulNV(vu64, vu4); + vu64 = subgroupPartitionedInclusiveMinNV(vu64, vu4); + vu64 = subgroupPartitionedInclusiveMaxNV(vu64, vu4); + vu64 = subgroupPartitionedInclusiveAndNV(vu64, vu4); + vu64 = subgroupPartitionedInclusiveOrNV(vu64, vu4); + vu64 = subgroupPartitionedInclusiveXorNV(vu64, vu4); + vu64 = subgroupPartitionedExclusiveAddNV(vu64, vu4); + vu64 = subgroupPartitionedExclusiveMulNV(vu64, vu4); + vu64 = subgroupPartitionedExclusiveMinNV(vu64, vu4); + vu64 = subgroupPartitionedExclusiveMaxNV(vu64, vu4); + vu64 = subgroupPartitionedExclusiveAndNV(vu64, vu4); + vu64 = subgroupPartitionedExclusiveOrNV(vu64, vu4); + vu64 = subgroupPartitionedExclusiveXorNV(vu64, vu4); + +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsfp16.comp b/third_party/glslang/Test/spv.longVectorBuiltinsfp16.comp new file mode 100644 index 0000000000..301c8f492f --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsfp16.comp @@ -0,0 +1,100 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vf; + float16_t f; + vector vi; + vector vb; + bool b; + + // 8.1 + vf = radians(vf); + vf = degrees(vf); + vf = sin(vf); + vf = cos(vf); + vf = tan(vf); + vf = asin(vf); + vf = acos(vf); + vf = atan(vf); + vf = atan(vf, vf); + vf = sinh(vf); + vf = cosh(vf); + vf = tanh(vf); + vf = asinh(vf); + vf = acosh(vf); + vf = atanh(vf); + + // 8.2 + vf = pow(vf, vf); + vf = exp(vf); + vf = log(vf); + vf = exp2(vf); + vf = log2(vf); + vf = sqrt(vf); + vf = inversesqrt(vf); + + // 8.3 + vf = abs(vf); + vf = sign(vf); + vf = floor(vf); + vf = trunc(vf); + vf = round(vf); + vf = roundEven(vf); + vf = ceil(vf); + vf = fract(vf); + vf = mod(vf, f); + vf = mod(vf, vf); + vf = modf(vf, vf); + vf = min(vf, f); + vf = min(vf, vf); + vf = max(vf, f); + vf = max(vf, vf); + vf = clamp(vf, f, f); + vf = clamp(vf, vf, vf); + vf = mix(vf, vf, f); + vf = mix(vf, vf, vf); + vf = mix(vf, vf, vb); + vf = step(vf, vf); + vf = step(f, vf); + vf = smoothstep(vf, vf, vf); + vf = smoothstep(f, f, vf); + vb = isnan(vf); + vb = isinf(vf); + vf = fma(vf, vf, vf); + vf = frexp(vf, vi); + vf = ldexp(vf, vi); + + // 8.5 + f = length(vf); + f = distance(vf, vf); + f = dot(vf, vf); + vf = normalize(vf); + vf = faceforward(vf, vf, vf); + vf = reflect(vf, vf); + vf = refract(vf, vf, f); + + // 8.7 + vb = lessThan(vf, vf); + vb = lessThanEqual(vf, vf); + vb = greaterThan(vf, vf); + vb = greaterThanEqual(vf, vf); + vb = equal(vf, vf); + vb = notEqual(vf, vf); + b = any(vb); + b = all(vb); + vb = not(vb); + + // 8.8 + + // GL_EXT_shader_integer_mix + + // GL_EXT_expect_assume +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsfp64.comp b/third_party/glslang/Test/spv.longVectorBuiltinsfp64.comp new file mode 100644 index 0000000000..946e8e4f4e --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsfp64.comp @@ -0,0 +1,77 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vf; + float64_t f; + vector vu; + vector vi; + vector vi32; + vector vb; + bool b; + + // 8.1 + + // 8.2 + vf = sqrt(vf); + vf = inversesqrt(vf); + + // 8.3 + vf = abs(vf); + vf = sign(vf); + vf = floor(vf); + vf = trunc(vf); + vf = round(vf); + vf = roundEven(vf); + vf = ceil(vf); + vf = fract(vf); + vf = mod(vf, f); + vf = mod(vf, vf); + vf = modf(vf, vf); + vf = min(vf, f); + vf = min(vf, vf); + vf = max(vf, f); + vf = max(vf, vf); + vf = clamp(vf, f, f); + vf = clamp(vf, vf, vf); + vf = mix(vf, vf, f); + vf = mix(vf, vf, vf); + vf = mix(vf, vf, vb); + vf = step(vf, vf); + vf = step(f, vf); + vf = smoothstep(vf, vf, vf); + vf = smoothstep(f, f, vf); + vb = isnan(vf); + vb = isinf(vf); + vi = doubleBitsToInt64(vf); + vu = doubleBitsToUint64(vf); + vf = int64BitsToDouble(vi); + vf = uint64BitsToDouble(vu); + vf = fma(vf, vf, vf); + vf = frexp(vf, vi32); + vf = ldexp(vf, vi32); + + // 8.5 + f = length(vf); + f = distance(vf, vf); + f = dot(vf, vf); + vf = normalize(vf); + vf = faceforward(vf, vf, vf); + vf = reflect(vf, vf); + vf = refract(vf, vf, f); + + // 8.7 + vb = lessThan(vf, vf); + vb = lessThanEqual(vf, vf); + vb = greaterThan(vf, vf); + vb = greaterThanEqual(vf, vf); + vb = equal(vf, vf); + vb = notEqual(vf, vf); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsint16.comp b/third_party/glslang/Test/spv.longVectorBuiltinsint16.comp new file mode 100644 index 0000000000..422664f2e1 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsint16.comp @@ -0,0 +1,59 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vi; + int16_t i; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vi = abs(vi); + //vi = sign(vi); + vi = min(vi, i); + vi = min(vi, vi); + vi = max(vi, i); + vi = max(vi, vi); + vi = clamp(vi, i, i); + vi = clamp(vi, vi, vi); + vi = mix(vi, vi, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vi, vi); + vb = lessThanEqual(vi, vi); + vb = greaterThan(vi, vi); + vb = greaterThanEqual(vi, vi); + vb = equal(vi, vi); + vb = notEqual(vi, vi); + + // 8.8 + //vi = uaddCarry(vi, vi, vi); + //vi = usubBorrow(vi, vi, vi); + imulExtended(vi, vi, vi, vi); + vi = bitfieldExtract(vi, i, i); + vi = bitfieldInsert(vi, vi, i, i); + vi = bitfieldReverse(vi); + vi = bitCount(vi); + //vi = findLSB(vi); + //vi = findMSB(vi); + + // GL_EXT_shader_integer_mix + vi = mix(vi, vi, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vi = expectEXT(vi, vi); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsint32.comp b/third_party/glslang/Test/spv.longVectorBuiltinsint32.comp new file mode 100644 index 0000000000..fadbf77fe0 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsint32.comp @@ -0,0 +1,59 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vi; + int32_t i; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vi = abs(vi); + //vi = sign(vi); + vi = min(vi, i); + vi = min(vi, vi); + vi = max(vi, i); + vi = max(vi, vi); + vi = clamp(vi, i, i); + vi = clamp(vi, vi, vi); + vi = mix(vi, vi, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vi, vi); + vb = lessThanEqual(vi, vi); + vb = greaterThan(vi, vi); + vb = greaterThanEqual(vi, vi); + vb = equal(vi, vi); + vb = notEqual(vi, vi); + + // 8.8 + //vi = uaddCarry(vi, vi, vi); + //vi = usubBorrow(vi, vi, vi); + imulExtended(vi, vi, vi, vi); + vi = bitfieldExtract(vi, i, i); + vi = bitfieldInsert(vi, vi, i, i); + vi = bitfieldReverse(vi); + vi = bitCount(vi); + vi = findLSB(vi); + vi = findMSB(vi); + + // GL_EXT_shader_integer_mix + vi = mix(vi, vi, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vi = expectEXT(vi, vi); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsint64.comp b/third_party/glslang/Test/spv.longVectorBuiltinsint64.comp new file mode 100644 index 0000000000..5d956f858c --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsint64.comp @@ -0,0 +1,59 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vi; + int64_t i; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vi = abs(vi); + //vi = sign(vi); + vi = min(vi, i); + vi = min(vi, vi); + vi = max(vi, i); + vi = max(vi, vi); + vi = clamp(vi, i, i); + vi = clamp(vi, vi, vi); + vi = mix(vi, vi, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vi, vi); + vb = lessThanEqual(vi, vi); + vb = greaterThan(vi, vi); + vb = greaterThanEqual(vi, vi); + vb = equal(vi, vi); + vb = notEqual(vi, vi); + + // 8.8 + //vi = uaddCarry(vi, vi, vi); + //vi = usubBorrow(vi, vi, vi); + imulExtended(vi, vi, vi, vi); + //vi = bitfieldExtract(vi, i, i); + //vi = bitfieldInsert(vi, vi, i, i); + //vi = bitfieldReverse(vi); + vi = bitCount(vi); + //vi = findLSB(vi); + //vi = findMSB(vi); + + // GL_EXT_shader_integer_mix + vi = mix(vi, vi, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vi = expectEXT(vi, vi); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsint8.comp b/third_party/glslang/Test/spv.longVectorBuiltinsint8.comp new file mode 100644 index 0000000000..e32a87d1b6 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsint8.comp @@ -0,0 +1,59 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vi; + int8_t i; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vi = abs(vi); + //vi = sign(vi); + vi = min(vi, i); + vi = min(vi, vi); + vi = max(vi, i); + vi = max(vi, vi); + vi = clamp(vi, i, i); + vi = clamp(vi, vi, vi); + vi = mix(vi, vi, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vi, vi); + vb = lessThanEqual(vi, vi); + vb = greaterThan(vi, vi); + vb = greaterThanEqual(vi, vi); + vb = equal(vi, vi); + vb = notEqual(vi, vi); + + // 8.8 + //vi = uaddCarry(vi, vi, vi); + //vi = usubBorrow(vi, vi, vi); + imulExtended(vi, vi, vi, vi); + vi = bitfieldExtract(vi, i, i); + vi = bitfieldInsert(vi, vi, i, i); + vi = bitfieldReverse(vi); + vi = bitCount(vi); + //vi = findLSB(vi); + //vi = findMSB(vi); + + // GL_EXT_shader_integer_mix + vi = mix(vi, vi, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vi = expectEXT(vi, vi); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsuint16.comp b/third_party/glslang/Test/spv.longVectorBuiltinsuint16.comp new file mode 100644 index 0000000000..b009162b13 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsuint16.comp @@ -0,0 +1,61 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vu; + uint16_t u; + vector vi; + int16_t i; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vu = abs(vu); + //vu = sign(vu); + vu = min(vu, u); + vu = min(vu, vu); + vu = max(vu, u); + vu = max(vu, vu); + vu = clamp(vu, u, u); + vu = clamp(vu, vu, vu); + vu = mix(vu, vu, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vu, vu); + vb = lessThanEqual(vu, vu); + vb = greaterThan(vu, vu); + vb = greaterThanEqual(vu, vu); + vb = equal(vu, vu); + vb = notEqual(vu, vu); + + // 8.8 + vu = uaddCarry(vu, vu, vu); + vu = usubBorrow(vu, vu, vu); + umulExtended(vu, vu, vu, vu); + vu = bitfieldExtract(vu, i, i); + vu = bitfieldInsert(vu, vu, i, i); + vu = bitfieldReverse(vu); + vi = bitCount(vu); + //vi = findLSB(vu); + //vi = findMSB(vu); + + // GL_EXT_shader_integer_mix + vu = mix(vu, vu, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vu = expectEXT(vu, vu); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsuint32.comp b/third_party/glslang/Test/spv.longVectorBuiltinsuint32.comp new file mode 100644 index 0000000000..8a5b605eda --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsuint32.comp @@ -0,0 +1,63 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vu; + uint32_t u; + vector vi; + int32_t i; + vector vu16; + float16_t f16; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vu = abs(vu); + //vu = sign(vu); + vu = min(vu, u); + vu = min(vu, vu); + vu = max(vu, u); + vu = max(vu, vu); + vu = clamp(vu, u, u); + vu = clamp(vu, vu, vu); + vu = mix(vu, vu, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vu, vu); + vb = lessThanEqual(vu, vu); + vb = greaterThan(vu, vu); + vb = greaterThanEqual(vu, vu); + vb = equal(vu, vu); + vb = notEqual(vu, vu); + + // 8.8 + vu = uaddCarry(vu, vu, vu); + vu = usubBorrow(vu, vu, vu); + umulExtended(vu, vu, vu, vu); + vu = bitfieldExtract(vu, i, i); + vu = bitfieldInsert(vu, vu, i, i); + vu = bitfieldReverse(vu); + vi = bitCount(vu); + vi = findLSB(vu); + vi = findMSB(vu); + + // GL_EXT_shader_integer_mix + vu = mix(vu, vu, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vu = expectEXT(vu, vu); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsuint64.comp b/third_party/glslang/Test/spv.longVectorBuiltinsuint64.comp new file mode 100644 index 0000000000..116eba22ab --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsuint64.comp @@ -0,0 +1,61 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vu; + uint64_t u; + vector vi; + int64_t i; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vu = abs(vu); + //vu = sign(vu); + vu = min(vu, u); + vu = min(vu, vu); + vu = max(vu, u); + vu = max(vu, vu); + vu = clamp(vu, u, u); + vu = clamp(vu, vu, vu); + vu = mix(vu, vu, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vu, vu); + vb = lessThanEqual(vu, vu); + vb = greaterThan(vu, vu); + vb = greaterThanEqual(vu, vu); + vb = equal(vu, vu); + vb = notEqual(vu, vu); + + // 8.8 + vu = uaddCarry(vu, vu, vu); + vu = usubBorrow(vu, vu, vu); + umulExtended(vu, vu, vu, vu); + //vu = bitfieldExtract(vu, i, i); + //vu = bitfieldInsert(vu, vu, i, i); + //vu = bitfieldReverse(vu); + vi = bitCount(vu); + //vi = findLSB(vu); + //vi = findMSB(vu); + + // GL_EXT_shader_integer_mix + vu = mix(vu, vu, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vu = expectEXT(vu, vu); +} diff --git a/third_party/glslang/Test/spv.longVectorBuiltinsuint8.comp b/third_party/glslang/Test/spv.longVectorBuiltinsuint8.comp new file mode 100644 index 0000000000..6b9a92c38b --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorBuiltinsuint8.comp @@ -0,0 +1,61 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_expect_assume : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vector vu; + uint8_t u; + vector vi; + int8_t i; + vector vb; + bool b; + + // 8.1 + + // 8.2 + + // 8.3 + //vu = abs(vu); + //vu = sign(vu); + vu = min(vu, u); + vu = min(vu, vu); + vu = max(vu, u); + vu = max(vu, vu); + vu = clamp(vu, u, u); + vu = clamp(vu, vu, vu); + vu = mix(vu, vu, vb); + + // 8.5 + + // 8.7 + vb = lessThan(vu, vu); + vb = lessThanEqual(vu, vu); + vb = greaterThan(vu, vu); + vb = greaterThanEqual(vu, vu); + vb = equal(vu, vu); + vb = notEqual(vu, vu); + + // 8.8 + vu = uaddCarry(vu, vu, vu); + vu = usubBorrow(vu, vu, vu); + umulExtended(vu, vu, vu, vu); + vu = bitfieldExtract(vu, i, i); + vu = bitfieldInsert(vu, vu, i, i); + vu = bitfieldReverse(vu); + vi = bitCount(vu); + //vi = findLSB(vu); + //vi = findMSB(vu); + + // GL_EXT_shader_integer_mix + vu = mix(vu, vu, vb); + vb = mix(vb, vb, vb); + + // GL_EXT_expect_assume + vu = expectEXT(vu, vu); +} diff --git a/third_party/glslang/Test/spv.longVectorMatMul.comp b/third_party/glslang/Test/spv.longVectorMatMul.comp new file mode 100644 index 0000000000..1d4ec48cc0 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorMatMul.comp @@ -0,0 +1,29 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_NV_cooperative_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_nonuniform_qualifier : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer MatrixBuf { + float16_t matrixData[]; +} matrixBuf; + +layout(set = 0, binding = 0) buffer MatrixBuf2 { + int8_t matrixData[]; +} matrixBuf2; + +void main() +{ + vector v7 = vector(1); + vector v8; + + coopvecNV cv7 = coopvecNV(v7); + coopvecNV cv8; + + coopVecMatMulNV(cv8, cv7, gl_ComponentTypeFloat16NV, matrixBuf.matrixData, 11, gl_ComponentTypeFloat16NV, 100, 20, gl_CooperativeVectorMatrixLayoutRowMajorNV, false, 300); + v8 = vector(cv8); +} diff --git a/third_party/glslang/Test/spv.longVectorNotReserved.comp b/third_party/glslang/Test/spv.longVectorNotReserved.comp new file mode 100644 index 0000000000..9761ec9e2b --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorNotReserved.comp @@ -0,0 +1,9 @@ +#version 450 core + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + vec4 vector; + float f = vector.y; +} diff --git a/third_party/glslang/Test/spv.longVectorOperators.comp b/third_party/glslang/Test/spv.longVectorOperators.comp new file mode 100644 index 0000000000..40fd532c61 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorOperators.comp @@ -0,0 +1,173 @@ +#version 450 core +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + float f; + vector f0, f1; + uint32_t u; + vector u0, u1; + bool b; + vector b0, b1; + + f0 = f0 + f1; + f0 = f0 - f1; + f0 = f0 * f1; + f0 = f0 / f1; + f0 = f0 + f; + f0 = f0 - f; + f0 = f0 * f; + f0 = f0 / f; + f0 = -f0; + + f0 += f1; + f0 -= f1; + f0 *= f1; + f0 /= f1; + f0 += f; + f0 -= f; + f0 *= f; + f0 /= f; + + u0 = u0 + u1; + u0 = u0 - u1; + u0 = u0 * u1; + u0 = u0 / u1; + u0 = u0 % u1; + u0 = u0 & u1; + u0 = u0 | u1; + u0 = u0 ^ u1; + u0 = u0 << u1; + u0 = u0 >> u1; + u0 = u0 + u; + u0 = u0 - u; + u0 = u0 * u; + u0 = u0 / u; + u0 = u0 % u; + u0 = u0 & u; + u0 = u0 | u; + u0 = u0 ^ u; + u0 = u0 << u; + u0 = u0 >> u; + + u0 += u1; + u0 -= u1; + u0 *= u1; + u0 /= u1; + u0 %= u1; + u0 &= u1; + u0 |= u1; + u0 ^= u1; + u0 <<= u1; + u0 >>= u1; + u0 += u; + u0 -= u; + u0 *= u; + u0 /= u; + u0 %= u; + u0 &= u; + u0 ^= u; + u0 |= u; + u0 <<= u; + u0 >>= u; + + u0++; + u0--; + ++u0; + --u0; + + b0 = equal(b0, b1); + b0 = notEqual(b0, b1); + b = any(b0); + b = all(b0); + b0 = not(b0); + + f0 = b ? f0 : f1; +} + +void foo() +{ + float f; + vector f0, f1; + uint32_t u; + vector u0, u1; + bool b; + vector b0, b1; + + f0 = f0 + f1; + f0 = f0 - f1; + f0 = f0 * f1; + f0 = f0 / f1; + f0 = f0 + f; + f0 = f0 - f; + f0 = f0 * f; + f0 = f0 / f; + f0 = -f0; + + f0 += f1; + f0 -= f1; + f0 *= f1; + f0 /= f1; + f0 += f; + f0 -= f; + f0 *= f; + f0 /= f; + + u0 = u0 + u1; + u0 = u0 - u1; + u0 = u0 * u1; + u0 = u0 / u1; + u0 = u0 % u1; + u0 = u0 & u1; + u0 = u0 | u1; + u0 = u0 ^ u1; + u0 = u0 << u1; + u0 = u0 >> u1; + u0 = u0 + u; + u0 = u0 - u; + u0 = u0 * u; + u0 = u0 / u; + u0 = u0 % u; + u0 = u0 & u; + u0 = u0 | u; + u0 = u0 ^ u; + u0 = u0 << u; + u0 = u0 >> u; + + u0 += u1; + u0 -= u1; + u0 *= u1; + u0 /= u1; + u0 %= u1; + u0 &= u1; + u0 |= u1; + u0 ^= u1; + u0 <<= u1; + u0 >>= u1; + u0 += u; + u0 -= u; + u0 *= u; + u0 /= u; + u0 %= u; + u0 &= u; + u0 ^= u; + u0 |= u; + u0 <<= u; + u0 >>= u; + + u0++; + u0--; + ++u0; + --u0; + + b0 = equal(b0, b1); + b0 = notEqual(b0, b1); + b = any(b0); + b = all(b0); + b0 = not(b0); + + f0 = b ? f0 : f1; +} diff --git a/third_party/glslang/Test/spv.longVectorSpecConst.comp b/third_party/glslang/Test/spv.longVectorSpecConst.comp new file mode 100644 index 0000000000..ea60cc0847 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorSpecConst.comp @@ -0,0 +1,81 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_nonuniform_qualifier : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer MatrixBuf { + float16_t matrixData[]; +} matrixBuf; + +layout(set = 0, binding = 0) buffer MatrixBuf2 { + int8_t matrixData[]; +} matrixBuf2; + +layout(constant_id = 0) const uint32_t c0 = 0; + +void main() +{ + vector v = vector(0.0); + + vec3 x = vec3(1.0), y = vec3(2.0); + vector v2 = vector(x[0]); + + const vec3 x2 = vec3(1.0), y2 = vec3(2.0); + vector v3 = vector(x2[0]); + + vec3 x3 = vec3(4, 5, 6), y3 = vec3(7, 8, 9); + + vector v4 = vector(x3.z); + + vector v5 = vector(v4); + + vector v6; + + v6 = v + v2; + v6 = v - v2; + v6 = v * v2; + v6 = v / v2; + + v6 += v; + v6 -= v; + v6 *= v; + v6 /= v; + + float f; + v6 *= f; + v6 *= 5.0; + + int len = v6.length(); + + v6[0] = f; + v6[4] = 5.0; + + f += (v += v)[4]; + v6 = v; + + vector v7; + vector f162 = vector(v7.length()); + + float16_t f16; + vector f161 = vector(f16); + + vector v11, v12, v13; + + v11 = max(v11, v12); + v11 = min(v11, v12); + v11 = step(v11, v12); + v11 = clamp(v11, v12, v13); + v11 = exp(v11); + v11 = log(v11); + v11 = tanh(v11); + v11 = atan(v11); + v11 = fma(v11, v12, v13); + + f += (v += v)[len]; +} + +vector foo(vector x) { return x; } diff --git a/third_party/glslang/Test/spv.longVectorStorage.comp b/third_party/glslang/Test/spv.longVectorStorage.comp new file mode 100644 index 0000000000..c7c6ff9816 --- /dev/null +++ b/third_party/glslang/Test/spv.longVectorStorage.comp @@ -0,0 +1,84 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_EXT_long_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_scalar_block_layout : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const uint32_t c0 = 0; + +layout(set = 0, binding = 0, std140) buffer Buf140 { + vector v5[2]; + vector v7; + vector v1[2]; +} buf140; + +layout(set = 0, binding = 0, std430) buffer Buf430 { + vector v5[2]; + vector v7; + vector v1[2]; +} buf430; + +layout(set = 0, binding = 0, scalar) buffer BufScalar { + vector v5[2]; + vector v7; + vector v1[2]; +} bufScalar; + +layout(set = 0, binding = 1) uniform UBO { + vector v5[2]; + vector v7; + vector v1[2]; +} ubo; + +layout (push_constant, scalar) uniform PC { + layout(offset = 0) vector v5; + layout(offset = 28) vector v7; +} pc; + +layout(scalar, buffer_reference) buffer BufScalarRef { + vector v5[2]; + vector v7; + vector v1[2]; +}; + +shared vector s9; +shared vector s5; + + + +void main() +{ + vector v1; + vector v5; + vector v7; + vector v9; + vector vc; + + BufScalarRef ref; + + v1 = buf140.v1[0]; + v1 = buf430.v1[1]; + v1 = bufScalar.v1[1]; + v1 = ubo.v1[1]; + v1 = ref.v1[1]; + + v5 = buf140.v5[1]; + v5 = buf430.v5[1]; + v5 = bufScalar.v5[1]; + v5 = ubo.v5[1]; + v5 = pc.v5; + v5 = ref.v5[1]; + + v7 = buf140.v7; + v7 = buf430.v7; + v7 = bufScalar.v7; + v7 = ubo.v7; + v7 = pc.v7; + v7 = ref.v7; + + v9 = s9; + vc = s5; +} diff --git a/third_party/glslang/Test/spv.memoryScopeSemantics.comp b/third_party/glslang/Test/spv.memoryScopeSemantics.comp index 528a639688..bff502b374 100644 --- a/third_party/glslang/Test/spv.memoryScopeSemantics.comp +++ b/third_party/glslang/Test/spv.memoryScopeSemantics.comp @@ -39,9 +39,6 @@ void main() origi = atomicExchange(atomi, origi, gl_ScopeDevice, 0, 0); origu = atomicCompSwap(atomu, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); atomicAdd(bufferu.x, 1, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); - memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); - controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); - controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, 0, 0); uint y; y = bufferu.x; @@ -70,5 +67,83 @@ void main() imageAtomicStore(imageMS, ivec2(0,0), 1, 4, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); imageAtomicStore(imagei, ivec2(0,0), -7, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); -} + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, 0, 0); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable); + + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable); + + origu = atomicLoad(atomu, gl_ScopeDevice, 0, 0); + origu = atomicLoad(atomu, gl_ScopeDevice, 0, gl_SemanticsVolatile); + origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); + origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile); + origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + origu = atomicLoad(atomu, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire | gl_SemanticsMakeVisible | gl_SemanticsVolatile); + + atomicStore(atomu, 10U, gl_ScopeDevice, 0, 0); + atomicStore(atomu, 10U, gl_ScopeDevice, 0, gl_SemanticsVolatile); + atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); + atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsVolatile); + atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable); + atomicStore(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease | gl_SemanticsMakeAvailable | gl_SemanticsVolatile); + + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, 0, 0); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, 0, gl_SemanticsVolatile); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsVolatile); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable); + origu = atomicAnd(atomu, 10U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable | gl_SemanticsVolatile); + + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, 0, 0, 0, 0); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, 0, gl_SemanticsVolatile, 0, gl_SemanticsVolatile); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire, 0, 0); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease, 0, 0); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, 0, 0); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile, 0, gl_SemanticsVolatile); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsVolatile, 0, gl_SemanticsVolatile); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile, 0, gl_SemanticsVolatile); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible, 0, 0); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable, 0, 0); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable, 0, 0); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable | gl_SemanticsVolatile, 0, gl_SemanticsVolatile); + + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire | gl_SemanticsMakeVisible | gl_SemanticsVolatile, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire | gl_SemanticsMakeVisible | gl_SemanticsVolatile); + + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeAvailable, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + atomicCompSwap(atomu, 10U, 20U, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible | gl_SemanticsMakeAvailable | gl_SemanticsVolatile, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire | gl_SemanticsMakeVisible | gl_SemanticsVolatile); +} diff --git a/third_party/glslang/Test/spv.memoryScopeSemantics_Error.comp b/third_party/glslang/Test/spv.memoryScopeSemantics_Error.comp index 1b856717a1..a50ece0c9f 100644 --- a/third_party/glslang/Test/spv.memoryScopeSemantics_Error.comp +++ b/third_party/glslang/Test/spv.memoryScopeSemantics_Error.comp @@ -1,30 +1,93 @@ #version 450 #extension GL_KHR_memory_scope_semantics : require - shared uint value; -shared int atomi; -shared uint atomu; -layout(binding = 0, r32ui) workgroupcoherent uniform uimage2D imageu; -layout(binding = 1, r32i) coherent uniform iimage2D imagei; -layout (binding = 2) buffer BufferU { workgroupcoherent uint x; } bufferu; -layout (binding = 3) subgroupcoherent buffer BufferI { uint x; } bufferi; +layout (binding = 0) buffer BufferU { coherent uint x; } bufferu; +layout(binding = 1, r32ui) coherent uniform uimage2D imageu; void main() { - atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); - int origi = imageAtomicLoad(imagei, ivec2(0,0), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); - atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); - atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_StorageSemanticsBuffer); - origi = imageAtomicLoad(imagei, ivec2(0,0), gl_ScopeDevice, gl_SemanticsAcquire, gl_SemanticsAcquire); - memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, 0); - memoryBarrier(gl_ScopeWorkgroup, 0, gl_SemanticsRelease); - memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease | gl_SemanticsAcquire); - atomicAdd(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsAcquire); - uint origu = atomicCompSwap(atomu, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); - memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeVisible); - memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeAvailable); - memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsVolatile); - atomicCompSwap(bufferi.x, 10u, 10u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); -} + uint origu; + // Acquire must not be used with (image) atomic store + atomicStore(bufferu.x, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + imageAtomicStore(imageu, ivec2(0,0), value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + + // Release must not be used with (image) atomic load + origu = atomicLoad(bufferu.x, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + origu = imageAtomicLoad(imageu, ivec2(0,0), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + + // AcquireRelease must not be used with (image) atomic load/store + atomicStore(bufferu.x, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + imageAtomicStore(imageu, ivec2(0,0), value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + origu = atomicLoad(bufferu.x, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + origu = imageAtomicLoad(imageu, ivec2(0,0), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + + // Relaxed must not be used with memoryBarrier + memoryBarrier(gl_ScopeWorkgroup, 0, 0); + + // Illegal semantics bits + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, 0, gl_StorageSemanticsBuffer, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_StorageSemanticsBuffer | gl_SemanticsAcquireRelease, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, 0, gl_StorageSemanticsBuffer); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_StorageSemanticsBuffer | gl_SemanticsAcquire); + + // Illegal storage class semantics bits + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_SemanticsAcquire, gl_SemanticsAcquire, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_SemanticsAcquire, gl_SemanticsAcquire, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + + // Semantics must not have multiple memory order bits set + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsRelease, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsAcquireRelease, 0, 0); + + // Storage class semantics must be non-zero when used with a non-relaxed memory order + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, 0, gl_SemanticsAcquireRelease, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, 0, gl_SemanticsAcquire); + + // Semantics must have a non-relaxed memory order when used with non-zero storage class semantics + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, 0, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsVolatile, 0, gl_SemanticsVolatile); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile, gl_StorageSemanticsBuffer, gl_SemanticsVolatile); + imageAtomicAdd(imageu, ivec2(0,0), value, gl_ScopeDevice, gl_StorageSemanticsImage, 0); + imageAtomicAdd(imageu, ivec2(0,0), value, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsVolatile); + + // MakeAvailable requires Release or AcquireRelease + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, 0, gl_SemanticsMakeAvailable, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeAvailable, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeAvailable, 0, gl_SemanticsMakeAvailable); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeAvailable, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeAvailable); + + // MakeVisible requires Acquire or AcquireRelease + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, 0, gl_SemanticsMakeVisible, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeVisible, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeVisible, 0, gl_SemanticsMakeVisible); + + // Volatile must not be used with memoryBarrier or controlBarrier + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, 0, gl_SemanticsVolatile); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile); + + // SemUnequal must not be Release or AcquireRelease + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + + // SemUnequal must not be Acquire unless SemEqual is Acquire or AcquireRelease + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, 0, 0, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + + // SemUnequal must not include MakeVisible unless SemEqual also includes MakeVisible + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible); + + // SemStorageUnequal must not include any option that is not present in SemStorageEqual + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire, gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); + + // SemEqual and SemUnequal must either both include Volatile or neither + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, 0, gl_SemanticsVolatile, 0, 0); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, 0, 0, 0, gl_SemanticsVolatile); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsVolatile, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicCompSwap(bufferu.x, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsVolatile); +} diff --git a/third_party/glslang/Test/spv.promote_uint32_indices.comp b/third_party/glslang/Test/spv.promote_uint32_indices.comp new file mode 100644 index 0000000000..8e3cb66cdb --- /dev/null +++ b/third_party/glslang/Test/spv.promote_uint32_indices.comp @@ -0,0 +1,24 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_KHR_cooperative_matrix : enable +#extension GL_NV_cooperative_vector : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_shader_64bit_indexing : enable + +#pragma promote_uint32_indices + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, buffer_reference) coherent buffer Block { + float x[]; +} block; + +void main() +{ + uint32_t element = 3000000000u; + + float y = block.x[element]; + y = block.x[4000000000u]; + y = block.x[5000000000ul]; +} diff --git a/third_party/glslang/Test/spv.pushConstantBank.vert b/third_party/glslang/Test/spv.pushConstantBank.vert new file mode 100644 index 0000000000..3422dac2a1 --- /dev/null +++ b/third_party/glslang/Test/spv.pushConstantBank.vert @@ -0,0 +1,45 @@ +#version 460 +#extension GL_NV_push_constant_bank : enable + +layout(std430, binding = 0) buffer ResultData { + uint bank[8]; +} resultData; + +layout(push_constant) uniform PushConstantBank0 { + uint data; +} bank0; + +layout(push_constant, bank = 1) uniform PushConstantBank1 { + uint data; +} bank1; + +layout(push_constant, bank = 2) uniform PushConstantBank2 { + uint data; +} bank2; + +layout(push_constant, bank = 3) uniform PushConstantBank3 { + uint data; +} bank3; + +layout(push_constant, bank = 4) uniform PushConstantBank4 { + uint data; +} bank4; + +layout(push_constant, bank = 5) uniform PushConstantBank5 { + uint data; +} bank5; + +layout(push_constant, bank = 6, member_offset = 64) uniform PushConstantBank6 { + uint data; +} bank6_offset; + +void main() { + resultData.bank[0] = bank0.data; + resultData.bank[1] = bank1.data; + resultData.bank[2] = bank2.data; + resultData.bank[3] = bank3.data; + resultData.bank[4] = bank4.data; + resultData.bank[5] = bank5.data; + resultData.bank[6] = bank6_offset.data; + gl_Position = vec4(0, 0, 0, 0); +} \ No newline at end of file diff --git a/third_party/glslang/Test/spv.qcom.coopmatConversion.1.comp b/third_party/glslang/Test/spv.qcom.coopmatConversion.1.comp new file mode 100644 index 0000000000..3d59694f81 --- /dev/null +++ b/third_party/glslang/Test/spv.qcom.coopmatConversion.1.comp @@ -0,0 +1,196 @@ +#version 450 core +#pragma use_vulkan_memory_model +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_EXT_scalar_block_layout : enable +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_KHR_cooperative_matrix : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_control_flow_attributes : enable +#extension GL_KHR_shader_subgroup_basic : enable + +#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable +#extension GL_EXT_shader_explicit_arithmetic_types_int32 : enable +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : enable +#extension GL_QCOM_cooperative_matrix_conversion : enable + +layout(set=0, binding=0) readonly buffer InputA { float x[]; } inputA; +layout(set=0, binding=1) readonly buffer InputB { float x[]; } inputB; +layout(set=0, binding=2) readonly buffer InputC { float x[]; } inputC; +layout(set=0, binding=3) buffer Output { float x[]; } outputO; + +layout(local_size_x = 64, local_size_y = 2, local_size_z = 2) in; + +void main() +{ + float16_t hvec8A[16]; + float32_t vec8A[8]; + int32_t ivec8A[8]; + uint32_t uvec8A[8]; + float16_t hvec32B[64]; + float32_t vec32B[32]; + int32_t ivec32B[32]; + uint32_t uvec32B[32]; + float vec64Acc[64]; + int ivec64Acc[64]; + uint uvec64Acc[64]; + float16_t hvec8A_4[4]; + + // bitcastQCOM + { + bitcastQCOM(hvec8A, uvec8A); + bitcastQCOM(uvec8A, hvec8A); + bitcastQCOM(ivec8A, vec8A); + bitcastQCOM( vec8A, ivec8A); + + bitcastQCOM(hvec32B, ivec32B); + bitcastQCOM(ivec32B, hvec32B); + bitcastQCOM(uvec32B, vec32B); + bitcastQCOM( vec32B, uvec32B); + + bitcastQCOM(uvec64Acc, ivec64Acc); + bitcastQCOM(ivec64Acc, uvec64Acc); + bitcastQCOM(uvec64Acc, vec64Acc); + bitcastQCOM( vec64Acc, uvec64Acc); + } + + // extractSubArrayQCOM + { + extractSubArrayQCOM(ivec64Acc, 0, ivec8A); + extractSubArrayQCOM(ivec64Acc, 8, ivec32B); + extractSubArrayQCOM(uvec64Acc, 0, uvec8A); + extractSubArrayQCOM(uvec64Acc, 8, uvec32B); + extractSubArrayQCOM( vec64Acc, 0, vec8A); + extractSubArrayQCOM( vec64Acc, 4, vec32B); + extractSubArrayQCOM(hvec32B, 0, hvec8A); + extractSubArrayQCOM(hvec32B, 4, hvec8A_4); + } + + coopmat< uint8_t, gl_ScopeSubgroup, 64, 32, gl_MatrixUseA> matA_u8_64_32; + coopmat< int8_t, gl_ScopeSubgroup, 64, 32, gl_MatrixUseA> matA_i8_64_32; + coopmat matA_f16_64_16; + coopmat matA_f32_64_8; + + // vectorToCoopmatQCOM gl_MatrixUseA + { + vectorToCoopmatQCOM( vec8A, matA_f32_64_8); + vectorToCoopmatQCOM(uvec8A, matA_f32_64_8); + + vectorToCoopmatQCOM(hvec8A, matA_f16_64_16); + vectorToCoopmatQCOM(uvec8A, matA_f16_64_16); + + int8_t i8vec8A[32]; + vectorToCoopmatQCOM(i8vec8A, matA_i8_64_32); + vectorToCoopmatQCOM( uvec8A, matA_i8_64_32); + + uint8_t u8vec8A[32]; + vectorToCoopmatQCOM(u8vec8A, matA_u8_64_32); + vectorToCoopmatQCOM( uvec8A, matA_u8_64_32); + } + + coopmat< uint8_t, gl_ScopeSubgroup, 32, 64, gl_MatrixUseB> matB_u8_32_64; + coopmat< int8_t, gl_ScopeSubgroup, 32, 64, gl_MatrixUseB> matB_i8_32_64; + coopmat matB_f16_16_64; + coopmat matB_f32_8_64; + + coopmat matB_f16_16_32; + coopmat< int8_t, gl_ScopeSubgroup, 32, 16, gl_MatrixUseB> matB_i8_32_16; + + // vectorToCoopmatQCOM gl_MatrixUseB + { + vectorToCoopmatQCOM( vec8A, matB_f32_8_64); + vectorToCoopmatQCOM(uvec8A, matB_f32_8_64); + + vectorToCoopmatQCOM(hvec8A, matB_f16_16_64); + vectorToCoopmatQCOM(uvec8A, matB_f16_16_64); + + int8_t i8vec8B[32]; + vectorToCoopmatQCOM(i8vec8B, matB_i8_32_64); + vectorToCoopmatQCOM( uvec8A, matB_i8_32_64); + + uint8_t u8vec8B[32]; + vectorToCoopmatQCOM(u8vec8B, matB_u8_32_64); + vectorToCoopmatQCOM( uvec8A, matB_u8_32_64); + + vectorToCoopmatQCOM(hvec8A, matB_f16_16_32); + vectorToCoopmatQCOM(uvec8A, matB_f16_16_32); + + vectorToCoopmatQCOM(i8vec8B, matB_i8_32_16); + vectorToCoopmatQCOM(uvec8A, matB_i8_32_16); + } + + coopmat< uint32_t, gl_ScopeSubgroup, 64, 64, gl_MatrixUseAccumulator> matAcc_u32_64_64; + coopmat< int32_t, gl_ScopeSubgroup, 64, 64, gl_MatrixUseAccumulator> matAcc_i32_64_64; + coopmat matAcc_f16_64_64; + coopmat matAcc_f32_64_64; + + // vectorToCoopmatQCOM gl_MatrixUseAccumulator + { + vectorToCoopmatQCOM( vec64Acc, matAcc_f32_64_64); + vectorToCoopmatQCOM(uvec64Acc, matAcc_f32_64_64); + + float16_t hvec64Acc[64]; + vectorToCoopmatQCOM(hvec64Acc, matAcc_f16_64_64); + vectorToCoopmatQCOM(uvec32B, matAcc_f16_64_64); + + vectorToCoopmatQCOM(ivec64Acc, matAcc_i32_64_64); + vectorToCoopmatQCOM(uvec64Acc, matAcc_i32_64_64); + + vectorToCoopmatQCOM(uvec64Acc, matAcc_u32_64_64); + } + + // coopmatToVectorQCOM gl_MatrixUseA + { + coopmatToVectorQCOM(matA_f32_64_8, vec8A); + coopmatToVectorQCOM(matA_f32_64_8, uvec8A); + + coopmatToVectorQCOM(matA_f16_64_16, hvec8A); + coopmatToVectorQCOM(matA_f16_64_16, uvec8A); + + int8_t i8vec8A[32]; + coopmatToVectorQCOM(matA_i8_64_32, i8vec8A); + coopmatToVectorQCOM(matA_i8_64_32, uvec8A); + + uint8_t u8vec8A[32]; + coopmatToVectorQCOM(matA_u8_64_32, u8vec8A); + coopmatToVectorQCOM(matA_u8_64_32, uvec8A); + } + + // coopmatToVectorQCOM gl_MatrixUseB + { + coopmatToVectorQCOM(matB_f32_8_64, vec8A); + coopmatToVectorQCOM(matB_f32_8_64, uvec8A); + + coopmatToVectorQCOM(matB_f16_16_64, hvec8A); + coopmatToVectorQCOM(matB_f16_16_64, uvec8A); + + int8_t i8vec8B[32]; + coopmatToVectorQCOM(matB_i8_32_64, i8vec8B); + coopmatToVectorQCOM(matB_i8_32_64, uvec8A); + + uint8_t u8vec8B[32]; + coopmatToVectorQCOM(matB_u8_32_64, u8vec8B); + coopmatToVectorQCOM(matB_u8_32_64, uvec8A); + + coopmatToVectorQCOM(matB_f16_16_32, hvec8A); + coopmatToVectorQCOM(matB_f16_16_32, uvec8A); + + coopmatToVectorQCOM(matB_i8_32_16, i8vec8B); + coopmatToVectorQCOM(matB_i8_32_16, uvec8A); + } + + // coopmatToVectorQCOM gl_MatrixUseAccumulator + { + coopmatToVectorQCOM(matAcc_f32_64_64, vec64Acc); + coopmatToVectorQCOM(matAcc_f32_64_64, uvec64Acc); + + float16_t hvec64Acc[64]; + coopmatToVectorQCOM(matAcc_f16_64_64, hvec64Acc); + coopmatToVectorQCOM(matAcc_f16_64_64, uvec32B); + + coopmatToVectorQCOM(matAcc_i32_64_64, ivec64Acc); + coopmatToVectorQCOM(matAcc_i32_64_64, uvec64Acc); + + coopmatToVectorQCOM(matAcc_u32_64_64, uvec64Acc); + } +} diff --git a/third_party/glslang/Test/spv.qcom.coopmatConversion.2.comp b/third_party/glslang/Test/spv.qcom.coopmatConversion.2.comp new file mode 100644 index 0000000000..1186c54c63 --- /dev/null +++ b/third_party/glslang/Test/spv.qcom.coopmatConversion.2.comp @@ -0,0 +1,200 @@ +#version 450 core +#pragma use_vulkan_memory_model +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_EXT_scalar_block_layout : enable +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_KHR_cooperative_matrix : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_control_flow_attributes : enable +#extension GL_KHR_shader_subgroup_basic : enable + +#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable +#extension GL_EXT_shader_explicit_arithmetic_types_int32 : enable +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : enable +#extension GL_QCOM_cooperative_matrix_conversion : enable + +layout(constant_id = 3) const uint TILE_M = 1; +layout(constant_id = 4) const uint TILE_N = 1; +layout(constant_id = 5) const uint TILE_N2 = 2; +layout(constant_id = 6) const uint TILE_N4 = 4; +layout(constant_id = 7) const uint TILE_K = 1; +layout(constant_id = 8) const uint TILE_K2 = 2; +layout(constant_id = 9) const uint TILE_K4 = 4; + +layout(set=0, binding=0) readonly buffer InputA { float x[]; } inputA; +layout(set=0, binding=1) readonly buffer InputB { float x[]; } inputB; +layout(set=0, binding=2) readonly buffer InputC { float x[]; } inputC; +layout(set=0, binding=3) buffer Output { float x[]; } outputO; + +layout(local_size_x = 64, local_size_y = 2, local_size_z = 2) in; + +void main() +{ + uint32_t uvec8[8]; + float vec8[8]; + uint uvec64Acc[64]; + + { + uint32_t uvecSC[TILE_K]; + float f32vecSC[TILE_K]; + bitcastQCOM(uvec8, f32vecSC); + bitcastQCOM(uvecSC, vec8); + bitcastQCOM(uvecSC, f32vecSC); + + uint32_t uvecSC2[TILE_K/2]; + float f32vecSC2[TILE_K/2]; + bitcastQCOM(uvecSC2, f32vecSC2); + } + + // extractSubArrayQCOM + { + uint32_t uvecSC[TILE_K]; + uint32_t uvec64AccSC[TILE_N]; + extractSubArrayQCOM(uvec64Acc, 0, uvecSC); + extractSubArrayQCOM(uvec64AccSC, 4, uvec8); + extractSubArrayQCOM(uvec64AccSC, 8, uvecSC); + + uint32_t uvecSC2[TILE_K/2]; + uint32_t uvec64AccSC2[TILE_N/2]; + extractSubArrayQCOM(uvec64Acc, 2, uvecSC2); + extractSubArrayQCOM(uvec64AccSC2, 2, uvec8); + } + + // vectorToCoopmatQCOM gl_MatrixUseA + { + coopmat V2C_matA_f32_SC_M8; + vectorToCoopmatQCOM(uvec8, V2C_matA_f32_SC_M8); + + uint32_t uvecSC_K11[TILE_K]; + uint32_t uvecSC_K12[TILE_K2]; + coopmat V2C_matA_f32_SC_MK; + coopmat V2C_matA_f32_SC_64K; + coopmat V2C_matA_f32_SC_64_8; + vectorToCoopmatQCOM(uvecSC_K11, V2C_matA_f32_SC_MK); + vectorToCoopmatQCOM(uvecSC_K12, V2C_matA_f32_SC_64_8); + + coopmat V2C_matA_f16_SC_MK; + coopmat< int8_t, gl_ScopeSubgroup, 64, TILE_K4, gl_MatrixUseA> V2C_matA_i8_SC_64K; + coopmat V2C_matA_u8_SC_64K; + + vectorToCoopmatQCOM(uvecSC_K11, V2C_matA_f16_SC_MK); + vectorToCoopmatQCOM(uvecSC_K11, V2C_matA_i8_SC_64K); + vectorToCoopmatQCOM(uvecSC_K11, V2C_matA_u8_SC_64K); + } + + // vectorToCoopmatQCOM gl_MatrixUseB + { + coopmat V2C_matB_f32_SC_8N; + vectorToCoopmatQCOM(uvec8, V2C_matB_f32_SC_8N); + + uint32_t uvecSC_K21[TILE_K]; + uint32_t uvecSC_K22[TILE_K2]; + coopmat V2C_matB_f32_SC_KN; + coopmat V2C_matB_f32_SC_K64; + coopmat V2C_matB_f32_SC_8_64; + vectorToCoopmatQCOM(uvecSC_K21, V2C_matB_f32_SC_KN); + vectorToCoopmatQCOM(uvecSC_K22, V2C_matB_f32_SC_8_64); + + coopmat V2C_matB_f16_SC_KN; + coopmat< int8_t, gl_ScopeSubgroup, TILE_K4, 64, gl_MatrixUseB> V2C_matB_i8_SC_K64; + coopmat V2C_matB_u8_SC_K64; + coopmat V2C_matB_f32_SC_K32; + coopmat V2C_matB_f32_SC_K16; + + vectorToCoopmatQCOM(uvecSC_K21, V2C_matB_f16_SC_KN); + vectorToCoopmatQCOM(uvecSC_K21, V2C_matB_i8_SC_K64); + vectorToCoopmatQCOM(uvecSC_K21, V2C_matB_u8_SC_K64); + vectorToCoopmatQCOM(uvecSC_K21, V2C_matB_f32_SC_K32); + vectorToCoopmatQCOM(uvecSC_K21, V2C_matB_f32_SC_K16); + } + + // vectorToCoopmatQCOM gl_MatrixUseAccumulator + { + uint32_t uvecSC_N31[TILE_N]; + uint32_t uvecSC_N32[TILE_N2]; + + coopmat V2C_matAcc_f32_SC_MN; + coopmat V2C_matAcc_f32_SC_64N; + coopmat V2C_matAcc_f32_SC_64_64; + vectorToCoopmatQCOM(uvecSC_N31, V2C_matAcc_f32_SC_MN); + vectorToCoopmatQCOM(uvecSC_N32, V2C_matAcc_f32_SC_64_64); + + coopmat V2C_matAcc_f16_SC_MN; + coopmat< int32_t, gl_ScopeSubgroup, 64, TILE_N4, gl_MatrixUseAccumulator> V2C_matAcc_i32_SC_64N; + coopmat V2C_matAcc_u32_SC_64N; + + vectorToCoopmatQCOM(uvecSC_N31, V2C_matAcc_f16_SC_MN); + vectorToCoopmatQCOM(uvecSC_N31, V2C_matAcc_i32_SC_64N); + vectorToCoopmatQCOM(uvecSC_N31, V2C_matAcc_u32_SC_64N); + } + + // coopmatToVectorQCOM gl_MatrixUseA + { + coopmat C2V_matA_f32_SC_M8; + coopmatToVectorQCOM(C2V_matA_f32_SC_M8, uvec8); + + uint32_t uvecSC_K11[TILE_K]; + uint32_t uvecSC_K12[TILE_K2]; + coopmat C2V_matA_f32_SC_MK; + coopmat C2V_matA_f32_SC_64K; + coopmat C2V_matA_f32_SC_64_8; + coopmatToVectorQCOM(C2V_matA_f32_SC_MK, uvecSC_K11); + coopmatToVectorQCOM(C2V_matA_f32_SC_64_8, uvecSC_K12); + + coopmat C2V_matA_f16_SC_MK; + coopmat< int8_t, gl_ScopeSubgroup, 64, TILE_K4, gl_MatrixUseA> C2V_matA_i8_SC_64K; + coopmat C2V_matA_u8_SC_64K; + + coopmatToVectorQCOM(C2V_matA_f16_SC_MK, uvecSC_K11); + coopmatToVectorQCOM(C2V_matA_i8_SC_64K, uvecSC_K11); + coopmatToVectorQCOM(C2V_matA_u8_SC_64K, uvecSC_K11); + } + + // coopmatToVectorQCOM gl_MatrixUseB + { + coopmat C2V_matB_f32_SC_8N; + coopmatToVectorQCOM(C2V_matB_f32_SC_8N, uvec8); + + uint32_t uvecSC_K21[TILE_K]; + uint32_t uvecSC_K22[TILE_K2]; + coopmat C2V_matB_f32_SC_KN; + coopmat C2V_matB_f32_SC_K64; + coopmat C2V_matB_f32_SC_8_64; + coopmatToVectorQCOM(C2V_matB_f32_SC_KN, uvecSC_K21); + coopmatToVectorQCOM(C2V_matB_f32_SC_8_64, uvecSC_K22); + + coopmat C2V_matB_f16_SC_KN; + coopmat< int8_t, gl_ScopeSubgroup, TILE_K4, 64, gl_MatrixUseB> C2V_matB_i8_SC_K64; + coopmat C2V_matB_u8_SC_K64; + coopmat C2V_matB_f32_SC_K32; + coopmat C2V_matB_f32_SC_K16; + + coopmatToVectorQCOM(C2V_matB_f16_SC_KN, uvecSC_K21); + coopmatToVectorQCOM(C2V_matB_i8_SC_K64, uvecSC_K21); + coopmatToVectorQCOM(C2V_matB_u8_SC_K64, uvecSC_K21); + coopmatToVectorQCOM(C2V_matB_f32_SC_K32, uvecSC_K21); + coopmatToVectorQCOM(C2V_matB_f32_SC_K16, uvecSC_K21); + } + + // coopmatToVectorQCOM gl_MatrixUseAccumulator + { + uint32_t uvecSC_N31[TILE_N]; + uint32_t uvecSC_N32[TILE_N2]; + + coopmat C2V_matAcc_f32_SC_MN; + coopmat C2V_matAcc_f32_SC_64N; + coopmat C2V_matAcc_f32_SC_64_64; + coopmatToVectorQCOM(C2V_matAcc_f32_SC_MN, uvecSC_N31); + coopmatToVectorQCOM(C2V_matAcc_f32_SC_64N, uvecSC_N31); + coopmatToVectorQCOM(C2V_matAcc_f32_SC_64_64, uvecSC_N32); + + coopmat C2V_matAcc_f16_SC_MN; + coopmat< int32_t, gl_ScopeSubgroup, 64, TILE_N4, gl_MatrixUseAccumulator> C2V_matAcc_i32_SC_64N; + coopmat C2V_matAcc_u32_SC_64N; + + coopmatToVectorQCOM(C2V_matAcc_f16_SC_MN, uvecSC_N31); + coopmatToVectorQCOM(C2V_matAcc_i32_SC_64N, uvecSC_N31); + coopmatToVectorQCOM(C2V_matAcc_u32_SC_64N, uvecSC_N31); + } +} diff --git a/third_party/glslang/Test/stringInvalidOps.frag b/third_party/glslang/Test/stringInvalidOps.frag new file mode 100644 index 0000000000..6ca5592668 --- /dev/null +++ b/third_party/glslang/Test/stringInvalidOps.frag @@ -0,0 +1,8 @@ +#version 450 +#extension GL_EXT_debug_printf : require + +void main() { + true ? "abd" : "def"; + "o" + "k"; + "o" + "k" * "l"; +} diff --git a/third_party/glslang/Test/struct_construction_patterns.frag b/third_party/glslang/Test/struct_construction_patterns.frag new file mode 100644 index 0000000000..0aebf3fb69 --- /dev/null +++ b/third_party/glslang/Test/struct_construction_patterns.frag @@ -0,0 +1,77 @@ +#version 400 + +struct Inner { + int id; + float value; +}; + +struct Outer { + int before; + uint padding; + mat2 matrix; + int after; +}; + +struct Complex { + Inner nested; + Inner array[2]; +}; + +struct Point { + float x; + float y; +}; + +struct Color { + vec3 rgb; + float alpha; +}; + +void store_data(Inner data[4]) { + // Function that takes array of structs +} + +void store_outer(Outer value) { + // Function that takes single struct +} + +void process_point(Point p) { + // Function that takes single struct +} + +void main() { + // Pattern 1: Complex array constructors (most common tint failure pattern) + Outer data[4] = Outer[4]( + Outer(0, 0u, mat2(vec2(0.0), vec2(0.0)), 0), + Outer(1, 1u, mat2(vec2(1.0), vec2(1.0)), 1), + Outer(2, 2u, mat2(vec2(2.0), vec2(2.0)), 2), + Outer(3, 3u, mat2(vec2(3.0), vec2(3.0)), 3) + ); + + // Pattern 2: Nested struct array constructors + Inner inner_array[4] = Inner[4]( + Inner(0, 0.0), + Inner(1, 1.0), + Inner(2, 2.0), + Inner(3, 3.0) + ); + + // Pattern 3: Struct with nested struct constructors + Complex complex_data = Complex( + Inner(42, 3.14), + Inner[2](Inner(1, 1.0), Inner(2, 2.0)) + ); + + // Pattern 4: Function calls with array constructors + store_data(Inner[4](Inner(1, 1.0), Inner(2, 2.0), Inner(3, 3.0), Inner(4, 4.0))); + store_outer(Outer(10, 10u, mat2(vec2(5.0), vec2(6.0)), 20)); + + // Pattern 5: Basic struct constructors (from deleted basic_struct_constructor.frag) + Point p1 = Point(1.0, 2.0); + Color c1 = Color(vec3(1.0, 0.0, 0.0), 1.0); + Point p2; + p2 = Point(3.0, 4.0); + + // Pattern 6: Struct constructors in function calls (from deleted struct_constructor_in_function_call.frag) + process_point(Point(5.0, 6.0)); +} \ No newline at end of file diff --git a/third_party/glslang/Test/struct_function_parameters.frag b/third_party/glslang/Test/struct_function_parameters.frag new file mode 100644 index 0000000000..37f99791a7 --- /dev/null +++ b/third_party/glslang/Test/struct_function_parameters.frag @@ -0,0 +1,48 @@ +#version 400 + +struct Vertex { + vec3 position; + vec3 normal; +}; + +struct Light { + vec3 position; + vec3 color; + float intensity; +}; + +struct Camera { + mat4 viewMatrix; + mat4 projMatrix; +}; + +// Test various positions of struct parameters - these should be TYPE_NAME +void render(Vertex v, Light l, Camera c) { + // Function with struct parameters at start +} + +void process(int id, Vertex v, float time) { + // Function with struct parameter in middle +} + +void compute(float delta, int count, Light l, Camera c, bool enabled) { + // Function with multiple struct parameters mixed with other types +} + +void single(Vertex v) { + // Function with single struct parameter +} + +void multiple(Vertex v1, Vertex v2, Light l1, Light l2) { + // Function with multiple parameters of same struct type +} + +void main() { + Vertex v = Vertex(vec3(0.0), vec3(1.0, 0.0, 0.0)); + Light l = Light(vec3(10.0), vec3(1.0), 1.0); + Camera c = Camera(mat4(1.0), mat4(1.0)); + + render(v, l, c); + process(1, v, 0.5); + compute(0.016, 100, l, c, true); +} \ No newline at end of file diff --git a/third_party/glslang/Test/struct_member_declarator_lists.frag b/third_party/glslang/Test/struct_member_declarator_lists.frag new file mode 100644 index 0000000000..dc80c063a9 --- /dev/null +++ b/third_party/glslang/Test/struct_member_declarator_lists.frag @@ -0,0 +1,49 @@ +#version 400 + +struct Vector { + float x; + float y; + float z; +}; + +struct Color { + float r; + float g; + float b; +}; + +struct Material { + float shininess; +}; + +struct B { + vec3 t; +}; + +struct K { + // Original #3931 issue: struct names used as member names in declarator lists + // These should be IDENTIFIER tokens, not TYPE_NAME + float Vector, Color; // Two struct names as member names + int Material, shininess; // Mix of struct name and regular name + vec2 a, position, b; // Regular names in declarator list + mat3 ambient, diffuse, spec; // Regular names in declarator list + + // Original bug report pattern + float A, B; // B is a struct name used as member name + + // Array member pattern + float A_array[2], B_array[3]; // B is a struct name used as array member name +}; + +void main() { + K k; + // Access the members that have struct names + k.Vector = 1.0; + k.Color = 2.0; + k.Material = 3; + k.B = 4.0; + k.B_array[0] = 5.0; + + // Test variable declarations with struct names + int x, B, y, K; +} \ No newline at end of file diff --git a/third_party/glslang/Test/struct_name_as_struct_member.frag b/third_party/glslang/Test/struct_name_as_struct_member.frag new file mode 100644 index 0000000000..18e89c62da --- /dev/null +++ b/third_party/glslang/Test/struct_name_as_struct_member.frag @@ -0,0 +1,20 @@ +#version 400 + +// Original bug report from: https://github.com/KhronosGroup/glslang/issues/3931 +// Error was: "syntax error, unexpected TYPE_NAME, expecting IDENTIFIER" +// when defining a struct field with the same name as a previously defined +// struct. +struct B +{ + vec3 t; +}; + +struct K +{ + float A, B; // This should work. The B field is in a different scope + // than the B struct. +}; + +void main(){ + int x, B, y, K; +} \ No newline at end of file diff --git a/third_party/glslang/Test/struct_parameter_after_non_struct.frag b/third_party/glslang/Test/struct_parameter_after_non_struct.frag new file mode 100644 index 0000000000..3ed342b043 --- /dev/null +++ b/third_party/glslang/Test/struct_parameter_after_non_struct.frag @@ -0,0 +1,15 @@ +#version 400 + +struct B { + int a; +}; + +// Test struct parameter after non-struct parameter (minimal regression test). +void test1(B b, int c) {} // works. +void test2(int c, B b) {} // should work. + +void main() { + B b = B(42); + test1(b, 10); + test2(10, b); +} \ No newline at end of file diff --git a/third_party/glslang/Test/validate-shaders.sh b/third_party/glslang/Test/validate-shaders.sh index c841969c51..be75618d3f 100755 --- a/third_party/glslang/Test/validate-shaders.sh +++ b/third_party/glslang/Test/validate-shaders.sh @@ -113,7 +113,7 @@ function FindLanguage() fi # If it doesn't start with spv., assume it's GLSL. - if [[ ! "$test" == spv.* && ! "$test" == remap.* ]]; then + if [[ ! "$test" == spv.* ]]; then echo glsl return fi diff --git a/third_party/glslang/Test/vk.relaxed.syntaxerror.frag b/third_party/glslang/Test/vk.relaxed.syntaxerror.frag new file mode 100644 index 0000000000..d18013b7e0 --- /dev/null +++ b/third_party/glslang/Test/vk.relaxed.syntaxerror.frag @@ -0,0 +1,23 @@ +#version 460 + +layout (location = 0) in vec4 io; + +out vec4 o; + +struct OpaqueInStruct +{ + sampler2D smp; +}; + +uniform OpaqueInStruct uniformStruct; + +vec4 foo(OpaqueInStruct); + +void main() { + o = io + foo(uniformStruct); +} + +vec4 foo(OpaqueInStruct sampler) { // unnamed variable and invalid SAMPLER token + return a + vec4(test); +} + diff --git a/third_party/glslang/Test/vk.relaxed.syntaxerror.vert b/third_party/glslang/Test/vk.relaxed.syntaxerror.vert new file mode 100644 index 0000000000..6f291b767d --- /dev/null +++ b/third_party/glslang/Test/vk.relaxed.syntaxerror.vert @@ -0,0 +1,7 @@ +#version 460 + +layout (location = 0) out vec4 io; + +void main() { + io = vec4(0.0); +} \ No newline at end of file diff --git a/third_party/glslang/Test/whileLoop.frag b/third_party/glslang/Test/whileLoop.frag index a9541f9179..0d98535d79 100644 --- a/third_party/glslang/Test/whileLoop.frag +++ b/third_party/glslang/Test/whileLoop.frag @@ -12,5 +12,9 @@ void main() color += bigColor; } + while (bool test = color.y < d) { + color += bigColor; + } + gl_FragColor = color; } diff --git a/third_party/glslang/glslang/CInterface/glslang_c_interface.cpp b/third_party/glslang/glslang/CInterface/glslang_c_interface.cpp index d391c1d044..1038eec3f6 100644 --- a/third_party/glslang/glslang/CInterface/glslang_c_interface.cpp +++ b/third_party/glslang/glslang/CInterface/glslang_c_interface.cpp @@ -351,6 +351,14 @@ GLSLANG_EXPORT void glslang_shader_set_preamble(glslang_shader_t* shader, const shader->shader->setPreamble(s); } +GLSLANG_EXPORT void glslang_shader_set_entry_point(glslang_shader_t* shader, const char* s) { + shader->shader->setEntryPoint(s); +} + +GLSLANG_EXPORT void glslang_shader_set_invert_y(glslang_shader_t* shader, bool y) { + shader->shader->setInvertY(y); +} + GLSLANG_EXPORT void glslang_shader_shift_binding(glslang_shader_t* shader, glslang_resource_type_t res, unsigned int base) { const glslang::TResourceType res_type = glslang::TResourceType(res); @@ -376,6 +384,10 @@ GLSLANG_EXPORT void glslang_shader_set_options(glslang_shader_t* shader, int opt if (options & GLSLANG_SHADER_VULKAN_RULES_RELAXED) { shader->shader->setEnvInputVulkanRulesRelaxed(); } + + if (options & GLSLANG_SHADER_BINDINGS_PER_RESOURCE_TYPE) { + shader->shader->setBindingsPerResourceType(); + } } GLSLANG_EXPORT void glslang_shader_set_glsl_version(glslang_shader_t* shader, int version) diff --git a/third_party/glslang/glslang/CMakeLists.txt b/third_party/glslang/glslang/CMakeLists.txt index eb1dc68e39..1bf4c1f2c2 100644 --- a/third_party/glslang/glslang/CMakeLists.txt +++ b/third_party/glslang/glslang/CMakeLists.txt @@ -173,7 +173,8 @@ set_target_properties(glslang PROPERTIES FOLDER glslang POSITION_INDEPENDENT_CODE ON VERSION "${GLSLANG_VERSION}" - SOVERSION "${GLSLANG_VERSION_MAJOR}") + SOVERSION "${GLSLANG_VERSION_MAJOR}" + COMPILE_DEFINITIONS "$<$,$>:GLSLANG_TEST_BUILD>") target_include_directories(glslang PUBLIC $ $) diff --git a/third_party/glslang/glslang/HLSL/hlslParseHelper.cpp b/third_party/glslang/glslang/HLSL/hlslParseHelper.cpp index 0732334055..3dbdcb8b46 100644 --- a/third_party/glslang/glslang/HLSL/hlslParseHelper.cpp +++ b/third_party/glslang/glslang/HLSL/hlslParseHelper.cpp @@ -801,9 +801,16 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc, return result; // it was handled as an operator[] bool flattened = false; - int indexValue = 0; - if (index->getQualifier().isFrontEndConstant()) - indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst(); + int64_t indexValue = 0; + if (index->getQualifier().isFrontEndConstant()) { + if (index->getType().contains64BitInt()) { + indexValue = index->getAsConstantUnion()->getConstArray()[0].getI64Const(); + } else if (index->getType().getBasicType() == EbtUint) { + indexValue = index->getAsConstantUnion()->getConstArray()[0].getUConst(); + } else { + indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst(); + } + } variableCheck(base); if (! base->isArray() && ! base->isMatrix() && ! base->isVector()) { diff --git a/third_party/glslang/glslang/Include/BaseTypes.h b/third_party/glslang/glslang/Include/BaseTypes.h index f0c8714286..e681ca0dc7 100644 --- a/third_party/glslang/glslang/Include/BaseTypes.h +++ b/third_party/glslang/glslang/Include/BaseTypes.h @@ -69,12 +69,14 @@ enum TBasicType { EbtReference, EbtRayQuery, EbtHitObjectNV, + EbtHitObjectEXT, EbtCoopmat, EbtFunction, EbtTensorLayoutNV, EbtTensorViewNV, EbtCoopvecNV, EbtTensorARM, + EbtLongVector, // SPIR-V type defined by spirv_type EbtSpirvType, @@ -111,6 +113,7 @@ enum TStorageQualifier { EvqCallableData, EvqCallableDataIn, EvqHitObjectAttrNV, + EvqHitObjectAttrEXT, EvqtaskPayloadSharedEXT, @@ -141,6 +144,10 @@ enum TStorageQualifier { EvqTileImageEXT, + // EXT_structured_descriptor_heap + EvqSamplerHeap, + EvqResourceHeap, + // end of list EvqLast }; @@ -351,6 +358,9 @@ enum TBuiltInVariable { EbvTileOffsetQCOM, EbvTileDimensionQCOM, EbvTileApronSizeQCOM, + // GL_EXT_descriptor_heap + EbvSamplerHeapEXT, + EbvResourceHeapEXT, EbvLast }; @@ -398,7 +408,8 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q) case EvqCallableData: return "callableDataNV"; break; case EvqCallableDataIn: return "callableDataInNV"; break; case EvqtaskPayloadSharedEXT: return "taskPayloadSharedEXT"; break; - case EvqHitObjectAttrNV:return "hitObjectAttributeNV"; break; + case EvqHitObjectAttrNV: return "hitObjectAttributeNV"; break; + case EvqHitObjectAttrEXT:return "hitObjectAttributeEXT"; break; default: return "unknown qualifier"; } } @@ -600,6 +611,22 @@ __inline bool isTypeUnsignedInt(TBasicType type) } } +__inline TBasicType unsignedTypeToSigned(TBasicType type) +{ + switch (type) { + case EbtUint8: + return EbtInt8; + case EbtUint16: + return EbtInt16; + case EbtUint: + return EbtInt; + case EbtUint64: + return EbtInt64; + default: + return type; + } +} + __inline bool isTypeInt(TBasicType type) { return isTypeSignedInt(type) || isTypeUnsignedInt(type); diff --git a/third_party/glslang/glslang/Include/PoolAlloc.h b/third_party/glslang/glslang/Include/PoolAlloc.h index 8a9284144a..6b6dfd64db 100644 --- a/third_party/glslang/glslang/Include/PoolAlloc.h +++ b/third_party/glslang/glslang/Include/PoolAlloc.h @@ -292,8 +292,7 @@ public: template pool_allocator(const pool_allocator& p) : allocator(p.getAllocator()) { } - - GLSLANG_EXPORT_FOR_TESTS + pointer allocate(size_type n) { return reinterpret_cast(getAllocator().allocate(n * sizeof(T))); } pointer allocate(size_type n, const void*) { diff --git a/third_party/glslang/glslang/Include/Types.h b/third_party/glslang/glslang/Include/Types.h index 735918011a..3fb0c55b54 100644 --- a/third_party/glslang/glslang/Include/Types.h +++ b/third_party/glslang/glslang/Include/Types.h @@ -130,6 +130,13 @@ struct TSampler { // misnomer now; includes images, textures without sampler, bool isTileAttachmentQCOM() const { return tileQCOM; } + // For combined sampler, returns the underlying texture. Otherwise, returns identity. + TSampler removeCombined() const { + TSampler result = *this; + result.combined = false; + return result; + } + void clear() { type = EbtVoid; @@ -238,9 +245,9 @@ struct TSampler { // misnomer now; includes images, textures without sampler, return ! operator==(right); } - TString getString() const + std::string getString() const { - TString s; + std::string s; if (isPureSampler()) { s.append("sampler"); @@ -510,6 +517,7 @@ public: spirvByReference = false; spirvLiteral = false; defaultBlock = false; + usedByAtomic = false; } // drop qualifiers that don't belong in a temporary variable @@ -529,6 +537,7 @@ public: spirvDecorate = nullptr; spirvByReference = false; spirvLiteral = false; + usedByAtomic = false; } void clearInterstage() @@ -610,6 +619,7 @@ public: bool nullInit : 1; bool spirvByReference : 1; bool spirvLiteral : 1; + bool usedByAtomic : 1; // EXT_descriptor_heap bool isWriteOnly() const { return writeonly; } bool isReadOnly() const { return readonly; } bool isRestrict() const { return restrict; } @@ -653,6 +663,8 @@ public: bool isSpirvByReference() const { return spirvByReference; } void setSpirvLiteral() { spirvLiteral = true; } bool isSpirvLiteral() const { return spirvLiteral; } + void setUsedByAtomic() { usedByAtomic = true; } + bool isUsedByAtomic() const { return usedByAtomic; } bool isPipeInput() const { @@ -818,6 +830,9 @@ public: bool isHitObjectAttrNV() const { return storage == EvqHitObjectAttrNV; } + bool isHitObjectAttrEXT() const { + return storage == EvqHitObjectAttrEXT; + } // True if this type of IO is supposed to be arrayed with extra level for per-vertex data bool isArrayedIo(EShLanguage language) const @@ -854,6 +869,7 @@ public: layoutFullQuads = false; layoutQuadDeriv = false; layoutHitObjectShaderRecordNV = false; + layoutHitObjectShaderRecordEXT = false; layoutBindlessSampler = false; layoutBindlessImage = false; layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd; @@ -864,6 +880,11 @@ public: clearInterstageLayout(); layoutSpecConstantId = layoutSpecConstantIdEnd; + layoutBank = layoutBankEnd; + layoutDescriptorHeap = false; + layoutDescriptorStride = layoutDescriptorStrideEnd; + layoutHeapOffset = 0; + layoutDescriptorInnerBlock = false; } void clearInterstageLayout() { @@ -905,6 +926,7 @@ public: TLayoutPacking layoutPacking : 4; int layoutOffset; int layoutAlign; + int layoutMemberOffset; unsigned int layoutLocation : 12; static const unsigned int layoutLocationEnd = 0xFFF; @@ -939,6 +961,12 @@ public: unsigned int layoutSpecConstantId : 11; static const unsigned int layoutSpecConstantIdEnd = 0x7FF; + unsigned int layoutBank : 4; + static const unsigned int layoutBankEnd = 0xF; + + unsigned int layoutDescriptorStride : 4; + static const unsigned int layoutDescriptorStrideEnd = 0x0; + // stored as log2 of the actual alignment value unsigned int layoutBufferReferenceAlign : 6; static const unsigned int layoutBufferReferenceAlignEnd = 0x3F; @@ -954,6 +982,10 @@ public: bool layoutFullQuads; bool layoutQuadDeriv; bool layoutHitObjectShaderRecordNV; + bool layoutHitObjectShaderRecordEXT; + bool layoutDescriptorHeap; + bool layoutDescriptorInnerBlock; + int layoutHeapOffset; // GL_EXT_spirv_intrinsics int spirvStorageClass; @@ -979,6 +1011,7 @@ public: layoutPacking = ElpNone; layoutOffset = layoutNotSet; layoutAlign = layoutNotSet; + layoutMemberOffset = layoutNotSet; layoutSet = layoutSetEnd; layoutBinding = layoutBindingEnd; @@ -1065,6 +1098,7 @@ public: bool isFullQuads() const { return layoutFullQuads; } bool isQuadDeriv() const { return layoutQuadDeriv; } bool hasHitObjectShaderRecordNV() const { return layoutHitObjectShaderRecordNV; } + bool hasHitObjectShaderRecordEXT() const { return layoutHitObjectShaderRecordEXT; } bool hasBufferReference() const { return layoutBufferReference; } bool hasBufferReferenceAlign() const { @@ -1102,6 +1136,14 @@ public: // is just whether or not it was declared with an ID. return layoutSpecConstantId != layoutSpecConstantIdEnd; } + bool hasBank() const + { + return layoutBank != layoutBankEnd; + } + bool hasMemberOffset() const + { + return layoutMemberOffset != layoutNotSet; + } bool isSpecConstant() const { // True if type is a specialization constant, whether or not it @@ -1501,6 +1543,7 @@ public: bool coopmatNV : 1; bool coopmatKHR : 1; bool coopvecNV : 1; + bool longVector : 1; bool tileAttachmentQCOM: 1; uint32_t tensorRankARM : 4; TArraySizes* arraySizes; @@ -1514,8 +1557,11 @@ public: bool isCoopmatNV() const { return coopmatNV; } bool isCoopmatKHR() const { return coopmatKHR; } bool isCoopvecNV() const { return coopvecNV; } + bool isCoopmatOrvec() const { return isCoopmat() || isCoopvecNV() || isLongVector(); } + bool isLongVector() const { return longVector; } + bool isCoopvecOrLongVector() const { return isCoopvecNV() || isLongVector(); } bool isTensorARM() const { return tensorRankARM; } - bool hasTypeParameter() const { return isCoopmat() || isCoopvecNV() || isTensorARM(); } + bool hasTypeParameter() const { return isCoopmat() || isCoopvecNV() || isLongVector() || isTensorARM(); } bool isTensorLayoutNV() const { return basicType == EbtTensorLayoutNV; } bool isTensorViewNV() const { return basicType == EbtTensorViewNV; } @@ -1533,6 +1579,7 @@ public: coopmatNV = false; coopmatKHR = false; coopvecNV = false; + longVector = false; tileAttachmentQCOM = false; tensorRankARM = 0; spirvType = nullptr; @@ -1594,7 +1641,7 @@ public: // for "empty" type (no args) or simple scalar/vector/matrix explicit TType(TBasicType t = EbtVoid, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0, bool isVector = false) : - basicType(t), vectorSize(static_cast(vs) & 0b1111), matrixCols(static_cast(mc) & 0b1111), matrixRows(static_cast(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), + basicType(t), vectorSize(static_cast(vs) & 0b1111), matrixCols(static_cast(mc) & 0b1111), matrixRows(static_cast(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), longVector(false), tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr), spirvType(nullptr) { @@ -1610,7 +1657,7 @@ public: // for explicit precision qualifier TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0, bool isVector = false) : - basicType(t), vectorSize(static_cast(vs) & 0b1111), matrixCols(static_cast(mc) & 0b1111), matrixRows(static_cast(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), + basicType(t), vectorSize(static_cast(vs) & 0b1111), matrixCols(static_cast(mc) & 0b1111), matrixRows(static_cast(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), longVector(false), tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr), spirvType(nullptr) { @@ -1628,7 +1675,7 @@ public: // for turning a TPublicType into a TType, using a shallow copy explicit TType(const TPublicType& p) : basicType(p.basicType), - vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(p.coopvecNV), + vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(p.coopvecNV), longVector(p.longVector), tileAttachmentQCOM(p.tileAttachmentQCOM), tensorRankARM(p.tensorRankARM), arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters), spirvType(p.spirvType) { @@ -1679,7 +1726,7 @@ public: coopmatKHRUseValid = true; } } - if (p.isCoopvecNV() && p.typeParameters) { + if ((p.isCoopvecNV() || p.isLongVector()) && p.typeParameters) { basicType = p.typeParameters->basicType; } if (p.isTensorARM() && p.typeParameters) { @@ -1691,7 +1738,7 @@ public: } // for construction of sampler types TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) : - basicType(EbtSampler), vectorSize(1u), matrixCols(0u), matrixRows(0u), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), + basicType(EbtSampler), vectorSize(1u), matrixCols(0u), matrixRows(0u), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), longVector(false), tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr), sampler(sampler), typeParameters(nullptr), spirvType(nullptr) { @@ -1734,12 +1781,13 @@ public: // dereference from vector to scalar vectorSize = 1; vector1 = false; - } else if (isCoopMat() || isCoopVecNV()) { + } else if (isCoopMat() || isCoopVecNV() || isLongVector()) { coopmatNV = false; coopmatKHR = false; coopmatKHRuse = 0; coopmatKHRUseValid = false; coopvecNV = false; + longVector = false; typeParameters = nullptr; } else if (isTileAttachmentQCOM()) { tileAttachmentQCOM = false; @@ -1749,7 +1797,7 @@ public: } // for making structures, ... TType(TTypeList* userDef, const TString& n) : - basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), + basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), longVector(false), tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr), spirvType(nullptr) { @@ -1759,7 +1807,7 @@ public: } // For interface blocks TType(TTypeList* userDef, const TString& n, const TQualifier& q) : - basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), + basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false), longVector(false), tileAttachmentQCOM(false), tensorRankARM(0), qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr), spirvType(nullptr) { @@ -1808,6 +1856,7 @@ public: coopmatKHRuse = copyOf.coopmatKHRuse; coopmatKHRUseValid = copyOf.coopmatKHRUseValid; coopvecNV = copyOf.isCoopVecNV(); + longVector = copyOf.isLongVector(); tileAttachmentQCOM = copyOf.tileAttachmentQCOM; tensorRankARM = copyOf.tensorRankARM; } @@ -1849,6 +1898,7 @@ public: return *typeName; } + virtual bool hasFieldName() const { return (fieldName != nullptr); } virtual const TString& getFieldName() const { assert(fieldName); @@ -1893,7 +1943,7 @@ public: virtual const TTypeParameters* getTypeParameters() const { return typeParameters; } virtual TTypeParameters* getTypeParameters() { return typeParameters; } - virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray() && ! isCoopVecNV(); } + virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray() && ! isCoopVecNV() && ! isLongVector(); } virtual bool isScalarOrVec1() const { return isScalar() || vector1; } virtual bool isScalarOrVector() const { return !isMatrix() && !isStruct() && !isArray(); } virtual bool isVector() const { return vectorSize > 1u || vector1; } @@ -1929,7 +1979,7 @@ public: } virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtRayQuery - || basicType == EbtHitObjectNV || isTileAttachmentQCOM() + || basicType == EbtHitObjectNV || basicType == EbtHitObjectEXT || isTileAttachmentQCOM() || isTensorARM(); } virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; } @@ -1948,9 +1998,12 @@ public: bool isCoopMatNV() const { return coopmatNV; } bool isCoopMatKHR() const { return coopmatKHR; } bool isCoopVecNV() const { return coopvecNV; } + bool isCoopMatOrVec() const { return isCoopMat() || isCoopVecNV() || isLongVector(); } + bool isLongVector() const { return longVector; } + bool isCoopVecOrLongVector() const { return isCoopVecNV() || isLongVector(); } bool isTileAttachmentQCOM() const { return tileAttachmentQCOM; } bool isTensorARM() const { return tensorRankARM; } - bool hasTypeParameter() const { return isCoopMat() || isCoopVecNV() || isTensorARM(); } + bool hasTypeParameter() const { return isCoopMat() || isCoopVecNV() || isLongVector() || isTensorARM(); } int getTensorRankARM() const { return static_cast(tensorRankARM); } bool isReference() const { return getBasicType() == EbtReference; } bool isSpirvType() const { return getBasicType() == EbtSpirvType; } @@ -1983,6 +2036,22 @@ public: return contains([](const TType* t) { return t->isArray(); } ); } + // Recursively check the structure for any arrays, needed for some error checks + virtual bool containsHeapArray() const + { + const auto containsResourceArray = [](const TType* t) { + return (t->isArray() && + (t->isImage() || t->isTexture() || t->getBasicType() == EbtSampler || + t->getBasicType() == EbtAccStruct || + t->getQualifier().storage == EvqUniform || + t->getQualifier().storage == EvqResourceHeap || + t->getQualifier().storage == EvqSamplerHeap || + t->getQualifier().storage == EvqBuffer)); + }; + + return contains(containsResourceArray); + } + // Check the structure for any structures, needed for some error checks virtual bool containsStructure() const { @@ -2063,6 +2132,10 @@ public: { return containsBasicType(EbtBFloat16); } + bool contains8BitFloat() const + { + return containsBasicType(EbtFloatE5M2) || containsBasicType(EbtFloatE4M3); + } bool contains64BitInt() const { return containsBasicType(EbtInt64) || containsBasicType(EbtUint64); @@ -2083,6 +2156,10 @@ public: { return contains([](const TType* t) { return t->coopvecNV; } ); } + bool containsLongVector() const + { + return contains([](const TType* t) { return t->longVector; } ); + } bool containsReference() const { return containsBasicType(EbtReference); @@ -2207,6 +2284,7 @@ public: case EbtTensorViewNV: return "tensorViewNV"; case EbtCoopvecNV: return "coopvecNV"; case EbtTensorARM: return "tensorARM"; + case EbtLongVector: return "vector"; default: return "unknown type"; } } @@ -2321,12 +2399,32 @@ public: appendStr(" quad_derivatives"); if (qualifier.layoutHitObjectShaderRecordNV) appendStr(" hitobjectshaderrecordnv"); + if (qualifier.layoutHitObjectShaderRecordEXT) + appendStr(" hitobjectshaderrecordext"); + + if (qualifier.hasBank()) { + appendStr(" bank="); + appendUint(qualifier.layoutBank); + } + if (qualifier.hasMemberOffset()) { + appendStr(" member_offset="); + appendInt(qualifier.layoutMemberOffset); + } if (qualifier.layoutBindlessSampler) appendStr(" layoutBindlessSampler"); if (qualifier.layoutBindlessImage) appendStr(" layoutBindlessImage"); + if (qualifier.layoutDescriptorHeap) + appendStr(" descriptor_heap"); + if (qualifier.layoutDescriptorStride != TQualifier::layoutDescriptorStrideEnd) { + appendStr(" descriptor_stride="); + appendInt(qualifier.layoutDescriptorStride); + } + if (qualifier.layoutHeapOffset) + appendStr(" heap_offset="); + appendStr(")"); } } @@ -2531,6 +2629,10 @@ public: appendStr(" "); appendStr("coopvecNV"); } + if (isLongVector()) { + appendStr(" "); + appendStr("vector"); + } appendStr("<"); for (int i = 0; i < (int)typeParameters->arraySizes->getNumDims(); ++i) { @@ -2590,7 +2692,7 @@ public: TString getBasicTypeString() const { if (basicType == EbtSampler) - return sampler.getString(); + return TString{sampler.getString()}; else return getBasicString(); } @@ -2612,7 +2714,7 @@ public: { uint32_t components = 0; - if (isCoopVecNV()) { + if (isCoopVecOrLongVector()) { components = typeParameters->arraySizes->getDimSize(0); } else if (getBasicType() == EbtStruct || getBasicType() == EbtBlock) { for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++) @@ -2629,6 +2731,10 @@ public: return static_cast(components); } + bool hasSpecConstantVectorComponents() const { + return getTypeParameters() && getTypeParameters()->arraySizes->getDimNode(0) != nullptr; + } + // append this type's mangled name to the passed in 'name' void appendMangledName(TString& name) const { @@ -2819,6 +2925,7 @@ public: isCoopMatNV() == right.isCoopMatNV() && isCoopMatKHR() == right.isCoopMatKHR() && isCoopVecNV() == right.isCoopVecNV() && + isLongVector() == right.isLongVector() && isTensorARM() == right.isTensorARM() && sameStructType(right, lpidx, rpidx) && sameReferenceType(right); @@ -2915,6 +3022,26 @@ public: return rv; } + bool sameLongVectorBaseType(const TType &right) const { + bool rv = false; + + if (isLongVector() && right.isLongVector()) { + if (isFloatingDomain()) + rv = right.isFloatingDomain() || right.getBasicType() == EbtLongVector; + else if (isTypeUnsignedInt(getBasicType())) + rv = isTypeUnsignedInt(right.getBasicType()) || right.getBasicType() == EbtLongVector; + else if (isTypeSignedInt(getBasicType())) + rv = isTypeSignedInt(right.getBasicType()) || right.getBasicType() == EbtLongVector; + else if (getBasicType() == EbtBool) + rv = right.getBasicType() == EbtBool || right.getBasicType() == EbtLongVector; + else if (getBasicType() == EbtLongVector) + rv = right.isLongVector(); + else + rv = false; + } + return rv; + } + bool sameCoopMatUse(const TType &right) const { return coopmatKHRuse == right.coopmatKHRuse; } @@ -2945,6 +3072,31 @@ public: return true; } + bool sameLongVectorShape(const TType &right) const + { + if (!isLongVector() || !right.isLongVector() || !typeParameters || !right.typeParameters) + return false; + + return typeParameters->arraySizes->getDimSize(0) == right.typeParameters->arraySizes->getDimSize(0); + } + + static bool vectorAndLongVectorMatch(const TType &left, const TType &right) + { + if (left.isVector() && right.isLongVector() && + right.getTypeParameters() && + !right.hasSpecConstantVectorComponents() && + left.getVectorSize() == right.getTypeParameters()->arraySizes->getDimSize(0)) { + return true; + } + if (right.isVector() && left.isLongVector() && + left.getTypeParameters() && + !left.hasSpecConstantVectorComponents() && + right.getVectorSize() == left.getTypeParameters()->arraySizes->getDimSize(0)) { + return true; + } + return false; + } + // See if two types match in all ways (just the actual type, not qualification) bool operator==(const TType& right) const { @@ -3045,6 +3197,7 @@ protected: uint32_t coopmatKHRuse : 3; // Accepts one of three values: 0, 1, 2 (gl_MatrixUseA, gl_MatrixUseB, gl_MatrixUseAccumulator) bool coopmatKHRUseValid : 1; // True if coopmatKHRuse has been set bool coopvecNV : 1; + bool longVector : 1; bool tileAttachmentQCOM : 1; uint32_t tensorRankARM : 4; // 0 means not a tensor; non-zero indicates the tensor rank. TQualifier qualifier; diff --git a/third_party/glslang/glslang/Include/arrays.h b/third_party/glslang/glslang/Include/arrays.h index 91e1908355..261af68377 100644 --- a/third_party/glslang/glslang/Include/arrays.h +++ b/third_party/glslang/glslang/Include/arrays.h @@ -66,6 +66,7 @@ struct TArraySize { return SameSpecializationConstants(node, rhs.node); } + bool operator!=(const TArraySize& rhs) const { return !(*this == rhs); } }; // @@ -198,6 +199,12 @@ struct TSmallArrayVector { } bool operator!=(const TSmallArrayVector& rhs) const { return ! operator==(rhs); } + const TArraySize& operator[](int index) const + { + assert(sizes && index < (int)sizes->size()); + return (*sizes)[index]; + } + protected: TSmallArrayVector(const TSmallArrayVector&); @@ -336,6 +343,10 @@ struct TArraySizes { return true; } + const TArraySize& getArraySize(int index) const + { + return sizes[index]; + } void setVariablyIndexed() { variablyIndexed = true; } bool isVariablyIndexed() const { return variablyIndexed; } diff --git a/third_party/glslang/glslang/Include/glslang_c_interface.h b/third_party/glslang/glslang/Include/glslang_c_interface.h index 06120219df..4eec55b582 100644 --- a/third_party/glslang/glslang/Include/glslang_c_interface.h +++ b/third_party/glslang/glslang/Include/glslang_c_interface.h @@ -253,6 +253,8 @@ GLSLANG_EXPORT void glslang_finalize_process(void); GLSLANG_EXPORT glslang_shader_t* glslang_shader_create(const glslang_input_t* input); GLSLANG_EXPORT void glslang_shader_delete(glslang_shader_t* shader); GLSLANG_EXPORT void glslang_shader_set_preamble(glslang_shader_t* shader, const char* s); +GLSLANG_EXPORT void glslang_shader_set_entry_point(glslang_shader_t* shader, const char* s); +GLSLANG_EXPORT void glslang_shader_set_invert_y(glslang_shader_t* shader, bool y); GLSLANG_EXPORT void glslang_shader_shift_binding(glslang_shader_t* shader, glslang_resource_type_t res, unsigned int base); GLSLANG_EXPORT void glslang_shader_shift_binding_for_set(glslang_shader_t* shader, glslang_resource_type_t res, unsigned int base, unsigned int set); GLSLANG_EXPORT void glslang_shader_set_options(glslang_shader_t* shader, int options); // glslang_shader_options_t diff --git a/third_party/glslang/glslang/Include/glslang_c_shader_types.h b/third_party/glslang/glslang/Include/glslang_c_shader_types.h index 34bfbdb9d3..1b70645fe3 100644 --- a/third_party/glslang/glslang/Include/glslang_c_shader_types.h +++ b/third_party/glslang/glslang/Include/glslang_c_shader_types.h @@ -213,6 +213,7 @@ typedef enum { GLSLANG_SHADER_AUTO_MAP_BINDINGS = (1 << 0), GLSLANG_SHADER_AUTO_MAP_LOCATIONS = (1 << 1), GLSLANG_SHADER_VULKAN_RULES_RELAXED = (1 << 2), + GLSLANG_SHADER_BINDINGS_PER_RESOURCE_TYPE = (1 << 3), LAST_ELEMENT_MARKER(GLSLANG_SHADER_COUNT), } glslang_shader_options_t; @@ -224,6 +225,9 @@ typedef enum { GLSLANG_RESOURCE_TYPE_UBO, GLSLANG_RESOURCE_TYPE_SSBO, GLSLANG_RESOURCE_TYPE_UAV, + GLSLANG_RESOURCE_TYPE_COMBINED_SAMPLER, + GLSLANG_RESOURCE_TYPE_AS, + GLSLANG_RESOURCE_TYPE_TENSOR, LAST_ELEMENT_MARKER(GLSLANG_RESOURCE_TYPE_COUNT), } glslang_resource_type_t; diff --git a/third_party/glslang/glslang/Include/intermediate.h b/third_party/glslang/glslang/Include/intermediate.h index 1c77de3452..9e520dee7a 100644 --- a/third_party/glslang/glslang/Include/intermediate.h +++ b/third_party/glslang/glslang/Include/intermediate.h @@ -875,6 +875,44 @@ enum TOperator { EOpFetchMicroTriangleVertexPositionNV, EOpFetchMicroTriangleVertexBarycentricNV, + // + // GL_EXT_shader_invocation_reorder + // + + EOpHitObjectTraceRayEXT, + EOpHitObjectTraceRayMotionEXT, + EOpHitObjectRecordMissEXT, + EOpHitObjectRecordMissMotionEXT, + EOpHitObjectRecordEmptyEXT, + EOpHitObjectExecuteShaderEXT, + EOpHitObjectIsEmptyEXT, + EOpHitObjectIsMissEXT, + EOpHitObjectIsHitEXT, + EOpHitObjectGetRayTMinEXT, + EOpHitObjectGetRayTMaxEXT, + EOpHitObjectGetRayFlagsEXT, + EOpHitObjectGetObjectRayOriginEXT, + EOpHitObjectGetObjectRayDirectionEXT, + EOpHitObjectGetWorldRayOriginEXT, + EOpHitObjectGetWorldRayDirectionEXT, + EOpHitObjectGetWorldToObjectEXT, + EOpHitObjectGetObjectToWorldEXT, + EOpHitObjectGetInstanceCustomIndexEXT, + EOpHitObjectGetInstanceIdEXT, + EOpHitObjectGetGeometryIndexEXT, + EOpHitObjectGetPrimitiveIndexEXT, + EOpHitObjectGetHitKindEXT, + EOpHitObjectGetShaderBindingTableRecordIndexEXT, + EOpHitObjectSetShaderBindingTableRecordIndexEXT, + EOpHitObjectGetShaderRecordBufferHandleEXT, + EOpHitObjectGetAttributesEXT, + EOpHitObjectGetCurrentTimeEXT, + EOpReorderThreadEXT, + EOpHitObjectReorderExecuteEXT, + EOpHitObjectTraceReorderExecuteEXT, + EOpHitObjectTraceMotionReorderExecuteEXT, + EOpHitObjectRecordFromQueryEXT, + EOpHitObjectGetIntersectionTriangleVertexPositionsEXT, // HLSL operations // @@ -985,6 +1023,12 @@ enum TOperator { EOpImageBlockMatchGatherSSDQCOM, EOpImageBlockMatchGatherSADQCOM, + // Cooperative Matrix Conversion + EOpBitCastArrayQCOM, + EOpExtractSubArrayQCOM, + EOpCompositeConstructCoopMatQCOM, + EOpCompositeExtractCoopMatQCOM, + // GL_NV_cluster_acceleration_structure EOpRayQueryGetIntersectionClusterIdNV, EOpHitObjectGetClusterIdNV, @@ -1015,6 +1059,7 @@ enum TLinkType { }; class TIntermTraverser; +class TIntermVariableDecl; class TIntermOperator; class TIntermAggregate; class TIntermUnary; @@ -1043,6 +1088,7 @@ public: virtual const glslang::TSourceLoc& getLoc() const { return loc; } virtual void setLoc(const glslang::TSourceLoc& l) { loc = l; } virtual void traverse(glslang::TIntermTraverser*) = 0; + virtual glslang::TIntermVariableDecl* getAsVariableDecl() { return nullptr; } virtual glslang::TIntermTyped* getAsTyped() { return nullptr; } virtual glslang::TIntermOperator* getAsOperator() { return nullptr; } virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return nullptr; } @@ -1056,6 +1102,7 @@ public: virtual glslang::TIntermBranch* getAsBranchNode() { return nullptr; } virtual glslang::TIntermLoop* getAsLoopNode() { return nullptr; } + virtual const glslang::TIntermVariableDecl* getAsVariableDecl() const { return nullptr; } virtual const glslang::TIntermTyped* getAsTyped() const { return nullptr; } virtual const glslang::TIntermOperator* getAsOperator() const { return nullptr; } virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return nullptr; } @@ -1086,6 +1133,37 @@ struct TIntermNodePair { TIntermNode* node2; }; +// +// Represent declaration of a variable. +// +class TIntermVariableDecl : public TIntermNode { +public: + TIntermVariableDecl(TIntermSymbol* declSymbol, TIntermNode* initNode) : declSymbol(declSymbol), initNode(initNode) + { + } + TIntermVariableDecl(const TIntermVariableDecl&) = delete; + TIntermVariableDecl& operator=(const TIntermVariableDecl&) = delete; + + void traverse(glslang::TIntermTraverser* traverser) override; + + TIntermVariableDecl* getAsVariableDecl() override { return this; } + const TIntermVariableDecl* getAsVariableDecl() const override { return this; } + + TIntermSymbol* getDeclSymbol() { return declSymbol; } + const TIntermSymbol* getDeclSymbol() const { return declSymbol; } + + TIntermNode* getInitNode() { return initNode; } + const TIntermNode* getInitNode() const { return initNode; } + +private: + // This symbol represents the declared variable at its declaration point. + // It's not traversed by default. To traverse it, the visitor needs to have includeDeclSymbol enabled. + TIntermSymbol* declSymbol = nullptr; + + // The initializer + TIntermNode* initNode = nullptr; +}; + // // Intermediate class for nodes that have a type. // @@ -1130,7 +1208,7 @@ protected: // class TIntermLoop : public TIntermNode { public: - TIntermLoop(TIntermNode* aBody, TIntermTyped* aTest, TIntermTyped* aTerminal, bool testFirst) : + TIntermLoop(TIntermNode* aBody, TIntermNode* aTest, TIntermTyped* aTerminal, bool testFirst) : body(aBody), test(aTest), terminal(aTerminal), @@ -1149,10 +1227,20 @@ public: virtual const TIntermLoop* getAsLoopNode() const { return this; } virtual void traverse(TIntermTraverser*); TIntermNode* getBody() const { return body; } - TIntermTyped* getTest() const { return test; } + TIntermNode* getTest() const { return test; } TIntermTyped* getTerminal() const { return terminal; } bool testFirst() const { return first; } + // Because the test node can be a declaration in a while loop, this function unwraps it to get the actual expression. + TIntermTyped* getTestExpr() const { + if (auto decl = test->getAsVariableDecl()) { + return decl->getInitNode()->getAsTyped(); + } + else { + return test->getAsTyped(); + } + } + void setUnroll() { unroll = true; } void setDontUnroll() { dontUnroll = true; @@ -1186,7 +1274,7 @@ public: protected: TIntermNode* body; // code to loop over - TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops + TIntermNode* test; // exit condition associated with loop, could be 0 for 'for' loops TIntermTyped* terminal; // exists for for-loops bool first; // true for while and for, not for do-while bool unroll; // true if unroll requested @@ -1747,24 +1835,26 @@ enum TVisit class TIntermTraverser { public: POOL_ALLOCATOR_NEW_DELETE(glslang::GetThreadPoolAllocator()) - TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false) : + TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false, bool includeDeclSymbol = false) : preVisit(preVisit), inVisit(inVisit), postVisit(postVisit), rightToLeft(rightToLeft), + includeDeclSymbol(includeDeclSymbol), depth(0), maxDepth(0) { } virtual ~TIntermTraverser() { } - virtual void visitSymbol(TIntermSymbol*) { } - virtual void visitConstantUnion(TIntermConstantUnion*) { } - virtual bool visitBinary(TVisit, TIntermBinary*) { return true; } - virtual bool visitUnary(TVisit, TIntermUnary*) { return true; } - virtual bool visitSelection(TVisit, TIntermSelection*) { return true; } - virtual bool visitAggregate(TVisit, TIntermAggregate*) { return true; } - virtual bool visitLoop(TVisit, TIntermLoop*) { return true; } - virtual bool visitBranch(TVisit, TIntermBranch*) { return true; } - virtual bool visitSwitch(TVisit, TIntermSwitch*) { return true; } + virtual void visitSymbol(TIntermSymbol*) { } + virtual void visitConstantUnion(TIntermConstantUnion*) { } + virtual bool visitBinary(TVisit, TIntermBinary*) { return true; } + virtual bool visitUnary(TVisit, TIntermUnary*) { return true; } + virtual bool visitSelection(TVisit, TIntermSelection*) { return true; } + virtual bool visitAggregate(TVisit, TIntermAggregate*) { return true; } + virtual bool visitLoop(TVisit, TIntermLoop*) { return true; } + virtual bool visitBranch(TVisit, TIntermBranch*) { return true; } + virtual bool visitSwitch(TVisit, TIntermSwitch*) { return true; } + virtual bool visitVariableDecl(TVisit, TIntermVariableDecl*) { return true; } int getMaxDepth() const { return maxDepth; } @@ -1791,6 +1881,11 @@ public: const bool postVisit; const bool rightToLeft; + // Whether to traverse declaration symbols in the traversal. + // By default, declaration symbols are not visited in the traversal to avoid + // visiting them in SPIR-V generation where they are not needed. + const bool includeDeclSymbol; + protected: TIntermTraverser& operator=(TIntermTraverser&); diff --git a/third_party/glslang/glslang/Include/visibility.h b/third_party/glslang/glslang/Include/visibility.h index 9bb8f3faaa..dd32351f83 100644 --- a/third_party/glslang/glslang/Include/visibility.h +++ b/third_party/glslang/glslang/Include/visibility.h @@ -51,4 +51,8 @@ // Symbols marked with this macro are only meant for public use by the test suite // and do not appear in publicly installed headers. They are not considered to be // part of the glslang library ABI. -#define GLSLANG_EXPORT_FOR_TESTS GLSLANG_EXPORT +#ifdef GLSLANG_TEST_BUILD + #define GLSLANG_EXPORT_FOR_TESTS GLSLANG_EXPORT +#else + #define GLSLANG_EXPORT_FOR_TESTS +#endif diff --git a/third_party/glslang/glslang/MachineIndependent/Initialize.cpp b/third_party/glslang/glslang/MachineIndependent/Initialize.cpp index d199cd51f5..546d8af854 100644 --- a/third_party/glslang/glslang/MachineIndependent/Initialize.cpp +++ b/third_party/glslang/glslang/MachineIndependent/Initialize.cpp @@ -394,6 +394,83 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function) } } +// Add long vector prototype for the builtin function. This is similar to +// AddTabledBuiltin, but only generates builtins where one type is an +// arbitrary vector. See comments on "enum ArgClass" for more details. +void AddLongVectorBuiltin(TString& decls, const BuiltInFunction& function) +{ + const auto isScalarType = [](int type) { return (type & TypeStringColumnMask) == 0; }; + + // loop across these two: + // 0: the varying arg set, and + // 1: the fixed scalar args + const ArgClass ClassFixed = (ArgClass)(ClassLS | ClassXLS | ClassLS2 | ClassFS | ClassFS2); + for (int fixed = 0; fixed < ((function.classes & ClassFixed) > 0 ? 2 : 1); ++fixed) { + + if (fixed == 0 && (function.classes & ClassXLS)) + continue; + + // Iterate over the different scalar types (needed for ClassRS) + for (int type = 0; type < TypeStringCount; ++type) { + if (!isScalarType(type)) + continue; + + // skip types not selected: go from type to row number to type bit + if ((function.types & (1 << (type >> TypeStringRowShift))) == 0) + continue; + + // skip scalar-only + if (function.classes & ClassV1) + continue; + + // skip 3-vector + if (function.classes & ClassV3) + continue; + + TString decl; + // return type + if (function.classes & ClassB) + decl.append("vector"); + else if (function.classes & ClassRS) + decl.append(TypeString[type & TypeStringScalarMask]); + else + decl.append("vector"); + decl.append(" "); + decl.append(function.name); + decl.append("("); + + // arguments + for (int arg = 0; arg < function.numArguments; ++arg) { + if (arg == function.numArguments - 1 && (function.classes & ClassLO)) + decl.append("out "); + if (arg == 0) { + if (function.classes & ClassCVN) + decl.append("coherent volatile nontemporal "); + if (function.classes & ClassFIO) + decl.append("inout "); + if (function.classes & ClassFO) + decl.append("out "); + } + if ((function.classes & ClassLB) && arg == function.numArguments - 1) + decl.append("vector"); + else if (fixed && ((arg == function.numArguments - 1 && (function.classes & (ClassLS | ClassXLS | + ClassLS2))) || + (arg == function.numArguments - 2 && (function.classes & ClassLS2)) || + (arg == 0 && (function.classes & (ClassFS | ClassFS2))) || + (arg == 1 && (function.classes & ClassFS2)))) + decl.append(TypeString[type & TypeStringScalarMask]); + else + decl.append("vector"); + if (arg < function.numArguments - 1) + decl.append(","); + } + decl.append(");\n"); + + decls.append(decl); + } + } +} + // See if the tabled versioning information allows the current version. bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile, const SpvVersion& /* spVersion */) { @@ -432,8 +509,12 @@ void TBuiltIns::addTabledBuiltins(int version, EProfile profile, const SpvVersio { const auto forEachFunction = [&](TString& decls, const span& functions) { for (const auto& fn : functions) { - if (ValidVersion(fn, version, profile, spvVersion)) + if (ValidVersion(fn, version, profile, spvVersion)) { AddTabledBuiltin(decls, fn); + if (profile != EEsProfile) { + AddLongVectorBuiltin(decls, fn); + } + } } }; @@ -2498,6 +2579,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV snprintf(buf, bufSize, op, intTypes[j], intTypes[j]); commonBuiltins.append(buf); } + snprintf(buf, bufSize, op, "vector", "vector"); + commonBuiltins.append(buf); } stageBuiltins[EShLangCompute].append( @@ -4830,17 +4913,19 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "uint", "uvec2", "uvec4", "uint64_t", "u64vec2", "u64vec4", }; - for (auto t : allTypes) { - cooperativeMatrixFuncs << "void coopMatLoad(out coopmat m, volatile coherent nontemporal " << t << "[] buf, uint element, uint stride, int matrixLayout);\n"; - cooperativeMatrixFuncs << "void coopMatStore(coopmat m, volatile coherent nontemporal " << t << "[] buf, uint element, uint stride, int matrixLayout);\n"; + for (auto elemTy : {"uint", "uint64_t"}) { + for (auto t : allTypes) { + cooperativeMatrixFuncs << "void coopMatLoad(out coopmat m, volatile coherent nontemporal " << t << "[] buf, " << elemTy << " element, uint stride, int matrixLayout);\n"; + cooperativeMatrixFuncs << "void coopMatStore(coopmat m, volatile coherent nontemporal " << t << "[] buf, " << elemTy << " element, uint stride, int matrixLayout);\n"; + } + // Just use uint8_t for buffer type, we have special matching rules to allow any conversion + cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent nontemporal uint8_t[] buf, " << elemTy << " element, tensorLayoutNV t);\n"; + cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent nontemporal uint8_t[] buf, " << elemTy << " element, tensorLayoutNV t, tensorViewNV v);\n"; + cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent nontemporal uint8_t[] buf, " << elemTy << " element, tensorLayoutNV t, __function f);\n"; + cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent nontemporal uint8_t[] buf, " << elemTy << " element, tensorLayoutNV t, tensorViewNV v, __function f);\n"; + cooperativeMatrixFuncs << "void coopMatStoreTensorNV(coopmat m, volatile coherent nontemporal uint8_t[] buf, " << elemTy << " element, tensorLayoutNV t);\n"; + cooperativeMatrixFuncs << "void coopMatStoreTensorNV(coopmat m, volatile coherent nontemporal uint8_t[] buf, " << elemTy << " element, tensorLayoutNV t, tensorViewNV v);\n"; } - // Just use uint8_t for buffer type, we have special matching rules to allow any conversion - cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent nontemporal uint8_t[] buf, uint element, tensorLayoutNV t);\n"; - cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent nontemporal uint8_t[] buf, uint element, tensorLayoutNV t, tensorViewNV v);\n"; - cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent nontemporal uint8_t[] buf, uint element, tensorLayoutNV t, __function f);\n"; - cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent nontemporal uint8_t[] buf, uint element, tensorLayoutNV t, tensorViewNV v, __function f);\n"; - cooperativeMatrixFuncs << "void coopMatStoreTensorNV(coopmat m, volatile coherent nontemporal uint8_t[] buf, uint element, tensorLayoutNV t);\n"; - cooperativeMatrixFuncs << "void coopMatStoreTensorNV(coopmat m, volatile coherent nontemporal uint8_t[] buf, uint element, tensorLayoutNV t, tensorViewNV v);\n"; } cooperativeMatrixFuncs << @@ -4884,6 +4969,31 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n" ); + { + std::stringstream coopMatConvFuncs; + + const std::string eltTypes[] = {"uint32_t", "uint", "int32_t", "int", "float32_t", "float", "float16_t"}; + + for (auto srcEltTy : eltTypes) { + for (auto dstEltTy : eltTypes) { + coopMatConvFuncs << "void bitcastQCOM(" << srcEltTy.c_str() << " SrcArr[], " << dstEltTy.c_str() + << " DstArr[]);\n"; + } + } + coopMatConvFuncs << "\n"; + + for (auto eltTy : {"float32_t", "float16_t", "int8_t", "uint8_t", "uint32_t", "uint", "int32_t", "int"}) { + coopMatConvFuncs << "void vectorToCoopmatQCOM(" << eltTy << " SrcVec[], coopmat CM);\n"; + coopMatConvFuncs << "void coopmatToVectorQCOM(coopmat CM, " << eltTy << " Dstvec[]);\n"; + } + + for (auto eltTy : {"uint32_t", "uint", "int32_t", "int", "float32_t", "float", "float16_t"}) { + coopMatConvFuncs << "void extractSubArrayQCOM(" << eltTy << " arr[], uint index, " << eltTy << " subarr[]);\n"; + } + + commonBuiltins.append(coopMatConvFuncs.str().c_str()); + } + commonBuiltins.append( "tensorLayoutNV createTensorLayoutNV(uint Dim);\n" "tensorLayoutNV createTensorLayoutNV(uint Dim, uint Mode);\n" @@ -4976,49 +5086,54 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "float32_t", "float64_t", }; - for (uint32_t i = 0; i < sizeof(basicTypes)/sizeof(basicTypes[0]); ++i) { - std::string func = std::string("void coopVecMatMulNV(out coopvecNV result, ") + - std::string("coopvecNV v, ") + - std::string("int inputInterpretation, ") + - std::string(basicTypes[i]) + std::string("[] matrix, ") + - std::string("uint matrixOffset, ") + - std::string("int matrixInterpretation, ") + - std::string("uint M, ") + - std::string("uint K, ") + - std::string("int matrixLayout, ") + - std::string("bool transpose, ") + - std::string("uint matrixStride);\n"); - commonBuiltins.append(func.c_str()); + std::string coopVecOffsetTypes[] = { + "uint", + "uint64_t", + }; + for (auto offsetTy : coopVecOffsetTypes) { + for (uint32_t i = 0; i < sizeof(basicTypes)/sizeof(basicTypes[0]); ++i) { + std::string func = std::string("void coopVecMatMulNV(out coopvecNV result, ") + + std::string("coopvecNV v, ") + + std::string("int inputInterpretation, ") + + std::string(basicTypes[i]) + std::string("[] matrix, ") + + offsetTy + std::string(" matrixOffset, ") + + std::string("int matrixInterpretation, ") + + std::string("uint M, ") + + std::string("uint K, ") + + std::string("int matrixLayout, ") + + std::string("bool transpose, ") + + std::string("uint matrixStride);\n"); + commonBuiltins.append(func.c_str()); - for (uint32_t j = 0; j < sizeof(basicTypes)/sizeof(basicTypes[0]); ++j) { - func = std::string("void coopVecMatMulAddNV(out coopvecNV result, ") + - std::string("coopvecNV v, ") + - std::string("int inputInterpretation, ") + - std::string(basicTypes[i]) + std::string("[] matrix, ") + - std::string("uint matrixOffset, ") + - std::string("int matrixInterpretation, ") + - std::string(basicTypes[j]) + std::string("[] bias, ") + - std::string("uint biasOffset, ") + - std::string("int biasInterpretation, ") + - std::string("uint M, ") + - std::string("uint K, ") + - std::string("int matrixLayout, ") + - std::string("bool transpose, ") + - std::string("uint matrixStride);\n"); + for (uint32_t j = 0; j < sizeof(basicTypes)/sizeof(basicTypes[0]); ++j) { + func = std::string("void coopVecMatMulAddNV(out coopvecNV result, ") + + std::string("coopvecNV v, ") + + std::string("int inputInterpretation, ") + + std::string(basicTypes[i]) + std::string("[] matrix, ") + + offsetTy + std::string(" matrixOffset, ") + + std::string("int matrixInterpretation, ") + + std::string(basicTypes[j]) + std::string("[] bias, ") + + offsetTy + std::string(" biasOffset, ") + + std::string("int biasInterpretation, ") + + std::string("uint M, ") + + std::string("uint K, ") + + std::string("int matrixLayout, ") + + std::string("bool transpose, ") + + std::string("uint matrixStride);\n"); + commonBuiltins.append(func.c_str()); + } + + func = std::string("void coopVecOuterProductAccumulateNV(coopvecNV v1, coopvecNV v2, ") + + std::string(basicTypes[i]) + + std::string("[] buf, ") + offsetTy + std::string(" offset, uint stride, int matrixLayout, int matrixInterpretation);\n"); + commonBuiltins.append(func.c_str()); + + func = std::string("void coopVecReduceSumAccumulateNV(coopvecNV v, ") + + std::string(basicTypes[i]) + + std::string("[] buf, ") + offsetTy + std::string(" offset);\n"); commonBuiltins.append(func.c_str()); } - - func = std::string("void coopVecOuterProductAccumulateNV(coopvecNV v1, coopvecNV v2, ") + - std::string(basicTypes[i]) + - std::string("[] buf, uint offset, uint stride, int matrixLayout, int matrixInterpretation);\n"); - commonBuiltins.append(func.c_str()); - - func = std::string("void coopVecReduceSumAccumulateNV(coopvecNV v, ") + - std::string(basicTypes[i]) + - std::string("[] buf, uint offset);\n"); - commonBuiltins.append(func.c_str()); } - std::string cooperativeVectorFuncs = "coopvecNV fma(coopvecNV, coopvecNV, coopvecNV);\n" "coopvecNV min(coopvecNV, coopvecNV);\n" @@ -5028,12 +5143,124 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "coopvecNV log(coopvecNV);\n" "coopvecNV tanh(coopvecNV);\n" "coopvecNV atan(coopvecNV);\n" - "coopvecNV clamp(coopvecNV, coopvecNV, coopvecNV);\n" - "\n" - ; + "coopvecNV clamp(coopvecNV, coopvecNV, coopvecNV);\n"; commonBuiltins.append(cooperativeVectorFuncs.c_str()); + if (profile != EEsProfile) { + std::string longVectorFuncs = + + // manually add long vector prototypes for functions not in BaseFunctions/etc + "vector frexp(vector, vector);\n" + "vector ldexp(vector, vector);\n" + "vector fma(vector, vector, vector);\n" + + "vector floatBitsToInt(vector);\n" + "vector floatBitsToUint(vector);\n" + "vector intBitsToFloat(vector);\n" + "vector uintBitsToFloat(vector);\n" + "vector doubleBitsToInt64(vector);" + "vector doubleBitsToUint64(vector);" + "vector int64BitsToDouble(vector);" + "vector uint64BitsToDouble(vector);" + "vector bfloat16BitsToIntEXT(vector);" + "vector bfloat16BitsToUintEXT(vector);" + "vector intBitsToBFloat16EXT(vector);" + "vector uintBitsToBFloat16EXT(vector);" + "vector halfBitsToInt16(vector);" + "vector halfBitsToUint16(vector);" + "vector float16BitsToInt16(vector);" + "vector float16BitsToUint16(vector);" + "vector int16BitsToFloat16(vector);" + "vector uint16BitsToFloat16(vector);" + "vector int16BitsToHalf(vector);" + "vector uint16BitsToHalf(vector);" + "vector floate5m2BitsToIntEXT(vector);" + "vector floate5m2BitsToUintEXT(vector);" + "vector intBitsToFloate5m2EXT(vector);" + "vector uintBitsToFloate5m2EXT(vector);" + "vector floate4m3BitsToIntEXT(vector);" + "vector floate4m3BitsToUintEXT(vector);" + "vector intBitsToFloate4m3EXT(vector);" + "vector uintBitsToFloate4m3EXT(vector);" + + "vector uaddCarry(highp vector, highp vector, out lowp vector carry);" + "vector usubBorrow(highp vector, highp vector, out lowp vector borrow);" + "void umulExtended(highp vector, highp vector, out highp vector, out highp vector);" + "void imulExtended(highp vector, highp vector, out highp vector, out highp vector);" + "vector bitfieldExtract(vector, int, int);" + "vector bitfieldInsert(vector, vector, int, int);" + "vector bitfieldReverse(highp vector);" + "vector bitCount(vector);" + "vector findLSB(vector);" + "vector findMSB(vector);" + + // BaseFunctions overloads with a scalar parameter don't get generated in AddLongVectorBuiltin + "vector mod(vector, double);\n" + "vector min(vector, double);\n" + "vector max(vector, double);\n" + "vector clamp(vector, double, double);" + "vector mix(vector, vector, double);" + "vector step(double, vector);" + "vector smoothstep(double, double, vector);" + "vector refract(vector, vector, double);" + + "vector mod(vector, float16_t);\n" + "vector min(vector, float16_t);\n" + "vector max(vector, float16_t);\n" + "vector clamp(vector, float16_t, float16_t);" + "vector mix(vector, vector, float16_t);" + "vector step(float16_t, vector);" + "vector smoothstep(float16_t, float16_t, vector);" + "vector refract(vector, vector, float16_t);" + + "vector min(vector, uint64_t);\n" + "vector max(vector, uint64_t);\n" + "vector clamp(vector, uint64_t, uint64_t);" + "vector mix(vector, vector, uint64_t);" + + "vector min(vector, int64_t);\n" + "vector max(vector, int64_t);\n" + "vector clamp(vector, int64_t, int64_t);" + "vector mix(vector, vector, int64_t);" + + "vector min(vector, uint16_t);\n" + "vector max(vector, uint16_t);\n" + "vector clamp(vector, uint16_t, uint16_t);" + "vector mix(vector, vector, uint16_t);" + + "vector min(vector, int16_t);\n" + "vector max(vector, int16_t);\n" + "vector clamp(vector, int16_t, int16_t);" + "vector mix(vector, vector, int16_t);" + + "vector min(vector, uint8_t);\n" + "vector max(vector, uint8_t);\n" + "vector clamp(vector, uint8_t, uint8_t);" + "vector mix(vector, vector, uint8_t);" + + "vector min(vector, int8_t);\n" + "vector max(vector, int8_t);\n" + "vector clamp(vector, int8_t, int8_t);" + "vector mix(vector, vector, int8_t);" + + "vector expectEXT(vector, vector);" + ; + + std::string longVectorDerivativeFuncs = + "vector dFdxFine(vector);" + "vector dFdyFine(vector);" + "vector fwidthFine(vector);" + "vector dFdxCoarse(vector);" + "vector dFdyCoarse(vector);" + "vector fwidthCoarse(vector);" + + ; + commonBuiltins.append(longVectorFuncs.c_str()); + stageBuiltins[EShLangFragment].append(longVectorDerivativeFuncs.c_str()); + stageBuiltins[EShLangCompute].append(longVectorDerivativeFuncs.c_str()); + } + const char *scalarAndVectorTypes[] = { "int8_t", "int16_t", @@ -5080,13 +5307,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f32vec4", "f64vec4", }; - for (uint32_t i = 0; i < sizeof(scalarAndVectorTypes)/sizeof(scalarAndVectorTypes[0]); ++i) { - std::string load = std::string("void coopVecLoadNV(out coopvecNV v, volatile coherent ") + - std::string(scalarAndVectorTypes[i]) + std::string("[] buf, uint offset);"); - std::string store = std::string("void coopVecStoreNV(coopvecNV v, volatile coherent ") + - std::string(scalarAndVectorTypes[i]) + std::string("[] buf, uint offset);"); - commonBuiltins.append(load.c_str()); - commonBuiltins.append(store.c_str()); + + for (auto offsetTy : coopVecOffsetTypes) { + for (uint32_t i = 0; i < sizeof(scalarAndVectorTypes)/sizeof(scalarAndVectorTypes[0]); ++i) { + std::string load = std::string("void coopVecLoadNV(out coopvecNV v, volatile coherent ") + + std::string(scalarAndVectorTypes[i]) + std::string("[] buf, ") + offsetTy + std::string(" offset);"); + std::string store = std::string("void coopVecStoreNV(coopvecNV v, volatile coherent ") + + std::string(scalarAndVectorTypes[i]) + std::string("[] buf, ") + offsetTy + std::string(" offset);"); + commonBuiltins.append(load.c_str()); + commonBuiltins.append(store.c_str()); + } } commonBuiltins.append( @@ -5372,6 +5602,45 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void hitObjectGetLSSRadiiNV(hitObjectNV, out float[2]);" "bool hitObjectIsSphereHitNV(hitObjectNV);" "bool hitObjectIsLSSHitNV(hitObjectNV);" + "void hitObjectTraceRayEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectTraceRayMotionEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordMissEXT(hitObjectEXT,uint,uint,vec3,float,vec3,float);" + "void hitObjectRecordMissMotionEXT(hitObjectEXT,uint,uint,vec3,float,vec3,float,float);" + "void hitObjectRecordEmptyEXT(hitObjectEXT);" + "void hitObjectExecuteShaderEXT(hitObjectEXT,int);" + "bool hitObjectIsEmptyEXT(hitObjectEXT);" + "bool hitObjectIsMissEXT(hitObjectEXT);" + "bool hitObjectIsHitEXT(hitObjectEXT);" + "float hitObjectGetRayTMinEXT(hitObjectEXT);" + "float hitObjectGetRayTMaxEXT(hitObjectEXT);" + "uint hitObjectGetRayFlagsEXT(hitObjectEXT);" + "vec3 hitObjectGetWorldRayOriginEXT(hitObjectEXT);" + "vec3 hitObjectGetWorldRayDirectionEXT(hitObjectEXT);" + "vec3 hitObjectGetObjectRayOriginEXT(hitObjectEXT);" + "vec3 hitObjectGetObjectRayDirectionEXT(hitObjectEXT);" + "mat4x3 hitObjectGetWorldToObjectEXT(hitObjectEXT);" + "mat4x3 hitObjectGetObjectToWorldEXT(hitObjectEXT);" + "int hitObjectGetInstanceCustomIndexEXT(hitObjectEXT);" + "int hitObjectGetInstanceIdEXT(hitObjectEXT);" + "int hitObjectGetGeometryIndexEXT(hitObjectEXT);" + "int hitObjectGetPrimitiveIndexEXT(hitObjectEXT);" + "uint hitObjectGetHitKindEXT(hitObjectEXT);" + "void hitObjectGetAttributesEXT(hitObjectEXT,int);" + "float hitObjectGetCurrentTimeEXT(hitObjectEXT);" + "uint hitObjectGetShaderBindingTableRecordIndexEXT(hitObjectEXT);" + "uvec2 hitObjectGetShaderRecordBufferHandleEXT(hitObjectEXT);" + "void hitObjectSetShaderBindingTableRecordIndexEXT(hitObjectEXT, uint);" + "void hitObjectReorderExecuteEXT(hitObjectEXT,int);" + "void hitObjectReorderExecuteEXT(hitObjectEXT,uint,uint,int);" + "void hitObjectTraceReorderExecuteEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectTraceReorderExecuteEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,uint,uint,int);" + "void hitObjectTraceMotionReorderExecuteEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectTraceMotionReorderExecuteEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,uint,uint,int);" + "void hitObjectRecordFromQueryEXT(hitObjectEXT, rayQueryEXT, uint, int);" + "void hitObjectGetIntersectionTriangleVertexPositionsEXT(hitObjectEXT, out vec3[3]);" + "void reorderThreadEXT(uint, uint);" + "void reorderThreadEXT(hitObjectEXT);" + "void reorderThreadEXT(hitObjectEXT, uint, uint);" "\n"); stageBuiltins[EShLangIntersect].append( "bool reportIntersectionNV(float, uint);" @@ -5424,6 +5693,36 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void hitObjectGetLSSRadiiNV(hitObjectNV, out float[2]);" "bool hitObjectIsSphereHitNV(hitObjectNV);" "bool hitObjectIsLSSHitNV(hitObjectNV);" + "void hitObjectTraceRayEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectTraceRayMotionEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordMissEXT(hitObjectEXT,uint,uint,vec3,float,vec3,float);" + "void hitObjectRecordMissMotionEXT(hitObjectEXT,uint,uint,vec3,float,vec3,float,float);" + "void hitObjectRecordEmptyEXT(hitObjectEXT);" + "void hitObjectExecuteShaderEXT(hitObjectEXT,int);" + "bool hitObjectIsEmptyEXT(hitObjectEXT);" + "bool hitObjectIsMissEXT(hitObjectEXT);" + "bool hitObjectIsHitEXT(hitObjectEXT);" + "float hitObjectGetRayTMinEXT(hitObjectEXT);" + "float hitObjectGetRayTMaxEXT(hitObjectEXT);" + "uint hitObjectGetRayFlagsEXT(hitObjectEXT);" + "vec3 hitObjectGetWorldRayOriginEXT(hitObjectEXT);" + "vec3 hitObjectGetWorldRayDirectionEXT(hitObjectEXT);" + "vec3 hitObjectGetObjectRayOriginEXT(hitObjectEXT);" + "vec3 hitObjectGetObjectRayDirectionEXT(hitObjectEXT);" + "mat4x3 hitObjectGetWorldToObjectEXT(hitObjectEXT);" + "mat4x3 hitObjectGetObjectToWorldEXT(hitObjectEXT);" + "int hitObjectGetInstanceCustomIndexEXT(hitObjectEXT);" + "int hitObjectGetInstanceIdEXT(hitObjectEXT);" + "int hitObjectGetGeometryIndexEXT(hitObjectEXT);" + "int hitObjectGetPrimitiveIndexEXT(hitObjectEXT);" + "uint hitObjectGetHitKindEXT(hitObjectEXT);" + "void hitObjectGetAttributesEXT(hitObjectEXT,int);" + "float hitObjectGetCurrentTimeEXT(hitObjectEXT);" + "uint hitObjectGetShaderBindingTableRecordIndexEXT(hitObjectEXT);" + "uvec2 hitObjectGetShaderRecordBufferHandleEXT(hitObjectEXT);" + "void hitObjectSetShaderBindingTableRecordIndexEXT(hitObjectEXT, uint);" + "void hitObjectRecordFromQueryEXT(hitObjectEXT, rayQueryEXT,uint, int);" + "void hitObjectGetIntersectionTriangleVertexPositionsEXT(hitObjectEXT, out vec3[3]);" "\n"); stageBuiltins[EShLangMiss].append( "void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" @@ -5468,6 +5767,36 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void hitObjectGetLSSRadiiNV(hitObjectNV, out float[2]);" "bool hitObjectIsSphereHitNV(hitObjectNV);" "bool hitObjectIsLSSHitNV(hitObjectNV);" + "void hitObjectTraceRayEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectTraceRayMotionEXT(hitObjectEXT,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordMissEXT(hitObjectEXT,uint,uint,vec3,float,vec3,float);" + "void hitObjectRecordMissMotionEXT(hitObjectEXT,uint,uint,vec3,float,vec3,float,float);" + "void hitObjectRecordEmptyEXT(hitObjectEXT);" + "void hitObjectExecuteShaderEXT(hitObjectEXT,int);" + "bool hitObjectIsEmptyEXT(hitObjectEXT);" + "bool hitObjectIsMissEXT(hitObjectEXT);" + "bool hitObjectIsHitEXT(hitObjectEXT);" + "float hitObjectGetRayTMinEXT(hitObjectEXT);" + "float hitObjectGetRayTMaxEXT(hitObjectEXT);" + "uint hitObjectGetRayFlagsEXT(hitObjectEXT);" + "vec3 hitObjectGetWorldRayOriginEXT(hitObjectEXT);" + "vec3 hitObjectGetWorldRayDirectionEXT(hitObjectEXT);" + "vec3 hitObjectGetObjectRayOriginEXT(hitObjectEXT);" + "vec3 hitObjectGetObjectRayDirectionEXT(hitObjectEXT);" + "mat4x3 hitObjectGetWorldToObjectEXT(hitObjectEXT);" + "mat4x3 hitObjectGetObjectToWorldEXT(hitObjectEXT);" + "int hitObjectGetInstanceCustomIndexEXT(hitObjectEXT);" + "int hitObjectGetInstanceIdEXT(hitObjectEXT);" + "int hitObjectGetGeometryIndexEXT(hitObjectEXT);" + "int hitObjectGetPrimitiveIndexEXT(hitObjectEXT);" + "uint hitObjectGetHitKindEXT(hitObjectEXT);" + "void hitObjectGetAttributesEXT(hitObjectEXT,int);" + "float hitObjectGetCurrentTimeEXT(hitObjectEXT);" + "uint hitObjectGetShaderBindingTableRecordIndexEXT(hitObjectEXT);" + "uvec2 hitObjectGetShaderRecordBufferHandleEXT(hitObjectEXT);" + "void hitObjectSetShaderBindingTableRecordIndexEXT(hitObjectEXT, uint);" + "void hitObjectRecordFromQueryEXT(hitObjectEXT, rayQueryEXT, uint, int);" + "void hitObjectGetIntersectionTriangleVertexPositionsEXT(hitObjectEXT, out vec3[3]);" "\n"); stageBuiltins[EShLangCallable].append( "void executeCallableNV(uint, int);" @@ -6940,7 +7269,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV false, ms ? true : false); - TString typeName = sampler.getString(); + TString typeName = TString{sampler.getString()}; addQueryFunctions(sampler, typeName, version, profile); addImageFunctions(sampler, typeName, version, profile); @@ -7043,7 +7372,7 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c ms ? true : false); } - TString typeName = sampler.getString(); + TString typeName = TString{sampler.getString()}; if (dim == EsdSubpass) { addSubpassSampling(sampler, typeName, version, profile); @@ -7067,7 +7396,7 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c // texture types. sampler.setTexture(sampler.type, sampler.dim, sampler.arrayed, sampler.shadow, sampler.ms); - TString textureTypeName = sampler.getString(); + TString textureTypeName = TString{sampler.getString()}; addSamplingFunctions(sampler, textureTypeName, version, profile); addQueryFunctions(sampler, textureTypeName, version, profile); } @@ -9757,10 +10086,32 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } { - symbolTable.setFunctionExtensions("coopMatLoad", 1, &E_GL_KHR_cooperative_matrix); - symbolTable.setFunctionExtensions("coopMatStore", 1, &E_GL_KHR_cooperative_matrix); + auto coopMatKHRCallback = [](const char *name) -> std::vector { + std::vector ret; + if (strstr(name, "u64") != nullptr) { + ret.push_back(E_GL_EXT_shader_64bit_indexing); + } else { + ret.push_back(E_GL_KHR_cooperative_matrix); + } + return ret; + }; + auto coopMat2NVCallback = [](const char *name) -> std::vector { + std::vector ret; + if (strstr(name, "u64") != nullptr) { + ret.push_back(E_GL_EXT_shader_64bit_indexing); + } else { + ret.push_back(E_GL_NV_cooperative_matrix2); + } + return ret; + }; + + symbolTable.setFunctionExtensionsCallback("coopMatLoad", coopMatKHRCallback); + symbolTable.setFunctionExtensionsCallback("coopMatStore", coopMatKHRCallback); symbolTable.setFunctionExtensions("coopMatMulAdd", 1, &E_GL_KHR_cooperative_matrix); + symbolTable.setFunctionExtensionsCallback("coopMatLoadTensorNV", coopMat2NVCallback); + symbolTable.setFunctionExtensionsCallback("coopMatStoreTensorNV", coopMat2NVCallback); + symbolTable.setFunctionExtensions("coopMatReduceNV", 1, &E_GL_NV_cooperative_matrix2); symbolTable.setFunctionExtensions("coopMatPerElementNV", 1, &E_GL_NV_cooperative_matrix2); symbolTable.setFunctionExtensions("coopMatTransposeNV", 1, &E_GL_NV_cooperative_matrix2); @@ -9783,12 +10134,30 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("tensorWriteARM", 1, &E_GL_ARM_tensors); symbolTable.setFunctionExtensions("tensorSizeARM", 1, &E_GL_ARM_tensors); } + { + auto coopVecCallback = [](const char *name) -> std::vector { + std::vector ret; + // This looks for u64 as the last parameter (the offset) + if (strstr(name, "u641;") != nullptr) { + ret.push_back(E_GL_EXT_shader_64bit_indexing); + } else { + ret.push_back(E_GL_NV_cooperative_vector); + } + return ret; + }; + symbolTable.setFunctionExtensionsCallback("coopVecMatMulNV", coopVecCallback); + symbolTable.setFunctionExtensionsCallback("coopVecMatMulAddNV", coopVecCallback); + symbolTable.setFunctionExtensionsCallback("coopVecLoadNV", coopVecCallback); + symbolTable.setFunctionExtensionsCallback("coopVecStoreNV", coopVecCallback); + symbolTable.setFunctionExtensionsCallback("coopVecOuterProductAccumulateNV", coopVecCallback); + symbolTable.setFunctionExtensionsCallback("coopVecReduceSumAccumulateNV", coopVecCallback); + } { - symbolTable.setFunctionExtensions("coopVecMatMulNV", 1, &E_GL_NV_cooperative_vector); - symbolTable.setFunctionExtensions("coopVecMatMulAddNV", 1, &E_GL_NV_cooperative_vector); - symbolTable.setFunctionExtensions("coopVecOuterProductAccumulateNV", 1, &E_GL_NV_cooperative_vector); - symbolTable.setFunctionExtensions("coopVecReduceSumAccumulateNV", 1, &E_GL_NV_cooperative_vector); + symbolTable.setFunctionExtensions("bitcastQCOM", 1, &E_GL_QCOM_cooperative_matrix_conversion); + symbolTable.setFunctionExtensions("extractSubArrayQCOM", 1, &E_GL_QCOM_cooperative_matrix_conversion); + symbolTable.setFunctionExtensions("vectorToCoopmatQCOM", 1, &E_GL_QCOM_cooperative_matrix_conversion); + symbolTable.setFunctionExtensions("coopmatToVectorQCOM", 1, &E_GL_QCOM_cooperative_matrix_conversion); } if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { @@ -9965,6 +10334,40 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("hitObjectGetLSSRadiiNV", 1, &E_GL_NV_linear_swept_spheres); symbolTable.setFunctionExtensions("hitObjectIsSphereHitNV", 1, &E_GL_NV_linear_swept_spheres); symbolTable.setFunctionExtensions("hitObjectIsLSSHitNV", 1, &E_GL_NV_linear_swept_spheres); + symbolTable.setFunctionExtensions("hitObjectTraceRayEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectTraceRayMotionEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordMissEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordMissMotionEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordEmptyEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectExecuteShaderEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectIsEmptyEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectIsMissEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectIsHitEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetRayTMinEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetRayTMaxEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetRayFlagsEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetObjectRayOriginEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetObjectRayDirectionEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetWorldRayOriginEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetWorldRayDirectionEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetWorldToObjectEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetObjectToWorldEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetInstanceCustomIndexEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetInstanceIdEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetGeometryIndexEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetPrimitiveIndexEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetHitKindEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetAttributesEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetCurrentTimeEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetShaderBindingTableRecordIndexEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetShaderRecordBufferHandleEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectSetShaderBindingTableRecordIndexEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("reorderThreadEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectReorderExecuteEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectTraceReorderExecuteEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectTraceMotionReorderExecuteEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordFromQueryEXT", 1, &E_GL_EXT_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetIntersectionTriangleVertexPositionsEXT", 1, &E_GL_EXT_shader_invocation_reorder); BuiltInVariable("gl_LaunchIDNV", EbvLaunchId, symbolTable); @@ -11104,6 +11507,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("tensorWriteARM", EOpTensorWriteARM); symbolTable.relateToOperator("tensorSizeARM", EOpTensorSizeARM); + symbolTable.relateToOperator("bitcastQCOM", EOpBitCastArrayQCOM); + symbolTable.relateToOperator("extractSubArrayQCOM", EOpExtractSubArrayQCOM); + symbolTable.relateToOperator("vectorToCoopmatQCOM", EOpCompositeConstructCoopMatQCOM); + symbolTable.relateToOperator("coopmatToVectorQCOM", EOpCompositeExtractCoopMatQCOM); + if (profile != EEsProfile && version >= 460) { symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV); symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV); @@ -11163,6 +11571,40 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("hitObjectGetLSSRadiiNV", EOpHitObjectGetLSSRadiiNV); symbolTable.relateToOperator("hitObjectIsSphereHitNV", EOpHitObjectIsSphereHitNV); symbolTable.relateToOperator("hitObjectIsLSSHitNV", EOpHitObjectIsLSSHitNV); + symbolTable.relateToOperator("hitObjectTraceRayEXT", EOpHitObjectTraceRayEXT); + symbolTable.relateToOperator("hitObjectTraceRayMotionEXT", EOpHitObjectTraceRayMotionEXT); + symbolTable.relateToOperator("hitObjectRecordMissEXT", EOpHitObjectRecordMissEXT); + symbolTable.relateToOperator("hitObjectRecordMissMotionEXT", EOpHitObjectRecordMissMotionEXT); + symbolTable.relateToOperator("hitObjectRecordEmptyEXT", EOpHitObjectRecordEmptyEXT); + symbolTable.relateToOperator("hitObjectExecuteShaderEXT", EOpHitObjectExecuteShaderEXT); + symbolTable.relateToOperator("hitObjectIsEmptyEXT", EOpHitObjectIsEmptyEXT); + symbolTable.relateToOperator("hitObjectIsMissEXT", EOpHitObjectIsMissEXT); + symbolTable.relateToOperator("hitObjectIsHitEXT", EOpHitObjectIsHitEXT); + symbolTable.relateToOperator("hitObjectGetRayTMinEXT", EOpHitObjectGetRayTMinEXT); + symbolTable.relateToOperator("hitObjectGetRayTMaxEXT", EOpHitObjectGetRayTMaxEXT); + symbolTable.relateToOperator("hitObjectGetRayFlagsEXT", EOpHitObjectGetRayFlagsEXT); + symbolTable.relateToOperator("hitObjectGetObjectRayOriginEXT", EOpHitObjectGetObjectRayOriginEXT); + symbolTable.relateToOperator("hitObjectGetObjectRayDirectionEXT", EOpHitObjectGetObjectRayDirectionEXT); + symbolTable.relateToOperator("hitObjectGetWorldRayOriginEXT", EOpHitObjectGetWorldRayOriginEXT); + symbolTable.relateToOperator("hitObjectGetWorldRayDirectionEXT", EOpHitObjectGetWorldRayDirectionEXT); + symbolTable.relateToOperator("hitObjectGetWorldToObjectEXT", EOpHitObjectGetWorldToObjectEXT); + symbolTable.relateToOperator("hitObjectGetObjectToWorldEXT", EOpHitObjectGetObjectToWorldEXT); + symbolTable.relateToOperator("hitObjectGetInstanceCustomIndexEXT", EOpHitObjectGetInstanceCustomIndexEXT); + symbolTable.relateToOperator("hitObjectGetInstanceIdEXT", EOpHitObjectGetInstanceIdEXT); + symbolTable.relateToOperator("hitObjectGetGeometryIndexEXT", EOpHitObjectGetGeometryIndexEXT); + symbolTable.relateToOperator("hitObjectGetPrimitiveIndexEXT", EOpHitObjectGetPrimitiveIndexEXT); + symbolTable.relateToOperator("hitObjectGetHitKindEXT", EOpHitObjectGetHitKindEXT); + symbolTable.relateToOperator("hitObjectGetAttributesEXT", EOpHitObjectGetAttributesEXT); + symbolTable.relateToOperator("hitObjectGetCurrentTimeEXT", EOpHitObjectGetCurrentTimeEXT); + symbolTable.relateToOperator("hitObjectGetShaderBindingTableRecordIndexEXT", EOpHitObjectGetShaderBindingTableRecordIndexEXT); + symbolTable.relateToOperator("hitObjectGetShaderRecordBufferHandleEXT", EOpHitObjectGetShaderRecordBufferHandleEXT); + symbolTable.relateToOperator("hitObjectSetShaderBindingTableRecordIndexEXT", EOpHitObjectSetShaderBindingTableRecordIndexEXT); + symbolTable.relateToOperator("reorderThreadEXT", EOpReorderThreadEXT); + symbolTable.relateToOperator("hitObjectReorderExecuteEXT", EOpHitObjectReorderExecuteEXT); + symbolTable.relateToOperator("hitObjectTraceReorderExecuteEXT", EOpHitObjectTraceReorderExecuteEXT); + symbolTable.relateToOperator("hitObjectTraceMotionReorderExecuteEXT", EOpHitObjectTraceMotionReorderExecuteEXT); + symbolTable.relateToOperator("hitObjectRecordFromQueryEXT", EOpHitObjectRecordFromQueryEXT); + symbolTable.relateToOperator("hitObjectGetIntersectionTriangleVertexPositionsEXT", EOpHitObjectGetIntersectionTriangleVertexPositionsEXT); } break; case EShLangIntersect: @@ -11301,4 +11743,407 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } } +// Determine whether this fnCandidate overload is supported for these arguments. +// Some of this is based on the BaseFunctions table, but for functions not in that +// table there's some handcoded logic. +// If the overload is supported, then this sets the specific parameter/result +// types and returns true. +bool IsSupportedLongVectorBuiltin(const TFunction* fnCandidate, TType* resultType, TIntermNode* arguments) +{ + TOperator op = fnCandidate->getBuiltInOp(); + + const auto &getArg = [&](uint32_t i) { + TIntermAggregate* aggregate = arguments->getAsAggregate(); + return fnCandidate->getParamCount() == 1 ? arguments->getAsTyped() : (aggregate ? aggregate->getSequence()[i]->getAsTyped() : arguments->getAsTyped()); + }; + + bool valid = true; + + const auto &checkFnTypes = [&](TIntermTyped *t, uint32_t types) { + if (t->getType().isFloatingDomain() && !(types & TypeF)) { + valid = false; + } + if (isTypeSignedInt(t->getType().getBasicType()) && !(types & TypeI)) { + valid = false; + } + if (isTypeUnsignedInt(t->getType().getBasicType()) && !(types & TypeU)) { + valid = false; + } + if (t->getType().getBasicType() == EbtBool && !(types & TypeB)) { + valid = false; + } + }; + + const auto &checkShape = [&](TIntermTyped *t0, TIntermTyped *t1) { + if (!t0->getType().sameLongVectorShape(t1->getType())) { + valid = false; + } + }; + + const auto &checkSameType = [&](TIntermTyped *t0, TIntermTyped *t1) { + if (t0->getType() != t1->getType()) { + valid = false; + } + }; + + const auto &checkArgsMatch = [&](uint32_t argStart, uint32_t argEnd, uint32_t types) { + for (uint32_t i = argStart; i < argEnd; ++i) { + checkFnTypes(getArg(i), types); + if (i != argStart) { + checkSameType(getArg(argStart), getArg(i)); + } + } + }; + + uint32_t paramCount = fnCandidate->getParamCount(); + + bool foundInBase = false; + for (const auto &fn : BaseFunctions) { + if (fn.op != op) { + continue; + } + valid = true; + foundInBase = true; + + TIntermTyped *firstLongVector = nullptr; + for (uint32_t i = 0; i < paramCount; ++i) { + TIntermTyped* arg = getArg(i); + + ArgType argType = fn.types; + if (i == paramCount - 1 && (fn.classes & ClassLB)) { + argType = TypeB; + } + + checkFnTypes(arg, argType); + + if ((fn.classes & ClassLS) && getArg(paramCount-1)->getType().isScalar()) { + if (getArg(paramCount-1)->getType().getBasicType() != arg->getBasicType()) { + valid = false; + } + } + + if (arg->getType().isLongVector()) { + if (firstLongVector != nullptr) { + checkShape(firstLongVector, arg); + } + if (firstLongVector == nullptr) { + firstLongVector = arg; + } + } + } + + uint32_t argsToMatchStart = 0; + uint32_t argsToMatchEnd = paramCount; + if (fn.classes & ClassFS) + argsToMatchStart++; + if (fn.classes & ClassFS2) + argsToMatchStart += 2; + if ((fn.classes & ClassLS) && getArg(paramCount-1)->getType().isScalar()) + argsToMatchEnd--; + if (fn.classes & ClassXLS) + argsToMatchEnd--; + if (fn.classes & ClassLS2) + argsToMatchEnd -= 2; + if (fn.classes & ClassLB) + argsToMatchEnd--; + + checkArgsMatch(argsToMatchStart, argsToMatchEnd, fn.types); + + // These ops (arbitrarily) don't support double precision + switch (op) { + case EOpRadians: + case EOpDegrees: + case EOpSin: + case EOpCos: + case EOpTan: + case EOpAcos: + case EOpAsin: + case EOpAtan: + case EOpAcosh: + case EOpAsinh: + case EOpAtanh: + case EOpTanh: + case EOpCosh: + case EOpSinh: + case EOpPow: + case EOpExp: + case EOpLog: + case EOpExp2: + case EOpLog2: + if (getArg(0)->getType().getBasicType() == EbtDouble) { + return false; + } + break; + default: + break; + } + + if (valid) { + // It's valid, so override the types and return true + assert(firstLongVector); + resultType->deepCopy(firstLongVector->getType()); + if (fn.classes & ClassB) { + resultType->setBasicType(EbtBool); + } + if (fn.classes & ClassRS) { + resultType->deepCopy(TType(firstLongVector->getType().getBasicType())); + } + if (fn.classes & ClassLO) { + getArg(fnCandidate->getParamCount() - 1)->setType(getArg(0)->getType()); + } + return true; + } + } + // If it was in the base table but not supported, fail. The rest of the logic + // is for ops not in the base table. + if (foundInBase) { + return false; + } + + // Check the arg0 type and if this and other checks have passed, then set + // the result type to the bitcasted result + const auto &checkBitCast = [&](TBasicType fromBasicType, TBasicType newBasicType) { + if (getArg(0)->getType().getBasicType() != fromBasicType) { + valid = false; + } + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + resultType->setBasicType(newBasicType); + } + }; + + valid = true; + switch (op) { + case EOpFrexp: + case EOpLdexp: + checkFnTypes(getArg(0), TypeF); + checkFnTypes(getArg(1), TypeI); + checkShape(getArg(0), getArg(1)); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + case EOpFloatBitsToInt: + if (fnCandidate->getName() == "bfloat16BitsToIntEXT") { + checkBitCast(EbtBFloat16, EbtInt16); + } else if (fnCandidate->getName() == "floate5m2BitsToIntEXT") { + checkBitCast(EbtFloatE5M2, EbtInt8); + } else if (fnCandidate->getName() == "floate4m3BitsToIntEXT") { + checkBitCast(EbtFloatE4M3, EbtInt8); + } else { + checkBitCast(EbtFloat, EbtInt); + } + return valid; + case EOpFloatBitsToUint: + if (fnCandidate->getName() == "bfloat16BitsToUintEXT") { + checkBitCast(EbtBFloat16, EbtUint16); + } else if (fnCandidate->getName() == "floate5m2BitsToUintEXT") { + checkBitCast(EbtFloatE5M2, EbtUint8); + } else if (fnCandidate->getName() == "floate4m3BitsToUintEXT") { + checkBitCast(EbtFloatE4M3, EbtUint8); + } else { + checkBitCast(EbtFloat, EbtUint); + } + return valid; + case EOpIntBitsToFloat: + if (fnCandidate->getName() == "intBitsToBFloat16EXT") { + checkBitCast(EbtInt16, EbtBFloat16); + } else if (fnCandidate->getName() == "intBitsToFloate5m2EXT") { + checkBitCast(EbtInt8, EbtFloatE5M2); + } else if (fnCandidate->getName() == "intBitsToFloate4m3EXT") { + checkBitCast(EbtInt8, EbtFloatE4M3); + } else { + checkBitCast(EbtInt, EbtFloat); + } + return valid; + case EOpUintBitsToFloat: + if (fnCandidate->getName() == "uintBitsToBFloat16EXT") { + checkBitCast(EbtUint16, EbtBFloat16); + } else if (fnCandidate->getName() == "uintBitsToFloate5m2EXT") { + checkBitCast(EbtUint8, EbtFloatE5M2); + } else if (fnCandidate->getName() == "uintBitsToFloate4m3EXT") { + checkBitCast(EbtUint8, EbtFloatE4M3); + } else { + checkBitCast(EbtUint, EbtFloat); + } + return valid; + case EOpDoubleBitsToInt64: + checkBitCast(EbtDouble, EbtInt64); + return valid; + case EOpDoubleBitsToUint64: + checkBitCast(EbtDouble, EbtUint64); + return valid; + case EOpInt64BitsToDouble: + checkBitCast(EbtInt64, EbtDouble); + return valid; + case EOpUint64BitsToDouble: + checkBitCast(EbtUint64, EbtDouble); + return valid; + case EOpFloat16BitsToInt16: + checkBitCast(EbtFloat16, EbtInt16); + return valid; + case EOpFloat16BitsToUint16: + checkBitCast(EbtFloat16, EbtUint16); + return valid; + case EOpInt16BitsToFloat16: + checkBitCast(EbtInt16, EbtFloat16); + return valid; + case EOpUint16BitsToFloat16: + checkBitCast(EbtUint16, EbtFloat16); + return valid; + + case EOpFma: + checkArgsMatch(0, paramCount, TypeF); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + case EOpAddCarry: + case EOpSubBorrow: + checkArgsMatch(0, paramCount, TypeU); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + case EOpUMulExtended: + checkArgsMatch(0, paramCount, TypeU); + return valid; + case EOpIMulExtended: + checkArgsMatch(0, paramCount, TypeI); + return valid; + case EOpBitfieldExtract: + case EOpBitFieldReverse: + checkFnTypes(getArg(0), TypeIU); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + case EOpBitfieldInsert: + checkArgsMatch(0, 2, TypeIU); + checkSameType(getArg(0), getArg(1)); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + case EOpFindLSB: + case EOpFindMSB: + case EOpBitCount: + checkFnTypes(getArg(0), TypeIU); + if (valid) { + TType newType; + newType.deepCopy(getArg(0)->getType()); + newType.setBasicType(unsignedTypeToSigned(newType.getBasicType())); + resultType->deepCopy(newType); + } + return valid; + case EOpDPdx: + case EOpDPdxFine: + case EOpDPdxCoarse: + case EOpDPdy: + case EOpDPdyFine: + case EOpDPdyCoarse: + case EOpFwidth: + case EOpFwidthFine: + case EOpFwidthCoarse: + checkFnTypes(getArg(0), TypeF); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + case EOpExpectEXT: + checkArgsMatch(0, paramCount, TypeIU | TypeB); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + + case EOpSubgroupPartition: + resultType->deepCopy(TType(EbtUint, EvqTemporary, 4)); + return valid; + case EOpSubgroupAllEqual: + resultType->deepCopy(TType(EbtBool)); + return valid; + + case EOpSubgroupAnd: + case EOpSubgroupOr: + case EOpSubgroupXor: + case EOpSubgroupInclusiveAnd: + case EOpSubgroupInclusiveOr: + case EOpSubgroupInclusiveXor: + case EOpSubgroupExclusiveAnd: + case EOpSubgroupExclusiveOr: + case EOpSubgroupExclusiveXor: + case EOpSubgroupClusteredAnd: + case EOpSubgroupClusteredOr: + case EOpSubgroupClusteredXor: + case EOpSubgroupPartitionedAnd: + case EOpSubgroupPartitionedOr: + case EOpSubgroupPartitionedXor: + case EOpSubgroupPartitionedInclusiveAnd: + case EOpSubgroupPartitionedInclusiveOr: + case EOpSubgroupPartitionedInclusiveXor: + case EOpSubgroupPartitionedExclusiveAnd: + case EOpSubgroupPartitionedExclusiveOr: + case EOpSubgroupPartitionedExclusiveXor: + checkFnTypes(getArg(0), TypeIU | TypeB); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + case EOpSubgroupBroadcast: + case EOpSubgroupBroadcastFirst: + case EOpSubgroupShuffle: + case EOpSubgroupShuffleXor: + case EOpSubgroupShuffleUp: + case EOpSubgroupShuffleDown: + case EOpSubgroupRotate: + case EOpSubgroupClusteredRotate: + case EOpSubgroupQuadBroadcast: + case EOpSubgroupQuadSwapHorizontal: + case EOpSubgroupQuadSwapVertical: + case EOpSubgroupQuadSwapDiagonal: + checkFnTypes(getArg(0), TypeIU | TypeB | TypeF); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + case EOpSubgroupAdd: + case EOpSubgroupMul: + case EOpSubgroupMin: + case EOpSubgroupMax: + case EOpSubgroupInclusiveAdd: + case EOpSubgroupInclusiveMul: + case EOpSubgroupInclusiveMin: + case EOpSubgroupInclusiveMax: + case EOpSubgroupExclusiveAdd: + case EOpSubgroupExclusiveMul: + case EOpSubgroupExclusiveMin: + case EOpSubgroupExclusiveMax: + case EOpSubgroupClusteredAdd: + case EOpSubgroupClusteredMul: + case EOpSubgroupClusteredMin: + case EOpSubgroupClusteredMax: + case EOpSubgroupPartitionedAdd: + case EOpSubgroupPartitionedMul: + case EOpSubgroupPartitionedMin: + case EOpSubgroupPartitionedMax: + case EOpSubgroupPartitionedInclusiveAdd: + case EOpSubgroupPartitionedInclusiveMul: + case EOpSubgroupPartitionedInclusiveMin: + case EOpSubgroupPartitionedInclusiveMax: + case EOpSubgroupPartitionedExclusiveAdd: + case EOpSubgroupPartitionedExclusiveMul: + case EOpSubgroupPartitionedExclusiveMin: + case EOpSubgroupPartitionedExclusiveMax: + checkFnTypes(getArg(0), TypeIU | TypeF); + if (valid) { + resultType->deepCopy(getArg(0)->getType()); + } + return valid; + default: + break; + } + return false; +} + } // end namespace glslang diff --git a/third_party/glslang/glslang/MachineIndependent/Initialize.h b/third_party/glslang/glslang/MachineIndependent/Initialize.h index 42c32ddbb7..849399af35 100644 --- a/third_party/glslang/glslang/MachineIndependent/Initialize.h +++ b/third_party/glslang/glslang/MachineIndependent/Initialize.h @@ -110,6 +110,9 @@ protected: // change this back to false if depending on textual spellings of texturing calls when consuming the AST // Using PureOperatorBuiltins=false is deprecated. constexpr bool PureOperatorBuiltins = true; + +bool IsSupportedLongVectorBuiltin(const TFunction* fnCandidate, TType* resultType, TIntermNode* arguments); + } // end namespace glslang #endif // _INITIALIZE_INCLUDED_ diff --git a/third_party/glslang/glslang/MachineIndependent/IntermTraverse.cpp b/third_party/glslang/glslang/MachineIndependent/IntermTraverse.cpp index 553b1b5ff8..447e8cb6cd 100644 --- a/third_party/glslang/glslang/MachineIndependent/IntermTraverse.cpp +++ b/third_party/glslang/glslang/MachineIndependent/IntermTraverse.cpp @@ -306,4 +306,35 @@ void TIntermSwitch::traverse(TIntermTraverser* it) it->visitSwitch(EvPostVisit, this); } +// +// Traverse a variable declaration. +// +void TIntermVariableDecl::traverse(TIntermTraverser *it) +{ + bool visit = true; + + if (it->preVisit) + visit = it->visitVariableDecl(EvPreVisit, this); + + if (visit) { + it->incrementDepth(this); + if (it->rightToLeft) { + if (it->includeDeclSymbol) + declSymbol->traverse(it); + if (initNode) + initNode->traverse(it); + } + else { + if (initNode) + initNode->traverse(it); + if (it->includeDeclSymbol) + declSymbol->traverse(it); + } + it->decrementDepth(); + } + + if (visit && it->postVisit) + it->visitVariableDecl(EvPostVisit, this); +} + } // end namespace glslang diff --git a/third_party/glslang/glslang/MachineIndependent/Intermediate.cpp b/third_party/glslang/glslang/MachineIndependent/Intermediate.cpp index 1f10ee83db..68e57e3876 100644 --- a/third_party/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/third_party/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -118,7 +118,8 @@ TIntermSymbol* TIntermediate::addSymbol(const TType& type, const TSourceLoc& loc TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc& loc) { // No operations work on blocks - if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock) + if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock || + left->getType().getBasicType() == EbtString || right->getType().getBasicType() == EbtString) return nullptr; // Convert "reference +/- int" and "reference - reference" to integer math @@ -406,11 +407,15 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, } if (newType != EbtVoid) { - child = addConversion(op, TType(newType, EvqTemporary, child->getVectorSize(), - child->getMatrixCols(), - child->getMatrixRows(), - child->isVector()), - child); + TType newTType(newType, EvqTemporary, child->getVectorSize(), child->getMatrixCols(), child->getMatrixRows(), child->isVector()); + if (child->getType().isLongVector()) { + newTType.shallowCopy(child->getType()); + newTType.setBasicType(newType); + newTType.makeTemporary(); + newTType.getQualifier().clear(); + } + + child = addConversion(op, newTType, child); if (child == nullptr) return nullptr; } @@ -646,6 +651,12 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped } TType newType(convertTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows()); + if (node->getType().isLongVector()) { + newType.shallowCopy(node->getType()); + newType.setBasicType(convertTo); + newType.makeTemporary(); + newType.getQualifier().clear(); + } newNode = addUnaryNode(newOp, node, node->getLoc(), newType); if (node->getAsConstantUnion()) { @@ -839,7 +850,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt // Reject implicit conversions to cooperative matrix types if (node->getType().isCoopMat() && op != EOpConstructCooperativeMatrixNV && - op != EOpConstructCooperativeMatrixKHR) + op != EOpConstructCooperativeMatrixKHR && + op != glslang::EOpCompositeConstructCoopMatQCOM) return nullptr; if (node->getType().isTensorLayoutNV() || @@ -1857,7 +1869,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const if (type.isCoopMatKHR()) return EOpConstructCooperativeMatrixKHR; - if (type.isCoopVecNV()) + if (type.isCoopVecOrLongVector()) return EOpConstructCooperativeVectorNV; switch (type.getBasicType()) { @@ -2381,7 +2393,8 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true trueBlock = std::get<0>(children); falseBlock = std::get<1>(children); - if (trueBlock == nullptr || falseBlock == nullptr) + if (trueBlock == nullptr || falseBlock == nullptr || + trueBlock->getBasicType() == EbtString || falseBlock->getBasicType() == EbtString) return nullptr; // Handle a vector condition as a mix @@ -2649,7 +2662,7 @@ const TIntermTyped* TIntermediate::traverseLValueBase(const TIntermTyped* node, // // Create while and do-while loop nodes. // -TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, +TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermNode* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc) { TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst); @@ -2661,7 +2674,7 @@ TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TInte // // Create a for-loop sequence. // -TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermTyped* test, +TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermNode* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TIntermLoop*& node) { node = new TIntermLoop(body, test, terminal, testFirst); @@ -3453,6 +3466,8 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) return false; } + bool vectorAndLongVectorMatch = TType::vectorAndLongVectorMatch(left->getType(), right->getType()); + // Finish handling the case, for all ops, where both operands are scalars. if (left->isScalar() && right->isScalar()) return true; @@ -3461,6 +3476,10 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) if (left->isVector() && right->isVector() && left->getVectorSize() != right->getVectorSize() && right->getVectorSize() > 1) return false; + // Finish handling the case, for all ops, where there are two vectors of different sizes + if (left->getType().isLongVector() && right->getType().isLongVector() && !left->getType().sameLongVectorShape(right->getType())) + return false; + // // We now have a mix of scalars, vectors, or matrices, for non-relational operations. // @@ -3546,7 +3565,8 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) break; case EOpAssign: - if (left->getVectorSize() != right->getVectorSize() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixRows() != right->getMatrixRows()) + if ((left->getVectorSize() != right->getVectorSize() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixRows() != right->getMatrixRows()) && + !vectorAndLongVectorMatch) return false; [[fallthrough]]; @@ -3573,7 +3593,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) return false; if (left->isVector() && right->isVector() && left->getVectorSize() != right->getVectorSize()) return false; - if (right->isVector() || right->isMatrix()) { + if ((right->isVector() || right->isMatrix()) && !vectorAndLongVectorMatch) { node.getWritableType().shallowCopy(right->getType()); node.getWritableType().getQualifier().makeTemporary(); } @@ -3903,12 +3923,15 @@ void TIntermediate::performTextureUpgradeAndSamplerRemovalTransformation(TInterm const char* TIntermediate::getResourceName(TResourceType res) { switch (res) { - case EResSampler: return "shift-sampler-binding"; - case EResTexture: return "shift-texture-binding"; - case EResImage: return "shift-image-binding"; - case EResUbo: return "shift-UBO-binding"; - case EResSsbo: return "shift-ssbo-binding"; - case EResUav: return "shift-uav-binding"; + case EResSampler: return "shift-sampler-binding"; + case EResTexture: return "shift-texture-binding"; + case EResImage: return "shift-image-binding"; + case EResUbo: return "shift-ubo-binding"; + case EResSsbo: return "shift-ssbo-binding"; + case EResUav: return "shift-uav-binding"; + case EResCombinedSampler: return "shift-combined-sampler-binding"; + case EResAs: return "shift-as-binding"; + case EResTensor: return nullptr; default: assert(0); // internal error: should only be called with valid resource types. return nullptr; diff --git a/third_party/glslang/glslang/MachineIndependent/LiveTraverser.h b/third_party/glslang/glslang/MachineIndependent/LiveTraverser.h index 0e9d748ca4..76ccfec12d 100644 --- a/third_party/glslang/glslang/MachineIndependent/LiveTraverser.h +++ b/third_party/glslang/glslang/MachineIndependent/LiveTraverser.h @@ -59,8 +59,8 @@ namespace glslang { class TLiveTraverser : public TIntermTraverser { public: TLiveTraverser(const TIntermediate& i, bool traverseAll = false, - bool preVisit = true, bool inVisit = false, bool postVisit = false) : - TIntermTraverser(preVisit, inVisit, postVisit), + bool preVisit = true, bool inVisit = false, bool postVisit = false, bool includeDeclSymbol = false) : + TIntermTraverser(preVisit, inVisit, postVisit, false, includeDeclSymbol), intermediate(i), traverseAll(traverseAll) { } diff --git a/third_party/glslang/glslang/MachineIndependent/ParseContextBase.cpp b/third_party/glslang/glslang/MachineIndependent/ParseContextBase.cpp index 95c7f0053d..45ada17dbe 100644 --- a/third_party/glslang/glslang/MachineIndependent/ParseContextBase.cpp +++ b/third_party/glslang/glslang/MachineIndependent/ParseContextBase.cpp @@ -171,6 +171,9 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, case EbtHitObjectNV: message = "can't modify hitObjectNV"; break; + case EbtHitObjectEXT: + message = "can't modify hitObjectEXT"; + break; default: break; } @@ -279,7 +282,7 @@ void TParseContextBase::trackLinkage(TSymbol& symbol) // Ensure index is in bounds, correct if necessary. // Give an error if not. -void TParseContextBase::checkIndex(const TSourceLoc& loc, const TType& type, int& index) +void TParseContextBase::checkIndex(const TSourceLoc& loc, const TType& type, int64_t& index) { const auto sizeIsSpecializationExpression = [&type]() { return type.containsSpecializationSize() && @@ -484,6 +487,16 @@ const TFunction* TParseContextBase::selectFunction( return true; }; + const auto enabled = [this](const TFunction& candidate) -> bool { + bool enabled = candidate.getNumExtensions() == 0; + for (int i = 0; i < candidate.getNumExtensions(); ++i) { + TExtensionBehavior behavior = getExtensionBehavior(candidate.getExtensions()[i]); + if (behavior == EBhEnable || behavior == EBhRequire) + enabled = true; + } + return enabled; + }; + const TFunction* incumbent = viableCandidates.front(); for (auto it = viableCandidates.begin() + 1; it != viableCandidates.end(); ++it) { const TFunction& candidate = *(*it); @@ -499,7 +512,7 @@ const TFunction* TParseContextBase::selectFunction( // In the case of default parameters, it may have an identical initial set, which is // also ambiguous - if (betterParam(*incumbent, candidate) || equivalentParams(*incumbent, candidate)) + if ((betterParam(*incumbent, candidate) || equivalentParams(*incumbent, candidate)) && enabled(candidate)) tie = true; } diff --git a/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp b/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp index f44ae4a85a..658ca42d4b 100644 --- a/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -43,6 +43,7 @@ #include "Scan.h" #include +#include #include "Versions.h" #include "preprocessor/PpContext.h" @@ -404,6 +405,14 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector& if (tokens.size() != 1) error(loc, "extra tokens", "#pragma", ""); intermediate.setReplicatedComposites(); + } else if (spvVersion.spv > 0 && tokens[0].compare("promote_uint32_indices") == 0) { + if (tokens.size() != 1) + error(loc, "extra tokens", "#pragma", ""); + intermediate.setPromoteUint32Indices(); + } else if (spvVersion.spv > 0 && tokens[0].compare("shader_64bit_indexing") == 0) { + if (tokens.size() != 1) + error(loc, "extra tokens", "#pragma", ""); + intermediate.setShader64BitIndexing(); } else if (tokens[0].compare("once") == 0) { warn(loc, "not implemented", "#pragma once", ""); } else if (tokens[0].compare("glslang_binary_double_output") == 0) { @@ -542,15 +551,21 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb // TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIntermTyped* base, TIntermTyped* index) { - int indexValue = 0; - if (index->getQualifier().isFrontEndConstant()) - indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst(); - + int64_t indexValue = 0; + if (index->getQualifier().isFrontEndConstant()) { + if (index->getType().contains64BitInt()) { + indexValue = index->getAsConstantUnion()->getConstArray()[0].getI64Const(); + } else if (index->getType().getBasicType() == EbtUint) { + indexValue = index->getAsConstantUnion()->getConstArray()[0].getUConst(); + } else { + indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst(); + } + } // basic type checks... variableCheck(base); if (! base->isArray() && ! base->isMatrix() && ! base->isVector() && ! base->getType().isCoopMat() && - ! base->isReference() && ! base->getType().isCoopVecNV()) { + ! base->isReference() && ! base->getType().isCoopVecOrLongVector()) { if (base->getAsSymbolNode()) error(loc, " left of '[' is not of type array, matrix, or vector ", base->getAsSymbolNode()->getName().c_str(), ""); else @@ -624,7 +639,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn TType& leftType = binaryNode->getLeft()->getWritableType(); TArraySizes& arraySizes = *leftType.getArraySizes(); assert(arraySizes.getNumDims() == 2); - arraySizes.setDimSize(1, std::max(arraySizes.getDimSize(1), indexValue + 1)); + assert(indexValue < std::numeric_limits::max()); + arraySizes.setDimSize(1, std::max(arraySizes.getDimSize(1), (int)indexValue + 1)); } } } else @@ -912,7 +928,8 @@ TIntermTyped* TParseContext::handleBinaryMath(const TSourceLoc& loc, const char* if (((left->getType().contains16BitFloat() || right->getType().contains16BitFloat()) && !float16Arithmetic()) || ((left->getType().contains16BitInt() || right->getType().contains16BitInt()) && !int16Arithmetic()) || ((left->getType().contains8BitInt() || right->getType().contains8BitInt()) && !int8Arithmetic()) || - (left->getType().containsBFloat16() || right->getType().containsBFloat16())) { + (left->getType().containsBFloat16() || right->getType().containsBFloat16()) || + (left->getType().contains8BitFloat() || right->getType().contains8BitFloat())) { allowed = false; } @@ -940,7 +957,8 @@ TIntermTyped* TParseContext::handleUnaryMath(const TSourceLoc& loc, const char* if ((childNode->getType().contains16BitFloat() && !float16Arithmetic()) || (childNode->getType().contains16BitInt() && !int16Arithmetic()) || (childNode->getType().contains8BitInt() && !int8Arithmetic()) || - (childNode->getType().containsBFloat16())) { + (childNode->getType().containsBFloat16()) || + (childNode->getType().contains8BitFloat())) { allowed = false; } @@ -970,21 +988,26 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm // Save away the name in the AST for now. Processing is completed in // handleLengthMethod(). // - if (field == "length") { + if (field == "length" || field == "length64") { if (base->isArray()) { - profileRequires(loc, ENoProfile, 120, E_GL_3DL_array_objects, ".length"); - profileRequires(loc, EEsProfile, 300, nullptr, ".length"); + profileRequires(loc, ENoProfile, 120, E_GL_3DL_array_objects, (TString(".") + field).c_str()); + profileRequires(loc, EEsProfile, 300, nullptr, (TString(".") + field).c_str()); } else if (base->isVector() || base->isMatrix()) { const char* feature = ".length() on vectors and matrices"; requireProfile(loc, ~EEsProfile, feature); profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, feature); - } else if (!base->getType().isCoopMat() && !base->getType().isCoopVecNV()) { + } else if (!base->getType().isCoopMat() && !base->getType().isCoopVecOrLongVector()) { bool enhanced = intermediate.getEnhancedMsgs(); error(loc, "does not operate on this type:", field.c_str(), base->getType().getCompleteString(enhanced).c_str()); return base; } - return intermediate.addMethod(base, TType(EbtInt), &field, loc); + if (field == "length") { + return intermediate.addMethod(base, TType(EbtInt), &field, loc); + } else { + requireExtensions(loc, 1, &E_GL_EXT_shader_64bit_indexing, "length64"); + return intermediate.addMethod(base, TType(EbtInt64), &field, loc); + } } // It's not .length() if we get to here. @@ -1398,6 +1421,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if ((*fnCandidate)[0].type->getSampler().isMultiSample() && version <= 140) requireExtensions(loc, 1, &E_GL_ARB_texture_multisample, fnCandidate->getName().c_str()); } + bool hasLongVectorArg = false; if (arguments != nullptr) { // Make sure qualifications work for these arguments. TIntermAggregate* aggregate = arguments->getAsAggregate(); @@ -1482,6 +1506,21 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction i == 1 && arg->getAsTyped()->getType().getBasicType() != aggregate->getSequence()[0]->getAsTyped()->getType().getBasicType()) error(arguments->getLoc(), "cooperative vector basic types must match", fnCandidate->getName().c_str(), ""); + // Check that coopVecLoadNV and coopVecStoreNV buffer parameter is in buffer or shared storage + if (builtIn && (fnCandidate->getBuiltInOp() == EOpCooperativeVectorLoadNV || + fnCandidate->getBuiltInOp() == EOpCooperativeVectorStoreNV) && + i == 1) { + TStorageQualifier storage = arg->getAsTyped()->getType().getQualifier().storage; + if (storage != EvqBuffer && storage != EvqShared) { + error(arguments->getLoc(), "buffer argument must be in buffer or shared storage", + fnCandidate->getName().c_str(), ""); + } + } + + if (argType.isLongVector()) { + hasLongVectorArg = true; + } + // TODO 4.5 functionality: A shader will fail to compile // if the value passed to the memargument of an atomic memory function does not correspond to a buffer or // shared variable. It is acceptable to pass an element of an array or a single component of a vector to the @@ -1524,6 +1563,12 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction userFunctionCallCheck(loc, *call); } + if (hasLongVectorArg && fnCandidate->getBuiltInOp() != EOpNull) { + TType longVectorResultType(EbtVoid); + handleLongVectorBuiltin(loc, fnCandidate, &longVectorResultType, arguments); + result->setType(longVectorResultType); + } + // Convert 'out' arguments. If it was a constant folded built-in, it won't be an aggregate anymore. // Built-ins with a single argument aren't called with an aggregate, but they also don't have an output. // Also, build the qualifier list for user function calls, which are always called with an aggregate. @@ -1538,7 +1583,9 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction handleCoopMat2FunctionCall(loc, fnCandidate, result, arguments); - if (result->getAsTyped()->getType().isCoopVecNV() && + handleVector2CoopMatConversionCall(loc, fnCandidate, result, arguments); + + if (result->getAsTyped()->getType().isCoopVecOrLongVector() && !result->getAsTyped()->getType().isParameterized()) { if (auto unaryNode = result->getAsUnaryNode()) result->setType(unaryNode->getOperand()->getAsTyped()->getType()); @@ -1773,12 +1820,383 @@ void TParseContext::handleCoopMat2FunctionCall(const TSourceLoc& loc, const TFun // Set result type to match type of first parameter result->setType(result->getAsAggregate()->getSequence()[0]->getAsTyped()->getType()); } else { - // For MulAdd, set result type to match type of C parameter + // The only remaining operation is MulAdd + assert(fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAdd || + fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAddNV); + + // Validate that the matrix sizes are compatible for multiplication and addition + const auto &sequence = arguments->getAsAggregate()->getSequence(); + + using ArrayDim = const TArraySize&; + auto getDim = [](const TIntermSequence& seq, int idx) -> std::tuple { + const auto &type = seq[idx]->getAsTyped()->getType(); + const auto *size = type.getTypeParameters()->arraySizes; + + if (type.isCoopMatNV()) { + // coopmatNV don't encode usage, so provide the correct usage by default + return {size->getArraySize(2), size->getArraySize(3), idx}; + } else { + assert(type.isCoopMatKHR()); + return {size->getArraySize(1), size->getArraySize(2), size->getDimSize(3)}; + } + }; + + // sizes look like: [scope, rows, cols, use] + auto [aRows, aCols, aUse] = getDim(sequence, 0); + auto [bRows, bCols, bUse] = getDim(sequence, 1); + auto [cRows, cCols, cUse] = getDim(sequence, 2); + + auto toString = [](ArrayDim dim) -> std::string { + std::stringstream buf; + if (dim.node == nullptr) { + buf << dim.size; + } else { + buf << "spec_const"; + } + return buf.str(); + }; + + if (aCols != bRows) { + auto aRowsStr = toString(aRows); + auto aColsStr = toString(aCols); + auto bRowsStr = toString(bRows); + auto bColsStr = toString(bCols); + error(loc, "cannot multiply coop matrices with incompatible sizes", + sequence[0]->getAsSymbolNode()->getMangledName().c_str(), + "%s x %s with %s x %s", + aRowsStr.c_str(), + aColsStr.c_str(), + bRowsStr.c_str(), + bColsStr.c_str()); + } else if (aRows != cRows || bCols != cCols) { + auto aRowsStr = toString(aRows); + auto bColsStr = toString(bCols); + auto cRowsStr = toString(cRows); + auto cColsStr = toString(cCols); + error(loc, "cannot add coop matrices with incompatible sizes", + sequence[2]->getAsSymbolNode()->getMangledName().c_str(), + "%s x %s with %s x %s", + aRowsStr.c_str(), + bColsStr.c_str(), + cRowsStr.c_str(), + cColsStr.c_str()); + } else if (aUse != 0) { + error(loc, "coop matrix A in MulAdd operation has incompatible usage property,", + sequence[0]->getAsSymbolNode()->getMangledName().c_str(), + "found %d, but needed 0", aUse); + } else if (bUse != 1) { + error(loc, "coop matrix B in MulAdd operation has incompatible usage property,", + sequence[1]->getAsSymbolNode()->getMangledName().c_str(), + "found %d, but needed 1", bUse); + } else if (cUse != 2) { + error(loc, "coop matrix C in MulAdd operation has incompatible usage property,", + sequence[2]->getAsSymbolNode()->getMangledName().c_str(), + "found %d, but needed 2", cUse); + } + + // Set result type to match type of C parameter result->setType(result->getAsAggregate()->getSequence()[2]->getAsTyped()->getType()); } } } + +static const uint32_t spv_Scope_Subgroup = 3; + +void TParseContext::handleVector2CoopMatConversionCall(const TSourceLoc& loc, const TFunction* fnCandidate, + TIntermTyped*& result, TIntermNode* arguments) +{ + const uint32_t CM_MatrixUseA = 0; // == gl_MatrixUseA + const uint32_t CM_MatrixUseB = 1; // == gl_MatrixUseB + const uint32_t CM_MatrixUseAccumulator = 2; // == gl_MatrixUseAccumulator + + TOperator builtinOp = fnCandidate->getBuiltInOp(); + + if (!(builtinOp == EOpBitCastArrayQCOM || builtinOp == EOpExtractSubArrayQCOM || + builtinOp == EOpCompositeConstructCoopMatQCOM || builtinOp == EOpCompositeExtractCoopMatQCOM)) + return; + + TPublicType pubType{}; + auto* oldResult = result; + + if (builtinOp == EOpBitCastArrayQCOM) { + auto srcArr = arguments->getAsAggregate()->getSequence()[0]->getAsTyped(); + auto& srcTy = srcArr->getType(); + auto srcArrLen = srcTy.getArraySizes()->getDimSize(0); + auto srcLenAsNode = srcTy.getArraySizes()->getDimNode(0); + + auto dstArr = arguments->getAsAggregate()->getSequence()[1]->getAsTyped(); + auto& dstTy = dstArr->getType(); + auto dstArrLen = dstTy.getArraySizes()->getDimSize(0); + auto dstLenAsNode = dstTy.getArraySizes()->getDimNode(0); + + if (srcLenAsNode == nullptr && dstLenAsNode == nullptr) { + //do basic tests: + if ((srcArrLen * GetNumBits(srcTy.getBasicType())) != (dstArrLen * GetNumBits(dstTy.getBasicType()))) + error(loc, "source and target arrays have different bit sizes", "", ""); + } + + pubType.basicType = dstTy.getBasicType(); + pubType.vectorSize = 1u; + pubType.qualifier.precision = EpqNone; + pubType.coopmatNV = false; + pubType.coopmatKHR = false; + pubType.arraySizes = new TArraySizes; + pubType.arraySizes->addInnerSize(dstArrLen, dstLenAsNode); + pubType.typeParameters = nullptr; + } + + if (builtinOp == EOpExtractSubArrayQCOM) { + auto dstArr = arguments->getAsAggregate()->getSequence()[2]->getAsTyped(); + auto& dstTy = dstArr->getType(); + auto dstArrLen = dstTy.getArraySizes()->getDimSize(0); + auto dstLenAsNode = dstTy.getArraySizes()->getDimNode(0); + + if (dstLenAsNode == nullptr) { + if ((dstArrLen * GetNumBits(dstTy.getBasicType())) == 32) + error(loc, "the byte size of the target array must be 32", "", ""); + } + + pubType.basicType = dstTy.getBasicType(); + pubType.vectorSize = 1u; + pubType.qualifier.precision = EpqNone; + pubType.coopmatNV = false; + pubType.coopmatKHR = false; + pubType.arraySizes = new TArraySizes; + pubType.arraySizes->addInnerSize(dstArrLen, dstLenAsNode); + pubType.typeParameters = nullptr; + } + + if (builtinOp == EOpCompositeConstructCoopMatQCOM) { + + auto& srcType = arguments->getAsAggregate()->getSequence()[0]->getAsTyped()->getType(); + auto& dstType = arguments->getAsAggregate()->getSequence()[1]->getAsTyped()->getType(); + + glslang::TBasicType srcBasicType = srcType.getBasicType(); + glslang::TBasicType dstBasicType = dstType.getBasicType(); + + if (srcBasicType != EbtUint && srcBasicType != dstBasicType) + error(loc, "source and destination element types are not compatible", "", ""); + + uint32_t scope = spv_Scope_Subgroup; + uint32_t coopMatKHRuse = !0u; + uint32_t coopMatNumRows = !0u, coopMatNumCols = !0u; + TIntermTyped *nodeNumRows = nullptr, *nodeNumCols = nullptr; + const TTypeParameters* dstTypeParameters = dstType.getTypeParameters(); + if (dstTypeParameters->arraySizes == nullptr || dstTypeParameters->arraySizes->getNumDims() != 4) { + error(loc, "destination cooperative matrix has an unsupported type", "", ""); + } else { + auto arraySizes = dstTypeParameters->arraySizes; + scope = arraySizes->getDimSize(0); + coopMatNumRows = arraySizes->getDimSize(1); + nodeNumRows = arraySizes->getDimNode(1); + coopMatNumCols = arraySizes->getDimSize(2); + nodeNumCols = arraySizes->getDimNode(2); + coopMatKHRuse = arraySizes->getDimSize(3); + } + + if (scope != spv_Scope_Subgroup) { + scope = spv_Scope_Subgroup; + error(loc, "cooperative matrix has unsupported scope; gl_SubgroupScope is expected", "", ""); + } + + if (coopMatKHRuse > CM_MatrixUseAccumulator) { + coopMatKHRuse = CM_MatrixUseA; + error(loc, "cooperative matrix use must be one of gl_MatrixUseA, gl_MatrixUseB, gl_MatrixUseAccumulator", + "", ""); + } + + uint32_t dstBasicTypeSize = GetNumBits(dstBasicType) / 8; + + unsigned numRows = coopMatNumRows; + TIntermTyped* specConstRows = nodeNumRows; + unsigned numCols = coopMatNumCols; + TIntermTyped* specConstCols = nodeNumCols; + + // input array type + const TType& type = arguments->getAsAggregate()->getSequence()[0]->getAsTyped()->getType(); + uint32_t arrayLen = type.getArraySizes()->getDimSize(0); + auto arrayDimNode = type.getArraySizes()->getDimNode(0); + + if (coopMatKHRuse == CM_MatrixUseA || coopMatKHRuse == CM_MatrixUseAccumulator) { + // update numCols + if (arrayDimNode == nullptr && specConstCols == nullptr) + numCols = arrayLen * (sizeof(uint32_t) / dstBasicTypeSize); + } else if (coopMatKHRuse == CM_MatrixUseB) { + // update numRows + if (arrayDimNode == nullptr && specConstRows == nullptr) { + numRows = arrayLen * (sizeof(uint32_t) / dstBasicTypeSize); + } + } + + // construct the type + TArraySizes* arraySizes = new TArraySizes; + + // add Scope + arraySizes->addInnerSize(scope); + + // add the row size + arraySizes->addInnerSize(numRows, specConstRows); // copy from source + // add the column size + arraySizes->addInnerSize(numCols, specConstCols); // copy from source + // add cooperative matrix use + arraySizes->addInnerSize(coopMatKHRuse); + + pubType.basicType = dstBasicType; + pubType.vectorSize = 1u; + pubType.qualifier = srcType.getQualifier(); + pubType.qualifier.precision = EpqNone; + pubType.coopmatNV = dstType.isCoopMatNV(); + pubType.coopmatKHR = dstType.isCoopMatKHR(); + pubType.arraySizes = nullptr; + pubType.typeParameters = const_cast(dstTypeParameters); + } + + if (builtinOp == EOpCompositeExtractCoopMatQCOM) { + auto& srcType = arguments->getAsAggregate()->getSequence()[0]->getAsTyped()->getType(); + auto& dstType = arguments->getAsAggregate()->getSequence()[1]->getAsTyped()->getType(); + + glslang::TBasicType srcBasicType = srcType.getBasicType(); + glslang::TBasicType dstBasicType = dstType.getBasicType(); + + if (dstBasicType != EbtUint && srcBasicType != dstBasicType) + error(loc, "source and destination element types are not compatible", "", ""); + + uint32_t scope = spv_Scope_Subgroup; + unsigned coopMatKHRuse = !0u; + const TTypeParameters* srcTypeParameters = srcType.getTypeParameters(); + if (srcTypeParameters->arraySizes == nullptr || srcTypeParameters->arraySizes->getNumDims() != 4) { + error(loc, "source cooperative matrix has an unsupported type", "", ""); + } else { + auto arraySizes = srcTypeParameters->arraySizes; + scope = arraySizes->getDimSize(0); + coopMatKHRuse = arraySizes->getDimSize(3); + } + + if (scope != spv_Scope_Subgroup) { + scope = spv_Scope_Subgroup; + error(loc, "cooperative matrix has unsupported scope; gl_SubgroupScope is expected", "", ""); + } + + if (coopMatKHRuse > CM_MatrixUseAccumulator) { + coopMatKHRuse = CM_MatrixUseA; + error(loc, "cooperative matrix use must be one of gl_MatrixUseA, gl_MatrixUseB, gl_MatrixUseAccumulator", + "", ""); + } + + auto dstArrLen = dstType.getArraySizes()->getDimSize(0); + auto dstLenAsNode = dstType.getArraySizes()->getDimNode(0); + + if (dstLenAsNode == nullptr) { + bool ok = true; + switch (dstBasicType) { + case EbtUint: + case EbtInt: + case EbtFloat: + ok = (((coopMatKHRuse == CM_MatrixUseA || coopMatKHRuse == CM_MatrixUseB) && dstArrLen == 8) || + (coopMatKHRuse == + CM_MatrixUseAccumulator) /* && (dstArrLen == 64 || dstArrLen == 32 || dstArrLen == 16))*/); + break; + case EbtFloat16: + ok = (((coopMatKHRuse == CM_MatrixUseA || coopMatKHRuse == CM_MatrixUseB) && dstArrLen == 16) || + (coopMatKHRuse == + CM_MatrixUseAccumulator) /* && (dstArrLen == 64 || dstArrLen == 32 || dstArrLen == 16))*/); + break; + case EbtInt8: + case EbtUint8: + ok = (((coopMatKHRuse == CM_MatrixUseA || coopMatKHRuse == CM_MatrixUseB) && dstArrLen == 32) || + (coopMatKHRuse == + CM_MatrixUseAccumulator) /* && (dstArrLen == 64 || dstArrLen == 32 || dstArrLen == 16))*/); + break; + default: + error(loc, "unsupported element type", "", ""); + } + if (!ok) + error(loc, "unsupported destination array length", "", ""); + } + + pubType.basicType = dstBasicType; + pubType.vectorSize = 1u; + pubType.qualifier.precision = EpqNone; + pubType.coopmatNV = false; + pubType.coopmatKHR = false; + + pubType.arraySizes = new TArraySizes; + + { + //int coopMatKHRuse = srcTypeParameters->arraySizes->getDimSize(3); + uint32_t index = !0u; + if (coopMatKHRuse == CM_MatrixUseA) { + index = 2; + } else if (coopMatKHRuse == CM_MatrixUseB) { + index = 1; + } else if (coopMatKHRuse == CM_MatrixUseAccumulator) { + index = 2; + } else { + error(loc, "source cooperative matrix has an unexpected cooperative matrix use", "", ""); + } + int32_t numRowsOrCols = srcTypeParameters->arraySizes->getDimSize(index); + auto dimNode = srcTypeParameters->arraySizes->getDimNode(index); + if (dimNode != nullptr && dstLenAsNode == nullptr) { + numRowsOrCols = dstType.getArraySizes()->getDimSize(0); + dimNode = nullptr; + } + //int32_t dstArrLen = dstType.getArraySizes()->getDimSize(0); + pubType.arraySizes->addInnerSize(dstArrLen, dstLenAsNode); + if (dimNode == nullptr && dstLenAsNode == nullptr) { + const char* msg = nullptr; + if (coopMatKHRuse == CM_MatrixUseA && (numRowsOrCols != dstArrLen && dstArrLen != 8)) { + msg = "the source matrix's column is not compatible with the destination array"; + } else if (coopMatKHRuse == CM_MatrixUseB && (numRowsOrCols != dstArrLen && dstArrLen != 8)) { + msg = "the source matrix's row is not compatible with the destination array"; + } else if (coopMatKHRuse == CM_MatrixUseAccumulator && + (numRowsOrCols != dstArrLen && + (srcBasicType == EbtFloat16 && numRowsOrCols != 2 * dstArrLen))) { + msg = "the source matrix's column is not compatible with the destination array"; + } + if (msg != nullptr) + error(loc, msg, "", ""); + } + } + + pubType.typeParameters = nullptr; + } + + TType resultType(pubType); + if (pubType.typeParameters != nullptr) + resultType.copyTypeParameters(*pubType.typeParameters); + // need to make StorageQualifier temp + resultType.makeTemporary(); + result->setType(resultType); + + // the RHS of an assignment to be formed + auto rhs = result; + + // the LHS of an assignment to be formed; pick the last argument + int lhsIdx = (builtinOp == EOpExtractSubArrayQCOM ? 2 : 1); + auto lhs = arguments->getAsAggregate()->getSequence()[lhsIdx]->getAsTyped(); + // pop the last argument from the arguments sequence + arguments->getAsAggregate()->getSequence().pop_back(); + + // Create OpAssign + { + arrayObjectCheck(loc, lhs->getType(), "array assignment"); + storage16BitAssignmentCheck(loc, lhs->getType(), "="); + lValueErrorCheck(loc, "assign", lhs); + rValueErrorCheck(loc, "assign", rhs); + result = addAssign(loc, EOpAssign, lhs, rhs); + if (result == nullptr) + result = oldResult; + } +} + +void TParseContext::handleLongVectorBuiltin(const TSourceLoc& loc, const TFunction* fnCandidate, TType* resultType, TIntermNode* arguments) +{ + if (!IsSupportedLongVectorBuiltin(fnCandidate, resultType, arguments)) { + error(loc, "can't resolve types (ambiguous long vector overload)", fnCandidate->getName().c_str(), ""); + } +} + TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNode* arguments, const TFunction& function) { @@ -1786,6 +2204,26 @@ TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNo TIntermTyped *result = intermediate.addBuiltInFunctionCall(loc, function.getBuiltInOp(), function.getParamCount() == 1, arguments, function.getType()); + + // EXT_descriptor_heap + // All the image atomic ops' first param is image variable. + if (extensionTurnedOn(E_GL_EXT_descriptor_heap) && function.getBuiltInOp() <= EOpImageAtomicStore && + function.getBuiltInOp() >= EOpImageAtomicAdd) { + TIntermNode* imageNode = nullptr; + if (arguments->getAsAggregate() && arguments->getAsAggregate()->getSequence().size() > 0) + imageNode = arguments->getAsAggregate()->getSequence()[0]; + else if (arguments->getAsUnaryNode()) + imageNode = arguments->getAsUnaryNode(); + + if (imageNode && imageNode->getAsBinaryNode()) { + auto imageSymbol = imageNode->getAsBinaryNode()->getLeft(); + if (imageSymbol && imageSymbol->getType().isImage()) { + imageSymbol->getQualifier().setUsedByAtomic(); + result->getQualifier().setUsedByAtomic(); + } + } + } + if (result != nullptr && obeyPrecisionQualifiers()) computeBuiltinPrecisions(*result, function); @@ -2059,7 +2497,7 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction error(loc, "", function->getName().c_str(), "array must first be sized by a redeclaration or layout qualifier"); else if (isRuntimeLength(*intermNode->getAsTyped())) { // Create a unary op and let the back end handle it - return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); + return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, function->getType()); } else error(loc, "", function->getName().c_str(), "array must be declared with a size before using this method"); } @@ -2074,7 +2512,7 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction length = type.getMatrixCols(); else if (type.isVector()) length = type.getVectorSize(); - else if (type.isCoopMat() || type.isCoopVecNV()) + else if (type.isCoopMat() || type.isCoopVecOrLongVector()) return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); else { // we should not get here, because earlier semantic checking should have prevented this path @@ -2103,7 +2541,10 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte TIntermTyped* arg = function.getParamCount() == 1 ? arguments->getAsTyped() : (aggregate ? aggregate->getSequence()[i]->getAsTyped() : arguments->getAsTyped()); if (*function[i].type != arg->getType()) { if (function[i].type->getQualifier().isParamInput() && - !function[i].type->isCoopMat() && !function[i].type->isTensorARM()) { + !function[i].type->isCoopMat() && !function[i].type->isTensorARM() && + // tensor layout/view type declarations don't do conversions, so we can't convert these parameters either + (function.getName() != "createTensorLayoutNV") && + (function.getName() != "createTensorViewNV")) { // In-qualified arguments just need an extra node added above the argument to // convert to the correct type. arg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg); @@ -2230,6 +2671,9 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& const int gl_StorageSemanticsImage = 0x800; const int gl_StorageSemanticsOutput = 0x1000; + const int nonRelaxedMemoryOrder = gl_SemanticsAcquire | + gl_SemanticsRelease | + gl_SemanticsAcquireRelease; unsigned int semantics = 0, storageClassSemantics = 0; unsigned int semantics2 = 0, storageClassSemantics2 = 0; @@ -2296,22 +2740,6 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& break; } - if ((semantics & gl_SemanticsAcquire) && - (callNode.getOp() == EOpAtomicStore || callNode.getOp() == EOpImageAtomicStore)) { - error(loc, "gl_SemanticsAcquire must not be used with (image) atomic store", - fnCandidate.getName().c_str(), ""); - } - if ((semantics & gl_SemanticsRelease) && - (callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpImageAtomicLoad)) { - error(loc, "gl_SemanticsRelease must not be used with (image) atomic load", - fnCandidate.getName().c_str(), ""); - } - if ((semantics & gl_SemanticsAcquireRelease) && - (callNode.getOp() == EOpAtomicStore || callNode.getOp() == EOpImageAtomicStore || - callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpImageAtomicLoad)) { - error(loc, "gl_SemanticsAcquireRelease must not be used with (image) atomic load/store", - fnCandidate.getName().c_str(), ""); - } if (((semantics | semantics2) & ~(gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease | @@ -2320,6 +2748,7 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& gl_SemanticsVolatile))) { error(loc, "Invalid semantics value", fnCandidate.getName().c_str(), ""); } + if (((storageClassSemantics | storageClassSemantics2) & ~(gl_StorageSemanticsBuffer | gl_StorageSemanticsShared | gl_StorageSemanticsImage | @@ -2327,57 +2756,101 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& error(loc, "Invalid storage class semantics value", fnCandidate.getName().c_str(), ""); } - if (callNode.getOp() == EOpMemoryBarrier) { - if (!IsPow2(semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { - error(loc, "Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or " - "gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); - } - } else { - if (semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease)) { - if (!IsPow2(semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { - error(loc, "Semantics must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or " - "gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); - } - } - if (semantics2 & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease)) { - if (!IsPow2(semantics2 & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { - error(loc, "semUnequal must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or " - "gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); - } - } - } - if (callNode.getOp() == EOpMemoryBarrier) { - if (storageClassSemantics == 0) { - error(loc, "Storage class semantics must not be zero", fnCandidate.getName().c_str(), ""); - } - } - if (callNode.getOp() == EOpBarrier && semantics != 0 && storageClassSemantics == 0) { - error(loc, "Storage class semantics must not be zero", fnCandidate.getName().c_str(), ""); - } - if ((callNode.getOp() == EOpAtomicCompSwap || callNode.getOp() == EOpImageAtomicCompSwap) && - (semantics2 & (gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { - error(loc, "semUnequal must not be gl_SemanticsRelease or gl_SemanticsAcquireRelease", + if (((semantics & nonRelaxedMemoryOrder) && !IsPow2(semantics & nonRelaxedMemoryOrder)) || + ((semantics2 & nonRelaxedMemoryOrder) && !IsPow2(semantics2 & nonRelaxedMemoryOrder))) { + error(loc, + "Semantics must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or " + "gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); } - if ((semantics & gl_SemanticsMakeAvailable) && - !(semantics & (gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { + + if (((semantics & nonRelaxedMemoryOrder) && !storageClassSemantics) || + ((semantics2 & nonRelaxedMemoryOrder) && !storageClassSemantics2)) { + error(loc, + "Storage class semantics must not be zero when used with gl_SemanticsRelease, " + "gl_SemanticsAcquire, or gl_SemanticsAcquireRelease", + fnCandidate.getName().c_str(), ""); + } + + if ((storageClassSemantics && !(semantics & nonRelaxedMemoryOrder)) || + (storageClassSemantics2 && !(semantics2 & nonRelaxedMemoryOrder))) { + error(loc, + "Semantics must be gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease when used " + "with non-zero storage class semantics", + fnCandidate.getName().c_str(), ""); + } + + if (((semantics & gl_SemanticsMakeAvailable) && + !(semantics & (gl_SemanticsRelease | gl_SemanticsAcquireRelease))) || + ((semantics2 & gl_SemanticsMakeAvailable) && + !(semantics2 & (gl_SemanticsRelease | gl_SemanticsAcquireRelease)))) { error(loc, "gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); } - if ((semantics & gl_SemanticsMakeVisible) && - !(semantics & (gl_SemanticsAcquire | gl_SemanticsAcquireRelease))) { + + if (((semantics & gl_SemanticsMakeVisible) && !(semantics & (gl_SemanticsAcquire | gl_SemanticsAcquireRelease))) || + ((semantics2 & gl_SemanticsMakeVisible) && + !(semantics2 & (gl_SemanticsAcquire | gl_SemanticsAcquireRelease)))) { error(loc, "gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); } - if ((semantics & gl_SemanticsVolatile) && - (callNode.getOp() == EOpMemoryBarrier || callNode.getOp() == EOpBarrier)) { + + if ((callNode.getOp() == EOpAtomicStore || callNode.getOp() == EOpImageAtomicStore) && + (semantics & gl_SemanticsAcquire)) { + error(loc, "gl_SemanticsAcquire must not be used with (image) atomic store", fnCandidate.getName().c_str(), ""); + } + + if ((callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpImageAtomicLoad) && + (semantics & gl_SemanticsRelease)) { + error(loc, "gl_SemanticsRelease must not be used with (image) atomic load", fnCandidate.getName().c_str(), ""); + } + + if ((callNode.getOp() == EOpAtomicStore || callNode.getOp() == EOpImageAtomicStore || + callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpImageAtomicLoad) && + (semantics & gl_SemanticsAcquireRelease)) { + error(loc, "gl_SemanticsAcquireRelease must not be used with (image) atomic load/store", + fnCandidate.getName().c_str(), ""); + } + + if (callNode.getOp() == EOpMemoryBarrier && + !(semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { + error(loc, + "Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or " + "gl_SemanticsAcquireRelease when used with memoryBarrier", + fnCandidate.getName().c_str(), ""); + } + + if ((callNode.getOp() == EOpMemoryBarrier || callNode.getOp() == EOpBarrier) && + (semantics & gl_SemanticsVolatile)) { error(loc, "gl_SemanticsVolatile must not be used with memoryBarrier or controlBarrier", fnCandidate.getName().c_str(), ""); } - if ((callNode.getOp() == EOpAtomicCompSwap || callNode.getOp() == EOpImageAtomicCompSwap) && - ((semantics ^ semantics2) & gl_SemanticsVolatile)) { - error(loc, "semEqual and semUnequal must either both include gl_SemanticsVolatile or neither", - fnCandidate.getName().c_str(), ""); + + if (callNode.getOp() == EOpAtomicCompSwap || callNode.getOp() == EOpImageAtomicCompSwap) { + if (semantics2 & (gl_SemanticsRelease | gl_SemanticsAcquireRelease)) { + error(loc, "semUnequal must not be gl_SemanticsRelease or gl_SemanticsAcquireRelease", + fnCandidate.getName().c_str(), ""); + } + if ((semantics2 & gl_SemanticsAcquire) && !(semantics & (gl_SemanticsAcquire | gl_SemanticsAcquireRelease))) { + error(loc, + "semUnequal must not be gl_SemanticsAcquire unless semEqual is gl_SemanticsAcquire " + "or gl_SemanticsAcquireRelease", + fnCandidate.getName().c_str(), ""); + } + if ((semantics2 & gl_SemanticsMakeVisible) && !(semantics & gl_SemanticsMakeVisible)) { + error(loc, + "semUnequal must not include gl_SemanticsMakeVisible unless semEqual also includes " + "gl_SemanticsMakeVisible", + fnCandidate.getName().c_str(), ""); + } + if (storageClassSemantics2 & ~(storageClassSemantics)) { + error(loc, "semStorageUnequal must not include any option that is not present in semStorageEqual", + fnCandidate.getName().c_str(), ""); + } + if ((semantics ^ semantics2) & gl_SemanticsVolatile) { + error(loc, "semEqual and semUnequal must either both include gl_SemanticsVolatile or neither", + fnCandidate.getName().c_str(), ""); + } } } @@ -2407,6 +2880,19 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan TString featureString; const char* feature = nullptr; + + auto checkConstantArgWithLocation = [&](int argIndex, const char* argDescription, + const char* errMsg, int ioRTLocationSet) { + //ioRTLocationSet refers to grouping of locations of RT input/outputs as defined in TIntermediate::usedIoRT + if (!(*argp)[argIndex]->getAsConstantUnion()) { + error(loc, "argument must be compile-time constant", argDescription, argIndex == 10 ? "a" : ""); + } else if (ioRTLocationSet >= 0) { + unsigned int location = (*argp)[argIndex]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(ioRTLocationSet, location) < 0) + error(loc, "with layout(location =", errMsg, "%d)", location); + } + }; + switch (callNode.getOp()) { case EOpTextureGather: case EOpTextureGatherOffset: @@ -2452,7 +2938,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan if (! fnCandidate[0].type->getSampler().shadow) compArg = 3; // check for constant offsets - if (! (*argp)[fnCandidate[0].type->getSampler().shadow ? 3 : 2]->getAsConstantUnion() + if (! (*argp)[fnCandidate[0].type->getSampler().shadow ? 3 : 2]->getAsConstantUnion() // NV_gpu_shader5 relaxes this limitation and allows for non-constant offsets && !extensionTurnedOn(E_GL_NV_gpu_shader5)) error(loc, "must be a compile-time constant:", feature, "offsets argument"); @@ -2696,108 +3182,46 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan break; } + case EOpTraceNV: - if (!(*argp)[10]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "payload number", "a"); + checkConstantArgWithLocation(10, "payload number", nullptr, -1); break; case EOpTraceRayMotionNV: - if (!(*argp)[11]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "payload number", "a"); + checkConstantArgWithLocation(11, "payload number", nullptr, -1); break; case EOpTraceKHR: - if (!(*argp)[10]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "payload number", "a"); - else { - unsigned int location = (*argp)[10]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0) - error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location); - } + checkConstantArgWithLocation(10, "payload number", "no rayPayloadEXT/rayPayloadInEXT declared", 0); break; case EOpExecuteCallableNV: - if (!(*argp)[1]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "callable data number", ""); + checkConstantArgWithLocation(1, "callable data number", nullptr, -1); break; case EOpExecuteCallableKHR: - if (!(*argp)[1]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "callable data number", ""); - else { - unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(1, location) < 0) - error(loc, "with layout(location =", "no callableDataEXT/callableDataInEXT declared", "%d)", location); - } + checkConstantArgWithLocation(1, "callable data number", "no callableDataEXT/callableDataInEXT declared", 1); break; case EOpHitObjectTraceRayNV: - if (!(*argp)[11]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "payload number", ""); - else { - unsigned int location = (*argp)[11]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0) - error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location); - } + checkConstantArgWithLocation(11, "payload number", "no rayPayloadEXT/rayPayloadInEXT declared", 0); break; case EOpHitObjectTraceRayMotionNV: - if (!(*argp)[12]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "payload number", ""); - else { - unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0) - error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location); - } + checkConstantArgWithLocation(12, "payload number", "no rayPayloadEXT/rayPayloadInEXT declared", 0); break; case EOpHitObjectExecuteShaderNV: - if (!(*argp)[1]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "payload number", ""); - else { - unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0) - error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location); - } + checkConstantArgWithLocation(1, "payload number", "no rayPayloadEXT/rayPayloadInEXT declared", 0); break; case EOpHitObjectRecordHitNV: - if (!(*argp)[12]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); - else { - unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) - error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); - } + checkConstantArgWithLocation(12, "hitobjectattribute number", "no hitObjectAttributeNV declared", 2); break; case EOpHitObjectRecordHitMotionNV: - if (!(*argp)[13]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); - else { - unsigned int location = (*argp)[13]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) - error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); - } + checkConstantArgWithLocation(13, "hitobjectattribute number", "no hitObjectAttributeNV declared", 2); break; case EOpHitObjectRecordHitWithIndexNV: - if (!(*argp)[11]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); - else { - unsigned int location = (*argp)[11]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) - error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); - } + checkConstantArgWithLocation(11, "hitobjectattribute number", "no hitObjectAttributeNV declared", 2); break; case EOpHitObjectRecordHitWithIndexMotionNV: - if (!(*argp)[12]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); - else { - unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) - error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); - } + checkConstantArgWithLocation(12, "hitobjectattribute number", "no hitObjectAttributeNV declared", 2); break; case EOpHitObjectGetAttributesNV: - if (!(*argp)[1]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); - else { - unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); - if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) - error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); - } + checkConstantArgWithLocation(1, "hitobjectattribute number", "no hitObjectAttributeNV declared", 2); break; case EOpRayQueryGetIntersectionType: @@ -3149,6 +3573,30 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan if (!(*argp)[6]->getAsTyped()->getType().getQualifier().isConstant()) error(loc, "argument must be compile-time constant", "matrixInterpretation", ""); break; + + case EOpCooperativeMatrixLoad: + case EOpCooperativeMatrixLoadNV: + case EOpCooperativeMatrixLoadTensorNV: + case EOpCooperativeMatrixStore: + case EOpCooperativeMatrixStoreNV: + case EOpCooperativeMatrixStoreTensorNV: + { + const TIntermTyped *arg1 = (*argp)[1]->getAsTyped(); + const TIntermTyped* base = TIntermediate::traverseLValueBase(arg1, true, true); + const char* errMsg = "Only l-values corresponding to storage block or shared variables can be used with " + "cooperative matrix load/store functions."; + if (base) { + const TType* refType = (base->getType().isReference()) ? base->getType().getReferentType() : nullptr; + const TQualifier& qualifier = + (refType != nullptr) ? refType->getQualifier() : base->getType().getQualifier(); + if (qualifier.storage != EvqShared && qualifier.storage != EvqBuffer) + error(loc, errMsg, fnCandidate.getName().c_str(), ""); + } else { + error(loc, errMsg, fnCandidate.getName().c_str(), ""); + } + } + break; + default: break; } @@ -3189,10 +3637,10 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan error(loc, "second parameter must not have floate5m2 or floate4m3 basic type", "", ""); } - if (!(op0Type.isScalar() || op0Type.isVector() || op0Type.isCoopMatKHR())) { + if (!(op0Type.isScalar() || op0Type.isVector() || op0Type.isLongVector() || op0Type.isCoopMatKHR())) { error(loc, "first parameter must be scalar, vector, or cooperative matrix", "", ""); } - if (!(op1Type.isScalar() || op1Type.isVector() || op1Type.isCoopMatKHR())) { + if (!(op1Type.isScalar() || op1Type.isVector() || op1Type.isLongVector() || op1Type.isCoopMatKHR())) { error(loc, "second parameter must be scalar, vector, or cooperative matrix", "", ""); } if (!(op0Type.sameElementShape(op1Type) || op0Type.sameCoopMatShape(op1Type))) { @@ -3744,6 +4192,21 @@ void TParseContext::integerCheck(const TIntermTyped* node, const char* token) error(node->getLoc(), "scalar integer expression required", token, ""); } +// +// Both test, and if necessary spit out an error, to see if the node is really +// supported as an array index. +// +void TParseContext::arrayIndexCheck(const TIntermTyped* node, const char* token) +{ + auto from_type = node->getBasicType(); + + if ((from_type == EbtInt64 || from_type == EbtUint64) && + extensionTurnedOn(E_GL_EXT_shader_64bit_indexing)) + return; + + integerCheck(node, token); +} + // // Both test, and if necessary spit out an error, to see if we are currently // globally scoped. @@ -3762,6 +4225,10 @@ void TParseContext::reservedErrorCheck(const TSourceLoc& loc, const TString& ide // "Identifiers starting with "gl_" are reserved for use by OpenGL, and may not be // declared in a shader; this results in a compile-time error." if (! symbolTable.atBuiltInLevel()) { + // The extension GL_EXT_conservative_depth allows us to declare "gl_FragDepth". + if (identifier == "gl_FragDepth" && extensionTurnedOn(E_GL_EXT_conservative_depth)) + return; + if (builtInName(identifier) && !extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) // The extension GL_EXT_spirv_intrinsics allows us to declare identifiers starting with "gl_". error(loc, "identifiers starting with \"gl_\" are reserved", identifier.c_str(), ""); @@ -4419,11 +4886,22 @@ void TParseContext::accStructCheck(const TSourceLoc& loc, const TType& type, con } +void TParseContext::hitObjectEXTCheck(const TSourceLoc & loc, const TType & type, const TString & identifier) +{ + if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtHitObjectEXT)) { + error(loc, "struct is not allowed to contain hitObjectEXT:", type.getTypeName().c_str(), identifier.c_str()); + } else if (type.getBasicType() == EbtHitObjectEXT) { + TStorageQualifier qualifier = type.getQualifier().storage; + if (qualifier != EvqGlobal && qualifier != EvqTemporary) { + error(loc, "hitObjectEXT can only be declared in global or function scope with no storage qualifier:", "hitObjectEXT", identifier.c_str()); + } + } +} void TParseContext::hitObjectNVCheck(const TSourceLoc & loc, const TType & type, const TString & identifier) { - if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtHitObjectNV)) { + if (type.getBasicType() == EbtStruct && ( containsFieldWithBasicType(type, EbtHitObjectNV))) { error(loc, "struct is not allowed to contain hitObjectNV:", type.getTypeName().c_str(), identifier.c_str()); - } else if (type.getBasicType() == EbtHitObjectNV) { + } else if ((type.getBasicType() == EbtHitObjectNV)) { TStorageQualifier qualifier = type.getQualifier().storage; if (qualifier != EvqGlobal && qualifier != EvqTemporary) { error(loc, "hitObjectNV can only be declared in global or function scope with no storage qualifier:", "hitObjectNV", identifier.c_str()); @@ -4575,11 +5053,6 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali // now, knowing it is a shader in/out, do all the in/out semantic checks - if (publicType.basicType == EbtBool && !parsingBuiltins) { - error(loc, "cannot be bool", GetStorageQualifierString(qualifier.storage), ""); - return; - } - if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble) { profileRequires(loc, EEsProfile, 300, nullptr, "non-float shader input/output"); profileRequires(loc, ~EEsProfile, 130, nullptr, "non-float shader input/output"); @@ -5153,6 +5626,9 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua if (qualifier.storage == EvqBuffer && lastMember) return; + if (qualifier.storage == EvqUniform && lastMember && extensionTurnedOn(E_GL_EXT_uniform_buffer_unsized_array)) + return; + arraySizeRequiredCheck(loc, *arraySizes); } @@ -5277,6 +5753,20 @@ void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermType } } + // Check for last member of a uniform block, which can be runtime sizeable + // when using GL_EXT_uniform_buffer_unsized_array + if (base.getType().getQualifier().storage == EvqUniform && extensionTurnedOn(E_GL_EXT_uniform_buffer_unsized_array)) { + const TIntermBinary* binary = base.getAsBinaryNode(); + if (binary != nullptr && + binary->getOp() == EOpIndexDirectStruct) { + + const int index = binary->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); + const int memberCount = (int)binary->getLeft()->getType().getStruct()->size(); + if (index == memberCount - 1) + return; + } + } + // check for additional things allowed by GL_EXT_nonuniform_qualifier if (base.getBasicType() == EbtSampler || base.getBasicType() == EbtAccStruct || base.getBasicType() == EbtRayQuery || base.getBasicType() == EbtHitObjectNV || (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer())) @@ -5381,7 +5871,8 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS bool nonEsRedecls = (!isEsProfile() && (version >= 130 || identifier == "gl_TexCoord")); bool esRedecls = (isEsProfile() && - (version >= 320 || extensionsTurnedOn(Num_AEP_shader_io_blocks, AEP_shader_io_blocks))); + (version >= 320 || extensionsTurnedOn(Num_AEP_shader_io_blocks, AEP_shader_io_blocks) || + (identifier == "gl_FragDepth" && extensionTurnedOn(E_GL_EXT_conservative_depth)))); if (! esRedecls && ! nonEsRedecls) return nullptr; @@ -5835,9 +6326,11 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali paramCheckFixStorage(loc, qualifier.storage, type); } -void TParseContext::nestedBlockCheck(const TSourceLoc& loc) +void TParseContext::nestedBlockCheck(const TSourceLoc& loc, const bool allowedInnerStruct) { - if (structNestingLevel > 0 || blockNestingLevel > 0) + if ((!allowedInnerStruct && structNestingLevel > 0) || + (allowedInnerStruct && structNestingLevel <= 0) || + blockNestingLevel > 0) error(loc, "cannot nest a block definition inside a structure or block", "", ""); ++blockNestingLevel; } @@ -5919,7 +6412,8 @@ void TParseContext::structTypeCheck(const TSourceLoc& /*loc*/, TPublicType& publ const TSourceLoc& memberLoc = typeList[member].loc; if (memberQualifier.isAuxiliary() || memberQualifier.isInterpolation() || - (memberQualifier.storage != EvqTemporary && memberQualifier.storage != EvqGlobal)) + (memberQualifier.storage != EvqTemporary && memberQualifier.storage != EvqGlobal && + !memberQualifier.layoutDescriptorHeap && !memberQualifier.layoutDescriptorInnerBlock)) error(memberLoc, "cannot use storage or interpolation qualifiers on structure members", typeList[member].type->getFieldName().c_str(), ""); if (memberQualifier.isMemory()) error(memberLoc, "cannot use memory qualifiers on structure members", typeList[member].type->getFieldName().c_str(), ""); @@ -5985,9 +6479,9 @@ void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init, inductiveLoopIds.insert(loopIndex); // condition's form must be "loop-index relational-operator constant-expression" - bool badCond = ! loop->getTest(); + bool badCond = ! loop->getTestExpr(); if (! badCond) { - TIntermBinary* binaryCond = loop->getTest()->getAsBinaryNode(); + TIntermBinary* binaryCond = loop->getTestExpr()->getAsBinaryNode(); badCond = ! binaryCond; if (! badCond) { switch (binaryCond->getOp()) { @@ -6086,6 +6580,9 @@ void TParseContext::finish() if (parsingBuiltins) return; + // Forward builtin alias to AST for later use + intermediate.setBuiltinAliasLookup(symbolTable.collectBuiltinAlias()); + // Check on array indexes for ES 2.0 (version 100) limitations. for (size_t i = 0; i < needsIndexLimitationChecking.size(); ++i) constantIndexExpressionCheck(needsIndexLimitationChecking[i]); @@ -6210,6 +6707,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi return; } } + if (id == "descriptor_heap") { + requireExtensions(loc, 1, &E_GL_EXT_descriptor_heap, "descriptor_stride"); + requireVulkan(loc, "descriptor_heap"); + publicType.qualifier.layoutDescriptorHeap = true; + return; + } if (id == "push_constant") { requireVulkan(loc, "push_constant"); publicType.qualifier.layoutPushConstant = true; @@ -6387,8 +6890,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth+1)) { if (id == TQualifier::getLayoutDepthString(depth)) { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, "depth layout qualifier"); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, nullptr, "depth layout qualifier"); + const char* feature = "depth layout qualifier"; + requireProfile(loc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, E_GL_ARB_conservative_depth, feature); + profileRequires(loc, EEsProfile, 0, E_GL_EXT_conservative_depth, feature); publicType.shaderQualifiers.layoutDepth = depth; return; } @@ -6478,6 +6983,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi requireExtensions(loc, 1, &E_GL_NV_shader_invocation_reorder, "hitobject shader record NV"); publicType.qualifier.layoutHitObjectShaderRecordNV = true; return; + } else if (id == "hitobjectshaderrecordext") { + requireExtensions(loc, 1, &E_GL_EXT_shader_invocation_reorder, "hitobject shader record EXT"); + publicType.qualifier.layoutHitObjectShaderRecordEXT = true; + return; } } @@ -6724,6 +7233,45 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi return; } + if (id == "bank") { + requireExtensions(loc, 1, &E_GL_NV_push_constant_bank, "bank"); + if (nonLiteral) + error(loc, "needs a literal integer", id.c_str(), ""); + else if (value < 0 || (unsigned int)value >= TQualifier::layoutBankEnd) + error(loc, "bank out of range", id.c_str(), ""); + else + publicType.qualifier.layoutBank = value; + return; + } + if (id == "member_offset") { + requireExtensions(loc, 1, &E_GL_NV_push_constant_bank, "member_offset"); + if (nonLiteral) + error(loc, "needs a literal integer", id.c_str(), ""); + else if (value < 0) + error(loc, "must be equal or greater than 0", id.c_str(), ""); + else + publicType.qualifier.layoutMemberOffset = value; + return; + } + + if (id == "descriptor_stride") { + requireExtensions(loc, 1, &E_GL_EXT_descriptor_heap, "descriptor_stride"); + requireVulkan(loc, "descriptor_stride"); + if (!IsPow2(value)) + error(loc, "must be a power of 2", "descriptor_stride", ""); + else + publicType.qualifier.layoutDescriptorStride = uint32_t(value); + return; + } + + if (id == "heap_offset") { + requireExtensions(loc, 1, &E_GL_EXT_descriptor_heap, "heap_offset"); + requireExtensions(loc, 1, &E_GL_EXT_structured_descriptor_heap, "heap_offset"); + requireVulkan(loc, "heap_offset"); + publicType.qualifier.layoutHeapOffset = uint32_t(value); + return; + } + switch (language) { case EShLangTessControl: if (id == "vertices") { @@ -6964,6 +7512,14 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie dst.layoutXfbOffset = src.layoutXfbOffset; if (src.hasAttachment()) dst.layoutAttachment = src.layoutAttachment; + if (src.layoutDescriptorHeap) + dst.layoutDescriptorHeap = true; + if (src.layoutDescriptorInnerBlock) + dst.layoutDescriptorInnerBlock = true; + if (src.layoutDescriptorStride != TQualifier::layoutDescriptorStrideEnd) + dst.layoutDescriptorStride = src.layoutDescriptorStride; + if (src.layoutHeapOffset != 0) + dst.layoutHeapOffset = src.layoutHeapOffset; if (src.layoutPushConstant) dst.layoutPushConstant = true; @@ -6993,6 +7549,12 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie if (src.layoutHitObjectShaderRecordNV) dst.layoutHitObjectShaderRecordNV = true; dst.layoutTileAttachmentQCOM |= src.layoutTileAttachmentQCOM; + if (src.layoutHitObjectShaderRecordEXT) + dst.layoutHitObjectShaderRecordEXT = true; + if (src.hasBank()) + dst.layoutBank = src.layoutBank; + if (src.hasMemberOffset()) + dst.layoutMemberOffset = src.layoutMemberOffset; } } @@ -7068,6 +7630,22 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb break; } } + + // Check that an in/out variable or block doesn't contain a boolean member + // Don't enforce if redeclaring a builtin, which are allowed to contain bool + if (!parsingBuiltins && type.containsBasicType(EbtBool) && !builtInName(symbol.getName())) { + switch(qualifier.storage) { + case EvqVaryingIn: + case EvqVaryingOut: + { + const char *reason = type.getBasicType() == EbtBool ? "cannot be bool" : "cannot contain bool"; + error(loc, reason, GetStorageQualifierString(qualifier.storage), ""); + break; + } + default: + break; + } + } } // "For some blocks declared as arrays, the location can only be applied at the block level: @@ -7143,6 +7721,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) case EvqCallableData: case EvqCallableDataIn: case EvqHitObjectAttrNV: + case EvqHitObjectAttrEXT: case EvqSpirvStorageClass: break; case EvqTileImageEXT: @@ -7231,7 +7810,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) // SPIR-V if (spvVersion.spv > 0) { - if (qualifier.isUniformOrBuffer()) { + if (qualifier.isUniformOrBuffer() && !intermediate.IsRequestedExtension(E_GL_EXT_descriptor_heap)) { if (type.getBasicType() == EbtBlock && !qualifier.isPushConstant() && !qualifier.isShaderRecord() && !qualifier.hasAttachment() && @@ -7355,6 +7934,8 @@ static bool storageCanHaveLayoutInBlock(const enum TStorageQualifier storage) case EvqUniform: case EvqBuffer: case EvqShared: + case EvqSamplerHeap: + case EvqResourceHeap: return true; default: return false; @@ -7490,6 +8071,21 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier if (qualifier.storage == EvqHitAttr && qualifier.hasLayout()) { error(loc, "cannot apply layout qualifiers to hitAttributeNV variable", "hitAttributeNV", ""); } + if (qualifier.hasBank()) { + if (!qualifier.isPushConstant()) + error(loc, "can only be used with push_constant", "bank", ""); + } + if (qualifier.hasMemberOffset()) { + if (!qualifier.isPushConstant()) + error(loc, "can only be used with push_constant", "member_offset", ""); + } + + if (qualifier.layoutDescriptorStride != TQualifier::layoutDescriptorStrideEnd && + !qualifier.layoutDescriptorHeap) + error(loc, "must specify 'descriptor_heap' to use 'descriptor_stride'", "descriptor_stride", ""); + if (qualifier.layoutHeapOffset != 0 && !qualifier.layoutDescriptorHeap && + qualifier.storage != EvqSamplerHeap && qualifier.storage != EvqResourceHeap) + error(loc, "must specify 'descriptor_heap' to use 'heap_offset'", "heap_offset", ""); } // For places that can't have shader-level layout qualifiers @@ -7815,19 +8411,22 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu TType toElementType(to, 0); // Load/store tensor functions allow any element type for the pointer if ((op == EOpCooperativeMatrixLoadTensorNV || op == EOpCooperativeMatrixStoreTensorNV) && - param == 1 && - (from.getQualifier().storage == EvqBuffer || from.getQualifier().storage == EvqShared)) { + param == 1) { return true; } if (fromElementType == toElementType) return true; } + if (TType::vectorAndLongVectorMatch(from, to)) + return true; if (from.isArray() || to.isArray() || ! from.sameElementShape(to)) return false; if (from.isCoopMat() && to.isCoopMat()) return from.sameCoopMatBaseType(to); if (from.isCoopVecNV() && to.isCoopVecNV()) return from.sameCoopVecBaseType(to); + if (from.isLongVector() && to.isLongVector()) + return from.sameLongVectorBaseType(to); if (from.isTensorARM() && to.isTensorARM()) return from.sameTensorBaseTypeARM(to); return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType()); @@ -7838,10 +8437,13 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu // Assumes 'convertible' already said true. const auto better = [&](const TType& from, const TType& to1, const TType& to2) -> bool { // 1. exact match - if (from == to2) - return from != to1; - if (from == to1) + bool to2Matches = from == to2 || (from.isLongVector() && to2.getBasicType() == EbtLongVector); + bool to1Matches = from == to1 || (from.isLongVector() && to1.getBasicType() == EbtLongVector); + if (to2Matches) + return !to1Matches; + if (to1Matches) return false; + if (extensionTurnedOn(E_GL_NV_gpu_shader5)) { // This map refers to the conversion table mentioned under the // section "Modify Section 6.1, Function Definitions, p. 63" in NV_gpu_shader5 spec @@ -7892,7 +8494,7 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu // "To determine whether the conversion for a single argument in one match // is better than that for another match, the conversion is assigned of the // three ranks ordered from best to worst: -// 1. Exact match: no conversion. +// 1. Exact match: no conversion. // 2. Promotion: integral or floating-point promotion. // 3. Conversion: integral conversion, floating-point conversion, // floating-integral conversion. @@ -7929,19 +8531,22 @@ const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc, TType toElementType(to, 0); // Load/store tensor functions allow any element type for the pointer if ((op == EOpCooperativeMatrixLoadTensorNV || op == EOpCooperativeMatrixStoreTensorNV) && - param == 1 && - (from.getQualifier().storage == EvqBuffer || from.getQualifier().storage == EvqShared)) { + param == 1) { return true; } if (fromElementType == toElementType) return true; } + if (TType::vectorAndLongVectorMatch(from, to)) + return true; if (from.isArray() || to.isArray() || ! from.sameElementShape(to)) return false; if (from.isCoopMat() && to.isCoopMat()) return from.sameCoopMatBaseType(to); if (from.isCoopVecNV() && to.isCoopVecNV()) return from.sameCoopVecBaseType(to); + if (from.isLongVector() && to.isLongVector()) + return from.sameLongVectorBaseType(to); if (from.isTensorARM() && to.isTensorARM()) return from.sameTensorBaseTypeARM(to); return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType()); @@ -7952,9 +8557,11 @@ const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc, // Assumes 'convertible' already said true. const auto better = [this](const TType& from, const TType& to1, const TType& to2) -> bool { // 1. exact match - if (from == to2) - return from != to1; - if (from == to1) + bool to2Matches = from == to2 || (from.isLongVector() && to2.getBasicType() == EbtLongVector); + bool to1Matches = from == to1 || (from.isLongVector() && to1.getBasicType() == EbtLongVector); + if (to2Matches) + return !to1Matches; + if (to1Matches) return false; // 2. Promotion (integral, floating-point) is better @@ -8248,6 +8855,11 @@ bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString // merge qualifiers mergeObjectLayoutQualifiers(updatedBlock->getWritableType().getQualifier(), type.getQualifier(), true); + // set default value for bank when no decoration is present. + if (updatedBlock->getWritableType().getQualifier().isPushConstant() && !updatedBlock->getWritableType().getQualifier().hasBank()) { + updatedBlock->getWritableType().getQualifier().layoutBank = 0; + } + return true; } @@ -8263,12 +8875,15 @@ static void ForEachOpaque(const TType& type, const TString& path, Function callb ++flatIndex) { TString subscriptPath = path; - for (size_t dimIndex = 0; dimIndex < indices.size(); ++dimIndex) + if (path != "") { - int index = indices[dimIndex]; - subscriptPath.append("["); - subscriptPath.append(String(index)); - subscriptPath.append("]"); + for (size_t dimIndex = 0; dimIndex < indices.size(); ++dimIndex) + { + int index = indices[dimIndex]; + subscriptPath.append("["); + subscriptPath.append(String(index)); + subscriptPath.append("]"); + } } recursion(type, subscriptPath, true, recursion); @@ -8276,7 +8891,7 @@ static void ForEachOpaque(const TType& type, const TString& path, Function callb for (size_t dimIndex = 0; dimIndex < indices.size(); ++dimIndex) { ++indices[dimIndex]; - if (indices[dimIndex] < type.getArraySizes()->getDimSize(dimIndex)) + if (indices[dimIndex] < type.getArraySizes()->getDimSize(static_cast(dimIndex))) break; else indices[dimIndex] = 0; @@ -8290,8 +8905,11 @@ static void ForEachOpaque(const TType& type, const TString& path, Function callb for (const TTypeLoc& typeLoc : types) { TString nextPath = path; - nextPath.append("."); - nextPath.append(typeLoc.type->getFieldName()); + if (path != "") + { + nextPath.append("."); + nextPath.append(typeLoc.type->getFieldName()); + } recursion(*(typeLoc.type), nextPath, false, recursion); } @@ -8349,9 +8967,13 @@ void TParseContext::vkRelaxedRemapFunctionParameter(TFunction* function, TParame if (!param.type->isStruct() || !param.type->containsOpaque()) return; - ForEachOpaque(*param.type, (param.name ? *param.name : param.type->getFieldName()), + TString fieldName = param.name + ? *param.name + : param.type->hasFieldName() ? param.type->getFieldName() : ""; + + ForEachOpaque(*param.type, fieldName, [function, param, newParams](const TType& type, const TString& path) { - TString* memberName = NewPoolTString(path.c_str()); + TString* memberName = path != "" ? NewPoolTString(path.c_str()) : nullptr; TType* memberType = new TType(); memberType->shallowCopy(type); @@ -8532,7 +9154,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden if (initializer) { if (type.getBasicType() == EbtRayQuery) { error(loc, "ray queries can only be initialized by using the rayQueryInitializeEXT intrinsic:", "=", identifier.c_str()); - } else if (type.getBasicType() == EbtHitObjectNV) { + } else if ((type.getBasicType() == EbtHitObjectNV) || (type.getBasicType() == EbtHitObjectEXT)) { error(loc, "hit objects cannot be initialized using initializers", "=", identifier.c_str()); } @@ -8587,7 +9209,15 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden if (!publicType.typeParameters || !publicType.typeParameters->arraySizes || publicType.typeParameters->arraySizes->getNumDims() != 1) { error(loc, "expected two type parameters", identifier.c_str(), ""); - } else if (publicType.typeParameters->arraySizes->getDimSize(0) <= 0) { + } else if (publicType.typeParameters->arraySizes->getDimNode(0) == nullptr && publicType.typeParameters->arraySizes->getDimSize(0) <= 0) { + error(loc, "expected positive number of components", identifier.c_str(), ""); + } + } else if (type.isLongVector()) { + intermediate.setUseStorageBuffer(); + + if (!publicType.typeParameters || !publicType.typeParameters->arraySizes || publicType.typeParameters->arraySizes->getNumDims() != 1) { + error(loc, "expected two type parameters", identifier.c_str(), ""); + } else if (publicType.typeParameters->arraySizes->getDimNode(0) == nullptr && publicType.typeParameters->arraySizes->getDimSize(0) <= 0) { error(loc, "expected positive number of components", identifier.c_str(), ""); } } else if (type.isTensorARM()) { @@ -8632,6 +9262,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden atomicUintCheck(loc, type, identifier); accStructCheck(loc, type, identifier); hitObjectNVCheck(loc, type, identifier); + hitObjectEXTCheck(loc, type, identifier); checkAndResizeMeshViewDim(loc, type, /*isBlockMember*/ false); if (type.getQualifier().storage == EvqConst && type.containsReference()) { error(loc, "variables with reference type can't have qualifier 'const'", "qualifier", ""); @@ -8730,13 +9361,33 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden initNode = executeInitializer(loc, initializer, variable); } + // EXT_descriptor_heap + if (!untypedHeapCheck(symbol, type, loc, identifier.c_str())) { + return nullptr; + } + // look for errors in layout qualifier use layoutObjectCheck(loc, *symbol); // fix up fixOffset(loc, *symbol); - return initNode; + // TODO: The decl AST is turned on based on debug info right now. We should expose it as an explicit option. + if (intermediate.getDebugInfo()) { + TVariable* variable = symbol->getAsVariable(); + if (variable) { + auto decl = new TIntermVariableDecl(intermediate.addSymbol(*variable, loc), initNode); + decl->setLoc(loc); + return decl; + } + else { + // We ignore builtins redeclarations + return nullptr; + } + } + else { + return initNode; + } } // Pick up global defaults from the provide global defaults into dst. @@ -9656,10 +10307,64 @@ void TParseContext::updateBindlessQualifier(TType& memberType) } } +void TParseContext::descHeapBuiltinRemap(TType* type, bool isInnerBlock) +{ + if (type->isStruct()) { + TTypeList* types = type->getWritableStruct(); + for (auto typeLoc : *types) { + descHeapBuiltinRemap(typeLoc.type, isInnerBlock); + } + } + + auto* qualifier = &type->getQualifier(); + if (type->getBasicType() == EbtSampler) { + if (type->isImage() || type->isTexture()) + qualifier->builtIn = EbvResourceHeapEXT; + else + qualifier->builtIn = EbvSamplerHeapEXT; + qualifier->layoutDescriptorHeap = true; + } else if (qualifier->isUniformOrBuffer() || type->getBasicType() == EbtAccStruct) { + qualifier->builtIn = EbvResourceHeapEXT; + qualifier->layoutDescriptorHeap = true; + qualifier->layoutDescriptorInnerBlock = isInnerBlock; + } + } + +bool TParseContext::untypedHeapCheck(TSymbol* symbol, const TType& type, const TSourceLoc& loc, const char* name) +{ + // EXT_descriptor_heap + bool isHeapStruct = + (type.getQualifier().storage == EvqSamplerHeap || type.getQualifier().storage == EvqResourceHeap); + + if (intermediate.IsRequestedExtension(E_GL_EXT_descriptor_heap) && spvVersion.vulkan > 0 && + !type.getQualifier().hasSet() && !type.getQualifier().hasBinding()) { + if (type.getQualifier().layoutDescriptorHeap || isHeapStruct) { + if ((intermediate.isEsProfile() && intermediate.getVersion() < 310) || + (!intermediate.isEsProfile() && intermediate.getVersion() < 420)) { + TString warnMsg = "layout(descriptor_heap) is turned on beyond version/profile limits."; + infoSink.info.message(EPrefixWarning, warnMsg.c_str()); + } + if (IsAnonymous(symbol->getName()) && + (type.getQualifier().isUniformOrBuffer() || type.getBasicType() == EbtBlock)) { + error(loc, "layout(descriptor_heap) decorated block should be explicitly " + "declared with a run-time sized array type.", name, ""); + return false; + } + if (!type.containsHeapArray()) { + error(loc, "layout(descriptor_heap) decorated variable could only be declared as an array.", + name, ""); + return false; + } + descHeapBuiltinRemap(&symbol->getWritableType(), isHeapStruct); + } + } + return true; +} + // -// Do everything needed to add an interface block. +// Do everything needed to add an interface block. Returns the declarator node if there's an instance declaration. // -void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, const TString* instanceName, +TIntermNode* TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, const TString* instanceName, TArraySizes* arraySizes) { if (spvVersion.vulkan > 0 && spvVersion.vulkanRelaxed) @@ -9707,12 +10412,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con } // For bindless texture, sampler can be declared as uniform/storage block member, - if (memberType.containsOpaque()) { + if (memberType.containsOpaque() && !extensionTurnedOn(E_GL_EXT_structured_descriptor_heap)) { if (memberType.containsSampler() && extensionTurnedOn(E_GL_ARB_bindless_texture)) updateBindlessQualifier(memberType); else error(memberLoc, "member of block cannot be or contain a sampler, image, or atomic_uint type", typeList[member].type->getFieldName().c_str(), ""); - } + } if (memberType.containsCoopMat()) error(memberLoc, "member of block cannot be or contain a cooperative matrix type", typeList[member].type->getFieldName().c_str(), ""); @@ -9725,7 +10430,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // do all the rest. if (! symbolTable.atBuiltInLevel() && builtInName(*blockName)) { redeclareBuiltinBlock(loc, typeList, *blockName, instanceName, arraySizes); - return; + return nullptr; } // Not a redeclaration of a built-in; check that all names are user names. @@ -9891,7 +10596,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con } } if (!instanceName) { - return; + return nullptr; } } else { // @@ -9914,11 +10619,11 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (existingName->getType().getBasicType() == EbtBlock) { if (existingName->getType().getQualifier().storage == blockType.getQualifier().storage) { error(loc, "Cannot reuse block name within the same interface:", blockName->c_str(), blockType.getStorageQualifierString()); - return; + return nullptr; } } else { error(loc, "block name cannot redefine a non-block name", blockName->c_str(), ""); - return; + return nullptr; } } } @@ -9935,7 +10640,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con else error(loc, "block instance name redefinition", variable.getName().c_str(), ""); - return; + return nullptr; + } + + // EXT_descriptor_heap + if (!untypedHeapCheck(&variable, blockType, loc, blockName->c_str())) { + return nullptr; } // Check for general layout qualifier errors @@ -9950,6 +10660,17 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // Save it in the AST for linker use. trackLinkage(variable); + + TIntermAggregate* declNode = nullptr; + if (intermediate.getDebugInfo()) { + auto blockDeclNode = new TIntermVariableDecl(intermediate.addSymbol(variable, loc), nullptr); + blockDeclNode->setLoc(loc); + + // We have to wrap the declaration with a sequence to fit the same processing logic with variables. + declNode = new TIntermAggregate(EOpSequence); + declNode->getSequence().push_back(blockDeclNode); + } + return declNode; } // @@ -10038,6 +10759,18 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q profileRequires(loc, ~EEsProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV block"); requireStage(loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | EShLangMissMask), "hitObjectAttributeNV block"); break; + case EvqHitObjectAttrEXT: + profileRequires(loc, ~EEsProfile, 460, E_GL_EXT_shader_invocation_reorder, "hitObjectAttributeEXT block"); + requireStage(loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | EShLangMissMask), "hitObjectAttributeEXT block"); + break; + case EvqResourceHeap: + profileRequires(loc, ~EEsProfile, 460, E_GL_EXT_structured_descriptor_heap, "resourceheap block"); + profileRequires(loc, ~EEsProfile, 460, E_GL_EXT_descriptor_heap, "resourceheap block"); + break; + case EvqSamplerHeap: + profileRequires(loc, ~EEsProfile, 460, E_GL_EXT_structured_descriptor_heap, "samplerheap block"); + profileRequires(loc, ~EEsProfile, 460, E_GL_EXT_descriptor_heap, "samplerheap block"); + break; default: error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), ""); break; diff --git a/third_party/glslang/glslang/MachineIndependent/ParseHelper.h b/third_party/glslang/glslang/MachineIndependent/ParseHelper.h index a2de165e01..785c9c68b0 100644 --- a/third_party/glslang/glslang/MachineIndependent/ParseHelper.h +++ b/third_party/glslang/glslang/MachineIndependent/ParseHelper.h @@ -115,7 +115,7 @@ public: virtual void setLimits(const TBuiltInResource&) = 0; - void checkIndex(const TSourceLoc&, const TType&, int& index); + void checkIndex(const TSourceLoc&, const TType&, int64_t& index); EShLanguage getLanguage() const { return language; } void setScanContext(TScanContext* c) { scanContext = c; } @@ -381,6 +381,7 @@ public: void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override; void constantValueCheck(TIntermTyped* node, const char* token); void integerCheck(const TIntermTyped* node, const char* token); + void arrayIndexCheck(const TIntermTyped* node, const char* token); void globalCheck(const TSourceLoc&, const char* token); bool constructorError(const TSourceLoc&, TIntermNode*, TFunction&, TOperator, TType&); bool constructorTextureSamplerError(const TSourceLoc&, const TFunction&); @@ -397,6 +398,7 @@ public: void samplerCheck(const TSourceLoc&, const TType&, const TString& identifier, TIntermTyped* initializer); void atomicUintCheck(const TSourceLoc&, const TType&, const TString& identifier); void accStructCheck(const TSourceLoc & loc, const TType & type, const TString & identifier); + void hitObjectEXTCheck(const TSourceLoc& loc, const TType& type, const TString& identifier); void hitObjectNVCheck(const TSourceLoc & loc, const TType & type, const TString & identifier); void transparentOpaqueCheck(const TSourceLoc&, const TType&, const TString& identifier); void memberQualifierCheck(glslang::TPublicType&); @@ -414,7 +416,7 @@ public: void redeclareBuiltinBlock(const TSourceLoc&, TTypeList& typeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes); void paramCheckFixStorage(const TSourceLoc&, const TStorageQualifier&, TType& type); void paramCheckFix(const TSourceLoc&, const TQualifier&, TType& type); - void nestedBlockCheck(const TSourceLoc&); + void nestedBlockCheck(const TSourceLoc&, const bool allowedInnerStruct = false); void nestedStructCheck(const TSourceLoc&); void arrayObjectCheck(const TSourceLoc&, const TType&, const char* op); void opaqueCheck(const TSourceLoc&, const TType&, const char* op); @@ -454,7 +456,9 @@ public: TParameter getParamWithDefault(const TPublicType& ty, TString* identifier, TIntermTyped* initializer, const TSourceLoc& loc); void inheritMemoryQualifiers(const TQualifier& from, TQualifier& to); - void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = nullptr, TArraySizes* arraySizes = nullptr); + void descHeapBuiltinRemap(TType* type, bool isInnerBlock); + bool untypedHeapCheck(TSymbol* symbol, const TType& type, const TSourceLoc& loc, const char* name); + TIntermNode* declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = nullptr, TArraySizes* arraySizes = nullptr); void blockStorageRemap(const TSourceLoc&, const TString*, TQualifier&); void blockStageIoCheck(const TSourceLoc&, const TQualifier&); void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName); @@ -513,6 +517,8 @@ protected: TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); void finish() override; void handleCoopMat2FunctionCall(const TSourceLoc& loc, const TFunction* fnCandidate, TIntermTyped* result, TIntermNode* arguments); + void handleVector2CoopMatConversionCall(const TSourceLoc& loc, const TFunction* fnCandidate, TIntermTyped* &result, TIntermNode* arguments); + void handleLongVectorBuiltin(const TSourceLoc& loc, const TFunction* fnCandidate, TType* resultType, TIntermNode* arguments); virtual const char* getGlobalUniformBlockName() const override; virtual void finalizeGlobalUniformBlockLayout(TVariable&) override; diff --git a/third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp b/third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp index 1d33bfd203..29baf1f1a5 100644 --- a/third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp +++ b/third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp @@ -43,7 +43,7 @@ namespace glslang { // Code to recursively delete the intermediate tree. // struct TRemoveTraverser : TIntermTraverser { - TRemoveTraverser() : TIntermTraverser(false, false, true, false) {} + TRemoveTraverser() : TIntermTraverser(false, false, true, false, true) {} virtual void visitSymbol(TIntermSymbol* node) { @@ -103,6 +103,12 @@ struct TRemoveTraverser : TIntermTraverser { return true; } + + virtual bool visitVariableDecl(TVisit /* visit */, TIntermVariableDecl* decl) + { + delete decl; + return true; + } }; // diff --git a/third_party/glslang/glslang/MachineIndependent/Scan.cpp b/third_party/glslang/glslang/MachineIndependent/Scan.cpp index a29a6da25c..665a92e663 100644 --- a/third_party/glslang/glslang/MachineIndependent/Scan.cpp +++ b/third_party/glslang/glslang/MachineIndependent/Scan.cpp @@ -771,11 +771,17 @@ const std::unordered_map KeywordMap { {"tensorARM",TENSORARM}, + {"hitObjectEXT",HITOBJECTEXT}, + {"hitObjectAttributeEXT",HITOBJECTATTREXT}, + {"__function",FUNCTION}, {"tensorLayoutNV",TENSORLAYOUTNV}, {"tensorViewNV",TENSORVIEWNV}, {"coopvecNV",COOPVECNV}, + {"vector",VECTOR}, + {"resourceheap",RESOURCEHEAP}, + {"samplerheap",SAMPLERHEAP}, }; const std::unordered_set ReservedSet { "common", @@ -836,12 +842,22 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) loc = ppToken.loc; parserToken->sType.lex.loc = loc; switch (token) { - case ';': afterType = false; afterBuffer = false; return SEMICOLON; - case ',': afterType = false; return COMMA; + case ';': afterType = false; afterBuffer = false; inDeclaratorList = false; afterDeclarator = false; angleBracketDepth = 0; squareBracketDepth = 0; parenDepth = 0; return SEMICOLON; + case ',': + // If we just processed a declarator (identifier after a type), this comma + // indicates that we're in a declarator list. Note that 'afterDeclarator' is + // only set when we are not inside a template parameter list, array expression, + // or function parameter list. + if (afterDeclarator) { + inDeclaratorList = true; + } + afterType = false; + afterDeclarator = false; + return COMMA; case ':': return COLON; - case '=': afterType = false; return EQUAL; - case '(': afterType = false; return LEFT_PAREN; - case ')': afterType = false; return RIGHT_PAREN; + case '=': afterType = false; inDeclaratorList = false; afterDeclarator = false; return EQUAL; + case '(': afterType = false; inDeclaratorList = false; afterDeclarator = false; parenDepth++; return LEFT_PAREN; + case ')': afterType = false; inDeclaratorList = false; afterDeclarator = false; if (parenDepth > 0) parenDepth--; return RIGHT_PAREN; case '.': field = true; return DOT; case '!': return BANG; case '-': return DASH; @@ -850,16 +866,16 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) case '*': return STAR; case '/': return SLASH; case '%': return PERCENT; - case '<': return LEFT_ANGLE; - case '>': return RIGHT_ANGLE; + case '<': angleBracketDepth++; return LEFT_ANGLE; + case '>': if (angleBracketDepth > 0) angleBracketDepth--; return RIGHT_ANGLE; case '|': return VERTICAL_BAR; case '^': return CARET; case '&': return AMPERSAND; case '?': return QUESTION; - case '[': return LEFT_BRACKET; - case ']': return RIGHT_BRACKET; - case '{': afterStruct = false; afterBuffer = false; return LEFT_BRACE; - case '}': return RIGHT_BRACE; + case '[': squareBracketDepth++; return LEFT_BRACKET; + case ']': if (squareBracketDepth > 0) squareBracketDepth--; return RIGHT_BRACKET; + case '{': afterStruct = false; afterBuffer = false; inDeclaratorList = false; afterDeclarator = false; angleBracketDepth = 0; squareBracketDepth = 0; parenDepth = 0; return LEFT_BRACE; + case '}': inDeclaratorList = false; afterDeclarator = false; angleBracketDepth = 0; squareBracketDepth = 0; parenDepth = 0; return RIGHT_BRACE; case '\\': parseContext.error(loc, "illegal use of escape character", "\\", ""); break; @@ -1340,13 +1356,14 @@ int TScanContext::tokenizeIdentifier() case U64VEC2: case U64VEC3: case U64VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || parseContext.extensionTurnedOn(E_GL_NV_gpu_shader5) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int64)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int64)) { + afterType = true; return keyword; + } return identifierOrType(); case INT8_T: @@ -1357,13 +1374,14 @@ int TScanContext::tokenizeIdentifier() case U8VEC2: case U8VEC3: case U8VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || parseContext.extensionTurnedOn(E_GL_EXT_shader_8bit_storage) || parseContext.extensionTurnedOn(E_GL_NV_gpu_shader5) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8)) { + afterType = true; return keyword; + } return identifierOrType(); case INT16_T: @@ -1374,14 +1392,15 @@ int TScanContext::tokenizeIdentifier() case U16VEC2: case U16VEC3: case U16VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) || parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || parseContext.extensionTurnedOn(E_GL_NV_gpu_shader5) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16)) { + afterType = true; return keyword; + } return identifierOrType(); case INT32_T: case UINT32_T: @@ -1391,23 +1410,25 @@ int TScanContext::tokenizeIdentifier() case U32VEC2: case U32VEC3: case U32VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || parseContext.extensionTurnedOn(E_GL_NV_gpu_shader5) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32)) { + afterType = true; return keyword; + } return identifierOrType(); case FLOAT32_T: case F32VEC2: case F32VEC3: case F32VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || parseContext.extensionTurnedOn(E_GL_NV_gpu_shader5) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) { + afterType = true; return keyword; + } return identifierOrType(); case F32MAT2: case F32MAT3: @@ -1421,25 +1442,27 @@ int TScanContext::tokenizeIdentifier() case F32MAT4X2: case F32MAT4X3: case F32MAT4X4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) { + afterType = true; return keyword; + } return identifierOrType(); case FLOAT64_T: case F64VEC2: case F64VEC3: case F64VEC4: - afterType = true; - if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - (parseContext.extensionTurnedOn(E_GL_NV_gpu_shader5) && - parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_fp64)) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) - return keyword; - return identifierOrType(); + if (parseContext.symbolTable.atBuiltInLevel() || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + (parseContext.extensionTurnedOn(E_GL_NV_gpu_shader5) && + parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_fp64)) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) { + afterType = true; + return keyword; + } + return identifierOrType(); case F64MAT2: case F64MAT3: case F64MAT4: @@ -1452,26 +1475,27 @@ int TScanContext::tokenizeIdentifier() case F64MAT4X2: case F64MAT4X3: case F64MAT4X4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) { + afterType = true; return keyword; + } return identifierOrType(); case FLOAT16_T: case F16VEC2: case F16VEC3: case F16VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) || parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || parseContext.extensionTurnedOn(E_GL_NV_gpu_shader5) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16)) { + afterType = true; return keyword; - + } return identifierOrType(); case F16MAT2: @@ -1486,12 +1510,13 @@ int TScanContext::tokenizeIdentifier() case F16MAT4X2: case F16MAT4X3: case F16MAT4X4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) || parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16)) { + afterType = true; return keyword; + } return identifierOrType(); @@ -1499,10 +1524,11 @@ int TScanContext::tokenizeIdentifier() case BF16VEC2: case BF16VEC3: case BF16VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_EXT_bfloat16)) + parseContext.extensionTurnedOn(E_GL_EXT_bfloat16)) { + afterType = true; return keyword; + } return identifierOrType(); @@ -1510,10 +1536,11 @@ int TScanContext::tokenizeIdentifier() case FE5M2VEC2: case FE5M2VEC3: case FE5M2VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_EXT_float_e5m2)) + parseContext.extensionTurnedOn(E_GL_EXT_float_e5m2)) { + afterType = true; return keyword; + } return identifierOrType(); @@ -1521,10 +1548,11 @@ int TScanContext::tokenizeIdentifier() case FE4M3VEC2: case FE4M3VEC3: case FE4M3VEC4: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_EXT_float_e4m3)) + parseContext.extensionTurnedOn(E_GL_EXT_float_e4m3)) { + afterType = true; return keyword; + } return identifierOrType(); @@ -1793,10 +1821,11 @@ int TScanContext::tokenizeIdentifier() case F16SUBPASSINPUT: case F16SUBPASSINPUTMS: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch)) + parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch)) { + afterType = true; return keyword; + } return identifierOrType(); case EXPLICITINTERPAMD: @@ -1845,38 +1874,51 @@ int TScanContext::tokenizeIdentifier() return identifierOrType(); case FCOOPMATNV: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_NV_cooperative_matrix)) + parseContext.extensionTurnedOn(E_GL_NV_cooperative_matrix)) { + afterType = true; return keyword; + } return identifierOrType(); case UCOOPMATNV: case ICOOPMATNV: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_NV_integer_cooperative_matrix)) + parseContext.extensionTurnedOn(E_GL_NV_integer_cooperative_matrix)) { + afterType = true; return keyword; + } return identifierOrType(); case TENSORARM: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_ARM_tensors)) + parseContext.extensionTurnedOn(E_GL_ARM_tensors)) { + afterType = true; return keyword; + } return identifierOrType(); case COOPMAT: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_KHR_cooperative_matrix)) + parseContext.extensionTurnedOn(E_GL_KHR_cooperative_matrix)) { + afterType = true; return keyword; + } return identifierOrType(); case COOPVECNV: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_NV_cooperative_vector)) + parseContext.extensionTurnedOn(E_GL_NV_cooperative_vector)) { + afterType = true; return keyword; + } + return identifierOrType(); + + case VECTOR: + if (parseContext.symbolTable.atBuiltInLevel() || + parseContext.extensionTurnedOn(E_GL_EXT_long_vector)) { + afterType = true; + return keyword; + } return identifierOrType(); case DEMOTE: @@ -1907,6 +1949,13 @@ int TScanContext::tokenizeIdentifier() return keyword; return identifierOrType(); + case HITOBJECTEXT: + if (parseContext.symbolTable.atBuiltInLevel() || + (!parseContext.isEsProfile() && parseContext.version >= 460 + && parseContext.extensionTurnedOn(E_GL_EXT_shader_invocation_reorder))) + return keyword; + return identifierOrType(); + case HITOBJECTATTRNV: if (parseContext.symbolTable.atBuiltInLevel() || (!parseContext.isEsProfile() && parseContext.version >= 460 @@ -1914,12 +1963,27 @@ int TScanContext::tokenizeIdentifier() return keyword; return identifierOrType(); + case HITOBJECTATTREXT: + if (parseContext.symbolTable.atBuiltInLevel() || + (!parseContext.isEsProfile() && parseContext.version >= 460 + && parseContext.extensionTurnedOn(E_GL_EXT_shader_invocation_reorder))) + return keyword; + return identifierOrType(); + case FUNCTION: case TENSORLAYOUTNV: case TENSORVIEWNV: - afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_NV_cooperative_matrix2)) + parseContext.extensionTurnedOn(E_GL_NV_cooperative_matrix2)) { + afterType = true; + return keyword; + } + return identifierOrType(); + + case RESOURCEHEAP: + case SAMPLERHEAP: + if (parseContext.extensionTurnedOn(E_GL_EXT_structured_descriptor_heap) && + parseContext.extensionTurnedOn(E_GL_EXT_descriptor_heap)) return keyword; return identifierOrType(); @@ -1935,14 +1999,29 @@ int TScanContext::identifierOrType() if (field) return IDENTIFIER; + // If we see an identifier right after a type, this might be a declarator. + // But not in template parameters (inside angle brackets), array expressions (inside square brackets), + // or function parameters (inside parentheses) + if (afterType && angleBracketDepth == 0 && squareBracketDepth == 0 && parenDepth == 0) { + afterDeclarator = true; + afterType = false; + return IDENTIFIER; + } + parserToken->sType.lex.symbol = parseContext.symbolTable.find(*parserToken->sType.lex.string); if ((afterType == false && afterStruct == false) && parserToken->sType.lex.symbol != nullptr) { if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) { if (variable->isUserType() && // treat redeclaration of forward-declared buffer/uniform reference as an identifier !(variable->getType().isReference() && afterBuffer)) { - afterType = true; + // If we're in a declarator list (like "float a, B;"), treat struct names as IDENTIFIER + // to fix GitHub issue #3931 + if (inDeclaratorList) { + return IDENTIFIER; + } + + afterType = true; return TYPE_NAME; } } diff --git a/third_party/glslang/glslang/MachineIndependent/ScanContext.h b/third_party/glslang/glslang/MachineIndependent/ScanContext.h index 74b2b3c746..ce2145eb99 100644 --- a/third_party/glslang/glslang/MachineIndependent/ScanContext.h +++ b/third_party/glslang/glslang/MachineIndependent/ScanContext.h @@ -53,7 +53,7 @@ public: explicit TScanContext(TParseContextBase& pc) : parseContext(pc), afterType(false), afterStruct(false), - field(false), afterBuffer(false) { } + field(false), afterBuffer(false), inDeclaratorList(false), afterDeclarator(false), angleBracketDepth(0), squareBracketDepth(0), parenDepth(0) { } virtual ~TScanContext() { } static void fillInKeywordMap(); @@ -82,6 +82,11 @@ protected: bool afterStruct; // true if we've recognized the STRUCT keyword, so can only be looking for an identifier bool field; // true if we're on a field, right after a '.' bool afterBuffer; // true if we've recognized the BUFFER keyword + bool inDeclaratorList; // true if we detected we're in a declarator list like "float a, b;" + bool afterDeclarator; // true if we just saw an identifier after a type (potential declarator) + int angleBracketDepth; // track nesting level of < > to detect template parameters + int squareBracketDepth; // track nesting level of [ ] to detect array expressions + int parenDepth; // track nesting level of ( ) to detect function parameters TSourceLoc loc; TParserToken* parserToken; TPpToken* ppToken; diff --git a/third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp b/third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp index 62d72535b2..7a0433c118 100644 --- a/third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -1855,6 +1855,7 @@ void TShader::setUniformLocationBase(int base) { intermediate->setUniformLocationBase(base); } +void TShader::setBindingsPerResourceType() { intermediate->setBindingsPerResourceType(); } void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); } void TShader::setResourceSetBinding(const std::vector& base) { intermediate->setResourceSetBinding(base); } void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); } diff --git a/third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp b/third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp index dbcd575ece..fd8a690f27 100644 --- a/third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp +++ b/third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp @@ -86,6 +86,7 @@ void TType::buildMangledName(TString& mangledName) const case EbtRayQuery: mangledName += "rq"; break; case EbtSpirvType: mangledName += "spv-t"; break; case EbtHitObjectNV: mangledName += "ho"; break; + case EbtHitObjectEXT: mangledName += "ho"; break; case EbtTensorLayoutNV: mangledName += "tl"; break; case EbtTensorViewNV: mangledName += "tv"; break; case EbtSampler: @@ -346,6 +347,24 @@ void TSymbolTableLevel::setFunctionExtensions(const char* name, int num, const c } } +// Call the callback function to determine the required extensions +void TSymbolTableLevel::setFunctionExtensionsCallback(const char* name, std::function(const char *)> const &func) +{ + tLevel::const_iterator candidate = level.lower_bound(name); + while (candidate != level.end()) { + const TString& candidateName = (*candidate).first; + TString::size_type parenAt = candidateName.find_first_of('('); + if (parenAt != candidateName.npos && candidateName.compare(0, parenAt, name) == 0) { + TSymbol* symbol = candidate->second; + + auto exts = func(candidateName.c_str()); + symbol->setExtensions(exts.size(), exts.data()); + } else + break; + ++candidate; + } +} + // Make a single function require an extension(s). i.e., this will only set the extensions for the symbol that matches 'name' exactly. // This is different from setFunctionExtensions, which uses std::map::lower_bound to effectively set all symbols that start with 'name'. // Should only be used for a version/profile that actually needs the extension(s). diff --git a/third_party/glslang/glslang/MachineIndependent/SymbolTable.h b/third_party/glslang/glslang/MachineIndependent/SymbolTable.h index c2f5ccf15a..9161927493 100644 --- a/third_party/glslang/glslang/MachineIndependent/SymbolTable.h +++ b/third_party/glslang/glslang/MachineIndependent/SymbolTable.h @@ -69,6 +69,9 @@ #include "../Include/intermediate.h" #include "../Include/InfoSink.h" +#include +#include + namespace glslang { // @@ -503,6 +506,11 @@ public: retargetedSymbols.push_back({from, to}); } + void collectRetargetedSymbols(std::unordered_multimap &out) const { + for (const auto &[fromName, toName] : retargetedSymbols) + out.insert({std::string{toName}, std::string{fromName}}); + } + TSymbol* find(const TString& name) const { tLevel::const_iterator it = level.find(name); @@ -596,6 +604,7 @@ public: void relateToOperator(const char* name, TOperator op); void setFunctionExtensions(const char* name, int num, const char* const extensions[]); + void setFunctionExtensionsCallback(const char* name, std::function(const char *)> const &func); void setSingleFunctionExtensions(const char* name, int num, const char* const extensions[]); void dump(TInfoSink& infoSink, bool complete = false) const; TSymbolTableLevel* clone() const; @@ -659,9 +668,10 @@ public: // protected: static const uint32_t LevelFlagBitOffset = 56; - static const int globalLevel = 3; + static constexpr int builtinLevel = 2; + static constexpr int globalLevel = 3; static bool isSharedLevel(int level) { return level <= 1; } // exclude all per-compile levels - static bool isBuiltInLevel(int level) { return level <= 2; } // exclude user globals + static bool isBuiltInLevel(int level) { return level <= builtinLevel; } // exclude user globals static bool isGlobalLevel(int level) { return level <= globalLevel; } // include user globals public: bool isEmpty() { return table.size() == 0; } @@ -826,6 +836,13 @@ public: table[level]->retargetSymbol(from, to); } + std::unordered_multimap collectBuiltinAlias() { + std::unordered_multimap allRetargets; + for (int level = 0; level <= std::min(currentLevel(), builtinLevel); ++level) + table[level]->collectRetargetedSymbols(allRetargets); + + return allRetargets; + } // Find of a symbol that returns how many layers deep of nested // structures-with-member-functions ('this' scopes) deep the symbol was @@ -898,6 +915,12 @@ public: table[level]->setFunctionExtensions(name, num, extensions); } + void setFunctionExtensionsCallback(const char* name, std::function(const char *)> const &func) + { + for (unsigned int level = 0; level < table.size(); ++level) + table[level]->setFunctionExtensionsCallback(name, func); + } + void setSingleFunctionExtensions(const char* name, int num, const char* const extensions[]) { for (unsigned int level = 0; level < table.size(); ++level) diff --git a/third_party/glslang/glslang/MachineIndependent/Versions.cpp b/third_party/glslang/glslang/MachineIndependent/Versions.cpp index 8b2f7b7e8f..4238d4f6c2 100644 --- a/third_party/glslang/glslang/MachineIndependent/Versions.cpp +++ b/third_party/glslang/glslang/MachineIndependent/Versions.cpp @@ -229,6 +229,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_draw_instanced] = EBhDisable; extensionBehavior[E_GL_ARB_bindless_texture] = EBhDisable; extensionBehavior[E_GL_ARB_fragment_coord_conventions] = EBhDisable; + extensionBehavior[E_GL_ARB_conservative_depth] = EBhDisable; extensionBehavior[E_GL_KHR_shader_subgroup_basic] = EBhDisable; @@ -316,6 +317,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_NV_cooperative_matrix2] = EBhDisable; extensionBehavior[E_GL_NV_cluster_acceleration_structure] = EBhDisable; extensionBehavior[E_GL_NV_linear_swept_spheres] = EBhDisable; + extensionBehavior[E_GL_NV_push_constant_bank] = EBhDisable; // ARM extensionBehavior[E_GL_ARM_shader_core_builtins] = EBhDisable; @@ -325,6 +327,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_QCOM_image_processing] = EBhDisable; extensionBehavior[E_GL_QCOM_image_processing2] = EBhDisable; extensionBehavior[E_GL_QCOM_tile_shading] = EBhDisable; + extensionBehavior[E_GL_QCOM_cooperative_matrix_conversion] = EBhDisable; // AEP extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable; @@ -343,6 +346,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_texture_buffer] = EBhDisable; extensionBehavior[E_GL_EXT_texture_cube_map_array] = EBhDisable; extensionBehavior[E_GL_EXT_null_initializer] = EBhDisable; + extensionBehavior[E_GL_EXT_descriptor_heap] = EBhDisable; // OES matching AEP extensionBehavior[E_GL_OES_geometry_shader] = EBhDisable; @@ -384,6 +388,10 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_bfloat16] = EBhDisable; extensionBehavior[E_GL_EXT_float_e4m3] = EBhDisable; extensionBehavior[E_GL_EXT_float_e5m2] = EBhDisable; + extensionBehavior[E_GL_EXT_uniform_buffer_unsized_array] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_64bit_indexing] = EBhDisable; + extensionBehavior[E_GL_EXT_conservative_depth] = EBhDisable; + extensionBehavior[E_GL_EXT_long_vector] = EBhDisable; // OVR extensions extensionBehavior[E_GL_OVR_multiview] = EBhDisable; @@ -409,6 +417,8 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_integer_dot_product] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_invocation_reorder] = EBhDisable; + // Record extensions not for spv. spvUnsupportedExt.push_back(E_GL_ARB_bindless_texture); } @@ -430,6 +440,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_shader_texture_lod 1\n" "#define GL_EXT_shadow_samplers 1\n" "#define GL_EXT_fragment_shading_rate 1\n" + "#define GL_EXT_conservative_depth 1\n" // AEP "#define GL_ANDROID_extension_pack_es31a 1\n" @@ -449,6 +460,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_shader_implicit_conversions 1\n" "#define GL_EXT_shader_integer_mix 1\n" "#define GL_EXT_blend_func_extended 1\n" + "#define GL_EXT_descriptor_heap 1\n" // OES matching AEP "#define GL_OES_geometry_shader 1\n" @@ -465,6 +477,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_QCOM_image_processing 1\n" "#define GL_QCOM_image_processing2 1\n" "#define GL_QCOM_tile_shading 1\n" + "#define GL_QCOM_cooperative_matrix_conversion 1\n" ; if (version >= 300) { @@ -518,6 +531,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_NV_gpu_shader5 1\n" "#define GL_ARB_draw_instanced 1\n" "#define GL_ARB_fragment_coord_conventions 1\n" + "#define GL_ARB_conservative_depth 1\n" "#define GL_EXT_shader_non_constant_global_initializers 1\n" "#define GL_EXT_shader_image_load_formatted 1\n" @@ -596,6 +610,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_QCOM_image_processing 1\n" "#define GL_QCOM_image_processing2 1\n" "#define GL_QCOM_tile_shading 1\n" + "#define GL_QCOM_cooperative_matrix_conversion 1\n" "#define GL_EXT_shader_explicit_arithmetic_types 1\n" "#define GL_EXT_shader_explicit_arithmetic_types_int8 1\n" @@ -624,6 +639,11 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_bfloat16 1\n" "#define GL_EXT_float_e5m2 1\n" "#define GL_EXT_float_e4m3 1\n" + "#define GL_EXT_uniform_buffer_unsized_array 1\n" + "#define GL_EXT_shader_64bit_indexing 1\n" + + "#define GL_EXT_shader_invocation_reorder 1\n" + "#define GL_EXT_descriptor_heap 1\n" ; if (spvVersion.spv == 0) { @@ -647,6 +667,11 @@ void TParseVersions::getPreamble(std::string& preamble) } } + if ((!isEsProfile() && version >= 460) || + (isEsProfile() && version >= 320)) { + preamble += "#define GL_EXT_nontemporal_keyword 1\n"; + } + if ((!isEsProfile() && version >= 140) || (isEsProfile() && version >= 310)) { preamble += @@ -713,8 +738,8 @@ void TParseVersions::getPreamble(std::string& preamble) case EShLangClosestHit: preamble += "#define GL_CLOSEST_HIT_SHADER_EXT 1 \n"; break; case EShLangMiss: preamble += "#define GL_MISS_SHADER_EXT 1 \n"; break; case EShLangCallable: preamble += "#define GL_CALLABLE_SHADER_EXT 1 \n"; break; - case EShLangTask: preamble += "#define GL_TASK_SHADER_NV 1 \n"; break; - case EShLangMesh: preamble += "#define GL_MESH_SHADER_NV 1 \n"; break; + case EShLangTask: preamble += "#define GL_TASK_SHADER_EXT 1 \n"; break; + case EShLangMesh: preamble += "#define GL_MESH_SHADER_EXT 1 \n"; break; default: break; } } @@ -1464,6 +1489,14 @@ void TParseVersions::coopmatCheck(const TSourceLoc& loc, const char* op, bool bu } } +void TParseVersions::coopmatConverisonCheckQCOM(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (!builtIn) { + const char* const extensions[] = {E_GL_KHR_cooperative_matrix}; + requireExtensions(loc, sizeof(extensions) / sizeof(extensions[0]), extensions, op); + } +} + void TParseVersions::tensorLayoutViewCheck(const TSourceLoc& loc, const char* op, bool builtIn) { if (!builtIn) { @@ -1496,6 +1529,14 @@ void TParseVersions::tensorCheckARM(const TSourceLoc& loc, const char* op, bool } } +void TParseVersions::longVectorCheck(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (!builtIn) { + const char* const extensions[] = {E_GL_EXT_long_vector}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); + } +} + // Call for any operation removed because SPIR-V is in use. void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op) { diff --git a/third_party/glslang/glslang/MachineIndependent/Versions.h b/third_party/glslang/glslang/MachineIndependent/Versions.h index d4cf2f7c52..cfc6ea3fb0 100644 --- a/third_party/glslang/glslang/MachineIndependent/Versions.h +++ b/third_party/glslang/glslang/MachineIndependent/Versions.h @@ -165,6 +165,7 @@ const char* const E_GL_ARB_vertex_attrib_64bit = "GL_ARB_vertex_attrib_ const char* const E_GL_ARB_draw_instanced = "GL_ARB_draw_instanced"; const char* const E_GL_ARB_fragment_coord_conventions = "GL_ARB_fragment_coord_conventions"; const char* const E_GL_ARB_bindless_texture = "GL_ARB_bindless_texture"; +const char* const E_GL_ARB_conservative_depth = "GL_ARB_conservative_depth"; const char* const E_GL_KHR_shader_subgroup_basic = "GL_KHR_shader_subgroup_basic"; const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote"; @@ -226,6 +227,10 @@ const char* const E_GL_EXT_control_flow_attributes2 = "GL_EXT_control_fl const char* const E_GL_EXT_spec_constant_composites = "GL_EXT_spec_constant_composites"; const char* const E_GL_EXT_texture_offset_non_const = "GL_EXT_texture_offset_non_const"; const char* const E_GL_EXT_nontemporal_keyword = "GL_EXT_nontemporal_keyword"; +const char* const E_GL_EXT_uniform_buffer_unsized_array = "GL_EXT_uniform_buffer_unsized_array"; +const char* const E_GL_EXT_conservative_depth = "GL_EXT_conservative_depth"; +const char* const E_GL_EXT_descriptor_heap = "GL_EXT_descriptor_heap"; +const char* const E_GL_EXT_structured_descriptor_heap = "GL_EXT_structured_descriptor_heap"; // Arrays of extensions for the above viewportEXTs duplications @@ -290,6 +295,7 @@ const char* const E_GL_NV_cooperative_vector = "GL_NV_coopera const char* const E_GL_NV_cluster_acceleration_structure = "GL_NV_cluster_acceleration_structure"; const char* const E_GL_NV_linear_swept_spheres = "GL_NV_linear_swept_spheres"; const char* const E_GL_NV_gpu_shader5 = "GL_NV_gpu_shader5"; +const char* const E_GL_NV_push_constant_bank = "GL_NV_push_constant_bank"; // ARM const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins"; @@ -304,6 +310,7 @@ const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]); const char* const E_GL_QCOM_image_processing = "GL_QCOM_image_processing"; const char* const E_GL_QCOM_image_processing2 = "GL_QCOM_image_processing2"; const char* const E_GL_QCOM_tile_shading = "GL_QCOM_tile_shading"; +const char* const E_GL_QCOM_cooperative_matrix_conversion = "GL_QCOM_cooperative_matrix_conversion"; // AEP const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a"; @@ -362,6 +369,11 @@ const char* const E_GL_EXT_integer_dot_product = "GL_EXT_inte const char* const E_GL_EXT_bfloat16 = "GL_EXT_bfloat16"; const char* const E_GL_EXT_float_e5m2 = "GL_EXT_float_e5m2"; const char* const E_GL_EXT_float_e4m3 = "GL_EXT_float_e4m3"; +const char* const E_GL_EXT_long_vector = "GL_EXT_long_vector"; + +const char* const E_GL_EXT_shader_64bit_indexing = "GL_EXT_shader_64bit_indexing"; + +const char* const E_GL_EXT_shader_invocation_reorder = "GL_EXT_shader_invocation_reorder"; // Arrays of extensions for the above AEP duplications diff --git a/third_party/glslang/glslang/MachineIndependent/glslang.y b/third_party/glslang/glslang/MachineIndependent/glslang.y index 53969dd14a..ac39aff0bd 100644 --- a/third_party/glslang/glslang/MachineIndependent/glslang.y +++ b/third_party/glslang/glslang/MachineIndependent/glslang.y @@ -182,7 +182,8 @@ extern int yylex(YYSTYPE*, TParseContext&); %token FCOOPMATNV ICOOPMATNV UCOOPMATNV %token COOPMAT %token COOPVECNV -%token HITOBJECTNV HITOBJECTATTRNV +%token VECTOR +%token HITOBJECTNV HITOBJECTATTRNV HITOBJECTEXT HITOBJECTATTREXT %token TENSORLAYOUTNV TENSORVIEWNV %token TENSORARM @@ -284,7 +285,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %token SUBROUTINE DEMOTE FUNCTION %token PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV %token PAYLOADEXT PAYLOADINEXT HITATTREXT CALLDATAEXT CALLDATAINEXT -%token PATCH SAMPLE NONUNIFORM +%token PATCH SAMPLE NONUNIFORM RESOURCEHEAP SAMPLERHEAP %token COHERENT VOLATILE RESTRICT READONLY WRITEONLY NONTEMPORAL DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT %token SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT %token NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT @@ -298,7 +299,8 @@ extern int yylex(YYSTYPE*, TParseContext&); %type conditional_expression constant_expression %type logical_or_expression logical_xor_expression logical_and_expression %type shift_expression and_expression exclusive_or_expression inclusive_or_expression -%type function_call initializer condition conditionopt +%type function_call initializer +%type condition conditionopt %type translation_unit function_definition %type statement simple_statement @@ -325,8 +327,10 @@ extern int yylex(YYSTYPE*, TParseContext&); %type single_type_qualifier %type type_specifier_nonarray %type struct_specifier +%type block_heap_inner_structure %type struct_declarator %type struct_declarator_list struct_declaration struct_declaration_list +%type struct_declaration_with_heap struct_declaration_without_heap %type block_structure %type function_header function_declarator %type function_header_with_parameters @@ -451,7 +455,7 @@ postfix_expression integer_expression : expression { - parseContext.integerCheck($1, "[]"); + parseContext.arrayIndexCheck($1, "[]"); $$ = $1; } ; @@ -555,7 +559,7 @@ function_identifier TIntermMethod* method = $1->getAsMethodNode(); if (method) { - $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength); + $$.function = new TFunction(&method->getMethodName(), method->getType(), EOpArrayLength); $$.intermNode = method->getObject(); } else { TIntermSymbol* symbol = $1->getAsSymbolNode(); @@ -912,37 +916,28 @@ declaration $$ = 0; } | block_structure SEMICOLON { - parseContext.declareBlock($1.loc, *$1.typeList); - $$ = 0; + $$ = parseContext.declareBlock($1.loc, *$1.typeList); } | block_structure IDENTIFIER SEMICOLON { - parseContext.declareBlock($1.loc, *$1.typeList, $2.string); - $$ = 0; + $$ = parseContext.declareBlock($1.loc, *$1.typeList, $2.string); } | block_structure IDENTIFIER array_specifier SEMICOLON { - parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes); - $$ = 0; + $$ = parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes); } | type_qualifier SEMICOLON { parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); parseContext.updateStandaloneQualifierDefaults($1.loc, $1); $$ = 0; } - | type_qualifier IDENTIFIER SEMICOLON { + | type_qualifier identifier_list SEMICOLON { parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); - parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string); - $$ = 0; - } - | type_qualifier IDENTIFIER identifier_list SEMICOLON { - parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); - $3->push_back($2.string); - parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3); + parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2); $$ = 0; } ; block_structure - : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE { + : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_without_heap RIGHT_BRACE { --parseContext.blockNestingLevel; parseContext.blockName = $2.string; parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); @@ -951,11 +946,12 @@ block_structure $$.loc = $1.loc; $$.typeList = $5; } + ; identifier_list - : COMMA IDENTIFIER { + : IDENTIFIER { $$ = new TIdentifierList; - $$->push_back($2.string); + $$->push_back($1.string); } | identifier_list COMMA IDENTIFIER { $$ = $1; @@ -1170,21 +1166,23 @@ init_declarator_list } | init_declarator_list COMMA IDENTIFIER { $$ = $1; - parseContext.declareVariable($3.loc, *$3.string, $1.type); + TIntermNode* declNode = parseContext.declareVariable($3.loc, *$3.string, $1.type); + $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, declNode, $3.loc); } | init_declarator_list COMMA IDENTIFIER array_specifier { $$ = $1; - parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes); + TIntermNode* declNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes); + $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, declNode, $3.loc); } | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer { $$.type = $1.type; - TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6); - $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc); + TIntermNode* declNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6); + $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, declNode, $5.loc); } | init_declarator_list COMMA IDENTIFIER EQUAL initializer { $$.type = $1.type; - TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5); - $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc); + TIntermNode* declNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5); + $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, declNode, $4.loc); } ; @@ -1196,23 +1194,24 @@ single_declaration } | fully_specified_type IDENTIFIER { $$.type = $1; - $$.intermNode = 0; - parseContext.declareVariable($2.loc, *$2.string, $1); + TIntermNode* declNode = parseContext.declareVariable($2.loc, *$2.string, $1); + $$.intermNode = parseContext.intermediate.growAggregate(nullptr, declNode, $2.loc); + } | fully_specified_type IDENTIFIER array_specifier { $$.type = $1; - $$.intermNode = 0; - parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes); + TIntermNode* declNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes); + $$.intermNode = parseContext.intermediate.growAggregate(nullptr, declNode, $2.loc); } | fully_specified_type IDENTIFIER array_specifier EQUAL initializer { $$.type = $1; - TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5); - $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc); + TIntermNode* declNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5); + $$.intermNode = parseContext.intermediate.growAggregate(nullptr, declNode, $2.loc); } | fully_specified_type IDENTIFIER EQUAL initializer { $$.type = $1; - TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); - $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc); + TIntermNode* declNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); + $$.intermNode = parseContext.intermediate.growAggregate(nullptr, declNode, $2.loc); } // Grammar Note: No 'enum', or 'typedef'. @@ -1535,6 +1534,16 @@ storage_qualifier $$.init($1.loc); $$.qualifier.sample = true; } + | RESOURCEHEAP { + parseContext.globalCheck($1.loc, "resourceHeap"); + $$.init($1.loc); + $$.qualifier.storage = EvqResourceHeap; + } + | SAMPLERHEAP { + parseContext.globalCheck($1.loc, "samplerHeap"); + $$.init($1.loc); + $$.qualifier.storage = EvqSamplerHeap; + } | HITATTRNV { parseContext.globalCheck($1.loc, "hitAttributeNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask @@ -1543,14 +1552,22 @@ storage_qualifier $$.init($1.loc); $$.qualifier.storage = EvqHitAttr; } - | HITOBJECTATTRNV { + | HITOBJECTATTRNV { parseContext.globalCheck($1.loc, "hitAttributeNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | EShLangMissMask), "hitObjectAttributeNV"); parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV"); $$.init($1.loc); $$.qualifier.storage = EvqHitObjectAttrNV; - } + } + | HITOBJECTATTREXT { + parseContext.globalCheck($1.loc, "hitAttributeEXT"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask + | EShLangMissMask), "hitObjectAttributeEXT"); + parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_shader_invocation_reorder, "hitObjectAttributeEXT"); + $$.init($1.loc); + $$.qualifier.storage = EvqHitObjectAttrEXT; + } | HITATTREXT { parseContext.globalCheck($1.loc, "hitAttributeEXT"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask @@ -3649,14 +3666,24 @@ type_specifier_nonarray $$.tensorRankARM = 1; // placeholder value $$.basicType = EbtTensorARM; } + | VECTOR { + parseContext.longVectorCheck($1.loc, "vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtLongVector; + $$.longVector = true; + } | spirv_type_specifier { parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier"); $$ = $1; } - | HITOBJECTNV { + | HITOBJECTNV { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtHitObjectNV; - } + } + | HITOBJECTEXT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtHitObjectEXT; + } | struct_specifier { $$ = $1; $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; @@ -3697,7 +3724,6 @@ precision_qualifier struct_specifier : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE { - TType* structure = new TType($5, *$2.string); parseContext.structArrayCheck($2.loc, *structure); @@ -3723,10 +3749,71 @@ struct_specifier ; struct_declaration_list + : struct_declaration_without_heap { + $$ = $1; + } + | struct_declaration_with_heap { + $$ = $1; + } + | struct_declaration_with_heap struct_declaration_without_heap { + $$ = $1; + for (unsigned int i = 0; i < $2->size(); ++i) { + for (unsigned int j = 0; j < $$->size(); ++j) { + if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName()) + parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str()); + } + $$->push_back((*$2)[i]); + } + } + | struct_declaration_without_heap struct_declaration_with_heap { + $$ = $1; + for (unsigned int i = 0; i < $2->size(); ++i) { + for (unsigned int j = 0; j < $$->size(); ++j) { + if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName()) + parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str()); + } + $$->push_back((*$2)[i]); + } + } + ; + +struct_declaration_with_heap + : block_heap_inner_structure struct_declarator_list SEMICOLON { + $$ = $2; + parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType); + parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier, $1.hasTypeParameter()); + + for (unsigned int i = 0; i < $$->size(); ++i) { + TType type($1); + type.setFieldName((*$$)[i].type->getFieldName()); + type.transferArraySizes((*$$)[i].type->getArraySizes()); + type.copyArrayInnerSizes($1.arraySizes); + parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); + (*$$)[i].type->shallowCopy(type); + } + } + ; + +block_heap_inner_structure + : type_qualifier LEFT_BRACE { parseContext.nestedBlockCheck($1.loc, true); } struct_declaration_without_heap RIGHT_BRACE { + --parseContext.blockNestingLevel; + parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); + parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); + $$.init($1.loc); + TType* innerStructure = new TType($4, TString("")); + $$.basicType = EbtBlock; + $$.userDef = innerStructure; + $$.qualifier = $1.qualifier; + $$.qualifier.layoutDescriptorHeap = true; + $$.qualifier.layoutDescriptorInnerBlock = true; + } + ; + +struct_declaration_without_heap : struct_declaration { $$ = $1; } - | struct_declaration_list struct_declaration { + | struct_declaration_without_heap struct_declaration { $$ = $1; for (unsigned int i = 0; i < $2->size(); ++i) { for (unsigned int j = 0; j < $$->size(); ++j) { @@ -3996,11 +4083,7 @@ condition parseContext.boolCheck($2.loc, $1); TType type($1); - TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); - if (initNode) - $$ = initNode->getAsTyped(); - else - $$ = 0; + $$ = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); } ; @@ -4090,6 +4173,10 @@ iteration_statement_nonattributed condition RIGHT_PAREN statement_no_new_scope { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc); + if (parseContext.intermediate.getDebugInfo()) { + $$ = parseContext.intermediate.makeAggregate($$, $1.loc); + $$->getAsAggregate()->setOperator(EOpScope); + } --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; @@ -4107,6 +4194,10 @@ iteration_statement_nonattributed parseContext.boolCheck($8.loc, $6); $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc); + if (parseContext.intermediate.getDebugInfo()) { + $$ = parseContext.intermediate.makeAggregate($$, $4.loc); + $$->getAsAggregate()->setOperator(EOpScope); + } parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; @@ -4125,7 +4216,7 @@ iteration_statement_nonattributed if (! parseContext.limits.nonInductiveForLoops) parseContext.inductiveLoopCheck($1.loc, $4, forLoop); $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc); - $$->getAsAggregate()->setOperator(EOpSequence); + $$->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; diff --git a/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp b/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp index eb3fc9b722..50db001d44 100644 --- a/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp +++ b/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp @@ -301,441 +301,450 @@ enum yysymbol_kind_t YYSYMBOL_UCOOPMATNV = 177, /* UCOOPMATNV */ YYSYMBOL_COOPMAT = 178, /* COOPMAT */ YYSYMBOL_COOPVECNV = 179, /* COOPVECNV */ - YYSYMBOL_HITOBJECTNV = 180, /* HITOBJECTNV */ - YYSYMBOL_HITOBJECTATTRNV = 181, /* HITOBJECTATTRNV */ - YYSYMBOL_TENSORLAYOUTNV = 182, /* TENSORLAYOUTNV */ - YYSYMBOL_TENSORVIEWNV = 183, /* TENSORVIEWNV */ - YYSYMBOL_TENSORARM = 184, /* TENSORARM */ - YYSYMBOL_SAMPLERCUBEARRAY = 185, /* SAMPLERCUBEARRAY */ - YYSYMBOL_SAMPLERCUBEARRAYSHADOW = 186, /* SAMPLERCUBEARRAYSHADOW */ - YYSYMBOL_ISAMPLERCUBEARRAY = 187, /* ISAMPLERCUBEARRAY */ - YYSYMBOL_USAMPLERCUBEARRAY = 188, /* USAMPLERCUBEARRAY */ - YYSYMBOL_SAMPLER1D = 189, /* SAMPLER1D */ - YYSYMBOL_SAMPLER1DARRAY = 190, /* SAMPLER1DARRAY */ - YYSYMBOL_SAMPLER1DARRAYSHADOW = 191, /* SAMPLER1DARRAYSHADOW */ - YYSYMBOL_ISAMPLER1D = 192, /* ISAMPLER1D */ - YYSYMBOL_SAMPLER1DSHADOW = 193, /* SAMPLER1DSHADOW */ - YYSYMBOL_SAMPLER2DRECT = 194, /* SAMPLER2DRECT */ - YYSYMBOL_SAMPLER2DRECTSHADOW = 195, /* SAMPLER2DRECTSHADOW */ - YYSYMBOL_ISAMPLER2DRECT = 196, /* ISAMPLER2DRECT */ - YYSYMBOL_USAMPLER2DRECT = 197, /* USAMPLER2DRECT */ - YYSYMBOL_SAMPLERBUFFER = 198, /* SAMPLERBUFFER */ - YYSYMBOL_ISAMPLERBUFFER = 199, /* ISAMPLERBUFFER */ - YYSYMBOL_USAMPLERBUFFER = 200, /* USAMPLERBUFFER */ - YYSYMBOL_SAMPLER2DMS = 201, /* SAMPLER2DMS */ - YYSYMBOL_ISAMPLER2DMS = 202, /* ISAMPLER2DMS */ - YYSYMBOL_USAMPLER2DMS = 203, /* USAMPLER2DMS */ - YYSYMBOL_SAMPLER2DMSARRAY = 204, /* SAMPLER2DMSARRAY */ - YYSYMBOL_ISAMPLER2DMSARRAY = 205, /* ISAMPLER2DMSARRAY */ - YYSYMBOL_USAMPLER2DMSARRAY = 206, /* USAMPLER2DMSARRAY */ - YYSYMBOL_SAMPLEREXTERNALOES = 207, /* SAMPLEREXTERNALOES */ - YYSYMBOL_SAMPLEREXTERNAL2DY2YEXT = 208, /* SAMPLEREXTERNAL2DY2YEXT */ - YYSYMBOL_ISAMPLER1DARRAY = 209, /* ISAMPLER1DARRAY */ - YYSYMBOL_USAMPLER1D = 210, /* USAMPLER1D */ - YYSYMBOL_USAMPLER1DARRAY = 211, /* USAMPLER1DARRAY */ - YYSYMBOL_F16SAMPLER1D = 212, /* F16SAMPLER1D */ - YYSYMBOL_F16SAMPLER2D = 213, /* F16SAMPLER2D */ - YYSYMBOL_F16SAMPLER3D = 214, /* F16SAMPLER3D */ - YYSYMBOL_F16SAMPLER2DRECT = 215, /* F16SAMPLER2DRECT */ - YYSYMBOL_F16SAMPLERCUBE = 216, /* F16SAMPLERCUBE */ - YYSYMBOL_F16SAMPLER1DARRAY = 217, /* F16SAMPLER1DARRAY */ - YYSYMBOL_F16SAMPLER2DARRAY = 218, /* F16SAMPLER2DARRAY */ - YYSYMBOL_F16SAMPLERCUBEARRAY = 219, /* F16SAMPLERCUBEARRAY */ - YYSYMBOL_F16SAMPLERBUFFER = 220, /* F16SAMPLERBUFFER */ - YYSYMBOL_F16SAMPLER2DMS = 221, /* F16SAMPLER2DMS */ - YYSYMBOL_F16SAMPLER2DMSARRAY = 222, /* F16SAMPLER2DMSARRAY */ - YYSYMBOL_F16SAMPLER1DSHADOW = 223, /* F16SAMPLER1DSHADOW */ - YYSYMBOL_F16SAMPLER2DSHADOW = 224, /* F16SAMPLER2DSHADOW */ - YYSYMBOL_F16SAMPLER1DARRAYSHADOW = 225, /* F16SAMPLER1DARRAYSHADOW */ - YYSYMBOL_F16SAMPLER2DARRAYSHADOW = 226, /* F16SAMPLER2DARRAYSHADOW */ - YYSYMBOL_F16SAMPLER2DRECTSHADOW = 227, /* F16SAMPLER2DRECTSHADOW */ - YYSYMBOL_F16SAMPLERCUBESHADOW = 228, /* F16SAMPLERCUBESHADOW */ - YYSYMBOL_F16SAMPLERCUBEARRAYSHADOW = 229, /* F16SAMPLERCUBEARRAYSHADOW */ - YYSYMBOL_IMAGE1D = 230, /* IMAGE1D */ - YYSYMBOL_IIMAGE1D = 231, /* IIMAGE1D */ - YYSYMBOL_UIMAGE1D = 232, /* UIMAGE1D */ - YYSYMBOL_IMAGE2D = 233, /* IMAGE2D */ - YYSYMBOL_IIMAGE2D = 234, /* IIMAGE2D */ - YYSYMBOL_UIMAGE2D = 235, /* UIMAGE2D */ - YYSYMBOL_IMAGE3D = 236, /* IMAGE3D */ - YYSYMBOL_IIMAGE3D = 237, /* IIMAGE3D */ - YYSYMBOL_UIMAGE3D = 238, /* UIMAGE3D */ - YYSYMBOL_IMAGE2DRECT = 239, /* IMAGE2DRECT */ - YYSYMBOL_IIMAGE2DRECT = 240, /* IIMAGE2DRECT */ - YYSYMBOL_UIMAGE2DRECT = 241, /* UIMAGE2DRECT */ - YYSYMBOL_IMAGECUBE = 242, /* IMAGECUBE */ - YYSYMBOL_IIMAGECUBE = 243, /* IIMAGECUBE */ - YYSYMBOL_UIMAGECUBE = 244, /* UIMAGECUBE */ - YYSYMBOL_IMAGEBUFFER = 245, /* IMAGEBUFFER */ - YYSYMBOL_IIMAGEBUFFER = 246, /* IIMAGEBUFFER */ - YYSYMBOL_UIMAGEBUFFER = 247, /* UIMAGEBUFFER */ - YYSYMBOL_IMAGE1DARRAY = 248, /* IMAGE1DARRAY */ - YYSYMBOL_IIMAGE1DARRAY = 249, /* IIMAGE1DARRAY */ - YYSYMBOL_UIMAGE1DARRAY = 250, /* UIMAGE1DARRAY */ - YYSYMBOL_IMAGE2DARRAY = 251, /* IMAGE2DARRAY */ - YYSYMBOL_IIMAGE2DARRAY = 252, /* IIMAGE2DARRAY */ - YYSYMBOL_UIMAGE2DARRAY = 253, /* UIMAGE2DARRAY */ - YYSYMBOL_IMAGECUBEARRAY = 254, /* IMAGECUBEARRAY */ - YYSYMBOL_IIMAGECUBEARRAY = 255, /* IIMAGECUBEARRAY */ - YYSYMBOL_UIMAGECUBEARRAY = 256, /* UIMAGECUBEARRAY */ - YYSYMBOL_IMAGE2DMS = 257, /* IMAGE2DMS */ - YYSYMBOL_IIMAGE2DMS = 258, /* IIMAGE2DMS */ - YYSYMBOL_UIMAGE2DMS = 259, /* UIMAGE2DMS */ - YYSYMBOL_IMAGE2DMSARRAY = 260, /* IMAGE2DMSARRAY */ - YYSYMBOL_IIMAGE2DMSARRAY = 261, /* IIMAGE2DMSARRAY */ - YYSYMBOL_UIMAGE2DMSARRAY = 262, /* UIMAGE2DMSARRAY */ - YYSYMBOL_F16IMAGE1D = 263, /* F16IMAGE1D */ - YYSYMBOL_F16IMAGE2D = 264, /* F16IMAGE2D */ - YYSYMBOL_F16IMAGE3D = 265, /* F16IMAGE3D */ - YYSYMBOL_F16IMAGE2DRECT = 266, /* F16IMAGE2DRECT */ - YYSYMBOL_F16IMAGECUBE = 267, /* F16IMAGECUBE */ - YYSYMBOL_F16IMAGE1DARRAY = 268, /* F16IMAGE1DARRAY */ - YYSYMBOL_F16IMAGE2DARRAY = 269, /* F16IMAGE2DARRAY */ - YYSYMBOL_F16IMAGECUBEARRAY = 270, /* F16IMAGECUBEARRAY */ - YYSYMBOL_F16IMAGEBUFFER = 271, /* F16IMAGEBUFFER */ - YYSYMBOL_F16IMAGE2DMS = 272, /* F16IMAGE2DMS */ - YYSYMBOL_F16IMAGE2DMSARRAY = 273, /* F16IMAGE2DMSARRAY */ - YYSYMBOL_I64IMAGE1D = 274, /* I64IMAGE1D */ - YYSYMBOL_U64IMAGE1D = 275, /* U64IMAGE1D */ - YYSYMBOL_I64IMAGE2D = 276, /* I64IMAGE2D */ - YYSYMBOL_U64IMAGE2D = 277, /* U64IMAGE2D */ - YYSYMBOL_I64IMAGE3D = 278, /* I64IMAGE3D */ - YYSYMBOL_U64IMAGE3D = 279, /* U64IMAGE3D */ - YYSYMBOL_I64IMAGE2DRECT = 280, /* I64IMAGE2DRECT */ - YYSYMBOL_U64IMAGE2DRECT = 281, /* U64IMAGE2DRECT */ - YYSYMBOL_I64IMAGECUBE = 282, /* I64IMAGECUBE */ - YYSYMBOL_U64IMAGECUBE = 283, /* U64IMAGECUBE */ - YYSYMBOL_I64IMAGEBUFFER = 284, /* I64IMAGEBUFFER */ - YYSYMBOL_U64IMAGEBUFFER = 285, /* U64IMAGEBUFFER */ - YYSYMBOL_I64IMAGE1DARRAY = 286, /* I64IMAGE1DARRAY */ - YYSYMBOL_U64IMAGE1DARRAY = 287, /* U64IMAGE1DARRAY */ - YYSYMBOL_I64IMAGE2DARRAY = 288, /* I64IMAGE2DARRAY */ - YYSYMBOL_U64IMAGE2DARRAY = 289, /* U64IMAGE2DARRAY */ - YYSYMBOL_I64IMAGECUBEARRAY = 290, /* I64IMAGECUBEARRAY */ - YYSYMBOL_U64IMAGECUBEARRAY = 291, /* U64IMAGECUBEARRAY */ - YYSYMBOL_I64IMAGE2DMS = 292, /* I64IMAGE2DMS */ - YYSYMBOL_U64IMAGE2DMS = 293, /* U64IMAGE2DMS */ - YYSYMBOL_I64IMAGE2DMSARRAY = 294, /* I64IMAGE2DMSARRAY */ - YYSYMBOL_U64IMAGE2DMSARRAY = 295, /* U64IMAGE2DMSARRAY */ - YYSYMBOL_TEXTURECUBEARRAY = 296, /* TEXTURECUBEARRAY */ - YYSYMBOL_ITEXTURECUBEARRAY = 297, /* ITEXTURECUBEARRAY */ - YYSYMBOL_UTEXTURECUBEARRAY = 298, /* UTEXTURECUBEARRAY */ - YYSYMBOL_TEXTURE1D = 299, /* TEXTURE1D */ - YYSYMBOL_ITEXTURE1D = 300, /* ITEXTURE1D */ - YYSYMBOL_UTEXTURE1D = 301, /* UTEXTURE1D */ - YYSYMBOL_TEXTURE1DARRAY = 302, /* TEXTURE1DARRAY */ - YYSYMBOL_ITEXTURE1DARRAY = 303, /* ITEXTURE1DARRAY */ - YYSYMBOL_UTEXTURE1DARRAY = 304, /* UTEXTURE1DARRAY */ - YYSYMBOL_TEXTURE2DRECT = 305, /* TEXTURE2DRECT */ - YYSYMBOL_ITEXTURE2DRECT = 306, /* ITEXTURE2DRECT */ - YYSYMBOL_UTEXTURE2DRECT = 307, /* UTEXTURE2DRECT */ - YYSYMBOL_TEXTUREBUFFER = 308, /* TEXTUREBUFFER */ - YYSYMBOL_ITEXTUREBUFFER = 309, /* ITEXTUREBUFFER */ - YYSYMBOL_UTEXTUREBUFFER = 310, /* UTEXTUREBUFFER */ - YYSYMBOL_TEXTURE2DMS = 311, /* TEXTURE2DMS */ - YYSYMBOL_ITEXTURE2DMS = 312, /* ITEXTURE2DMS */ - YYSYMBOL_UTEXTURE2DMS = 313, /* UTEXTURE2DMS */ - YYSYMBOL_TEXTURE2DMSARRAY = 314, /* TEXTURE2DMSARRAY */ - YYSYMBOL_ITEXTURE2DMSARRAY = 315, /* ITEXTURE2DMSARRAY */ - YYSYMBOL_UTEXTURE2DMSARRAY = 316, /* UTEXTURE2DMSARRAY */ - YYSYMBOL_F16TEXTURE1D = 317, /* F16TEXTURE1D */ - YYSYMBOL_F16TEXTURE2D = 318, /* F16TEXTURE2D */ - YYSYMBOL_F16TEXTURE3D = 319, /* F16TEXTURE3D */ - YYSYMBOL_F16TEXTURE2DRECT = 320, /* F16TEXTURE2DRECT */ - YYSYMBOL_F16TEXTURECUBE = 321, /* F16TEXTURECUBE */ - YYSYMBOL_F16TEXTURE1DARRAY = 322, /* F16TEXTURE1DARRAY */ - YYSYMBOL_F16TEXTURE2DARRAY = 323, /* F16TEXTURE2DARRAY */ - YYSYMBOL_F16TEXTURECUBEARRAY = 324, /* F16TEXTURECUBEARRAY */ - YYSYMBOL_F16TEXTUREBUFFER = 325, /* F16TEXTUREBUFFER */ - YYSYMBOL_F16TEXTURE2DMS = 326, /* F16TEXTURE2DMS */ - YYSYMBOL_F16TEXTURE2DMSARRAY = 327, /* F16TEXTURE2DMSARRAY */ - YYSYMBOL_SUBPASSINPUT = 328, /* SUBPASSINPUT */ - YYSYMBOL_SUBPASSINPUTMS = 329, /* SUBPASSINPUTMS */ - YYSYMBOL_ISUBPASSINPUT = 330, /* ISUBPASSINPUT */ - YYSYMBOL_ISUBPASSINPUTMS = 331, /* ISUBPASSINPUTMS */ - YYSYMBOL_USUBPASSINPUT = 332, /* USUBPASSINPUT */ - YYSYMBOL_USUBPASSINPUTMS = 333, /* USUBPASSINPUTMS */ - YYSYMBOL_F16SUBPASSINPUT = 334, /* F16SUBPASSINPUT */ - YYSYMBOL_F16SUBPASSINPUTMS = 335, /* F16SUBPASSINPUTMS */ - YYSYMBOL_SPIRV_INSTRUCTION = 336, /* SPIRV_INSTRUCTION */ - YYSYMBOL_SPIRV_EXECUTION_MODE = 337, /* SPIRV_EXECUTION_MODE */ - YYSYMBOL_SPIRV_EXECUTION_MODE_ID = 338, /* SPIRV_EXECUTION_MODE_ID */ - YYSYMBOL_SPIRV_DECORATE = 339, /* SPIRV_DECORATE */ - YYSYMBOL_SPIRV_DECORATE_ID = 340, /* SPIRV_DECORATE_ID */ - YYSYMBOL_SPIRV_DECORATE_STRING = 341, /* SPIRV_DECORATE_STRING */ - YYSYMBOL_SPIRV_TYPE = 342, /* SPIRV_TYPE */ - YYSYMBOL_SPIRV_STORAGE_CLASS = 343, /* SPIRV_STORAGE_CLASS */ - YYSYMBOL_SPIRV_BY_REFERENCE = 344, /* SPIRV_BY_REFERENCE */ - YYSYMBOL_SPIRV_LITERAL = 345, /* SPIRV_LITERAL */ - YYSYMBOL_ATTACHMENTEXT = 346, /* ATTACHMENTEXT */ - YYSYMBOL_IATTACHMENTEXT = 347, /* IATTACHMENTEXT */ - YYSYMBOL_UATTACHMENTEXT = 348, /* UATTACHMENTEXT */ - YYSYMBOL_LEFT_OP = 349, /* LEFT_OP */ - YYSYMBOL_RIGHT_OP = 350, /* RIGHT_OP */ - YYSYMBOL_INC_OP = 351, /* INC_OP */ - YYSYMBOL_DEC_OP = 352, /* DEC_OP */ - YYSYMBOL_LE_OP = 353, /* LE_OP */ - YYSYMBOL_GE_OP = 354, /* GE_OP */ - YYSYMBOL_EQ_OP = 355, /* EQ_OP */ - YYSYMBOL_NE_OP = 356, /* NE_OP */ - YYSYMBOL_AND_OP = 357, /* AND_OP */ - YYSYMBOL_OR_OP = 358, /* OR_OP */ - YYSYMBOL_XOR_OP = 359, /* XOR_OP */ - YYSYMBOL_MUL_ASSIGN = 360, /* MUL_ASSIGN */ - YYSYMBOL_DIV_ASSIGN = 361, /* DIV_ASSIGN */ - YYSYMBOL_ADD_ASSIGN = 362, /* ADD_ASSIGN */ - YYSYMBOL_MOD_ASSIGN = 363, /* MOD_ASSIGN */ - YYSYMBOL_LEFT_ASSIGN = 364, /* LEFT_ASSIGN */ - YYSYMBOL_RIGHT_ASSIGN = 365, /* RIGHT_ASSIGN */ - YYSYMBOL_AND_ASSIGN = 366, /* AND_ASSIGN */ - YYSYMBOL_XOR_ASSIGN = 367, /* XOR_ASSIGN */ - YYSYMBOL_OR_ASSIGN = 368, /* OR_ASSIGN */ - YYSYMBOL_SUB_ASSIGN = 369, /* SUB_ASSIGN */ - YYSYMBOL_STRING_LITERAL = 370, /* STRING_LITERAL */ - YYSYMBOL_LEFT_PAREN = 371, /* LEFT_PAREN */ - YYSYMBOL_RIGHT_PAREN = 372, /* RIGHT_PAREN */ - YYSYMBOL_LEFT_BRACKET = 373, /* LEFT_BRACKET */ - YYSYMBOL_RIGHT_BRACKET = 374, /* RIGHT_BRACKET */ - YYSYMBOL_LEFT_BRACE = 375, /* LEFT_BRACE */ - YYSYMBOL_RIGHT_BRACE = 376, /* RIGHT_BRACE */ - YYSYMBOL_DOT = 377, /* DOT */ - YYSYMBOL_COMMA = 378, /* COMMA */ - YYSYMBOL_COLON = 379, /* COLON */ - YYSYMBOL_EQUAL = 380, /* EQUAL */ - YYSYMBOL_SEMICOLON = 381, /* SEMICOLON */ - YYSYMBOL_BANG = 382, /* BANG */ - YYSYMBOL_DASH = 383, /* DASH */ - YYSYMBOL_TILDE = 384, /* TILDE */ - YYSYMBOL_PLUS = 385, /* PLUS */ - YYSYMBOL_STAR = 386, /* STAR */ - YYSYMBOL_SLASH = 387, /* SLASH */ - YYSYMBOL_PERCENT = 388, /* PERCENT */ - YYSYMBOL_LEFT_ANGLE = 389, /* LEFT_ANGLE */ - YYSYMBOL_RIGHT_ANGLE = 390, /* RIGHT_ANGLE */ - YYSYMBOL_VERTICAL_BAR = 391, /* VERTICAL_BAR */ - YYSYMBOL_CARET = 392, /* CARET */ - YYSYMBOL_AMPERSAND = 393, /* AMPERSAND */ - YYSYMBOL_QUESTION = 394, /* QUESTION */ - YYSYMBOL_INVARIANT = 395, /* INVARIANT */ - YYSYMBOL_HIGH_PRECISION = 396, /* HIGH_PRECISION */ - YYSYMBOL_MEDIUM_PRECISION = 397, /* MEDIUM_PRECISION */ - YYSYMBOL_LOW_PRECISION = 398, /* LOW_PRECISION */ - YYSYMBOL_PRECISION = 399, /* PRECISION */ - YYSYMBOL_PACKED = 400, /* PACKED */ - YYSYMBOL_RESOURCE = 401, /* RESOURCE */ - YYSYMBOL_SUPERP = 402, /* SUPERP */ - YYSYMBOL_FLOATCONSTANT = 403, /* FLOATCONSTANT */ - YYSYMBOL_INTCONSTANT = 404, /* INTCONSTANT */ - YYSYMBOL_UINTCONSTANT = 405, /* UINTCONSTANT */ - YYSYMBOL_BOOLCONSTANT = 406, /* BOOLCONSTANT */ - YYSYMBOL_IDENTIFIER = 407, /* IDENTIFIER */ - YYSYMBOL_TYPE_NAME = 408, /* TYPE_NAME */ - YYSYMBOL_CENTROID = 409, /* CENTROID */ - YYSYMBOL_IN = 410, /* IN */ - YYSYMBOL_OUT = 411, /* OUT */ - YYSYMBOL_INOUT = 412, /* INOUT */ - YYSYMBOL_STRUCT = 413, /* STRUCT */ - YYSYMBOL_VOID = 414, /* VOID */ - YYSYMBOL_WHILE = 415, /* WHILE */ - YYSYMBOL_BREAK = 416, /* BREAK */ - YYSYMBOL_CONTINUE = 417, /* CONTINUE */ - YYSYMBOL_DO = 418, /* DO */ - YYSYMBOL_ELSE = 419, /* ELSE */ - YYSYMBOL_FOR = 420, /* FOR */ - YYSYMBOL_IF = 421, /* IF */ - YYSYMBOL_DISCARD = 422, /* DISCARD */ - YYSYMBOL_RETURN = 423, /* RETURN */ - YYSYMBOL_SWITCH = 424, /* SWITCH */ - YYSYMBOL_CASE = 425, /* CASE */ - YYSYMBOL_DEFAULT = 426, /* DEFAULT */ - YYSYMBOL_TERMINATE_INVOCATION = 427, /* TERMINATE_INVOCATION */ - YYSYMBOL_TERMINATE_RAY = 428, /* TERMINATE_RAY */ - YYSYMBOL_IGNORE_INTERSECTION = 429, /* IGNORE_INTERSECTION */ - YYSYMBOL_UNIFORM = 430, /* UNIFORM */ - YYSYMBOL_SHARED = 431, /* SHARED */ - YYSYMBOL_BUFFER = 432, /* BUFFER */ - YYSYMBOL_TILEIMAGEEXT = 433, /* TILEIMAGEEXT */ - YYSYMBOL_FLAT = 434, /* FLAT */ - YYSYMBOL_SMOOTH = 435, /* SMOOTH */ - YYSYMBOL_LAYOUT = 436, /* LAYOUT */ - YYSYMBOL_DOUBLECONSTANT = 437, /* DOUBLECONSTANT */ - YYSYMBOL_INT16CONSTANT = 438, /* INT16CONSTANT */ - YYSYMBOL_UINT16CONSTANT = 439, /* UINT16CONSTANT */ - YYSYMBOL_FLOAT16CONSTANT = 440, /* FLOAT16CONSTANT */ - YYSYMBOL_INT32CONSTANT = 441, /* INT32CONSTANT */ - YYSYMBOL_UINT32CONSTANT = 442, /* UINT32CONSTANT */ - YYSYMBOL_INT64CONSTANT = 443, /* INT64CONSTANT */ - YYSYMBOL_UINT64CONSTANT = 444, /* UINT64CONSTANT */ - YYSYMBOL_SUBROUTINE = 445, /* SUBROUTINE */ - YYSYMBOL_DEMOTE = 446, /* DEMOTE */ - YYSYMBOL_FUNCTION = 447, /* FUNCTION */ - YYSYMBOL_PAYLOADNV = 448, /* PAYLOADNV */ - YYSYMBOL_PAYLOADINNV = 449, /* PAYLOADINNV */ - YYSYMBOL_HITATTRNV = 450, /* HITATTRNV */ - YYSYMBOL_CALLDATANV = 451, /* CALLDATANV */ - YYSYMBOL_CALLDATAINNV = 452, /* CALLDATAINNV */ - YYSYMBOL_PAYLOADEXT = 453, /* PAYLOADEXT */ - YYSYMBOL_PAYLOADINEXT = 454, /* PAYLOADINEXT */ - YYSYMBOL_HITATTREXT = 455, /* HITATTREXT */ - YYSYMBOL_CALLDATAEXT = 456, /* CALLDATAEXT */ - YYSYMBOL_CALLDATAINEXT = 457, /* CALLDATAINEXT */ - YYSYMBOL_PATCH = 458, /* PATCH */ - YYSYMBOL_SAMPLE = 459, /* SAMPLE */ - YYSYMBOL_NONUNIFORM = 460, /* NONUNIFORM */ - YYSYMBOL_COHERENT = 461, /* COHERENT */ - YYSYMBOL_VOLATILE = 462, /* VOLATILE */ - YYSYMBOL_RESTRICT = 463, /* RESTRICT */ - YYSYMBOL_READONLY = 464, /* READONLY */ - YYSYMBOL_WRITEONLY = 465, /* WRITEONLY */ - YYSYMBOL_NONTEMPORAL = 466, /* NONTEMPORAL */ - YYSYMBOL_DEVICECOHERENT = 467, /* DEVICECOHERENT */ - YYSYMBOL_QUEUEFAMILYCOHERENT = 468, /* QUEUEFAMILYCOHERENT */ - YYSYMBOL_WORKGROUPCOHERENT = 469, /* WORKGROUPCOHERENT */ - YYSYMBOL_SUBGROUPCOHERENT = 470, /* SUBGROUPCOHERENT */ - YYSYMBOL_NONPRIVATE = 471, /* NONPRIVATE */ - YYSYMBOL_SHADERCALLCOHERENT = 472, /* SHADERCALLCOHERENT */ - YYSYMBOL_NOPERSPECTIVE = 473, /* NOPERSPECTIVE */ - YYSYMBOL_EXPLICITINTERPAMD = 474, /* EXPLICITINTERPAMD */ - YYSYMBOL_PERVERTEXEXT = 475, /* PERVERTEXEXT */ - YYSYMBOL_PERVERTEXNV = 476, /* PERVERTEXNV */ - YYSYMBOL_PERPRIMITIVENV = 477, /* PERPRIMITIVENV */ - YYSYMBOL_PERVIEWNV = 478, /* PERVIEWNV */ - YYSYMBOL_PERTASKNV = 479, /* PERTASKNV */ - YYSYMBOL_PERPRIMITIVEEXT = 480, /* PERPRIMITIVEEXT */ - YYSYMBOL_TASKPAYLOADWORKGROUPEXT = 481, /* TASKPAYLOADWORKGROUPEXT */ - YYSYMBOL_PRECISE = 482, /* PRECISE */ - YYSYMBOL_YYACCEPT = 483, /* $accept */ - YYSYMBOL_variable_identifier = 484, /* variable_identifier */ - YYSYMBOL_primary_expression = 485, /* primary_expression */ - YYSYMBOL_postfix_expression = 486, /* postfix_expression */ - YYSYMBOL_integer_expression = 487, /* integer_expression */ - YYSYMBOL_function_call = 488, /* function_call */ - YYSYMBOL_function_call_or_method = 489, /* function_call_or_method */ - YYSYMBOL_function_call_generic = 490, /* function_call_generic */ - YYSYMBOL_function_call_header_no_parameters = 491, /* function_call_header_no_parameters */ - YYSYMBOL_function_call_header_with_parameters = 492, /* function_call_header_with_parameters */ - YYSYMBOL_function_call_header = 493, /* function_call_header */ - YYSYMBOL_function_identifier = 494, /* function_identifier */ - YYSYMBOL_unary_expression = 495, /* unary_expression */ - YYSYMBOL_unary_operator = 496, /* unary_operator */ - YYSYMBOL_multiplicative_expression = 497, /* multiplicative_expression */ - YYSYMBOL_additive_expression = 498, /* additive_expression */ - YYSYMBOL_shift_expression = 499, /* shift_expression */ - YYSYMBOL_relational_expression = 500, /* relational_expression */ - YYSYMBOL_equality_expression = 501, /* equality_expression */ - YYSYMBOL_and_expression = 502, /* and_expression */ - YYSYMBOL_exclusive_or_expression = 503, /* exclusive_or_expression */ - YYSYMBOL_inclusive_or_expression = 504, /* inclusive_or_expression */ - YYSYMBOL_logical_and_expression = 505, /* logical_and_expression */ - YYSYMBOL_logical_xor_expression = 506, /* logical_xor_expression */ - YYSYMBOL_logical_or_expression = 507, /* logical_or_expression */ - YYSYMBOL_conditional_expression = 508, /* conditional_expression */ - YYSYMBOL_509_1 = 509, /* $@1 */ - YYSYMBOL_assignment_expression = 510, /* assignment_expression */ - YYSYMBOL_assignment_operator = 511, /* assignment_operator */ - YYSYMBOL_expression = 512, /* expression */ - YYSYMBOL_constant_expression = 513, /* constant_expression */ - YYSYMBOL_declaration = 514, /* declaration */ - YYSYMBOL_block_structure = 515, /* block_structure */ - YYSYMBOL_516_2 = 516, /* $@2 */ - YYSYMBOL_identifier_list = 517, /* identifier_list */ - YYSYMBOL_function_prototype = 518, /* function_prototype */ - YYSYMBOL_function_declarator = 519, /* function_declarator */ - YYSYMBOL_function_header_with_parameters = 520, /* function_header_with_parameters */ - YYSYMBOL_function_header = 521, /* function_header */ - YYSYMBOL_parameter_declarator = 522, /* parameter_declarator */ - YYSYMBOL_parameter_declaration = 523, /* parameter_declaration */ - YYSYMBOL_parameter_type_specifier = 524, /* parameter_type_specifier */ - YYSYMBOL_init_declarator_list = 525, /* init_declarator_list */ - YYSYMBOL_single_declaration = 526, /* single_declaration */ - YYSYMBOL_fully_specified_type = 527, /* fully_specified_type */ - YYSYMBOL_invariant_qualifier = 528, /* invariant_qualifier */ - YYSYMBOL_interpolation_qualifier = 529, /* interpolation_qualifier */ - YYSYMBOL_layout_qualifier = 530, /* layout_qualifier */ - YYSYMBOL_layout_qualifier_id_list = 531, /* layout_qualifier_id_list */ - YYSYMBOL_layout_qualifier_id = 532, /* layout_qualifier_id */ - YYSYMBOL_precise_qualifier = 533, /* precise_qualifier */ - YYSYMBOL_type_qualifier = 534, /* type_qualifier */ - YYSYMBOL_single_type_qualifier = 535, /* single_type_qualifier */ - YYSYMBOL_storage_qualifier = 536, /* storage_qualifier */ - YYSYMBOL_non_uniform_qualifier = 537, /* non_uniform_qualifier */ - YYSYMBOL_type_name_list = 538, /* type_name_list */ - YYSYMBOL_type_specifier = 539, /* type_specifier */ - YYSYMBOL_array_specifier = 540, /* array_specifier */ - YYSYMBOL_type_parameter_specifier_opt = 541, /* type_parameter_specifier_opt */ - YYSYMBOL_type_parameter_specifier = 542, /* type_parameter_specifier */ - YYSYMBOL_type_parameter_specifier_list = 543, /* type_parameter_specifier_list */ - YYSYMBOL_type_specifier_nonarray = 544, /* type_specifier_nonarray */ - YYSYMBOL_precision_qualifier = 545, /* precision_qualifier */ - YYSYMBOL_struct_specifier = 546, /* struct_specifier */ - YYSYMBOL_547_3 = 547, /* $@3 */ - YYSYMBOL_548_4 = 548, /* $@4 */ - YYSYMBOL_struct_declaration_list = 549, /* struct_declaration_list */ - YYSYMBOL_struct_declaration = 550, /* struct_declaration */ - YYSYMBOL_struct_declarator_list = 551, /* struct_declarator_list */ - YYSYMBOL_struct_declarator = 552, /* struct_declarator */ - YYSYMBOL_initializer = 553, /* initializer */ - YYSYMBOL_initializer_list = 554, /* initializer_list */ - YYSYMBOL_declaration_statement = 555, /* declaration_statement */ - YYSYMBOL_statement = 556, /* statement */ - YYSYMBOL_simple_statement = 557, /* simple_statement */ - YYSYMBOL_demote_statement = 558, /* demote_statement */ - YYSYMBOL_compound_statement = 559, /* compound_statement */ - YYSYMBOL_560_5 = 560, /* $@5 */ - YYSYMBOL_561_6 = 561, /* $@6 */ - YYSYMBOL_statement_no_new_scope = 562, /* statement_no_new_scope */ - YYSYMBOL_statement_scoped = 563, /* statement_scoped */ - YYSYMBOL_564_7 = 564, /* $@7 */ - YYSYMBOL_565_8 = 565, /* $@8 */ - YYSYMBOL_compound_statement_no_new_scope = 566, /* compound_statement_no_new_scope */ - YYSYMBOL_statement_list = 567, /* statement_list */ - YYSYMBOL_expression_statement = 568, /* expression_statement */ - YYSYMBOL_selection_statement = 569, /* selection_statement */ - YYSYMBOL_selection_statement_nonattributed = 570, /* selection_statement_nonattributed */ - YYSYMBOL_selection_rest_statement = 571, /* selection_rest_statement */ - YYSYMBOL_condition = 572, /* condition */ - YYSYMBOL_switch_statement = 573, /* switch_statement */ - YYSYMBOL_switch_statement_nonattributed = 574, /* switch_statement_nonattributed */ - YYSYMBOL_575_9 = 575, /* $@9 */ - YYSYMBOL_switch_statement_list = 576, /* switch_statement_list */ - YYSYMBOL_case_label = 577, /* case_label */ - YYSYMBOL_iteration_statement = 578, /* iteration_statement */ - YYSYMBOL_iteration_statement_nonattributed = 579, /* iteration_statement_nonattributed */ - YYSYMBOL_580_10 = 580, /* $@10 */ - YYSYMBOL_581_11 = 581, /* $@11 */ - YYSYMBOL_582_12 = 582, /* $@12 */ - YYSYMBOL_for_init_statement = 583, /* for_init_statement */ - YYSYMBOL_conditionopt = 584, /* conditionopt */ - YYSYMBOL_for_rest_statement = 585, /* for_rest_statement */ - YYSYMBOL_jump_statement = 586, /* jump_statement */ - YYSYMBOL_translation_unit = 587, /* translation_unit */ - YYSYMBOL_external_declaration = 588, /* external_declaration */ - YYSYMBOL_function_definition = 589, /* function_definition */ - YYSYMBOL_590_13 = 590, /* $@13 */ - YYSYMBOL_attribute = 591, /* attribute */ - YYSYMBOL_attribute_list = 592, /* attribute_list */ - YYSYMBOL_single_attribute = 593, /* single_attribute */ - YYSYMBOL_spirv_requirements_list = 594, /* spirv_requirements_list */ - YYSYMBOL_spirv_requirements_parameter = 595, /* spirv_requirements_parameter */ - YYSYMBOL_spirv_extension_list = 596, /* spirv_extension_list */ - YYSYMBOL_spirv_capability_list = 597, /* spirv_capability_list */ - YYSYMBOL_spirv_execution_mode_qualifier = 598, /* spirv_execution_mode_qualifier */ - YYSYMBOL_spirv_execution_mode_parameter_list = 599, /* spirv_execution_mode_parameter_list */ - YYSYMBOL_spirv_execution_mode_parameter = 600, /* spirv_execution_mode_parameter */ - YYSYMBOL_spirv_execution_mode_id_parameter_list = 601, /* spirv_execution_mode_id_parameter_list */ - YYSYMBOL_spirv_storage_class_qualifier = 602, /* spirv_storage_class_qualifier */ - YYSYMBOL_spirv_decorate_qualifier = 603, /* spirv_decorate_qualifier */ - YYSYMBOL_spirv_decorate_parameter_list = 604, /* spirv_decorate_parameter_list */ - YYSYMBOL_spirv_decorate_parameter = 605, /* spirv_decorate_parameter */ - YYSYMBOL_spirv_decorate_id_parameter_list = 606, /* spirv_decorate_id_parameter_list */ - YYSYMBOL_spirv_decorate_id_parameter = 607, /* spirv_decorate_id_parameter */ - YYSYMBOL_spirv_decorate_string_parameter_list = 608, /* spirv_decorate_string_parameter_list */ - YYSYMBOL_spirv_type_specifier = 609, /* spirv_type_specifier */ - YYSYMBOL_spirv_type_parameter_list = 610, /* spirv_type_parameter_list */ - YYSYMBOL_spirv_type_parameter = 611, /* spirv_type_parameter */ - YYSYMBOL_spirv_instruction_qualifier = 612, /* spirv_instruction_qualifier */ - YYSYMBOL_spirv_instruction_qualifier_list = 613, /* spirv_instruction_qualifier_list */ - YYSYMBOL_spirv_instruction_qualifier_id = 614 /* spirv_instruction_qualifier_id */ + YYSYMBOL_VECTOR = 180, /* VECTOR */ + YYSYMBOL_HITOBJECTNV = 181, /* HITOBJECTNV */ + YYSYMBOL_HITOBJECTATTRNV = 182, /* HITOBJECTATTRNV */ + YYSYMBOL_HITOBJECTEXT = 183, /* HITOBJECTEXT */ + YYSYMBOL_HITOBJECTATTREXT = 184, /* HITOBJECTATTREXT */ + YYSYMBOL_TENSORLAYOUTNV = 185, /* TENSORLAYOUTNV */ + YYSYMBOL_TENSORVIEWNV = 186, /* TENSORVIEWNV */ + YYSYMBOL_TENSORARM = 187, /* TENSORARM */ + YYSYMBOL_SAMPLERCUBEARRAY = 188, /* SAMPLERCUBEARRAY */ + YYSYMBOL_SAMPLERCUBEARRAYSHADOW = 189, /* SAMPLERCUBEARRAYSHADOW */ + YYSYMBOL_ISAMPLERCUBEARRAY = 190, /* ISAMPLERCUBEARRAY */ + YYSYMBOL_USAMPLERCUBEARRAY = 191, /* USAMPLERCUBEARRAY */ + YYSYMBOL_SAMPLER1D = 192, /* SAMPLER1D */ + YYSYMBOL_SAMPLER1DARRAY = 193, /* SAMPLER1DARRAY */ + YYSYMBOL_SAMPLER1DARRAYSHADOW = 194, /* SAMPLER1DARRAYSHADOW */ + YYSYMBOL_ISAMPLER1D = 195, /* ISAMPLER1D */ + YYSYMBOL_SAMPLER1DSHADOW = 196, /* SAMPLER1DSHADOW */ + YYSYMBOL_SAMPLER2DRECT = 197, /* SAMPLER2DRECT */ + YYSYMBOL_SAMPLER2DRECTSHADOW = 198, /* SAMPLER2DRECTSHADOW */ + YYSYMBOL_ISAMPLER2DRECT = 199, /* ISAMPLER2DRECT */ + YYSYMBOL_USAMPLER2DRECT = 200, /* USAMPLER2DRECT */ + YYSYMBOL_SAMPLERBUFFER = 201, /* SAMPLERBUFFER */ + YYSYMBOL_ISAMPLERBUFFER = 202, /* ISAMPLERBUFFER */ + YYSYMBOL_USAMPLERBUFFER = 203, /* USAMPLERBUFFER */ + YYSYMBOL_SAMPLER2DMS = 204, /* SAMPLER2DMS */ + YYSYMBOL_ISAMPLER2DMS = 205, /* ISAMPLER2DMS */ + YYSYMBOL_USAMPLER2DMS = 206, /* USAMPLER2DMS */ + YYSYMBOL_SAMPLER2DMSARRAY = 207, /* SAMPLER2DMSARRAY */ + YYSYMBOL_ISAMPLER2DMSARRAY = 208, /* ISAMPLER2DMSARRAY */ + YYSYMBOL_USAMPLER2DMSARRAY = 209, /* USAMPLER2DMSARRAY */ + YYSYMBOL_SAMPLEREXTERNALOES = 210, /* SAMPLEREXTERNALOES */ + YYSYMBOL_SAMPLEREXTERNAL2DY2YEXT = 211, /* SAMPLEREXTERNAL2DY2YEXT */ + YYSYMBOL_ISAMPLER1DARRAY = 212, /* ISAMPLER1DARRAY */ + YYSYMBOL_USAMPLER1D = 213, /* USAMPLER1D */ + YYSYMBOL_USAMPLER1DARRAY = 214, /* USAMPLER1DARRAY */ + YYSYMBOL_F16SAMPLER1D = 215, /* F16SAMPLER1D */ + YYSYMBOL_F16SAMPLER2D = 216, /* F16SAMPLER2D */ + YYSYMBOL_F16SAMPLER3D = 217, /* F16SAMPLER3D */ + YYSYMBOL_F16SAMPLER2DRECT = 218, /* F16SAMPLER2DRECT */ + YYSYMBOL_F16SAMPLERCUBE = 219, /* F16SAMPLERCUBE */ + YYSYMBOL_F16SAMPLER1DARRAY = 220, /* F16SAMPLER1DARRAY */ + YYSYMBOL_F16SAMPLER2DARRAY = 221, /* F16SAMPLER2DARRAY */ + YYSYMBOL_F16SAMPLERCUBEARRAY = 222, /* F16SAMPLERCUBEARRAY */ + YYSYMBOL_F16SAMPLERBUFFER = 223, /* F16SAMPLERBUFFER */ + YYSYMBOL_F16SAMPLER2DMS = 224, /* F16SAMPLER2DMS */ + YYSYMBOL_F16SAMPLER2DMSARRAY = 225, /* F16SAMPLER2DMSARRAY */ + YYSYMBOL_F16SAMPLER1DSHADOW = 226, /* F16SAMPLER1DSHADOW */ + YYSYMBOL_F16SAMPLER2DSHADOW = 227, /* F16SAMPLER2DSHADOW */ + YYSYMBOL_F16SAMPLER1DARRAYSHADOW = 228, /* F16SAMPLER1DARRAYSHADOW */ + YYSYMBOL_F16SAMPLER2DARRAYSHADOW = 229, /* F16SAMPLER2DARRAYSHADOW */ + YYSYMBOL_F16SAMPLER2DRECTSHADOW = 230, /* F16SAMPLER2DRECTSHADOW */ + YYSYMBOL_F16SAMPLERCUBESHADOW = 231, /* F16SAMPLERCUBESHADOW */ + YYSYMBOL_F16SAMPLERCUBEARRAYSHADOW = 232, /* F16SAMPLERCUBEARRAYSHADOW */ + YYSYMBOL_IMAGE1D = 233, /* IMAGE1D */ + YYSYMBOL_IIMAGE1D = 234, /* IIMAGE1D */ + YYSYMBOL_UIMAGE1D = 235, /* UIMAGE1D */ + YYSYMBOL_IMAGE2D = 236, /* IMAGE2D */ + YYSYMBOL_IIMAGE2D = 237, /* IIMAGE2D */ + YYSYMBOL_UIMAGE2D = 238, /* UIMAGE2D */ + YYSYMBOL_IMAGE3D = 239, /* IMAGE3D */ + YYSYMBOL_IIMAGE3D = 240, /* IIMAGE3D */ + YYSYMBOL_UIMAGE3D = 241, /* UIMAGE3D */ + YYSYMBOL_IMAGE2DRECT = 242, /* IMAGE2DRECT */ + YYSYMBOL_IIMAGE2DRECT = 243, /* IIMAGE2DRECT */ + YYSYMBOL_UIMAGE2DRECT = 244, /* UIMAGE2DRECT */ + YYSYMBOL_IMAGECUBE = 245, /* IMAGECUBE */ + YYSYMBOL_IIMAGECUBE = 246, /* IIMAGECUBE */ + YYSYMBOL_UIMAGECUBE = 247, /* UIMAGECUBE */ + YYSYMBOL_IMAGEBUFFER = 248, /* IMAGEBUFFER */ + YYSYMBOL_IIMAGEBUFFER = 249, /* IIMAGEBUFFER */ + YYSYMBOL_UIMAGEBUFFER = 250, /* UIMAGEBUFFER */ + YYSYMBOL_IMAGE1DARRAY = 251, /* IMAGE1DARRAY */ + YYSYMBOL_IIMAGE1DARRAY = 252, /* IIMAGE1DARRAY */ + YYSYMBOL_UIMAGE1DARRAY = 253, /* UIMAGE1DARRAY */ + YYSYMBOL_IMAGE2DARRAY = 254, /* IMAGE2DARRAY */ + YYSYMBOL_IIMAGE2DARRAY = 255, /* IIMAGE2DARRAY */ + YYSYMBOL_UIMAGE2DARRAY = 256, /* UIMAGE2DARRAY */ + YYSYMBOL_IMAGECUBEARRAY = 257, /* IMAGECUBEARRAY */ + YYSYMBOL_IIMAGECUBEARRAY = 258, /* IIMAGECUBEARRAY */ + YYSYMBOL_UIMAGECUBEARRAY = 259, /* UIMAGECUBEARRAY */ + YYSYMBOL_IMAGE2DMS = 260, /* IMAGE2DMS */ + YYSYMBOL_IIMAGE2DMS = 261, /* IIMAGE2DMS */ + YYSYMBOL_UIMAGE2DMS = 262, /* UIMAGE2DMS */ + YYSYMBOL_IMAGE2DMSARRAY = 263, /* IMAGE2DMSARRAY */ + YYSYMBOL_IIMAGE2DMSARRAY = 264, /* IIMAGE2DMSARRAY */ + YYSYMBOL_UIMAGE2DMSARRAY = 265, /* UIMAGE2DMSARRAY */ + YYSYMBOL_F16IMAGE1D = 266, /* F16IMAGE1D */ + YYSYMBOL_F16IMAGE2D = 267, /* F16IMAGE2D */ + YYSYMBOL_F16IMAGE3D = 268, /* F16IMAGE3D */ + YYSYMBOL_F16IMAGE2DRECT = 269, /* F16IMAGE2DRECT */ + YYSYMBOL_F16IMAGECUBE = 270, /* F16IMAGECUBE */ + YYSYMBOL_F16IMAGE1DARRAY = 271, /* F16IMAGE1DARRAY */ + YYSYMBOL_F16IMAGE2DARRAY = 272, /* F16IMAGE2DARRAY */ + YYSYMBOL_F16IMAGECUBEARRAY = 273, /* F16IMAGECUBEARRAY */ + YYSYMBOL_F16IMAGEBUFFER = 274, /* F16IMAGEBUFFER */ + YYSYMBOL_F16IMAGE2DMS = 275, /* F16IMAGE2DMS */ + YYSYMBOL_F16IMAGE2DMSARRAY = 276, /* F16IMAGE2DMSARRAY */ + YYSYMBOL_I64IMAGE1D = 277, /* I64IMAGE1D */ + YYSYMBOL_U64IMAGE1D = 278, /* U64IMAGE1D */ + YYSYMBOL_I64IMAGE2D = 279, /* I64IMAGE2D */ + YYSYMBOL_U64IMAGE2D = 280, /* U64IMAGE2D */ + YYSYMBOL_I64IMAGE3D = 281, /* I64IMAGE3D */ + YYSYMBOL_U64IMAGE3D = 282, /* U64IMAGE3D */ + YYSYMBOL_I64IMAGE2DRECT = 283, /* I64IMAGE2DRECT */ + YYSYMBOL_U64IMAGE2DRECT = 284, /* U64IMAGE2DRECT */ + YYSYMBOL_I64IMAGECUBE = 285, /* I64IMAGECUBE */ + YYSYMBOL_U64IMAGECUBE = 286, /* U64IMAGECUBE */ + YYSYMBOL_I64IMAGEBUFFER = 287, /* I64IMAGEBUFFER */ + YYSYMBOL_U64IMAGEBUFFER = 288, /* U64IMAGEBUFFER */ + YYSYMBOL_I64IMAGE1DARRAY = 289, /* I64IMAGE1DARRAY */ + YYSYMBOL_U64IMAGE1DARRAY = 290, /* U64IMAGE1DARRAY */ + YYSYMBOL_I64IMAGE2DARRAY = 291, /* I64IMAGE2DARRAY */ + YYSYMBOL_U64IMAGE2DARRAY = 292, /* U64IMAGE2DARRAY */ + YYSYMBOL_I64IMAGECUBEARRAY = 293, /* I64IMAGECUBEARRAY */ + YYSYMBOL_U64IMAGECUBEARRAY = 294, /* U64IMAGECUBEARRAY */ + YYSYMBOL_I64IMAGE2DMS = 295, /* I64IMAGE2DMS */ + YYSYMBOL_U64IMAGE2DMS = 296, /* U64IMAGE2DMS */ + YYSYMBOL_I64IMAGE2DMSARRAY = 297, /* I64IMAGE2DMSARRAY */ + YYSYMBOL_U64IMAGE2DMSARRAY = 298, /* U64IMAGE2DMSARRAY */ + YYSYMBOL_TEXTURECUBEARRAY = 299, /* TEXTURECUBEARRAY */ + YYSYMBOL_ITEXTURECUBEARRAY = 300, /* ITEXTURECUBEARRAY */ + YYSYMBOL_UTEXTURECUBEARRAY = 301, /* UTEXTURECUBEARRAY */ + YYSYMBOL_TEXTURE1D = 302, /* TEXTURE1D */ + YYSYMBOL_ITEXTURE1D = 303, /* ITEXTURE1D */ + YYSYMBOL_UTEXTURE1D = 304, /* UTEXTURE1D */ + YYSYMBOL_TEXTURE1DARRAY = 305, /* TEXTURE1DARRAY */ + YYSYMBOL_ITEXTURE1DARRAY = 306, /* ITEXTURE1DARRAY */ + YYSYMBOL_UTEXTURE1DARRAY = 307, /* UTEXTURE1DARRAY */ + YYSYMBOL_TEXTURE2DRECT = 308, /* TEXTURE2DRECT */ + YYSYMBOL_ITEXTURE2DRECT = 309, /* ITEXTURE2DRECT */ + YYSYMBOL_UTEXTURE2DRECT = 310, /* UTEXTURE2DRECT */ + YYSYMBOL_TEXTUREBUFFER = 311, /* TEXTUREBUFFER */ + YYSYMBOL_ITEXTUREBUFFER = 312, /* ITEXTUREBUFFER */ + YYSYMBOL_UTEXTUREBUFFER = 313, /* UTEXTUREBUFFER */ + YYSYMBOL_TEXTURE2DMS = 314, /* TEXTURE2DMS */ + YYSYMBOL_ITEXTURE2DMS = 315, /* ITEXTURE2DMS */ + YYSYMBOL_UTEXTURE2DMS = 316, /* UTEXTURE2DMS */ + YYSYMBOL_TEXTURE2DMSARRAY = 317, /* TEXTURE2DMSARRAY */ + YYSYMBOL_ITEXTURE2DMSARRAY = 318, /* ITEXTURE2DMSARRAY */ + YYSYMBOL_UTEXTURE2DMSARRAY = 319, /* UTEXTURE2DMSARRAY */ + YYSYMBOL_F16TEXTURE1D = 320, /* F16TEXTURE1D */ + YYSYMBOL_F16TEXTURE2D = 321, /* F16TEXTURE2D */ + YYSYMBOL_F16TEXTURE3D = 322, /* F16TEXTURE3D */ + YYSYMBOL_F16TEXTURE2DRECT = 323, /* F16TEXTURE2DRECT */ + YYSYMBOL_F16TEXTURECUBE = 324, /* F16TEXTURECUBE */ + YYSYMBOL_F16TEXTURE1DARRAY = 325, /* F16TEXTURE1DARRAY */ + YYSYMBOL_F16TEXTURE2DARRAY = 326, /* F16TEXTURE2DARRAY */ + YYSYMBOL_F16TEXTURECUBEARRAY = 327, /* F16TEXTURECUBEARRAY */ + YYSYMBOL_F16TEXTUREBUFFER = 328, /* F16TEXTUREBUFFER */ + YYSYMBOL_F16TEXTURE2DMS = 329, /* F16TEXTURE2DMS */ + YYSYMBOL_F16TEXTURE2DMSARRAY = 330, /* F16TEXTURE2DMSARRAY */ + YYSYMBOL_SUBPASSINPUT = 331, /* SUBPASSINPUT */ + YYSYMBOL_SUBPASSINPUTMS = 332, /* SUBPASSINPUTMS */ + YYSYMBOL_ISUBPASSINPUT = 333, /* ISUBPASSINPUT */ + YYSYMBOL_ISUBPASSINPUTMS = 334, /* ISUBPASSINPUTMS */ + YYSYMBOL_USUBPASSINPUT = 335, /* USUBPASSINPUT */ + YYSYMBOL_USUBPASSINPUTMS = 336, /* USUBPASSINPUTMS */ + YYSYMBOL_F16SUBPASSINPUT = 337, /* F16SUBPASSINPUT */ + YYSYMBOL_F16SUBPASSINPUTMS = 338, /* F16SUBPASSINPUTMS */ + YYSYMBOL_SPIRV_INSTRUCTION = 339, /* SPIRV_INSTRUCTION */ + YYSYMBOL_SPIRV_EXECUTION_MODE = 340, /* SPIRV_EXECUTION_MODE */ + YYSYMBOL_SPIRV_EXECUTION_MODE_ID = 341, /* SPIRV_EXECUTION_MODE_ID */ + YYSYMBOL_SPIRV_DECORATE = 342, /* SPIRV_DECORATE */ + YYSYMBOL_SPIRV_DECORATE_ID = 343, /* SPIRV_DECORATE_ID */ + YYSYMBOL_SPIRV_DECORATE_STRING = 344, /* SPIRV_DECORATE_STRING */ + YYSYMBOL_SPIRV_TYPE = 345, /* SPIRV_TYPE */ + YYSYMBOL_SPIRV_STORAGE_CLASS = 346, /* SPIRV_STORAGE_CLASS */ + YYSYMBOL_SPIRV_BY_REFERENCE = 347, /* SPIRV_BY_REFERENCE */ + YYSYMBOL_SPIRV_LITERAL = 348, /* SPIRV_LITERAL */ + YYSYMBOL_ATTACHMENTEXT = 349, /* ATTACHMENTEXT */ + YYSYMBOL_IATTACHMENTEXT = 350, /* IATTACHMENTEXT */ + YYSYMBOL_UATTACHMENTEXT = 351, /* UATTACHMENTEXT */ + YYSYMBOL_LEFT_OP = 352, /* LEFT_OP */ + YYSYMBOL_RIGHT_OP = 353, /* RIGHT_OP */ + YYSYMBOL_INC_OP = 354, /* INC_OP */ + YYSYMBOL_DEC_OP = 355, /* DEC_OP */ + YYSYMBOL_LE_OP = 356, /* LE_OP */ + YYSYMBOL_GE_OP = 357, /* GE_OP */ + YYSYMBOL_EQ_OP = 358, /* EQ_OP */ + YYSYMBOL_NE_OP = 359, /* NE_OP */ + YYSYMBOL_AND_OP = 360, /* AND_OP */ + YYSYMBOL_OR_OP = 361, /* OR_OP */ + YYSYMBOL_XOR_OP = 362, /* XOR_OP */ + YYSYMBOL_MUL_ASSIGN = 363, /* MUL_ASSIGN */ + YYSYMBOL_DIV_ASSIGN = 364, /* DIV_ASSIGN */ + YYSYMBOL_ADD_ASSIGN = 365, /* ADD_ASSIGN */ + YYSYMBOL_MOD_ASSIGN = 366, /* MOD_ASSIGN */ + YYSYMBOL_LEFT_ASSIGN = 367, /* LEFT_ASSIGN */ + YYSYMBOL_RIGHT_ASSIGN = 368, /* RIGHT_ASSIGN */ + YYSYMBOL_AND_ASSIGN = 369, /* AND_ASSIGN */ + YYSYMBOL_XOR_ASSIGN = 370, /* XOR_ASSIGN */ + YYSYMBOL_OR_ASSIGN = 371, /* OR_ASSIGN */ + YYSYMBOL_SUB_ASSIGN = 372, /* SUB_ASSIGN */ + YYSYMBOL_STRING_LITERAL = 373, /* STRING_LITERAL */ + YYSYMBOL_LEFT_PAREN = 374, /* LEFT_PAREN */ + YYSYMBOL_RIGHT_PAREN = 375, /* RIGHT_PAREN */ + YYSYMBOL_LEFT_BRACKET = 376, /* LEFT_BRACKET */ + YYSYMBOL_RIGHT_BRACKET = 377, /* RIGHT_BRACKET */ + YYSYMBOL_LEFT_BRACE = 378, /* LEFT_BRACE */ + YYSYMBOL_RIGHT_BRACE = 379, /* RIGHT_BRACE */ + YYSYMBOL_DOT = 380, /* DOT */ + YYSYMBOL_COMMA = 381, /* COMMA */ + YYSYMBOL_COLON = 382, /* COLON */ + YYSYMBOL_EQUAL = 383, /* EQUAL */ + YYSYMBOL_SEMICOLON = 384, /* SEMICOLON */ + YYSYMBOL_BANG = 385, /* BANG */ + YYSYMBOL_DASH = 386, /* DASH */ + YYSYMBOL_TILDE = 387, /* TILDE */ + YYSYMBOL_PLUS = 388, /* PLUS */ + YYSYMBOL_STAR = 389, /* STAR */ + YYSYMBOL_SLASH = 390, /* SLASH */ + YYSYMBOL_PERCENT = 391, /* PERCENT */ + YYSYMBOL_LEFT_ANGLE = 392, /* LEFT_ANGLE */ + YYSYMBOL_RIGHT_ANGLE = 393, /* RIGHT_ANGLE */ + YYSYMBOL_VERTICAL_BAR = 394, /* VERTICAL_BAR */ + YYSYMBOL_CARET = 395, /* CARET */ + YYSYMBOL_AMPERSAND = 396, /* AMPERSAND */ + YYSYMBOL_QUESTION = 397, /* QUESTION */ + YYSYMBOL_INVARIANT = 398, /* INVARIANT */ + YYSYMBOL_HIGH_PRECISION = 399, /* HIGH_PRECISION */ + YYSYMBOL_MEDIUM_PRECISION = 400, /* MEDIUM_PRECISION */ + YYSYMBOL_LOW_PRECISION = 401, /* LOW_PRECISION */ + YYSYMBOL_PRECISION = 402, /* PRECISION */ + YYSYMBOL_PACKED = 403, /* PACKED */ + YYSYMBOL_RESOURCE = 404, /* RESOURCE */ + YYSYMBOL_SUPERP = 405, /* SUPERP */ + YYSYMBOL_FLOATCONSTANT = 406, /* FLOATCONSTANT */ + YYSYMBOL_INTCONSTANT = 407, /* INTCONSTANT */ + YYSYMBOL_UINTCONSTANT = 408, /* UINTCONSTANT */ + YYSYMBOL_BOOLCONSTANT = 409, /* BOOLCONSTANT */ + YYSYMBOL_IDENTIFIER = 410, /* IDENTIFIER */ + YYSYMBOL_TYPE_NAME = 411, /* TYPE_NAME */ + YYSYMBOL_CENTROID = 412, /* CENTROID */ + YYSYMBOL_IN = 413, /* IN */ + YYSYMBOL_OUT = 414, /* OUT */ + YYSYMBOL_INOUT = 415, /* INOUT */ + YYSYMBOL_STRUCT = 416, /* STRUCT */ + YYSYMBOL_VOID = 417, /* VOID */ + YYSYMBOL_WHILE = 418, /* WHILE */ + YYSYMBOL_BREAK = 419, /* BREAK */ + YYSYMBOL_CONTINUE = 420, /* CONTINUE */ + YYSYMBOL_DO = 421, /* DO */ + YYSYMBOL_ELSE = 422, /* ELSE */ + YYSYMBOL_FOR = 423, /* FOR */ + YYSYMBOL_IF = 424, /* IF */ + YYSYMBOL_DISCARD = 425, /* DISCARD */ + YYSYMBOL_RETURN = 426, /* RETURN */ + YYSYMBOL_SWITCH = 427, /* SWITCH */ + YYSYMBOL_CASE = 428, /* CASE */ + YYSYMBOL_DEFAULT = 429, /* DEFAULT */ + YYSYMBOL_TERMINATE_INVOCATION = 430, /* TERMINATE_INVOCATION */ + YYSYMBOL_TERMINATE_RAY = 431, /* TERMINATE_RAY */ + YYSYMBOL_IGNORE_INTERSECTION = 432, /* IGNORE_INTERSECTION */ + YYSYMBOL_UNIFORM = 433, /* UNIFORM */ + YYSYMBOL_SHARED = 434, /* SHARED */ + YYSYMBOL_BUFFER = 435, /* BUFFER */ + YYSYMBOL_TILEIMAGEEXT = 436, /* TILEIMAGEEXT */ + YYSYMBOL_FLAT = 437, /* FLAT */ + YYSYMBOL_SMOOTH = 438, /* SMOOTH */ + YYSYMBOL_LAYOUT = 439, /* LAYOUT */ + YYSYMBOL_DOUBLECONSTANT = 440, /* DOUBLECONSTANT */ + YYSYMBOL_INT16CONSTANT = 441, /* INT16CONSTANT */ + YYSYMBOL_UINT16CONSTANT = 442, /* UINT16CONSTANT */ + YYSYMBOL_FLOAT16CONSTANT = 443, /* FLOAT16CONSTANT */ + YYSYMBOL_INT32CONSTANT = 444, /* INT32CONSTANT */ + YYSYMBOL_UINT32CONSTANT = 445, /* UINT32CONSTANT */ + YYSYMBOL_INT64CONSTANT = 446, /* INT64CONSTANT */ + YYSYMBOL_UINT64CONSTANT = 447, /* UINT64CONSTANT */ + YYSYMBOL_SUBROUTINE = 448, /* SUBROUTINE */ + YYSYMBOL_DEMOTE = 449, /* DEMOTE */ + YYSYMBOL_FUNCTION = 450, /* FUNCTION */ + YYSYMBOL_PAYLOADNV = 451, /* PAYLOADNV */ + YYSYMBOL_PAYLOADINNV = 452, /* PAYLOADINNV */ + YYSYMBOL_HITATTRNV = 453, /* HITATTRNV */ + YYSYMBOL_CALLDATANV = 454, /* CALLDATANV */ + YYSYMBOL_CALLDATAINNV = 455, /* CALLDATAINNV */ + YYSYMBOL_PAYLOADEXT = 456, /* PAYLOADEXT */ + YYSYMBOL_PAYLOADINEXT = 457, /* PAYLOADINEXT */ + YYSYMBOL_HITATTREXT = 458, /* HITATTREXT */ + YYSYMBOL_CALLDATAEXT = 459, /* CALLDATAEXT */ + YYSYMBOL_CALLDATAINEXT = 460, /* CALLDATAINEXT */ + YYSYMBOL_PATCH = 461, /* PATCH */ + YYSYMBOL_SAMPLE = 462, /* SAMPLE */ + YYSYMBOL_NONUNIFORM = 463, /* NONUNIFORM */ + YYSYMBOL_RESOURCEHEAP = 464, /* RESOURCEHEAP */ + YYSYMBOL_SAMPLERHEAP = 465, /* SAMPLERHEAP */ + YYSYMBOL_COHERENT = 466, /* COHERENT */ + YYSYMBOL_VOLATILE = 467, /* VOLATILE */ + YYSYMBOL_RESTRICT = 468, /* RESTRICT */ + YYSYMBOL_READONLY = 469, /* READONLY */ + YYSYMBOL_WRITEONLY = 470, /* WRITEONLY */ + YYSYMBOL_NONTEMPORAL = 471, /* NONTEMPORAL */ + YYSYMBOL_DEVICECOHERENT = 472, /* DEVICECOHERENT */ + YYSYMBOL_QUEUEFAMILYCOHERENT = 473, /* QUEUEFAMILYCOHERENT */ + YYSYMBOL_WORKGROUPCOHERENT = 474, /* WORKGROUPCOHERENT */ + YYSYMBOL_SUBGROUPCOHERENT = 475, /* SUBGROUPCOHERENT */ + YYSYMBOL_NONPRIVATE = 476, /* NONPRIVATE */ + YYSYMBOL_SHADERCALLCOHERENT = 477, /* SHADERCALLCOHERENT */ + YYSYMBOL_NOPERSPECTIVE = 478, /* NOPERSPECTIVE */ + YYSYMBOL_EXPLICITINTERPAMD = 479, /* EXPLICITINTERPAMD */ + YYSYMBOL_PERVERTEXEXT = 480, /* PERVERTEXEXT */ + YYSYMBOL_PERVERTEXNV = 481, /* PERVERTEXNV */ + YYSYMBOL_PERPRIMITIVENV = 482, /* PERPRIMITIVENV */ + YYSYMBOL_PERVIEWNV = 483, /* PERVIEWNV */ + YYSYMBOL_PERTASKNV = 484, /* PERTASKNV */ + YYSYMBOL_PERPRIMITIVEEXT = 485, /* PERPRIMITIVEEXT */ + YYSYMBOL_TASKPAYLOADWORKGROUPEXT = 486, /* TASKPAYLOADWORKGROUPEXT */ + YYSYMBOL_PRECISE = 487, /* PRECISE */ + YYSYMBOL_YYACCEPT = 488, /* $accept */ + YYSYMBOL_variable_identifier = 489, /* variable_identifier */ + YYSYMBOL_primary_expression = 490, /* primary_expression */ + YYSYMBOL_postfix_expression = 491, /* postfix_expression */ + YYSYMBOL_integer_expression = 492, /* integer_expression */ + YYSYMBOL_function_call = 493, /* function_call */ + YYSYMBOL_function_call_or_method = 494, /* function_call_or_method */ + YYSYMBOL_function_call_generic = 495, /* function_call_generic */ + YYSYMBOL_function_call_header_no_parameters = 496, /* function_call_header_no_parameters */ + YYSYMBOL_function_call_header_with_parameters = 497, /* function_call_header_with_parameters */ + YYSYMBOL_function_call_header = 498, /* function_call_header */ + YYSYMBOL_function_identifier = 499, /* function_identifier */ + YYSYMBOL_unary_expression = 500, /* unary_expression */ + YYSYMBOL_unary_operator = 501, /* unary_operator */ + YYSYMBOL_multiplicative_expression = 502, /* multiplicative_expression */ + YYSYMBOL_additive_expression = 503, /* additive_expression */ + YYSYMBOL_shift_expression = 504, /* shift_expression */ + YYSYMBOL_relational_expression = 505, /* relational_expression */ + YYSYMBOL_equality_expression = 506, /* equality_expression */ + YYSYMBOL_and_expression = 507, /* and_expression */ + YYSYMBOL_exclusive_or_expression = 508, /* exclusive_or_expression */ + YYSYMBOL_inclusive_or_expression = 509, /* inclusive_or_expression */ + YYSYMBOL_logical_and_expression = 510, /* logical_and_expression */ + YYSYMBOL_logical_xor_expression = 511, /* logical_xor_expression */ + YYSYMBOL_logical_or_expression = 512, /* logical_or_expression */ + YYSYMBOL_conditional_expression = 513, /* conditional_expression */ + YYSYMBOL_514_1 = 514, /* $@1 */ + YYSYMBOL_assignment_expression = 515, /* assignment_expression */ + YYSYMBOL_assignment_operator = 516, /* assignment_operator */ + YYSYMBOL_expression = 517, /* expression */ + YYSYMBOL_constant_expression = 518, /* constant_expression */ + YYSYMBOL_declaration = 519, /* declaration */ + YYSYMBOL_block_structure = 520, /* block_structure */ + YYSYMBOL_521_2 = 521, /* $@2 */ + YYSYMBOL_identifier_list = 522, /* identifier_list */ + YYSYMBOL_function_prototype = 523, /* function_prototype */ + YYSYMBOL_function_declarator = 524, /* function_declarator */ + YYSYMBOL_function_header_with_parameters = 525, /* function_header_with_parameters */ + YYSYMBOL_function_header = 526, /* function_header */ + YYSYMBOL_parameter_declarator = 527, /* parameter_declarator */ + YYSYMBOL_parameter_declaration = 528, /* parameter_declaration */ + YYSYMBOL_parameter_type_specifier = 529, /* parameter_type_specifier */ + YYSYMBOL_init_declarator_list = 530, /* init_declarator_list */ + YYSYMBOL_single_declaration = 531, /* single_declaration */ + YYSYMBOL_fully_specified_type = 532, /* fully_specified_type */ + YYSYMBOL_invariant_qualifier = 533, /* invariant_qualifier */ + YYSYMBOL_interpolation_qualifier = 534, /* interpolation_qualifier */ + YYSYMBOL_layout_qualifier = 535, /* layout_qualifier */ + YYSYMBOL_layout_qualifier_id_list = 536, /* layout_qualifier_id_list */ + YYSYMBOL_layout_qualifier_id = 537, /* layout_qualifier_id */ + YYSYMBOL_precise_qualifier = 538, /* precise_qualifier */ + YYSYMBOL_type_qualifier = 539, /* type_qualifier */ + YYSYMBOL_single_type_qualifier = 540, /* single_type_qualifier */ + YYSYMBOL_storage_qualifier = 541, /* storage_qualifier */ + YYSYMBOL_non_uniform_qualifier = 542, /* non_uniform_qualifier */ + YYSYMBOL_type_name_list = 543, /* type_name_list */ + YYSYMBOL_type_specifier = 544, /* type_specifier */ + YYSYMBOL_array_specifier = 545, /* array_specifier */ + YYSYMBOL_type_parameter_specifier_opt = 546, /* type_parameter_specifier_opt */ + YYSYMBOL_type_parameter_specifier = 547, /* type_parameter_specifier */ + YYSYMBOL_type_parameter_specifier_list = 548, /* type_parameter_specifier_list */ + YYSYMBOL_type_specifier_nonarray = 549, /* type_specifier_nonarray */ + YYSYMBOL_precision_qualifier = 550, /* precision_qualifier */ + YYSYMBOL_struct_specifier = 551, /* struct_specifier */ + YYSYMBOL_552_3 = 552, /* $@3 */ + YYSYMBOL_553_4 = 553, /* $@4 */ + YYSYMBOL_struct_declaration_list = 554, /* struct_declaration_list */ + YYSYMBOL_struct_declaration_with_heap = 555, /* struct_declaration_with_heap */ + YYSYMBOL_block_heap_inner_structure = 556, /* block_heap_inner_structure */ + YYSYMBOL_557_5 = 557, /* $@5 */ + YYSYMBOL_struct_declaration_without_heap = 558, /* struct_declaration_without_heap */ + YYSYMBOL_struct_declaration = 559, /* struct_declaration */ + YYSYMBOL_struct_declarator_list = 560, /* struct_declarator_list */ + YYSYMBOL_struct_declarator = 561, /* struct_declarator */ + YYSYMBOL_initializer = 562, /* initializer */ + YYSYMBOL_initializer_list = 563, /* initializer_list */ + YYSYMBOL_declaration_statement = 564, /* declaration_statement */ + YYSYMBOL_statement = 565, /* statement */ + YYSYMBOL_simple_statement = 566, /* simple_statement */ + YYSYMBOL_demote_statement = 567, /* demote_statement */ + YYSYMBOL_compound_statement = 568, /* compound_statement */ + YYSYMBOL_569_6 = 569, /* $@6 */ + YYSYMBOL_570_7 = 570, /* $@7 */ + YYSYMBOL_statement_no_new_scope = 571, /* statement_no_new_scope */ + YYSYMBOL_statement_scoped = 572, /* statement_scoped */ + YYSYMBOL_573_8 = 573, /* $@8 */ + YYSYMBOL_574_9 = 574, /* $@9 */ + YYSYMBOL_compound_statement_no_new_scope = 575, /* compound_statement_no_new_scope */ + YYSYMBOL_statement_list = 576, /* statement_list */ + YYSYMBOL_expression_statement = 577, /* expression_statement */ + YYSYMBOL_selection_statement = 578, /* selection_statement */ + YYSYMBOL_selection_statement_nonattributed = 579, /* selection_statement_nonattributed */ + YYSYMBOL_selection_rest_statement = 580, /* selection_rest_statement */ + YYSYMBOL_condition = 581, /* condition */ + YYSYMBOL_switch_statement = 582, /* switch_statement */ + YYSYMBOL_switch_statement_nonattributed = 583, /* switch_statement_nonattributed */ + YYSYMBOL_584_10 = 584, /* $@10 */ + YYSYMBOL_switch_statement_list = 585, /* switch_statement_list */ + YYSYMBOL_case_label = 586, /* case_label */ + YYSYMBOL_iteration_statement = 587, /* iteration_statement */ + YYSYMBOL_iteration_statement_nonattributed = 588, /* iteration_statement_nonattributed */ + YYSYMBOL_589_11 = 589, /* $@11 */ + YYSYMBOL_590_12 = 590, /* $@12 */ + YYSYMBOL_591_13 = 591, /* $@13 */ + YYSYMBOL_for_init_statement = 592, /* for_init_statement */ + YYSYMBOL_conditionopt = 593, /* conditionopt */ + YYSYMBOL_for_rest_statement = 594, /* for_rest_statement */ + YYSYMBOL_jump_statement = 595, /* jump_statement */ + YYSYMBOL_translation_unit = 596, /* translation_unit */ + YYSYMBOL_external_declaration = 597, /* external_declaration */ + YYSYMBOL_function_definition = 598, /* function_definition */ + YYSYMBOL_599_14 = 599, /* $@14 */ + YYSYMBOL_attribute = 600, /* attribute */ + YYSYMBOL_attribute_list = 601, /* attribute_list */ + YYSYMBOL_single_attribute = 602, /* single_attribute */ + YYSYMBOL_spirv_requirements_list = 603, /* spirv_requirements_list */ + YYSYMBOL_spirv_requirements_parameter = 604, /* spirv_requirements_parameter */ + YYSYMBOL_spirv_extension_list = 605, /* spirv_extension_list */ + YYSYMBOL_spirv_capability_list = 606, /* spirv_capability_list */ + YYSYMBOL_spirv_execution_mode_qualifier = 607, /* spirv_execution_mode_qualifier */ + YYSYMBOL_spirv_execution_mode_parameter_list = 608, /* spirv_execution_mode_parameter_list */ + YYSYMBOL_spirv_execution_mode_parameter = 609, /* spirv_execution_mode_parameter */ + YYSYMBOL_spirv_execution_mode_id_parameter_list = 610, /* spirv_execution_mode_id_parameter_list */ + YYSYMBOL_spirv_storage_class_qualifier = 611, /* spirv_storage_class_qualifier */ + YYSYMBOL_spirv_decorate_qualifier = 612, /* spirv_decorate_qualifier */ + YYSYMBOL_spirv_decorate_parameter_list = 613, /* spirv_decorate_parameter_list */ + YYSYMBOL_spirv_decorate_parameter = 614, /* spirv_decorate_parameter */ + YYSYMBOL_spirv_decorate_id_parameter_list = 615, /* spirv_decorate_id_parameter_list */ + YYSYMBOL_spirv_decorate_id_parameter = 616, /* spirv_decorate_id_parameter */ + YYSYMBOL_spirv_decorate_string_parameter_list = 617, /* spirv_decorate_string_parameter_list */ + YYSYMBOL_spirv_type_specifier = 618, /* spirv_type_specifier */ + YYSYMBOL_spirv_type_parameter_list = 619, /* spirv_type_parameter_list */ + YYSYMBOL_spirv_type_parameter = 620, /* spirv_type_parameter */ + YYSYMBOL_spirv_instruction_qualifier = 621, /* spirv_instruction_qualifier */ + YYSYMBOL_spirv_instruction_qualifier_list = 622, /* spirv_instruction_qualifier_list */ + YYSYMBOL_spirv_instruction_qualifier_id = 623 /* spirv_instruction_qualifier_id */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -750,7 +759,7 @@ typedef enum yysymbol_kind_t yysymbol_kind_t; extern int yylex(YYSTYPE*, TParseContext&); -#line 754 "MachineIndependent/glslang_tab.cpp" +#line 763 "MachineIndependent/glslang_tab.cpp" #ifdef short @@ -1072,21 +1081,21 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 470 +#define YYFINAL 476 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 13694 +#define YYLAST 13820 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 483 +#define YYNTOKENS 488 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 132 +#define YYNNTS 136 /* YYNRULES -- Number of rules. */ -#define YYNRULES 720 +#define YYNRULES 731 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 969 +#define YYNSTATES 983 /* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 737 +#define YYMAXUTOK 742 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -1173,86 +1182,88 @@ static const yytype_int16 yytranslate[] = 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482 + 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, + 485, 486, 487 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 361, 361, 367, 370, 375, 378, 381, 385, 388, - 391, 395, 399, 403, 407, 411, 415, 421, 428, 431, - 434, 437, 440, 445, 453, 460, 467, 473, 477, 484, - 487, 493, 511, 536, 544, 549, 576, 584, 590, 594, - 598, 618, 619, 620, 621, 627, 628, 633, 638, 647, - 648, 653, 661, 662, 668, 677, 678, 683, 688, 693, - 701, 702, 711, 723, 724, 733, 734, 743, 744, 753, - 754, 762, 763, 771, 772, 780, 781, 781, 799, 800, - 816, 820, 824, 828, 833, 837, 841, 845, 849, 853, - 857, 864, 867, 878, 885, 890, 897, 902, 907, 914, - 918, 922, 926, 931, 936, 945, 945, 956, 960, 967, - 972, 980, 988, 1000, 1003, 1010, 1023, 1043, 1050, 1073, - 1088, 1107, 1118, 1129, 1139, 1149, 1159, 1168, 1171, 1175, - 1179, 1184, 1192, 1197, 1202, 1207, 1212, 1221, 1231, 1258, - 1267, 1274, 1281, 1288, 1295, 1303, 1311, 1321, 1331, 1338, - 1348, 1354, 1357, 1364, 1368, 1372, 1380, 1389, 1392, 1403, - 1406, 1409, 1413, 1417, 1421, 1425, 1428, 1433, 1437, 1442, - 1450, 1454, 1459, 1465, 1471, 1478, 1483, 1488, 1496, 1501, - 1513, 1527, 1533, 1538, 1546, 1554, 1562, 1570, 1578, 1586, - 1594, 1602, 1610, 1617, 1624, 1628, 1633, 1638, 1643, 1648, - 1653, 1658, 1662, 1666, 1670, 1674, 1678, 1684, 1690, 1700, - 1707, 1710, 1718, 1725, 1736, 1741, 1749, 1753, 1763, 1766, - 1772, 1778, 1784, 1792, 1802, 1806, 1810, 1814, 1819, 1823, - 1828, 1833, 1838, 1843, 1848, 1853, 1858, 1863, 1868, 1874, - 1880, 1886, 1891, 1896, 1901, 1906, 1911, 1916, 1921, 1926, - 1931, 1936, 1941, 1946, 1953, 1958, 1963, 1968, 1973, 1978, - 1983, 1988, 1993, 1998, 2003, 2008, 2013, 2018, 2023, 2031, - 2039, 2047, 2053, 2059, 2065, 2071, 2077, 2083, 2089, 2095, - 2101, 2107, 2113, 2119, 2125, 2131, 2137, 2143, 2149, 2155, - 2161, 2167, 2173, 2179, 2185, 2191, 2197, 2203, 2209, 2215, - 2221, 2227, 2233, 2239, 2245, 2251, 2257, 2263, 2269, 2275, - 2281, 2287, 2293, 2299, 2307, 2315, 2323, 2331, 2339, 2347, - 2355, 2363, 2371, 2379, 2387, 2395, 2401, 2407, 2413, 2419, - 2425, 2431, 2437, 2443, 2449, 2455, 2461, 2467, 2473, 2479, - 2485, 2491, 2497, 2503, 2509, 2515, 2521, 2527, 2533, 2539, - 2545, 2551, 2557, 2563, 2569, 2575, 2581, 2587, 2593, 2599, - 2605, 2611, 2615, 2619, 2623, 2628, 2633, 2638, 2643, 2648, - 2653, 2658, 2663, 2668, 2673, 2678, 2683, 2688, 2693, 2699, - 2705, 2711, 2717, 2723, 2729, 2735, 2741, 2747, 2753, 2759, - 2765, 2771, 2776, 2781, 2786, 2791, 2796, 2801, 2806, 2811, - 2816, 2821, 2826, 2831, 2836, 2841, 2846, 2851, 2856, 2861, - 2866, 2871, 2876, 2881, 2886, 2891, 2896, 2901, 2906, 2911, - 2916, 2921, 2926, 2931, 2936, 2942, 2948, 2953, 2958, 2963, - 2969, 2974, 2979, 2984, 2990, 2995, 3000, 3005, 3011, 3016, - 3021, 3026, 3032, 3038, 3044, 3050, 3055, 3061, 3067, 3073, - 3078, 3083, 3088, 3093, 3098, 3104, 3109, 3114, 3119, 3125, - 3130, 3135, 3140, 3146, 3151, 3156, 3161, 3167, 3172, 3177, - 3182, 3188, 3193, 3198, 3203, 3209, 3214, 3219, 3224, 3230, - 3235, 3240, 3245, 3251, 3256, 3261, 3266, 3272, 3277, 3282, - 3287, 3293, 3298, 3303, 3308, 3314, 3319, 3324, 3329, 3335, - 3340, 3345, 3350, 3356, 3361, 3366, 3371, 3377, 3382, 3387, - 3392, 3398, 3403, 3408, 3413, 3418, 3423, 3428, 3433, 3438, - 3443, 3448, 3453, 3458, 3463, 3468, 3473, 3478, 3483, 3488, - 3493, 3498, 3503, 3508, 3513, 3518, 3524, 3530, 3536, 3542, - 3548, 3554, 3560, 3567, 3574, 3580, 3586, 3592, 3598, 3605, - 3612, 3619, 3626, 3631, 3636, 3640, 3646, 3652, 3656, 3660, - 3665, 3681, 3686, 3691, 3699, 3699, 3716, 3716, 3726, 3729, - 3742, 3764, 3791, 3795, 3801, 3806, 3817, 3820, 3826, 3832, - 3841, 3844, 3850, 3854, 3855, 3861, 3862, 3863, 3864, 3865, - 3866, 3867, 3868, 3872, 3880, 3881, 3885, 3881, 3899, 3900, - 3904, 3904, 3911, 3911, 3925, 3928, 3938, 3946, 3957, 3958, - 3962, 3965, 3972, 3979, 3983, 3991, 3995, 4008, 4011, 4018, - 4018, 4038, 4041, 4047, 4059, 4071, 4074, 4082, 4082, 4097, - 4097, 4115, 4115, 4136, 4139, 4145, 4148, 4154, 4158, 4165, - 4170, 4175, 4182, 4185, 4189, 4193, 4197, 4206, 4210, 4219, - 4222, 4225, 4233, 4233, 4275, 4280, 4283, 4288, 4291, 4296, - 4299, 4304, 4307, 4312, 4315, 4320, 4323, 4328, 4332, 4337, - 4341, 4346, 4350, 4357, 4360, 4365, 4368, 4371, 4374, 4377, - 4382, 4391, 4402, 4407, 4415, 4419, 4424, 4428, 4433, 4437, - 4442, 4446, 4453, 4456, 4461, 4464, 4467, 4470, 4475, 4478, - 4483, 4489, 4492, 4495, 4498, 4503, 4507, 4512, 4516, 4521, - 4525, 4532, 4535, 4540, 4543, 4548, 4551, 4557, 4560, 4565, - 4568 + 0, 365, 365, 371, 374, 379, 382, 385, 389, 392, + 395, 399, 403, 407, 411, 415, 419, 425, 432, 435, + 438, 441, 444, 449, 457, 464, 471, 477, 481, 488, + 491, 497, 515, 540, 548, 553, 580, 588, 594, 598, + 602, 622, 623, 624, 625, 631, 632, 637, 642, 651, + 652, 657, 665, 666, 672, 681, 682, 687, 692, 697, + 705, 706, 715, 727, 728, 737, 738, 747, 748, 757, + 758, 766, 767, 775, 776, 784, 785, 785, 803, 804, + 820, 824, 828, 832, 837, 841, 845, 849, 853, 857, + 861, 868, 871, 882, 889, 894, 901, 906, 911, 918, + 921, 924, 927, 932, 940, 940, 952, 956, 963, 968, + 976, 984, 996, 999, 1006, 1019, 1039, 1046, 1069, 1084, + 1103, 1114, 1125, 1135, 1145, 1155, 1164, 1167, 1172, 1177, + 1182, 1190, 1195, 1201, 1206, 1211, 1220, 1230, 1257, 1266, + 1273, 1280, 1287, 1294, 1302, 1310, 1320, 1330, 1337, 1347, + 1353, 1356, 1363, 1367, 1371, 1379, 1388, 1391, 1402, 1405, + 1408, 1412, 1416, 1420, 1424, 1427, 1432, 1436, 1441, 1449, + 1453, 1458, 1464, 1470, 1477, 1482, 1487, 1495, 1500, 1512, + 1526, 1532, 1537, 1542, 1547, 1555, 1563, 1571, 1579, 1587, + 1595, 1603, 1611, 1619, 1627, 1634, 1641, 1645, 1650, 1655, + 1660, 1665, 1670, 1675, 1679, 1683, 1687, 1691, 1695, 1701, + 1707, 1717, 1724, 1727, 1735, 1742, 1753, 1758, 1766, 1770, + 1780, 1783, 1789, 1795, 1801, 1809, 1819, 1823, 1827, 1831, + 1836, 1840, 1845, 1850, 1855, 1860, 1865, 1870, 1875, 1880, + 1885, 1891, 1897, 1903, 1908, 1913, 1918, 1923, 1928, 1933, + 1938, 1943, 1948, 1953, 1958, 1963, 1970, 1975, 1980, 1985, + 1990, 1995, 2000, 2005, 2010, 2015, 2020, 2025, 2030, 2035, + 2040, 2048, 2056, 2064, 2070, 2076, 2082, 2088, 2094, 2100, + 2106, 2112, 2118, 2124, 2130, 2136, 2142, 2148, 2154, 2160, + 2166, 2172, 2178, 2184, 2190, 2196, 2202, 2208, 2214, 2220, + 2226, 2232, 2238, 2244, 2250, 2256, 2262, 2268, 2274, 2280, + 2286, 2292, 2298, 2304, 2310, 2316, 2324, 2332, 2340, 2348, + 2356, 2364, 2372, 2380, 2388, 2396, 2404, 2412, 2418, 2424, + 2430, 2436, 2442, 2448, 2454, 2460, 2466, 2472, 2478, 2484, + 2490, 2496, 2502, 2508, 2514, 2520, 2526, 2532, 2538, 2544, + 2550, 2556, 2562, 2568, 2574, 2580, 2586, 2592, 2598, 2604, + 2610, 2616, 2622, 2628, 2632, 2636, 2640, 2645, 2650, 2655, + 2660, 2665, 2670, 2675, 2680, 2685, 2690, 2695, 2700, 2705, + 2710, 2716, 2722, 2728, 2734, 2740, 2746, 2752, 2758, 2764, + 2770, 2776, 2782, 2788, 2793, 2798, 2803, 2808, 2813, 2818, + 2823, 2828, 2833, 2838, 2843, 2848, 2853, 2858, 2863, 2868, + 2873, 2878, 2883, 2888, 2893, 2898, 2903, 2908, 2913, 2918, + 2923, 2928, 2933, 2938, 2943, 2948, 2953, 2959, 2965, 2970, + 2975, 2980, 2986, 2991, 2996, 3001, 3007, 3012, 3017, 3022, + 3028, 3033, 3038, 3043, 3049, 3055, 3061, 3067, 3072, 3078, + 3084, 3090, 3095, 3100, 3105, 3110, 3115, 3121, 3126, 3131, + 3136, 3142, 3147, 3152, 3157, 3163, 3168, 3173, 3178, 3184, + 3189, 3194, 3199, 3205, 3210, 3215, 3220, 3226, 3231, 3236, + 3241, 3247, 3252, 3257, 3262, 3268, 3273, 3278, 3283, 3289, + 3294, 3299, 3304, 3310, 3315, 3320, 3325, 3331, 3336, 3341, + 3346, 3352, 3357, 3362, 3367, 3373, 3378, 3383, 3388, 3394, + 3399, 3404, 3409, 3415, 3420, 3425, 3430, 3435, 3440, 3445, + 3450, 3455, 3460, 3465, 3470, 3475, 3480, 3485, 3490, 3495, + 3500, 3505, 3510, 3515, 3520, 3525, 3530, 3535, 3541, 3547, + 3553, 3559, 3565, 3571, 3577, 3584, 3591, 3597, 3603, 3609, + 3615, 3622, 3629, 3636, 3643, 3648, 3653, 3657, 3663, 3669, + 3675, 3679, 3683, 3687, 3692, 3708, 3713, 3718, 3726, 3726, + 3742, 3742, 3752, 3755, 3758, 3768, 3781, 3798, 3798, 3813, + 3816, 3829, 3851, 3878, 3882, 3888, 3893, 3904, 3907, 3913, + 3919, 3928, 3931, 3937, 3941, 3942, 3948, 3949, 3950, 3951, + 3952, 3953, 3954, 3955, 3959, 3967, 3968, 3972, 3968, 3986, + 3987, 3991, 3991, 3998, 3998, 4012, 4015, 4025, 4033, 4044, + 4045, 4049, 4052, 4059, 4066, 4070, 4078, 4082, 4091, 4094, + 4101, 4101, 4121, 4124, 4130, 4142, 4154, 4157, 4165, 4165, + 4184, 4184, 4206, 4206, 4227, 4230, 4236, 4239, 4245, 4249, + 4256, 4261, 4266, 4273, 4276, 4280, 4284, 4288, 4297, 4301, + 4310, 4313, 4316, 4324, 4324, 4366, 4371, 4374, 4379, 4382, + 4387, 4390, 4395, 4398, 4403, 4406, 4411, 4414, 4419, 4423, + 4428, 4432, 4437, 4441, 4448, 4451, 4456, 4459, 4462, 4465, + 4468, 4473, 4482, 4493, 4498, 4506, 4510, 4515, 4519, 4524, + 4528, 4533, 4537, 4544, 4547, 4552, 4555, 4558, 4561, 4566, + 4569, 4574, 4580, 4583, 4586, 4589, 4594, 4598, 4603, 4607, + 4612, 4616, 4623, 4626, 4631, 4634, 4639, 4642, 4648, 4651, + 4656, 4659 }; #endif @@ -1300,17 +1311,17 @@ static const char *const yytname[] = "F64MAT2X3", "F64MAT2X4", "F64MAT3X2", "F64MAT3X3", "F64MAT3X4", "F64MAT4X2", "F64MAT4X3", "F64MAT4X4", "ATOMIC_UINT", "ACCSTRUCTNV", "ACCSTRUCTEXT", "RAYQUERYEXT", "FCOOPMATNV", "ICOOPMATNV", "UCOOPMATNV", - "COOPMAT", "COOPVECNV", "HITOBJECTNV", "HITOBJECTATTRNV", - "TENSORLAYOUTNV", "TENSORVIEWNV", "TENSORARM", "SAMPLERCUBEARRAY", - "SAMPLERCUBEARRAYSHADOW", "ISAMPLERCUBEARRAY", "USAMPLERCUBEARRAY", - "SAMPLER1D", "SAMPLER1DARRAY", "SAMPLER1DARRAYSHADOW", "ISAMPLER1D", - "SAMPLER1DSHADOW", "SAMPLER2DRECT", "SAMPLER2DRECTSHADOW", - "ISAMPLER2DRECT", "USAMPLER2DRECT", "SAMPLERBUFFER", "ISAMPLERBUFFER", - "USAMPLERBUFFER", "SAMPLER2DMS", "ISAMPLER2DMS", "USAMPLER2DMS", - "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", "USAMPLER2DMSARRAY", - "SAMPLEREXTERNALOES", "SAMPLEREXTERNAL2DY2YEXT", "ISAMPLER1DARRAY", - "USAMPLER1D", "USAMPLER1DARRAY", "F16SAMPLER1D", "F16SAMPLER2D", - "F16SAMPLER3D", "F16SAMPLER2DRECT", "F16SAMPLERCUBE", + "COOPMAT", "COOPVECNV", "VECTOR", "HITOBJECTNV", "HITOBJECTATTRNV", + "HITOBJECTEXT", "HITOBJECTATTREXT", "TENSORLAYOUTNV", "TENSORVIEWNV", + "TENSORARM", "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", + "ISAMPLERCUBEARRAY", "USAMPLERCUBEARRAY", "SAMPLER1D", "SAMPLER1DARRAY", + "SAMPLER1DARRAYSHADOW", "ISAMPLER1D", "SAMPLER1DSHADOW", "SAMPLER2DRECT", + "SAMPLER2DRECTSHADOW", "ISAMPLER2DRECT", "USAMPLER2DRECT", + "SAMPLERBUFFER", "ISAMPLERBUFFER", "USAMPLERBUFFER", "SAMPLER2DMS", + "ISAMPLER2DMS", "USAMPLER2DMS", "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", + "USAMPLER2DMSARRAY", "SAMPLEREXTERNALOES", "SAMPLEREXTERNAL2DY2YEXT", + "ISAMPLER1DARRAY", "USAMPLER1D", "USAMPLER1DARRAY", "F16SAMPLER1D", + "F16SAMPLER2D", "F16SAMPLER3D", "F16SAMPLER2DRECT", "F16SAMPLERCUBE", "F16SAMPLER1DARRAY", "F16SAMPLER2DARRAY", "F16SAMPLERCUBEARRAY", "F16SAMPLERBUFFER", "F16SAMPLER2DMS", "F16SAMPLER2DMSARRAY", "F16SAMPLER1DSHADOW", "F16SAMPLER2DSHADOW", "F16SAMPLER1DARRAYSHADOW", @@ -1368,10 +1379,10 @@ static const char *const yytname[] = "DEMOTE", "FUNCTION", "PAYLOADNV", "PAYLOADINNV", "HITATTRNV", "CALLDATANV", "CALLDATAINNV", "PAYLOADEXT", "PAYLOADINEXT", "HITATTREXT", "CALLDATAEXT", "CALLDATAINEXT", "PATCH", "SAMPLE", "NONUNIFORM", - "COHERENT", "VOLATILE", "RESTRICT", "READONLY", "WRITEONLY", - "NONTEMPORAL", "DEVICECOHERENT", "QUEUEFAMILYCOHERENT", - "WORKGROUPCOHERENT", "SUBGROUPCOHERENT", "NONPRIVATE", - "SHADERCALLCOHERENT", "NOPERSPECTIVE", "EXPLICITINTERPAMD", + "RESOURCEHEAP", "SAMPLERHEAP", "COHERENT", "VOLATILE", "RESTRICT", + "READONLY", "WRITEONLY", "NONTEMPORAL", "DEVICECOHERENT", + "QUEUEFAMILYCOHERENT", "WORKGROUPCOHERENT", "SUBGROUPCOHERENT", + "NONPRIVATE", "SHADERCALLCOHERENT", "NOPERSPECTIVE", "EXPLICITINTERPAMD", "PERVERTEXEXT", "PERVERTEXNV", "PERPRIMITIVENV", "PERVIEWNV", "PERTASKNV", "PERPRIMITIVEEXT", "TASKPAYLOADWORKGROUPEXT", "PRECISE", "$accept", "variable_identifier", "primary_expression", @@ -1398,20 +1409,21 @@ static const char *const yytname[] = "type_specifier", "array_specifier", "type_parameter_specifier_opt", "type_parameter_specifier", "type_parameter_specifier_list", "type_specifier_nonarray", "precision_qualifier", "struct_specifier", - "$@3", "$@4", "struct_declaration_list", "struct_declaration", - "struct_declarator_list", "struct_declarator", "initializer", - "initializer_list", "declaration_statement", "statement", - "simple_statement", "demote_statement", "compound_statement", "$@5", - "$@6", "statement_no_new_scope", "statement_scoped", "$@7", "$@8", + "$@3", "$@4", "struct_declaration_list", "struct_declaration_with_heap", + "block_heap_inner_structure", "$@5", "struct_declaration_without_heap", + "struct_declaration", "struct_declarator_list", "struct_declarator", + "initializer", "initializer_list", "declaration_statement", "statement", + "simple_statement", "demote_statement", "compound_statement", "$@6", + "$@7", "statement_no_new_scope", "statement_scoped", "$@8", "$@9", "compound_statement_no_new_scope", "statement_list", "expression_statement", "selection_statement", "selection_statement_nonattributed", "selection_rest_statement", - "condition", "switch_statement", "switch_statement_nonattributed", "$@9", - "switch_statement_list", "case_label", "iteration_statement", - "iteration_statement_nonattributed", "$@10", "$@11", "$@12", + "condition", "switch_statement", "switch_statement_nonattributed", + "$@10", "switch_statement_list", "case_label", "iteration_statement", + "iteration_statement_nonattributed", "$@11", "$@12", "$@13", "for_init_statement", "conditionopt", "for_rest_statement", "jump_statement", "translation_unit", "external_declaration", - "function_definition", "$@13", "attribute", "attribute_list", + "function_definition", "$@14", "attribute", "attribute_list", "single_attribute", "spirv_requirements_list", "spirv_requirements_parameter", "spirv_extension_list", "spirv_capability_list", "spirv_execution_mode_qualifier", @@ -1433,12 +1445,12 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif -#define YYPACT_NINF (-863) +#define YYPACT_NINF (-832) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF (-715) +#define YYTABLE_NINF (-726) #define yytable_value_is_error(Yyn) \ 0 @@ -1447,103 +1459,105 @@ yysymbol_name (yysymbol_kind_t yysymbol) STATE-NUM. */ static const yytype_int16 yypact[] = { - 4815, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -311, -283, -208, -203, -113, -89, - -77, -71, -863, -863, -863, -863, -863, -340, -863, -863, - -863, -863, -863, -348, -863, -863, -863, -863, -863, -323, - -863, -863, -863, -863, -863, -863, -863, -33, -25, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -317, -248, -226, -205, - 8655, -198, -863, -204, -863, -863, -863, -863, 5775, -863, - -863, -863, -863, -190, -863, -863, 975, -863, -863, 8655, - -46, -863, -863, -863, 6255, -184, -219, -217, -140, -136, - -135, -184, -131, -57, 13247, -863, -139, -349, -55, -863, - -327, -863, -22, -19, 6735, -863, -863, -863, 8655, -49, - -48, -863, -318, -863, -246, -863, -863, 11876, -18, -863, - -863, -863, -12, -45, 8655, -863, -20, -17, -14, -863, - -281, -863, -238, -13, -9, -8, -7, -235, -6, -5, - -4, -3, -2, 3, -234, 6, 4, 8, -282, -863, - -1, 8655, -863, 7, -863, -231, -863, -863, -216, 10048, - -863, -286, 1455, -863, -863, -11, -863, -863, -863, -259, - -258, -863, 10505, -250, -863, -24, -863, -104, 11876, 11876, - -863, 11876, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -314, -863, -863, -863, 13, -214, 12333, 15, -863, - 11876, -863, 17, -334, 11, -19, 20, -863, -330, -184, - -863, -10, -863, -338, 19, -124, 11876, -116, -863, -143, - -112, -153, -106, 23, -83, -184, -863, 12790, -863, -82, - 11876, 21, -57, -863, 8655, 9, 7215, -863, 8655, 11876, - -863, -349, -863, 10, -863, -863, -54, -272, -224, -319, - -15, 14, 22, 18, 37, 39, -322, 25, -863, 10962, - -863, 24, -863, -863, 30, 31, 32, -863, 34, 35, - 40, 11419, 44, 11876, 41, 42, 43, 51, 56, -260, - -863, -863, -103, -863, -248, 68, 17, -863, -863, -863, - -863, -863, 1935, -863, -863, -863, -863, -863, -863, -863, - -863, -863, 5295, 26, 10505, 11, 10505, -249, 9134, -863, - -863, 10505, 8655, -863, 36, -863, -863, -863, -202, -863, - -863, 11876, 38, -863, -863, 11876, 70, -863, -863, -863, - 11876, -863, -863, -863, -331, -863, -863, -194, 16, -863, - -863, -863, -863, -863, -863, -172, -863, -171, -863, -863, - -170, 69, -863, -863, -863, -863, -168, -863, -161, -863, - -863, -863, -863, -863, -160, -863, 71, -863, -159, 72, - -158, 16, -863, -262, -157, -863, 76, 79, -863, -863, - 9, -18, -52, -863, -863, -863, 7695, -863, -863, -863, - 11876, 11876, 11876, 11876, 11876, 11876, 11876, 11876, 11876, 11876, - 11876, 11876, 11876, 11876, 11876, 11876, 11876, 11876, 11876, -863, - -863, -863, 78, -863, 2415, -863, -863, -863, 2415, -863, - 11876, -863, -863, -51, 11876, -225, -863, -863, -863, -863, - -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, 11876, 11876, -863, -863, -863, -863, -863, -863, - -863, -863, -863, 10505, -863, -863, -119, -863, 8175, -863, - -863, 82, 75, -863, -863, -863, -863, -863, -229, -213, - -863, -325, -863, -338, -863, -338, -863, 11876, 11876, -863, - -143, -863, -143, -863, -153, -153, -863, 89, 23, -863, - 12790, -863, 11876, -863, -863, -50, 11, 9, -863, -863, - -863, -863, -863, -54, -54, -272, -272, -224, -224, -224, - -224, -319, -319, -15, 14, 22, 18, 37, 39, 11876, - -863, 2415, 4335, 45, 3855, -156, -863, -148, -863, -863, - -863, -863, -863, 9591, -863, -863, -863, 91, -863, 58, - -863, -147, -863, -146, -863, -145, -863, -144, -863, -137, - -134, -863, -863, -863, -36, 87, 75, 57, 93, 97, - -863, -863, 4335, 94, -863, -863, -863, -863, -863, -863, - -863, -863, -863, -863, -863, 11876, -863, 92, 2895, 11876, - -863, 90, 101, 59, 102, 3375, -863, 104, -863, 10505, - -863, -863, -863, -129, 11876, 2895, 94, -863, -863, 2415, - -863, 95, 75, -863, -863, 2415, 105, -863, -863 + 4866, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -320, -282, -220, + -210, -141, -139, -102, -92, -832, -832, -832, -832, -832, + -244, -832, -832, -832, -832, -832, -54, -832, -832, -832, + -832, -832, -339, -832, -832, -832, -832, -832, -832, -832, + -90, -88, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -352, -250, -197, -195, 8746, -130, -832, -211, -832, + -832, -832, -832, 5836, -832, -832, -832, -832, -168, -832, + -832, 986, -832, -832, 8746, -93, -832, -832, -832, 6321, + -76, -185, -151, -150, -146, -145, -76, -144, -74, 13370, + -832, -34, -375, -50, -832, -302, -832, -22, -15, 6806, + -832, -832, -832, 8746, -48, -47, -832, -247, -832, -14, + -114, -832, -832, 11990, -11, -832, -832, -832, -9, -43, + 8746, -832, -16, -13, -12, -832, -251, -832, -242, -10, + -7, -5, -4, -240, -2, -1, 1, 6, 7, 8, + -225, -3, 10, 11, -215, -832, 12, 8746, -832, 3, + -832, -216, -832, -832, -214, 10150, -832, -296, 1471, -832, + -832, 14, -832, -832, -832, -290, -279, -832, 10610, -276, + -832, -39, -832, 11990, 11990, -832, 11990, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -299, -832, -832, -832, + 15, -212, 12450, 21, -832, 11990, -832, 23, -336, 22, + -15, 25, -832, -323, -76, -832, -29, -832, -340, 24, + -136, 11990, -134, -832, -159, -129, -178, -110, 28, -109, + -76, -832, 12910, -832, -108, 11990, 26, -74, -832, 7291, + -27, 27, 8746, -27, 8746, -832, 8746, 11990, -832, -375, + -832, -8, -832, -832, -41, -344, -113, -331, -253, 13, + 16, 18, 44, 46, -327, 33, -832, 11070, -832, 34, + -832, -832, 40, 32, 36, -832, 47, 48, 41, 11530, + 52, 11990, 45, 54, 61, 62, 63, -252, -832, -832, + -104, -832, -250, 55, 23, -832, -832, -832, -832, -832, + 1956, -832, -832, -832, -832, -832, -832, -832, -832, -832, + 5351, 38, 10610, 22, 10610, -275, 9230, -832, -832, 10610, + 8746, -832, -832, -832, -201, -832, -832, 11990, 20, -832, + -832, 11990, 75, -832, -832, -832, 11990, -832, -832, -832, + -343, -832, -832, -200, 68, -832, -832, -832, -832, -832, + -832, -199, -832, -198, -832, -832, -196, 73, -832, -832, + -832, -832, -188, -832, -186, -832, -832, -832, -832, -832, + -184, -832, 74, -832, -179, 76, -177, 68, -832, -329, + -175, -832, 81, 83, -832, -832, -832, -27, -11, -56, + -832, -832, 8746, 8746, -55, -832, -832, 85, -832, -832, + -832, 11990, 11990, 11990, 11990, 11990, 11990, 11990, 11990, 11990, + 11990, 11990, 11990, 11990, 11990, 11990, 11990, 11990, 11990, 11990, + -832, -832, -832, 88, -832, 2441, -832, -832, -832, 2441, + -832, 11990, -832, -832, -51, 11990, -77, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -832, 11990, 11990, -832, -832, -832, -832, -832, + -832, -832, -832, -832, 10610, -832, -832, -126, -832, 7776, + -832, 89, 86, -832, -832, -832, -832, -832, -154, -143, + -832, -322, -832, -340, -832, -340, -832, 11990, 11990, -832, + -159, -832, -159, -832, -178, -178, -832, 96, 28, -832, + 12910, -832, 11990, -832, -832, 8746, -46, 22, -27, -832, + -832, -832, -832, -832, -832, -41, -41, -344, -344, -113, + -113, -113, -113, -331, -331, -253, 13, 16, 18, 44, + 46, 11990, -832, 2441, 4381, 53, 3896, -174, -832, -172, + -832, -832, -832, -832, -832, 9690, -832, -832, -832, 97, + -832, 67, -832, -167, -832, -165, -832, -164, -832, -163, + -832, -162, -160, -832, 8261, -832, -832, -42, 98, 86, + 65, 87, 102, -832, -832, 4381, 100, -832, -832, -832, + -832, -832, -832, -832, -832, -832, -832, -832, -832, 11990, + -832, 101, 2926, 11990, -832, 95, 106, 64, 105, 3411, + -832, 107, -832, 10610, -832, -832, -832, -155, 11990, 2926, + 100, -832, -832, 2441, -832, 103, 86, -832, -832, 2441, + 109, -832, -832 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1551,141 +1565,143 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_int16 yydefact[] = { - 0, 170, 228, 226, 227, 225, 232, 233, 234, 235, - 236, 237, 238, 239, 240, 229, 230, 231, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 366, 367, 368, 369, 370, 371, 372, 392, 393, 394, - 395, 396, 397, 398, 407, 420, 421, 408, 409, 411, - 410, 412, 413, 414, 415, 416, 417, 418, 419, 179, - 180, 255, 256, 254, 257, 258, 253, 259, 266, 267, - 264, 265, 262, 263, 260, 261, 298, 299, 300, 310, - 311, 312, 295, 296, 297, 307, 308, 309, 292, 293, - 294, 304, 305, 306, 289, 290, 291, 301, 302, 303, - 268, 269, 270, 313, 314, 315, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 325, 326, - 327, 283, 284, 285, 337, 338, 339, 286, 287, 288, - 349, 350, 351, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 328, 329, 330, 331, 332, 333, 334, 335, - 336, 340, 341, 342, 343, 344, 345, 346, 347, 348, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 364, - 361, 362, 363, 548, 549, 550, 551, 555, 558, 184, - 552, 553, 556, 376, 377, 400, 403, 365, 374, 375, - 391, 373, 422, 423, 426, 427, 428, 430, 431, 432, - 434, 435, 436, 438, 439, 535, 536, 399, 401, 402, - 378, 379, 380, 424, 381, 385, 386, 389, 429, 433, - 437, 382, 383, 387, 388, 425, 384, 390, 469, 471, - 472, 473, 475, 476, 477, 479, 480, 481, 483, 484, - 485, 487, 488, 489, 491, 492, 493, 495, 496, 497, - 499, 500, 501, 503, 504, 505, 507, 508, 509, 511, - 512, 470, 474, 478, 482, 486, 494, 498, 502, 490, - 506, 510, 513, 514, 515, 516, 517, 518, 519, 520, - 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 532, 533, 534, 404, 405, 406, 440, 449, 451, - 445, 450, 452, 453, 455, 456, 457, 459, 460, 461, - 463, 464, 465, 467, 468, 441, 442, 443, 454, 444, - 446, 447, 448, 458, 462, 466, 540, 541, 544, 545, - 546, 547, 542, 543, 0, 0, 0, 0, 0, 0, - 0, 0, 168, 169, 537, 538, 539, 0, 651, 139, - 561, 562, 563, 0, 560, 174, 172, 173, 171, 0, - 224, 175, 177, 178, 176, 141, 140, 0, 206, 554, - 186, 188, 183, 190, 192, 187, 189, 185, 191, 193, - 181, 182, 209, 194, 201, 202, 203, 204, 205, 195, - 196, 197, 198, 199, 200, 142, 143, 145, 144, 146, - 148, 149, 147, 208, 156, 650, 0, 652, 0, 114, - 113, 0, 127, 132, 163, 162, 160, 164, 0, 157, - 159, 165, 137, 219, 161, 559, 0, 647, 649, 0, - 0, 166, 167, 557, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 566, 0, 0, 0, 99, - 0, 94, 0, 109, 0, 123, 115, 125, 0, 126, - 0, 97, 133, 102, 0, 158, 138, 0, 212, 218, - 1, 648, 0, 0, 0, 96, 0, 0, 0, 659, - 0, 717, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 657, 0, 655, - 0, 0, 564, 153, 155, 0, 151, 210, 0, 0, - 100, 0, 0, 653, 110, 0, 116, 122, 124, 119, - 128, 118, 0, 134, 105, 0, 103, 0, 0, 0, - 9, 0, 43, 42, 44, 41, 5, 6, 7, 8, - 2, 16, 14, 15, 17, 10, 11, 12, 13, 3, - 18, 37, 20, 25, 26, 0, 0, 30, 0, 222, - 0, 36, 221, 0, 213, 111, 0, 95, 0, 0, - 715, 0, 667, 0, 0, 0, 0, 0, 684, 0, - 0, 0, 0, 0, 0, 0, 709, 0, 682, 0, - 0, 0, 0, 98, 0, 0, 0, 568, 0, 0, - 150, 0, 207, 0, 214, 45, 49, 52, 55, 60, - 63, 65, 67, 69, 71, 73, 75, 0, 34, 0, - 101, 595, 604, 608, 0, 0, 0, 629, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, - 78, 91, 0, 582, 0, 165, 137, 585, 606, 584, - 592, 583, 0, 586, 587, 610, 588, 617, 589, 590, - 625, 591, 0, 0, 0, 120, 0, 129, 0, 576, - 136, 0, 0, 107, 0, 104, 38, 39, 0, 22, - 23, 0, 0, 28, 27, 0, 224, 31, 33, 40, - 0, 220, 112, 719, 0, 720, 660, 0, 0, 718, - 679, 675, 676, 677, 678, 0, 673, 0, 93, 680, - 0, 0, 694, 695, 696, 697, 0, 692, 0, 701, - 702, 703, 704, 700, 0, 698, 0, 705, 0, 0, - 0, 2, 713, 219, 0, 711, 0, 0, 654, 656, - 0, 574, 0, 572, 567, 569, 0, 154, 152, 211, + 0, 169, 230, 228, 229, 227, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 231, 232, 233, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 368, 369, 370, 371, 372, 373, 374, 394, 395, 396, + 397, 398, 399, 400, 409, 422, 423, 410, 411, 413, + 412, 414, 415, 416, 417, 418, 419, 420, 421, 178, + 179, 257, 258, 256, 259, 260, 255, 261, 268, 269, + 266, 267, 264, 265, 262, 263, 300, 301, 302, 312, + 313, 314, 297, 298, 299, 309, 310, 311, 294, 295, + 296, 306, 307, 308, 291, 292, 293, 303, 304, 305, + 270, 271, 272, 315, 316, 317, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 327, 328, + 329, 285, 286, 287, 339, 340, 341, 288, 289, 290, + 351, 352, 353, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 330, 331, 332, 333, 334, 335, 336, 337, + 338, 342, 343, 344, 345, 346, 347, 348, 349, 350, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 366, + 363, 364, 365, 550, 551, 552, 553, 557, 559, 561, + 185, 562, 186, 554, 555, 558, 378, 379, 402, 405, + 367, 376, 377, 393, 375, 424, 425, 428, 429, 430, + 432, 433, 434, 436, 437, 438, 440, 441, 537, 538, + 401, 403, 404, 380, 381, 382, 426, 383, 387, 388, + 391, 431, 435, 439, 384, 385, 389, 390, 427, 386, + 392, 471, 473, 474, 475, 477, 478, 479, 481, 482, + 483, 485, 486, 487, 489, 490, 491, 493, 494, 495, + 497, 498, 499, 501, 502, 503, 505, 506, 507, 509, + 510, 511, 513, 514, 472, 476, 480, 484, 488, 496, + 500, 504, 492, 508, 512, 515, 516, 517, 518, 519, + 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, + 530, 531, 532, 533, 534, 535, 536, 406, 407, 408, + 442, 451, 453, 447, 452, 454, 455, 457, 458, 459, + 461, 462, 463, 465, 466, 467, 469, 470, 443, 444, + 445, 456, 446, 448, 449, 450, 460, 464, 468, 542, + 543, 546, 547, 548, 549, 544, 545, 0, 0, 0, + 0, 0, 0, 0, 0, 167, 168, 539, 540, 541, + 0, 662, 138, 565, 566, 567, 0, 564, 173, 171, + 172, 170, 0, 226, 174, 176, 177, 175, 140, 139, + 0, 208, 556, 188, 190, 184, 192, 194, 189, 191, + 187, 193, 195, 180, 181, 211, 182, 183, 196, 203, + 204, 205, 206, 207, 197, 198, 199, 200, 201, 202, + 141, 142, 144, 143, 145, 147, 148, 146, 210, 155, + 661, 0, 663, 0, 113, 112, 0, 126, 131, 162, + 161, 159, 163, 0, 156, 158, 164, 136, 221, 160, + 563, 0, 658, 660, 0, 0, 165, 166, 560, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, - 215, 216, 0, 594, 0, 627, 640, 639, 0, 631, - 0, 643, 641, 0, 0, 0, 624, 644, 645, 646, - 593, 81, 82, 84, 83, 86, 87, 88, 89, 90, - 85, 80, 0, 0, 609, 605, 607, 611, 618, 626, - 117, 121, 131, 0, 579, 580, 0, 135, 0, 108, - 4, 0, 24, 21, 32, 223, 663, 665, 0, 0, - 716, 0, 669, 0, 668, 0, 671, 0, 0, 686, - 0, 685, 0, 688, 0, 0, 690, 0, 0, 710, - 0, 707, 0, 683, 658, 0, 575, 0, 570, 565, - 46, 47, 48, 51, 50, 53, 54, 58, 59, 56, - 57, 61, 62, 64, 66, 68, 70, 72, 74, 0, - 217, 596, 0, 0, 0, 0, 642, 0, 623, 79, - 92, 130, 577, 0, 106, 19, 661, 0, 662, 0, - 674, 0, 681, 0, 693, 0, 699, 0, 706, 0, - 0, 712, 571, 573, 0, 0, 615, 0, 0, 0, - 634, 633, 636, 602, 619, 578, 581, 664, 666, 670, - 672, 687, 689, 691, 708, 0, 597, 0, 0, 0, - 635, 0, 0, 614, 0, 0, 612, 0, 77, 0, - 599, 628, 598, 0, 637, 0, 602, 601, 603, 621, - 616, 0, 638, 632, 613, 622, 0, 630, 620 + 570, 0, 0, 0, 99, 0, 94, 0, 108, 0, + 122, 114, 124, 0, 125, 0, 97, 132, 102, 106, + 0, 157, 137, 0, 214, 220, 1, 659, 0, 0, + 0, 96, 0, 0, 0, 670, 0, 728, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 668, 0, 666, 0, 0, 568, 152, + 154, 0, 150, 212, 0, 0, 100, 0, 0, 664, + 109, 0, 115, 121, 123, 118, 127, 117, 0, 133, + 104, 0, 103, 0, 0, 9, 0, 43, 42, 44, + 41, 5, 6, 7, 8, 2, 16, 14, 15, 17, + 10, 11, 12, 13, 3, 18, 37, 20, 25, 26, + 0, 0, 30, 0, 224, 0, 36, 223, 0, 215, + 110, 0, 95, 0, 0, 726, 0, 678, 0, 0, + 0, 0, 0, 695, 0, 0, 0, 0, 0, 0, + 0, 720, 0, 693, 0, 0, 0, 0, 98, 0, + 0, 0, 573, 0, 572, 579, 0, 0, 149, 0, + 209, 0, 216, 45, 49, 52, 55, 60, 63, 65, + 67, 69, 71, 73, 75, 0, 34, 0, 101, 606, + 615, 619, 0, 0, 0, 640, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 45, 78, 91, + 0, 593, 0, 164, 136, 596, 617, 595, 603, 594, + 0, 597, 598, 621, 599, 628, 600, 601, 636, 602, + 0, 0, 0, 119, 0, 128, 0, 587, 135, 0, + 0, 107, 38, 39, 0, 22, 23, 0, 0, 28, + 27, 0, 226, 31, 33, 40, 0, 222, 111, 730, + 0, 731, 671, 0, 0, 729, 690, 686, 687, 688, + 689, 0, 684, 0, 93, 691, 0, 0, 705, 706, + 707, 708, 0, 703, 0, 712, 713, 714, 715, 711, + 0, 709, 0, 716, 0, 0, 0, 2, 724, 221, + 0, 722, 0, 0, 665, 667, 577, 0, 585, 0, + 583, 571, 0, 574, 0, 575, 580, 0, 153, 151, + 213, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 76, 217, 218, 0, 605, 0, 638, 651, 650, 0, + 642, 0, 654, 652, 0, 0, 0, 635, 655, 656, + 657, 604, 81, 82, 84, 83, 86, 87, 88, 89, + 90, 85, 80, 0, 0, 620, 616, 618, 622, 629, + 637, 116, 120, 130, 0, 590, 591, 0, 134, 0, + 4, 0, 24, 21, 32, 225, 674, 676, 0, 0, + 727, 0, 680, 0, 679, 0, 682, 0, 0, 697, + 0, 696, 0, 699, 0, 0, 701, 0, 0, 721, + 0, 718, 0, 694, 669, 0, 0, 586, 0, 581, + 576, 569, 46, 47, 48, 51, 50, 53, 54, 58, + 59, 56, 57, 61, 62, 64, 66, 68, 70, 72, + 74, 0, 219, 607, 0, 0, 0, 0, 653, 0, + 634, 79, 92, 129, 588, 0, 105, 19, 672, 0, + 673, 0, 685, 0, 692, 0, 704, 0, 710, 0, + 717, 0, 0, 723, 0, 582, 584, 0, 0, 626, + 0, 0, 0, 645, 644, 647, 613, 630, 589, 592, + 675, 677, 681, 683, 698, 700, 702, 719, 578, 0, + 608, 0, 0, 0, 646, 0, 0, 625, 0, 0, + 623, 0, 77, 0, 610, 639, 609, 0, 648, 0, + 613, 612, 614, 632, 627, 0, 649, 643, 624, 633, + 0, 641, 631 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -863, -560, -863, -863, -863, -863, -863, -863, -863, -863, - -863, -863, -448, -863, -409, -408, -512, -405, -280, -284, - -278, -277, -285, -276, -863, -501, -863, -516, -863, -514, - -548, 5, -863, -863, -863, 1, -406, -863, -863, 27, - 46, 33, -863, -863, -425, -863, -863, -863, -863, -117, - -863, -407, -389, -863, 12, -863, 0, -442, -863, -863, - -863, -571, 135, -863, -863, -863, -573, -589, -247, -367, - -653, -863, -390, -642, -862, -863, -449, -863, -863, -459, - -458, -863, -863, 47, -750, -382, -863, -155, -863, -419, - -863, -154, -863, -863, -863, -863, -152, -863, -863, -863, - -863, -863, -863, -863, -863, 80, -863, -863, 2, -863, - -88, -244, -403, -863, -863, -863, -326, -328, -324, -863, - -863, -321, -329, -320, -316, -332, -863, -333, -315, -863, - -410, -557 + -832, -567, -832, -832, -832, -832, -832, -832, -832, -832, + -832, -832, -455, -832, -413, -408, -526, -419, -284, -283, + -285, -281, -280, -286, -832, -505, -832, -521, -832, -516, + -558, 4, -832, -832, -832, 5, -418, -832, -832, 31, + 42, 37, -832, -832, -433, -832, -832, -832, -832, -112, + -832, -412, -415, -832, 9, -832, 0, -453, -832, -832, + -832, -577, 139, -832, -832, -832, -107, -101, -832, -832, + -571, -593, -579, -364, -636, -832, -391, -647, -831, -832, + -452, -832, -832, -461, -460, -832, -832, 56, -768, -387, + -832, -156, -832, -424, -832, -153, -832, -832, -832, -832, + -149, -832, -832, -832, -832, -832, -832, -832, -832, 84, + -832, -832, 2, -832, -78, -298, -491, -832, -832, -832, + -325, -321, -324, -832, -832, -326, -319, -330, -318, -328, + -832, -332, -333, -832, -417, -564 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - 0, 549, 550, 551, 821, 552, 553, 554, 555, 556, - 557, 558, 639, 560, 606, 607, 608, 609, 610, 611, - 612, 613, 614, 615, 616, 640, 879, 641, 802, 642, - 732, 643, 406, 672, 527, 644, 408, 409, 410, 455, - 456, 457, 411, 412, 413, 414, 415, 416, 505, 506, - 417, 418, 419, 420, 561, 508, 618, 511, 468, 469, - 563, 423, 424, 425, 598, 501, 596, 597, 742, 743, - 670, 816, 647, 648, 649, 650, 651, 774, 915, 951, - 943, 944, 945, 952, 652, 653, 654, 655, 946, 918, - 656, 657, 947, 966, 658, 659, 660, 882, 778, 884, - 922, 941, 942, 661, 426, 427, 428, 452, 662, 498, - 499, 478, 479, 828, 829, 430, 705, 706, 710, 431, - 432, 716, 717, 724, 725, 728, 433, 734, 735, 434, - 480, 481 + 0, 554, 555, 556, 831, 557, 558, 559, 560, 561, + 562, 563, 647, 565, 614, 615, 616, 617, 618, 619, + 620, 621, 622, 623, 624, 648, 891, 649, 813, 650, + 738, 651, 411, 680, 470, 652, 413, 414, 415, 460, + 461, 462, 416, 417, 418, 419, 420, 421, 511, 512, + 422, 423, 424, 425, 566, 514, 626, 517, 474, 475, + 568, 428, 429, 430, 606, 507, 601, 602, 603, 865, + 604, 605, 749, 750, 678, 827, 655, 656, 657, 658, + 659, 785, 928, 965, 957, 958, 959, 966, 660, 661, + 662, 663, 960, 931, 664, 665, 961, 980, 666, 667, + 668, 894, 789, 896, 935, 955, 956, 669, 431, 432, + 433, 457, 670, 504, 505, 484, 485, 838, 839, 435, + 711, 712, 716, 436, 437, 722, 723, 730, 731, 734, + 438, 740, 741, 439, 486, 487 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -1693,1200 +1709,111 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 422, 407, 429, 458, 473, 405, 669, 745, 617, 473, - 806, 811, 421, 812, 699, 815, 733, 678, 817, 559, - 523, 723, 474, 472, 881, 746, 564, 474, 709, 465, - 699, 494, 700, 443, 757, 758, 768, 679, 680, 826, - 693, 687, 737, 694, 690, 693, 509, 458, 350, 351, - 352, 747, 445, 521, 510, 509, 691, -35, 503, 681, - 435, 605, 522, 682, 449, 701, 702, 703, 704, 465, - 759, 760, 769, 827, 695, 708, 950, 665, 667, 695, - 676, 677, 504, 958, 446, 465, 708, 619, 436, 708, - 450, 570, 591, 950, 594, 620, 592, 571, 708, 818, - 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, - -714, 753, 689, 754, 509, 509, -714, 783, 772, 785, - 801, 664, 666, 619, 619, 755, 756, 467, 605, 524, - 671, 813, 525, 451, 572, 526, 883, 578, 586, 605, - 573, 600, 605, 579, 587, 896, 453, 601, 669, 897, - 669, 605, 669, 803, 888, 669, 602, 745, 684, 697, - 891, 898, 603, 437, 685, 899, 696, 822, 438, 824, - 820, 605, 696, 454, 696, 730, 803, 696, 830, 696, - 460, 696, 696, 461, 571, 482, 696, 485, 483, 594, - 483, 594, 484, 486, 488, 490, 492, 493, 496, 467, - 832, 834, 836, 462, 839, 465, 833, 835, 837, 965, - 840, 841, 843, 846, 849, 851, 923, 842, 844, 847, - 850, 852, 803, 477, 924, 929, 930, 931, 932, 745, - 803, 833, 837, 840, 844, 933, 502, 473, 934, 806, - 926, 847, 825, 961, 852, 867, 868, 869, 870, 803, - 719, 720, 721, 722, 540, 474, 472, 892, 439, 893, - 712, 713, 714, 715, 487, 594, 885, 483, 489, 491, - 887, 483, 483, 495, 674, 803, 483, 675, 804, 733, - 707, 733, 440, 483, 723, 723, 889, 890, 711, 902, - 709, 483, 718, 699, 441, 483, 960, 669, 726, 856, - 442, 483, 860, 861, 862, 605, 605, 605, 605, 605, - 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, - 605, 729, 736, 806, 483, 483, 857, 803, 857, 858, - 886, 912, 750, 751, 752, 475, 708, 708, 447, 594, - 761, 762, 803, 935, 863, 864, 448, 865, 866, 708, - 497, 708, 507, 512, 347, 509, 871, 872, 519, 520, - 565, 567, 566, 568, 569, 914, 663, 574, 916, 575, - 576, 577, 580, 581, 582, 583, 584, 669, 588, 590, - 593, 585, 589, 673, 619, 683, 688, 599, -34, 605, - 605, 521, 694, 727, 766, 738, 831, 698, 767, 770, - 773, 775, 605, 810, 605, 779, 780, 763, 916, 765, - 459, 594, 776, 777, 764, 784, 741, 749, 466, 948, - 786, 781, 421, 787, 788, 953, 422, 407, 429, 422, - 421, 405, 789, 669, 422, 476, 429, 790, 421, -36, - 962, 421, -29, 819, 500, 823, 421, 838, 853, 845, - 848, 854, 880, 803, 459, 514, 895, 917, 459, 908, - 919, 927, 928, 936, 937, 938, 421, 562, 939, -600, - 421, 954, 949, 955, 466, 474, 967, 621, 956, 959, - 874, 968, 877, 873, 748, 517, 421, 875, 444, 876, - 913, 518, 878, 855, 920, 957, 963, 917, 964, 513, - 516, 595, 921, 940, 739, 900, 471, 807, 808, 901, - 809, 904, 646, 421, 903, 474, 909, 910, 0, 0, - 0, 905, 0, 0, 645, 907, 0, 0, 906, 0, - 0, 0, 0, 0, 0, 0, 0, 911, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 692, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 740, 0, 595, 0, 595, 0, - 0, 0, 0, 0, 0, 0, 421, 0, 421, 0, - 421, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 646, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 422, 0, 645, 0, 0, 0, 0, 0, - 0, 0, 595, 0, 421, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 421, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 595, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 421, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 646, 0, 0, 0, 646, 0, - 0, 0, 0, 0, 0, 0, 645, 0, 0, 0, - 645, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 595, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 421, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 646, 646, 0, 646, 0, 429, 0, 0, 0, - 0, 0, 0, 645, 645, 0, 645, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 646, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 645, 0, 0, 0, 646, 0, - 0, 0, 0, 0, 0, 646, 0, 0, 0, 0, - 645, 0, 0, 0, 0, 646, 0, 645, 0, 646, - 0, 0, 0, 0, 0, 646, 0, 645, 0, 0, - 0, 645, 0, 0, 0, 470, 0, 645, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 347, 0, - 0, 0, 0, 0, 0, 0, 348, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 353, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 528, 529, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 530, 531, 0, 347, 0, - 621, 622, 0, 0, 0, 0, 623, 532, 533, 534, - 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 353, 0, 0, 0, 536, 537, - 538, 539, 540, 354, 355, 356, 357, 358, 359, 360, - 624, 625, 626, 627, 0, 628, 629, 630, 631, 632, - 633, 634, 635, 636, 637, 361, 362, 363, 364, 365, - 366, 367, 541, 542, 543, 544, 545, 546, 547, 548, - 368, 638, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 528, 529, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 530, 531, 0, 347, 0, - 621, 805, 0, 0, 0, 0, 623, 532, 533, 534, - 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 353, 0, 0, 0, 536, 537, - 538, 539, 540, 354, 355, 356, 357, 358, 359, 360, - 624, 625, 626, 627, 0, 628, 629, 630, 631, 632, - 633, 634, 635, 636, 637, 361, 362, 363, 364, 365, - 366, 367, 541, 542, 543, 544, 545, 546, 547, 548, - 368, 638, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 528, 529, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 530, 531, 0, 347, 0, - 621, 0, 0, 0, 0, 0, 623, 532, 533, 534, - 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 353, 0, 0, 0, 536, 537, - 538, 539, 540, 354, 355, 356, 357, 358, 359, 360, - 624, 625, 626, 627, 0, 628, 629, 630, 631, 632, - 633, 634, 635, 636, 637, 361, 362, 363, 364, 365, - 366, 367, 541, 542, 543, 544, 545, 546, 547, 548, - 368, 638, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 528, 529, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 530, 531, 0, 347, 0, - 512, 0, 0, 0, 0, 0, 623, 532, 533, 534, - 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 353, 0, 0, 0, 536, 537, - 538, 539, 540, 354, 355, 356, 357, 358, 359, 360, - 624, 625, 626, 627, 0, 628, 629, 630, 631, 632, - 633, 634, 635, 636, 637, 361, 362, 363, 364, 365, - 366, 367, 541, 542, 543, 544, 545, 546, 547, 548, - 368, 638, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 528, 529, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 530, 531, 0, 347, 0, - 0, 0, 0, 0, 0, 0, 623, 532, 533, 534, - 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 353, 0, 0, 0, 536, 537, - 538, 539, 540, 354, 355, 356, 357, 358, 359, 360, - 624, 625, 626, 627, 0, 628, 629, 630, 631, 632, - 633, 634, 635, 636, 637, 361, 362, 363, 364, 365, - 366, 367, 541, 542, 543, 544, 545, 546, 547, 548, - 368, 638, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 528, 529, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 530, 531, 0, 347, 0, - 0, 0, 0, 0, 0, 0, 623, 532, 533, 534, - 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 353, 0, 0, 0, 536, 537, - 538, 539, 540, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 541, 542, 543, 544, 545, 546, 547, 548, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 528, 529, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 530, 531, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 532, 533, 534, - 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 536, 537, - 538, 539, 540, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 541, 542, 543, 544, 545, 546, 547, 548, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 347, 0, - 0, 0, 0, 0, 0, 0, 348, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 353, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 624, 0, 0, 627, 0, 628, 629, 0, 0, 632, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 463, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, - 0, 0, 464, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 347, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 515, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 744, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 859, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 894, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 354, 355, 356, 357, 358, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 361, 362, 363, 364, 365, - 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, - 368, 0, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 0, 0, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 0, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, - 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, - 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 0, 0, 0, 0, 0, 0, 340, 0, 0, 0, - 344, 345, 346, 0, 0, 528, 529, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 530, 531, 0, 0, 0, 668, - 814, 0, 0, 0, 0, 0, 532, 533, 534, 535, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 536, 537, 538, - 539, 540, 354, 0, 0, 0, 0, 359, 360, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 541, 542, 543, 544, 545, 546, 547, 548, 0, - 0, 369, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 382, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 0, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 330, 331, 332, 333, 0, 0, 0, - 0, 0, 0, 340, 0, 0, 0, 344, 345, 346, - 0, 0, 528, 529, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 530, 531, 0, 0, 0, 668, 925, 0, 0, - 0, 0, 0, 532, 533, 534, 535, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 536, 537, 538, 539, 540, 354, - 0, 0, 0, 0, 359, 360, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 541, 542, - 543, 544, 545, 546, 547, 548, 0, 0, 369, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 382, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 0, - 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 0, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 0, 0, 0, 0, 0, - 340, 0, 0, 0, 344, 345, 346, 0, 0, 528, - 529, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 530, 531, - 0, 0, 604, 0, 0, 0, 0, 0, 0, 0, - 532, 533, 534, 535, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 536, 537, 538, 539, 540, 354, 0, 0, 0, - 0, 359, 360, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 541, 542, 543, 544, 545, - 546, 547, 548, 0, 0, 369, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 382, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 0, 0, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 0, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 0, 0, 0, 0, 0, 0, 340, 0, 0, - 0, 344, 345, 346, 0, 0, 528, 529, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 530, 531, 0, 0, 0, - 668, 0, 0, 0, 0, 0, 0, 532, 533, 534, - 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 536, 537, - 538, 539, 540, 354, 0, 0, 0, 0, 359, 360, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 541, 542, 543, 544, 545, 546, 547, 548, - 0, 0, 369, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 382, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 0, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, - 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 0, 0, - 0, 0, 0, 0, 340, 0, 0, 0, 344, 345, - 346, 0, 0, 528, 529, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 530, 531, 0, 0, 771, 0, 0, 0, - 0, 0, 0, 0, 532, 533, 534, 535, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 536, 537, 538, 539, 540, - 354, 0, 0, 0, 0, 359, 360, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 541, - 542, 543, 544, 545, 546, 547, 548, 0, 0, 369, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 382, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 0, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 0, 0, 0, 0, 0, - 0, 340, 0, 0, 0, 344, 345, 346, 0, 0, - 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 530, - 531, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 782, 532, 533, 534, 535, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 536, 537, 538, 539, 540, 354, 0, 0, - 0, 0, 359, 360, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, - 545, 546, 547, 548, 0, 0, 369, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 382, + 427, 479, 434, 463, 410, 412, 479, 677, 471, 426, + 625, 756, 705, 817, 529, 739, 478, 893, 564, 729, + 684, 569, 480, 715, 754, 768, 769, 480, 705, 500, + 836, 753, 454, 706, 779, 509, 822, 743, 823, 450, + 826, 693, 764, 828, 765, 696, -725, 463, 471, 758, + 699, 699, -725, 700, 440, 685, 686, 697, 455, 510, + 613, 770, 771, 473, 837, 471, 707, 708, 709, 710, + 780, 451, 673, 675, 515, -35, 714, 687, 682, 683, + 627, 688, 516, 702, 701, 701, 515, 714, 628, 702, + 714, 702, 441, 672, 702, 599, 702, 515, 702, 702, + 627, 627, 714, 702, 674, 772, 773, 679, 824, 829, + 695, 802, 803, 804, 805, 806, 807, 808, 809, 810, + 811, 964, 783, 794, 575, 796, 613, 527, 972, 515, + 576, 812, 448, 577, 456, 583, 528, 613, 964, 578, + 613, 584, 895, 490, 492, 494, 496, 498, 499, 502, + 591, 677, 613, 677, 442, 677, 592, 703, 677, 608, + 756, 610, 596, 690, 443, 609, 597, 611, 866, 691, + 834, 832, 613, 736, 830, 840, 842, 844, 458, 846, + 814, 576, 843, 845, 471, 847, 459, 849, 903, 851, + 752, 853, 599, 850, 599, 852, 856, 854, 859, 467, + 861, 936, 857, 937, 860, 979, 862, 814, 942, 814, + 943, 944, 945, 946, 843, 947, 847, 850, 854, 857, + 975, 862, 488, 908, 473, 489, 814, 909, 725, 726, + 727, 728, 545, 444, 910, 445, 756, 479, 911, 766, + 767, 835, 879, 880, 881, 882, 817, 718, 719, 720, + 721, 465, 478, 904, 466, 905, 491, 493, 480, 489, + 489, 495, 497, 501, 489, 489, 489, 531, 752, 939, + 532, 713, 446, 717, 489, 897, 489, 814, 724, 899, + 815, 489, 447, 739, 452, 739, 453, 729, 729, 914, + 715, 481, 901, 902, 924, 867, 705, 732, 735, 742, + 489, 489, 489, 677, 814, 900, 872, 873, 874, 613, + 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, + 613, 613, 613, 613, 613, 868, 868, 974, 869, 870, + 814, 756, 817, 898, 483, 868, 503, 471, 925, 814, + 949, 752, 714, 714, 508, 353, 354, 355, 761, 762, + 763, 875, 876, 883, 884, 714, 518, 714, 877, 878, + 513, 350, 525, 526, 530, 515, 570, 571, 572, 574, + 573, 681, 593, 579, 580, 927, 581, 582, 929, 585, + 586, 704, 587, 748, 677, 595, 607, 588, 589, 590, + 689, 594, 613, 613, 671, 694, 598, -34, 627, 527, + 700, 733, 760, 744, 777, 613, 751, 613, 778, 774, + 781, 775, 776, 784, 786, 464, 787, 752, 821, 929, + 788, 790, 791, 472, 426, 792, 795, 797, 962, -36, + 833, 427, 426, 434, 427, 410, 412, 967, 798, 427, + 426, 434, 677, 426, 482, 799, 800, 801, 426, 506, + -29, 841, 976, 752, 848, 855, 863, 858, 864, 464, + 520, 930, 952, 464, 871, 892, 907, 814, 426, 920, + 940, 932, 426, 567, 941, 951, 953, 950, -611, 968, + 472, 969, 480, 629, 963, 973, 970, 981, 982, 426, + 885, 887, 886, 890, 523, 449, 888, 759, 889, 757, + 524, 522, 930, 755, 926, 933, 971, 600, 977, 934, + 978, 954, 752, 519, 818, 477, 426, 819, 654, 745, + 913, 820, 912, 480, 915, 919, 917, 653, 922, 923, + 921, 916, 0, 0, 0, 0, 918, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 698, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 747, + 0, 0, 600, 0, 600, 0, 600, 0, 426, 0, + 0, 426, 0, 426, 0, 426, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 654, 0, 0, 0, 0, 0, 0, 0, 0, 653, + 427, 0, 0, 0, 0, 0, 0, 0, 0, 426, + 600, 0, 0, 0, 0, 0, 0, 0, 0, 426, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 747, 600, 0, 0, 0, 0, 0, 0, + 0, 426, 426, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 654, 0, 0, 0, 654, + 0, 0, 0, 0, 653, 0, 0, 0, 653, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 600, + 0, 0, 0, 0, 0, 0, 0, 0, 426, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 600, 0, 0, 0, 0, + 0, 0, 0, 0, 426, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 654, 654, 0, 654, 0, 434, 0, + 0, 0, 653, 653, 0, 653, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 600, 0, 0, 0, 0, 0, + 0, 0, 0, 426, 0, 654, 0, 0, 0, 0, + 0, 0, 0, 0, 653, 0, 0, 0, 0, 0, + 0, 0, 654, 0, 0, 0, 0, 0, 0, 654, + 0, 653, 0, 0, 0, 0, 0, 0, 653, 654, + 0, 0, 0, 654, 0, 0, 0, 0, 653, 654, + 0, 0, 653, 0, 0, 0, 476, 0, 653, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 0, 0, 61, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, @@ -2898,7 +1825,7 @@ static const yytype_int16 yytable[] = 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 0, 180, 181, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, @@ -2914,65 +1841,798 @@ static const yytype_int16 yytable[] = 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 0, 0, 0, 0, 0, 340, 0, - 0, 0, 344, 345, 346, 0, 0, 528, 529, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 530, 531, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 532, 533, - 534, 535, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 536, - 537, 538, 539, 540, 354, 0, 0, 0, 0, 359, - 360, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 541, 542, 543, 544, 545, 546, 547, - 548, 0, 0, 369, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 382, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 0, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 0, - 0, 0, 0, 0, 0, 340, 0, 0, 0, 344, - 345, 346, 0, 0, 528, 529, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 530, 531, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 532, 533, 534, 535, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 536, 537, 538, 539, - 540, 354, 0, 0, 0, 0, 359, 686, 0, 0, + 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 541, 542, 543, 544, 545, 546, 547, 548, 0, 0, - 369, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 382, 2, 3, 4, 5, 6, 7, + 0, 0, 350, 0, 0, 0, 0, 0, 0, 0, + 351, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 356, 0, + 0, 0, 0, 0, 0, 0, 0, 357, 358, 359, + 360, 361, 362, 363, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, + 365, 366, 367, 368, 369, 370, 0, 0, 0, 0, + 0, 0, 0, 0, 371, 0, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 0, 0, 533, 534, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 535, 536, 0, 350, 0, 629, + 630, 0, 0, 0, 0, 631, 537, 538, 539, 540, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 353, 354, 355, 356, 0, 0, 0, 541, 542, 543, + 544, 545, 357, 358, 359, 360, 361, 362, 363, 632, + 633, 634, 635, 0, 636, 637, 638, 639, 640, 641, + 642, 643, 644, 645, 364, 365, 366, 367, 368, 369, + 370, 546, 547, 548, 549, 550, 551, 552, 553, 371, + 646, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, + 533, 534, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 535, + 536, 0, 350, 0, 629, 816, 0, 0, 0, 0, + 631, 537, 538, 539, 540, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 356, 0, + 0, 0, 541, 542, 543, 544, 545, 357, 358, 359, + 360, 361, 362, 363, 632, 633, 634, 635, 0, 636, + 637, 638, 639, 640, 641, 642, 643, 644, 645, 364, + 365, 366, 367, 368, 369, 370, 546, 547, 548, 549, + 550, 551, 552, 553, 371, 646, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 0, 0, 533, 534, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 535, 536, 0, 350, 0, 629, + 0, 0, 0, 0, 0, 631, 537, 538, 539, 540, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 353, 354, 355, 356, 0, 0, 0, 541, 542, 543, + 544, 545, 357, 358, 359, 360, 361, 362, 363, 632, + 633, 634, 635, 0, 636, 637, 638, 639, 640, 641, + 642, 643, 644, 645, 364, 365, 366, 367, 368, 369, + 370, 546, 547, 548, 549, 550, 551, 552, 553, 371, + 646, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, + 533, 534, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 535, + 536, 0, 350, 0, 518, 0, 0, 0, 0, 0, + 631, 537, 538, 539, 540, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 356, 0, + 0, 0, 541, 542, 543, 544, 545, 357, 358, 359, + 360, 361, 362, 363, 632, 633, 634, 635, 0, 636, + 637, 638, 639, 640, 641, 642, 643, 644, 645, 364, + 365, 366, 367, 368, 369, 370, 546, 547, 548, 549, + 550, 551, 552, 553, 371, 646, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 0, 0, 533, 534, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 535, 536, 0, 350, 0, 0, + 0, 0, 0, 0, 0, 631, 537, 538, 539, 540, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 353, 354, 355, 356, 0, 0, 0, 541, 542, 543, + 544, 545, 357, 358, 359, 360, 361, 362, 363, 632, + 633, 634, 635, 0, 636, 637, 638, 639, 640, 641, + 642, 643, 644, 645, 364, 365, 366, 367, 368, 369, + 370, 546, 547, 548, 549, 550, 551, 552, 553, 371, + 646, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, + 533, 534, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 535, + 536, 0, 350, 0, 0, 0, 0, 0, 0, 0, + 631, 537, 538, 539, 540, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 356, 0, + 0, 0, 541, 542, 543, 544, 545, 357, 358, 359, + 360, 361, 362, 363, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, + 365, 366, 367, 368, 369, 370, 546, 547, 548, 549, + 550, 551, 552, 553, 371, 0, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 0, 0, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 0, 0, 533, 534, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 535, 536, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 537, 538, 539, 540, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 353, 354, 355, 0, 0, 0, 0, 541, 542, 543, + 544, 545, 357, 358, 359, 360, 361, 362, 363, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 364, 365, 366, 367, 368, 369, + 370, 546, 547, 548, 549, 550, 551, 552, 553, 371, + 0, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 350, 0, 0, 0, 0, 0, 0, 0, + 351, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 356, 0, + 0, 0, 0, 0, 0, 0, 0, 357, 358, 359, + 360, 361, 362, 363, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, + 365, 366, 367, 368, 369, 370, 0, 0, 0, 0, + 0, 0, 0, 0, 371, 0, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 0, 0, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 353, 354, 355, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 357, 358, 359, 360, 361, 362, 363, 632, + 0, 0, 635, 0, 636, 637, 0, 0, 640, 0, + 0, 0, 0, 0, 364, 365, 366, 367, 368, 369, + 370, 0, 0, 0, 0, 0, 0, 0, 0, 371, + 0, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 0, 0, 0, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 468, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 0, 0, + 0, 0, 0, 0, 0, 0, 469, 357, 358, 359, + 360, 361, 362, 363, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, + 365, 366, 367, 368, 369, 370, 0, 0, 0, 0, + 0, 0, 0, 0, 371, 0, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 0, 0, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 350, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 353, 354, 355, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 357, 358, 359, 360, 361, 362, 363, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 364, 365, 366, 367, 368, 369, + 370, 0, 0, 0, 0, 0, 0, 0, 0, 371, + 0, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 0, 0, 0, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 521, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 357, 358, 359, + 360, 361, 362, 363, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, + 365, 366, 367, 368, 369, 370, 0, 0, 0, 0, + 0, 0, 0, 0, 371, 0, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 0, 0, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 746, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 353, 354, 355, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 357, 358, 359, 360, 361, 362, 363, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 364, 365, 366, 367, 368, 369, + 370, 0, 0, 0, 0, 0, 0, 0, 0, 371, + 0, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 0, 0, 0, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 906, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 357, 358, 359, + 360, 361, 362, 363, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, + 365, 366, 367, 368, 369, 370, 0, 0, 0, 0, + 0, 0, 0, 0, 371, 0, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 0, 0, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 948, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 353, 354, 355, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 357, 358, 359, 360, 361, 362, 363, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 364, 365, 366, 367, 368, 369, + 370, 0, 0, 0, 0, 0, 0, 0, 0, 371, + 0, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 0, 0, 0, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 352, 353, 354, 355, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 357, 358, 359, + 360, 361, 362, 363, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, + 365, 366, 367, 368, 369, 370, 0, 0, 0, 0, + 0, 0, 0, 0, 371, 0, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, @@ -2990,7 +2650,7 @@ static const yytype_int16 yytable[] = 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 0, 180, 181, 182, 183, 184, 185, 186, 187, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, @@ -3005,1171 +2665,26 @@ static const yytype_int16 yytable[] = 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 0, 0, 0, 0, - 0, 0, 340, 0, 0, 0, 344, 345, 346, 0, - 0, 528, 529, 0, 0, 0, 0, 0, 0, 0, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 530, 531, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 532, 533, 534, 535, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 0, 676, 825, + 0, 0, 0, 0, 0, 537, 538, 539, 540, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 536, 537, 538, 539, 731, 354, 0, - 0, 0, 0, 359, 360, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 541, 542, 543, - 544, 545, 546, 547, 548, 0, 0, 369, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 382, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 0, 0, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 0, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 0, 0, 0, 0, 0, 0, 340, - 0, 0, 0, 344, 345, 346, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 545, 357, 0, 0, 0, 0, 362, 363, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 354, 0, 0, 0, 0, - 359, 360, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 369 -}; - -static const yytype_int16 yycheck[] = -{ - 0, 0, 0, 410, 429, 0, 522, 596, 509, 434, - 652, 664, 0, 666, 571, 668, 587, 531, 671, 467, - 462, 581, 429, 429, 774, 598, 468, 434, 576, 418, - 587, 441, 370, 373, 353, 354, 358, 351, 352, 370, - 370, 557, 590, 373, 378, 370, 373, 454, 396, 397, - 398, 599, 375, 371, 381, 373, 390, 371, 407, 373, - 371, 509, 380, 377, 381, 403, 404, 405, 406, 458, - 389, 390, 394, 404, 404, 576, 938, 519, 520, 404, - 528, 529, 431, 945, 407, 474, 587, 373, 371, 590, - 407, 372, 374, 955, 501, 381, 378, 378, 599, 672, - 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, - 372, 383, 560, 385, 373, 373, 378, 631, 619, 633, - 380, 380, 380, 373, 373, 349, 350, 389, 576, 375, - 380, 380, 378, 381, 372, 381, 778, 372, 372, 587, - 378, 372, 590, 378, 378, 374, 372, 378, 664, 378, - 666, 599, 668, 378, 379, 671, 372, 746, 372, 569, - 813, 374, 378, 371, 378, 378, 569, 681, 371, 685, - 372, 619, 575, 378, 577, 585, 378, 580, 372, 582, - 378, 584, 585, 381, 378, 404, 589, 404, 407, 596, - 407, 598, 436, 437, 438, 439, 440, 441, 442, 389, - 372, 372, 372, 407, 372, 594, 378, 378, 378, 959, - 378, 372, 372, 372, 372, 372, 372, 378, 378, 378, - 378, 378, 378, 407, 372, 372, 372, 372, 372, 818, - 378, 378, 378, 378, 378, 372, 375, 662, 372, 881, - 893, 378, 690, 372, 378, 757, 758, 759, 760, 378, - 403, 404, 405, 406, 407, 662, 662, 376, 371, 378, - 403, 404, 405, 406, 404, 672, 780, 407, 404, 404, - 784, 407, 407, 404, 378, 378, 407, 381, 381, 850, - 404, 852, 371, 407, 844, 845, 802, 803, 404, 837, - 838, 407, 404, 850, 371, 407, 949, 813, 404, 741, - 371, 407, 750, 751, 752, 753, 754, 755, 756, 757, - 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, - 768, 404, 404, 965, 407, 407, 378, 378, 378, 381, - 381, 381, 386, 387, 388, 381, 837, 838, 371, 746, - 355, 356, 378, 379, 753, 754, 371, 755, 756, 850, - 407, 852, 407, 375, 373, 373, 761, 762, 407, 407, - 372, 381, 407, 380, 378, 879, 377, 380, 882, 378, - 378, 378, 378, 378, 378, 378, 378, 893, 372, 371, - 381, 378, 378, 407, 373, 372, 371, 380, 371, 837, - 838, 371, 373, 370, 357, 374, 380, 407, 359, 374, - 376, 371, 850, 377, 852, 371, 371, 393, 922, 391, - 410, 818, 381, 381, 392, 371, 407, 407, 418, 935, - 379, 381, 410, 381, 381, 939, 426, 426, 426, 429, - 418, 426, 381, 949, 434, 434, 434, 381, 426, 371, - 954, 429, 372, 407, 444, 407, 434, 378, 372, 378, - 378, 372, 374, 378, 454, 453, 374, 882, 458, 370, - 415, 370, 404, 376, 407, 372, 454, 467, 371, 375, - 458, 381, 380, 372, 474, 882, 381, 375, 419, 375, - 764, 376, 767, 763, 601, 458, 474, 765, 353, 766, - 857, 458, 768, 740, 884, 944, 955, 922, 956, 452, - 454, 501, 884, 922, 592, 833, 426, 662, 662, 835, - 662, 840, 512, 501, 838, 922, 848, 850, -1, -1, - -1, 842, -1, -1, 512, 845, -1, -1, 844, -1, - -1, -1, -1, -1, -1, -1, -1, 852, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 565, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 594, -1, 596, -1, 598, -1, - -1, -1, -1, -1, -1, -1, 594, -1, 596, -1, - 598, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 652, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 662, -1, 652, -1, -1, -1, -1, -1, - -1, -1, 672, -1, 662, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 672, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 746, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 746, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 774, -1, -1, -1, 778, -1, - -1, -1, -1, -1, -1, -1, 774, -1, -1, -1, - 778, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 818, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 818, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 881, 882, -1, 884, -1, 884, -1, -1, -1, - -1, -1, -1, 881, 882, -1, 884, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 922, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 922, -1, -1, -1, 938, -1, - -1, -1, -1, -1, -1, 945, -1, -1, -1, -1, - 938, -1, -1, -1, -1, 955, -1, 945, -1, 959, - -1, -1, -1, -1, -1, 965, -1, 955, -1, -1, - -1, 959, -1, -1, -1, 0, -1, 965, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, -1, - -1, -1, -1, -1, -1, -1, 381, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, 399, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, 351, 352, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 370, 371, -1, 373, -1, - 375, 376, -1, -1, -1, -1, 381, 382, 383, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, 399, -1, -1, -1, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, -1, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, 351, 352, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 370, 371, -1, 373, -1, - 375, 376, -1, -1, -1, -1, 381, 382, 383, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, 399, -1, -1, -1, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, -1, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, 351, 352, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 370, 371, -1, 373, -1, - 375, -1, -1, -1, -1, -1, 381, 382, 383, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, 399, -1, -1, -1, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, -1, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, 351, 352, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 370, 371, -1, 373, -1, - 375, -1, -1, -1, -1, -1, 381, 382, 383, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, 399, -1, -1, -1, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, -1, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, 351, 352, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 370, 371, -1, 373, -1, - -1, -1, -1, -1, -1, -1, 381, 382, 383, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, 399, -1, -1, -1, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, -1, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, 351, 352, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 370, 371, -1, 373, -1, - -1, -1, -1, -1, -1, -1, 381, 382, 383, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, 399, -1, -1, -1, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, 351, 352, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 370, 371, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 382, 383, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, -1, - -1, -1, -1, -1, -1, -1, 381, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, 399, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - 415, -1, -1, 418, -1, 420, 421, -1, -1, 424, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 381, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, - -1, -1, 407, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 377, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 376, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 376, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 376, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 430, 431, 432, 433, 434, - 435, 436, -1, -1, -1, -1, -1, -1, -1, -1, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, -1, -1, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, - 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, - -1, -1, -1, -1, -1, -1, 342, -1, -1, -1, - 346, 347, 348, -1, -1, 351, 352, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 370, 371, -1, -1, -1, 375, - 376, -1, -1, -1, -1, -1, 382, 383, 384, 385, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 403, 404, 405, - 406, 407, 408, -1, -1, -1, -1, 413, 414, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 437, 438, 439, 440, 441, 442, 443, 444, -1, - -1, 447, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 460, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, -1, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, -1, -1, -1, - -1, -1, -1, 342, -1, -1, -1, 346, 347, 348, - -1, -1, 351, 352, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 370, 371, -1, -1, -1, 375, 376, -1, -1, - -1, -1, -1, 382, 383, 384, 385, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 403, 404, 405, 406, 407, 408, - -1, -1, -1, -1, 413, 414, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 437, 438, - 439, 440, 441, 442, 443, 444, -1, -1, 447, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 460, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, -1, - -1, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 334, 335, -1, -1, -1, -1, -1, -1, - 342, -1, -1, -1, 346, 347, 348, -1, -1, 351, - 352, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 370, 371, - -1, -1, 374, -1, -1, -1, -1, -1, -1, -1, - 382, 383, 384, 385, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 403, 404, 405, 406, 407, 408, -1, -1, -1, - -1, 413, 414, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 437, 438, 439, 440, 441, - 442, 443, 444, -1, -1, 447, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 460, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, -1, -1, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, -1, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, -1, -1, -1, -1, -1, -1, 342, -1, -1, - -1, 346, 347, 348, -1, -1, 351, 352, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 370, 371, -1, -1, -1, - 375, -1, -1, -1, -1, -1, -1, 382, 383, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 403, 404, - 405, 406, 407, 408, -1, -1, -1, -1, 413, 414, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 437, 438, 439, 440, 441, 442, 443, 444, - -1, -1, 447, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 460, 4, 5, 6, 7, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, -1, -1, 63, 64, 65, 66, 67, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, @@ -4181,7 +2696,7 @@ static const yytype_int16 yycheck[] = 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, @@ -4196,71 +2711,496 @@ static const yytype_int16 yycheck[] = 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 334, 335, -1, -1, - -1, -1, -1, -1, 342, -1, -1, -1, 346, 347, - 348, -1, -1, 351, 352, -1, -1, -1, -1, -1, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 0, 676, 938, + 0, 0, 0, 0, 0, 537, 538, 539, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 545, 357, 0, 0, 0, 0, 362, 363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 612, 0, 0, + 0, 0, 0, 0, 0, 537, 538, 539, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 545, 357, 0, 0, 0, 0, 362, 363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 0, 676, 0, + 0, 0, 0, 0, 0, 537, 538, 539, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 545, 357, 0, 0, 0, 0, 362, 363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 782, 0, 0, + 0, 0, 0, 0, 0, 537, 538, 539, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 545, 357, 0, 0, 0, 0, 362, 363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 793, 537, 538, 539, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 545, 357, 0, 0, 0, 0, 362, 363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 537, 538, 539, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 545, 357, 0, 0, 0, 0, 362, 363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 537, 538, 539, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 545, 357, 0, 0, 0, 0, 362, 692, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 533, 534, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 535, 536, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 537, 538, 539, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 542, 543, 544, + 737, 357, 0, 0, 0, 0, 362, 363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, + 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 385, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 181, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 343, 0, 0, 0, 347, + 348, 349, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 357, 0, 0, 0, 0, 362, 363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 372 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 434, 0, 415, 0, 0, 439, 528, 423, 0, + 515, 604, 576, 660, 467, 592, 434, 785, 473, 586, + 536, 474, 434, 581, 603, 356, 357, 439, 592, 446, + 373, 602, 384, 373, 361, 410, 672, 595, 674, 378, + 676, 562, 386, 679, 388, 381, 375, 459, 463, 607, + 373, 373, 381, 376, 374, 354, 355, 393, 410, 434, + 515, 392, 393, 392, 407, 480, 406, 407, 408, 409, + 397, 410, 525, 526, 376, 374, 581, 376, 533, 534, + 376, 380, 384, 574, 407, 407, 376, 592, 384, 580, + 595, 582, 374, 383, 585, 507, 587, 376, 589, 590, + 376, 376, 607, 594, 383, 358, 359, 383, 383, 680, + 565, 363, 364, 365, 366, 367, 368, 369, 370, 371, + 372, 952, 627, 639, 375, 641, 581, 374, 959, 376, + 381, 383, 376, 375, 384, 375, 383, 592, 969, 381, + 595, 381, 789, 441, 442, 443, 444, 445, 446, 447, + 375, 672, 607, 674, 374, 676, 381, 574, 679, 375, + 753, 375, 377, 375, 374, 381, 381, 381, 747, 381, + 691, 687, 627, 590, 375, 375, 375, 375, 375, 375, + 381, 381, 381, 381, 599, 381, 381, 375, 824, 375, + 602, 375, 604, 381, 606, 381, 375, 381, 375, 410, + 375, 375, 381, 375, 381, 973, 381, 381, 375, 381, + 375, 375, 375, 375, 381, 375, 381, 381, 381, 381, + 375, 381, 407, 377, 392, 410, 381, 381, 406, 407, + 408, 409, 410, 374, 377, 374, 829, 670, 381, 352, + 353, 696, 768, 769, 770, 771, 893, 406, 407, 408, + 409, 381, 670, 379, 384, 381, 407, 407, 670, 410, + 410, 407, 407, 407, 410, 410, 410, 381, 680, 905, + 384, 407, 374, 407, 410, 791, 410, 381, 407, 795, + 384, 410, 374, 860, 374, 862, 374, 854, 855, 847, + 848, 384, 813, 814, 865, 748, 860, 407, 407, 407, + 410, 410, 410, 824, 381, 382, 761, 762, 763, 764, + 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, + 775, 776, 777, 778, 779, 381, 381, 963, 384, 384, + 381, 924, 979, 384, 410, 381, 410, 752, 384, 381, + 382, 753, 847, 848, 378, 399, 400, 401, 389, 390, + 391, 764, 765, 772, 773, 860, 378, 862, 766, 767, + 410, 376, 410, 410, 378, 376, 375, 410, 384, 381, + 383, 410, 375, 383, 381, 891, 381, 381, 894, 381, + 381, 410, 381, 410, 905, 374, 383, 381, 381, 381, + 375, 381, 847, 848, 380, 374, 384, 374, 376, 374, + 376, 373, 410, 377, 360, 860, 379, 862, 362, 396, + 377, 395, 394, 379, 374, 415, 384, 829, 380, 935, + 384, 374, 374, 423, 415, 384, 374, 382, 949, 374, + 410, 431, 423, 431, 434, 431, 431, 953, 384, 439, + 431, 439, 963, 434, 439, 384, 384, 384, 439, 449, + 375, 383, 968, 865, 381, 381, 375, 381, 375, 459, + 458, 894, 375, 463, 379, 377, 377, 381, 459, 373, + 373, 418, 463, 473, 407, 410, 374, 379, 378, 384, + 480, 375, 894, 378, 383, 378, 422, 384, 379, 480, + 774, 776, 775, 779, 463, 356, 777, 609, 778, 606, + 463, 459, 935, 604, 868, 896, 958, 507, 969, 896, + 970, 935, 924, 457, 670, 431, 507, 670, 518, 597, + 845, 670, 843, 935, 848, 855, 852, 518, 860, 862, + 858, 850, -1, -1, -1, -1, 854, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 370, 371, -1, -1, 374, -1, -1, -1, - -1, -1, -1, -1, 382, 383, 384, 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 403, 404, 405, 406, 407, - 408, -1, -1, -1, -1, 413, 414, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 437, - 438, 439, 440, 441, 442, 443, 444, -1, -1, 447, + -1, -1, 570, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 460, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, -1, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - -1, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 334, 335, -1, -1, -1, -1, -1, - -1, 342, -1, -1, -1, 346, 347, 348, -1, -1, - 351, 352, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 370, - 371, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 381, 382, 383, 384, 385, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 599, + -1, -1, 602, -1, 604, -1, 606, -1, 599, -1, + -1, 602, -1, 604, -1, 606, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 403, 404, 405, 406, 407, 408, -1, -1, - -1, -1, 413, 414, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 437, 438, 439, 440, - 441, 442, 443, 444, -1, -1, 447, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 460, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 660, -1, -1, -1, -1, -1, -1, -1, -1, 660, + 670, -1, -1, -1, -1, -1, -1, -1, -1, 670, + 680, -1, -1, -1, -1, -1, -1, -1, -1, 680, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 752, 753, -1, -1, -1, -1, -1, -1, + -1, 752, 753, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 785, -1, -1, -1, 789, + -1, -1, -1, -1, 785, -1, -1, -1, 789, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 829, + -1, -1, -1, -1, -1, -1, -1, -1, 829, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 865, -1, -1, -1, -1, + -1, -1, -1, -1, 865, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 893, 894, -1, 896, -1, 896, -1, + -1, -1, 893, 894, -1, 896, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 924, -1, -1, -1, -1, -1, + -1, -1, -1, 924, -1, 935, -1, -1, -1, -1, + -1, -1, -1, -1, 935, -1, -1, -1, -1, -1, + -1, -1, 952, -1, -1, -1, -1, -1, -1, 959, + -1, 952, -1, -1, -1, -1, -1, -1, 959, 969, + -1, -1, -1, 973, -1, -1, -1, -1, 969, 979, + -1, -1, 973, -1, -1, -1, 0, -1, 979, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, -1, -1, 63, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, @@ -4272,7 +3212,7 @@ static const yytype_int16 yycheck[] = 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, -1, 182, 183, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, @@ -4288,65 +3228,798 @@ static const yytype_int16 yycheck[] = 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 334, 335, -1, -1, -1, -1, -1, -1, 342, -1, - -1, -1, 346, 347, 348, -1, -1, 351, 352, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 370, 371, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 382, 383, - 384, 385, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 403, - 404, 405, 406, 407, 408, -1, -1, -1, -1, 413, - 414, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 437, 438, 439, 440, 441, 442, 443, - 444, -1, -1, 447, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 460, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 330, 331, 332, 333, 334, 335, -1, - -1, -1, -1, -1, -1, 342, -1, -1, -1, 346, - 347, 348, -1, -1, 351, 352, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 370, 371, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 382, 383, 384, 385, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 403, 404, 405, 406, - 407, 408, -1, -1, -1, -1, 413, 414, -1, -1, + 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 437, 438, 439, 440, 441, 442, 443, 444, -1, -1, - 447, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 460, 4, 5, 6, 7, 8, 9, + -1, -1, 376, -1, -1, -1, -1, -1, -1, -1, + 384, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, 402, -1, + -1, -1, -1, -1, -1, -1, -1, 411, 412, 413, + 414, 415, 416, 417, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, + 434, 435, 436, 437, 438, 439, -1, -1, -1, -1, + -1, -1, -1, -1, 448, -1, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, 374, -1, 376, -1, 378, + 379, -1, -1, -1, -1, 384, 385, 386, 387, 388, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, + 399, 400, 401, 402, -1, -1, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, -1, 423, 424, 425, 426, 427, 428, + 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, + 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, + 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 487, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 373, + 374, -1, 376, -1, 378, 379, -1, -1, -1, -1, + 384, 385, 386, 387, 388, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, 402, -1, + -1, -1, 406, 407, 408, 409, 410, 411, 412, 413, + 414, 415, 416, 417, 418, 419, 420, 421, -1, 423, + 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, + 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, 374, -1, 376, -1, 378, + -1, -1, -1, -1, -1, 384, 385, 386, 387, 388, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, + 399, 400, 401, 402, -1, -1, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, -1, 423, 424, 425, 426, 427, 428, + 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, + 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, + 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 487, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 373, + 374, -1, 376, -1, 378, -1, -1, -1, -1, -1, + 384, 385, 386, 387, 388, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, 402, -1, + -1, -1, 406, 407, 408, 409, 410, 411, 412, 413, + 414, 415, 416, 417, 418, 419, 420, 421, -1, 423, + 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, + 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, 374, -1, 376, -1, -1, + -1, -1, -1, -1, -1, 384, 385, 386, 387, 388, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, + 399, 400, 401, 402, -1, -1, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, -1, 423, 424, 425, 426, 427, 428, + 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, + 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, + 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 487, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 373, + 374, -1, 376, -1, -1, -1, -1, -1, -1, -1, + 384, 385, 386, 387, 388, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, 402, -1, + -1, -1, 406, 407, 408, 409, 410, 411, 412, 413, + 414, 415, 416, 417, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, + 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, + 444, 445, 446, 447, 448, -1, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + -1, -1, -1, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, 374, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 385, 386, 387, 388, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, + 399, 400, 401, -1, -1, -1, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 433, 434, 435, 436, 437, 438, + 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, + -1, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 487, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 376, -1, -1, -1, -1, -1, -1, -1, + 384, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, 402, -1, + -1, -1, -1, -1, -1, -1, -1, 411, 412, 413, + 414, 415, 416, 417, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, + 434, 435, 436, 437, 438, 439, -1, -1, -1, -1, + -1, -1, -1, -1, 448, -1, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + -1, -1, -1, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, + 399, 400, 401, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 411, 412, 413, 414, 415, 416, 417, 418, + -1, -1, 421, -1, 423, 424, -1, -1, 427, -1, + -1, -1, -1, -1, 433, 434, 435, 436, 437, 438, + 439, -1, -1, -1, -1, -1, -1, -1, -1, 448, + -1, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 487, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, -1, -1, -1, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 384, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, -1, -1, + -1, -1, -1, -1, -1, -1, 410, 411, 412, 413, + 414, 415, 416, 417, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, + 434, 435, 436, 437, 438, 439, -1, -1, -1, -1, + -1, -1, -1, -1, 448, -1, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + -1, -1, -1, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 376, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, + 399, 400, 401, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 411, 412, 413, 414, 415, 416, 417, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 433, 434, 435, 436, 437, 438, + 439, -1, -1, -1, -1, -1, -1, -1, -1, 448, + -1, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 487, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, -1, -1, -1, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 380, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 411, 412, 413, + 414, 415, 416, 417, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, + 434, 435, 436, 437, 438, 439, -1, -1, -1, -1, + -1, -1, -1, -1, 448, -1, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + -1, -1, -1, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 378, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, + 399, 400, 401, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 411, 412, 413, 414, 415, 416, 417, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 433, 434, 435, 436, 437, 438, + 439, -1, -1, -1, -1, -1, -1, -1, -1, 448, + -1, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 487, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, -1, -1, -1, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 379, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 411, 412, 413, + 414, 415, 416, 417, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, + 434, 435, 436, 437, 438, 439, -1, -1, -1, -1, + -1, -1, -1, -1, 448, -1, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + -1, -1, -1, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 379, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, + 399, 400, 401, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 411, 412, 413, 414, 415, 416, 417, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 433, 434, 435, 436, 437, 438, + 439, -1, -1, -1, -1, -1, -1, -1, -1, 448, + -1, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 487, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, -1, -1, -1, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 398, 399, 400, 401, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 411, 412, 413, + 414, 415, 416, 417, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, + 434, 435, 436, 437, 438, 439, -1, -1, -1, -1, + -1, -1, -1, -1, 448, -1, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, @@ -4364,7 +4037,7 @@ static const yytype_int16 yycheck[] = 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, 189, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, @@ -4379,64 +4052,433 @@ static const yytype_int16 yycheck[] = 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 334, 335, -1, -1, -1, -1, - -1, -1, 342, -1, -1, -1, 346, 347, 348, -1, - -1, 351, 352, -1, -1, -1, -1, -1, -1, -1, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 370, 371, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 382, 383, 384, 385, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, -1, 378, 379, + -1, -1, -1, -1, -1, 385, 386, 387, 388, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 403, 404, 405, 406, 407, 408, -1, - -1, -1, -1, 413, 414, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 437, 438, 439, - 440, 441, 442, 443, 444, -1, -1, 447, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 460, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, -1, -1, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, -1, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, -1, -1, -1, -1, -1, -1, 342, - -1, -1, -1, 346, 347, 348, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, -1, 378, 379, + -1, -1, -1, -1, -1, 385, 386, 387, 388, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, 377, -1, -1, + -1, -1, -1, -1, -1, 385, 386, 387, 388, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, -1, 378, -1, + -1, -1, -1, -1, -1, 385, 386, 387, 388, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, 377, -1, -1, + -1, -1, -1, -1, -1, 385, 386, 387, 388, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 384, 385, 386, 387, 388, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 385, 386, 387, 388, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 385, 386, 387, 388, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, 374, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 385, 386, 387, 388, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 406, 407, 408, 409, + 410, 411, -1, -1, -1, -1, 416, 417, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 440, 441, 442, 443, 444, 445, 446, 447, -1, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 463, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, -1, 183, -1, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, + -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, + 350, 351, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 408, -1, -1, -1, -1, - 413, 414, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 411, -1, -1, -1, -1, 416, 417, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 447 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 450 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of @@ -4477,147 +4519,150 @@ static const yytype_int16 yystos[] = 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, 346, 347, 348, 373, 381, 395, - 396, 397, 398, 399, 408, 409, 410, 411, 412, 413, - 414, 430, 431, 432, 433, 434, 435, 436, 445, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + 376, 384, 398, 399, 400, 401, 402, 411, 412, 413, + 414, 415, 416, 417, 433, 434, 435, 436, 437, 438, + 439, 448, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, - 478, 479, 480, 481, 482, 514, 515, 518, 519, 520, - 521, 525, 526, 527, 528, 529, 530, 533, 534, 535, - 536, 537, 539, 544, 545, 546, 587, 588, 589, 591, - 598, 602, 603, 609, 612, 371, 371, 371, 371, 371, - 371, 371, 371, 373, 545, 375, 407, 371, 371, 381, - 407, 381, 590, 372, 378, 522, 523, 524, 534, 539, - 378, 381, 407, 381, 407, 535, 539, 389, 541, 542, - 0, 588, 519, 527, 534, 381, 518, 407, 594, 595, - 613, 614, 404, 407, 594, 404, 594, 404, 594, 404, - 594, 404, 594, 594, 613, 404, 594, 407, 592, 593, - 539, 548, 375, 407, 431, 531, 532, 407, 538, 373, - 381, 540, 375, 566, 591, 377, 523, 522, 524, 407, - 407, 371, 380, 540, 375, 378, 381, 517, 351, 352, - 370, 371, 382, 383, 384, 385, 403, 404, 405, 406, - 407, 437, 438, 439, 440, 441, 442, 443, 444, 484, - 485, 486, 488, 489, 490, 491, 492, 493, 494, 495, - 496, 537, 539, 543, 540, 372, 407, 381, 380, 378, - 372, 378, 372, 378, 380, 378, 378, 378, 372, 378, - 378, 378, 378, 378, 378, 378, 372, 378, 372, 378, - 371, 374, 378, 381, 534, 539, 549, 550, 547, 380, - 372, 378, 372, 378, 374, 495, 497, 498, 499, 500, - 501, 502, 503, 504, 505, 506, 507, 508, 539, 373, - 381, 375, 376, 381, 415, 416, 417, 418, 420, 421, - 422, 423, 424, 425, 426, 427, 428, 429, 446, 495, - 508, 510, 512, 514, 518, 537, 539, 555, 556, 557, - 558, 559, 567, 568, 569, 570, 573, 574, 577, 578, - 579, 586, 591, 377, 380, 540, 380, 540, 375, 510, - 553, 380, 516, 407, 378, 381, 495, 495, 512, 351, - 352, 373, 377, 372, 372, 378, 414, 510, 371, 495, - 378, 390, 591, 370, 373, 404, 595, 613, 407, 614, - 370, 403, 404, 405, 406, 599, 600, 404, 508, 513, - 601, 404, 403, 404, 405, 406, 604, 605, 404, 403, - 404, 405, 406, 484, 606, 607, 404, 370, 608, 404, - 613, 407, 513, 544, 610, 611, 404, 513, 374, 593, - 539, 407, 551, 552, 376, 550, 549, 513, 532, 407, - 386, 387, 388, 383, 385, 349, 350, 353, 354, 389, - 390, 355, 356, 393, 392, 391, 357, 359, 358, 394, - 374, 374, 508, 376, 560, 371, 381, 381, 581, 371, - 371, 381, 381, 512, 371, 512, 379, 381, 381, 381, - 381, 360, 361, 362, 363, 364, 365, 366, 367, 368, - 369, 380, 511, 378, 381, 376, 556, 570, 574, 579, - 377, 553, 553, 380, 376, 553, 554, 553, 549, 407, - 372, 487, 512, 407, 510, 495, 370, 404, 596, 597, - 372, 380, 372, 378, 372, 378, 372, 378, 378, 372, - 378, 372, 378, 372, 378, 378, 372, 378, 378, 372, - 378, 372, 378, 372, 372, 551, 540, 378, 381, 376, - 495, 495, 495, 497, 497, 498, 498, 499, 499, 499, - 499, 500, 500, 501, 502, 503, 504, 505, 506, 509, - 374, 567, 580, 556, 582, 512, 381, 512, 379, 510, - 510, 553, 376, 378, 376, 374, 374, 378, 374, 378, - 600, 599, 513, 601, 605, 604, 607, 606, 370, 608, - 610, 611, 381, 552, 512, 561, 512, 527, 572, 415, - 555, 568, 583, 372, 372, 376, 553, 370, 404, 372, - 372, 372, 372, 372, 372, 379, 376, 407, 372, 371, - 572, 584, 585, 563, 564, 565, 571, 575, 510, 380, - 557, 562, 566, 512, 381, 372, 419, 559, 557, 375, - 553, 372, 512, 562, 563, 567, 576, 381, 376 + 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, + 519, 520, 523, 524, 525, 526, 530, 531, 532, 533, + 534, 535, 538, 539, 540, 541, 542, 544, 549, 550, + 551, 596, 597, 598, 600, 607, 611, 612, 618, 621, + 374, 374, 374, 374, 374, 374, 374, 374, 376, 550, + 378, 410, 374, 374, 384, 410, 384, 599, 375, 381, + 527, 528, 529, 539, 544, 381, 384, 410, 384, 410, + 522, 540, 544, 392, 546, 547, 0, 597, 524, 532, + 539, 384, 523, 410, 603, 604, 622, 623, 407, 410, + 603, 407, 603, 407, 603, 407, 603, 407, 603, 603, + 622, 407, 603, 410, 601, 602, 544, 553, 378, 410, + 434, 536, 537, 410, 543, 376, 384, 545, 378, 575, + 600, 380, 528, 527, 529, 410, 410, 374, 383, 545, + 378, 381, 384, 354, 355, 373, 374, 385, 386, 387, + 388, 406, 407, 408, 409, 410, 440, 441, 442, 443, + 444, 445, 446, 447, 489, 490, 491, 493, 494, 495, + 496, 497, 498, 499, 500, 501, 542, 544, 548, 545, + 375, 410, 384, 383, 381, 375, 381, 375, 381, 383, + 381, 381, 381, 375, 381, 381, 381, 381, 381, 381, + 381, 375, 381, 375, 381, 374, 377, 381, 384, 539, + 544, 554, 555, 556, 558, 559, 552, 383, 375, 381, + 375, 381, 377, 500, 502, 503, 504, 505, 506, 507, + 508, 509, 510, 511, 512, 513, 544, 376, 384, 378, + 379, 384, 418, 419, 420, 421, 423, 424, 425, 426, + 427, 428, 429, 430, 431, 432, 449, 500, 513, 515, + 517, 519, 523, 542, 544, 564, 565, 566, 567, 568, + 576, 577, 578, 579, 582, 583, 586, 587, 588, 595, + 600, 380, 383, 545, 383, 545, 378, 515, 562, 383, + 521, 410, 500, 500, 517, 354, 355, 376, 380, 375, + 375, 381, 417, 515, 374, 500, 381, 393, 600, 373, + 376, 407, 604, 622, 410, 623, 373, 406, 407, 408, + 409, 608, 609, 407, 513, 518, 610, 407, 406, 407, + 408, 409, 613, 614, 407, 406, 407, 408, 409, 489, + 615, 616, 407, 373, 617, 407, 622, 410, 518, 549, + 619, 620, 407, 518, 377, 602, 378, 544, 410, 560, + 561, 379, 539, 558, 560, 555, 559, 554, 518, 537, + 410, 389, 390, 391, 386, 388, 352, 353, 356, 357, + 392, 393, 358, 359, 396, 395, 394, 360, 362, 361, + 397, 377, 377, 513, 379, 569, 374, 384, 384, 590, + 374, 374, 384, 384, 517, 374, 517, 382, 384, 384, + 384, 384, 363, 364, 365, 366, 367, 368, 369, 370, + 371, 372, 383, 516, 381, 384, 379, 565, 579, 583, + 588, 380, 562, 562, 383, 379, 562, 563, 562, 558, + 375, 492, 517, 410, 515, 500, 373, 407, 605, 606, + 375, 383, 375, 381, 375, 381, 375, 381, 381, 375, + 381, 375, 381, 375, 381, 381, 375, 381, 381, 375, + 381, 375, 381, 375, 375, 557, 560, 545, 381, 384, + 384, 379, 500, 500, 500, 502, 502, 503, 503, 504, + 504, 504, 504, 505, 505, 506, 507, 508, 509, 510, + 511, 514, 377, 576, 589, 565, 591, 517, 384, 517, + 382, 515, 515, 562, 379, 381, 379, 377, 377, 381, + 377, 381, 609, 608, 518, 610, 614, 613, 616, 615, + 373, 617, 619, 620, 558, 384, 561, 517, 570, 517, + 532, 581, 418, 564, 577, 592, 375, 375, 379, 562, + 373, 407, 375, 375, 375, 375, 375, 375, 379, 382, + 379, 410, 375, 374, 581, 593, 594, 572, 573, 574, + 580, 584, 515, 383, 566, 571, 575, 517, 384, 375, + 422, 568, 566, 378, 562, 375, 517, 571, 572, 576, + 585, 384, 379 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int16 yyr1[] = { - 0, 483, 484, 485, 485, 485, 485, 485, 485, 485, - 485, 485, 485, 485, 485, 485, 485, 485, 486, 486, - 486, 486, 486, 486, 487, 488, 489, 490, 490, 491, - 491, 492, 492, 493, 494, 494, 494, 495, 495, 495, - 495, 496, 496, 496, 496, 497, 497, 497, 497, 498, - 498, 498, 499, 499, 499, 500, 500, 500, 500, 500, - 501, 501, 501, 502, 502, 503, 503, 504, 504, 505, - 505, 506, 506, 507, 507, 508, 509, 508, 510, 510, - 511, 511, 511, 511, 511, 511, 511, 511, 511, 511, - 511, 512, 512, 513, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 516, 515, 517, 517, 518, - 518, 518, 518, 519, 519, 520, 520, 520, 521, 522, - 522, 522, 523, 523, 523, 523, 524, 525, 525, 525, - 525, 525, 526, 526, 526, 526, 526, 527, 527, 528, - 529, 529, 529, 529, 529, 529, 529, 529, 529, 529, - 530, 531, 531, 532, 532, 532, 533, 534, 534, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, - 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, - 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, - 536, 536, 536, 536, 536, 536, 536, 536, 536, 537, - 538, 538, 539, 539, 540, 540, 540, 540, 541, 541, - 542, 543, 543, 543, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 545, 545, 545, 547, 546, 548, 546, 549, 549, - 550, 550, 551, 551, 552, 552, 553, 553, 553, 553, - 554, 554, 555, 556, 556, 557, 557, 557, 557, 557, - 557, 557, 557, 558, 559, 560, 561, 559, 562, 562, - 564, 563, 565, 563, 566, 566, 567, 567, 568, 568, - 569, 569, 570, 571, 571, 572, 572, 573, 573, 575, - 574, 576, 576, 577, 577, 578, 578, 580, 579, 581, - 579, 582, 579, 583, 583, 584, 584, 585, 585, 586, - 586, 586, 586, 586, 586, 586, 586, 587, 587, 588, - 588, 588, 590, 589, 591, 592, 592, 593, 593, 594, - 594, 595, 595, 596, 596, 597, 597, 598, 598, 598, - 598, 598, 598, 599, 599, 600, 600, 600, 600, 600, - 601, 601, 602, 602, 603, 603, 603, 603, 603, 603, - 603, 603, 604, 604, 605, 605, 605, 605, 606, 606, - 607, 607, 607, 607, 607, 608, 608, 609, 609, 609, - 609, 610, 610, 611, 611, 612, 612, 613, 613, 614, - 614 + 0, 488, 489, 490, 490, 490, 490, 490, 490, 490, + 490, 490, 490, 490, 490, 490, 490, 490, 491, 491, + 491, 491, 491, 491, 492, 493, 494, 495, 495, 496, + 496, 497, 497, 498, 499, 499, 499, 500, 500, 500, + 500, 501, 501, 501, 501, 502, 502, 502, 502, 503, + 503, 503, 504, 504, 504, 505, 505, 505, 505, 505, + 506, 506, 506, 507, 507, 508, 508, 509, 509, 510, + 510, 511, 511, 512, 512, 513, 514, 513, 515, 515, + 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, + 516, 517, 517, 518, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 521, 520, 522, 522, 523, 523, + 523, 523, 524, 524, 525, 525, 525, 526, 527, 527, + 527, 528, 528, 528, 528, 529, 530, 530, 530, 530, + 530, 531, 531, 531, 531, 531, 532, 532, 533, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 535, + 536, 536, 537, 537, 537, 538, 539, 539, 540, 540, + 540, 540, 540, 540, 540, 540, 540, 540, 540, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 542, 543, 543, 544, 544, 545, 545, 545, 545, + 546, 546, 547, 548, 548, 548, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, + 549, 549, 549, 549, 549, 550, 550, 550, 552, 551, + 553, 551, 554, 554, 554, 554, 555, 557, 556, 558, + 558, 559, 559, 560, 560, 561, 561, 562, 562, 562, + 562, 563, 563, 564, 565, 565, 566, 566, 566, 566, + 566, 566, 566, 566, 567, 568, 569, 570, 568, 571, + 571, 573, 572, 574, 572, 575, 575, 576, 576, 577, + 577, 578, 578, 579, 580, 580, 581, 581, 582, 582, + 584, 583, 585, 585, 586, 586, 587, 587, 589, 588, + 590, 588, 591, 588, 592, 592, 593, 593, 594, 594, + 595, 595, 595, 595, 595, 595, 595, 595, 596, 596, + 597, 597, 597, 599, 598, 600, 601, 601, 602, 602, + 603, 603, 604, 604, 605, 605, 606, 606, 607, 607, + 607, 607, 607, 607, 608, 608, 609, 609, 609, 609, + 609, 610, 610, 611, 611, 612, 612, 612, 612, 612, + 612, 612, 612, 613, 613, 614, 614, 614, 614, 615, + 615, 616, 616, 616, 616, 616, 617, 617, 618, 618, + 618, 618, 619, 619, 620, 620, 621, 621, 622, 622, + 623, 623 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ @@ -4633,19 +4678,19 @@ static const yytype_int8 yyr2[] = 3, 1, 3, 1, 3, 1, 0, 6, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, 3, 2, 2, 4, 2, - 3, 4, 2, 3, 4, 0, 6, 2, 3, 2, - 3, 3, 4, 1, 1, 2, 3, 5, 3, 2, - 3, 4, 2, 1, 2, 1, 1, 1, 3, 4, - 6, 5, 1, 2, 3, 5, 4, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 4, 1, 3, 1, 3, 1, 1, 1, 2, 1, + 3, 4, 2, 3, 0, 6, 1, 3, 2, 3, + 3, 4, 1, 1, 2, 3, 5, 3, 2, 3, + 4, 2, 1, 2, 1, 1, 1, 3, 4, 6, + 5, 1, 2, 3, 5, 4, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, + 1, 3, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, - 1, 3, 2, 3, 2, 3, 3, 4, 1, 0, - 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, + 1, 1, 1, 3, 2, 3, 2, 3, 3, 4, + 1, 0, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -4679,23 +4724,24 @@ static const yytype_int8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 6, 0, 5, 1, 2, - 3, 4, 1, 3, 1, 2, 1, 3, 4, 2, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 0, 0, 5, 1, 1, - 0, 2, 0, 2, 2, 3, 1, 2, 1, 2, - 1, 2, 5, 3, 1, 1, 4, 1, 2, 0, - 8, 0, 1, 3, 2, 1, 2, 0, 6, 0, - 8, 0, 7, 1, 1, 1, 0, 2, 3, 2, - 2, 2, 3, 2, 2, 2, 2, 1, 2, 1, - 1, 1, 0, 3, 5, 1, 3, 1, 4, 1, - 3, 5, 5, 1, 3, 1, 3, 4, 6, 6, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 6, + 0, 5, 1, 1, 2, 2, 3, 0, 5, 1, + 2, 3, 4, 1, 3, 1, 2, 1, 3, 4, + 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 2, 0, 0, 5, 1, + 1, 0, 2, 0, 2, 2, 3, 1, 2, 1, + 2, 1, 2, 5, 3, 1, 1, 4, 1, 2, + 0, 8, 0, 1, 3, 2, 1, 2, 0, 6, + 0, 8, 0, 7, 1, 1, 1, 0, 2, 3, + 2, 2, 2, 3, 2, 2, 2, 2, 1, 2, + 1, 1, 1, 0, 3, 5, 1, 3, 1, 4, + 1, 3, 5, 5, 1, 3, 1, 3, 4, 6, + 6, 8, 6, 8, 1, 3, 1, 1, 1, 1, + 1, 1, 3, 4, 6, 4, 6, 6, 8, 6, 8, 6, 8, 1, 3, 1, 1, 1, 1, 1, - 1, 3, 4, 6, 4, 6, 6, 8, 6, 8, - 6, 8, 1, 3, 1, 1, 1, 1, 1, 3, - 1, 1, 1, 1, 1, 1, 3, 6, 8, 4, - 6, 1, 3, 1, 1, 4, 6, 1, 3, 3, - 3 + 3, 1, 1, 1, 1, 1, 1, 3, 6, 8, + 4, 6, 1, 3, 1, 1, 4, 6, 1, 3, + 3, 3 }; @@ -5437,260 +5483,260 @@ yyreduce: switch (yyn) { case 2: /* variable_identifier: IDENTIFIER */ -#line 361 "MachineIndependent/glslang.y" +#line 365 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleVariable((yyvsp[0].lex).loc, (yyvsp[0].lex).symbol, (yyvsp[0].lex).string); } -#line 5445 "MachineIndependent/glslang_tab.cpp" +#line 5491 "MachineIndependent/glslang_tab.cpp" break; case 3: /* primary_expression: variable_identifier */ -#line 367 "MachineIndependent/glslang.y" +#line 371 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5453 "MachineIndependent/glslang_tab.cpp" +#line 5499 "MachineIndependent/glslang_tab.cpp" break; case 4: /* primary_expression: LEFT_PAREN expression RIGHT_PAREN */ -#line 370 "MachineIndependent/glslang.y" +#line 374 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } -#line 5463 "MachineIndependent/glslang_tab.cpp" +#line 5509 "MachineIndependent/glslang_tab.cpp" break; case 5: /* primary_expression: FLOATCONSTANT */ -#line 375 "MachineIndependent/glslang.y" +#line 379 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } -#line 5471 "MachineIndependent/glslang_tab.cpp" +#line 5517 "MachineIndependent/glslang_tab.cpp" break; case 6: /* primary_expression: INTCONSTANT */ -#line 378 "MachineIndependent/glslang.y" +#line 382 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 5479 "MachineIndependent/glslang_tab.cpp" +#line 5525 "MachineIndependent/glslang_tab.cpp" break; case 7: /* primary_expression: UINTCONSTANT */ -#line 381 "MachineIndependent/glslang.y" +#line 385 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 5488 "MachineIndependent/glslang_tab.cpp" +#line 5534 "MachineIndependent/glslang_tab.cpp" break; case 8: /* primary_expression: BOOLCONSTANT */ -#line 385 "MachineIndependent/glslang.y" +#line 389 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } -#line 5496 "MachineIndependent/glslang_tab.cpp" +#line 5542 "MachineIndependent/glslang_tab.cpp" break; case 9: /* primary_expression: STRING_LITERAL */ -#line 388 "MachineIndependent/glslang.y" +#line 392 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true); } -#line 5504 "MachineIndependent/glslang_tab.cpp" +#line 5550 "MachineIndependent/glslang_tab.cpp" break; case 10: /* primary_expression: INT32CONSTANT */ -#line 391 "MachineIndependent/glslang.y" +#line 395 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 5513 "MachineIndependent/glslang_tab.cpp" +#line 5559 "MachineIndependent/glslang_tab.cpp" break; case 11: /* primary_expression: UINT32CONSTANT */ -#line 395 "MachineIndependent/glslang.y" +#line 399 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 5522 "MachineIndependent/glslang_tab.cpp" +#line 5568 "MachineIndependent/glslang_tab.cpp" break; case 12: /* primary_expression: INT64CONSTANT */ -#line 399 "MachineIndependent/glslang.y" +#line 403 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i64, (yyvsp[0].lex).loc, true); } -#line 5531 "MachineIndependent/glslang_tab.cpp" +#line 5577 "MachineIndependent/glslang_tab.cpp" break; case 13: /* primary_expression: UINT64CONSTANT */ -#line 403 "MachineIndependent/glslang.y" +#line 407 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u64, (yyvsp[0].lex).loc, true); } -#line 5540 "MachineIndependent/glslang_tab.cpp" +#line 5586 "MachineIndependent/glslang_tab.cpp" break; case 14: /* primary_expression: INT16CONSTANT */ -#line 407 "MachineIndependent/glslang.y" +#line 411 "MachineIndependent/glslang.y" { parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((short)(yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 5549 "MachineIndependent/glslang_tab.cpp" +#line 5595 "MachineIndependent/glslang_tab.cpp" break; case 15: /* primary_expression: UINT16CONSTANT */ -#line 411 "MachineIndependent/glslang.y" +#line 415 "MachineIndependent/glslang.y" { parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit unsigned integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((unsigned short)(yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 5558 "MachineIndependent/glslang_tab.cpp" +#line 5604 "MachineIndependent/glslang_tab.cpp" break; case 16: /* primary_expression: DOUBLECONSTANT */ -#line 415 "MachineIndependent/glslang.y" +#line 419 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double literal"); if (! parseContext.symbolTable.atBuiltInLevel()) parseContext.doubleCheck((yyvsp[0].lex).loc, "double literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtDouble, (yyvsp[0].lex).loc, true); } -#line 5569 "MachineIndependent/glslang_tab.cpp" +#line 5615 "MachineIndependent/glslang_tab.cpp" break; case 17: /* primary_expression: FLOAT16CONSTANT */ -#line 421 "MachineIndependent/glslang.y" +#line 425 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat16, (yyvsp[0].lex).loc, true); } -#line 5578 "MachineIndependent/glslang_tab.cpp" +#line 5624 "MachineIndependent/glslang_tab.cpp" break; case 18: /* postfix_expression: primary_expression */ -#line 428 "MachineIndependent/glslang.y" +#line 432 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5586 "MachineIndependent/glslang_tab.cpp" +#line 5632 "MachineIndependent/glslang_tab.cpp" break; case 19: /* postfix_expression: postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET */ -#line 431 "MachineIndependent/glslang.y" +#line 435 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[-2].lex).loc, (yyvsp[-3].interm.intermTypedNode), (yyvsp[-1].interm.intermTypedNode)); } -#line 5594 "MachineIndependent/glslang_tab.cpp" +#line 5640 "MachineIndependent/glslang_tab.cpp" break; case 20: /* postfix_expression: function_call */ -#line 434 "MachineIndependent/glslang.y" +#line 438 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5602 "MachineIndependent/glslang_tab.cpp" +#line 5648 "MachineIndependent/glslang_tab.cpp" break; case 21: /* postfix_expression: postfix_expression DOT IDENTIFIER */ -#line 437 "MachineIndependent/glslang.y" +#line 441 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode), *(yyvsp[0].lex).string); } -#line 5610 "MachineIndependent/glslang_tab.cpp" +#line 5656 "MachineIndependent/glslang_tab.cpp" break; case 22: /* postfix_expression: postfix_expression INC_OP */ -#line 440 "MachineIndependent/glslang.y" +#line 444 "MachineIndependent/glslang.y" { parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "++", (yyvsp[-1].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "++", EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode)); } -#line 5620 "MachineIndependent/glslang_tab.cpp" +#line 5666 "MachineIndependent/glslang_tab.cpp" break; case 23: /* postfix_expression: postfix_expression DEC_OP */ -#line 445 "MachineIndependent/glslang.y" +#line 449 "MachineIndependent/glslang.y" { parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "--", (yyvsp[-1].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "--", EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode)); } -#line 5630 "MachineIndependent/glslang_tab.cpp" +#line 5676 "MachineIndependent/glslang_tab.cpp" break; case 24: /* integer_expression: expression */ -#line 453 "MachineIndependent/glslang.y" +#line 457 "MachineIndependent/glslang.y" { - parseContext.integerCheck((yyvsp[0].interm.intermTypedNode), "[]"); + parseContext.arrayIndexCheck((yyvsp[0].interm.intermTypedNode), "[]"); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5639 "MachineIndependent/glslang_tab.cpp" +#line 5685 "MachineIndependent/glslang_tab.cpp" break; case 25: /* function_call: function_call_or_method */ -#line 460 "MachineIndependent/glslang.y" +#line 464 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleFunctionCall((yyvsp[0].interm).loc, (yyvsp[0].interm).function, (yyvsp[0].interm).intermNode); delete (yyvsp[0].interm).function; } -#line 5648 "MachineIndependent/glslang_tab.cpp" +#line 5694 "MachineIndependent/glslang_tab.cpp" break; case 26: /* function_call_or_method: function_call_generic */ -#line 467 "MachineIndependent/glslang.y" +#line 471 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); } -#line 5656 "MachineIndependent/glslang_tab.cpp" +#line 5702 "MachineIndependent/glslang_tab.cpp" break; case 27: /* function_call_generic: function_call_header_with_parameters RIGHT_PAREN */ -#line 473 "MachineIndependent/glslang.y" +#line 477 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-1].interm); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 5665 "MachineIndependent/glslang_tab.cpp" +#line 5711 "MachineIndependent/glslang_tab.cpp" break; case 28: /* function_call_generic: function_call_header_no_parameters RIGHT_PAREN */ -#line 477 "MachineIndependent/glslang.y" +#line 481 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-1].interm); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 5674 "MachineIndependent/glslang_tab.cpp" +#line 5720 "MachineIndependent/glslang_tab.cpp" break; case 29: /* function_call_header_no_parameters: function_call_header VOID */ -#line 484 "MachineIndependent/glslang.y" +#line 488 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-1].interm); } -#line 5682 "MachineIndependent/glslang_tab.cpp" +#line 5728 "MachineIndependent/glslang_tab.cpp" break; case 30: /* function_call_header_no_parameters: function_call_header */ -#line 487 "MachineIndependent/glslang.y" +#line 491 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); } -#line 5690 "MachineIndependent/glslang_tab.cpp" +#line 5736 "MachineIndependent/glslang_tab.cpp" break; case 31: /* function_call_header_with_parameters: function_call_header assignment_expression */ -#line 493 "MachineIndependent/glslang.y" +#line 497 "MachineIndependent/glslang.y" { if (parseContext.spvVersion.vulkan > 0 && parseContext.spvVersion.vulkanRelaxed @@ -5709,11 +5755,11 @@ yyreduce: (yyval.interm).intermNode = (yyvsp[0].interm.intermTypedNode); } } -#line 5713 "MachineIndependent/glslang_tab.cpp" +#line 5759 "MachineIndependent/glslang_tab.cpp" break; case 32: /* function_call_header_with_parameters: function_call_header_with_parameters COMMA assignment_expression */ -#line 511 "MachineIndependent/glslang.y" +#line 515 "MachineIndependent/glslang.y" { if (parseContext.spvVersion.vulkan > 0 && parseContext.spvVersion.vulkanRelaxed @@ -5736,29 +5782,29 @@ yyreduce: (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); } } -#line 5740 "MachineIndependent/glslang_tab.cpp" +#line 5786 "MachineIndependent/glslang_tab.cpp" break; case 33: /* function_call_header: function_identifier LEFT_PAREN */ -#line 536 "MachineIndependent/glslang.y" +#line 540 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-1].interm); } -#line 5748 "MachineIndependent/glslang_tab.cpp" +#line 5794 "MachineIndependent/glslang_tab.cpp" break; case 34: /* function_identifier: type_specifier */ -#line 544 "MachineIndependent/glslang.y" +#line 548 "MachineIndependent/glslang.y" { // Constructor (yyval.interm).intermNode = 0; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } -#line 5758 "MachineIndependent/glslang_tab.cpp" +#line 5804 "MachineIndependent/glslang_tab.cpp" break; case 35: /* function_identifier: postfix_expression */ -#line 549 "MachineIndependent/glslang.y" +#line 553 "MachineIndependent/glslang.y" { // // Should be a method or subroutine call, but we haven't recognized the arguments yet. @@ -5768,7 +5814,7 @@ yyreduce: TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode(); if (method) { - (yyval.interm).function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength); + (yyval.interm).function = new TFunction(&method->getMethodName(), method->getType(), EOpArrayLength); (yyval.interm).intermNode = method->getObject(); } else { TIntermSymbol* symbol = (yyvsp[0].interm.intermTypedNode)->getAsSymbolNode(); @@ -5786,50 +5832,50 @@ yyreduce: (yyval.interm).function = new TFunction(empty, TType(EbtVoid), EOpNull); } } -#line 5790 "MachineIndependent/glslang_tab.cpp" +#line 5836 "MachineIndependent/glslang_tab.cpp" break; case 36: /* function_identifier: non_uniform_qualifier */ -#line 576 "MachineIndependent/glslang.y" +#line 580 "MachineIndependent/glslang.y" { // Constructor (yyval.interm).intermNode = 0; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } -#line 5800 "MachineIndependent/glslang_tab.cpp" +#line 5846 "MachineIndependent/glslang_tab.cpp" break; case 37: /* unary_expression: postfix_expression */ -#line 584 "MachineIndependent/glslang.y" +#line 588 "MachineIndependent/glslang.y" { parseContext.variableCheck((yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); if (TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode()) parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); } -#line 5811 "MachineIndependent/glslang_tab.cpp" +#line 5857 "MachineIndependent/glslang_tab.cpp" break; case 38: /* unary_expression: INC_OP unary_expression */ -#line 590 "MachineIndependent/glslang.y" +#line 594 "MachineIndependent/glslang.y" { parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "++", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "++", EOpPreIncrement, (yyvsp[0].interm.intermTypedNode)); } -#line 5820 "MachineIndependent/glslang_tab.cpp" +#line 5866 "MachineIndependent/glslang_tab.cpp" break; case 39: /* unary_expression: DEC_OP unary_expression */ -#line 594 "MachineIndependent/glslang.y" +#line 598 "MachineIndependent/glslang.y" { parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "--", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "--", EOpPreDecrement, (yyvsp[0].interm.intermTypedNode)); } -#line 5829 "MachineIndependent/glslang_tab.cpp" +#line 5875 "MachineIndependent/glslang_tab.cpp" break; case 40: /* unary_expression: unary_operator unary_expression */ -#line 598 "MachineIndependent/glslang.y" +#line 602 "MachineIndependent/glslang.y" { if ((yyvsp[-1].interm).op != EOpNull) { char errorOp[2] = {0, 0}; @@ -5846,179 +5892,179 @@ yyreduce: (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } } -#line 5850 "MachineIndependent/glslang_tab.cpp" +#line 5896 "MachineIndependent/glslang_tab.cpp" break; case 41: /* unary_operator: PLUS */ -#line 618 "MachineIndependent/glslang.y" +#line 622 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNull; } -#line 5856 "MachineIndependent/glslang_tab.cpp" +#line 5902 "MachineIndependent/glslang_tab.cpp" break; case 42: /* unary_operator: DASH */ -#line 619 "MachineIndependent/glslang.y" +#line 623 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNegative; } -#line 5862 "MachineIndependent/glslang_tab.cpp" +#line 5908 "MachineIndependent/glslang_tab.cpp" break; case 43: /* unary_operator: BANG */ -#line 620 "MachineIndependent/glslang.y" +#line 624 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLogicalNot; } -#line 5868 "MachineIndependent/glslang_tab.cpp" +#line 5914 "MachineIndependent/glslang_tab.cpp" break; case 44: /* unary_operator: TILDE */ -#line 621 "MachineIndependent/glslang.y" +#line 625 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpBitwiseNot; parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise not"); } -#line 5875 "MachineIndependent/glslang_tab.cpp" +#line 5921 "MachineIndependent/glslang_tab.cpp" break; case 45: /* multiplicative_expression: unary_expression */ -#line 627 "MachineIndependent/glslang.y" +#line 631 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5881 "MachineIndependent/glslang_tab.cpp" +#line 5927 "MachineIndependent/glslang_tab.cpp" break; case 46: /* multiplicative_expression: multiplicative_expression STAR unary_expression */ -#line 628 "MachineIndependent/glslang.y" +#line 632 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "*", EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5891 "MachineIndependent/glslang_tab.cpp" +#line 5937 "MachineIndependent/glslang_tab.cpp" break; case 47: /* multiplicative_expression: multiplicative_expression SLASH unary_expression */ -#line 633 "MachineIndependent/glslang.y" +#line 637 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "/", EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5901 "MachineIndependent/glslang_tab.cpp" +#line 5947 "MachineIndependent/glslang_tab.cpp" break; case 48: /* multiplicative_expression: multiplicative_expression PERCENT unary_expression */ -#line 638 "MachineIndependent/glslang.y" +#line 642 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "%"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "%", EOpMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5912 "MachineIndependent/glslang_tab.cpp" +#line 5958 "MachineIndependent/glslang_tab.cpp" break; case 49: /* additive_expression: multiplicative_expression */ -#line 647 "MachineIndependent/glslang.y" +#line 651 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5918 "MachineIndependent/glslang_tab.cpp" +#line 5964 "MachineIndependent/glslang_tab.cpp" break; case 50: /* additive_expression: additive_expression PLUS multiplicative_expression */ -#line 648 "MachineIndependent/glslang.y" +#line 652 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "+", EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5928 "MachineIndependent/glslang_tab.cpp" +#line 5974 "MachineIndependent/glslang_tab.cpp" break; case 51: /* additive_expression: additive_expression DASH multiplicative_expression */ -#line 653 "MachineIndependent/glslang.y" +#line 657 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "-", EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5938 "MachineIndependent/glslang_tab.cpp" +#line 5984 "MachineIndependent/glslang_tab.cpp" break; case 52: /* shift_expression: additive_expression */ -#line 661 "MachineIndependent/glslang.y" +#line 665 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5944 "MachineIndependent/glslang_tab.cpp" +#line 5990 "MachineIndependent/glslang_tab.cpp" break; case 53: /* shift_expression: shift_expression LEFT_OP additive_expression */ -#line 662 "MachineIndependent/glslang.y" +#line 666 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift left"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<<", EOpLeftShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5955 "MachineIndependent/glslang_tab.cpp" +#line 6001 "MachineIndependent/glslang_tab.cpp" break; case 54: /* shift_expression: shift_expression RIGHT_OP additive_expression */ -#line 668 "MachineIndependent/glslang.y" +#line 672 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift right"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">>", EOpRightShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5966 "MachineIndependent/glslang_tab.cpp" +#line 6012 "MachineIndependent/glslang_tab.cpp" break; case 55: /* relational_expression: shift_expression */ -#line 677 "MachineIndependent/glslang.y" +#line 681 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5972 "MachineIndependent/glslang_tab.cpp" +#line 6018 "MachineIndependent/glslang_tab.cpp" break; case 56: /* relational_expression: relational_expression LEFT_ANGLE shift_expression */ -#line 678 "MachineIndependent/glslang.y" +#line 682 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<", EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5982 "MachineIndependent/glslang_tab.cpp" +#line 6028 "MachineIndependent/glslang_tab.cpp" break; case 57: /* relational_expression: relational_expression RIGHT_ANGLE shift_expression */ -#line 683 "MachineIndependent/glslang.y" +#line 687 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">", EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5992 "MachineIndependent/glslang_tab.cpp" +#line 6038 "MachineIndependent/glslang_tab.cpp" break; case 58: /* relational_expression: relational_expression LE_OP shift_expression */ -#line 688 "MachineIndependent/glslang.y" +#line 692 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<=", EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 6002 "MachineIndependent/glslang_tab.cpp" +#line 6048 "MachineIndependent/glslang_tab.cpp" break; case 59: /* relational_expression: relational_expression GE_OP shift_expression */ -#line 693 "MachineIndependent/glslang.y" +#line 697 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">=", EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 6012 "MachineIndependent/glslang_tab.cpp" +#line 6058 "MachineIndependent/glslang_tab.cpp" break; case 60: /* equality_expression: relational_expression */ -#line 701 "MachineIndependent/glslang.y" +#line 705 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6018 "MachineIndependent/glslang_tab.cpp" +#line 6064 "MachineIndependent/glslang_tab.cpp" break; case 61: /* equality_expression: equality_expression EQ_OP relational_expression */ -#line 702 "MachineIndependent/glslang.y" +#line 706 "MachineIndependent/glslang.y" { parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); @@ -6028,11 +6074,11 @@ yyreduce: if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 6032 "MachineIndependent/glslang_tab.cpp" +#line 6078 "MachineIndependent/glslang_tab.cpp" break; case 62: /* equality_expression: equality_expression NE_OP relational_expression */ -#line 711 "MachineIndependent/glslang.y" +#line 715 "MachineIndependent/glslang.y" { parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); @@ -6042,124 +6088,124 @@ yyreduce: if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 6046 "MachineIndependent/glslang_tab.cpp" +#line 6092 "MachineIndependent/glslang_tab.cpp" break; case 63: /* and_expression: equality_expression */ -#line 723 "MachineIndependent/glslang.y" +#line 727 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6052 "MachineIndependent/glslang_tab.cpp" +#line 6098 "MachineIndependent/glslang_tab.cpp" break; case 64: /* and_expression: and_expression AMPERSAND equality_expression */ -#line 724 "MachineIndependent/glslang.y" +#line 728 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise and"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&", EOpAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 6063 "MachineIndependent/glslang_tab.cpp" +#line 6109 "MachineIndependent/glslang_tab.cpp" break; case 65: /* exclusive_or_expression: and_expression */ -#line 733 "MachineIndependent/glslang.y" +#line 737 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6069 "MachineIndependent/glslang_tab.cpp" +#line 6115 "MachineIndependent/glslang_tab.cpp" break; case 66: /* exclusive_or_expression: exclusive_or_expression CARET and_expression */ -#line 734 "MachineIndependent/glslang.y" +#line 738 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise exclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^", EOpExclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 6080 "MachineIndependent/glslang_tab.cpp" +#line 6126 "MachineIndependent/glslang_tab.cpp" break; case 67: /* inclusive_or_expression: exclusive_or_expression */ -#line 743 "MachineIndependent/glslang.y" +#line 747 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6086 "MachineIndependent/glslang_tab.cpp" +#line 6132 "MachineIndependent/glslang_tab.cpp" break; case 68: /* inclusive_or_expression: inclusive_or_expression VERTICAL_BAR exclusive_or_expression */ -#line 744 "MachineIndependent/glslang.y" +#line 748 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise inclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "|", EOpInclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 6097 "MachineIndependent/glslang_tab.cpp" +#line 6143 "MachineIndependent/glslang_tab.cpp" break; case 69: /* logical_and_expression: inclusive_or_expression */ -#line 753 "MachineIndependent/glslang.y" +#line 757 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6103 "MachineIndependent/glslang_tab.cpp" +#line 6149 "MachineIndependent/glslang_tab.cpp" break; case 70: /* logical_and_expression: logical_and_expression AND_OP inclusive_or_expression */ -#line 754 "MachineIndependent/glslang.y" +#line 758 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&&", EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 6113 "MachineIndependent/glslang_tab.cpp" +#line 6159 "MachineIndependent/glslang_tab.cpp" break; case 71: /* logical_xor_expression: logical_and_expression */ -#line 762 "MachineIndependent/glslang.y" +#line 766 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6119 "MachineIndependent/glslang_tab.cpp" +#line 6165 "MachineIndependent/glslang_tab.cpp" break; case 72: /* logical_xor_expression: logical_xor_expression XOR_OP logical_and_expression */ -#line 763 "MachineIndependent/glslang.y" +#line 767 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^^", EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 6129 "MachineIndependent/glslang_tab.cpp" +#line 6175 "MachineIndependent/glslang_tab.cpp" break; case 73: /* logical_or_expression: logical_xor_expression */ -#line 771 "MachineIndependent/glslang.y" +#line 775 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6135 "MachineIndependent/glslang_tab.cpp" +#line 6181 "MachineIndependent/glslang_tab.cpp" break; case 74: /* logical_or_expression: logical_or_expression OR_OP logical_xor_expression */ -#line 772 "MachineIndependent/glslang.y" +#line 776 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "||", EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 6145 "MachineIndependent/glslang_tab.cpp" +#line 6191 "MachineIndependent/glslang_tab.cpp" break; case 75: /* conditional_expression: logical_or_expression */ -#line 780 "MachineIndependent/glslang.y" +#line 784 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6151 "MachineIndependent/glslang_tab.cpp" +#line 6197 "MachineIndependent/glslang_tab.cpp" break; case 76: /* $@1: %empty */ -#line 781 "MachineIndependent/glslang.y" +#line 785 "MachineIndependent/glslang.y" { ++parseContext.controlFlowNestingLevel; } -#line 6159 "MachineIndependent/glslang_tab.cpp" +#line 6205 "MachineIndependent/glslang_tab.cpp" break; case 77: /* conditional_expression: logical_or_expression QUESTION $@1 expression COLON assignment_expression */ -#line 784 "MachineIndependent/glslang.y" +#line 788 "MachineIndependent/glslang.y" { --parseContext.controlFlowNestingLevel; parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-5].interm.intermTypedNode)); @@ -6172,17 +6218,17 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 6176 "MachineIndependent/glslang_tab.cpp" +#line 6222 "MachineIndependent/glslang_tab.cpp" break; case 78: /* assignment_expression: conditional_expression */ -#line 799 "MachineIndependent/glslang.y" +#line 803 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6182 "MachineIndependent/glslang_tab.cpp" +#line 6228 "MachineIndependent/glslang_tab.cpp" break; case 79: /* assignment_expression: unary_expression assignment_operator assignment_expression */ -#line 800 "MachineIndependent/glslang.y" +#line 804 "MachineIndependent/glslang.y" { parseContext.arrayObjectCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array assignment"); parseContext.opaqueCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); @@ -6196,119 +6242,119 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } } -#line 6200 "MachineIndependent/glslang_tab.cpp" +#line 6246 "MachineIndependent/glslang_tab.cpp" break; case 80: /* assignment_operator: EQUAL */ -#line 816 "MachineIndependent/glslang.y" +#line 820 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAssign; } -#line 6209 "MachineIndependent/glslang_tab.cpp" +#line 6255 "MachineIndependent/glslang_tab.cpp" break; case 81: /* assignment_operator: MUL_ASSIGN */ -#line 820 "MachineIndependent/glslang.y" +#line 824 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpMulAssign; } -#line 6218 "MachineIndependent/glslang_tab.cpp" +#line 6264 "MachineIndependent/glslang_tab.cpp" break; case 82: /* assignment_operator: DIV_ASSIGN */ -#line 824 "MachineIndependent/glslang.y" +#line 828 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpDivAssign; } -#line 6227 "MachineIndependent/glslang_tab.cpp" +#line 6273 "MachineIndependent/glslang_tab.cpp" break; case 83: /* assignment_operator: MOD_ASSIGN */ -#line 828 "MachineIndependent/glslang.y" +#line 832 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "%="); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpModAssign; } -#line 6237 "MachineIndependent/glslang_tab.cpp" +#line 6283 "MachineIndependent/glslang_tab.cpp" break; case 84: /* assignment_operator: ADD_ASSIGN */ -#line 833 "MachineIndependent/glslang.y" +#line 837 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAddAssign; } -#line 6246 "MachineIndependent/glslang_tab.cpp" +#line 6292 "MachineIndependent/glslang_tab.cpp" break; case 85: /* assignment_operator: SUB_ASSIGN */ -#line 837 "MachineIndependent/glslang.y" +#line 841 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpSubAssign; } -#line 6255 "MachineIndependent/glslang_tab.cpp" +#line 6301 "MachineIndependent/glslang_tab.cpp" break; case 86: /* assignment_operator: LEFT_ASSIGN */ -#line 841 "MachineIndependent/glslang.y" +#line 845 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift left assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLeftShiftAssign; } -#line 6264 "MachineIndependent/glslang_tab.cpp" +#line 6310 "MachineIndependent/glslang_tab.cpp" break; case 87: /* assignment_operator: RIGHT_ASSIGN */ -#line 845 "MachineIndependent/glslang.y" +#line 849 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift right assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpRightShiftAssign; } -#line 6273 "MachineIndependent/glslang_tab.cpp" +#line 6319 "MachineIndependent/glslang_tab.cpp" break; case 88: /* assignment_operator: AND_ASSIGN */ -#line 849 "MachineIndependent/glslang.y" +#line 853 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-and assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAndAssign; } -#line 6282 "MachineIndependent/glslang_tab.cpp" +#line 6328 "MachineIndependent/glslang_tab.cpp" break; case 89: /* assignment_operator: XOR_ASSIGN */ -#line 853 "MachineIndependent/glslang.y" +#line 857 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-xor assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpExclusiveOrAssign; } -#line 6291 "MachineIndependent/glslang_tab.cpp" +#line 6337 "MachineIndependent/glslang_tab.cpp" break; case 90: /* assignment_operator: OR_ASSIGN */ -#line 857 "MachineIndependent/glslang.y" +#line 861 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-or assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpInclusiveOrAssign; } -#line 6300 "MachineIndependent/glslang_tab.cpp" +#line 6346 "MachineIndependent/glslang_tab.cpp" break; case 91: /* expression: assignment_expression */ -#line 864 "MachineIndependent/glslang.y" +#line 868 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6308 "MachineIndependent/glslang_tab.cpp" +#line 6354 "MachineIndependent/glslang_tab.cpp" break; case 92: /* expression: expression COMMA assignment_expression */ -#line 867 "MachineIndependent/glslang.y" +#line 871 "MachineIndependent/glslang.y" { parseContext.samplerConstructorLocationCheck((yyvsp[-1].lex).loc, ",", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); @@ -6317,30 +6363,30 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 6321 "MachineIndependent/glslang_tab.cpp" +#line 6367 "MachineIndependent/glslang_tab.cpp" break; case 93: /* constant_expression: conditional_expression */ -#line 878 "MachineIndependent/glslang.y" +#line 882 "MachineIndependent/glslang.y" { parseContext.constantValueCheck((yyvsp[0].interm.intermTypedNode), ""); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6330 "MachineIndependent/glslang_tab.cpp" +#line 6376 "MachineIndependent/glslang_tab.cpp" break; case 94: /* declaration: function_prototype SEMICOLON */ -#line 885 "MachineIndependent/glslang.y" +#line 889 "MachineIndependent/glslang.y" { parseContext.handleFunctionDeclarator((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).function, true /* prototype */); (yyval.interm.intermNode) = 0; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } -#line 6340 "MachineIndependent/glslang_tab.cpp" +#line 6386 "MachineIndependent/glslang_tab.cpp" break; case 95: /* declaration: spirv_instruction_qualifier function_prototype SEMICOLON */ -#line 890 "MachineIndependent/glslang.y" +#line 894 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[-1].interm).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier"); (yyvsp[-1].interm).function->setSpirvInstruction(*(yyvsp[-2].interm.spirvInst)); // Attach SPIR-V intruction qualifier @@ -6348,31 +6394,31 @@ yyreduce: (yyval.interm.intermNode) = 0; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } -#line 6352 "MachineIndependent/glslang_tab.cpp" +#line 6398 "MachineIndependent/glslang_tab.cpp" break; case 96: /* declaration: spirv_execution_mode_qualifier SEMICOLON */ -#line 897 "MachineIndependent/glslang.y" +#line 901 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "SPIR-V execution mode qualifier"); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier"); (yyval.interm.intermNode) = 0; } -#line 6362 "MachineIndependent/glslang_tab.cpp" +#line 6408 "MachineIndependent/glslang_tab.cpp" break; case 97: /* declaration: init_declarator_list SEMICOLON */ -#line 902 "MachineIndependent/glslang.y" +#line 906 "MachineIndependent/glslang.y" { if ((yyvsp[-1].interm).intermNode && (yyvsp[-1].interm).intermNode->getAsAggregate()) (yyvsp[-1].interm).intermNode->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-1].interm).intermNode; } -#line 6372 "MachineIndependent/glslang_tab.cpp" +#line 6418 "MachineIndependent/glslang_tab.cpp" break; case 98: /* declaration: PRECISION precision_qualifier type_specifier SEMICOLON */ -#line 907 "MachineIndependent/glslang.y" +#line 911 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[-3].lex).loc, ENoProfile, 130, 0, "precision statement"); // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope @@ -6380,76 +6426,62 @@ yyreduce: parseContext.setDefaultPrecision((yyvsp[-3].lex).loc, (yyvsp[-1].interm.type), (yyvsp[-2].interm.type).qualifier.precision); (yyval.interm.intermNode) = 0; } -#line 6384 "MachineIndependent/glslang_tab.cpp" +#line 6430 "MachineIndependent/glslang_tab.cpp" break; case 99: /* declaration: block_structure SEMICOLON */ -#line 914 "MachineIndependent/glslang.y" +#line 918 "MachineIndependent/glslang.y" { - parseContext.declareBlock((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).typeList); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = parseContext.declareBlock((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).typeList); } -#line 6393 "MachineIndependent/glslang_tab.cpp" +#line 6438 "MachineIndependent/glslang_tab.cpp" break; case 100: /* declaration: block_structure IDENTIFIER SEMICOLON */ -#line 918 "MachineIndependent/glslang.y" +#line 921 "MachineIndependent/glslang.y" { - parseContext.declareBlock((yyvsp[-2].interm).loc, *(yyvsp[-2].interm).typeList, (yyvsp[-1].lex).string); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = parseContext.declareBlock((yyvsp[-2].interm).loc, *(yyvsp[-2].interm).typeList, (yyvsp[-1].lex).string); } -#line 6402 "MachineIndependent/glslang_tab.cpp" +#line 6446 "MachineIndependent/glslang_tab.cpp" break; case 101: /* declaration: block_structure IDENTIFIER array_specifier SEMICOLON */ -#line 922 "MachineIndependent/glslang.y" +#line 924 "MachineIndependent/glslang.y" { - parseContext.declareBlock((yyvsp[-3].interm).loc, *(yyvsp[-3].interm).typeList, (yyvsp[-2].lex).string, (yyvsp[-1].interm).arraySizes); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = parseContext.declareBlock((yyvsp[-3].interm).loc, *(yyvsp[-3].interm).typeList, (yyvsp[-2].lex).string, (yyvsp[-1].interm).arraySizes); } -#line 6411 "MachineIndependent/glslang_tab.cpp" +#line 6454 "MachineIndependent/glslang_tab.cpp" break; case 102: /* declaration: type_qualifier SEMICOLON */ -#line 926 "MachineIndependent/glslang.y" +#line 927 "MachineIndependent/glslang.y" { parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); parseContext.updateStandaloneQualifierDefaults((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type)); (yyval.interm.intermNode) = 0; } -#line 6421 "MachineIndependent/glslang_tab.cpp" +#line 6464 "MachineIndependent/glslang_tab.cpp" break; - case 103: /* declaration: type_qualifier IDENTIFIER SEMICOLON */ -#line 931 "MachineIndependent/glslang.y" - { + case 103: /* declaration: type_qualifier identifier_list SEMICOLON */ +#line 932 "MachineIndependent/glslang.y" + { parseContext.checkNoShaderLayouts((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).shaderQualifiers); - parseContext.addQualifierToExisting((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, *(yyvsp[-1].lex).string); + parseContext.addQualifierToExisting((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, *(yyvsp[-1].interm.identifierList)); (yyval.interm.intermNode) = 0; } -#line 6431 "MachineIndependent/glslang_tab.cpp" +#line 6474 "MachineIndependent/glslang_tab.cpp" break; - case 104: /* declaration: type_qualifier IDENTIFIER identifier_list SEMICOLON */ -#line 936 "MachineIndependent/glslang.y" - { - parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); - (yyvsp[-1].interm.identifierList)->push_back((yyvsp[-2].lex).string); - parseContext.addQualifierToExisting((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier, *(yyvsp[-1].interm.identifierList)); - (yyval.interm.intermNode) = 0; - } -#line 6442 "MachineIndependent/glslang_tab.cpp" - break; - - case 105: /* $@2: %empty */ -#line 945 "MachineIndependent/glslang.y" + case 104: /* $@2: %empty */ +#line 940 "MachineIndependent/glslang.y" { parseContext.nestedBlockCheck((yyvsp[-2].interm.type).loc); } -#line 6448 "MachineIndependent/glslang_tab.cpp" +#line 6480 "MachineIndependent/glslang_tab.cpp" break; - case 106: /* block_structure: type_qualifier IDENTIFIER LEFT_BRACE $@2 struct_declaration_list RIGHT_BRACE */ -#line 945 "MachineIndependent/glslang.y" - { + case 105: /* block_structure: type_qualifier IDENTIFIER LEFT_BRACE $@2 struct_declaration_without_heap RIGHT_BRACE */ +#line 940 "MachineIndependent/glslang.y" + { --parseContext.blockNestingLevel; parseContext.blockName = (yyvsp[-4].lex).string; parseContext.globalQualifierFixCheck((yyvsp[-5].interm.type).loc, (yyvsp[-5].interm.type).qualifier); @@ -6458,39 +6490,39 @@ yyreduce: (yyval.interm).loc = (yyvsp[-5].interm.type).loc; (yyval.interm).typeList = (yyvsp[-1].interm.typeList); } -#line 6462 "MachineIndependent/glslang_tab.cpp" +#line 6494 "MachineIndependent/glslang_tab.cpp" break; - case 107: /* identifier_list: COMMA IDENTIFIER */ -#line 956 "MachineIndependent/glslang.y" - { + case 106: /* identifier_list: IDENTIFIER */ +#line 952 "MachineIndependent/glslang.y" + { (yyval.interm.identifierList) = new TIdentifierList; (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } -#line 6471 "MachineIndependent/glslang_tab.cpp" +#line 6503 "MachineIndependent/glslang_tab.cpp" break; - case 108: /* identifier_list: identifier_list COMMA IDENTIFIER */ -#line 960 "MachineIndependent/glslang.y" + case 107: /* identifier_list: identifier_list COMMA IDENTIFIER */ +#line 956 "MachineIndependent/glslang.y" { (yyval.interm.identifierList) = (yyvsp[-2].interm.identifierList); (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } -#line 6480 "MachineIndependent/glslang_tab.cpp" +#line 6512 "MachineIndependent/glslang_tab.cpp" break; - case 109: /* function_prototype: function_declarator RIGHT_PAREN */ -#line 967 "MachineIndependent/glslang.y" + case 108: /* function_prototype: function_declarator RIGHT_PAREN */ +#line 963 "MachineIndependent/glslang.y" { (yyval.interm).function = (yyvsp[-1].interm.function); if (parseContext.compileOnly) (yyval.interm).function->setExport(); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 6490 "MachineIndependent/glslang_tab.cpp" +#line 6522 "MachineIndependent/glslang_tab.cpp" break; - case 110: /* function_prototype: function_declarator RIGHT_PAREN attribute */ -#line 972 "MachineIndependent/glslang.y" + case 109: /* function_prototype: function_declarator RIGHT_PAREN attribute */ +#line 968 "MachineIndependent/glslang.y" { (yyval.interm).function = (yyvsp[-2].interm.function); if (parseContext.compileOnly) (yyval.interm).function->setExport(); @@ -6499,11 +6531,11 @@ yyreduce: parseContext.requireExtensions((yyvsp[-1].lex).loc, 2, extensions, "attribute"); parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[0].interm.attributes)); } -#line 6503 "MachineIndependent/glslang_tab.cpp" +#line 6535 "MachineIndependent/glslang_tab.cpp" break; - case 111: /* function_prototype: attribute function_declarator RIGHT_PAREN */ -#line 980 "MachineIndependent/glslang.y" + case 110: /* function_prototype: attribute function_declarator RIGHT_PAREN */ +#line 976 "MachineIndependent/glslang.y" { (yyval.interm).function = (yyvsp[-1].interm.function); if (parseContext.compileOnly) (yyval.interm).function->setExport(); @@ -6512,11 +6544,11 @@ yyreduce: parseContext.requireExtensions((yyvsp[0].lex).loc, 2, extensions, "attribute"); parseContext.handleFunctionAttributes((yyvsp[0].lex).loc, *(yyvsp[-2].interm.attributes)); } -#line 6516 "MachineIndependent/glslang_tab.cpp" +#line 6548 "MachineIndependent/glslang_tab.cpp" break; - case 112: /* function_prototype: attribute function_declarator RIGHT_PAREN attribute */ -#line 988 "MachineIndependent/glslang.y" + case 111: /* function_prototype: attribute function_declarator RIGHT_PAREN attribute */ +#line 984 "MachineIndependent/glslang.y" { (yyval.interm).function = (yyvsp[-2].interm.function); if (parseContext.compileOnly) (yyval.interm).function->setExport(); @@ -6526,27 +6558,27 @@ yyreduce: parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[-3].interm.attributes)); parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[0].interm.attributes)); } -#line 6530 "MachineIndependent/glslang_tab.cpp" +#line 6562 "MachineIndependent/glslang_tab.cpp" break; - case 113: /* function_declarator: function_header */ -#line 1000 "MachineIndependent/glslang.y" + case 112: /* function_declarator: function_header */ +#line 996 "MachineIndependent/glslang.y" { (yyval.interm.function) = (yyvsp[0].interm.function); } -#line 6538 "MachineIndependent/glslang_tab.cpp" +#line 6570 "MachineIndependent/glslang_tab.cpp" break; - case 114: /* function_declarator: function_header_with_parameters */ -#line 1003 "MachineIndependent/glslang.y" + case 113: /* function_declarator: function_header_with_parameters */ +#line 999 "MachineIndependent/glslang.y" { (yyval.interm.function) = (yyvsp[0].interm.function); } -#line 6546 "MachineIndependent/glslang_tab.cpp" +#line 6578 "MachineIndependent/glslang_tab.cpp" break; - case 115: /* function_header_with_parameters: function_header parameter_declaration */ -#line 1010 "MachineIndependent/glslang.y" + case 114: /* function_header_with_parameters: function_header parameter_declaration */ +#line 1006 "MachineIndependent/glslang.y" { // Add the parameter (yyval.interm.function) = (yyvsp[-1].interm.function); @@ -6560,11 +6592,11 @@ yyreduce: else delete (yyvsp[0].interm).param.type; } -#line 6564 "MachineIndependent/glslang_tab.cpp" +#line 6596 "MachineIndependent/glslang_tab.cpp" break; - case 116: /* function_header_with_parameters: function_header_with_parameters COMMA parameter_declaration */ -#line 1023 "MachineIndependent/glslang.y" + case 115: /* function_header_with_parameters: function_header_with_parameters COMMA parameter_declaration */ +#line 1019 "MachineIndependent/glslang.y" { // // Only first parameter of one-parameter functions can be void @@ -6585,20 +6617,20 @@ yyreduce: parseContext.vkRelaxedRemapFunctionParameter((yyvsp[-2].interm.function), (yyvsp[0].interm).param); } } -#line 6589 "MachineIndependent/glslang_tab.cpp" +#line 6621 "MachineIndependent/glslang_tab.cpp" break; - case 117: /* function_header_with_parameters: function_header_with_parameters COMMA DOT DOT DOT */ -#line 1043 "MachineIndependent/glslang.y" + case 116: /* function_header_with_parameters: function_header_with_parameters COMMA DOT DOT DOT */ +#line 1039 "MachineIndependent/glslang.y" { (yyval.interm.function) = (yyvsp[-4].interm.function); parseContext.makeVariadic((yyvsp[-4].interm.function), (yyvsp[-2].lex).loc); } -#line 6598 "MachineIndependent/glslang_tab.cpp" +#line 6630 "MachineIndependent/glslang_tab.cpp" break; - case 118: /* function_header: fully_specified_type IDENTIFIER LEFT_PAREN */ -#line 1050 "MachineIndependent/glslang.y" + case 117: /* function_header: fully_specified_type IDENTIFIER LEFT_PAREN */ +#line 1046 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.type).qualifier.storage != EvqGlobal && (yyvsp[-2].interm.type).qualifier.storage != EvqTemporary) { parseContext.error((yyvsp[-1].lex).loc, "no qualifiers allowed for function return", @@ -6618,11 +6650,11 @@ yyreduce: function = new TFunction((yyvsp[-1].lex).string, type); (yyval.interm.function) = function; } -#line 6622 "MachineIndependent/glslang_tab.cpp" +#line 6654 "MachineIndependent/glslang_tab.cpp" break; - case 119: /* parameter_declarator: type_specifier IDENTIFIER */ -#line 1073 "MachineIndependent/glslang.y" + case 118: /* parameter_declarator: type_specifier IDENTIFIER */ +#line 1069 "MachineIndependent/glslang.y" { if ((yyvsp[-1].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-1].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -6638,11 +6670,11 @@ yyreduce: (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).param = param; } -#line 6642 "MachineIndependent/glslang_tab.cpp" +#line 6674 "MachineIndependent/glslang_tab.cpp" break; - case 120: /* parameter_declarator: type_specifier IDENTIFIER array_specifier */ -#line 1088 "MachineIndependent/glslang.y" + case 119: /* parameter_declarator: type_specifier IDENTIFIER array_specifier */ +#line 1084 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -6662,21 +6694,21 @@ yyreduce: (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).param = param; } -#line 6666 "MachineIndependent/glslang_tab.cpp" +#line 6698 "MachineIndependent/glslang_tab.cpp" break; - case 121: /* parameter_declarator: type_specifier IDENTIFIER EQUAL initializer */ -#line 1107 "MachineIndependent/glslang.y" + case 120: /* parameter_declarator: type_specifier IDENTIFIER EQUAL initializer */ +#line 1103 "MachineIndependent/glslang.y" { TParameter param = parseContext.getParamWithDefault((yyvsp[-3].interm.type), (yyvsp[-2].lex).string, (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); (yyval.interm).loc = (yyvsp[-2].lex).loc; (yyval.interm).param = param; } -#line 6676 "MachineIndependent/glslang_tab.cpp" +#line 6708 "MachineIndependent/glslang_tab.cpp" break; - case 122: /* parameter_declaration: type_qualifier parameter_declarator */ -#line 1118 "MachineIndependent/glslang.y" + case 121: /* parameter_declaration: type_qualifier parameter_declarator */ +#line 1114 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) @@ -6688,11 +6720,11 @@ yyreduce: parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } -#line 6692 "MachineIndependent/glslang_tab.cpp" +#line 6724 "MachineIndependent/glslang_tab.cpp" break; - case 123: /* parameter_declaration: parameter_declarator */ -#line 1129 "MachineIndependent/glslang.y" + case 122: /* parameter_declaration: parameter_declarator */ +#line 1125 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); @@ -6700,11 +6732,11 @@ yyreduce: parseContext.paramCheckFixStorage((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier(), (yyval.interm).param.type->hasTypeParameter()); } -#line 6704 "MachineIndependent/glslang_tab.cpp" +#line 6736 "MachineIndependent/glslang_tab.cpp" break; - case 124: /* parameter_declaration: type_qualifier parameter_type_specifier */ -#line 1139 "MachineIndependent/glslang.y" + case 123: /* parameter_declaration: type_qualifier parameter_type_specifier */ +#line 1135 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) @@ -6715,11 +6747,11 @@ yyreduce: parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } -#line 6719 "MachineIndependent/glslang_tab.cpp" +#line 6751 "MachineIndependent/glslang_tab.cpp" break; - case 125: /* parameter_declaration: parameter_type_specifier */ -#line 1149 "MachineIndependent/glslang.y" + case 124: /* parameter_declaration: parameter_type_specifier */ +#line 1145 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); @@ -6727,118 +6759,121 @@ yyreduce: parseContext.paramCheckFixStorage((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier(), (yyval.interm).param.type->hasTypeParameter()); } -#line 6731 "MachineIndependent/glslang_tab.cpp" +#line 6763 "MachineIndependent/glslang_tab.cpp" break; - case 126: /* parameter_type_specifier: type_specifier */ -#line 1159 "MachineIndependent/glslang.y" + case 125: /* parameter_type_specifier: type_specifier */ +#line 1155 "MachineIndependent/glslang.y" { TParameter param = { 0, new TType((yyvsp[0].interm.type)), {} }; (yyval.interm).param = param; if ((yyvsp[0].interm.type).arraySizes) parseContext.arraySizeRequiredCheck((yyvsp[0].interm.type).loc, *(yyvsp[0].interm.type).arraySizes); } -#line 6742 "MachineIndependent/glslang_tab.cpp" +#line 6774 "MachineIndependent/glslang_tab.cpp" break; - case 127: /* init_declarator_list: single_declaration */ -#line 1168 "MachineIndependent/glslang.y" + case 126: /* init_declarator_list: single_declaration */ +#line 1164 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); } -#line 6750 "MachineIndependent/glslang_tab.cpp" +#line 6782 "MachineIndependent/glslang_tab.cpp" break; - case 128: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER */ -#line 1171 "MachineIndependent/glslang.y" + case 127: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER */ +#line 1167 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-2].interm); - parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-2].interm).type); + TIntermNode* declNode = parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-2].interm).type); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-2].interm).intermNode, declNode, (yyvsp[0].lex).loc); } -#line 6759 "MachineIndependent/glslang_tab.cpp" +#line 6792 "MachineIndependent/glslang_tab.cpp" break; - case 129: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER array_specifier */ -#line 1175 "MachineIndependent/glslang.y" + case 128: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER array_specifier */ +#line 1172 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-3].interm); - parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-3].interm).type, (yyvsp[0].interm).arraySizes); + TIntermNode* declNode = parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-3].interm).type, (yyvsp[0].interm).arraySizes); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-3].interm).intermNode, declNode, (yyvsp[-1].lex).loc); } -#line 6768 "MachineIndependent/glslang_tab.cpp" +#line 6802 "MachineIndependent/glslang_tab.cpp" break; - case 130: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer */ -#line 1179 "MachineIndependent/glslang.y" + case 129: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer */ +#line 1177 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-5].interm).type; - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-5].interm).intermNode, initNode, (yyvsp[-1].lex).loc); + TIntermNode* declNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-5].interm).intermNode, declNode, (yyvsp[-1].lex).loc); } -#line 6778 "MachineIndependent/glslang_tab.cpp" +#line 6812 "MachineIndependent/glslang_tab.cpp" break; - case 131: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER EQUAL initializer */ -#line 1184 "MachineIndependent/glslang.y" + case 130: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER EQUAL initializer */ +#line 1182 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-4].interm).type; - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, 0, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-4].interm).intermNode, initNode, (yyvsp[-1].lex).loc); + TIntermNode* declNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, 0, (yyvsp[0].interm.intermTypedNode)); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-4].interm).intermNode, declNode, (yyvsp[-1].lex).loc); } -#line 6788 "MachineIndependent/glslang_tab.cpp" +#line 6822 "MachineIndependent/glslang_tab.cpp" break; - case 132: /* single_declaration: fully_specified_type */ -#line 1192 "MachineIndependent/glslang.y" + case 131: /* single_declaration: fully_specified_type */ +#line 1190 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[0].interm.type); (yyval.interm).intermNode = 0; parseContext.declareTypeDefaults((yyval.interm).loc, (yyval.interm).type); } -#line 6798 "MachineIndependent/glslang_tab.cpp" +#line 6832 "MachineIndependent/glslang_tab.cpp" break; - case 133: /* single_declaration: fully_specified_type IDENTIFIER */ -#line 1197 "MachineIndependent/glslang.y" + case 132: /* single_declaration: fully_specified_type IDENTIFIER */ +#line 1195 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-1].interm.type); - (yyval.interm).intermNode = 0; - parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-1].interm.type)); + TIntermNode* declNode = parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-1].interm.type)); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate(nullptr, declNode, (yyvsp[0].lex).loc); + } -#line 6808 "MachineIndependent/glslang_tab.cpp" +#line 6843 "MachineIndependent/glslang_tab.cpp" break; - case 134: /* single_declaration: fully_specified_type IDENTIFIER array_specifier */ -#line 1202 "MachineIndependent/glslang.y" + case 133: /* single_declaration: fully_specified_type IDENTIFIER array_specifier */ +#line 1201 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-2].interm.type); - (yyval.interm).intermNode = 0; - parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-2].interm.type), (yyvsp[0].interm).arraySizes); + TIntermNode* declNode = parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-2].interm.type), (yyvsp[0].interm).arraySizes); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate(nullptr, declNode, (yyvsp[-1].lex).loc); } -#line 6818 "MachineIndependent/glslang_tab.cpp" +#line 6853 "MachineIndependent/glslang_tab.cpp" break; - case 135: /* single_declaration: fully_specified_type IDENTIFIER array_specifier EQUAL initializer */ -#line 1207 "MachineIndependent/glslang.y" + case 134: /* single_declaration: fully_specified_type IDENTIFIER array_specifier EQUAL initializer */ +#line 1206 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-4].interm.type); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); + TIntermNode* declNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate(nullptr, declNode, (yyvsp[-3].lex).loc); } -#line 6828 "MachineIndependent/glslang_tab.cpp" +#line 6863 "MachineIndependent/glslang_tab.cpp" break; - case 136: /* single_declaration: fully_specified_type IDENTIFIER EQUAL initializer */ -#line 1212 "MachineIndependent/glslang.y" + case 135: /* single_declaration: fully_specified_type IDENTIFIER EQUAL initializer */ +#line 1211 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-3].interm.type); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); + TIntermNode* declNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate(nullptr, declNode, (yyvsp[-2].lex).loc); } -#line 6838 "MachineIndependent/glslang_tab.cpp" +#line 6873 "MachineIndependent/glslang_tab.cpp" break; - case 137: /* fully_specified_type: type_specifier */ -#line 1221 "MachineIndependent/glslang.y" + case 136: /* fully_specified_type: type_specifier */ +#line 1220 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); @@ -6849,11 +6884,11 @@ yyreduce: } parseContext.precisionQualifierCheck((yyval.interm.type).loc, (yyval.interm.type).basicType, (yyval.interm.type).qualifier, (yyval.interm.type).hasTypeParameter()); } -#line 6853 "MachineIndependent/glslang_tab.cpp" +#line 6888 "MachineIndependent/glslang_tab.cpp" break; - case 138: /* fully_specified_type: type_qualifier type_specifier */ -#line 1231 "MachineIndependent/glslang.y" + case 137: /* fully_specified_type: type_qualifier type_specifier */ +#line 1230 "MachineIndependent/glslang.y" { parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, false, &(yyvsp[0].interm.type)); parseContext.globalQualifierTypeCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, (yyvsp[0].interm.type)); @@ -6878,22 +6913,22 @@ yyreduce: (parseContext.language == EShLangFragment && (yyval.interm.type).qualifier.storage == EvqVaryingIn))) (yyval.interm.type).qualifier.smooth = true; } -#line 6882 "MachineIndependent/glslang_tab.cpp" +#line 6917 "MachineIndependent/glslang_tab.cpp" break; - case 139: /* invariant_qualifier: INVARIANT */ -#line 1258 "MachineIndependent/glslang.y" + case 138: /* invariant_qualifier: INVARIANT */ +#line 1257 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "invariant"); parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, 0, "invariant"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.invariant = true; } -#line 6893 "MachineIndependent/glslang_tab.cpp" +#line 6928 "MachineIndependent/glslang_tab.cpp" break; - case 140: /* interpolation_qualifier: SMOOTH */ -#line 1267 "MachineIndependent/glslang.y" + case 139: /* interpolation_qualifier: SMOOTH */ +#line 1266 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "smooth"); parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "smooth"); @@ -6901,11 +6936,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.smooth = true; } -#line 6905 "MachineIndependent/glslang_tab.cpp" +#line 6940 "MachineIndependent/glslang_tab.cpp" break; - case 141: /* interpolation_qualifier: FLAT */ -#line 1274 "MachineIndependent/glslang.y" + case 140: /* interpolation_qualifier: FLAT */ +#line 1273 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "flat"); parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "flat"); @@ -6913,11 +6948,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.flat = true; } -#line 6917 "MachineIndependent/glslang_tab.cpp" +#line 6952 "MachineIndependent/glslang_tab.cpp" break; - case 142: /* interpolation_qualifier: NOPERSPECTIVE */ -#line 1281 "MachineIndependent/glslang.y" + case 141: /* interpolation_qualifier: NOPERSPECTIVE */ +#line 1280 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "noperspective"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); @@ -6925,11 +6960,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nopersp = true; } -#line 6929 "MachineIndependent/glslang_tab.cpp" +#line 6964 "MachineIndependent/glslang_tab.cpp" break; - case 143: /* interpolation_qualifier: EXPLICITINTERPAMD */ -#line 1288 "MachineIndependent/glslang.y" + case 142: /* interpolation_qualifier: EXPLICITINTERPAMD */ +#line 1287 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "__explicitInterpAMD"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); @@ -6937,11 +6972,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.explicitInterp = true; } -#line 6941 "MachineIndependent/glslang_tab.cpp" +#line 6976 "MachineIndependent/glslang_tab.cpp" break; - case 144: /* interpolation_qualifier: PERVERTEXNV */ -#line 1295 "MachineIndependent/glslang.y" + case 143: /* interpolation_qualifier: PERVERTEXNV */ +#line 1294 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "pervertexNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); @@ -6950,11 +6985,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.pervertexNV = true; } -#line 6954 "MachineIndependent/glslang_tab.cpp" +#line 6989 "MachineIndependent/glslang_tab.cpp" break; - case 145: /* interpolation_qualifier: PERVERTEXEXT */ -#line 1303 "MachineIndependent/glslang.y" + case 144: /* interpolation_qualifier: PERVERTEXEXT */ +#line 1302 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "pervertexEXT"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric"); @@ -6963,11 +6998,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.pervertexEXT = true; } -#line 6967 "MachineIndependent/glslang_tab.cpp" +#line 7002 "MachineIndependent/glslang_tab.cpp" break; - case 146: /* interpolation_qualifier: PERPRIMITIVENV */ -#line 1311 "MachineIndependent/glslang.y" + case 145: /* interpolation_qualifier: PERPRIMITIVENV */ +#line 1310 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "perprimitiveNV"); @@ -6978,11 +7013,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perPrimitiveNV = true; } -#line 6982 "MachineIndependent/glslang_tab.cpp" +#line 7017 "MachineIndependent/glslang_tab.cpp" break; - case 147: /* interpolation_qualifier: PERPRIMITIVEEXT */ -#line 1321 "MachineIndependent/glslang.y" + case 146: /* interpolation_qualifier: PERPRIMITIVEEXT */ +#line 1320 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "perprimitiveEXT"); @@ -6993,11 +7028,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perPrimitiveNV = true; } -#line 6997 "MachineIndependent/glslang_tab.cpp" +#line 7032 "MachineIndependent/glslang_tab.cpp" break; - case 148: /* interpolation_qualifier: PERVIEWNV */ -#line 1331 "MachineIndependent/glslang.y" + case 147: /* interpolation_qualifier: PERVIEWNV */ +#line 1330 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "perviewNV"); @@ -7005,11 +7040,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perViewNV = true; } -#line 7009 "MachineIndependent/glslang_tab.cpp" +#line 7044 "MachineIndependent/glslang_tab.cpp" break; - case 149: /* interpolation_qualifier: PERTASKNV */ -#line 1338 "MachineIndependent/glslang.y" + case 148: /* interpolation_qualifier: PERTASKNV */ +#line 1337 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "taskNV"); @@ -7017,84 +7052,84 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perTaskNV = true; } -#line 7021 "MachineIndependent/glslang_tab.cpp" +#line 7056 "MachineIndependent/glslang_tab.cpp" break; - case 150: /* layout_qualifier: LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN */ -#line 1348 "MachineIndependent/glslang.y" + case 149: /* layout_qualifier: LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN */ +#line 1347 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[-1].interm.type); } -#line 7029 "MachineIndependent/glslang_tab.cpp" +#line 7064 "MachineIndependent/glslang_tab.cpp" break; - case 151: /* layout_qualifier_id_list: layout_qualifier_id */ -#line 1354 "MachineIndependent/glslang.y" + case 150: /* layout_qualifier_id_list: layout_qualifier_id */ +#line 1353 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 7037 "MachineIndependent/glslang_tab.cpp" +#line 7072 "MachineIndependent/glslang_tab.cpp" break; - case 152: /* layout_qualifier_id_list: layout_qualifier_id_list COMMA layout_qualifier_id */ -#line 1357 "MachineIndependent/glslang.y" + case 151: /* layout_qualifier_id_list: layout_qualifier_id_list COMMA layout_qualifier_id */ +#line 1356 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[-2].interm.type); (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); parseContext.mergeObjectLayoutQualifiers((yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); } -#line 7047 "MachineIndependent/glslang_tab.cpp" +#line 7082 "MachineIndependent/glslang_tab.cpp" break; - case 153: /* layout_qualifier_id: IDENTIFIER */ -#line 1364 "MachineIndependent/glslang.y" + case 152: /* layout_qualifier_id: IDENTIFIER */ +#line 1363 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), *(yyvsp[0].lex).string); } -#line 7056 "MachineIndependent/glslang_tab.cpp" +#line 7091 "MachineIndependent/glslang_tab.cpp" break; - case 154: /* layout_qualifier_id: IDENTIFIER EQUAL constant_expression */ -#line 1368 "MachineIndependent/glslang.y" + case 153: /* layout_qualifier_id: IDENTIFIER EQUAL constant_expression */ +#line 1367 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-2].lex).loc); parseContext.setLayoutQualifier((yyvsp[-2].lex).loc, (yyval.interm.type), *(yyvsp[-2].lex).string, (yyvsp[0].interm.intermTypedNode)); } -#line 7065 "MachineIndependent/glslang_tab.cpp" +#line 7100 "MachineIndependent/glslang_tab.cpp" break; - case 155: /* layout_qualifier_id: SHARED */ -#line 1372 "MachineIndependent/glslang.y" + case 154: /* layout_qualifier_id: SHARED */ +#line 1371 "MachineIndependent/glslang.y" { // because "shared" is both an identifier and a keyword (yyval.interm.type).init((yyvsp[0].lex).loc); TString strShared("shared"); parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), strShared); } -#line 7075 "MachineIndependent/glslang_tab.cpp" +#line 7110 "MachineIndependent/glslang_tab.cpp" break; - case 156: /* precise_qualifier: PRECISE */ -#line 1380 "MachineIndependent/glslang.y" + case 155: /* precise_qualifier: PRECISE */ +#line 1379 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyval.interm.type).loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.noContraction = true; } -#line 7086 "MachineIndependent/glslang_tab.cpp" +#line 7121 "MachineIndependent/glslang_tab.cpp" break; - case 157: /* type_qualifier: single_type_qualifier */ -#line 1389 "MachineIndependent/glslang.y" + case 156: /* type_qualifier: single_type_qualifier */ +#line 1388 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 7094 "MachineIndependent/glslang_tab.cpp" +#line 7129 "MachineIndependent/glslang_tab.cpp" break; - case 158: /* type_qualifier: type_qualifier single_type_qualifier */ -#line 1392 "MachineIndependent/glslang.y" + case 157: /* type_qualifier: type_qualifier single_type_qualifier */ +#line 1391 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[-1].interm.type); if ((yyval.interm.type).basicType == EbtVoid) @@ -7103,151 +7138,151 @@ yyreduce: (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); parseContext.mergeQualifiers((yyval.interm.type).loc, (yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); } -#line 7107 "MachineIndependent/glslang_tab.cpp" +#line 7142 "MachineIndependent/glslang_tab.cpp" break; - case 159: /* single_type_qualifier: storage_qualifier */ -#line 1403 "MachineIndependent/glslang.y" + case 158: /* single_type_qualifier: storage_qualifier */ +#line 1402 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 7115 "MachineIndependent/glslang_tab.cpp" - break; - - case 160: /* single_type_qualifier: layout_qualifier */ -#line 1406 "MachineIndependent/glslang.y" - { - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 7123 "MachineIndependent/glslang_tab.cpp" - break; - - case 161: /* single_type_qualifier: precision_qualifier */ -#line 1409 "MachineIndependent/glslang.y" - { - parseContext.checkPrecisionQualifier((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier.precision); - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 7132 "MachineIndependent/glslang_tab.cpp" - break; - - case 162: /* single_type_qualifier: interpolation_qualifier */ -#line 1413 "MachineIndependent/glslang.y" - { - // allow inheritance of storage qualifier from block declaration - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 7141 "MachineIndependent/glslang_tab.cpp" - break; - - case 163: /* single_type_qualifier: invariant_qualifier */ -#line 1417 "MachineIndependent/glslang.y" - { - // allow inheritance of storage qualifier from block declaration - (yyval.interm.type) = (yyvsp[0].interm.type); - } #line 7150 "MachineIndependent/glslang_tab.cpp" break; - case 164: /* single_type_qualifier: precise_qualifier */ -#line 1421 "MachineIndependent/glslang.y" - { - // allow inheritance of storage qualifier from block declaration + case 159: /* single_type_qualifier: layout_qualifier */ +#line 1405 "MachineIndependent/glslang.y" + { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 7159 "MachineIndependent/glslang_tab.cpp" +#line 7158 "MachineIndependent/glslang_tab.cpp" break; - case 165: /* single_type_qualifier: non_uniform_qualifier */ -#line 1425 "MachineIndependent/glslang.y" - { + case 160: /* single_type_qualifier: precision_qualifier */ +#line 1408 "MachineIndependent/glslang.y" + { + parseContext.checkPrecisionQualifier((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier.precision); (yyval.interm.type) = (yyvsp[0].interm.type); } #line 7167 "MachineIndependent/glslang_tab.cpp" break; - case 166: /* single_type_qualifier: spirv_storage_class_qualifier */ -#line 1428 "MachineIndependent/glslang.y" + case 161: /* single_type_qualifier: interpolation_qualifier */ +#line 1412 "MachineIndependent/glslang.y" + { + // allow inheritance of storage qualifier from block declaration + (yyval.interm.type) = (yyvsp[0].interm.type); + } +#line 7176 "MachineIndependent/glslang_tab.cpp" + break; + + case 162: /* single_type_qualifier: invariant_qualifier */ +#line 1416 "MachineIndependent/glslang.y" + { + // allow inheritance of storage qualifier from block declaration + (yyval.interm.type) = (yyvsp[0].interm.type); + } +#line 7185 "MachineIndependent/glslang_tab.cpp" + break; + + case 163: /* single_type_qualifier: precise_qualifier */ +#line 1420 "MachineIndependent/glslang.y" + { + // allow inheritance of storage qualifier from block declaration + (yyval.interm.type) = (yyvsp[0].interm.type); + } +#line 7194 "MachineIndependent/glslang_tab.cpp" + break; + + case 164: /* single_type_qualifier: non_uniform_qualifier */ +#line 1424 "MachineIndependent/glslang.y" + { + (yyval.interm.type) = (yyvsp[0].interm.type); + } +#line 7202 "MachineIndependent/glslang_tab.cpp" + break; + + case 165: /* single_type_qualifier: spirv_storage_class_qualifier */ +#line 1427 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].interm.type).loc, "spirv_storage_class"); parseContext.requireExtensions((yyvsp[0].interm.type).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V storage class qualifier"); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 7177 "MachineIndependent/glslang_tab.cpp" +#line 7212 "MachineIndependent/glslang_tab.cpp" break; - case 167: /* single_type_qualifier: spirv_decorate_qualifier */ -#line 1433 "MachineIndependent/glslang.y" + case 166: /* single_type_qualifier: spirv_decorate_qualifier */ +#line 1432 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.type).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V decorate qualifier"); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 7186 "MachineIndependent/glslang_tab.cpp" +#line 7221 "MachineIndependent/glslang_tab.cpp" break; - case 168: /* single_type_qualifier: SPIRV_BY_REFERENCE */ -#line 1437 "MachineIndependent/glslang.y" + case 167: /* single_type_qualifier: SPIRV_BY_REFERENCE */ +#line 1436 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_reference"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.setSpirvByReference(); } -#line 7196 "MachineIndependent/glslang_tab.cpp" +#line 7231 "MachineIndependent/glslang_tab.cpp" break; - case 169: /* single_type_qualifier: SPIRV_LITERAL */ -#line 1442 "MachineIndependent/glslang.y" + case 168: /* single_type_qualifier: SPIRV_LITERAL */ +#line 1441 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_literal"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.setSpirvLiteral(); } -#line 7206 "MachineIndependent/glslang_tab.cpp" +#line 7241 "MachineIndependent/glslang_tab.cpp" break; - case 170: /* storage_qualifier: CONST */ -#line 1450 "MachineIndependent/glslang.y" + case 169: /* storage_qualifier: CONST */ +#line 1449 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant } -#line 7215 "MachineIndependent/glslang_tab.cpp" +#line 7250 "MachineIndependent/glslang_tab.cpp" break; - case 171: /* storage_qualifier: INOUT */ -#line 1454 "MachineIndependent/glslang.y" + case 170: /* storage_qualifier: INOUT */ +#line 1453 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "inout"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqInOut; } -#line 7225 "MachineIndependent/glslang_tab.cpp" +#line 7260 "MachineIndependent/glslang_tab.cpp" break; - case 172: /* storage_qualifier: IN */ -#line 1459 "MachineIndependent/glslang.y" + case 171: /* storage_qualifier: IN */ +#line 1458 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "in"); (yyval.interm.type).init((yyvsp[0].lex).loc); // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later (yyval.interm.type).qualifier.storage = EvqIn; } -#line 7236 "MachineIndependent/glslang_tab.cpp" +#line 7271 "MachineIndependent/glslang_tab.cpp" break; - case 173: /* storage_qualifier: OUT */ -#line 1465 "MachineIndependent/glslang.y" + case 172: /* storage_qualifier: OUT */ +#line 1464 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "out"); (yyval.interm.type).init((yyvsp[0].lex).loc); // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later (yyval.interm.type).qualifier.storage = EvqOut; } -#line 7247 "MachineIndependent/glslang_tab.cpp" +#line 7282 "MachineIndependent/glslang_tab.cpp" break; - case 174: /* storage_qualifier: CENTROID */ -#line 1471 "MachineIndependent/glslang.y" + case 173: /* storage_qualifier: CENTROID */ +#line 1470 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 120, 0, "centroid"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "centroid"); @@ -7255,31 +7290,31 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.centroid = true; } -#line 7259 "MachineIndependent/glslang_tab.cpp" +#line 7294 "MachineIndependent/glslang_tab.cpp" break; - case 175: /* storage_qualifier: UNIFORM */ -#line 1478 "MachineIndependent/glslang.y" + case 174: /* storage_qualifier: UNIFORM */ +#line 1477 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqUniform; } -#line 7269 "MachineIndependent/glslang_tab.cpp" +#line 7304 "MachineIndependent/glslang_tab.cpp" break; - case 176: /* storage_qualifier: TILEIMAGEEXT */ -#line 1483 "MachineIndependent/glslang.y" + case 175: /* storage_qualifier: TILEIMAGEEXT */ +#line 1482 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "tileImageEXT"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqTileImageEXT; } -#line 7279 "MachineIndependent/glslang_tab.cpp" +#line 7314 "MachineIndependent/glslang_tab.cpp" break; - case 177: /* storage_qualifier: SHARED */ -#line 1488 "MachineIndependent/glslang.y" + case 176: /* storage_qualifier: SHARED */ +#line 1487 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "shared"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); @@ -7288,21 +7323,21 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqShared; } -#line 7292 "MachineIndependent/glslang_tab.cpp" +#line 7327 "MachineIndependent/glslang_tab.cpp" break; - case 178: /* storage_qualifier: BUFFER */ -#line 1496 "MachineIndependent/glslang.y" + case 177: /* storage_qualifier: BUFFER */ +#line 1495 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqBuffer; } -#line 7302 "MachineIndependent/glslang_tab.cpp" +#line 7337 "MachineIndependent/glslang_tab.cpp" break; - case 179: /* storage_qualifier: ATTRIBUTE */ -#line 1501 "MachineIndependent/glslang.y" + case 178: /* storage_qualifier: ATTRIBUTE */ +#line 1500 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); @@ -7315,11 +7350,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 7319 "MachineIndependent/glslang_tab.cpp" +#line 7354 "MachineIndependent/glslang_tab.cpp" break; - case 180: /* storage_qualifier: VARYING */ -#line 1513 "MachineIndependent/glslang.y" + case 179: /* storage_qualifier: VARYING */ +#line 1512 "MachineIndependent/glslang.y" { parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); @@ -7334,32 +7369,52 @@ yyreduce: else (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 7338 "MachineIndependent/glslang_tab.cpp" +#line 7373 "MachineIndependent/glslang_tab.cpp" break; - case 181: /* storage_qualifier: PATCH */ -#line 1527 "MachineIndependent/glslang.y" + case 180: /* storage_qualifier: PATCH */ +#line 1526 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "patch"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.patch = true; } -#line 7349 "MachineIndependent/glslang_tab.cpp" +#line 7384 "MachineIndependent/glslang_tab.cpp" break; - case 182: /* storage_qualifier: SAMPLE */ -#line 1533 "MachineIndependent/glslang.y" + case 181: /* storage_qualifier: SAMPLE */ +#line 1532 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "sample"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.sample = true; } -#line 7359 "MachineIndependent/glslang_tab.cpp" +#line 7394 "MachineIndependent/glslang_tab.cpp" break; - case 183: /* storage_qualifier: HITATTRNV */ -#line 1538 "MachineIndependent/glslang.y" + case 182: /* storage_qualifier: RESOURCEHEAP */ +#line 1537 "MachineIndependent/glslang.y" + { + parseContext.globalCheck((yyvsp[0].lex).loc, "resourceHeap"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqResourceHeap; + } +#line 7404 "MachineIndependent/glslang_tab.cpp" + break; + + case 183: /* storage_qualifier: SAMPLERHEAP */ +#line 1542 "MachineIndependent/glslang.y" + { + parseContext.globalCheck((yyvsp[0].lex).loc, "samplerHeap"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqSamplerHeap; + } +#line 7414 "MachineIndependent/glslang_tab.cpp" + break; + + case 184: /* storage_qualifier: HITATTRNV */ +#line 1547 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask @@ -7368,24 +7423,37 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqHitAttr; } -#line 7372 "MachineIndependent/glslang_tab.cpp" +#line 7427 "MachineIndependent/glslang_tab.cpp" break; - case 184: /* storage_qualifier: HITOBJECTATTRNV */ -#line 1546 "MachineIndependent/glslang.y" - { + case 185: /* storage_qualifier: HITOBJECTATTRNV */ +#line 1555 "MachineIndependent/glslang.y" + { parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | EShLangMissMask), "hitObjectAttributeNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqHitObjectAttrNV; - } -#line 7385 "MachineIndependent/glslang_tab.cpp" + } +#line 7440 "MachineIndependent/glslang_tab.cpp" break; - case 185: /* storage_qualifier: HITATTREXT */ -#line 1554 "MachineIndependent/glslang.y" + case 186: /* storage_qualifier: HITOBJECTATTREXT */ +#line 1563 "MachineIndependent/glslang.y" + { + parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeEXT"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask + | EShLangMissMask), "hitObjectAttributeEXT"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_EXT_shader_invocation_reorder, "hitObjectAttributeEXT"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqHitObjectAttrEXT; + } +#line 7453 "MachineIndependent/glslang_tab.cpp" + break; + + case 187: /* storage_qualifier: HITATTREXT */ +#line 1571 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask @@ -7394,11 +7462,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqHitAttr; } -#line 7398 "MachineIndependent/glslang_tab.cpp" +#line 7466 "MachineIndependent/glslang_tab.cpp" break; - case 186: /* storage_qualifier: PAYLOADNV */ -#line 1562 "MachineIndependent/glslang.y" + case 188: /* storage_qualifier: PAYLOADNV */ +#line 1579 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | @@ -7407,11 +7475,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayload; } -#line 7411 "MachineIndependent/glslang_tab.cpp" +#line 7479 "MachineIndependent/glslang_tab.cpp" break; - case 187: /* storage_qualifier: PAYLOADEXT */ -#line 1570 "MachineIndependent/glslang.y" + case 189: /* storage_qualifier: PAYLOADEXT */ +#line 1587 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | @@ -7420,11 +7488,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayload; } -#line 7424 "MachineIndependent/glslang_tab.cpp" +#line 7492 "MachineIndependent/glslang_tab.cpp" break; - case 188: /* storage_qualifier: PAYLOADINNV */ -#line 1578 "MachineIndependent/glslang.y" + case 190: /* storage_qualifier: PAYLOADINNV */ +#line 1595 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadInNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangClosestHitMask | @@ -7433,11 +7501,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayloadIn; } -#line 7437 "MachineIndependent/glslang_tab.cpp" +#line 7505 "MachineIndependent/glslang_tab.cpp" break; - case 189: /* storage_qualifier: PAYLOADINEXT */ -#line 1586 "MachineIndependent/glslang.y" + case 191: /* storage_qualifier: PAYLOADINEXT */ +#line 1603 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadInEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangClosestHitMask | @@ -7446,11 +7514,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayloadIn; } -#line 7450 "MachineIndependent/glslang_tab.cpp" +#line 7518 "MachineIndependent/glslang_tab.cpp" break; - case 190: /* storage_qualifier: CALLDATANV */ -#line 1594 "MachineIndependent/glslang.y" + case 192: /* storage_qualifier: CALLDATANV */ +#line 1611 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | @@ -7459,11 +7527,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableData; } -#line 7463 "MachineIndependent/glslang_tab.cpp" +#line 7531 "MachineIndependent/glslang_tab.cpp" break; - case 191: /* storage_qualifier: CALLDATAEXT */ -#line 1602 "MachineIndependent/glslang.y" + case 193: /* storage_qualifier: CALLDATAEXT */ +#line 1619 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | @@ -7472,11 +7540,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableData; } -#line 7476 "MachineIndependent/glslang_tab.cpp" +#line 7544 "MachineIndependent/glslang_tab.cpp" break; - case 192: /* storage_qualifier: CALLDATAINNV */ -#line 1610 "MachineIndependent/glslang.y" + case 194: /* storage_qualifier: CALLDATAINNV */ +#line 1627 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataInNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInNV"); @@ -7484,11 +7552,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableDataIn; } -#line 7488 "MachineIndependent/glslang_tab.cpp" +#line 7556 "MachineIndependent/glslang_tab.cpp" break; - case 193: /* storage_qualifier: CALLDATAINEXT */ -#line 1617 "MachineIndependent/glslang.y" + case 195: /* storage_qualifier: CALLDATAINEXT */ +#line 1634 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataInEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInEXT"); @@ -7496,147 +7564,147 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableDataIn; } -#line 7500 "MachineIndependent/glslang_tab.cpp" +#line 7568 "MachineIndependent/glslang_tab.cpp" break; - case 194: /* storage_qualifier: COHERENT */ -#line 1624 "MachineIndependent/glslang.y" + case 196: /* storage_qualifier: COHERENT */ +#line 1641 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.coherent = true; } -#line 7509 "MachineIndependent/glslang_tab.cpp" +#line 7577 "MachineIndependent/glslang_tab.cpp" break; - case 195: /* storage_qualifier: DEVICECOHERENT */ -#line 1628 "MachineIndependent/glslang.y" + case 197: /* storage_qualifier: DEVICECOHERENT */ +#line 1645 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent"); (yyval.interm.type).qualifier.devicecoherent = true; } -#line 7519 "MachineIndependent/glslang_tab.cpp" +#line 7587 "MachineIndependent/glslang_tab.cpp" break; - case 196: /* storage_qualifier: QUEUEFAMILYCOHERENT */ -#line 1633 "MachineIndependent/glslang.y" + case 198: /* storage_qualifier: QUEUEFAMILYCOHERENT */ +#line 1650 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent"); (yyval.interm.type).qualifier.queuefamilycoherent = true; } -#line 7529 "MachineIndependent/glslang_tab.cpp" +#line 7597 "MachineIndependent/glslang_tab.cpp" break; - case 197: /* storage_qualifier: WORKGROUPCOHERENT */ -#line 1638 "MachineIndependent/glslang.y" + case 199: /* storage_qualifier: WORKGROUPCOHERENT */ +#line 1655 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent"); (yyval.interm.type).qualifier.workgroupcoherent = true; } -#line 7539 "MachineIndependent/glslang_tab.cpp" +#line 7607 "MachineIndependent/glslang_tab.cpp" break; - case 198: /* storage_qualifier: SUBGROUPCOHERENT */ -#line 1643 "MachineIndependent/glslang.y" + case 200: /* storage_qualifier: SUBGROUPCOHERENT */ +#line 1660 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent"); (yyval.interm.type).qualifier.subgroupcoherent = true; } -#line 7549 "MachineIndependent/glslang_tab.cpp" +#line 7617 "MachineIndependent/glslang_tab.cpp" break; - case 199: /* storage_qualifier: NONPRIVATE */ -#line 1648 "MachineIndependent/glslang.y" + case 201: /* storage_qualifier: NONPRIVATE */ +#line 1665 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate"); (yyval.interm.type).qualifier.nonprivate = true; } -#line 7559 "MachineIndependent/glslang_tab.cpp" +#line 7627 "MachineIndependent/glslang_tab.cpp" break; - case 200: /* storage_qualifier: SHADERCALLCOHERENT */ -#line 1653 "MachineIndependent/glslang.y" + case 202: /* storage_qualifier: SHADERCALLCOHERENT */ +#line 1670 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_ray_tracing, "shadercallcoherent"); (yyval.interm.type).qualifier.shadercallcoherent = true; } -#line 7569 "MachineIndependent/glslang_tab.cpp" +#line 7637 "MachineIndependent/glslang_tab.cpp" break; - case 201: /* storage_qualifier: VOLATILE */ -#line 1658 "MachineIndependent/glslang.y" + case 203: /* storage_qualifier: VOLATILE */ +#line 1675 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.volatil = true; } -#line 7578 "MachineIndependent/glslang_tab.cpp" +#line 7646 "MachineIndependent/glslang_tab.cpp" break; - case 202: /* storage_qualifier: RESTRICT */ -#line 1662 "MachineIndependent/glslang.y" + case 204: /* storage_qualifier: RESTRICT */ +#line 1679 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.restrict = true; } -#line 7587 "MachineIndependent/glslang_tab.cpp" +#line 7655 "MachineIndependent/glslang_tab.cpp" break; - case 203: /* storage_qualifier: READONLY */ -#line 1666 "MachineIndependent/glslang.y" + case 205: /* storage_qualifier: READONLY */ +#line 1683 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.readonly = true; } -#line 7596 "MachineIndependent/glslang_tab.cpp" +#line 7664 "MachineIndependent/glslang_tab.cpp" break; - case 204: /* storage_qualifier: WRITEONLY */ -#line 1670 "MachineIndependent/glslang.y" + case 206: /* storage_qualifier: WRITEONLY */ +#line 1687 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.writeonly = true; } -#line 7605 "MachineIndependent/glslang_tab.cpp" +#line 7673 "MachineIndependent/glslang_tab.cpp" break; - case 205: /* storage_qualifier: NONTEMPORAL */ -#line 1674 "MachineIndependent/glslang.y" + case 207: /* storage_qualifier: NONTEMPORAL */ +#line 1691 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nontemporal = true; } -#line 7614 "MachineIndependent/glslang_tab.cpp" +#line 7682 "MachineIndependent/glslang_tab.cpp" break; - case 206: /* storage_qualifier: SUBROUTINE */ -#line 1678 "MachineIndependent/glslang.y" + case 208: /* storage_qualifier: SUBROUTINE */ +#line 1695 "MachineIndependent/glslang.y" { parseContext.spvRemoved((yyvsp[0].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[0].lex).loc, "subroutine"); parseContext.unimplemented((yyvsp[0].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[0].lex).loc); } -#line 7625 "MachineIndependent/glslang_tab.cpp" +#line 7693 "MachineIndependent/glslang_tab.cpp" break; - case 207: /* storage_qualifier: SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN */ -#line 1684 "MachineIndependent/glslang.y" + case 209: /* storage_qualifier: SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN */ +#line 1701 "MachineIndependent/glslang.y" { parseContext.spvRemoved((yyvsp[-3].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[-3].lex).loc, "subroutine"); parseContext.unimplemented((yyvsp[-3].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[-3].lex).loc); } -#line 7636 "MachineIndependent/glslang_tab.cpp" +#line 7704 "MachineIndependent/glslang_tab.cpp" break; - case 208: /* storage_qualifier: TASKPAYLOADWORKGROUPEXT */ -#line 1690 "MachineIndependent/glslang.y" + case 210: /* storage_qualifier: TASKPAYLOADWORKGROUPEXT */ +#line 1707 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "taskPayloadSharedEXT"); @@ -7644,38 +7712,38 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqtaskPayloadSharedEXT; } -#line 7648 "MachineIndependent/glslang_tab.cpp" +#line 7716 "MachineIndependent/glslang_tab.cpp" break; - case 209: /* non_uniform_qualifier: NONUNIFORM */ -#line 1700 "MachineIndependent/glslang.y" + case 211: /* non_uniform_qualifier: NONUNIFORM */ +#line 1717 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nonUniform = true; } -#line 7657 "MachineIndependent/glslang_tab.cpp" +#line 7725 "MachineIndependent/glslang_tab.cpp" break; - case 210: /* type_name_list: IDENTIFIER */ -#line 1707 "MachineIndependent/glslang.y" + case 212: /* type_name_list: IDENTIFIER */ +#line 1724 "MachineIndependent/glslang.y" { // TODO } -#line 7665 "MachineIndependent/glslang_tab.cpp" +#line 7733 "MachineIndependent/glslang_tab.cpp" break; - case 211: /* type_name_list: type_name_list COMMA IDENTIFIER */ -#line 1710 "MachineIndependent/glslang.y" + case 213: /* type_name_list: type_name_list COMMA IDENTIFIER */ +#line 1727 "MachineIndependent/glslang.y" { // TODO: 4.0 semantics: subroutines // 1) make sure each identifier is a type declared earlier with SUBROUTINE // 2) save all of the identifiers for future comparison with the declared function } -#line 7675 "MachineIndependent/glslang_tab.cpp" +#line 7743 "MachineIndependent/glslang_tab.cpp" break; - case 212: /* type_specifier: type_specifier_nonarray type_parameter_specifier_opt */ -#line 1718 "MachineIndependent/glslang.y" + case 214: /* type_specifier: type_specifier_nonarray type_parameter_specifier_opt */ +#line 1735 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[-1].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); @@ -7683,11 +7751,11 @@ yyreduce: parseContext.typeParametersCheck((yyvsp[-1].interm.type).loc, (yyval.interm.type)); } -#line 7687 "MachineIndependent/glslang_tab.cpp" +#line 7755 "MachineIndependent/glslang_tab.cpp" break; - case 213: /* type_specifier: type_specifier_nonarray type_parameter_specifier_opt array_specifier */ -#line 1725 "MachineIndependent/glslang.y" + case 215: /* type_specifier: type_specifier_nonarray type_parameter_specifier_opt array_specifier */ +#line 1742 "MachineIndependent/glslang.y" { parseContext.arrayOfArrayVersionCheck((yyvsp[0].interm).loc, (yyvsp[0].interm).arraySizes); (yyval.interm.type) = (yyvsp[-2].interm.type); @@ -7696,21 +7764,21 @@ yyreduce: (yyval.interm.type).arraySizes = (yyvsp[0].interm).arraySizes; parseContext.typeParametersCheck((yyvsp[-2].interm.type).loc, (yyval.interm.type)); } -#line 7700 "MachineIndependent/glslang_tab.cpp" +#line 7768 "MachineIndependent/glslang_tab.cpp" break; - case 214: /* array_specifier: LEFT_BRACKET RIGHT_BRACKET */ -#line 1736 "MachineIndependent/glslang.y" + case 216: /* array_specifier: LEFT_BRACKET RIGHT_BRACKET */ +#line 1753 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).arraySizes = new TArraySizes; (yyval.interm).arraySizes->addInnerSize(); } -#line 7710 "MachineIndependent/glslang_tab.cpp" +#line 7778 "MachineIndependent/glslang_tab.cpp" break; - case 215: /* array_specifier: LEFT_BRACKET conditional_expression RIGHT_BRACKET */ -#line 1741 "MachineIndependent/glslang.y" + case 217: /* array_specifier: LEFT_BRACKET conditional_expression RIGHT_BRACKET */ +#line 1758 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[-2].lex).loc; (yyval.interm).arraySizes = new TArraySizes; @@ -7719,20 +7787,20 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size, "array size"); (yyval.interm).arraySizes->addInnerSize(size); } -#line 7723 "MachineIndependent/glslang_tab.cpp" +#line 7791 "MachineIndependent/glslang_tab.cpp" break; - case 216: /* array_specifier: array_specifier LEFT_BRACKET RIGHT_BRACKET */ -#line 1749 "MachineIndependent/glslang.y" + case 218: /* array_specifier: array_specifier LEFT_BRACKET RIGHT_BRACKET */ +#line 1766 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-2].interm); (yyval.interm).arraySizes->addInnerSize(); } -#line 7732 "MachineIndependent/glslang_tab.cpp" +#line 7800 "MachineIndependent/glslang_tab.cpp" break; - case 217: /* array_specifier: array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET */ -#line 1753 "MachineIndependent/glslang.y" + case 219: /* array_specifier: array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET */ +#line 1770 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-3].interm); @@ -7740,46 +7808,46 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size, "array size"); (yyval.interm).arraySizes->addInnerSize(size); } -#line 7744 "MachineIndependent/glslang_tab.cpp" +#line 7812 "MachineIndependent/glslang_tab.cpp" break; - case 218: /* type_parameter_specifier_opt: type_parameter_specifier */ -#line 1763 "MachineIndependent/glslang.y" + case 220: /* type_parameter_specifier_opt: type_parameter_specifier */ +#line 1780 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = (yyvsp[0].interm.typeParameters); } -#line 7752 "MachineIndependent/glslang_tab.cpp" +#line 7820 "MachineIndependent/glslang_tab.cpp" break; - case 219: /* type_parameter_specifier_opt: %empty */ -#line 1766 "MachineIndependent/glslang.y" + case 221: /* type_parameter_specifier_opt: %empty */ +#line 1783 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = 0; } -#line 7760 "MachineIndependent/glslang_tab.cpp" +#line 7828 "MachineIndependent/glslang_tab.cpp" break; - case 220: /* type_parameter_specifier: LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE */ -#line 1772 "MachineIndependent/glslang.y" + case 222: /* type_parameter_specifier: LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE */ +#line 1789 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = (yyvsp[-1].interm.typeParameters); } -#line 7768 "MachineIndependent/glslang_tab.cpp" +#line 7836 "MachineIndependent/glslang_tab.cpp" break; - case 221: /* type_parameter_specifier_list: type_specifier */ -#line 1778 "MachineIndependent/glslang.y" + case 223: /* type_parameter_specifier_list: type_specifier */ +#line 1795 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = new TTypeParameters; (yyval.interm.typeParameters)->arraySizes = new TArraySizes; (yyval.interm.typeParameters)->spirvType = (yyvsp[0].interm.type).spirvType; (yyval.interm.typeParameters)->basicType = (yyvsp[0].interm.type).basicType; } -#line 7779 "MachineIndependent/glslang_tab.cpp" +#line 7847 "MachineIndependent/glslang_tab.cpp" break; - case 222: /* type_parameter_specifier_list: unary_expression */ -#line 1784 "MachineIndependent/glslang.y" + case 224: /* type_parameter_specifier_list: unary_expression */ +#line 1801 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = new TTypeParameters; (yyval.interm.typeParameters)->arraySizes = new TArraySizes; @@ -7788,11 +7856,11 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter", true); (yyval.interm.typeParameters)->arraySizes->addInnerSize(size); } -#line 7792 "MachineIndependent/glslang_tab.cpp" +#line 7860 "MachineIndependent/glslang_tab.cpp" break; - case 223: /* type_parameter_specifier_list: type_parameter_specifier_list COMMA unary_expression */ -#line 1792 "MachineIndependent/glslang.y" + case 225: /* type_parameter_specifier_list: type_parameter_specifier_list COMMA unary_expression */ +#line 1809 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = (yyvsp[-2].interm.typeParameters); @@ -7800,300 +7868,300 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter", true); (yyval.interm.typeParameters)->arraySizes->addInnerSize(size); } -#line 7804 "MachineIndependent/glslang_tab.cpp" +#line 7872 "MachineIndependent/glslang_tab.cpp" break; - case 224: /* type_specifier_nonarray: VOID */ -#line 1802 "MachineIndependent/glslang.y" + case 226: /* type_specifier_nonarray: VOID */ +#line 1819 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtVoid; } -#line 7813 "MachineIndependent/glslang_tab.cpp" +#line 7881 "MachineIndependent/glslang_tab.cpp" break; - case 225: /* type_specifier_nonarray: FLOAT */ -#line 1806 "MachineIndependent/glslang.y" + case 227: /* type_specifier_nonarray: FLOAT */ +#line 1823 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } -#line 7822 "MachineIndependent/glslang_tab.cpp" +#line 7890 "MachineIndependent/glslang_tab.cpp" break; - case 226: /* type_specifier_nonarray: INT */ -#line 1810 "MachineIndependent/glslang.y" + case 228: /* type_specifier_nonarray: INT */ +#line 1827 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } -#line 7831 "MachineIndependent/glslang_tab.cpp" +#line 7899 "MachineIndependent/glslang_tab.cpp" break; - case 227: /* type_specifier_nonarray: UINT */ -#line 1814 "MachineIndependent/glslang.y" + case 229: /* type_specifier_nonarray: UINT */ +#line 1831 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; } -#line 7841 "MachineIndependent/glslang_tab.cpp" +#line 7909 "MachineIndependent/glslang_tab.cpp" break; - case 228: /* type_specifier_nonarray: BOOL */ -#line 1819 "MachineIndependent/glslang.y" + case 230: /* type_specifier_nonarray: BOOL */ +#line 1836 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; } -#line 7850 "MachineIndependent/glslang_tab.cpp" +#line 7918 "MachineIndependent/glslang_tab.cpp" break; - case 229: /* type_specifier_nonarray: VEC2 */ -#line 1823 "MachineIndependent/glslang.y" + case 231: /* type_specifier_nonarray: VEC2 */ +#line 1840 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(2); } -#line 7860 "MachineIndependent/glslang_tab.cpp" +#line 7928 "MachineIndependent/glslang_tab.cpp" break; - case 230: /* type_specifier_nonarray: VEC3 */ -#line 1828 "MachineIndependent/glslang.y" + case 232: /* type_specifier_nonarray: VEC3 */ +#line 1845 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(3); } -#line 7870 "MachineIndependent/glslang_tab.cpp" +#line 7938 "MachineIndependent/glslang_tab.cpp" break; - case 231: /* type_specifier_nonarray: VEC4 */ -#line 1833 "MachineIndependent/glslang.y" + case 233: /* type_specifier_nonarray: VEC4 */ +#line 1850 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(4); } -#line 7880 "MachineIndependent/glslang_tab.cpp" +#line 7948 "MachineIndependent/glslang_tab.cpp" break; - case 232: /* type_specifier_nonarray: BVEC2 */ -#line 1838 "MachineIndependent/glslang.y" + case 234: /* type_specifier_nonarray: BVEC2 */ +#line 1855 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(2); } -#line 7890 "MachineIndependent/glslang_tab.cpp" +#line 7958 "MachineIndependent/glslang_tab.cpp" break; - case 233: /* type_specifier_nonarray: BVEC3 */ -#line 1843 "MachineIndependent/glslang.y" + case 235: /* type_specifier_nonarray: BVEC3 */ +#line 1860 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(3); } -#line 7900 "MachineIndependent/glslang_tab.cpp" +#line 7968 "MachineIndependent/glslang_tab.cpp" break; - case 234: /* type_specifier_nonarray: BVEC4 */ -#line 1848 "MachineIndependent/glslang.y" + case 236: /* type_specifier_nonarray: BVEC4 */ +#line 1865 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(4); } -#line 7910 "MachineIndependent/glslang_tab.cpp" +#line 7978 "MachineIndependent/glslang_tab.cpp" break; - case 235: /* type_specifier_nonarray: IVEC2 */ -#line 1853 "MachineIndependent/glslang.y" + case 237: /* type_specifier_nonarray: IVEC2 */ +#line 1870 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(2); } -#line 7920 "MachineIndependent/glslang_tab.cpp" +#line 7988 "MachineIndependent/glslang_tab.cpp" break; - case 236: /* type_specifier_nonarray: IVEC3 */ -#line 1858 "MachineIndependent/glslang.y" + case 238: /* type_specifier_nonarray: IVEC3 */ +#line 1875 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(3); } -#line 7930 "MachineIndependent/glslang_tab.cpp" +#line 7998 "MachineIndependent/glslang_tab.cpp" break; - case 237: /* type_specifier_nonarray: IVEC4 */ -#line 1863 "MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(4); - } -#line 7940 "MachineIndependent/glslang_tab.cpp" - break; - - case 238: /* type_specifier_nonarray: UVEC2 */ -#line 1868 "MachineIndependent/glslang.y" - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(2); - } -#line 7951 "MachineIndependent/glslang_tab.cpp" - break; - - case 239: /* type_specifier_nonarray: UVEC3 */ -#line 1874 "MachineIndependent/glslang.y" - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(3); - } -#line 7962 "MachineIndependent/glslang_tab.cpp" - break; - - case 240: /* type_specifier_nonarray: UVEC4 */ + case 239: /* type_specifier_nonarray: IVEC4 */ #line 1880 "MachineIndependent/glslang.y" { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(4); + } +#line 8008 "MachineIndependent/glslang_tab.cpp" + break; + + case 240: /* type_specifier_nonarray: UVEC2 */ +#line 1885 "MachineIndependent/glslang.y" + { + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(2); + } +#line 8019 "MachineIndependent/glslang_tab.cpp" + break; + + case 241: /* type_specifier_nonarray: UVEC3 */ +#line 1891 "MachineIndependent/glslang.y" + { + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(3); + } +#line 8030 "MachineIndependent/glslang_tab.cpp" + break; + + case 242: /* type_specifier_nonarray: UVEC4 */ +#line 1897 "MachineIndependent/glslang.y" + { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; (yyval.interm.type).setVector(4); } -#line 7973 "MachineIndependent/glslang_tab.cpp" +#line 8041 "MachineIndependent/glslang_tab.cpp" break; - case 241: /* type_specifier_nonarray: MAT2 */ -#line 1886 "MachineIndependent/glslang.y" + case 243: /* type_specifier_nonarray: MAT2 */ +#line 1903 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 7983 "MachineIndependent/glslang_tab.cpp" +#line 8051 "MachineIndependent/glslang_tab.cpp" break; - case 242: /* type_specifier_nonarray: MAT3 */ -#line 1891 "MachineIndependent/glslang.y" + case 244: /* type_specifier_nonarray: MAT3 */ +#line 1908 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 7993 "MachineIndependent/glslang_tab.cpp" +#line 8061 "MachineIndependent/glslang_tab.cpp" break; - case 243: /* type_specifier_nonarray: MAT4 */ -#line 1896 "MachineIndependent/glslang.y" + case 245: /* type_specifier_nonarray: MAT4 */ +#line 1913 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 8003 "MachineIndependent/glslang_tab.cpp" +#line 8071 "MachineIndependent/glslang_tab.cpp" break; - case 244: /* type_specifier_nonarray: MAT2X2 */ -#line 1901 "MachineIndependent/glslang.y" + case 246: /* type_specifier_nonarray: MAT2X2 */ +#line 1918 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 8013 "MachineIndependent/glslang_tab.cpp" +#line 8081 "MachineIndependent/glslang_tab.cpp" break; - case 245: /* type_specifier_nonarray: MAT2X3 */ -#line 1906 "MachineIndependent/glslang.y" + case 247: /* type_specifier_nonarray: MAT2X3 */ +#line 1923 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 3); } -#line 8023 "MachineIndependent/glslang_tab.cpp" +#line 8091 "MachineIndependent/glslang_tab.cpp" break; - case 246: /* type_specifier_nonarray: MAT2X4 */ -#line 1911 "MachineIndependent/glslang.y" + case 248: /* type_specifier_nonarray: MAT2X4 */ +#line 1928 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 4); } -#line 8033 "MachineIndependent/glslang_tab.cpp" +#line 8101 "MachineIndependent/glslang_tab.cpp" break; - case 247: /* type_specifier_nonarray: MAT3X2 */ -#line 1916 "MachineIndependent/glslang.y" + case 249: /* type_specifier_nonarray: MAT3X2 */ +#line 1933 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 2); } -#line 8043 "MachineIndependent/glslang_tab.cpp" +#line 8111 "MachineIndependent/glslang_tab.cpp" break; - case 248: /* type_specifier_nonarray: MAT3X3 */ -#line 1921 "MachineIndependent/glslang.y" + case 250: /* type_specifier_nonarray: MAT3X3 */ +#line 1938 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 8053 "MachineIndependent/glslang_tab.cpp" +#line 8121 "MachineIndependent/glslang_tab.cpp" break; - case 249: /* type_specifier_nonarray: MAT3X4 */ -#line 1926 "MachineIndependent/glslang.y" + case 251: /* type_specifier_nonarray: MAT3X4 */ +#line 1943 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 4); } -#line 8063 "MachineIndependent/glslang_tab.cpp" +#line 8131 "MachineIndependent/glslang_tab.cpp" break; - case 250: /* type_specifier_nonarray: MAT4X2 */ -#line 1931 "MachineIndependent/glslang.y" + case 252: /* type_specifier_nonarray: MAT4X2 */ +#line 1948 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 2); } -#line 8073 "MachineIndependent/glslang_tab.cpp" +#line 8141 "MachineIndependent/glslang_tab.cpp" break; - case 251: /* type_specifier_nonarray: MAT4X3 */ -#line 1936 "MachineIndependent/glslang.y" + case 253: /* type_specifier_nonarray: MAT4X3 */ +#line 1953 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 3); } -#line 8083 "MachineIndependent/glslang_tab.cpp" +#line 8151 "MachineIndependent/glslang_tab.cpp" break; - case 252: /* type_specifier_nonarray: MAT4X4 */ -#line 1941 "MachineIndependent/glslang.y" + case 254: /* type_specifier_nonarray: MAT4X4 */ +#line 1958 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 8093 "MachineIndependent/glslang_tab.cpp" +#line 8161 "MachineIndependent/glslang_tab.cpp" break; - case 253: /* type_specifier_nonarray: DOUBLE */ -#line 1946 "MachineIndependent/glslang.y" + case 255: /* type_specifier_nonarray: DOUBLE */ +#line 1963 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8101,151 +8169,151 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; } -#line 8105 "MachineIndependent/glslang_tab.cpp" +#line 8173 "MachineIndependent/glslang_tab.cpp" break; - case 254: /* type_specifier_nonarray: BFLOAT16_T */ -#line 1953 "MachineIndependent/glslang.y" + case 256: /* type_specifier_nonarray: BFLOAT16_T */ +#line 1970 "MachineIndependent/glslang.y" { parseContext.bfloat16ScalarVectorCheck((yyvsp[0].lex).loc, "bfloat16_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBFloat16; } -#line 8115 "MachineIndependent/glslang_tab.cpp" +#line 8183 "MachineIndependent/glslang_tab.cpp" break; - case 255: /* type_specifier_nonarray: FLOATE5M2_T */ -#line 1958 "MachineIndependent/glslang.y" + case 257: /* type_specifier_nonarray: FLOATE5M2_T */ +#line 1975 "MachineIndependent/glslang.y" { parseContext.floate5m2ScalarVectorCheck((yyvsp[0].lex).loc, "floate5m2_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloatE5M2; } -#line 8125 "MachineIndependent/glslang_tab.cpp" +#line 8193 "MachineIndependent/glslang_tab.cpp" break; - case 256: /* type_specifier_nonarray: FLOATE4M3_T */ -#line 1963 "MachineIndependent/glslang.y" + case 258: /* type_specifier_nonarray: FLOATE4M3_T */ +#line 1980 "MachineIndependent/glslang.y" { parseContext.floate4m3ScalarVectorCheck((yyvsp[0].lex).loc, "floate4m3_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloatE4M3; } -#line 8135 "MachineIndependent/glslang_tab.cpp" +#line 8203 "MachineIndependent/glslang_tab.cpp" break; - case 257: /* type_specifier_nonarray: FLOAT16_T */ -#line 1968 "MachineIndependent/glslang.y" + case 259: /* type_specifier_nonarray: FLOAT16_T */ +#line 1985 "MachineIndependent/glslang.y" { parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; } -#line 8145 "MachineIndependent/glslang_tab.cpp" +#line 8213 "MachineIndependent/glslang_tab.cpp" break; - case 258: /* type_specifier_nonarray: FLOAT32_T */ -#line 1973 "MachineIndependent/glslang.y" + case 260: /* type_specifier_nonarray: FLOAT32_T */ +#line 1990 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } -#line 8155 "MachineIndependent/glslang_tab.cpp" +#line 8223 "MachineIndependent/glslang_tab.cpp" break; - case 259: /* type_specifier_nonarray: FLOAT64_T */ -#line 1978 "MachineIndependent/glslang.y" + case 261: /* type_specifier_nonarray: FLOAT64_T */ +#line 1995 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; } -#line 8165 "MachineIndependent/glslang_tab.cpp" +#line 8233 "MachineIndependent/glslang_tab.cpp" break; - case 260: /* type_specifier_nonarray: INT8_T */ -#line 1983 "MachineIndependent/glslang.y" + case 262: /* type_specifier_nonarray: INT8_T */ +#line 2000 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt8; } -#line 8175 "MachineIndependent/glslang_tab.cpp" +#line 8243 "MachineIndependent/glslang_tab.cpp" break; - case 261: /* type_specifier_nonarray: UINT8_T */ -#line 1988 "MachineIndependent/glslang.y" + case 263: /* type_specifier_nonarray: UINT8_T */ +#line 2005 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint8; } -#line 8185 "MachineIndependent/glslang_tab.cpp" +#line 8253 "MachineIndependent/glslang_tab.cpp" break; - case 262: /* type_specifier_nonarray: INT16_T */ -#line 1993 "MachineIndependent/glslang.y" + case 264: /* type_specifier_nonarray: INT16_T */ +#line 2010 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt16; } -#line 8195 "MachineIndependent/glslang_tab.cpp" +#line 8263 "MachineIndependent/glslang_tab.cpp" break; - case 263: /* type_specifier_nonarray: UINT16_T */ -#line 1998 "MachineIndependent/glslang.y" + case 265: /* type_specifier_nonarray: UINT16_T */ +#line 2015 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint16; } -#line 8205 "MachineIndependent/glslang_tab.cpp" +#line 8273 "MachineIndependent/glslang_tab.cpp" break; - case 264: /* type_specifier_nonarray: INT32_T */ -#line 2003 "MachineIndependent/glslang.y" + case 266: /* type_specifier_nonarray: INT32_T */ +#line 2020 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } -#line 8215 "MachineIndependent/glslang_tab.cpp" +#line 8283 "MachineIndependent/glslang_tab.cpp" break; - case 265: /* type_specifier_nonarray: UINT32_T */ -#line 2008 "MachineIndependent/glslang.y" + case 267: /* type_specifier_nonarray: UINT32_T */ +#line 2025 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; } -#line 8225 "MachineIndependent/glslang_tab.cpp" +#line 8293 "MachineIndependent/glslang_tab.cpp" break; - case 266: /* type_specifier_nonarray: INT64_T */ -#line 2013 "MachineIndependent/glslang.y" + case 268: /* type_specifier_nonarray: INT64_T */ +#line 2030 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; } -#line 8235 "MachineIndependent/glslang_tab.cpp" +#line 8303 "MachineIndependent/glslang_tab.cpp" break; - case 267: /* type_specifier_nonarray: UINT64_T */ -#line 2018 "MachineIndependent/glslang.y" + case 269: /* type_specifier_nonarray: UINT64_T */ +#line 2035 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint64; } -#line 8245 "MachineIndependent/glslang_tab.cpp" +#line 8313 "MachineIndependent/glslang_tab.cpp" break; - case 268: /* type_specifier_nonarray: DVEC2 */ -#line 2023 "MachineIndependent/glslang.y" + case 270: /* type_specifier_nonarray: DVEC2 */ +#line 2040 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8254,11 +8322,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(2); } -#line 8258 "MachineIndependent/glslang_tab.cpp" +#line 8326 "MachineIndependent/glslang_tab.cpp" break; - case 269: /* type_specifier_nonarray: DVEC3 */ -#line 2031 "MachineIndependent/glslang.y" + case 271: /* type_specifier_nonarray: DVEC3 */ +#line 2048 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8267,499 +8335,499 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(3); } -#line 8271 "MachineIndependent/glslang_tab.cpp" - break; - - case 270: /* type_specifier_nonarray: DVEC4 */ -#line 2039 "MachineIndependent/glslang.y" - { - parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(4); - } -#line 8284 "MachineIndependent/glslang_tab.cpp" - break; - - case 271: /* type_specifier_nonarray: BF16VEC2 */ -#line 2047 "MachineIndependent/glslang.y" - { - parseContext.bfloat16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBFloat16; - (yyval.interm.type).setVector(2); - } -#line 8295 "MachineIndependent/glslang_tab.cpp" - break; - - case 272: /* type_specifier_nonarray: BF16VEC3 */ -#line 2053 "MachineIndependent/glslang.y" - { - parseContext.bfloat16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBFloat16; - (yyval.interm.type).setVector(3); - } -#line 8306 "MachineIndependent/glslang_tab.cpp" - break; - - case 273: /* type_specifier_nonarray: BF16VEC4 */ -#line 2059 "MachineIndependent/glslang.y" - { - parseContext.bfloat16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBFloat16; - (yyval.interm.type).setVector(4); - } -#line 8317 "MachineIndependent/glslang_tab.cpp" - break; - - case 274: /* type_specifier_nonarray: FE5M2VEC2 */ -#line 2065 "MachineIndependent/glslang.y" - { - parseContext.floate5m2ScalarVectorCheck((yyvsp[0].lex).loc, "fe5m2 vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloatE5M2; - (yyval.interm.type).setVector(2); - } -#line 8328 "MachineIndependent/glslang_tab.cpp" - break; - - case 275: /* type_specifier_nonarray: FE5M2VEC3 */ -#line 2071 "MachineIndependent/glslang.y" - { - parseContext.floate5m2ScalarVectorCheck((yyvsp[0].lex).loc, "fe5m2 vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloatE5M2; - (yyval.interm.type).setVector(3); - } #line 8339 "MachineIndependent/glslang_tab.cpp" break; - case 276: /* type_specifier_nonarray: FE5M2VEC4 */ -#line 2077 "MachineIndependent/glslang.y" + case 272: /* type_specifier_nonarray: DVEC4 */ +#line 2056 "MachineIndependent/glslang.y" + { + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(4); + } +#line 8352 "MachineIndependent/glslang_tab.cpp" + break; + + case 273: /* type_specifier_nonarray: BF16VEC2 */ +#line 2064 "MachineIndependent/glslang.y" + { + parseContext.bfloat16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBFloat16; + (yyval.interm.type).setVector(2); + } +#line 8363 "MachineIndependent/glslang_tab.cpp" + break; + + case 274: /* type_specifier_nonarray: BF16VEC3 */ +#line 2070 "MachineIndependent/glslang.y" + { + parseContext.bfloat16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBFloat16; + (yyval.interm.type).setVector(3); + } +#line 8374 "MachineIndependent/glslang_tab.cpp" + break; + + case 275: /* type_specifier_nonarray: BF16VEC4 */ +#line 2076 "MachineIndependent/glslang.y" + { + parseContext.bfloat16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBFloat16; + (yyval.interm.type).setVector(4); + } +#line 8385 "MachineIndependent/glslang_tab.cpp" + break; + + case 276: /* type_specifier_nonarray: FE5M2VEC2 */ +#line 2082 "MachineIndependent/glslang.y" + { + parseContext.floate5m2ScalarVectorCheck((yyvsp[0].lex).loc, "fe5m2 vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloatE5M2; + (yyval.interm.type).setVector(2); + } +#line 8396 "MachineIndependent/glslang_tab.cpp" + break; + + case 277: /* type_specifier_nonarray: FE5M2VEC3 */ +#line 2088 "MachineIndependent/glslang.y" + { + parseContext.floate5m2ScalarVectorCheck((yyvsp[0].lex).loc, "fe5m2 vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloatE5M2; + (yyval.interm.type).setVector(3); + } +#line 8407 "MachineIndependent/glslang_tab.cpp" + break; + + case 278: /* type_specifier_nonarray: FE5M2VEC4 */ +#line 2094 "MachineIndependent/glslang.y" { parseContext.floate5m2ScalarVectorCheck((yyvsp[0].lex).loc, "fe5m2 vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloatE5M2; (yyval.interm.type).setVector(4); } -#line 8350 "MachineIndependent/glslang_tab.cpp" +#line 8418 "MachineIndependent/glslang_tab.cpp" break; - case 277: /* type_specifier_nonarray: FE4M3VEC2 */ -#line 2083 "MachineIndependent/glslang.y" + case 279: /* type_specifier_nonarray: FE4M3VEC2 */ +#line 2100 "MachineIndependent/glslang.y" { parseContext.floate4m3ScalarVectorCheck((yyvsp[0].lex).loc, "fe4m3 vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloatE4M3; (yyval.interm.type).setVector(2); } -#line 8361 "MachineIndependent/glslang_tab.cpp" +#line 8429 "MachineIndependent/glslang_tab.cpp" break; - case 278: /* type_specifier_nonarray: FE4M3VEC3 */ -#line 2089 "MachineIndependent/glslang.y" + case 280: /* type_specifier_nonarray: FE4M3VEC3 */ +#line 2106 "MachineIndependent/glslang.y" { parseContext.floate4m3ScalarVectorCheck((yyvsp[0].lex).loc, "fe4m3 vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloatE4M3; (yyval.interm.type).setVector(3); } -#line 8372 "MachineIndependent/glslang_tab.cpp" +#line 8440 "MachineIndependent/glslang_tab.cpp" break; - case 279: /* type_specifier_nonarray: FE4M3VEC4 */ -#line 2095 "MachineIndependent/glslang.y" + case 281: /* type_specifier_nonarray: FE4M3VEC4 */ +#line 2112 "MachineIndependent/glslang.y" { parseContext.floate4m3ScalarVectorCheck((yyvsp[0].lex).loc, "fe4m3 vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloatE4M3; (yyval.interm.type).setVector(4); } -#line 8383 "MachineIndependent/glslang_tab.cpp" +#line 8451 "MachineIndependent/glslang_tab.cpp" break; - case 280: /* type_specifier_nonarray: F16VEC2 */ -#line 2101 "MachineIndependent/glslang.y" + case 282: /* type_specifier_nonarray: F16VEC2 */ +#line 2118 "MachineIndependent/glslang.y" { parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(2); } -#line 8394 "MachineIndependent/glslang_tab.cpp" +#line 8462 "MachineIndependent/glslang_tab.cpp" break; - case 281: /* type_specifier_nonarray: F16VEC3 */ -#line 2107 "MachineIndependent/glslang.y" + case 283: /* type_specifier_nonarray: F16VEC3 */ +#line 2124 "MachineIndependent/glslang.y" { parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(3); } -#line 8405 "MachineIndependent/glslang_tab.cpp" +#line 8473 "MachineIndependent/glslang_tab.cpp" break; - case 282: /* type_specifier_nonarray: F16VEC4 */ -#line 2113 "MachineIndependent/glslang.y" + case 284: /* type_specifier_nonarray: F16VEC4 */ +#line 2130 "MachineIndependent/glslang.y" { parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(4); } -#line 8416 "MachineIndependent/glslang_tab.cpp" +#line 8484 "MachineIndependent/glslang_tab.cpp" break; - case 283: /* type_specifier_nonarray: F32VEC2 */ -#line 2119 "MachineIndependent/glslang.y" + case 285: /* type_specifier_nonarray: F32VEC2 */ +#line 2136 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(2); } -#line 8427 "MachineIndependent/glslang_tab.cpp" +#line 8495 "MachineIndependent/glslang_tab.cpp" break; - case 284: /* type_specifier_nonarray: F32VEC3 */ -#line 2125 "MachineIndependent/glslang.y" + case 286: /* type_specifier_nonarray: F32VEC3 */ +#line 2142 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(3); } -#line 8438 "MachineIndependent/glslang_tab.cpp" +#line 8506 "MachineIndependent/glslang_tab.cpp" break; - case 285: /* type_specifier_nonarray: F32VEC4 */ -#line 2131 "MachineIndependent/glslang.y" + case 287: /* type_specifier_nonarray: F32VEC4 */ +#line 2148 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(4); } -#line 8449 "MachineIndependent/glslang_tab.cpp" +#line 8517 "MachineIndependent/glslang_tab.cpp" break; - case 286: /* type_specifier_nonarray: F64VEC2 */ -#line 2137 "MachineIndependent/glslang.y" + case 288: /* type_specifier_nonarray: F64VEC2 */ +#line 2154 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(2); } -#line 8460 "MachineIndependent/glslang_tab.cpp" +#line 8528 "MachineIndependent/glslang_tab.cpp" break; - case 287: /* type_specifier_nonarray: F64VEC3 */ -#line 2143 "MachineIndependent/glslang.y" + case 289: /* type_specifier_nonarray: F64VEC3 */ +#line 2160 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(3); } -#line 8471 "MachineIndependent/glslang_tab.cpp" +#line 8539 "MachineIndependent/glslang_tab.cpp" break; - case 288: /* type_specifier_nonarray: F64VEC4 */ -#line 2149 "MachineIndependent/glslang.y" + case 290: /* type_specifier_nonarray: F64VEC4 */ +#line 2166 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(4); } -#line 8482 "MachineIndependent/glslang_tab.cpp" +#line 8550 "MachineIndependent/glslang_tab.cpp" break; - case 289: /* type_specifier_nonarray: I8VEC2 */ -#line 2155 "MachineIndependent/glslang.y" + case 291: /* type_specifier_nonarray: I8VEC2 */ +#line 2172 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(2); } -#line 8493 "MachineIndependent/glslang_tab.cpp" +#line 8561 "MachineIndependent/glslang_tab.cpp" break; - case 290: /* type_specifier_nonarray: I8VEC3 */ -#line 2161 "MachineIndependent/glslang.y" + case 292: /* type_specifier_nonarray: I8VEC3 */ +#line 2178 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(3); } -#line 8504 "MachineIndependent/glslang_tab.cpp" +#line 8572 "MachineIndependent/glslang_tab.cpp" break; - case 291: /* type_specifier_nonarray: I8VEC4 */ -#line 2167 "MachineIndependent/glslang.y" + case 293: /* type_specifier_nonarray: I8VEC4 */ +#line 2184 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(4); } -#line 8515 "MachineIndependent/glslang_tab.cpp" +#line 8583 "MachineIndependent/glslang_tab.cpp" break; - case 292: /* type_specifier_nonarray: I16VEC2 */ -#line 2173 "MachineIndependent/glslang.y" + case 294: /* type_specifier_nonarray: I16VEC2 */ +#line 2190 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(2); } -#line 8526 "MachineIndependent/glslang_tab.cpp" +#line 8594 "MachineIndependent/glslang_tab.cpp" break; - case 293: /* type_specifier_nonarray: I16VEC3 */ -#line 2179 "MachineIndependent/glslang.y" + case 295: /* type_specifier_nonarray: I16VEC3 */ +#line 2196 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(3); } -#line 8537 "MachineIndependent/glslang_tab.cpp" +#line 8605 "MachineIndependent/glslang_tab.cpp" break; - case 294: /* type_specifier_nonarray: I16VEC4 */ -#line 2185 "MachineIndependent/glslang.y" + case 296: /* type_specifier_nonarray: I16VEC4 */ +#line 2202 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(4); } -#line 8548 "MachineIndependent/glslang_tab.cpp" +#line 8616 "MachineIndependent/glslang_tab.cpp" break; - case 295: /* type_specifier_nonarray: I32VEC2 */ -#line 2191 "MachineIndependent/glslang.y" + case 297: /* type_specifier_nonarray: I32VEC2 */ +#line 2208 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(2); } -#line 8559 "MachineIndependent/glslang_tab.cpp" +#line 8627 "MachineIndependent/glslang_tab.cpp" break; - case 296: /* type_specifier_nonarray: I32VEC3 */ -#line 2197 "MachineIndependent/glslang.y" + case 298: /* type_specifier_nonarray: I32VEC3 */ +#line 2214 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(3); } -#line 8570 "MachineIndependent/glslang_tab.cpp" +#line 8638 "MachineIndependent/glslang_tab.cpp" break; - case 297: /* type_specifier_nonarray: I32VEC4 */ -#line 2203 "MachineIndependent/glslang.y" + case 299: /* type_specifier_nonarray: I32VEC4 */ +#line 2220 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(4); } -#line 8581 "MachineIndependent/glslang_tab.cpp" +#line 8649 "MachineIndependent/glslang_tab.cpp" break; - case 298: /* type_specifier_nonarray: I64VEC2 */ -#line 2209 "MachineIndependent/glslang.y" + case 300: /* type_specifier_nonarray: I64VEC2 */ +#line 2226 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(2); } -#line 8592 "MachineIndependent/glslang_tab.cpp" +#line 8660 "MachineIndependent/glslang_tab.cpp" break; - case 299: /* type_specifier_nonarray: I64VEC3 */ -#line 2215 "MachineIndependent/glslang.y" + case 301: /* type_specifier_nonarray: I64VEC3 */ +#line 2232 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(3); } -#line 8603 "MachineIndependent/glslang_tab.cpp" +#line 8671 "MachineIndependent/glslang_tab.cpp" break; - case 300: /* type_specifier_nonarray: I64VEC4 */ -#line 2221 "MachineIndependent/glslang.y" + case 302: /* type_specifier_nonarray: I64VEC4 */ +#line 2238 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(4); } -#line 8614 "MachineIndependent/glslang_tab.cpp" +#line 8682 "MachineIndependent/glslang_tab.cpp" break; - case 301: /* type_specifier_nonarray: U8VEC2 */ -#line 2227 "MachineIndependent/glslang.y" + case 303: /* type_specifier_nonarray: U8VEC2 */ +#line 2244 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint8; (yyval.interm.type).setVector(2); } -#line 8625 "MachineIndependent/glslang_tab.cpp" +#line 8693 "MachineIndependent/glslang_tab.cpp" break; - case 302: /* type_specifier_nonarray: U8VEC3 */ -#line 2233 "MachineIndependent/glslang.y" + case 304: /* type_specifier_nonarray: U8VEC3 */ +#line 2250 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint8; (yyval.interm.type).setVector(3); } -#line 8636 "MachineIndependent/glslang_tab.cpp" +#line 8704 "MachineIndependent/glslang_tab.cpp" break; - case 303: /* type_specifier_nonarray: U8VEC4 */ -#line 2239 "MachineIndependent/glslang.y" + case 305: /* type_specifier_nonarray: U8VEC4 */ +#line 2256 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint8; (yyval.interm.type).setVector(4); } -#line 8647 "MachineIndependent/glslang_tab.cpp" +#line 8715 "MachineIndependent/glslang_tab.cpp" break; - case 304: /* type_specifier_nonarray: U16VEC2 */ -#line 2245 "MachineIndependent/glslang.y" + case 306: /* type_specifier_nonarray: U16VEC2 */ +#line 2262 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint16; (yyval.interm.type).setVector(2); } -#line 8658 "MachineIndependent/glslang_tab.cpp" +#line 8726 "MachineIndependent/glslang_tab.cpp" break; - case 305: /* type_specifier_nonarray: U16VEC3 */ -#line 2251 "MachineIndependent/glslang.y" + case 307: /* type_specifier_nonarray: U16VEC3 */ +#line 2268 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint16; (yyval.interm.type).setVector(3); } -#line 8669 "MachineIndependent/glslang_tab.cpp" +#line 8737 "MachineIndependent/glslang_tab.cpp" break; - case 306: /* type_specifier_nonarray: U16VEC4 */ -#line 2257 "MachineIndependent/glslang.y" + case 308: /* type_specifier_nonarray: U16VEC4 */ +#line 2274 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint16; (yyval.interm.type).setVector(4); } -#line 8680 "MachineIndependent/glslang_tab.cpp" +#line 8748 "MachineIndependent/glslang_tab.cpp" break; - case 307: /* type_specifier_nonarray: U32VEC2 */ -#line 2263 "MachineIndependent/glslang.y" + case 309: /* type_specifier_nonarray: U32VEC2 */ +#line 2280 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; (yyval.interm.type).setVector(2); } -#line 8691 "MachineIndependent/glslang_tab.cpp" - break; - - case 308: /* type_specifier_nonarray: U32VEC3 */ -#line 2269 "MachineIndependent/glslang.y" - { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(3); - } -#line 8702 "MachineIndependent/glslang_tab.cpp" - break; - - case 309: /* type_specifier_nonarray: U32VEC4 */ -#line 2275 "MachineIndependent/glslang.y" - { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(4); - } -#line 8713 "MachineIndependent/glslang_tab.cpp" - break; - - case 310: /* type_specifier_nonarray: U64VEC2 */ -#line 2281 "MachineIndependent/glslang.y" - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - (yyval.interm.type).setVector(2); - } -#line 8724 "MachineIndependent/glslang_tab.cpp" - break; - - case 311: /* type_specifier_nonarray: U64VEC3 */ -#line 2287 "MachineIndependent/glslang.y" - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - (yyval.interm.type).setVector(3); - } -#line 8735 "MachineIndependent/glslang_tab.cpp" - break; - - case 312: /* type_specifier_nonarray: U64VEC4 */ -#line 2293 "MachineIndependent/glslang.y" - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - (yyval.interm.type).setVector(4); - } -#line 8746 "MachineIndependent/glslang_tab.cpp" - break; - - case 313: /* type_specifier_nonarray: DMAT2 */ -#line 2299 "MachineIndependent/glslang.y" - { - parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(2, 2); - } #line 8759 "MachineIndependent/glslang_tab.cpp" break; - case 314: /* type_specifier_nonarray: DMAT3 */ -#line 2307 "MachineIndependent/glslang.y" + case 310: /* type_specifier_nonarray: U32VEC3 */ +#line 2286 "MachineIndependent/glslang.y" + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(3); + } +#line 8770 "MachineIndependent/glslang_tab.cpp" + break; + + case 311: /* type_specifier_nonarray: U32VEC4 */ +#line 2292 "MachineIndependent/glslang.y" + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(4); + } +#line 8781 "MachineIndependent/glslang_tab.cpp" + break; + + case 312: /* type_specifier_nonarray: U64VEC2 */ +#line 2298 "MachineIndependent/glslang.y" + { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(2); + } +#line 8792 "MachineIndependent/glslang_tab.cpp" + break; + + case 313: /* type_specifier_nonarray: U64VEC3 */ +#line 2304 "MachineIndependent/glslang.y" + { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(3); + } +#line 8803 "MachineIndependent/glslang_tab.cpp" + break; + + case 314: /* type_specifier_nonarray: U64VEC4 */ +#line 2310 "MachineIndependent/glslang.y" + { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(4); + } +#line 8814 "MachineIndependent/glslang_tab.cpp" + break; + + case 315: /* type_specifier_nonarray: DMAT2 */ +#line 2316 "MachineIndependent/glslang.y" + { + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(2, 2); + } +#line 8827 "MachineIndependent/glslang_tab.cpp" + break; + + case 316: /* type_specifier_nonarray: DMAT3 */ +#line 2324 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8768,11 +8836,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 8772 "MachineIndependent/glslang_tab.cpp" +#line 8840 "MachineIndependent/glslang_tab.cpp" break; - case 315: /* type_specifier_nonarray: DMAT4 */ -#line 2315 "MachineIndependent/glslang.y" + case 317: /* type_specifier_nonarray: DMAT4 */ +#line 2332 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8781,11 +8849,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 8785 "MachineIndependent/glslang_tab.cpp" +#line 8853 "MachineIndependent/glslang_tab.cpp" break; - case 316: /* type_specifier_nonarray: DMAT2X2 */ -#line 2323 "MachineIndependent/glslang.y" + case 318: /* type_specifier_nonarray: DMAT2X2 */ +#line 2340 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8794,11 +8862,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 8798 "MachineIndependent/glslang_tab.cpp" +#line 8866 "MachineIndependent/glslang_tab.cpp" break; - case 317: /* type_specifier_nonarray: DMAT2X3 */ -#line 2331 "MachineIndependent/glslang.y" + case 319: /* type_specifier_nonarray: DMAT2X3 */ +#line 2348 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8807,11 +8875,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 3); } -#line 8811 "MachineIndependent/glslang_tab.cpp" +#line 8879 "MachineIndependent/glslang_tab.cpp" break; - case 318: /* type_specifier_nonarray: DMAT2X4 */ -#line 2339 "MachineIndependent/glslang.y" + case 320: /* type_specifier_nonarray: DMAT2X4 */ +#line 2356 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8820,11 +8888,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 4); } -#line 8824 "MachineIndependent/glslang_tab.cpp" +#line 8892 "MachineIndependent/glslang_tab.cpp" break; - case 319: /* type_specifier_nonarray: DMAT3X2 */ -#line 2347 "MachineIndependent/glslang.y" + case 321: /* type_specifier_nonarray: DMAT3X2 */ +#line 2364 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8833,11 +8901,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 2); } -#line 8837 "MachineIndependent/glslang_tab.cpp" +#line 8905 "MachineIndependent/glslang_tab.cpp" break; - case 320: /* type_specifier_nonarray: DMAT3X3 */ -#line 2355 "MachineIndependent/glslang.y" + case 322: /* type_specifier_nonarray: DMAT3X3 */ +#line 2372 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8846,11 +8914,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 8850 "MachineIndependent/glslang_tab.cpp" +#line 8918 "MachineIndependent/glslang_tab.cpp" break; - case 321: /* type_specifier_nonarray: DMAT3X4 */ -#line 2363 "MachineIndependent/glslang.y" + case 323: /* type_specifier_nonarray: DMAT3X4 */ +#line 2380 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8859,11 +8927,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 4); } -#line 8863 "MachineIndependent/glslang_tab.cpp" +#line 8931 "MachineIndependent/glslang_tab.cpp" break; - case 322: /* type_specifier_nonarray: DMAT4X2 */ -#line 2371 "MachineIndependent/glslang.y" + case 324: /* type_specifier_nonarray: DMAT4X2 */ +#line 2388 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8872,11 +8940,11 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 2); } -#line 8876 "MachineIndependent/glslang_tab.cpp" +#line 8944 "MachineIndependent/glslang_tab.cpp" break; - case 323: /* type_specifier_nonarray: DMAT4X3 */ -#line 2379 "MachineIndependent/glslang.y" + case 325: /* type_specifier_nonarray: DMAT4X3 */ +#line 2396 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8885,2274 +8953,2274 @@ yyreduce: (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 3); } -#line 8889 "MachineIndependent/glslang_tab.cpp" - break; - - case 324: /* type_specifier_nonarray: DMAT4X4 */ -#line 2387 "MachineIndependent/glslang.y" - { - parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(4, 4); - } -#line 8902 "MachineIndependent/glslang_tab.cpp" - break; - - case 325: /* type_specifier_nonarray: F16MAT2 */ -#line 2395 "MachineIndependent/glslang.y" - { - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(2, 2); - } -#line 8913 "MachineIndependent/glslang_tab.cpp" - break; - - case 326: /* type_specifier_nonarray: F16MAT3 */ -#line 2401 "MachineIndependent/glslang.y" - { - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(3, 3); - } -#line 8924 "MachineIndependent/glslang_tab.cpp" - break; - - case 327: /* type_specifier_nonarray: F16MAT4 */ -#line 2407 "MachineIndependent/glslang.y" - { - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(4, 4); - } -#line 8935 "MachineIndependent/glslang_tab.cpp" - break; - - case 328: /* type_specifier_nonarray: F16MAT2X2 */ -#line 2413 "MachineIndependent/glslang.y" - { - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(2, 2); - } -#line 8946 "MachineIndependent/glslang_tab.cpp" - break; - - case 329: /* type_specifier_nonarray: F16MAT2X3 */ -#line 2419 "MachineIndependent/glslang.y" - { - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(2, 3); - } #line 8957 "MachineIndependent/glslang_tab.cpp" break; - case 330: /* type_specifier_nonarray: F16MAT2X4 */ -#line 2425 "MachineIndependent/glslang.y" + case 326: /* type_specifier_nonarray: DMAT4X4 */ +#line 2404 "MachineIndependent/glslang.y" + { + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(4, 4); + } +#line 8970 "MachineIndependent/glslang_tab.cpp" + break; + + case 327: /* type_specifier_nonarray: F16MAT2 */ +#line 2412 "MachineIndependent/glslang.y" + { + parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).setMatrix(2, 2); + } +#line 8981 "MachineIndependent/glslang_tab.cpp" + break; + + case 328: /* type_specifier_nonarray: F16MAT3 */ +#line 2418 "MachineIndependent/glslang.y" + { + parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).setMatrix(3, 3); + } +#line 8992 "MachineIndependent/glslang_tab.cpp" + break; + + case 329: /* type_specifier_nonarray: F16MAT4 */ +#line 2424 "MachineIndependent/glslang.y" + { + parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).setMatrix(4, 4); + } +#line 9003 "MachineIndependent/glslang_tab.cpp" + break; + + case 330: /* type_specifier_nonarray: F16MAT2X2 */ +#line 2430 "MachineIndependent/glslang.y" + { + parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).setMatrix(2, 2); + } +#line 9014 "MachineIndependent/glslang_tab.cpp" + break; + + case 331: /* type_specifier_nonarray: F16MAT2X3 */ +#line 2436 "MachineIndependent/glslang.y" + { + parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).setMatrix(2, 3); + } +#line 9025 "MachineIndependent/glslang_tab.cpp" + break; + + case 332: /* type_specifier_nonarray: F16MAT2X4 */ +#line 2442 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 4); } -#line 8968 "MachineIndependent/glslang_tab.cpp" +#line 9036 "MachineIndependent/glslang_tab.cpp" break; - case 331: /* type_specifier_nonarray: F16MAT3X2 */ -#line 2431 "MachineIndependent/glslang.y" + case 333: /* type_specifier_nonarray: F16MAT3X2 */ +#line 2448 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 2); } -#line 8979 "MachineIndependent/glslang_tab.cpp" +#line 9047 "MachineIndependent/glslang_tab.cpp" break; - case 332: /* type_specifier_nonarray: F16MAT3X3 */ -#line 2437 "MachineIndependent/glslang.y" + case 334: /* type_specifier_nonarray: F16MAT3X3 */ +#line 2454 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 3); } -#line 8990 "MachineIndependent/glslang_tab.cpp" +#line 9058 "MachineIndependent/glslang_tab.cpp" break; - case 333: /* type_specifier_nonarray: F16MAT3X4 */ -#line 2443 "MachineIndependent/glslang.y" + case 335: /* type_specifier_nonarray: F16MAT3X4 */ +#line 2460 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 4); } -#line 9001 "MachineIndependent/glslang_tab.cpp" +#line 9069 "MachineIndependent/glslang_tab.cpp" break; - case 334: /* type_specifier_nonarray: F16MAT4X2 */ -#line 2449 "MachineIndependent/glslang.y" + case 336: /* type_specifier_nonarray: F16MAT4X2 */ +#line 2466 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 2); } -#line 9012 "MachineIndependent/glslang_tab.cpp" +#line 9080 "MachineIndependent/glslang_tab.cpp" break; - case 335: /* type_specifier_nonarray: F16MAT4X3 */ -#line 2455 "MachineIndependent/glslang.y" + case 337: /* type_specifier_nonarray: F16MAT4X3 */ +#line 2472 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 3); } -#line 9023 "MachineIndependent/glslang_tab.cpp" +#line 9091 "MachineIndependent/glslang_tab.cpp" break; - case 336: /* type_specifier_nonarray: F16MAT4X4 */ -#line 2461 "MachineIndependent/glslang.y" + case 338: /* type_specifier_nonarray: F16MAT4X4 */ +#line 2478 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 4); } -#line 9034 "MachineIndependent/glslang_tab.cpp" +#line 9102 "MachineIndependent/glslang_tab.cpp" break; - case 337: /* type_specifier_nonarray: F32MAT2 */ -#line 2467 "MachineIndependent/glslang.y" + case 339: /* type_specifier_nonarray: F32MAT2 */ +#line 2484 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 9045 "MachineIndependent/glslang_tab.cpp" +#line 9113 "MachineIndependent/glslang_tab.cpp" break; - case 338: /* type_specifier_nonarray: F32MAT3 */ -#line 2473 "MachineIndependent/glslang.y" + case 340: /* type_specifier_nonarray: F32MAT3 */ +#line 2490 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 9056 "MachineIndependent/glslang_tab.cpp" +#line 9124 "MachineIndependent/glslang_tab.cpp" break; - case 339: /* type_specifier_nonarray: F32MAT4 */ -#line 2479 "MachineIndependent/glslang.y" + case 341: /* type_specifier_nonarray: F32MAT4 */ +#line 2496 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 9067 "MachineIndependent/glslang_tab.cpp" +#line 9135 "MachineIndependent/glslang_tab.cpp" break; - case 340: /* type_specifier_nonarray: F32MAT2X2 */ -#line 2485 "MachineIndependent/glslang.y" + case 342: /* type_specifier_nonarray: F32MAT2X2 */ +#line 2502 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 9078 "MachineIndependent/glslang_tab.cpp" +#line 9146 "MachineIndependent/glslang_tab.cpp" break; - case 341: /* type_specifier_nonarray: F32MAT2X3 */ -#line 2491 "MachineIndependent/glslang.y" + case 343: /* type_specifier_nonarray: F32MAT2X3 */ +#line 2508 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 3); } -#line 9089 "MachineIndependent/glslang_tab.cpp" +#line 9157 "MachineIndependent/glslang_tab.cpp" break; - case 342: /* type_specifier_nonarray: F32MAT2X4 */ -#line 2497 "MachineIndependent/glslang.y" + case 344: /* type_specifier_nonarray: F32MAT2X4 */ +#line 2514 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 4); } -#line 9100 "MachineIndependent/glslang_tab.cpp" +#line 9168 "MachineIndependent/glslang_tab.cpp" break; - case 343: /* type_specifier_nonarray: F32MAT3X2 */ -#line 2503 "MachineIndependent/glslang.y" + case 345: /* type_specifier_nonarray: F32MAT3X2 */ +#line 2520 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 2); } -#line 9111 "MachineIndependent/glslang_tab.cpp" +#line 9179 "MachineIndependent/glslang_tab.cpp" break; - case 344: /* type_specifier_nonarray: F32MAT3X3 */ -#line 2509 "MachineIndependent/glslang.y" + case 346: /* type_specifier_nonarray: F32MAT3X3 */ +#line 2526 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 9122 "MachineIndependent/glslang_tab.cpp" +#line 9190 "MachineIndependent/glslang_tab.cpp" break; - case 345: /* type_specifier_nonarray: F32MAT3X4 */ -#line 2515 "MachineIndependent/glslang.y" + case 347: /* type_specifier_nonarray: F32MAT3X4 */ +#line 2532 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 4); } -#line 9133 "MachineIndependent/glslang_tab.cpp" +#line 9201 "MachineIndependent/glslang_tab.cpp" break; - case 346: /* type_specifier_nonarray: F32MAT4X2 */ -#line 2521 "MachineIndependent/glslang.y" + case 348: /* type_specifier_nonarray: F32MAT4X2 */ +#line 2538 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 2); } -#line 9144 "MachineIndependent/glslang_tab.cpp" +#line 9212 "MachineIndependent/glslang_tab.cpp" break; - case 347: /* type_specifier_nonarray: F32MAT4X3 */ -#line 2527 "MachineIndependent/glslang.y" + case 349: /* type_specifier_nonarray: F32MAT4X3 */ +#line 2544 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 3); } -#line 9155 "MachineIndependent/glslang_tab.cpp" +#line 9223 "MachineIndependent/glslang_tab.cpp" break; - case 348: /* type_specifier_nonarray: F32MAT4X4 */ -#line 2533 "MachineIndependent/glslang.y" + case 350: /* type_specifier_nonarray: F32MAT4X4 */ +#line 2550 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 9166 "MachineIndependent/glslang_tab.cpp" +#line 9234 "MachineIndependent/glslang_tab.cpp" break; - case 349: /* type_specifier_nonarray: F64MAT2 */ -#line 2539 "MachineIndependent/glslang.y" + case 351: /* type_specifier_nonarray: F64MAT2 */ +#line 2556 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 9177 "MachineIndependent/glslang_tab.cpp" +#line 9245 "MachineIndependent/glslang_tab.cpp" break; - case 350: /* type_specifier_nonarray: F64MAT3 */ -#line 2545 "MachineIndependent/glslang.y" + case 352: /* type_specifier_nonarray: F64MAT3 */ +#line 2562 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 9188 "MachineIndependent/glslang_tab.cpp" +#line 9256 "MachineIndependent/glslang_tab.cpp" break; - case 351: /* type_specifier_nonarray: F64MAT4 */ -#line 2551 "MachineIndependent/glslang.y" + case 353: /* type_specifier_nonarray: F64MAT4 */ +#line 2568 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 9199 "MachineIndependent/glslang_tab.cpp" +#line 9267 "MachineIndependent/glslang_tab.cpp" break; - case 352: /* type_specifier_nonarray: F64MAT2X2 */ -#line 2557 "MachineIndependent/glslang.y" + case 354: /* type_specifier_nonarray: F64MAT2X2 */ +#line 2574 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 9210 "MachineIndependent/glslang_tab.cpp" +#line 9278 "MachineIndependent/glslang_tab.cpp" break; - case 353: /* type_specifier_nonarray: F64MAT2X3 */ -#line 2563 "MachineIndependent/glslang.y" + case 355: /* type_specifier_nonarray: F64MAT2X3 */ +#line 2580 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 3); } -#line 9221 "MachineIndependent/glslang_tab.cpp" +#line 9289 "MachineIndependent/glslang_tab.cpp" break; - case 354: /* type_specifier_nonarray: F64MAT2X4 */ -#line 2569 "MachineIndependent/glslang.y" + case 356: /* type_specifier_nonarray: F64MAT2X4 */ +#line 2586 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 4); } -#line 9232 "MachineIndependent/glslang_tab.cpp" +#line 9300 "MachineIndependent/glslang_tab.cpp" break; - case 355: /* type_specifier_nonarray: F64MAT3X2 */ -#line 2575 "MachineIndependent/glslang.y" + case 357: /* type_specifier_nonarray: F64MAT3X2 */ +#line 2592 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 2); } -#line 9243 "MachineIndependent/glslang_tab.cpp" +#line 9311 "MachineIndependent/glslang_tab.cpp" break; - case 356: /* type_specifier_nonarray: F64MAT3X3 */ -#line 2581 "MachineIndependent/glslang.y" + case 358: /* type_specifier_nonarray: F64MAT3X3 */ +#line 2598 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 9254 "MachineIndependent/glslang_tab.cpp" +#line 9322 "MachineIndependent/glslang_tab.cpp" break; - case 357: /* type_specifier_nonarray: F64MAT3X4 */ -#line 2587 "MachineIndependent/glslang.y" + case 359: /* type_specifier_nonarray: F64MAT3X4 */ +#line 2604 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 4); } -#line 9265 "MachineIndependent/glslang_tab.cpp" +#line 9333 "MachineIndependent/glslang_tab.cpp" break; - case 358: /* type_specifier_nonarray: F64MAT4X2 */ -#line 2593 "MachineIndependent/glslang.y" + case 360: /* type_specifier_nonarray: F64MAT4X2 */ +#line 2610 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 2); } -#line 9276 "MachineIndependent/glslang_tab.cpp" +#line 9344 "MachineIndependent/glslang_tab.cpp" break; - case 359: /* type_specifier_nonarray: F64MAT4X3 */ -#line 2599 "MachineIndependent/glslang.y" + case 361: /* type_specifier_nonarray: F64MAT4X3 */ +#line 2616 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 3); } -#line 9287 "MachineIndependent/glslang_tab.cpp" +#line 9355 "MachineIndependent/glslang_tab.cpp" break; - case 360: /* type_specifier_nonarray: F64MAT4X4 */ -#line 2605 "MachineIndependent/glslang.y" + case 362: /* type_specifier_nonarray: F64MAT4X4 */ +#line 2622 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 9298 "MachineIndependent/glslang_tab.cpp" +#line 9366 "MachineIndependent/glslang_tab.cpp" break; - case 361: /* type_specifier_nonarray: ACCSTRUCTNV */ -#line 2611 "MachineIndependent/glslang.y" + case 363: /* type_specifier_nonarray: ACCSTRUCTNV */ +#line 2628 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAccStruct; } -#line 9307 "MachineIndependent/glslang_tab.cpp" +#line 9375 "MachineIndependent/glslang_tab.cpp" break; - case 362: /* type_specifier_nonarray: ACCSTRUCTEXT */ -#line 2615 "MachineIndependent/glslang.y" + case 364: /* type_specifier_nonarray: ACCSTRUCTEXT */ +#line 2632 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAccStruct; } -#line 9316 "MachineIndependent/glslang_tab.cpp" +#line 9384 "MachineIndependent/glslang_tab.cpp" break; - case 363: /* type_specifier_nonarray: RAYQUERYEXT */ -#line 2619 "MachineIndependent/glslang.y" + case 365: /* type_specifier_nonarray: RAYQUERYEXT */ +#line 2636 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtRayQuery; } -#line 9325 "MachineIndependent/glslang_tab.cpp" +#line 9393 "MachineIndependent/glslang_tab.cpp" break; - case 364: /* type_specifier_nonarray: ATOMIC_UINT */ -#line 2623 "MachineIndependent/glslang.y" + case 366: /* type_specifier_nonarray: ATOMIC_UINT */ +#line 2640 "MachineIndependent/glslang.y" { parseContext.vulkanRemoved((yyvsp[0].lex).loc, "atomic counter types"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAtomicUint; } -#line 9335 "MachineIndependent/glslang_tab.cpp" +#line 9403 "MachineIndependent/glslang_tab.cpp" break; - case 365: /* type_specifier_nonarray: SAMPLER1D */ -#line 2628 "MachineIndependent/glslang.y" + case 367: /* type_specifier_nonarray: SAMPLER1D */ +#line 2645 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D); } -#line 9345 "MachineIndependent/glslang_tab.cpp" +#line 9413 "MachineIndependent/glslang_tab.cpp" break; - case 366: /* type_specifier_nonarray: SAMPLER2D */ -#line 2633 "MachineIndependent/glslang.y" + case 368: /* type_specifier_nonarray: SAMPLER2D */ +#line 2650 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); } -#line 9355 "MachineIndependent/glslang_tab.cpp" +#line 9423 "MachineIndependent/glslang_tab.cpp" break; - case 367: /* type_specifier_nonarray: SAMPLER3D */ -#line 2638 "MachineIndependent/glslang.y" + case 369: /* type_specifier_nonarray: SAMPLER3D */ +#line 2655 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd3D); } -#line 9365 "MachineIndependent/glslang_tab.cpp" +#line 9433 "MachineIndependent/glslang_tab.cpp" break; - case 368: /* type_specifier_nonarray: SAMPLERCUBE */ -#line 2643 "MachineIndependent/glslang.y" + case 370: /* type_specifier_nonarray: SAMPLERCUBE */ +#line 2660 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube); } -#line 9375 "MachineIndependent/glslang_tab.cpp" +#line 9443 "MachineIndependent/glslang_tab.cpp" break; - case 369: /* type_specifier_nonarray: SAMPLER2DSHADOW */ -#line 2648 "MachineIndependent/glslang.y" + case 371: /* type_specifier_nonarray: SAMPLER2DSHADOW */ +#line 2665 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, true); } -#line 9385 "MachineIndependent/glslang_tab.cpp" +#line 9453 "MachineIndependent/glslang_tab.cpp" break; - case 370: /* type_specifier_nonarray: SAMPLERCUBESHADOW */ -#line 2653 "MachineIndependent/glslang.y" + case 372: /* type_specifier_nonarray: SAMPLERCUBESHADOW */ +#line 2670 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, false, true); } -#line 9395 "MachineIndependent/glslang_tab.cpp" +#line 9463 "MachineIndependent/glslang_tab.cpp" break; - case 371: /* type_specifier_nonarray: SAMPLER2DARRAY */ -#line 2658 "MachineIndependent/glslang.y" + case 373: /* type_specifier_nonarray: SAMPLER2DARRAY */ +#line 2675 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true); } -#line 9405 "MachineIndependent/glslang_tab.cpp" +#line 9473 "MachineIndependent/glslang_tab.cpp" break; - case 372: /* type_specifier_nonarray: SAMPLER2DARRAYSHADOW */ -#line 2663 "MachineIndependent/glslang.y" + case 374: /* type_specifier_nonarray: SAMPLER2DARRAYSHADOW */ +#line 2680 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, true); } -#line 9415 "MachineIndependent/glslang_tab.cpp" +#line 9483 "MachineIndependent/glslang_tab.cpp" break; - case 373: /* type_specifier_nonarray: SAMPLER1DSHADOW */ -#line 2668 "MachineIndependent/glslang.y" + case 375: /* type_specifier_nonarray: SAMPLER1DSHADOW */ +#line 2685 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, false, true); } -#line 9425 "MachineIndependent/glslang_tab.cpp" +#line 9493 "MachineIndependent/glslang_tab.cpp" break; - case 374: /* type_specifier_nonarray: SAMPLER1DARRAY */ -#line 2673 "MachineIndependent/glslang.y" + case 376: /* type_specifier_nonarray: SAMPLER1DARRAY */ +#line 2690 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true); } -#line 9435 "MachineIndependent/glslang_tab.cpp" +#line 9503 "MachineIndependent/glslang_tab.cpp" break; - case 375: /* type_specifier_nonarray: SAMPLER1DARRAYSHADOW */ -#line 2678 "MachineIndependent/glslang.y" + case 377: /* type_specifier_nonarray: SAMPLER1DARRAYSHADOW */ +#line 2695 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true, true); } -#line 9445 "MachineIndependent/glslang_tab.cpp" +#line 9513 "MachineIndependent/glslang_tab.cpp" break; - case 376: /* type_specifier_nonarray: SAMPLERCUBEARRAY */ -#line 2683 "MachineIndependent/glslang.y" + case 378: /* type_specifier_nonarray: SAMPLERCUBEARRAY */ +#line 2700 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true); } -#line 9455 "MachineIndependent/glslang_tab.cpp" +#line 9523 "MachineIndependent/glslang_tab.cpp" break; - case 377: /* type_specifier_nonarray: SAMPLERCUBEARRAYSHADOW */ -#line 2688 "MachineIndependent/glslang.y" + case 379: /* type_specifier_nonarray: SAMPLERCUBEARRAYSHADOW */ +#line 2705 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true, true); } -#line 9465 "MachineIndependent/glslang_tab.cpp" +#line 9533 "MachineIndependent/glslang_tab.cpp" break; - case 378: /* type_specifier_nonarray: F16SAMPLER1D */ -#line 2693 "MachineIndependent/glslang.y" + case 380: /* type_specifier_nonarray: F16SAMPLER1D */ +#line 2710 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D); } -#line 9476 "MachineIndependent/glslang_tab.cpp" +#line 9544 "MachineIndependent/glslang_tab.cpp" break; - case 379: /* type_specifier_nonarray: F16SAMPLER2D */ -#line 2699 "MachineIndependent/glslang.y" + case 381: /* type_specifier_nonarray: F16SAMPLER2D */ +#line 2716 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D); } -#line 9487 "MachineIndependent/glslang_tab.cpp" +#line 9555 "MachineIndependent/glslang_tab.cpp" break; - case 380: /* type_specifier_nonarray: F16SAMPLER3D */ -#line 2705 "MachineIndependent/glslang.y" + case 382: /* type_specifier_nonarray: F16SAMPLER3D */ +#line 2722 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd3D); } -#line 9498 "MachineIndependent/glslang_tab.cpp" +#line 9566 "MachineIndependent/glslang_tab.cpp" break; - case 381: /* type_specifier_nonarray: F16SAMPLERCUBE */ -#line 2711 "MachineIndependent/glslang.y" + case 383: /* type_specifier_nonarray: F16SAMPLERCUBE */ +#line 2728 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube); } -#line 9509 "MachineIndependent/glslang_tab.cpp" +#line 9577 "MachineIndependent/glslang_tab.cpp" break; - case 382: /* type_specifier_nonarray: F16SAMPLER1DSHADOW */ -#line 2717 "MachineIndependent/glslang.y" + case 384: /* type_specifier_nonarray: F16SAMPLER1DSHADOW */ +#line 2734 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, false, true); } -#line 9520 "MachineIndependent/glslang_tab.cpp" +#line 9588 "MachineIndependent/glslang_tab.cpp" break; - case 383: /* type_specifier_nonarray: F16SAMPLER2DSHADOW */ -#line 2723 "MachineIndependent/glslang.y" + case 385: /* type_specifier_nonarray: F16SAMPLER2DSHADOW */ +#line 2740 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, true); } -#line 9531 "MachineIndependent/glslang_tab.cpp" +#line 9599 "MachineIndependent/glslang_tab.cpp" break; - case 384: /* type_specifier_nonarray: F16SAMPLERCUBESHADOW */ -#line 2729 "MachineIndependent/glslang.y" + case 386: /* type_specifier_nonarray: F16SAMPLERCUBESHADOW */ +#line 2746 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, false, true); } -#line 9542 "MachineIndependent/glslang_tab.cpp" +#line 9610 "MachineIndependent/glslang_tab.cpp" break; - case 385: /* type_specifier_nonarray: F16SAMPLER1DARRAY */ -#line 2735 "MachineIndependent/glslang.y" + case 387: /* type_specifier_nonarray: F16SAMPLER1DARRAY */ +#line 2752 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, true); } -#line 9553 "MachineIndependent/glslang_tab.cpp" +#line 9621 "MachineIndependent/glslang_tab.cpp" break; - case 386: /* type_specifier_nonarray: F16SAMPLER2DARRAY */ -#line 2741 "MachineIndependent/glslang.y" + case 388: /* type_specifier_nonarray: F16SAMPLER2DARRAY */ +#line 2758 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true); } -#line 9564 "MachineIndependent/glslang_tab.cpp" +#line 9632 "MachineIndependent/glslang_tab.cpp" break; - case 387: /* type_specifier_nonarray: F16SAMPLER1DARRAYSHADOW */ -#line 2747 "MachineIndependent/glslang.y" + case 389: /* type_specifier_nonarray: F16SAMPLER1DARRAYSHADOW */ +#line 2764 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, true, true); } -#line 9575 "MachineIndependent/glslang_tab.cpp" +#line 9643 "MachineIndependent/glslang_tab.cpp" break; - case 388: /* type_specifier_nonarray: F16SAMPLER2DARRAYSHADOW */ -#line 2753 "MachineIndependent/glslang.y" + case 390: /* type_specifier_nonarray: F16SAMPLER2DARRAYSHADOW */ +#line 2770 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, true); } -#line 9586 "MachineIndependent/glslang_tab.cpp" +#line 9654 "MachineIndependent/glslang_tab.cpp" break; - case 389: /* type_specifier_nonarray: F16SAMPLERCUBEARRAY */ -#line 2759 "MachineIndependent/glslang.y" + case 391: /* type_specifier_nonarray: F16SAMPLERCUBEARRAY */ +#line 2776 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, true); } -#line 9597 "MachineIndependent/glslang_tab.cpp" +#line 9665 "MachineIndependent/glslang_tab.cpp" break; - case 390: /* type_specifier_nonarray: F16SAMPLERCUBEARRAYSHADOW */ -#line 2765 "MachineIndependent/glslang.y" + case 392: /* type_specifier_nonarray: F16SAMPLERCUBEARRAYSHADOW */ +#line 2782 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, true, true); } -#line 9608 "MachineIndependent/glslang_tab.cpp" +#line 9676 "MachineIndependent/glslang_tab.cpp" break; - case 391: /* type_specifier_nonarray: ISAMPLER1D */ -#line 2771 "MachineIndependent/glslang.y" + case 393: /* type_specifier_nonarray: ISAMPLER1D */ +#line 2788 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd1D); } -#line 9618 "MachineIndependent/glslang_tab.cpp" +#line 9686 "MachineIndependent/glslang_tab.cpp" break; - case 392: /* type_specifier_nonarray: ISAMPLER2D */ -#line 2776 "MachineIndependent/glslang.y" + case 394: /* type_specifier_nonarray: ISAMPLER2D */ +#line 2793 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D); } -#line 9628 "MachineIndependent/glslang_tab.cpp" +#line 9696 "MachineIndependent/glslang_tab.cpp" break; - case 393: /* type_specifier_nonarray: ISAMPLER3D */ -#line 2781 "MachineIndependent/glslang.y" + case 395: /* type_specifier_nonarray: ISAMPLER3D */ +#line 2798 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd3D); } -#line 9638 "MachineIndependent/glslang_tab.cpp" +#line 9706 "MachineIndependent/glslang_tab.cpp" break; - case 394: /* type_specifier_nonarray: ISAMPLERCUBE */ -#line 2786 "MachineIndependent/glslang.y" + case 396: /* type_specifier_nonarray: ISAMPLERCUBE */ +#line 2803 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdCube); } -#line 9648 "MachineIndependent/glslang_tab.cpp" +#line 9716 "MachineIndependent/glslang_tab.cpp" break; - case 395: /* type_specifier_nonarray: ISAMPLER2DARRAY */ -#line 2791 "MachineIndependent/glslang.y" + case 397: /* type_specifier_nonarray: ISAMPLER2DARRAY */ +#line 2808 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, true); } -#line 9658 "MachineIndependent/glslang_tab.cpp" +#line 9726 "MachineIndependent/glslang_tab.cpp" break; - case 396: /* type_specifier_nonarray: USAMPLER2D */ -#line 2796 "MachineIndependent/glslang.y" + case 398: /* type_specifier_nonarray: USAMPLER2D */ +#line 2813 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D); } -#line 9668 "MachineIndependent/glslang_tab.cpp" +#line 9736 "MachineIndependent/glslang_tab.cpp" break; - case 397: /* type_specifier_nonarray: USAMPLER3D */ -#line 2801 "MachineIndependent/glslang.y" + case 399: /* type_specifier_nonarray: USAMPLER3D */ +#line 2818 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd3D); } -#line 9678 "MachineIndependent/glslang_tab.cpp" +#line 9746 "MachineIndependent/glslang_tab.cpp" break; - case 398: /* type_specifier_nonarray: USAMPLERCUBE */ -#line 2806 "MachineIndependent/glslang.y" + case 400: /* type_specifier_nonarray: USAMPLERCUBE */ +#line 2823 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdCube); } -#line 9688 "MachineIndependent/glslang_tab.cpp" +#line 9756 "MachineIndependent/glslang_tab.cpp" break; - case 399: /* type_specifier_nonarray: ISAMPLER1DARRAY */ -#line 2811 "MachineIndependent/glslang.y" + case 401: /* type_specifier_nonarray: ISAMPLER1DARRAY */ +#line 2828 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd1D, true); } -#line 9698 "MachineIndependent/glslang_tab.cpp" +#line 9766 "MachineIndependent/glslang_tab.cpp" break; - case 400: /* type_specifier_nonarray: ISAMPLERCUBEARRAY */ -#line 2816 "MachineIndependent/glslang.y" + case 402: /* type_specifier_nonarray: ISAMPLERCUBEARRAY */ +#line 2833 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdCube, true); } -#line 9708 "MachineIndependent/glslang_tab.cpp" +#line 9776 "MachineIndependent/glslang_tab.cpp" break; - case 401: /* type_specifier_nonarray: USAMPLER1D */ -#line 2821 "MachineIndependent/glslang.y" + case 403: /* type_specifier_nonarray: USAMPLER1D */ +#line 2838 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd1D); } -#line 9718 "MachineIndependent/glslang_tab.cpp" +#line 9786 "MachineIndependent/glslang_tab.cpp" break; - case 402: /* type_specifier_nonarray: USAMPLER1DARRAY */ -#line 2826 "MachineIndependent/glslang.y" + case 404: /* type_specifier_nonarray: USAMPLER1DARRAY */ +#line 2843 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd1D, true); } -#line 9728 "MachineIndependent/glslang_tab.cpp" +#line 9796 "MachineIndependent/glslang_tab.cpp" break; - case 403: /* type_specifier_nonarray: USAMPLERCUBEARRAY */ -#line 2831 "MachineIndependent/glslang.y" + case 405: /* type_specifier_nonarray: USAMPLERCUBEARRAY */ +#line 2848 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdCube, true); } -#line 9738 "MachineIndependent/glslang_tab.cpp" +#line 9806 "MachineIndependent/glslang_tab.cpp" break; - case 404: /* type_specifier_nonarray: TEXTURECUBEARRAY */ -#line 2836 "MachineIndependent/glslang.y" + case 406: /* type_specifier_nonarray: TEXTURECUBEARRAY */ +#line 2853 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube, true); } -#line 9748 "MachineIndependent/glslang_tab.cpp" +#line 9816 "MachineIndependent/glslang_tab.cpp" break; - case 405: /* type_specifier_nonarray: ITEXTURECUBEARRAY */ -#line 2841 "MachineIndependent/glslang.y" + case 407: /* type_specifier_nonarray: ITEXTURECUBEARRAY */ +#line 2858 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube, true); } -#line 9758 "MachineIndependent/glslang_tab.cpp" +#line 9826 "MachineIndependent/glslang_tab.cpp" break; - case 406: /* type_specifier_nonarray: UTEXTURECUBEARRAY */ -#line 2846 "MachineIndependent/glslang.y" + case 408: /* type_specifier_nonarray: UTEXTURECUBEARRAY */ +#line 2863 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube, true); } -#line 9768 "MachineIndependent/glslang_tab.cpp" +#line 9836 "MachineIndependent/glslang_tab.cpp" break; - case 407: /* type_specifier_nonarray: USAMPLER2DARRAY */ -#line 2851 "MachineIndependent/glslang.y" + case 409: /* type_specifier_nonarray: USAMPLER2DARRAY */ +#line 2868 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, true); } -#line 9778 "MachineIndependent/glslang_tab.cpp" +#line 9846 "MachineIndependent/glslang_tab.cpp" break; - case 408: /* type_specifier_nonarray: TEXTURE2D */ -#line 2856 "MachineIndependent/glslang.y" + case 410: /* type_specifier_nonarray: TEXTURE2D */ +#line 2873 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D); } -#line 9788 "MachineIndependent/glslang_tab.cpp" +#line 9856 "MachineIndependent/glslang_tab.cpp" break; - case 409: /* type_specifier_nonarray: TEXTURE3D */ -#line 2861 "MachineIndependent/glslang.y" + case 411: /* type_specifier_nonarray: TEXTURE3D */ +#line 2878 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd3D); } -#line 9798 "MachineIndependent/glslang_tab.cpp" +#line 9866 "MachineIndependent/glslang_tab.cpp" break; - case 410: /* type_specifier_nonarray: TEXTURE2DARRAY */ -#line 2866 "MachineIndependent/glslang.y" + case 412: /* type_specifier_nonarray: TEXTURE2DARRAY */ +#line 2883 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true); } -#line 9808 "MachineIndependent/glslang_tab.cpp" +#line 9876 "MachineIndependent/glslang_tab.cpp" break; - case 411: /* type_specifier_nonarray: TEXTURECUBE */ -#line 2871 "MachineIndependent/glslang.y" + case 413: /* type_specifier_nonarray: TEXTURECUBE */ +#line 2888 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube); } -#line 9818 "MachineIndependent/glslang_tab.cpp" +#line 9886 "MachineIndependent/glslang_tab.cpp" break; - case 412: /* type_specifier_nonarray: ITEXTURE2D */ -#line 2876 "MachineIndependent/glslang.y" + case 414: /* type_specifier_nonarray: ITEXTURE2D */ +#line 2893 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D); } -#line 9828 "MachineIndependent/glslang_tab.cpp" +#line 9896 "MachineIndependent/glslang_tab.cpp" break; - case 413: /* type_specifier_nonarray: ITEXTURE3D */ -#line 2881 "MachineIndependent/glslang.y" + case 415: /* type_specifier_nonarray: ITEXTURE3D */ +#line 2898 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd3D); } -#line 9838 "MachineIndependent/glslang_tab.cpp" +#line 9906 "MachineIndependent/glslang_tab.cpp" break; - case 414: /* type_specifier_nonarray: ITEXTURECUBE */ -#line 2886 "MachineIndependent/glslang.y" + case 416: /* type_specifier_nonarray: ITEXTURECUBE */ +#line 2903 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube); } -#line 9848 "MachineIndependent/glslang_tab.cpp" +#line 9916 "MachineIndependent/glslang_tab.cpp" break; - case 415: /* type_specifier_nonarray: ITEXTURE2DARRAY */ -#line 2891 "MachineIndependent/glslang.y" + case 417: /* type_specifier_nonarray: ITEXTURE2DARRAY */ +#line 2908 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true); } -#line 9858 "MachineIndependent/glslang_tab.cpp" +#line 9926 "MachineIndependent/glslang_tab.cpp" break; - case 416: /* type_specifier_nonarray: UTEXTURE2D */ -#line 2896 "MachineIndependent/glslang.y" + case 418: /* type_specifier_nonarray: UTEXTURE2D */ +#line 2913 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D); } -#line 9868 "MachineIndependent/glslang_tab.cpp" +#line 9936 "MachineIndependent/glslang_tab.cpp" break; - case 417: /* type_specifier_nonarray: UTEXTURE3D */ -#line 2901 "MachineIndependent/glslang.y" + case 419: /* type_specifier_nonarray: UTEXTURE3D */ +#line 2918 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd3D); } -#line 9878 "MachineIndependent/glslang_tab.cpp" +#line 9946 "MachineIndependent/glslang_tab.cpp" break; - case 418: /* type_specifier_nonarray: UTEXTURECUBE */ -#line 2906 "MachineIndependent/glslang.y" + case 420: /* type_specifier_nonarray: UTEXTURECUBE */ +#line 2923 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube); } -#line 9888 "MachineIndependent/glslang_tab.cpp" +#line 9956 "MachineIndependent/glslang_tab.cpp" break; - case 419: /* type_specifier_nonarray: UTEXTURE2DARRAY */ -#line 2911 "MachineIndependent/glslang.y" + case 421: /* type_specifier_nonarray: UTEXTURE2DARRAY */ +#line 2928 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true); } -#line 9898 "MachineIndependent/glslang_tab.cpp" +#line 9966 "MachineIndependent/glslang_tab.cpp" break; - case 420: /* type_specifier_nonarray: SAMPLER */ -#line 2916 "MachineIndependent/glslang.y" + case 422: /* type_specifier_nonarray: SAMPLER */ +#line 2933 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setPureSampler(false); } -#line 9908 "MachineIndependent/glslang_tab.cpp" +#line 9976 "MachineIndependent/glslang_tab.cpp" break; - case 421: /* type_specifier_nonarray: SAMPLERSHADOW */ -#line 2921 "MachineIndependent/glslang.y" + case 423: /* type_specifier_nonarray: SAMPLERSHADOW */ +#line 2938 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setPureSampler(true); } -#line 9918 "MachineIndependent/glslang_tab.cpp" +#line 9986 "MachineIndependent/glslang_tab.cpp" break; - case 422: /* type_specifier_nonarray: SAMPLER2DRECT */ -#line 2926 "MachineIndependent/glslang.y" + case 424: /* type_specifier_nonarray: SAMPLER2DRECT */ +#line 2943 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdRect); } -#line 9928 "MachineIndependent/glslang_tab.cpp" +#line 9996 "MachineIndependent/glslang_tab.cpp" break; - case 423: /* type_specifier_nonarray: SAMPLER2DRECTSHADOW */ -#line 2931 "MachineIndependent/glslang.y" + case 425: /* type_specifier_nonarray: SAMPLER2DRECTSHADOW */ +#line 2948 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdRect, false, true); } -#line 9938 "MachineIndependent/glslang_tab.cpp" +#line 10006 "MachineIndependent/glslang_tab.cpp" break; - case 424: /* type_specifier_nonarray: F16SAMPLER2DRECT */ -#line 2936 "MachineIndependent/glslang.y" + case 426: /* type_specifier_nonarray: F16SAMPLER2DRECT */ +#line 2953 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdRect); } -#line 9949 "MachineIndependent/glslang_tab.cpp" +#line 10017 "MachineIndependent/glslang_tab.cpp" break; - case 425: /* type_specifier_nonarray: F16SAMPLER2DRECTSHADOW */ -#line 2942 "MachineIndependent/glslang.y" + case 427: /* type_specifier_nonarray: F16SAMPLER2DRECTSHADOW */ +#line 2959 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdRect, false, true); } -#line 9960 "MachineIndependent/glslang_tab.cpp" +#line 10028 "MachineIndependent/glslang_tab.cpp" break; - case 426: /* type_specifier_nonarray: ISAMPLER2DRECT */ -#line 2948 "MachineIndependent/glslang.y" + case 428: /* type_specifier_nonarray: ISAMPLER2DRECT */ +#line 2965 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdRect); } -#line 9970 "MachineIndependent/glslang_tab.cpp" +#line 10038 "MachineIndependent/glslang_tab.cpp" break; - case 427: /* type_specifier_nonarray: USAMPLER2DRECT */ -#line 2953 "MachineIndependent/glslang.y" + case 429: /* type_specifier_nonarray: USAMPLER2DRECT */ +#line 2970 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdRect); } -#line 9980 "MachineIndependent/glslang_tab.cpp" +#line 10048 "MachineIndependent/glslang_tab.cpp" break; - case 428: /* type_specifier_nonarray: SAMPLERBUFFER */ -#line 2958 "MachineIndependent/glslang.y" + case 430: /* type_specifier_nonarray: SAMPLERBUFFER */ +#line 2975 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdBuffer); } -#line 9990 "MachineIndependent/glslang_tab.cpp" +#line 10058 "MachineIndependent/glslang_tab.cpp" break; - case 429: /* type_specifier_nonarray: F16SAMPLERBUFFER */ -#line 2963 "MachineIndependent/glslang.y" + case 431: /* type_specifier_nonarray: F16SAMPLERBUFFER */ +#line 2980 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdBuffer); } -#line 10001 "MachineIndependent/glslang_tab.cpp" +#line 10069 "MachineIndependent/glslang_tab.cpp" break; - case 430: /* type_specifier_nonarray: ISAMPLERBUFFER */ -#line 2969 "MachineIndependent/glslang.y" + case 432: /* type_specifier_nonarray: ISAMPLERBUFFER */ +#line 2986 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdBuffer); } -#line 10011 "MachineIndependent/glslang_tab.cpp" +#line 10079 "MachineIndependent/glslang_tab.cpp" break; - case 431: /* type_specifier_nonarray: USAMPLERBUFFER */ -#line 2974 "MachineIndependent/glslang.y" + case 433: /* type_specifier_nonarray: USAMPLERBUFFER */ +#line 2991 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdBuffer); } -#line 10021 "MachineIndependent/glslang_tab.cpp" +#line 10089 "MachineIndependent/glslang_tab.cpp" break; - case 432: /* type_specifier_nonarray: SAMPLER2DMS */ -#line 2979 "MachineIndependent/glslang.y" + case 434: /* type_specifier_nonarray: SAMPLER2DMS */ +#line 2996 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, false, true); } -#line 10031 "MachineIndependent/glslang_tab.cpp" +#line 10099 "MachineIndependent/glslang_tab.cpp" break; - case 433: /* type_specifier_nonarray: F16SAMPLER2DMS */ -#line 2984 "MachineIndependent/glslang.y" + case 435: /* type_specifier_nonarray: F16SAMPLER2DMS */ +#line 3001 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, false, true); } -#line 10042 "MachineIndependent/glslang_tab.cpp" +#line 10110 "MachineIndependent/glslang_tab.cpp" break; - case 434: /* type_specifier_nonarray: ISAMPLER2DMS */ -#line 2990 "MachineIndependent/glslang.y" + case 436: /* type_specifier_nonarray: ISAMPLER2DMS */ +#line 3007 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, false, false, true); } -#line 10052 "MachineIndependent/glslang_tab.cpp" +#line 10120 "MachineIndependent/glslang_tab.cpp" break; - case 435: /* type_specifier_nonarray: USAMPLER2DMS */ -#line 2995 "MachineIndependent/glslang.y" + case 437: /* type_specifier_nonarray: USAMPLER2DMS */ +#line 3012 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, false, false, true); } -#line 10062 "MachineIndependent/glslang_tab.cpp" +#line 10130 "MachineIndependent/glslang_tab.cpp" break; - case 436: /* type_specifier_nonarray: SAMPLER2DMSARRAY */ -#line 3000 "MachineIndependent/glslang.y" + case 438: /* type_specifier_nonarray: SAMPLER2DMSARRAY */ +#line 3017 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, false, true); } -#line 10072 "MachineIndependent/glslang_tab.cpp" +#line 10140 "MachineIndependent/glslang_tab.cpp" break; - case 437: /* type_specifier_nonarray: F16SAMPLER2DMSARRAY */ -#line 3005 "MachineIndependent/glslang.y" + case 439: /* type_specifier_nonarray: F16SAMPLER2DMSARRAY */ +#line 3022 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, false, true); } -#line 10083 "MachineIndependent/glslang_tab.cpp" +#line 10151 "MachineIndependent/glslang_tab.cpp" break; - case 438: /* type_specifier_nonarray: ISAMPLER2DMSARRAY */ -#line 3011 "MachineIndependent/glslang.y" + case 440: /* type_specifier_nonarray: ISAMPLER2DMSARRAY */ +#line 3028 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, true, false, true); } -#line 10093 "MachineIndependent/glslang_tab.cpp" +#line 10161 "MachineIndependent/glslang_tab.cpp" break; - case 439: /* type_specifier_nonarray: USAMPLER2DMSARRAY */ -#line 3016 "MachineIndependent/glslang.y" + case 441: /* type_specifier_nonarray: USAMPLER2DMSARRAY */ +#line 3033 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, true, false, true); } -#line 10103 "MachineIndependent/glslang_tab.cpp" +#line 10171 "MachineIndependent/glslang_tab.cpp" break; - case 440: /* type_specifier_nonarray: TEXTURE1D */ -#line 3021 "MachineIndependent/glslang.y" + case 442: /* type_specifier_nonarray: TEXTURE1D */ +#line 3038 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D); } -#line 10113 "MachineIndependent/glslang_tab.cpp" +#line 10181 "MachineIndependent/glslang_tab.cpp" break; - case 441: /* type_specifier_nonarray: F16TEXTURE1D */ -#line 3026 "MachineIndependent/glslang.y" + case 443: /* type_specifier_nonarray: F16TEXTURE1D */ +#line 3043 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D); } -#line 10124 "MachineIndependent/glslang_tab.cpp" +#line 10192 "MachineIndependent/glslang_tab.cpp" break; - case 442: /* type_specifier_nonarray: F16TEXTURE2D */ -#line 3032 "MachineIndependent/glslang.y" + case 444: /* type_specifier_nonarray: F16TEXTURE2D */ +#line 3049 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D); } -#line 10135 "MachineIndependent/glslang_tab.cpp" +#line 10203 "MachineIndependent/glslang_tab.cpp" break; - case 443: /* type_specifier_nonarray: F16TEXTURE3D */ -#line 3038 "MachineIndependent/glslang.y" + case 445: /* type_specifier_nonarray: F16TEXTURE3D */ +#line 3055 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd3D); } -#line 10146 "MachineIndependent/glslang_tab.cpp" +#line 10214 "MachineIndependent/glslang_tab.cpp" break; - case 444: /* type_specifier_nonarray: F16TEXTURECUBE */ -#line 3044 "MachineIndependent/glslang.y" + case 446: /* type_specifier_nonarray: F16TEXTURECUBE */ +#line 3061 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube); } -#line 10157 "MachineIndependent/glslang_tab.cpp" +#line 10225 "MachineIndependent/glslang_tab.cpp" break; - case 445: /* type_specifier_nonarray: TEXTURE1DARRAY */ -#line 3050 "MachineIndependent/glslang.y" + case 447: /* type_specifier_nonarray: TEXTURE1DARRAY */ +#line 3067 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D, true); } -#line 10167 "MachineIndependent/glslang_tab.cpp" +#line 10235 "MachineIndependent/glslang_tab.cpp" break; - case 446: /* type_specifier_nonarray: F16TEXTURE1DARRAY */ -#line 3055 "MachineIndependent/glslang.y" + case 448: /* type_specifier_nonarray: F16TEXTURE1DARRAY */ +#line 3072 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D, true); } -#line 10178 "MachineIndependent/glslang_tab.cpp" +#line 10246 "MachineIndependent/glslang_tab.cpp" break; - case 447: /* type_specifier_nonarray: F16TEXTURE2DARRAY */ -#line 3061 "MachineIndependent/glslang.y" + case 449: /* type_specifier_nonarray: F16TEXTURE2DARRAY */ +#line 3078 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true); } -#line 10189 "MachineIndependent/glslang_tab.cpp" +#line 10257 "MachineIndependent/glslang_tab.cpp" break; - case 448: /* type_specifier_nonarray: F16TEXTURECUBEARRAY */ -#line 3067 "MachineIndependent/glslang.y" + case 450: /* type_specifier_nonarray: F16TEXTURECUBEARRAY */ +#line 3084 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube, true); } -#line 10200 "MachineIndependent/glslang_tab.cpp" +#line 10268 "MachineIndependent/glslang_tab.cpp" break; - case 449: /* type_specifier_nonarray: ITEXTURE1D */ -#line 3073 "MachineIndependent/glslang.y" + case 451: /* type_specifier_nonarray: ITEXTURE1D */ +#line 3090 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D); } -#line 10210 "MachineIndependent/glslang_tab.cpp" +#line 10278 "MachineIndependent/glslang_tab.cpp" break; - case 450: /* type_specifier_nonarray: ITEXTURE1DARRAY */ -#line 3078 "MachineIndependent/glslang.y" + case 452: /* type_specifier_nonarray: ITEXTURE1DARRAY */ +#line 3095 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D, true); } -#line 10220 "MachineIndependent/glslang_tab.cpp" +#line 10288 "MachineIndependent/glslang_tab.cpp" break; - case 451: /* type_specifier_nonarray: UTEXTURE1D */ -#line 3083 "MachineIndependent/glslang.y" + case 453: /* type_specifier_nonarray: UTEXTURE1D */ +#line 3100 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D); } -#line 10230 "MachineIndependent/glslang_tab.cpp" +#line 10298 "MachineIndependent/glslang_tab.cpp" break; - case 452: /* type_specifier_nonarray: UTEXTURE1DARRAY */ -#line 3088 "MachineIndependent/glslang.y" + case 454: /* type_specifier_nonarray: UTEXTURE1DARRAY */ +#line 3105 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D, true); } -#line 10240 "MachineIndependent/glslang_tab.cpp" +#line 10308 "MachineIndependent/glslang_tab.cpp" break; - case 453: /* type_specifier_nonarray: TEXTURE2DRECT */ -#line 3093 "MachineIndependent/glslang.y" + case 455: /* type_specifier_nonarray: TEXTURE2DRECT */ +#line 3110 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdRect); } -#line 10250 "MachineIndependent/glslang_tab.cpp" +#line 10318 "MachineIndependent/glslang_tab.cpp" break; - case 454: /* type_specifier_nonarray: F16TEXTURE2DRECT */ -#line 3098 "MachineIndependent/glslang.y" + case 456: /* type_specifier_nonarray: F16TEXTURE2DRECT */ +#line 3115 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdRect); } -#line 10261 "MachineIndependent/glslang_tab.cpp" +#line 10329 "MachineIndependent/glslang_tab.cpp" break; - case 455: /* type_specifier_nonarray: ITEXTURE2DRECT */ -#line 3104 "MachineIndependent/glslang.y" + case 457: /* type_specifier_nonarray: ITEXTURE2DRECT */ +#line 3121 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdRect); } -#line 10271 "MachineIndependent/glslang_tab.cpp" +#line 10339 "MachineIndependent/glslang_tab.cpp" break; - case 456: /* type_specifier_nonarray: UTEXTURE2DRECT */ -#line 3109 "MachineIndependent/glslang.y" + case 458: /* type_specifier_nonarray: UTEXTURE2DRECT */ +#line 3126 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdRect); } -#line 10281 "MachineIndependent/glslang_tab.cpp" +#line 10349 "MachineIndependent/glslang_tab.cpp" break; - case 457: /* type_specifier_nonarray: TEXTUREBUFFER */ -#line 3114 "MachineIndependent/glslang.y" + case 459: /* type_specifier_nonarray: TEXTUREBUFFER */ +#line 3131 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdBuffer); } -#line 10291 "MachineIndependent/glslang_tab.cpp" +#line 10359 "MachineIndependent/glslang_tab.cpp" break; - case 458: /* type_specifier_nonarray: F16TEXTUREBUFFER */ -#line 3119 "MachineIndependent/glslang.y" + case 460: /* type_specifier_nonarray: F16TEXTUREBUFFER */ +#line 3136 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdBuffer); } -#line 10302 "MachineIndependent/glslang_tab.cpp" +#line 10370 "MachineIndependent/glslang_tab.cpp" break; - case 459: /* type_specifier_nonarray: ITEXTUREBUFFER */ -#line 3125 "MachineIndependent/glslang.y" + case 461: /* type_specifier_nonarray: ITEXTUREBUFFER */ +#line 3142 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdBuffer); } -#line 10312 "MachineIndependent/glslang_tab.cpp" +#line 10380 "MachineIndependent/glslang_tab.cpp" break; - case 460: /* type_specifier_nonarray: UTEXTUREBUFFER */ -#line 3130 "MachineIndependent/glslang.y" + case 462: /* type_specifier_nonarray: UTEXTUREBUFFER */ +#line 3147 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdBuffer); } -#line 10322 "MachineIndependent/glslang_tab.cpp" +#line 10390 "MachineIndependent/glslang_tab.cpp" break; - case 461: /* type_specifier_nonarray: TEXTURE2DMS */ -#line 3135 "MachineIndependent/glslang.y" + case 463: /* type_specifier_nonarray: TEXTURE2DMS */ +#line 3152 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, false, false, true); } -#line 10332 "MachineIndependent/glslang_tab.cpp" +#line 10400 "MachineIndependent/glslang_tab.cpp" break; - case 462: /* type_specifier_nonarray: F16TEXTURE2DMS */ -#line 3140 "MachineIndependent/glslang.y" + case 464: /* type_specifier_nonarray: F16TEXTURE2DMS */ +#line 3157 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, false, false, true); } -#line 10343 "MachineIndependent/glslang_tab.cpp" +#line 10411 "MachineIndependent/glslang_tab.cpp" break; - case 463: /* type_specifier_nonarray: ITEXTURE2DMS */ -#line 3146 "MachineIndependent/glslang.y" + case 465: /* type_specifier_nonarray: ITEXTURE2DMS */ +#line 3163 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, false, false, true); } -#line 10353 "MachineIndependent/glslang_tab.cpp" +#line 10421 "MachineIndependent/glslang_tab.cpp" break; - case 464: /* type_specifier_nonarray: UTEXTURE2DMS */ -#line 3151 "MachineIndependent/glslang.y" + case 466: /* type_specifier_nonarray: UTEXTURE2DMS */ +#line 3168 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, false, false, true); } -#line 10363 "MachineIndependent/glslang_tab.cpp" +#line 10431 "MachineIndependent/glslang_tab.cpp" break; - case 465: /* type_specifier_nonarray: TEXTURE2DMSARRAY */ -#line 3156 "MachineIndependent/glslang.y" + case 467: /* type_specifier_nonarray: TEXTURE2DMSARRAY */ +#line 3173 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true, false, true); } -#line 10373 "MachineIndependent/glslang_tab.cpp" +#line 10441 "MachineIndependent/glslang_tab.cpp" break; - case 466: /* type_specifier_nonarray: F16TEXTURE2DMSARRAY */ -#line 3161 "MachineIndependent/glslang.y" + case 468: /* type_specifier_nonarray: F16TEXTURE2DMSARRAY */ +#line 3178 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true, false, true); } -#line 10384 "MachineIndependent/glslang_tab.cpp" +#line 10452 "MachineIndependent/glslang_tab.cpp" break; - case 467: /* type_specifier_nonarray: ITEXTURE2DMSARRAY */ -#line 3167 "MachineIndependent/glslang.y" + case 469: /* type_specifier_nonarray: ITEXTURE2DMSARRAY */ +#line 3184 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true, false, true); } -#line 10394 "MachineIndependent/glslang_tab.cpp" +#line 10462 "MachineIndependent/glslang_tab.cpp" break; - case 468: /* type_specifier_nonarray: UTEXTURE2DMSARRAY */ -#line 3172 "MachineIndependent/glslang.y" + case 470: /* type_specifier_nonarray: UTEXTURE2DMSARRAY */ +#line 3189 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true, false, true); } -#line 10404 "MachineIndependent/glslang_tab.cpp" +#line 10472 "MachineIndependent/glslang_tab.cpp" break; - case 469: /* type_specifier_nonarray: IMAGE1D */ -#line 3177 "MachineIndependent/glslang.y" + case 471: /* type_specifier_nonarray: IMAGE1D */ +#line 3194 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D); } -#line 10414 "MachineIndependent/glslang_tab.cpp" +#line 10482 "MachineIndependent/glslang_tab.cpp" break; - case 470: /* type_specifier_nonarray: F16IMAGE1D */ -#line 3182 "MachineIndependent/glslang.y" + case 472: /* type_specifier_nonarray: F16IMAGE1D */ +#line 3199 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd1D); } -#line 10425 "MachineIndependent/glslang_tab.cpp" +#line 10493 "MachineIndependent/glslang_tab.cpp" break; - case 471: /* type_specifier_nonarray: IIMAGE1D */ -#line 3188 "MachineIndependent/glslang.y" + case 473: /* type_specifier_nonarray: IIMAGE1D */ +#line 3205 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D); } -#line 10435 "MachineIndependent/glslang_tab.cpp" +#line 10503 "MachineIndependent/glslang_tab.cpp" break; - case 472: /* type_specifier_nonarray: UIMAGE1D */ -#line 3193 "MachineIndependent/glslang.y" + case 474: /* type_specifier_nonarray: UIMAGE1D */ +#line 3210 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D); } -#line 10445 "MachineIndependent/glslang_tab.cpp" +#line 10513 "MachineIndependent/glslang_tab.cpp" break; - case 473: /* type_specifier_nonarray: IMAGE2D */ -#line 3198 "MachineIndependent/glslang.y" + case 475: /* type_specifier_nonarray: IMAGE2D */ +#line 3215 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D); } -#line 10455 "MachineIndependent/glslang_tab.cpp" +#line 10523 "MachineIndependent/glslang_tab.cpp" break; - case 474: /* type_specifier_nonarray: F16IMAGE2D */ -#line 3203 "MachineIndependent/glslang.y" + case 476: /* type_specifier_nonarray: F16IMAGE2D */ +#line 3220 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D); } -#line 10466 "MachineIndependent/glslang_tab.cpp" +#line 10534 "MachineIndependent/glslang_tab.cpp" break; - case 475: /* type_specifier_nonarray: IIMAGE2D */ -#line 3209 "MachineIndependent/glslang.y" + case 477: /* type_specifier_nonarray: IIMAGE2D */ +#line 3226 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D); } -#line 10476 "MachineIndependent/glslang_tab.cpp" +#line 10544 "MachineIndependent/glslang_tab.cpp" break; - case 476: /* type_specifier_nonarray: UIMAGE2D */ -#line 3214 "MachineIndependent/glslang.y" + case 478: /* type_specifier_nonarray: UIMAGE2D */ +#line 3231 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D); } -#line 10486 "MachineIndependent/glslang_tab.cpp" +#line 10554 "MachineIndependent/glslang_tab.cpp" break; - case 477: /* type_specifier_nonarray: IMAGE3D */ -#line 3219 "MachineIndependent/glslang.y" + case 479: /* type_specifier_nonarray: IMAGE3D */ +#line 3236 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd3D); } -#line 10496 "MachineIndependent/glslang_tab.cpp" +#line 10564 "MachineIndependent/glslang_tab.cpp" break; - case 478: /* type_specifier_nonarray: F16IMAGE3D */ -#line 3224 "MachineIndependent/glslang.y" + case 480: /* type_specifier_nonarray: F16IMAGE3D */ +#line 3241 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd3D); } -#line 10507 "MachineIndependent/glslang_tab.cpp" +#line 10575 "MachineIndependent/glslang_tab.cpp" break; - case 479: /* type_specifier_nonarray: IIMAGE3D */ -#line 3230 "MachineIndependent/glslang.y" + case 481: /* type_specifier_nonarray: IIMAGE3D */ +#line 3247 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd3D); } -#line 10517 "MachineIndependent/glslang_tab.cpp" +#line 10585 "MachineIndependent/glslang_tab.cpp" break; - case 480: /* type_specifier_nonarray: UIMAGE3D */ -#line 3235 "MachineIndependent/glslang.y" + case 482: /* type_specifier_nonarray: UIMAGE3D */ +#line 3252 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd3D); } -#line 10527 "MachineIndependent/glslang_tab.cpp" +#line 10595 "MachineIndependent/glslang_tab.cpp" break; - case 481: /* type_specifier_nonarray: IMAGE2DRECT */ -#line 3240 "MachineIndependent/glslang.y" + case 483: /* type_specifier_nonarray: IMAGE2DRECT */ +#line 3257 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdRect); } -#line 10537 "MachineIndependent/glslang_tab.cpp" +#line 10605 "MachineIndependent/glslang_tab.cpp" break; - case 482: /* type_specifier_nonarray: F16IMAGE2DRECT */ -#line 3245 "MachineIndependent/glslang.y" + case 484: /* type_specifier_nonarray: F16IMAGE2DRECT */ +#line 3262 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdRect); } -#line 10548 "MachineIndependent/glslang_tab.cpp" +#line 10616 "MachineIndependent/glslang_tab.cpp" break; - case 483: /* type_specifier_nonarray: IIMAGE2DRECT */ -#line 3251 "MachineIndependent/glslang.y" + case 485: /* type_specifier_nonarray: IIMAGE2DRECT */ +#line 3268 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdRect); } -#line 10558 "MachineIndependent/glslang_tab.cpp" +#line 10626 "MachineIndependent/glslang_tab.cpp" break; - case 484: /* type_specifier_nonarray: UIMAGE2DRECT */ -#line 3256 "MachineIndependent/glslang.y" + case 486: /* type_specifier_nonarray: UIMAGE2DRECT */ +#line 3273 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdRect); } -#line 10568 "MachineIndependent/glslang_tab.cpp" +#line 10636 "MachineIndependent/glslang_tab.cpp" break; - case 485: /* type_specifier_nonarray: IMAGECUBE */ -#line 3261 "MachineIndependent/glslang.y" + case 487: /* type_specifier_nonarray: IMAGECUBE */ +#line 3278 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube); } -#line 10578 "MachineIndependent/glslang_tab.cpp" +#line 10646 "MachineIndependent/glslang_tab.cpp" break; - case 486: /* type_specifier_nonarray: F16IMAGECUBE */ -#line 3266 "MachineIndependent/glslang.y" + case 488: /* type_specifier_nonarray: F16IMAGECUBE */ +#line 3283 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdCube); } -#line 10589 "MachineIndependent/glslang_tab.cpp" +#line 10657 "MachineIndependent/glslang_tab.cpp" break; - case 487: /* type_specifier_nonarray: IIMAGECUBE */ -#line 3272 "MachineIndependent/glslang.y" + case 489: /* type_specifier_nonarray: IIMAGECUBE */ +#line 3289 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube); } -#line 10599 "MachineIndependent/glslang_tab.cpp" +#line 10667 "MachineIndependent/glslang_tab.cpp" break; - case 488: /* type_specifier_nonarray: UIMAGECUBE */ -#line 3277 "MachineIndependent/glslang.y" + case 490: /* type_specifier_nonarray: UIMAGECUBE */ +#line 3294 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube); } -#line 10609 "MachineIndependent/glslang_tab.cpp" +#line 10677 "MachineIndependent/glslang_tab.cpp" break; - case 489: /* type_specifier_nonarray: IMAGEBUFFER */ -#line 3282 "MachineIndependent/glslang.y" + case 491: /* type_specifier_nonarray: IMAGEBUFFER */ +#line 3299 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdBuffer); } -#line 10619 "MachineIndependent/glslang_tab.cpp" +#line 10687 "MachineIndependent/glslang_tab.cpp" break; - case 490: /* type_specifier_nonarray: F16IMAGEBUFFER */ -#line 3287 "MachineIndependent/glslang.y" + case 492: /* type_specifier_nonarray: F16IMAGEBUFFER */ +#line 3304 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdBuffer); } -#line 10630 "MachineIndependent/glslang_tab.cpp" +#line 10698 "MachineIndependent/glslang_tab.cpp" break; - case 491: /* type_specifier_nonarray: IIMAGEBUFFER */ -#line 3293 "MachineIndependent/glslang.y" + case 493: /* type_specifier_nonarray: IIMAGEBUFFER */ +#line 3310 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdBuffer); } -#line 10640 "MachineIndependent/glslang_tab.cpp" +#line 10708 "MachineIndependent/glslang_tab.cpp" break; - case 492: /* type_specifier_nonarray: UIMAGEBUFFER */ -#line 3298 "MachineIndependent/glslang.y" + case 494: /* type_specifier_nonarray: UIMAGEBUFFER */ +#line 3315 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdBuffer); } -#line 10650 "MachineIndependent/glslang_tab.cpp" +#line 10718 "MachineIndependent/glslang_tab.cpp" break; - case 493: /* type_specifier_nonarray: IMAGE1DARRAY */ -#line 3303 "MachineIndependent/glslang.y" + case 495: /* type_specifier_nonarray: IMAGE1DARRAY */ +#line 3320 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D, true); } -#line 10660 "MachineIndependent/glslang_tab.cpp" +#line 10728 "MachineIndependent/glslang_tab.cpp" break; - case 494: /* type_specifier_nonarray: F16IMAGE1DARRAY */ -#line 3308 "MachineIndependent/glslang.y" + case 496: /* type_specifier_nonarray: F16IMAGE1DARRAY */ +#line 3325 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd1D, true); } -#line 10671 "MachineIndependent/glslang_tab.cpp" +#line 10739 "MachineIndependent/glslang_tab.cpp" break; - case 495: /* type_specifier_nonarray: IIMAGE1DARRAY */ -#line 3314 "MachineIndependent/glslang.y" + case 497: /* type_specifier_nonarray: IIMAGE1DARRAY */ +#line 3331 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D, true); } -#line 10681 "MachineIndependent/glslang_tab.cpp" +#line 10749 "MachineIndependent/glslang_tab.cpp" break; - case 496: /* type_specifier_nonarray: UIMAGE1DARRAY */ -#line 3319 "MachineIndependent/glslang.y" + case 498: /* type_specifier_nonarray: UIMAGE1DARRAY */ +#line 3336 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D, true); } -#line 10691 "MachineIndependent/glslang_tab.cpp" +#line 10759 "MachineIndependent/glslang_tab.cpp" break; - case 497: /* type_specifier_nonarray: IMAGE2DARRAY */ -#line 3324 "MachineIndependent/glslang.y" + case 499: /* type_specifier_nonarray: IMAGE2DARRAY */ +#line 3341 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true); } -#line 10701 "MachineIndependent/glslang_tab.cpp" +#line 10769 "MachineIndependent/glslang_tab.cpp" break; - case 498: /* type_specifier_nonarray: F16IMAGE2DARRAY */ -#line 3329 "MachineIndependent/glslang.y" + case 500: /* type_specifier_nonarray: F16IMAGE2DARRAY */ +#line 3346 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, true); } -#line 10712 "MachineIndependent/glslang_tab.cpp" +#line 10780 "MachineIndependent/glslang_tab.cpp" break; - case 499: /* type_specifier_nonarray: IIMAGE2DARRAY */ -#line 3335 "MachineIndependent/glslang.y" + case 501: /* type_specifier_nonarray: IIMAGE2DARRAY */ +#line 3352 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true); } -#line 10722 "MachineIndependent/glslang_tab.cpp" +#line 10790 "MachineIndependent/glslang_tab.cpp" break; - case 500: /* type_specifier_nonarray: UIMAGE2DARRAY */ -#line 3340 "MachineIndependent/glslang.y" + case 502: /* type_specifier_nonarray: UIMAGE2DARRAY */ +#line 3357 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true); } -#line 10732 "MachineIndependent/glslang_tab.cpp" +#line 10800 "MachineIndependent/glslang_tab.cpp" break; - case 501: /* type_specifier_nonarray: IMAGECUBEARRAY */ -#line 3345 "MachineIndependent/glslang.y" + case 503: /* type_specifier_nonarray: IMAGECUBEARRAY */ +#line 3362 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube, true); } -#line 10742 "MachineIndependent/glslang_tab.cpp" +#line 10810 "MachineIndependent/glslang_tab.cpp" break; - case 502: /* type_specifier_nonarray: F16IMAGECUBEARRAY */ -#line 3350 "MachineIndependent/glslang.y" + case 504: /* type_specifier_nonarray: F16IMAGECUBEARRAY */ +#line 3367 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdCube, true); } -#line 10753 "MachineIndependent/glslang_tab.cpp" +#line 10821 "MachineIndependent/glslang_tab.cpp" break; - case 503: /* type_specifier_nonarray: IIMAGECUBEARRAY */ -#line 3356 "MachineIndependent/glslang.y" + case 505: /* type_specifier_nonarray: IIMAGECUBEARRAY */ +#line 3373 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube, true); } -#line 10763 "MachineIndependent/glslang_tab.cpp" +#line 10831 "MachineIndependent/glslang_tab.cpp" break; - case 504: /* type_specifier_nonarray: UIMAGECUBEARRAY */ -#line 3361 "MachineIndependent/glslang.y" + case 506: /* type_specifier_nonarray: UIMAGECUBEARRAY */ +#line 3378 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube, true); } -#line 10773 "MachineIndependent/glslang_tab.cpp" +#line 10841 "MachineIndependent/glslang_tab.cpp" break; - case 505: /* type_specifier_nonarray: IMAGE2DMS */ -#line 3366 "MachineIndependent/glslang.y" + case 507: /* type_specifier_nonarray: IMAGE2DMS */ +#line 3383 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, false, false, true); } -#line 10783 "MachineIndependent/glslang_tab.cpp" +#line 10851 "MachineIndependent/glslang_tab.cpp" break; - case 506: /* type_specifier_nonarray: F16IMAGE2DMS */ -#line 3371 "MachineIndependent/glslang.y" + case 508: /* type_specifier_nonarray: F16IMAGE2DMS */ +#line 3388 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, false, false, true); } -#line 10794 "MachineIndependent/glslang_tab.cpp" +#line 10862 "MachineIndependent/glslang_tab.cpp" break; - case 507: /* type_specifier_nonarray: IIMAGE2DMS */ -#line 3377 "MachineIndependent/glslang.y" + case 509: /* type_specifier_nonarray: IIMAGE2DMS */ +#line 3394 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, false, false, true); } -#line 10804 "MachineIndependent/glslang_tab.cpp" +#line 10872 "MachineIndependent/glslang_tab.cpp" break; - case 508: /* type_specifier_nonarray: UIMAGE2DMS */ -#line 3382 "MachineIndependent/glslang.y" + case 510: /* type_specifier_nonarray: UIMAGE2DMS */ +#line 3399 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, false, false, true); } -#line 10814 "MachineIndependent/glslang_tab.cpp" +#line 10882 "MachineIndependent/glslang_tab.cpp" break; - case 509: /* type_specifier_nonarray: IMAGE2DMSARRAY */ -#line 3387 "MachineIndependent/glslang.y" + case 511: /* type_specifier_nonarray: IMAGE2DMSARRAY */ +#line 3404 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true, false, true); } -#line 10824 "MachineIndependent/glslang_tab.cpp" +#line 10892 "MachineIndependent/glslang_tab.cpp" break; - case 510: /* type_specifier_nonarray: F16IMAGE2DMSARRAY */ -#line 3392 "MachineIndependent/glslang.y" + case 512: /* type_specifier_nonarray: F16IMAGE2DMSARRAY */ +#line 3409 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, true, false, true); } -#line 10835 "MachineIndependent/glslang_tab.cpp" +#line 10903 "MachineIndependent/glslang_tab.cpp" break; - case 511: /* type_specifier_nonarray: IIMAGE2DMSARRAY */ -#line 3398 "MachineIndependent/glslang.y" + case 513: /* type_specifier_nonarray: IIMAGE2DMSARRAY */ +#line 3415 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true, false, true); } -#line 10845 "MachineIndependent/glslang_tab.cpp" +#line 10913 "MachineIndependent/glslang_tab.cpp" break; - case 512: /* type_specifier_nonarray: UIMAGE2DMSARRAY */ -#line 3403 "MachineIndependent/glslang.y" + case 514: /* type_specifier_nonarray: UIMAGE2DMSARRAY */ +#line 3420 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true, false, true); } -#line 10855 "MachineIndependent/glslang_tab.cpp" +#line 10923 "MachineIndependent/glslang_tab.cpp" break; - case 513: /* type_specifier_nonarray: I64IMAGE1D */ -#line 3408 "MachineIndependent/glslang.y" + case 515: /* type_specifier_nonarray: I64IMAGE1D */ +#line 3425 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd1D); } -#line 10865 "MachineIndependent/glslang_tab.cpp" +#line 10933 "MachineIndependent/glslang_tab.cpp" break; - case 514: /* type_specifier_nonarray: U64IMAGE1D */ -#line 3413 "MachineIndependent/glslang.y" + case 516: /* type_specifier_nonarray: U64IMAGE1D */ +#line 3430 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd1D); } -#line 10875 "MachineIndependent/glslang_tab.cpp" +#line 10943 "MachineIndependent/glslang_tab.cpp" break; - case 515: /* type_specifier_nonarray: I64IMAGE2D */ -#line 3418 "MachineIndependent/glslang.y" + case 517: /* type_specifier_nonarray: I64IMAGE2D */ +#line 3435 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd2D); } -#line 10885 "MachineIndependent/glslang_tab.cpp" +#line 10953 "MachineIndependent/glslang_tab.cpp" break; - case 516: /* type_specifier_nonarray: U64IMAGE2D */ -#line 3423 "MachineIndependent/glslang.y" + case 518: /* type_specifier_nonarray: U64IMAGE2D */ +#line 3440 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd2D); } -#line 10895 "MachineIndependent/glslang_tab.cpp" +#line 10963 "MachineIndependent/glslang_tab.cpp" break; - case 517: /* type_specifier_nonarray: I64IMAGE3D */ -#line 3428 "MachineIndependent/glslang.y" + case 519: /* type_specifier_nonarray: I64IMAGE3D */ +#line 3445 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd3D); } -#line 10905 "MachineIndependent/glslang_tab.cpp" +#line 10973 "MachineIndependent/glslang_tab.cpp" break; - case 518: /* type_specifier_nonarray: U64IMAGE3D */ -#line 3433 "MachineIndependent/glslang.y" + case 520: /* type_specifier_nonarray: U64IMAGE3D */ +#line 3450 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd3D); } -#line 10915 "MachineIndependent/glslang_tab.cpp" +#line 10983 "MachineIndependent/glslang_tab.cpp" break; - case 519: /* type_specifier_nonarray: I64IMAGE2DRECT */ -#line 3438 "MachineIndependent/glslang.y" + case 521: /* type_specifier_nonarray: I64IMAGE2DRECT */ +#line 3455 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, EsdRect); } -#line 10925 "MachineIndependent/glslang_tab.cpp" +#line 10993 "MachineIndependent/glslang_tab.cpp" break; - case 520: /* type_specifier_nonarray: U64IMAGE2DRECT */ -#line 3443 "MachineIndependent/glslang.y" + case 522: /* type_specifier_nonarray: U64IMAGE2DRECT */ +#line 3460 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, EsdRect); } -#line 10935 "MachineIndependent/glslang_tab.cpp" +#line 11003 "MachineIndependent/glslang_tab.cpp" break; - case 521: /* type_specifier_nonarray: I64IMAGECUBE */ -#line 3448 "MachineIndependent/glslang.y" + case 523: /* type_specifier_nonarray: I64IMAGECUBE */ +#line 3465 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, EsdCube); } -#line 10945 "MachineIndependent/glslang_tab.cpp" +#line 11013 "MachineIndependent/glslang_tab.cpp" break; - case 522: /* type_specifier_nonarray: U64IMAGECUBE */ -#line 3453 "MachineIndependent/glslang.y" + case 524: /* type_specifier_nonarray: U64IMAGECUBE */ +#line 3470 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, EsdCube); } -#line 10955 "MachineIndependent/glslang_tab.cpp" +#line 11023 "MachineIndependent/glslang_tab.cpp" break; - case 523: /* type_specifier_nonarray: I64IMAGEBUFFER */ -#line 3458 "MachineIndependent/glslang.y" + case 525: /* type_specifier_nonarray: I64IMAGEBUFFER */ +#line 3475 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, EsdBuffer); } -#line 10965 "MachineIndependent/glslang_tab.cpp" +#line 11033 "MachineIndependent/glslang_tab.cpp" break; - case 524: /* type_specifier_nonarray: U64IMAGEBUFFER */ -#line 3463 "MachineIndependent/glslang.y" + case 526: /* type_specifier_nonarray: U64IMAGEBUFFER */ +#line 3480 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, EsdBuffer); } -#line 10975 "MachineIndependent/glslang_tab.cpp" +#line 11043 "MachineIndependent/glslang_tab.cpp" break; - case 525: /* type_specifier_nonarray: I64IMAGE1DARRAY */ -#line 3468 "MachineIndependent/glslang.y" + case 527: /* type_specifier_nonarray: I64IMAGE1DARRAY */ +#line 3485 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd1D, true); } -#line 10985 "MachineIndependent/glslang_tab.cpp" +#line 11053 "MachineIndependent/glslang_tab.cpp" break; - case 526: /* type_specifier_nonarray: U64IMAGE1DARRAY */ -#line 3473 "MachineIndependent/glslang.y" + case 528: /* type_specifier_nonarray: U64IMAGE1DARRAY */ +#line 3490 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd1D, true); } -#line 10995 "MachineIndependent/glslang_tab.cpp" +#line 11063 "MachineIndependent/glslang_tab.cpp" break; - case 527: /* type_specifier_nonarray: I64IMAGE2DARRAY */ -#line 3478 "MachineIndependent/glslang.y" + case 529: /* type_specifier_nonarray: I64IMAGE2DARRAY */ +#line 3495 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd2D, true); } -#line 11005 "MachineIndependent/glslang_tab.cpp" +#line 11073 "MachineIndependent/glslang_tab.cpp" break; - case 528: /* type_specifier_nonarray: U64IMAGE2DARRAY */ -#line 3483 "MachineIndependent/glslang.y" + case 530: /* type_specifier_nonarray: U64IMAGE2DARRAY */ +#line 3500 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd2D, true); } -#line 11015 "MachineIndependent/glslang_tab.cpp" +#line 11083 "MachineIndependent/glslang_tab.cpp" break; - case 529: /* type_specifier_nonarray: I64IMAGECUBEARRAY */ -#line 3488 "MachineIndependent/glslang.y" + case 531: /* type_specifier_nonarray: I64IMAGECUBEARRAY */ +#line 3505 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, EsdCube, true); } -#line 11025 "MachineIndependent/glslang_tab.cpp" +#line 11093 "MachineIndependent/glslang_tab.cpp" break; - case 530: /* type_specifier_nonarray: U64IMAGECUBEARRAY */ -#line 3493 "MachineIndependent/glslang.y" + case 532: /* type_specifier_nonarray: U64IMAGECUBEARRAY */ +#line 3510 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, EsdCube, true); } -#line 11035 "MachineIndependent/glslang_tab.cpp" +#line 11103 "MachineIndependent/glslang_tab.cpp" break; - case 531: /* type_specifier_nonarray: I64IMAGE2DMS */ -#line 3498 "MachineIndependent/glslang.y" + case 533: /* type_specifier_nonarray: I64IMAGE2DMS */ +#line 3515 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd2D, false, false, true); } -#line 11045 "MachineIndependent/glslang_tab.cpp" +#line 11113 "MachineIndependent/glslang_tab.cpp" break; - case 532: /* type_specifier_nonarray: U64IMAGE2DMS */ -#line 3503 "MachineIndependent/glslang.y" + case 534: /* type_specifier_nonarray: U64IMAGE2DMS */ +#line 3520 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd2D, false, false, true); } -#line 11055 "MachineIndependent/glslang_tab.cpp" +#line 11123 "MachineIndependent/glslang_tab.cpp" break; - case 533: /* type_specifier_nonarray: I64IMAGE2DMSARRAY */ -#line 3508 "MachineIndependent/glslang.y" + case 535: /* type_specifier_nonarray: I64IMAGE2DMSARRAY */ +#line 3525 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd2D, true, false, true); } -#line 11065 "MachineIndependent/glslang_tab.cpp" +#line 11133 "MachineIndependent/glslang_tab.cpp" break; - case 534: /* type_specifier_nonarray: U64IMAGE2DMSARRAY */ -#line 3513 "MachineIndependent/glslang.y" + case 536: /* type_specifier_nonarray: U64IMAGE2DMSARRAY */ +#line 3530 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd2D, true, false, true); } -#line 11075 "MachineIndependent/glslang_tab.cpp" +#line 11143 "MachineIndependent/glslang_tab.cpp" break; - case 535: /* type_specifier_nonarray: SAMPLEREXTERNALOES */ -#line 3518 "MachineIndependent/glslang.y" + case 537: /* type_specifier_nonarray: SAMPLEREXTERNALOES */ +#line 3535 "MachineIndependent/glslang.y" { // GL_OES_EGL_image_external (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); (yyval.interm.type).sampler.external = true; } -#line 11086 "MachineIndependent/glslang_tab.cpp" +#line 11154 "MachineIndependent/glslang_tab.cpp" break; - case 536: /* type_specifier_nonarray: SAMPLEREXTERNAL2DY2YEXT */ -#line 3524 "MachineIndependent/glslang.y" + case 538: /* type_specifier_nonarray: SAMPLEREXTERNAL2DY2YEXT */ +#line 3541 "MachineIndependent/glslang.y" { // GL_EXT_YUV_target (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); (yyval.interm.type).sampler.yuv = true; } -#line 11097 "MachineIndependent/glslang_tab.cpp" +#line 11165 "MachineIndependent/glslang_tab.cpp" break; - case 537: /* type_specifier_nonarray: ATTACHMENTEXT */ -#line 3530 "MachineIndependent/glslang.y" + case 539: /* type_specifier_nonarray: ATTACHMENTEXT */ +#line 3547 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "attachmentEXT input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setAttachmentEXT(EbtFloat); } -#line 11108 "MachineIndependent/glslang_tab.cpp" +#line 11176 "MachineIndependent/glslang_tab.cpp" break; - case 538: /* type_specifier_nonarray: IATTACHMENTEXT */ -#line 3536 "MachineIndependent/glslang.y" + case 540: /* type_specifier_nonarray: IATTACHMENTEXT */ +#line 3553 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "attachmentEXT input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setAttachmentEXT(EbtInt); } -#line 11119 "MachineIndependent/glslang_tab.cpp" +#line 11187 "MachineIndependent/glslang_tab.cpp" break; - case 539: /* type_specifier_nonarray: UATTACHMENTEXT */ -#line 3542 "MachineIndependent/glslang.y" + case 541: /* type_specifier_nonarray: UATTACHMENTEXT */ +#line 3559 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "attachmentEXT input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setAttachmentEXT(EbtUint); } -#line 11130 "MachineIndependent/glslang_tab.cpp" +#line 11198 "MachineIndependent/glslang_tab.cpp" break; - case 540: /* type_specifier_nonarray: SUBPASSINPUT */ -#line 3548 "MachineIndependent/glslang.y" + case 542: /* type_specifier_nonarray: SUBPASSINPUT */ +#line 3565 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat); } -#line 11141 "MachineIndependent/glslang_tab.cpp" +#line 11209 "MachineIndependent/glslang_tab.cpp" break; - case 541: /* type_specifier_nonarray: SUBPASSINPUTMS */ -#line 3554 "MachineIndependent/glslang.y" + case 543: /* type_specifier_nonarray: SUBPASSINPUTMS */ +#line 3571 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat, true); } -#line 11152 "MachineIndependent/glslang_tab.cpp" +#line 11220 "MachineIndependent/glslang_tab.cpp" break; - case 542: /* type_specifier_nonarray: F16SUBPASSINPUT */ -#line 3560 "MachineIndependent/glslang.y" + case 544: /* type_specifier_nonarray: F16SUBPASSINPUT */ +#line 3577 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); @@ -11160,11 +11228,11 @@ yyreduce: (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat16); } -#line 11164 "MachineIndependent/glslang_tab.cpp" +#line 11232 "MachineIndependent/glslang_tab.cpp" break; - case 543: /* type_specifier_nonarray: F16SUBPASSINPUTMS */ -#line 3567 "MachineIndependent/glslang.y" + case 545: /* type_specifier_nonarray: F16SUBPASSINPUTMS */ +#line 3584 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); @@ -11172,55 +11240,55 @@ yyreduce: (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat16, true); } -#line 11176 "MachineIndependent/glslang_tab.cpp" +#line 11244 "MachineIndependent/glslang_tab.cpp" break; - case 544: /* type_specifier_nonarray: ISUBPASSINPUT */ -#line 3574 "MachineIndependent/glslang.y" + case 546: /* type_specifier_nonarray: ISUBPASSINPUT */ +#line 3591 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtInt); } -#line 11187 "MachineIndependent/glslang_tab.cpp" +#line 11255 "MachineIndependent/glslang_tab.cpp" break; - case 545: /* type_specifier_nonarray: ISUBPASSINPUTMS */ -#line 3580 "MachineIndependent/glslang.y" + case 547: /* type_specifier_nonarray: ISUBPASSINPUTMS */ +#line 3597 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtInt, true); } -#line 11198 "MachineIndependent/glslang_tab.cpp" +#line 11266 "MachineIndependent/glslang_tab.cpp" break; - case 546: /* type_specifier_nonarray: USUBPASSINPUT */ -#line 3586 "MachineIndependent/glslang.y" + case 548: /* type_specifier_nonarray: USUBPASSINPUT */ +#line 3603 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtUint); } -#line 11209 "MachineIndependent/glslang_tab.cpp" +#line 11277 "MachineIndependent/glslang_tab.cpp" break; - case 547: /* type_specifier_nonarray: USUBPASSINPUTMS */ -#line 3592 "MachineIndependent/glslang.y" + case 549: /* type_specifier_nonarray: USUBPASSINPUTMS */ +#line 3609 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtUint, true); } -#line 11220 "MachineIndependent/glslang_tab.cpp" +#line 11288 "MachineIndependent/glslang_tab.cpp" break; - case 548: /* type_specifier_nonarray: FCOOPMATNV */ -#line 3598 "MachineIndependent/glslang.y" + case 550: /* type_specifier_nonarray: FCOOPMATNV */ +#line 3615 "MachineIndependent/glslang.y" { parseContext.fcoopmatCheckNV((yyvsp[0].lex).loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -11228,11 +11296,11 @@ yyreduce: (yyval.interm.type).coopmatNV = true; (yyval.interm.type).coopmatKHR = false; } -#line 11232 "MachineIndependent/glslang_tab.cpp" +#line 11300 "MachineIndependent/glslang_tab.cpp" break; - case 549: /* type_specifier_nonarray: ICOOPMATNV */ -#line 3605 "MachineIndependent/glslang.y" + case 551: /* type_specifier_nonarray: ICOOPMATNV */ +#line 3622 "MachineIndependent/glslang.y" { parseContext.intcoopmatCheckNV((yyvsp[0].lex).loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -11240,11 +11308,11 @@ yyreduce: (yyval.interm.type).coopmatNV = true; (yyval.interm.type).coopmatKHR = false; } -#line 11244 "MachineIndependent/glslang_tab.cpp" +#line 11312 "MachineIndependent/glslang_tab.cpp" break; - case 550: /* type_specifier_nonarray: UCOOPMATNV */ -#line 3612 "MachineIndependent/glslang.y" + case 552: /* type_specifier_nonarray: UCOOPMATNV */ +#line 3629 "MachineIndependent/glslang.y" { parseContext.intcoopmatCheckNV((yyvsp[0].lex).loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -11252,11 +11320,11 @@ yyreduce: (yyval.interm.type).coopmatNV = true; (yyval.interm.type).coopmatKHR = false; } -#line 11256 "MachineIndependent/glslang_tab.cpp" +#line 11324 "MachineIndependent/glslang_tab.cpp" break; - case 551: /* type_specifier_nonarray: COOPMAT */ -#line 3619 "MachineIndependent/glslang.y" + case 553: /* type_specifier_nonarray: COOPMAT */ +#line 3636 "MachineIndependent/glslang.y" { parseContext.coopmatCheck((yyvsp[0].lex).loc, "coopmat", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -11264,90 +11332,110 @@ yyreduce: (yyval.interm.type).coopmatNV = false; (yyval.interm.type).coopmatKHR = true; } -#line 11268 "MachineIndependent/glslang_tab.cpp" +#line 11336 "MachineIndependent/glslang_tab.cpp" break; - case 552: /* type_specifier_nonarray: TENSORLAYOUTNV */ -#line 3626 "MachineIndependent/glslang.y" + case 554: /* type_specifier_nonarray: TENSORLAYOUTNV */ +#line 3643 "MachineIndependent/glslang.y" { parseContext.tensorLayoutViewCheck((yyvsp[0].lex).loc, "tensorLayoutNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtTensorLayoutNV; } -#line 11278 "MachineIndependent/glslang_tab.cpp" +#line 11346 "MachineIndependent/glslang_tab.cpp" break; - case 553: /* type_specifier_nonarray: TENSORVIEWNV */ -#line 3631 "MachineIndependent/glslang.y" + case 555: /* type_specifier_nonarray: TENSORVIEWNV */ +#line 3648 "MachineIndependent/glslang.y" { parseContext.tensorLayoutViewCheck((yyvsp[0].lex).loc, "tensorViewNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtTensorViewNV; } -#line 11288 "MachineIndependent/glslang_tab.cpp" +#line 11356 "MachineIndependent/glslang_tab.cpp" break; - case 554: /* type_specifier_nonarray: FUNCTION */ -#line 3636 "MachineIndependent/glslang.y" + case 556: /* type_specifier_nonarray: FUNCTION */ +#line 3653 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).basicType = EbtFunction; } -#line 11297 "MachineIndependent/glslang_tab.cpp" +#line 11365 "MachineIndependent/glslang_tab.cpp" break; - case 555: /* type_specifier_nonarray: COOPVECNV */ -#line 3640 "MachineIndependent/glslang.y" + case 557: /* type_specifier_nonarray: COOPVECNV */ +#line 3657 "MachineIndependent/glslang.y" { parseContext.coopvecCheck((yyvsp[0].lex).loc, "coopvecNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtCoopvecNV; (yyval.interm.type).coopvecNV = true; } -#line 11308 "MachineIndependent/glslang_tab.cpp" +#line 11376 "MachineIndependent/glslang_tab.cpp" break; - case 556: /* type_specifier_nonarray: TENSORARM */ -#line 3646 "MachineIndependent/glslang.y" + case 558: /* type_specifier_nonarray: TENSORARM */ +#line 3663 "MachineIndependent/glslang.y" { parseContext.tensorCheckARM((yyvsp[0].lex).loc, "tensorARM", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).tensorRankARM = 1; // placeholder value (yyval.interm.type).basicType = EbtTensorARM; } -#line 11319 "MachineIndependent/glslang_tab.cpp" +#line 11387 "MachineIndependent/glslang_tab.cpp" break; - case 557: /* type_specifier_nonarray: spirv_type_specifier */ -#line 3652 "MachineIndependent/glslang.y" + case 559: /* type_specifier_nonarray: VECTOR */ +#line 3669 "MachineIndependent/glslang.y" + { + parseContext.longVectorCheck((yyvsp[0].lex).loc, "vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtLongVector; + (yyval.interm.type).longVector = true; + } +#line 11398 "MachineIndependent/glslang_tab.cpp" + break; + + case 560: /* type_specifier_nonarray: spirv_type_specifier */ +#line 3675 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.type).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier"); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 11328 "MachineIndependent/glslang_tab.cpp" +#line 11407 "MachineIndependent/glslang_tab.cpp" break; - case 558: /* type_specifier_nonarray: HITOBJECTNV */ -#line 3656 "MachineIndependent/glslang.y" - { + case 561: /* type_specifier_nonarray: HITOBJECTNV */ +#line 3679 "MachineIndependent/glslang.y" + { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtHitObjectNV; - } -#line 11337 "MachineIndependent/glslang_tab.cpp" + } +#line 11416 "MachineIndependent/glslang_tab.cpp" break; - case 559: /* type_specifier_nonarray: struct_specifier */ -#line 3660 "MachineIndependent/glslang.y" + case 562: /* type_specifier_nonarray: HITOBJECTEXT */ +#line 3683 "MachineIndependent/glslang.y" + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtHitObjectEXT; + } +#line 11425 "MachineIndependent/glslang_tab.cpp" + break; + + case 563: /* type_specifier_nonarray: struct_specifier */ +#line 3687 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); (yyval.interm.type).qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; parseContext.structTypeCheck((yyval.interm.type).loc, (yyval.interm.type)); } -#line 11347 "MachineIndependent/glslang_tab.cpp" +#line 11435 "MachineIndependent/glslang_tab.cpp" break; - case 560: /* type_specifier_nonarray: TYPE_NAME */ -#line 3665 "MachineIndependent/glslang.y" + case 564: /* type_specifier_nonarray: TYPE_NAME */ +#line 3692 "MachineIndependent/glslang.y" { // // This is for user defined type names. The lexical phase looked up the @@ -11361,49 +11449,48 @@ yyreduce: } else parseContext.error((yyvsp[0].lex).loc, "expected type name", (yyvsp[0].lex).string->c_str(), ""); } -#line 11365 "MachineIndependent/glslang_tab.cpp" +#line 11453 "MachineIndependent/glslang_tab.cpp" break; - case 561: /* precision_qualifier: HIGH_PRECISION */ -#line 3681 "MachineIndependent/glslang.y" + case 565: /* precision_qualifier: HIGH_PRECISION */ +#line 3708 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqHigh); } -#line 11375 "MachineIndependent/glslang_tab.cpp" +#line 11463 "MachineIndependent/glslang_tab.cpp" break; - case 562: /* precision_qualifier: MEDIUM_PRECISION */ -#line 3686 "MachineIndependent/glslang.y" + case 566: /* precision_qualifier: MEDIUM_PRECISION */ +#line 3713 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqMedium); } -#line 11385 "MachineIndependent/glslang_tab.cpp" +#line 11473 "MachineIndependent/glslang_tab.cpp" break; - case 563: /* precision_qualifier: LOW_PRECISION */ -#line 3691 "MachineIndependent/glslang.y" + case 567: /* precision_qualifier: LOW_PRECISION */ +#line 3718 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqLow); } -#line 11395 "MachineIndependent/glslang_tab.cpp" +#line 11483 "MachineIndependent/glslang_tab.cpp" break; - case 564: /* $@3: %empty */ -#line 3699 "MachineIndependent/glslang.y" + case 568: /* $@3: %empty */ +#line 3726 "MachineIndependent/glslang.y" { parseContext.nestedStructCheck((yyvsp[-2].lex).loc); } -#line 11401 "MachineIndependent/glslang_tab.cpp" +#line 11489 "MachineIndependent/glslang_tab.cpp" break; - case 565: /* struct_specifier: STRUCT IDENTIFIER LEFT_BRACE $@3 struct_declaration_list RIGHT_BRACE */ -#line 3699 "MachineIndependent/glslang.y" + case 569: /* struct_specifier: STRUCT IDENTIFIER LEFT_BRACE $@3 struct_declaration_list RIGHT_BRACE */ +#line 3726 "MachineIndependent/glslang.y" { - TType* structure = new TType((yyvsp[-1].interm.typeList), *(yyvsp[-4].lex).string); parseContext.structArrayCheck((yyvsp[-4].lex).loc, *structure); @@ -11419,17 +11506,17 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 11423 "MachineIndependent/glslang_tab.cpp" +#line 11510 "MachineIndependent/glslang_tab.cpp" break; - case 566: /* $@4: %empty */ -#line 3716 "MachineIndependent/glslang.y" + case 570: /* $@4: %empty */ +#line 3742 "MachineIndependent/glslang.y" { parseContext.nestedStructCheck((yyvsp[-1].lex).loc); } -#line 11429 "MachineIndependent/glslang_tab.cpp" +#line 11516 "MachineIndependent/glslang_tab.cpp" break; - case 567: /* struct_specifier: STRUCT LEFT_BRACE $@4 struct_declaration_list RIGHT_BRACE */ -#line 3716 "MachineIndependent/glslang.y" + case 571: /* struct_specifier: STRUCT LEFT_BRACE $@4 struct_declaration_list RIGHT_BRACE */ +#line 3742 "MachineIndependent/glslang.y" { TType* structure = new TType((yyvsp[-1].interm.typeList), TString("")); (yyval.interm.type).init((yyvsp[-4].lex).loc); @@ -11437,20 +11524,28 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 11441 "MachineIndependent/glslang_tab.cpp" +#line 11528 "MachineIndependent/glslang_tab.cpp" break; - case 568: /* struct_declaration_list: struct_declaration */ -#line 3726 "MachineIndependent/glslang.y" - { + case 572: /* struct_declaration_list: struct_declaration_without_heap */ +#line 3752 "MachineIndependent/glslang.y" + { (yyval.interm.typeList) = (yyvsp[0].interm.typeList); } -#line 11449 "MachineIndependent/glslang_tab.cpp" +#line 11536 "MachineIndependent/glslang_tab.cpp" break; - case 569: /* struct_declaration_list: struct_declaration_list struct_declaration */ -#line 3729 "MachineIndependent/glslang.y" - { + case 573: /* struct_declaration_list: struct_declaration_with_heap */ +#line 3755 "MachineIndependent/glslang.y" + { + (yyval.interm.typeList) = (yyvsp[0].interm.typeList); + } +#line 11544 "MachineIndependent/glslang_tab.cpp" + break; + + case 574: /* struct_declaration_list: struct_declaration_with_heap struct_declaration_without_heap */ +#line 3758 "MachineIndependent/glslang.y" + { (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); for (unsigned int i = 0; i < (yyvsp[0].interm.typeList)->size(); ++i) { for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) { @@ -11460,11 +11555,91 @@ yyreduce: (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); } } -#line 11464 "MachineIndependent/glslang_tab.cpp" +#line 11559 "MachineIndependent/glslang_tab.cpp" break; - case 570: /* struct_declaration: type_specifier struct_declarator_list SEMICOLON */ -#line 3742 "MachineIndependent/glslang.y" + case 575: /* struct_declaration_list: struct_declaration_without_heap struct_declaration_with_heap */ +#line 3768 "MachineIndependent/glslang.y" + { + (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); + for (unsigned int i = 0; i < (yyvsp[0].interm.typeList)->size(); ++i) { + for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) { + if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[0].interm.typeList))[i].type->getFieldName()) + parseContext.error((*(yyvsp[0].interm.typeList))[i].loc, "duplicate member name:", "", (*(yyvsp[0].interm.typeList))[i].type->getFieldName().c_str()); + } + (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); + } + } +#line 11574 "MachineIndependent/glslang_tab.cpp" + break; + + case 576: /* struct_declaration_with_heap: block_heap_inner_structure struct_declarator_list SEMICOLON */ +#line 3781 "MachineIndependent/glslang.y" + { + (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); + parseContext.voidErrorCheck((yyvsp[-2].interm.type).loc, (*(yyvsp[-1].interm.typeList))[0].type->getFieldName(), (yyvsp[-2].interm.type).basicType); + parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier, (yyvsp[-2].interm.type).hasTypeParameter()); + + for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { + TType type((yyvsp[-2].interm.type)); + type.setFieldName((*(yyval.interm.typeList))[i].type->getFieldName()); + type.transferArraySizes((*(yyval.interm.typeList))[i].type->getArraySizes()); + type.copyArrayInnerSizes((yyvsp[-2].interm.type).arraySizes); + parseContext.arrayOfArrayVersionCheck((*(yyval.interm.typeList))[i].loc, type.getArraySizes()); + (*(yyval.interm.typeList))[i].type->shallowCopy(type); + } + } +#line 11593 "MachineIndependent/glslang_tab.cpp" + break; + + case 577: /* $@5: %empty */ +#line 3798 "MachineIndependent/glslang.y" + { parseContext.nestedBlockCheck((yyvsp[-1].interm.type).loc, true); } +#line 11599 "MachineIndependent/glslang_tab.cpp" + break; + + case 578: /* block_heap_inner_structure: type_qualifier LEFT_BRACE $@5 struct_declaration_without_heap RIGHT_BRACE */ +#line 3798 "MachineIndependent/glslang.y" + { + --parseContext.blockNestingLevel; + parseContext.globalQualifierFixCheck((yyvsp[-4].interm.type).loc, (yyvsp[-4].interm.type).qualifier); + parseContext.checkNoShaderLayouts((yyvsp[-4].interm.type).loc, (yyvsp[-4].interm.type).shaderQualifiers); + (yyval.interm.type).init((yyvsp[-4].interm.type).loc); + TType* innerStructure = new TType((yyvsp[-1].interm.typeList), TString("")); + (yyval.interm.type).basicType = EbtBlock; + (yyval.interm.type).userDef = innerStructure; + (yyval.interm.type).qualifier = (yyvsp[-4].interm.type).qualifier; + (yyval.interm.type).qualifier.layoutDescriptorHeap = true; + (yyval.interm.type).qualifier.layoutDescriptorInnerBlock = true; + } +#line 11616 "MachineIndependent/glslang_tab.cpp" + break; + + case 579: /* struct_declaration_without_heap: struct_declaration */ +#line 3813 "MachineIndependent/glslang.y" + { + (yyval.interm.typeList) = (yyvsp[0].interm.typeList); + } +#line 11624 "MachineIndependent/glslang_tab.cpp" + break; + + case 580: /* struct_declaration_without_heap: struct_declaration_without_heap struct_declaration */ +#line 3816 "MachineIndependent/glslang.y" + { + (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); + for (unsigned int i = 0; i < (yyvsp[0].interm.typeList)->size(); ++i) { + for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) { + if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[0].interm.typeList))[i].type->getFieldName()) + parseContext.error((*(yyvsp[0].interm.typeList))[i].loc, "duplicate member name:", "", (*(yyvsp[0].interm.typeList))[i].type->getFieldName().c_str()); + } + (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); + } + } +#line 11639 "MachineIndependent/glslang_tab.cpp" + break; + + case 581: /* struct_declaration: type_specifier struct_declarator_list SEMICOLON */ +#line 3829 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -11487,11 +11662,11 @@ yyreduce: (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 11491 "MachineIndependent/glslang_tab.cpp" +#line 11666 "MachineIndependent/glslang_tab.cpp" break; - case 571: /* struct_declaration: type_qualifier type_specifier struct_declarator_list SEMICOLON */ -#line 3764 "MachineIndependent/glslang.y" + case 582: /* struct_declaration: type_qualifier type_specifier struct_declarator_list SEMICOLON */ +#line 3851 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -11516,38 +11691,38 @@ yyreduce: (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 11520 "MachineIndependent/glslang_tab.cpp" +#line 11695 "MachineIndependent/glslang_tab.cpp" break; - case 572: /* struct_declarator_list: struct_declarator */ -#line 3791 "MachineIndependent/glslang.y" + case 583: /* struct_declarator_list: struct_declarator */ +#line 3878 "MachineIndependent/glslang.y" { (yyval.interm.typeList) = new TTypeList; (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 11529 "MachineIndependent/glslang_tab.cpp" +#line 11704 "MachineIndependent/glslang_tab.cpp" break; - case 573: /* struct_declarator_list: struct_declarator_list COMMA struct_declarator */ -#line 3795 "MachineIndependent/glslang.y" + case 584: /* struct_declarator_list: struct_declarator_list COMMA struct_declarator */ +#line 3882 "MachineIndependent/glslang.y" { (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 11537 "MachineIndependent/glslang_tab.cpp" +#line 11712 "MachineIndependent/glslang_tab.cpp" break; - case 574: /* struct_declarator: IDENTIFIER */ -#line 3801 "MachineIndependent/glslang.y" + case 585: /* struct_declarator: IDENTIFIER */ +#line 3888 "MachineIndependent/glslang.y" { (yyval.interm.typeLine).type = new TType(EbtVoid); (yyval.interm.typeLine).loc = (yyvsp[0].lex).loc; (yyval.interm.typeLine).type->setFieldName(*(yyvsp[0].lex).string); } -#line 11547 "MachineIndependent/glslang_tab.cpp" +#line 11722 "MachineIndependent/glslang_tab.cpp" break; - case 575: /* struct_declarator: IDENTIFIER array_specifier */ -#line 3806 "MachineIndependent/glslang.y" + case 586: /* struct_declarator: IDENTIFIER array_specifier */ +#line 3893 "MachineIndependent/glslang.y" { parseContext.arrayOfArrayVersionCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes); @@ -11556,168 +11731,168 @@ yyreduce: (yyval.interm.typeLine).type->setFieldName(*(yyvsp[-1].lex).string); (yyval.interm.typeLine).type->transferArraySizes((yyvsp[0].interm).arraySizes); } -#line 11560 "MachineIndependent/glslang_tab.cpp" +#line 11735 "MachineIndependent/glslang_tab.cpp" break; - case 576: /* initializer: assignment_expression */ -#line 3817 "MachineIndependent/glslang.y" + case 587: /* initializer: assignment_expression */ +#line 3904 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 11568 "MachineIndependent/glslang_tab.cpp" +#line 11743 "MachineIndependent/glslang_tab.cpp" break; - case 577: /* initializer: LEFT_BRACE initializer_list RIGHT_BRACE */ -#line 3820 "MachineIndependent/glslang.y" + case 588: /* initializer: LEFT_BRACE initializer_list RIGHT_BRACE */ +#line 3907 "MachineIndependent/glslang.y" { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[-2].lex).loc, ~EEsProfile, initFeature); parseContext.profileRequires((yyvsp[-2].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); } -#line 11579 "MachineIndependent/glslang_tab.cpp" +#line 11754 "MachineIndependent/glslang_tab.cpp" break; - case 578: /* initializer: LEFT_BRACE initializer_list COMMA RIGHT_BRACE */ -#line 3826 "MachineIndependent/glslang.y" + case 589: /* initializer: LEFT_BRACE initializer_list COMMA RIGHT_BRACE */ +#line 3913 "MachineIndependent/glslang.y" { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[-3].lex).loc, ~EEsProfile, initFeature); parseContext.profileRequires((yyvsp[-3].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 11590 "MachineIndependent/glslang_tab.cpp" +#line 11765 "MachineIndependent/glslang_tab.cpp" break; - case 579: /* initializer: LEFT_BRACE RIGHT_BRACE */ -#line 3832 "MachineIndependent/glslang.y" + case 590: /* initializer: LEFT_BRACE RIGHT_BRACE */ +#line 3919 "MachineIndependent/glslang.y" { const char* initFeature = "empty { } initializer"; parseContext.profileRequires((yyvsp[-1].lex).loc, EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); parseContext.profileRequires((yyvsp[-1].lex).loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); (yyval.interm.intermTypedNode) = parseContext.intermediate.makeAggregate((yyvsp[-1].lex).loc); } -#line 11601 "MachineIndependent/glslang_tab.cpp" +#line 11776 "MachineIndependent/glslang_tab.cpp" break; - case 580: /* initializer_list: initializer */ -#line 3841 "MachineIndependent/glslang.y" + case 591: /* initializer_list: initializer */ +#line 3928 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); } -#line 11609 "MachineIndependent/glslang_tab.cpp" +#line 11784 "MachineIndependent/glslang_tab.cpp" break; - case 581: /* initializer_list: initializer_list COMMA initializer */ -#line 3844 "MachineIndependent/glslang.y" + case 592: /* initializer_list: initializer_list COMMA initializer */ +#line 3931 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); } -#line 11617 "MachineIndependent/glslang_tab.cpp" +#line 11792 "MachineIndependent/glslang_tab.cpp" break; - case 582: /* declaration_statement: declaration */ -#line 3850 "MachineIndependent/glslang.y" + case 593: /* declaration_statement: declaration */ +#line 3937 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11623 "MachineIndependent/glslang_tab.cpp" +#line 11798 "MachineIndependent/glslang_tab.cpp" break; - case 583: /* statement: compound_statement */ -#line 3854 "MachineIndependent/glslang.y" + case 594: /* statement: compound_statement */ +#line 3941 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11629 "MachineIndependent/glslang_tab.cpp" +#line 11804 "MachineIndependent/glslang_tab.cpp" break; - case 584: /* statement: simple_statement */ -#line 3855 "MachineIndependent/glslang.y" + case 595: /* statement: simple_statement */ +#line 3942 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11635 "MachineIndependent/glslang_tab.cpp" +#line 11810 "MachineIndependent/glslang_tab.cpp" break; - case 585: /* simple_statement: declaration_statement */ -#line 3861 "MachineIndependent/glslang.y" + case 596: /* simple_statement: declaration_statement */ +#line 3948 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11641 "MachineIndependent/glslang_tab.cpp" +#line 11816 "MachineIndependent/glslang_tab.cpp" break; - case 586: /* simple_statement: expression_statement */ -#line 3862 "MachineIndependent/glslang.y" + case 597: /* simple_statement: expression_statement */ +#line 3949 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11647 "MachineIndependent/glslang_tab.cpp" +#line 11822 "MachineIndependent/glslang_tab.cpp" break; - case 587: /* simple_statement: selection_statement */ -#line 3863 "MachineIndependent/glslang.y" + case 598: /* simple_statement: selection_statement */ +#line 3950 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11653 "MachineIndependent/glslang_tab.cpp" +#line 11828 "MachineIndependent/glslang_tab.cpp" break; - case 588: /* simple_statement: switch_statement */ -#line 3864 "MachineIndependent/glslang.y" + case 599: /* simple_statement: switch_statement */ +#line 3951 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11659 "MachineIndependent/glslang_tab.cpp" +#line 11834 "MachineIndependent/glslang_tab.cpp" break; - case 589: /* simple_statement: case_label */ -#line 3865 "MachineIndependent/glslang.y" + case 600: /* simple_statement: case_label */ +#line 3952 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11665 "MachineIndependent/glslang_tab.cpp" +#line 11840 "MachineIndependent/glslang_tab.cpp" break; - case 590: /* simple_statement: iteration_statement */ -#line 3866 "MachineIndependent/glslang.y" + case 601: /* simple_statement: iteration_statement */ +#line 3953 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11671 "MachineIndependent/glslang_tab.cpp" +#line 11846 "MachineIndependent/glslang_tab.cpp" break; - case 591: /* simple_statement: jump_statement */ -#line 3867 "MachineIndependent/glslang.y" + case 602: /* simple_statement: jump_statement */ +#line 3954 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11677 "MachineIndependent/glslang_tab.cpp" +#line 11852 "MachineIndependent/glslang_tab.cpp" break; - case 592: /* simple_statement: demote_statement */ -#line 3868 "MachineIndependent/glslang.y" + case 603: /* simple_statement: demote_statement */ +#line 3955 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11683 "MachineIndependent/glslang_tab.cpp" +#line 11858 "MachineIndependent/glslang_tab.cpp" break; - case 593: /* demote_statement: DEMOTE SEMICOLON */ -#line 3872 "MachineIndependent/glslang.y" + case 604: /* demote_statement: DEMOTE SEMICOLON */ +#line 3959 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "demote"); parseContext.requireExtensions((yyvsp[-1].lex).loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDemote, (yyvsp[-1].lex).loc); } -#line 11693 "MachineIndependent/glslang_tab.cpp" +#line 11868 "MachineIndependent/glslang_tab.cpp" break; - case 594: /* compound_statement: LEFT_BRACE RIGHT_BRACE */ -#line 3880 "MachineIndependent/glslang.y" + case 605: /* compound_statement: LEFT_BRACE RIGHT_BRACE */ +#line 3967 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; } -#line 11699 "MachineIndependent/glslang_tab.cpp" +#line 11874 "MachineIndependent/glslang_tab.cpp" break; - case 595: /* $@5: %empty */ -#line 3881 "MachineIndependent/glslang.y" + case 606: /* $@6: %empty */ +#line 3968 "MachineIndependent/glslang.y" { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; } -#line 11708 "MachineIndependent/glslang_tab.cpp" +#line 11883 "MachineIndependent/glslang_tab.cpp" break; - case 596: /* $@6: %empty */ -#line 3885 "MachineIndependent/glslang.y" + case 607: /* $@7: %empty */ +#line 3972 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; } -#line 11717 "MachineIndependent/glslang_tab.cpp" +#line 11892 "MachineIndependent/glslang_tab.cpp" break; - case 597: /* compound_statement: LEFT_BRACE $@5 statement_list $@6 RIGHT_BRACE */ -#line 3889 "MachineIndependent/glslang.y" + case 608: /* compound_statement: LEFT_BRACE $@6 statement_list $@7 RIGHT_BRACE */ +#line 3976 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.intermNode) && (yyvsp[-2].interm.intermNode)->getAsAggregate()) { (yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence); @@ -11725,69 +11900,69 @@ yyreduce: } (yyval.interm.intermNode) = (yyvsp[-2].interm.intermNode); } -#line 11729 "MachineIndependent/glslang_tab.cpp" +#line 11904 "MachineIndependent/glslang_tab.cpp" break; - case 598: /* statement_no_new_scope: compound_statement_no_new_scope */ -#line 3899 "MachineIndependent/glslang.y" + case 609: /* statement_no_new_scope: compound_statement_no_new_scope */ +#line 3986 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11735 "MachineIndependent/glslang_tab.cpp" +#line 11910 "MachineIndependent/glslang_tab.cpp" break; - case 599: /* statement_no_new_scope: simple_statement */ -#line 3900 "MachineIndependent/glslang.y" + case 610: /* statement_no_new_scope: simple_statement */ +#line 3987 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11741 "MachineIndependent/glslang_tab.cpp" +#line 11916 "MachineIndependent/glslang_tab.cpp" break; - case 600: /* $@7: %empty */ -#line 3904 "MachineIndependent/glslang.y" + case 611: /* $@8: %empty */ +#line 3991 "MachineIndependent/glslang.y" { ++parseContext.controlFlowNestingLevel; } -#line 11749 "MachineIndependent/glslang_tab.cpp" +#line 11924 "MachineIndependent/glslang_tab.cpp" break; - case 601: /* statement_scoped: $@7 compound_statement */ -#line 3907 "MachineIndependent/glslang.y" + case 612: /* statement_scoped: $@8 compound_statement */ +#line 3994 "MachineIndependent/glslang.y" { --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11758 "MachineIndependent/glslang_tab.cpp" +#line 11933 "MachineIndependent/glslang_tab.cpp" break; - case 602: /* $@8: %empty */ -#line 3911 "MachineIndependent/glslang.y" + case 613: /* $@9: %empty */ +#line 3998 "MachineIndependent/glslang.y" { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 11768 "MachineIndependent/glslang_tab.cpp" +#line 11943 "MachineIndependent/glslang_tab.cpp" break; - case 603: /* statement_scoped: $@8 simple_statement */ -#line 3916 "MachineIndependent/glslang.y" + case 614: /* statement_scoped: $@9 simple_statement */ +#line 4003 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11779 "MachineIndependent/glslang_tab.cpp" +#line 11954 "MachineIndependent/glslang_tab.cpp" break; - case 604: /* compound_statement_no_new_scope: LEFT_BRACE RIGHT_BRACE */ -#line 3925 "MachineIndependent/glslang.y" + case 615: /* compound_statement_no_new_scope: LEFT_BRACE RIGHT_BRACE */ +#line 4012 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; } -#line 11787 "MachineIndependent/glslang_tab.cpp" +#line 11962 "MachineIndependent/glslang_tab.cpp" break; - case 605: /* compound_statement_no_new_scope: LEFT_BRACE statement_list RIGHT_BRACE */ -#line 3928 "MachineIndependent/glslang.y" + case 616: /* compound_statement_no_new_scope: LEFT_BRACE statement_list RIGHT_BRACE */ +#line 4015 "MachineIndependent/glslang.y" { if ((yyvsp[-1].interm.intermNode) && (yyvsp[-1].interm.intermNode)->getAsAggregate()) { (yyvsp[-1].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); @@ -11795,11 +11970,11 @@ yyreduce: } (yyval.interm.intermNode) = (yyvsp[-1].interm.intermNode); } -#line 11799 "MachineIndependent/glslang_tab.cpp" +#line 11974 "MachineIndependent/glslang_tab.cpp" break; - case 606: /* statement_list: statement */ -#line 3938 "MachineIndependent/glslang.y" + case 617: /* statement_list: statement */ +#line 4025 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || @@ -11808,11 +11983,11 @@ yyreduce: (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case } } -#line 11812 "MachineIndependent/glslang_tab.cpp" +#line 11987 "MachineIndependent/glslang_tab.cpp" break; - case 607: /* statement_list: statement_list statement */ -#line 3946 "MachineIndependent/glslang.y" + case 618: /* statement_list: statement_list statement */ +#line 4033 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { @@ -11821,110 +11996,106 @@ yyreduce: } else (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 11825 "MachineIndependent/glslang_tab.cpp" +#line 12000 "MachineIndependent/glslang_tab.cpp" break; - case 608: /* expression_statement: SEMICOLON */ -#line 3957 "MachineIndependent/glslang.y" + case 619: /* expression_statement: SEMICOLON */ +#line 4044 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; } -#line 11831 "MachineIndependent/glslang_tab.cpp" +#line 12006 "MachineIndependent/glslang_tab.cpp" break; - case 609: /* expression_statement: expression SEMICOLON */ -#line 3958 "MachineIndependent/glslang.y" + case 620: /* expression_statement: expression SEMICOLON */ +#line 4045 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = static_cast((yyvsp[-1].interm.intermTypedNode)); } -#line 11837 "MachineIndependent/glslang_tab.cpp" +#line 12012 "MachineIndependent/glslang_tab.cpp" break; - case 610: /* selection_statement: selection_statement_nonattributed */ -#line 3962 "MachineIndependent/glslang.y" + case 621: /* selection_statement: selection_statement_nonattributed */ +#line 4049 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11845 "MachineIndependent/glslang_tab.cpp" +#line 12020 "MachineIndependent/glslang_tab.cpp" break; - case 611: /* selection_statement: attribute selection_statement_nonattributed */ -#line 3965 "MachineIndependent/glslang.y" + case 622: /* selection_statement: attribute selection_statement_nonattributed */ +#line 4052 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.intermNode)->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.handleSelectionAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11855 "MachineIndependent/glslang_tab.cpp" +#line 12030 "MachineIndependent/glslang_tab.cpp" break; - case 612: /* selection_statement_nonattributed: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement */ -#line 3972 "MachineIndependent/glslang.y" + case 623: /* selection_statement_nonattributed: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement */ +#line 4059 "MachineIndependent/glslang.y" { parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-2].interm.intermTypedNode)); (yyval.interm.intermNode) = parseContext.intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yyvsp[-4].lex).loc); } -#line 11864 "MachineIndependent/glslang_tab.cpp" +#line 12039 "MachineIndependent/glslang_tab.cpp" break; - case 613: /* selection_rest_statement: statement_scoped ELSE statement_scoped */ -#line 3979 "MachineIndependent/glslang.y" + case 624: /* selection_rest_statement: statement_scoped ELSE statement_scoped */ +#line 4066 "MachineIndependent/glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode); } -#line 11873 "MachineIndependent/glslang_tab.cpp" +#line 12048 "MachineIndependent/glslang_tab.cpp" break; - case 614: /* selection_rest_statement: statement_scoped */ -#line 3983 "MachineIndependent/glslang.y" + case 625: /* selection_rest_statement: statement_scoped */ +#line 4070 "MachineIndependent/glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } -#line 11882 "MachineIndependent/glslang_tab.cpp" +#line 12057 "MachineIndependent/glslang_tab.cpp" break; - case 615: /* condition: expression */ -#line 3991 "MachineIndependent/glslang.y" + case 626: /* condition: expression */ +#line 4078 "MachineIndependent/glslang.y" { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermTypedNode); parseContext.boolCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode)); } -#line 11891 "MachineIndependent/glslang_tab.cpp" +#line 12066 "MachineIndependent/glslang_tab.cpp" break; - case 616: /* condition: fully_specified_type IDENTIFIER EQUAL initializer */ -#line 3995 "MachineIndependent/glslang.y" + case 627: /* condition: fully_specified_type IDENTIFIER EQUAL initializer */ +#line 4082 "MachineIndependent/glslang.y" { parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); TType type((yyvsp[-3].interm.type)); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); - if (initNode) - (yyval.interm.intermTypedNode) = initNode->getAsTyped(); - else - (yyval.interm.intermTypedNode) = 0; + (yyval.interm.intermNode) = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); } -#line 11906 "MachineIndependent/glslang_tab.cpp" +#line 12077 "MachineIndependent/glslang_tab.cpp" break; - case 617: /* switch_statement: switch_statement_nonattributed */ -#line 4008 "MachineIndependent/glslang.y" + case 628: /* switch_statement: switch_statement_nonattributed */ +#line 4091 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11914 "MachineIndependent/glslang_tab.cpp" +#line 12085 "MachineIndependent/glslang_tab.cpp" break; - case 618: /* switch_statement: attribute switch_statement_nonattributed */ -#line 4011 "MachineIndependent/glslang.y" + case 629: /* switch_statement: attribute switch_statement_nonattributed */ +#line 4094 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.intermNode)->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.handleSwitchAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11924 "MachineIndependent/glslang_tab.cpp" +#line 12095 "MachineIndependent/glslang_tab.cpp" break; - case 619: /* $@9: %empty */ -#line 4018 "MachineIndependent/glslang.y" + case 630: /* $@10: %empty */ +#line 4101 "MachineIndependent/glslang.y" { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -11933,11 +12104,11 @@ yyreduce: parseContext.switchLevel.push_back(parseContext.statementNestingLevel); parseContext.symbolTable.push(); } -#line 11937 "MachineIndependent/glslang_tab.cpp" +#line 12108 "MachineIndependent/glslang_tab.cpp" break; - case 620: /* switch_statement_nonattributed: SWITCH LEFT_PAREN expression RIGHT_PAREN $@9 LEFT_BRACE switch_statement_list RIGHT_BRACE */ -#line 4026 "MachineIndependent/glslang.y" + case 631: /* switch_statement_nonattributed: SWITCH LEFT_PAREN expression RIGHT_PAREN $@10 LEFT_BRACE switch_statement_list RIGHT_BRACE */ +#line 4109 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[-7].lex).loc, (yyvsp[-5].interm.intermTypedNode), (yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0); delete parseContext.switchSequenceStack.back(); @@ -11947,27 +12118,27 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 11951 "MachineIndependent/glslang_tab.cpp" +#line 12122 "MachineIndependent/glslang_tab.cpp" break; - case 621: /* switch_statement_list: %empty */ -#line 4038 "MachineIndependent/glslang.y" + case 632: /* switch_statement_list: %empty */ +#line 4121 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; } -#line 11959 "MachineIndependent/glslang_tab.cpp" +#line 12130 "MachineIndependent/glslang_tab.cpp" break; - case 622: /* switch_statement_list: statement_list */ -#line 4041 "MachineIndependent/glslang.y" + case 633: /* switch_statement_list: statement_list */ +#line 4124 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11967 "MachineIndependent/glslang_tab.cpp" +#line 12138 "MachineIndependent/glslang_tab.cpp" break; - case 623: /* case_label: CASE expression COLON */ -#line 4047 "MachineIndependent/glslang.y" + case 634: /* case_label: CASE expression COLON */ +#line 4130 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -11980,11 +12151,11 @@ yyreduce: (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } } -#line 11984 "MachineIndependent/glslang_tab.cpp" +#line 12155 "MachineIndependent/glslang_tab.cpp" break; - case 624: /* case_label: DEFAULT COLON */ -#line 4059 "MachineIndependent/glslang.y" + case 635: /* case_label: DEFAULT COLON */ +#line 4142 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -11994,30 +12165,30 @@ yyreduce: else (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[-1].lex).loc); } -#line 11998 "MachineIndependent/glslang_tab.cpp" +#line 12169 "MachineIndependent/glslang_tab.cpp" break; - case 625: /* iteration_statement: iteration_statement_nonattributed */ -#line 4071 "MachineIndependent/glslang.y" + case 636: /* iteration_statement: iteration_statement_nonattributed */ +#line 4154 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 12006 "MachineIndependent/glslang_tab.cpp" +#line 12177 "MachineIndependent/glslang_tab.cpp" break; - case 626: /* iteration_statement: attribute iteration_statement_nonattributed */ -#line 4074 "MachineIndependent/glslang.y" + case 637: /* iteration_statement: attribute iteration_statement_nonattributed */ +#line 4157 "MachineIndependent/glslang.y" { const char * extensions[2] = { E_GL_EXT_control_flow_attributes, E_GL_EXT_control_flow_attributes2 }; parseContext.requireExtensions((yyvsp[0].interm.intermNode)->getLoc(), 2, extensions, "attribute"); parseContext.handleLoopAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 12017 "MachineIndependent/glslang_tab.cpp" +#line 12188 "MachineIndependent/glslang_tab.cpp" break; - case 627: /* $@10: %empty */ -#line 4082 "MachineIndependent/glslang.y" + case 638: /* $@11: %empty */ +#line 4165 "MachineIndependent/glslang.y" { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-1].lex).loc, "while loops not available", "limitation", ""); @@ -12026,34 +12197,38 @@ yyreduce: ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 12030 "MachineIndependent/glslang_tab.cpp" +#line 12201 "MachineIndependent/glslang_tab.cpp" break; - case 628: /* iteration_statement_nonattributed: WHILE LEFT_PAREN $@10 condition RIGHT_PAREN statement_no_new_scope */ -#line 4090 "MachineIndependent/glslang.y" + case 639: /* iteration_statement_nonattributed: WHILE LEFT_PAREN $@11 condition RIGHT_PAREN statement_no_new_scope */ +#line 4173 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, true, (yyvsp[-5].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermNode), 0, true, (yyvsp[-5].lex).loc); + if (parseContext.intermediate.getDebugInfo()) { + (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyval.interm.intermNode), (yyvsp[-5].lex).loc); + (yyval.interm.intermNode)->getAsAggregate()->setOperator(EOpScope); + } --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 12042 "MachineIndependent/glslang_tab.cpp" +#line 12217 "MachineIndependent/glslang_tab.cpp" break; - case 629: /* $@11: %empty */ -#line 4097 "MachineIndependent/glslang.y" + case 640: /* $@12: %empty */ +#line 4184 "MachineIndependent/glslang.y" { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 12053 "MachineIndependent/glslang_tab.cpp" +#line 12228 "MachineIndependent/glslang_tab.cpp" break; - case 630: /* iteration_statement_nonattributed: DO $@11 statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON */ -#line 4103 "MachineIndependent/glslang.y" + case 641: /* iteration_statement_nonattributed: DO $@12 statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON */ +#line 4190 "MachineIndependent/glslang.y" { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-7].lex).loc, "do-while loops not available", "limitation", ""); @@ -12061,27 +12236,31 @@ yyreduce: parseContext.boolCheck((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode)); (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[-5].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, false, (yyvsp[-4].lex).loc); + if (parseContext.intermediate.getDebugInfo()) { + (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyval.interm.intermNode), (yyvsp[-4].lex).loc); + (yyval.interm.intermNode)->getAsAggregate()->setOperator(EOpScope); + } parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 12070 "MachineIndependent/glslang_tab.cpp" +#line 12249 "MachineIndependent/glslang_tab.cpp" break; - case 631: /* $@12: %empty */ -#line 4115 "MachineIndependent/glslang.y" + case 642: /* $@13: %empty */ +#line 4206 "MachineIndependent/glslang.y" { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 12081 "MachineIndependent/glslang_tab.cpp" +#line 12260 "MachineIndependent/glslang_tab.cpp" break; - case 632: /* iteration_statement_nonattributed: FOR LEFT_PAREN $@12 for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope */ -#line 4121 "MachineIndependent/glslang.y" + case 643: /* iteration_statement_nonattributed: FOR LEFT_PAREN $@13 for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope */ +#line 4212 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[-3].interm.intermNode), (yyvsp[-5].lex).loc); @@ -12089,86 +12268,86 @@ yyreduce: if (! parseContext.limits.nonInductiveForLoops) parseContext.inductiveLoopCheck((yyvsp[-6].lex).loc, (yyvsp[-3].interm.intermNode), forLoop); (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyval.interm.intermNode), forLoop, (yyvsp[-6].lex).loc); - (yyval.interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); + (yyval.interm.intermNode)->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 12098 "MachineIndependent/glslang_tab.cpp" +#line 12277 "MachineIndependent/glslang_tab.cpp" break; - case 633: /* for_init_statement: expression_statement */ -#line 4136 "MachineIndependent/glslang.y" + case 644: /* for_init_statement: expression_statement */ +#line 4227 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 12106 "MachineIndependent/glslang_tab.cpp" +#line 12285 "MachineIndependent/glslang_tab.cpp" break; - case 634: /* for_init_statement: declaration_statement */ -#line 4139 "MachineIndependent/glslang.y" + case 645: /* for_init_statement: declaration_statement */ +#line 4230 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 12114 "MachineIndependent/glslang_tab.cpp" +#line 12293 "MachineIndependent/glslang_tab.cpp" break; - case 635: /* conditionopt: condition */ -#line 4145 "MachineIndependent/glslang.y" + case 646: /* conditionopt: condition */ +#line 4236 "MachineIndependent/glslang.y" { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 12122 "MachineIndependent/glslang_tab.cpp" +#line 12301 "MachineIndependent/glslang_tab.cpp" break; - case 636: /* conditionopt: %empty */ -#line 4148 "MachineIndependent/glslang.y" + case 647: /* conditionopt: %empty */ +#line 4239 "MachineIndependent/glslang.y" { - (yyval.interm.intermTypedNode) = 0; + (yyval.interm.intermNode) = 0; } -#line 12130 "MachineIndependent/glslang_tab.cpp" +#line 12309 "MachineIndependent/glslang_tab.cpp" break; - case 637: /* for_rest_statement: conditionopt SEMICOLON */ -#line 4154 "MachineIndependent/glslang.y" + case 648: /* for_rest_statement: conditionopt SEMICOLON */ +#line 4245 "MachineIndependent/glslang.y" { - (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); + (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } -#line 12139 "MachineIndependent/glslang_tab.cpp" +#line 12318 "MachineIndependent/glslang_tab.cpp" break; - case 638: /* for_rest_statement: conditionopt SEMICOLON expression */ -#line 4158 "MachineIndependent/glslang.y" + case 649: /* for_rest_statement: conditionopt SEMICOLON expression */ +#line 4249 "MachineIndependent/glslang.y" { - (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode); + (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode); } -#line 12148 "MachineIndependent/glslang_tab.cpp" +#line 12327 "MachineIndependent/glslang_tab.cpp" break; - case 639: /* jump_statement: CONTINUE SEMICOLON */ -#line 4165 "MachineIndependent/glslang.y" + case 650: /* jump_statement: CONTINUE SEMICOLON */ +#line 4256 "MachineIndependent/glslang.y" { if (parseContext.loopNestingLevel <= 0) parseContext.error((yyvsp[-1].lex).loc, "continue statement only allowed in loops", "", ""); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpContinue, (yyvsp[-1].lex).loc); } -#line 12158 "MachineIndependent/glslang_tab.cpp" +#line 12337 "MachineIndependent/glslang_tab.cpp" break; - case 640: /* jump_statement: BREAK SEMICOLON */ -#line 4170 "MachineIndependent/glslang.y" + case 651: /* jump_statement: BREAK SEMICOLON */ +#line 4261 "MachineIndependent/glslang.y" { if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) parseContext.error((yyvsp[-1].lex).loc, "break statement only allowed in switch and loops", "", ""); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpBreak, (yyvsp[-1].lex).loc); } -#line 12168 "MachineIndependent/glslang_tab.cpp" +#line 12347 "MachineIndependent/glslang_tab.cpp" break; - case 641: /* jump_statement: RETURN SEMICOLON */ -#line 4175 "MachineIndependent/glslang.y" + case 652: /* jump_statement: RETURN SEMICOLON */ +#line 4266 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].lex).loc); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) @@ -12176,101 +12355,101 @@ yyreduce: if (parseContext.inMain) parseContext.postEntryPointReturn = true; } -#line 12180 "MachineIndependent/glslang_tab.cpp" +#line 12359 "MachineIndependent/glslang_tab.cpp" break; - case 642: /* jump_statement: RETURN expression SEMICOLON */ -#line 4182 "MachineIndependent/glslang.y" + case 653: /* jump_statement: RETURN expression SEMICOLON */ +#line 4273 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.handleReturnValue((yyvsp[-2].lex).loc, (yyvsp[-1].interm.intermTypedNode)); } -#line 12188 "MachineIndependent/glslang_tab.cpp" +#line 12367 "MachineIndependent/glslang_tab.cpp" break; - case 643: /* jump_statement: DISCARD SEMICOLON */ -#line 4185 "MachineIndependent/glslang.y" + case 654: /* jump_statement: DISCARD SEMICOLON */ +#line 4276 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "discard"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpKill, (yyvsp[-1].lex).loc); } -#line 12197 "MachineIndependent/glslang_tab.cpp" +#line 12376 "MachineIndependent/glslang_tab.cpp" break; - case 644: /* jump_statement: TERMINATE_INVOCATION SEMICOLON */ -#line 4189 "MachineIndependent/glslang.y" + case 655: /* jump_statement: TERMINATE_INVOCATION SEMICOLON */ +#line 4280 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "terminateInvocation"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpTerminateInvocation, (yyvsp[-1].lex).loc); } -#line 12206 "MachineIndependent/glslang_tab.cpp" +#line 12385 "MachineIndependent/glslang_tab.cpp" break; - case 645: /* jump_statement: TERMINATE_RAY SEMICOLON */ -#line 4193 "MachineIndependent/glslang.y" + case 656: /* jump_statement: TERMINATE_RAY SEMICOLON */ +#line 4284 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangAnyHit, "terminateRayEXT"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpTerminateRayKHR, (yyvsp[-1].lex).loc); } -#line 12215 "MachineIndependent/glslang_tab.cpp" +#line 12394 "MachineIndependent/glslang_tab.cpp" break; - case 646: /* jump_statement: IGNORE_INTERSECTION SEMICOLON */ -#line 4197 "MachineIndependent/glslang.y" + case 657: /* jump_statement: IGNORE_INTERSECTION SEMICOLON */ +#line 4288 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangAnyHit, "ignoreIntersectionEXT"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, (yyvsp[-1].lex).loc); } -#line 12224 "MachineIndependent/glslang_tab.cpp" +#line 12403 "MachineIndependent/glslang_tab.cpp" break; - case 647: /* translation_unit: external_declaration */ -#line 4206 "MachineIndependent/glslang.y" + case 658: /* translation_unit: external_declaration */ +#line 4297 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } -#line 12233 "MachineIndependent/glslang_tab.cpp" +#line 12412 "MachineIndependent/glslang_tab.cpp" break; - case 648: /* translation_unit: translation_unit external_declaration */ -#line 4210 "MachineIndependent/glslang.y" + case 659: /* translation_unit: translation_unit external_declaration */ +#line 4301 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermNode) != nullptr) { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } } -#line 12244 "MachineIndependent/glslang_tab.cpp" +#line 12423 "MachineIndependent/glslang_tab.cpp" break; - case 649: /* external_declaration: function_definition */ -#line 4219 "MachineIndependent/glslang.y" + case 660: /* external_declaration: function_definition */ +#line 4310 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 12252 "MachineIndependent/glslang_tab.cpp" +#line 12431 "MachineIndependent/glslang_tab.cpp" break; - case 650: /* external_declaration: declaration */ -#line 4222 "MachineIndependent/glslang.y" + case 661: /* external_declaration: declaration */ +#line 4313 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 12260 "MachineIndependent/glslang_tab.cpp" +#line 12439 "MachineIndependent/glslang_tab.cpp" break; - case 651: /* external_declaration: SEMICOLON */ -#line 4225 "MachineIndependent/glslang.y" + case 662: /* external_declaration: SEMICOLON */ +#line 4316 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "extraneous semicolon"); parseContext.profileRequires((yyvsp[0].lex).loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); (yyval.interm.intermNode) = nullptr; } -#line 12270 "MachineIndependent/glslang_tab.cpp" +#line 12449 "MachineIndependent/glslang_tab.cpp" break; - case 652: /* $@13: %empty */ -#line 4233 "MachineIndependent/glslang.y" + case 663: /* $@14: %empty */ +#line 4324 "MachineIndependent/glslang.y" { (yyvsp[0].interm).function = parseContext.handleFunctionDeclarator((yyvsp[0].interm).loc, *(yyvsp[0].interm).function, false /* not prototype */); (yyvsp[0].interm).intermNode = parseContext.handleFunctionDefinition((yyvsp[0].interm).loc, *(yyvsp[0].interm).function); @@ -12283,11 +12462,11 @@ yyreduce: ++parseContext.statementNestingLevel; } } -#line 12287 "MachineIndependent/glslang_tab.cpp" +#line 12466 "MachineIndependent/glslang_tab.cpp" break; - case 653: /* function_definition: function_prototype $@13 compound_statement_no_new_scope */ -#line 4245 "MachineIndependent/glslang.y" + case 664: /* function_definition: function_prototype $@14 compound_statement_no_new_scope */ +#line 4336 "MachineIndependent/glslang.y" { // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) @@ -12315,228 +12494,228 @@ yyreduce: --parseContext.statementNestingLevel; } } -#line 12319 "MachineIndependent/glslang_tab.cpp" +#line 12498 "MachineIndependent/glslang_tab.cpp" break; - case 654: /* attribute: LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET */ -#line 4275 "MachineIndependent/glslang.y" + case 665: /* attribute: LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET */ +#line 4366 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = (yyvsp[-2].interm.attributes); } -#line 12327 "MachineIndependent/glslang_tab.cpp" +#line 12506 "MachineIndependent/glslang_tab.cpp" break; - case 655: /* attribute_list: single_attribute */ -#line 4280 "MachineIndependent/glslang.y" + case 666: /* attribute_list: single_attribute */ +#line 4371 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = (yyvsp[0].interm.attributes); } -#line 12335 "MachineIndependent/glslang_tab.cpp" +#line 12514 "MachineIndependent/glslang_tab.cpp" break; - case 656: /* attribute_list: attribute_list COMMA single_attribute */ -#line 4283 "MachineIndependent/glslang.y" + case 667: /* attribute_list: attribute_list COMMA single_attribute */ +#line 4374 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = parseContext.mergeAttributes((yyvsp[-2].interm.attributes), (yyvsp[0].interm.attributes)); } -#line 12343 "MachineIndependent/glslang_tab.cpp" +#line 12522 "MachineIndependent/glslang_tab.cpp" break; - case 657: /* single_attribute: IDENTIFIER */ -#line 4288 "MachineIndependent/glslang.y" + case 668: /* single_attribute: IDENTIFIER */ +#line 4379 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[0].lex).string); } -#line 12351 "MachineIndependent/glslang_tab.cpp" +#line 12530 "MachineIndependent/glslang_tab.cpp" break; - case 658: /* single_attribute: IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN */ -#line 4291 "MachineIndependent/glslang.y" + case 669: /* single_attribute: IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN */ +#line 4382 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[-3].lex).string, (yyvsp[-1].interm.intermTypedNode)); } -#line 12359 "MachineIndependent/glslang_tab.cpp" +#line 12538 "MachineIndependent/glslang_tab.cpp" break; - case 659: /* spirv_requirements_list: spirv_requirements_parameter */ -#line 4296 "MachineIndependent/glslang.y" + case 670: /* spirv_requirements_list: spirv_requirements_parameter */ +#line 4387 "MachineIndependent/glslang.y" { (yyval.interm.spirvReq) = (yyvsp[0].interm.spirvReq); } -#line 12367 "MachineIndependent/glslang_tab.cpp" +#line 12546 "MachineIndependent/glslang_tab.cpp" break; - case 660: /* spirv_requirements_list: spirv_requirements_list COMMA spirv_requirements_parameter */ -#line 4299 "MachineIndependent/glslang.y" + case 671: /* spirv_requirements_list: spirv_requirements_list COMMA spirv_requirements_parameter */ +#line 4390 "MachineIndependent/glslang.y" { (yyval.interm.spirvReq) = parseContext.mergeSpirvRequirements((yyvsp[-1].lex).loc, (yyvsp[-2].interm.spirvReq), (yyvsp[0].interm.spirvReq)); } -#line 12375 "MachineIndependent/glslang_tab.cpp" +#line 12554 "MachineIndependent/glslang_tab.cpp" break; - case 661: /* spirv_requirements_parameter: IDENTIFIER EQUAL LEFT_BRACKET spirv_extension_list RIGHT_BRACKET */ -#line 4304 "MachineIndependent/glslang.y" + case 672: /* spirv_requirements_parameter: IDENTIFIER EQUAL LEFT_BRACKET spirv_extension_list RIGHT_BRACKET */ +#line 4395 "MachineIndependent/glslang.y" { (yyval.interm.spirvReq) = parseContext.makeSpirvRequirement((yyvsp[-3].lex).loc, *(yyvsp[-4].lex).string, (yyvsp[-1].interm.intermNode)->getAsAggregate(), nullptr); } -#line 12383 "MachineIndependent/glslang_tab.cpp" +#line 12562 "MachineIndependent/glslang_tab.cpp" break; - case 662: /* spirv_requirements_parameter: IDENTIFIER EQUAL LEFT_BRACKET spirv_capability_list RIGHT_BRACKET */ -#line 4307 "MachineIndependent/glslang.y" + case 673: /* spirv_requirements_parameter: IDENTIFIER EQUAL LEFT_BRACKET spirv_capability_list RIGHT_BRACKET */ +#line 4398 "MachineIndependent/glslang.y" { (yyval.interm.spirvReq) = parseContext.makeSpirvRequirement((yyvsp[-3].lex).loc, *(yyvsp[-4].lex).string, nullptr, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12391 "MachineIndependent/glslang_tab.cpp" +#line 12570 "MachineIndependent/glslang_tab.cpp" break; - case 663: /* spirv_extension_list: STRING_LITERAL */ -#line 4312 "MachineIndependent/glslang.y" + case 674: /* spirv_extension_list: STRING_LITERAL */ +#line 4403 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true)); } -#line 12399 "MachineIndependent/glslang_tab.cpp" +#line 12578 "MachineIndependent/glslang_tab.cpp" break; - case 664: /* spirv_extension_list: spirv_extension_list COMMA STRING_LITERAL */ -#line 4315 "MachineIndependent/glslang.y" + case 675: /* spirv_extension_list: spirv_extension_list COMMA STRING_LITERAL */ +#line 4406 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true)); } -#line 12407 "MachineIndependent/glslang_tab.cpp" +#line 12586 "MachineIndependent/glslang_tab.cpp" break; - case 665: /* spirv_capability_list: INTCONSTANT */ -#line 4320 "MachineIndependent/glslang.y" + case 676: /* spirv_capability_list: INTCONSTANT */ +#line 4411 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true)); } -#line 12415 "MachineIndependent/glslang_tab.cpp" +#line 12594 "MachineIndependent/glslang_tab.cpp" break; - case 666: /* spirv_capability_list: spirv_capability_list COMMA INTCONSTANT */ -#line 4323 "MachineIndependent/glslang.y" + case 677: /* spirv_capability_list: spirv_capability_list COMMA INTCONSTANT */ +#line 4414 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true)); } -#line 12423 "MachineIndependent/glslang_tab.cpp" +#line 12602 "MachineIndependent/glslang_tab.cpp" break; - case 667: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT RIGHT_PAREN */ -#line 4328 "MachineIndependent/glslang.y" + case 678: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT RIGHT_PAREN */ +#line 4419 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-1].lex).i); (yyval.interm.intermNode) = 0; } -#line 12432 "MachineIndependent/glslang_tab.cpp" +#line 12611 "MachineIndependent/glslang_tab.cpp" break; - case 668: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ -#line 4332 "MachineIndependent/glslang.y" + case 679: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ +#line 4423 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-1].lex).i); (yyval.interm.intermNode) = 0; } -#line 12442 "MachineIndependent/glslang_tab.cpp" +#line 12621 "MachineIndependent/glslang_tab.cpp" break; - case 669: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN */ -#line 4337 "MachineIndependent/glslang.y" + case 680: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN */ +#line 4428 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); (yyval.interm.intermNode) = 0; } -#line 12451 "MachineIndependent/glslang_tab.cpp" +#line 12630 "MachineIndependent/glslang_tab.cpp" break; - case 670: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN */ -#line 4341 "MachineIndependent/glslang.y" + case 681: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN */ +#line 4432 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); (yyval.interm.intermNode) = 0; } -#line 12461 "MachineIndependent/glslang_tab.cpp" +#line 12640 "MachineIndependent/glslang_tab.cpp" break; - case 671: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE_ID LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN */ -#line 4346 "MachineIndependent/glslang.y" + case 682: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE_ID LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN */ +#line 4437 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionModeId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); (yyval.interm.intermNode) = 0; } -#line 12470 "MachineIndependent/glslang_tab.cpp" +#line 12649 "MachineIndependent/glslang_tab.cpp" break; - case 672: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN */ -#line 4350 "MachineIndependent/glslang.y" + case 683: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN */ +#line 4441 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionModeId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); (yyval.interm.intermNode) = 0; } -#line 12480 "MachineIndependent/glslang_tab.cpp" +#line 12659 "MachineIndependent/glslang_tab.cpp" break; - case 673: /* spirv_execution_mode_parameter_list: spirv_execution_mode_parameter */ -#line 4357 "MachineIndependent/glslang.y" + case 684: /* spirv_execution_mode_parameter_list: spirv_execution_mode_parameter */ +#line 4448 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); } -#line 12488 "MachineIndependent/glslang_tab.cpp" +#line 12667 "MachineIndependent/glslang_tab.cpp" break; - case 674: /* spirv_execution_mode_parameter_list: spirv_execution_mode_parameter_list COMMA spirv_execution_mode_parameter */ -#line 4360 "MachineIndependent/glslang.y" + case 685: /* spirv_execution_mode_parameter_list: spirv_execution_mode_parameter_list COMMA spirv_execution_mode_parameter */ +#line 4451 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 12496 "MachineIndependent/glslang_tab.cpp" +#line 12675 "MachineIndependent/glslang_tab.cpp" break; - case 675: /* spirv_execution_mode_parameter: FLOATCONSTANT */ -#line 4365 "MachineIndependent/glslang.y" + case 686: /* spirv_execution_mode_parameter: FLOATCONSTANT */ +#line 4456 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } -#line 12504 "MachineIndependent/glslang_tab.cpp" +#line 12683 "MachineIndependent/glslang_tab.cpp" break; - case 676: /* spirv_execution_mode_parameter: INTCONSTANT */ -#line 4368 "MachineIndependent/glslang.y" + case 687: /* spirv_execution_mode_parameter: INTCONSTANT */ +#line 4459 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 12512 "MachineIndependent/glslang_tab.cpp" +#line 12691 "MachineIndependent/glslang_tab.cpp" break; - case 677: /* spirv_execution_mode_parameter: UINTCONSTANT */ -#line 4371 "MachineIndependent/glslang.y" + case 688: /* spirv_execution_mode_parameter: UINTCONSTANT */ +#line 4462 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 12520 "MachineIndependent/glslang_tab.cpp" +#line 12699 "MachineIndependent/glslang_tab.cpp" break; - case 678: /* spirv_execution_mode_parameter: BOOLCONSTANT */ -#line 4374 "MachineIndependent/glslang.y" + case 689: /* spirv_execution_mode_parameter: BOOLCONSTANT */ +#line 4465 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } -#line 12528 "MachineIndependent/glslang_tab.cpp" +#line 12707 "MachineIndependent/glslang_tab.cpp" break; - case 679: /* spirv_execution_mode_parameter: STRING_LITERAL */ -#line 4377 "MachineIndependent/glslang.y" + case 690: /* spirv_execution_mode_parameter: STRING_LITERAL */ +#line 4468 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true); } -#line 12536 "MachineIndependent/glslang_tab.cpp" +#line 12715 "MachineIndependent/glslang_tab.cpp" break; - case 680: /* spirv_execution_mode_id_parameter_list: constant_expression */ -#line 4382 "MachineIndependent/glslang.y" + case 691: /* spirv_execution_mode_id_parameter_list: constant_expression */ +#line 4473 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtFloat && (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtInt && @@ -12546,11 +12725,11 @@ yyreduce: parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "this type not allowed", (yyvsp[0].interm.intermTypedNode)->getType().getBasicString(), ""); (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermTypedNode)); } -#line 12550 "MachineIndependent/glslang_tab.cpp" +#line 12729 "MachineIndependent/glslang_tab.cpp" break; - case 681: /* spirv_execution_mode_id_parameter_list: spirv_execution_mode_id_parameter_list COMMA constant_expression */ -#line 4391 "MachineIndependent/glslang.y" + case 692: /* spirv_execution_mode_id_parameter_list: spirv_execution_mode_id_parameter_list COMMA constant_expression */ +#line 4482 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtFloat && (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtInt && @@ -12560,351 +12739,351 @@ yyreduce: parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "this type not allowed", (yyvsp[0].interm.intermTypedNode)->getType().getBasicString(), ""); (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermTypedNode)); } -#line 12564 "MachineIndependent/glslang_tab.cpp" +#line 12743 "MachineIndependent/glslang_tab.cpp" break; - case 682: /* spirv_storage_class_qualifier: SPIRV_STORAGE_CLASS LEFT_PAREN INTCONSTANT RIGHT_PAREN */ -#line 4402 "MachineIndependent/glslang.y" + case 693: /* spirv_storage_class_qualifier: SPIRV_STORAGE_CLASS LEFT_PAREN INTCONSTANT RIGHT_PAREN */ +#line 4493 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-3].lex).loc); (yyval.interm.type).qualifier.storage = EvqSpirvStorageClass; (yyval.interm.type).qualifier.spirvStorageClass = (yyvsp[-1].lex).i; } -#line 12574 "MachineIndependent/glslang_tab.cpp" +#line 12753 "MachineIndependent/glslang_tab.cpp" break; - case 683: /* spirv_storage_class_qualifier: SPIRV_STORAGE_CLASS LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ -#line 4407 "MachineIndependent/glslang.y" + case 694: /* spirv_storage_class_qualifier: SPIRV_STORAGE_CLASS LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ +#line 4498 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); (yyval.interm.type).qualifier.storage = EvqSpirvStorageClass; (yyval.interm.type).qualifier.spirvStorageClass = (yyvsp[-1].lex).i; } -#line 12585 "MachineIndependent/glslang_tab.cpp" +#line 12764 "MachineIndependent/glslang_tab.cpp" break; - case 684: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN INTCONSTANT RIGHT_PAREN */ -#line 4415 "MachineIndependent/glslang.y" + case 695: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN INTCONSTANT RIGHT_PAREN */ +#line 4506 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-3].lex).loc); (yyval.interm.type).qualifier.setSpirvDecorate((yyvsp[-1].lex).i); } -#line 12594 "MachineIndependent/glslang_tab.cpp" +#line 12773 "MachineIndependent/glslang_tab.cpp" break; - case 685: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ -#line 4419 "MachineIndependent/glslang.y" + case 696: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ +#line 4510 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); (yyval.interm.type).qualifier.setSpirvDecorate((yyvsp[-1].lex).i); } -#line 12604 "MachineIndependent/glslang_tab.cpp" +#line 12783 "MachineIndependent/glslang_tab.cpp" break; - case 686: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN */ -#line 4424 "MachineIndependent/glslang.y" + case 697: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN */ +#line 4515 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); (yyval.interm.type).qualifier.setSpirvDecorate((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12613 "MachineIndependent/glslang_tab.cpp" +#line 12792 "MachineIndependent/glslang_tab.cpp" break; - case 687: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN */ -#line 4428 "MachineIndependent/glslang.y" + case 698: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN */ +#line 4519 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-7].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); (yyval.interm.type).qualifier.setSpirvDecorate((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12623 "MachineIndependent/glslang_tab.cpp" +#line 12802 "MachineIndependent/glslang_tab.cpp" break; - case 688: /* spirv_decorate_qualifier: SPIRV_DECORATE_ID LEFT_PAREN INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN */ -#line 4433 "MachineIndependent/glslang.y" + case 699: /* spirv_decorate_qualifier: SPIRV_DECORATE_ID LEFT_PAREN INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN */ +#line 4524 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); (yyval.interm.type).qualifier.setSpirvDecorateId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12632 "MachineIndependent/glslang_tab.cpp" +#line 12811 "MachineIndependent/glslang_tab.cpp" break; - case 689: /* spirv_decorate_qualifier: SPIRV_DECORATE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN */ -#line 4437 "MachineIndependent/glslang.y" + case 700: /* spirv_decorate_qualifier: SPIRV_DECORATE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN */ +#line 4528 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-7].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); (yyval.interm.type).qualifier.setSpirvDecorateId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12642 "MachineIndependent/glslang_tab.cpp" +#line 12821 "MachineIndependent/glslang_tab.cpp" break; - case 690: /* spirv_decorate_qualifier: SPIRV_DECORATE_STRING LEFT_PAREN INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN */ -#line 4442 "MachineIndependent/glslang.y" + case 701: /* spirv_decorate_qualifier: SPIRV_DECORATE_STRING LEFT_PAREN INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN */ +#line 4533 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); (yyval.interm.type).qualifier.setSpirvDecorateString((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12651 "MachineIndependent/glslang_tab.cpp" +#line 12830 "MachineIndependent/glslang_tab.cpp" break; - case 691: /* spirv_decorate_qualifier: SPIRV_DECORATE_STRING LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN */ -#line 4446 "MachineIndependent/glslang.y" + case 702: /* spirv_decorate_qualifier: SPIRV_DECORATE_STRING LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN */ +#line 4537 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-7].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); (yyval.interm.type).qualifier.setSpirvDecorateString((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12661 "MachineIndependent/glslang_tab.cpp" +#line 12840 "MachineIndependent/glslang_tab.cpp" break; - case 692: /* spirv_decorate_parameter_list: spirv_decorate_parameter */ -#line 4453 "MachineIndependent/glslang.y" + case 703: /* spirv_decorate_parameter_list: spirv_decorate_parameter */ +#line 4544 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); } -#line 12669 "MachineIndependent/glslang_tab.cpp" +#line 12848 "MachineIndependent/glslang_tab.cpp" break; - case 693: /* spirv_decorate_parameter_list: spirv_decorate_parameter_list COMMA spirv_decorate_parameter */ -#line 4456 "MachineIndependent/glslang.y" + case 704: /* spirv_decorate_parameter_list: spirv_decorate_parameter_list COMMA spirv_decorate_parameter */ +#line 4547 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 12677 "MachineIndependent/glslang_tab.cpp" +#line 12856 "MachineIndependent/glslang_tab.cpp" break; - case 694: /* spirv_decorate_parameter: FLOATCONSTANT */ -#line 4461 "MachineIndependent/glslang.y" + case 705: /* spirv_decorate_parameter: FLOATCONSTANT */ +#line 4552 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } -#line 12685 "MachineIndependent/glslang_tab.cpp" +#line 12864 "MachineIndependent/glslang_tab.cpp" break; - case 695: /* spirv_decorate_parameter: INTCONSTANT */ -#line 4464 "MachineIndependent/glslang.y" + case 706: /* spirv_decorate_parameter: INTCONSTANT */ +#line 4555 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 12693 "MachineIndependent/glslang_tab.cpp" +#line 12872 "MachineIndependent/glslang_tab.cpp" break; - case 696: /* spirv_decorate_parameter: UINTCONSTANT */ -#line 4467 "MachineIndependent/glslang.y" + case 707: /* spirv_decorate_parameter: UINTCONSTANT */ +#line 4558 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 12701 "MachineIndependent/glslang_tab.cpp" +#line 12880 "MachineIndependent/glslang_tab.cpp" break; - case 697: /* spirv_decorate_parameter: BOOLCONSTANT */ -#line 4470 "MachineIndependent/glslang.y" + case 708: /* spirv_decorate_parameter: BOOLCONSTANT */ +#line 4561 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } -#line 12709 "MachineIndependent/glslang_tab.cpp" +#line 12888 "MachineIndependent/glslang_tab.cpp" break; - case 698: /* spirv_decorate_id_parameter_list: spirv_decorate_id_parameter */ -#line 4475 "MachineIndependent/glslang.y" + case 709: /* spirv_decorate_id_parameter_list: spirv_decorate_id_parameter */ +#line 4566 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); } -#line 12717 "MachineIndependent/glslang_tab.cpp" +#line 12896 "MachineIndependent/glslang_tab.cpp" break; - case 699: /* spirv_decorate_id_parameter_list: spirv_decorate_id_parameter_list COMMA spirv_decorate_id_parameter */ -#line 4478 "MachineIndependent/glslang.y" + case 710: /* spirv_decorate_id_parameter_list: spirv_decorate_id_parameter_list COMMA spirv_decorate_id_parameter */ +#line 4569 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 12725 "MachineIndependent/glslang_tab.cpp" +#line 12904 "MachineIndependent/glslang_tab.cpp" break; - case 700: /* spirv_decorate_id_parameter: variable_identifier */ -#line 4483 "MachineIndependent/glslang.y" + case 711: /* spirv_decorate_id_parameter: variable_identifier */ +#line 4574 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermTypedNode)->getAsConstantUnion() || (yyvsp[0].interm.intermTypedNode)->getAsSymbolNode()) (yyval.interm.intermNode) = (yyvsp[0].interm.intermTypedNode); else parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "only allow constants or variables which are not elements of a composite", "", ""); } -#line 12736 "MachineIndependent/glslang_tab.cpp" +#line 12915 "MachineIndependent/glslang_tab.cpp" break; - case 701: /* spirv_decorate_id_parameter: FLOATCONSTANT */ -#line 4489 "MachineIndependent/glslang.y" + case 712: /* spirv_decorate_id_parameter: FLOATCONSTANT */ +#line 4580 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } -#line 12744 "MachineIndependent/glslang_tab.cpp" +#line 12923 "MachineIndependent/glslang_tab.cpp" break; - case 702: /* spirv_decorate_id_parameter: INTCONSTANT */ -#line 4492 "MachineIndependent/glslang.y" + case 713: /* spirv_decorate_id_parameter: INTCONSTANT */ +#line 4583 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 12752 "MachineIndependent/glslang_tab.cpp" +#line 12931 "MachineIndependent/glslang_tab.cpp" break; - case 703: /* spirv_decorate_id_parameter: UINTCONSTANT */ -#line 4495 "MachineIndependent/glslang.y" + case 714: /* spirv_decorate_id_parameter: UINTCONSTANT */ +#line 4586 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 12760 "MachineIndependent/glslang_tab.cpp" +#line 12939 "MachineIndependent/glslang_tab.cpp" break; - case 704: /* spirv_decorate_id_parameter: BOOLCONSTANT */ -#line 4498 "MachineIndependent/glslang.y" + case 715: /* spirv_decorate_id_parameter: BOOLCONSTANT */ +#line 4589 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } -#line 12768 "MachineIndependent/glslang_tab.cpp" +#line 12947 "MachineIndependent/glslang_tab.cpp" break; - case 705: /* spirv_decorate_string_parameter_list: STRING_LITERAL */ -#line 4503 "MachineIndependent/glslang.y" + case 716: /* spirv_decorate_string_parameter_list: STRING_LITERAL */ +#line 4594 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate( parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true)); } -#line 12777 "MachineIndependent/glslang_tab.cpp" +#line 12956 "MachineIndependent/glslang_tab.cpp" break; - case 706: /* spirv_decorate_string_parameter_list: spirv_decorate_string_parameter_list COMMA STRING_LITERAL */ -#line 4507 "MachineIndependent/glslang.y" + case 717: /* spirv_decorate_string_parameter_list: spirv_decorate_string_parameter_list COMMA STRING_LITERAL */ +#line 4598 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true)); } -#line 12785 "MachineIndependent/glslang_tab.cpp" +#line 12964 "MachineIndependent/glslang_tab.cpp" break; - case 707: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN */ -#line 4512 "MachineIndependent/glslang.y" + case 718: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN */ +#line 4603 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).setSpirvType(*(yyvsp[-3].interm.spirvInst), (yyvsp[-1].interm.spirvTypeParams)); } -#line 12794 "MachineIndependent/glslang_tab.cpp" +#line 12973 "MachineIndependent/glslang_tab.cpp" break; - case 708: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN */ -#line 4516 "MachineIndependent/glslang.y" + case 719: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN */ +#line 4607 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-7].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); (yyval.interm.type).setSpirvType(*(yyvsp[-3].interm.spirvInst), (yyvsp[-1].interm.spirvTypeParams)); } -#line 12804 "MachineIndependent/glslang_tab.cpp" +#line 12983 "MachineIndependent/glslang_tab.cpp" break; - case 709: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN */ -#line 4521 "MachineIndependent/glslang.y" + case 720: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN */ +#line 4612 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-3].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).setSpirvType(*(yyvsp[-1].interm.spirvInst)); } -#line 12813 "MachineIndependent/glslang_tab.cpp" +#line 12992 "MachineIndependent/glslang_tab.cpp" break; - case 710: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN */ -#line 4525 "MachineIndependent/glslang.y" + case 721: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN */ +#line 4616 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); (yyval.interm.type).setSpirvType(*(yyvsp[-1].interm.spirvInst)); } -#line 12823 "MachineIndependent/glslang_tab.cpp" +#line 13002 "MachineIndependent/glslang_tab.cpp" break; - case 711: /* spirv_type_parameter_list: spirv_type_parameter */ -#line 4532 "MachineIndependent/glslang.y" + case 722: /* spirv_type_parameter_list: spirv_type_parameter */ +#line 4623 "MachineIndependent/glslang.y" { (yyval.interm.spirvTypeParams) = (yyvsp[0].interm.spirvTypeParams); } -#line 12831 "MachineIndependent/glslang_tab.cpp" +#line 13010 "MachineIndependent/glslang_tab.cpp" break; - case 712: /* spirv_type_parameter_list: spirv_type_parameter_list COMMA spirv_type_parameter */ -#line 4535 "MachineIndependent/glslang.y" + case 723: /* spirv_type_parameter_list: spirv_type_parameter_list COMMA spirv_type_parameter */ +#line 4626 "MachineIndependent/glslang.y" { (yyval.interm.spirvTypeParams) = parseContext.mergeSpirvTypeParameters((yyvsp[-2].interm.spirvTypeParams), (yyvsp[0].interm.spirvTypeParams)); } -#line 12839 "MachineIndependent/glslang_tab.cpp" +#line 13018 "MachineIndependent/glslang_tab.cpp" break; - case 713: /* spirv_type_parameter: constant_expression */ -#line 4540 "MachineIndependent/glslang.y" + case 724: /* spirv_type_parameter: constant_expression */ +#line 4631 "MachineIndependent/glslang.y" { (yyval.interm.spirvTypeParams) = parseContext.makeSpirvTypeParameters((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode)->getAsConstantUnion()); } -#line 12847 "MachineIndependent/glslang_tab.cpp" +#line 13026 "MachineIndependent/glslang_tab.cpp" break; - case 714: /* spirv_type_parameter: type_specifier_nonarray */ -#line 4543 "MachineIndependent/glslang.y" + case 725: /* spirv_type_parameter: type_specifier_nonarray */ +#line 4634 "MachineIndependent/glslang.y" { (yyval.interm.spirvTypeParams) = parseContext.makeSpirvTypeParameters((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } -#line 12855 "MachineIndependent/glslang_tab.cpp" +#line 13034 "MachineIndependent/glslang_tab.cpp" break; - case 715: /* spirv_instruction_qualifier: SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN */ -#line 4548 "MachineIndependent/glslang.y" + case 726: /* spirv_instruction_qualifier: SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN */ +#line 4639 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = (yyvsp[-1].interm.spirvInst); } -#line 12863 "MachineIndependent/glslang_tab.cpp" +#line 13042 "MachineIndependent/glslang_tab.cpp" break; - case 716: /* spirv_instruction_qualifier: SPIRV_INSTRUCTION LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN */ -#line 4551 "MachineIndependent/glslang.y" + case 727: /* spirv_instruction_qualifier: SPIRV_INSTRUCTION LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN */ +#line 4642 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); (yyval.interm.spirvInst) = (yyvsp[-1].interm.spirvInst); } -#line 12872 "MachineIndependent/glslang_tab.cpp" +#line 13051 "MachineIndependent/glslang_tab.cpp" break; - case 717: /* spirv_instruction_qualifier_list: spirv_instruction_qualifier_id */ -#line 4557 "MachineIndependent/glslang.y" + case 728: /* spirv_instruction_qualifier_list: spirv_instruction_qualifier_id */ +#line 4648 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = (yyvsp[0].interm.spirvInst); } -#line 12880 "MachineIndependent/glslang_tab.cpp" +#line 13059 "MachineIndependent/glslang_tab.cpp" break; - case 718: /* spirv_instruction_qualifier_list: spirv_instruction_qualifier_list COMMA spirv_instruction_qualifier_id */ -#line 4560 "MachineIndependent/glslang.y" + case 729: /* spirv_instruction_qualifier_list: spirv_instruction_qualifier_list COMMA spirv_instruction_qualifier_id */ +#line 4651 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = parseContext.mergeSpirvInstruction((yyvsp[-1].lex).loc, (yyvsp[-2].interm.spirvInst), (yyvsp[0].interm.spirvInst)); } -#line 12888 "MachineIndependent/glslang_tab.cpp" +#line 13067 "MachineIndependent/glslang_tab.cpp" break; - case 719: /* spirv_instruction_qualifier_id: IDENTIFIER EQUAL STRING_LITERAL */ -#line 4565 "MachineIndependent/glslang.y" + case 730: /* spirv_instruction_qualifier_id: IDENTIFIER EQUAL STRING_LITERAL */ +#line 4656 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = parseContext.makeSpirvInstruction((yyvsp[-1].lex).loc, *(yyvsp[-2].lex).string, *(yyvsp[0].lex).string); } -#line 12896 "MachineIndependent/glslang_tab.cpp" +#line 13075 "MachineIndependent/glslang_tab.cpp" break; - case 720: /* spirv_instruction_qualifier_id: IDENTIFIER EQUAL INTCONSTANT */ -#line 4568 "MachineIndependent/glslang.y" + case 731: /* spirv_instruction_qualifier_id: IDENTIFIER EQUAL INTCONSTANT */ +#line 4659 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = parseContext.makeSpirvInstruction((yyvsp[-1].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[0].lex).i); } -#line 12904 "MachineIndependent/glslang_tab.cpp" +#line 13083 "MachineIndependent/glslang_tab.cpp" break; -#line 12908 "MachineIndependent/glslang_tab.cpp" +#line 13087 "MachineIndependent/glslang_tab.cpp" default: break; } @@ -13128,5 +13307,5 @@ yyreturnlab: return yyresult; } -#line 4572 "MachineIndependent/glslang.y" +#line 4663 "MachineIndependent/glslang.y" diff --git a/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp.h b/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp.h index b92ddec03c..11932ead0d 100644 --- a/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp.h +++ b/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp.h @@ -231,309 +231,314 @@ extern int yydebug; UCOOPMATNV = 432, /* UCOOPMATNV */ COOPMAT = 433, /* COOPMAT */ COOPVECNV = 434, /* COOPVECNV */ - HITOBJECTNV = 435, /* HITOBJECTNV */ - HITOBJECTATTRNV = 436, /* HITOBJECTATTRNV */ - TENSORLAYOUTNV = 437, /* TENSORLAYOUTNV */ - TENSORVIEWNV = 438, /* TENSORVIEWNV */ - TENSORARM = 439, /* TENSORARM */ - SAMPLERCUBEARRAY = 440, /* SAMPLERCUBEARRAY */ - SAMPLERCUBEARRAYSHADOW = 441, /* SAMPLERCUBEARRAYSHADOW */ - ISAMPLERCUBEARRAY = 442, /* ISAMPLERCUBEARRAY */ - USAMPLERCUBEARRAY = 443, /* USAMPLERCUBEARRAY */ - SAMPLER1D = 444, /* SAMPLER1D */ - SAMPLER1DARRAY = 445, /* SAMPLER1DARRAY */ - SAMPLER1DARRAYSHADOW = 446, /* SAMPLER1DARRAYSHADOW */ - ISAMPLER1D = 447, /* ISAMPLER1D */ - SAMPLER1DSHADOW = 448, /* SAMPLER1DSHADOW */ - SAMPLER2DRECT = 449, /* SAMPLER2DRECT */ - SAMPLER2DRECTSHADOW = 450, /* SAMPLER2DRECTSHADOW */ - ISAMPLER2DRECT = 451, /* ISAMPLER2DRECT */ - USAMPLER2DRECT = 452, /* USAMPLER2DRECT */ - SAMPLERBUFFER = 453, /* SAMPLERBUFFER */ - ISAMPLERBUFFER = 454, /* ISAMPLERBUFFER */ - USAMPLERBUFFER = 455, /* USAMPLERBUFFER */ - SAMPLER2DMS = 456, /* SAMPLER2DMS */ - ISAMPLER2DMS = 457, /* ISAMPLER2DMS */ - USAMPLER2DMS = 458, /* USAMPLER2DMS */ - SAMPLER2DMSARRAY = 459, /* SAMPLER2DMSARRAY */ - ISAMPLER2DMSARRAY = 460, /* ISAMPLER2DMSARRAY */ - USAMPLER2DMSARRAY = 461, /* USAMPLER2DMSARRAY */ - SAMPLEREXTERNALOES = 462, /* SAMPLEREXTERNALOES */ - SAMPLEREXTERNAL2DY2YEXT = 463, /* SAMPLEREXTERNAL2DY2YEXT */ - ISAMPLER1DARRAY = 464, /* ISAMPLER1DARRAY */ - USAMPLER1D = 465, /* USAMPLER1D */ - USAMPLER1DARRAY = 466, /* USAMPLER1DARRAY */ - F16SAMPLER1D = 467, /* F16SAMPLER1D */ - F16SAMPLER2D = 468, /* F16SAMPLER2D */ - F16SAMPLER3D = 469, /* F16SAMPLER3D */ - F16SAMPLER2DRECT = 470, /* F16SAMPLER2DRECT */ - F16SAMPLERCUBE = 471, /* F16SAMPLERCUBE */ - F16SAMPLER1DARRAY = 472, /* F16SAMPLER1DARRAY */ - F16SAMPLER2DARRAY = 473, /* F16SAMPLER2DARRAY */ - F16SAMPLERCUBEARRAY = 474, /* F16SAMPLERCUBEARRAY */ - F16SAMPLERBUFFER = 475, /* F16SAMPLERBUFFER */ - F16SAMPLER2DMS = 476, /* F16SAMPLER2DMS */ - F16SAMPLER2DMSARRAY = 477, /* F16SAMPLER2DMSARRAY */ - F16SAMPLER1DSHADOW = 478, /* F16SAMPLER1DSHADOW */ - F16SAMPLER2DSHADOW = 479, /* F16SAMPLER2DSHADOW */ - F16SAMPLER1DARRAYSHADOW = 480, /* F16SAMPLER1DARRAYSHADOW */ - F16SAMPLER2DARRAYSHADOW = 481, /* F16SAMPLER2DARRAYSHADOW */ - F16SAMPLER2DRECTSHADOW = 482, /* F16SAMPLER2DRECTSHADOW */ - F16SAMPLERCUBESHADOW = 483, /* F16SAMPLERCUBESHADOW */ - F16SAMPLERCUBEARRAYSHADOW = 484, /* F16SAMPLERCUBEARRAYSHADOW */ - IMAGE1D = 485, /* IMAGE1D */ - IIMAGE1D = 486, /* IIMAGE1D */ - UIMAGE1D = 487, /* UIMAGE1D */ - IMAGE2D = 488, /* IMAGE2D */ - IIMAGE2D = 489, /* IIMAGE2D */ - UIMAGE2D = 490, /* UIMAGE2D */ - IMAGE3D = 491, /* IMAGE3D */ - IIMAGE3D = 492, /* IIMAGE3D */ - UIMAGE3D = 493, /* UIMAGE3D */ - IMAGE2DRECT = 494, /* IMAGE2DRECT */ - IIMAGE2DRECT = 495, /* IIMAGE2DRECT */ - UIMAGE2DRECT = 496, /* UIMAGE2DRECT */ - IMAGECUBE = 497, /* IMAGECUBE */ - IIMAGECUBE = 498, /* IIMAGECUBE */ - UIMAGECUBE = 499, /* UIMAGECUBE */ - IMAGEBUFFER = 500, /* IMAGEBUFFER */ - IIMAGEBUFFER = 501, /* IIMAGEBUFFER */ - UIMAGEBUFFER = 502, /* UIMAGEBUFFER */ - IMAGE1DARRAY = 503, /* IMAGE1DARRAY */ - IIMAGE1DARRAY = 504, /* IIMAGE1DARRAY */ - UIMAGE1DARRAY = 505, /* UIMAGE1DARRAY */ - IMAGE2DARRAY = 506, /* IMAGE2DARRAY */ - IIMAGE2DARRAY = 507, /* IIMAGE2DARRAY */ - UIMAGE2DARRAY = 508, /* UIMAGE2DARRAY */ - IMAGECUBEARRAY = 509, /* IMAGECUBEARRAY */ - IIMAGECUBEARRAY = 510, /* IIMAGECUBEARRAY */ - UIMAGECUBEARRAY = 511, /* UIMAGECUBEARRAY */ - IMAGE2DMS = 512, /* IMAGE2DMS */ - IIMAGE2DMS = 513, /* IIMAGE2DMS */ - UIMAGE2DMS = 514, /* UIMAGE2DMS */ - IMAGE2DMSARRAY = 515, /* IMAGE2DMSARRAY */ - IIMAGE2DMSARRAY = 516, /* IIMAGE2DMSARRAY */ - UIMAGE2DMSARRAY = 517, /* UIMAGE2DMSARRAY */ - F16IMAGE1D = 518, /* F16IMAGE1D */ - F16IMAGE2D = 519, /* F16IMAGE2D */ - F16IMAGE3D = 520, /* F16IMAGE3D */ - F16IMAGE2DRECT = 521, /* F16IMAGE2DRECT */ - F16IMAGECUBE = 522, /* F16IMAGECUBE */ - F16IMAGE1DARRAY = 523, /* F16IMAGE1DARRAY */ - F16IMAGE2DARRAY = 524, /* F16IMAGE2DARRAY */ - F16IMAGECUBEARRAY = 525, /* F16IMAGECUBEARRAY */ - F16IMAGEBUFFER = 526, /* F16IMAGEBUFFER */ - F16IMAGE2DMS = 527, /* F16IMAGE2DMS */ - F16IMAGE2DMSARRAY = 528, /* F16IMAGE2DMSARRAY */ - I64IMAGE1D = 529, /* I64IMAGE1D */ - U64IMAGE1D = 530, /* U64IMAGE1D */ - I64IMAGE2D = 531, /* I64IMAGE2D */ - U64IMAGE2D = 532, /* U64IMAGE2D */ - I64IMAGE3D = 533, /* I64IMAGE3D */ - U64IMAGE3D = 534, /* U64IMAGE3D */ - I64IMAGE2DRECT = 535, /* I64IMAGE2DRECT */ - U64IMAGE2DRECT = 536, /* U64IMAGE2DRECT */ - I64IMAGECUBE = 537, /* I64IMAGECUBE */ - U64IMAGECUBE = 538, /* U64IMAGECUBE */ - I64IMAGEBUFFER = 539, /* I64IMAGEBUFFER */ - U64IMAGEBUFFER = 540, /* U64IMAGEBUFFER */ - I64IMAGE1DARRAY = 541, /* I64IMAGE1DARRAY */ - U64IMAGE1DARRAY = 542, /* U64IMAGE1DARRAY */ - I64IMAGE2DARRAY = 543, /* I64IMAGE2DARRAY */ - U64IMAGE2DARRAY = 544, /* U64IMAGE2DARRAY */ - I64IMAGECUBEARRAY = 545, /* I64IMAGECUBEARRAY */ - U64IMAGECUBEARRAY = 546, /* U64IMAGECUBEARRAY */ - I64IMAGE2DMS = 547, /* I64IMAGE2DMS */ - U64IMAGE2DMS = 548, /* U64IMAGE2DMS */ - I64IMAGE2DMSARRAY = 549, /* I64IMAGE2DMSARRAY */ - U64IMAGE2DMSARRAY = 550, /* U64IMAGE2DMSARRAY */ - TEXTURECUBEARRAY = 551, /* TEXTURECUBEARRAY */ - ITEXTURECUBEARRAY = 552, /* ITEXTURECUBEARRAY */ - UTEXTURECUBEARRAY = 553, /* UTEXTURECUBEARRAY */ - TEXTURE1D = 554, /* TEXTURE1D */ - ITEXTURE1D = 555, /* ITEXTURE1D */ - UTEXTURE1D = 556, /* UTEXTURE1D */ - TEXTURE1DARRAY = 557, /* TEXTURE1DARRAY */ - ITEXTURE1DARRAY = 558, /* ITEXTURE1DARRAY */ - UTEXTURE1DARRAY = 559, /* UTEXTURE1DARRAY */ - TEXTURE2DRECT = 560, /* TEXTURE2DRECT */ - ITEXTURE2DRECT = 561, /* ITEXTURE2DRECT */ - UTEXTURE2DRECT = 562, /* UTEXTURE2DRECT */ - TEXTUREBUFFER = 563, /* TEXTUREBUFFER */ - ITEXTUREBUFFER = 564, /* ITEXTUREBUFFER */ - UTEXTUREBUFFER = 565, /* UTEXTUREBUFFER */ - TEXTURE2DMS = 566, /* TEXTURE2DMS */ - ITEXTURE2DMS = 567, /* ITEXTURE2DMS */ - UTEXTURE2DMS = 568, /* UTEXTURE2DMS */ - TEXTURE2DMSARRAY = 569, /* TEXTURE2DMSARRAY */ - ITEXTURE2DMSARRAY = 570, /* ITEXTURE2DMSARRAY */ - UTEXTURE2DMSARRAY = 571, /* UTEXTURE2DMSARRAY */ - F16TEXTURE1D = 572, /* F16TEXTURE1D */ - F16TEXTURE2D = 573, /* F16TEXTURE2D */ - F16TEXTURE3D = 574, /* F16TEXTURE3D */ - F16TEXTURE2DRECT = 575, /* F16TEXTURE2DRECT */ - F16TEXTURECUBE = 576, /* F16TEXTURECUBE */ - F16TEXTURE1DARRAY = 577, /* F16TEXTURE1DARRAY */ - F16TEXTURE2DARRAY = 578, /* F16TEXTURE2DARRAY */ - F16TEXTURECUBEARRAY = 579, /* F16TEXTURECUBEARRAY */ - F16TEXTUREBUFFER = 580, /* F16TEXTUREBUFFER */ - F16TEXTURE2DMS = 581, /* F16TEXTURE2DMS */ - F16TEXTURE2DMSARRAY = 582, /* F16TEXTURE2DMSARRAY */ - SUBPASSINPUT = 583, /* SUBPASSINPUT */ - SUBPASSINPUTMS = 584, /* SUBPASSINPUTMS */ - ISUBPASSINPUT = 585, /* ISUBPASSINPUT */ - ISUBPASSINPUTMS = 586, /* ISUBPASSINPUTMS */ - USUBPASSINPUT = 587, /* USUBPASSINPUT */ - USUBPASSINPUTMS = 588, /* USUBPASSINPUTMS */ - F16SUBPASSINPUT = 589, /* F16SUBPASSINPUT */ - F16SUBPASSINPUTMS = 590, /* F16SUBPASSINPUTMS */ - SPIRV_INSTRUCTION = 591, /* SPIRV_INSTRUCTION */ - SPIRV_EXECUTION_MODE = 592, /* SPIRV_EXECUTION_MODE */ - SPIRV_EXECUTION_MODE_ID = 593, /* SPIRV_EXECUTION_MODE_ID */ - SPIRV_DECORATE = 594, /* SPIRV_DECORATE */ - SPIRV_DECORATE_ID = 595, /* SPIRV_DECORATE_ID */ - SPIRV_DECORATE_STRING = 596, /* SPIRV_DECORATE_STRING */ - SPIRV_TYPE = 597, /* SPIRV_TYPE */ - SPIRV_STORAGE_CLASS = 598, /* SPIRV_STORAGE_CLASS */ - SPIRV_BY_REFERENCE = 599, /* SPIRV_BY_REFERENCE */ - SPIRV_LITERAL = 600, /* SPIRV_LITERAL */ - ATTACHMENTEXT = 601, /* ATTACHMENTEXT */ - IATTACHMENTEXT = 602, /* IATTACHMENTEXT */ - UATTACHMENTEXT = 603, /* UATTACHMENTEXT */ - LEFT_OP = 604, /* LEFT_OP */ - RIGHT_OP = 605, /* RIGHT_OP */ - INC_OP = 606, /* INC_OP */ - DEC_OP = 607, /* DEC_OP */ - LE_OP = 608, /* LE_OP */ - GE_OP = 609, /* GE_OP */ - EQ_OP = 610, /* EQ_OP */ - NE_OP = 611, /* NE_OP */ - AND_OP = 612, /* AND_OP */ - OR_OP = 613, /* OR_OP */ - XOR_OP = 614, /* XOR_OP */ - MUL_ASSIGN = 615, /* MUL_ASSIGN */ - DIV_ASSIGN = 616, /* DIV_ASSIGN */ - ADD_ASSIGN = 617, /* ADD_ASSIGN */ - MOD_ASSIGN = 618, /* MOD_ASSIGN */ - LEFT_ASSIGN = 619, /* LEFT_ASSIGN */ - RIGHT_ASSIGN = 620, /* RIGHT_ASSIGN */ - AND_ASSIGN = 621, /* AND_ASSIGN */ - XOR_ASSIGN = 622, /* XOR_ASSIGN */ - OR_ASSIGN = 623, /* OR_ASSIGN */ - SUB_ASSIGN = 624, /* SUB_ASSIGN */ - STRING_LITERAL = 625, /* STRING_LITERAL */ - LEFT_PAREN = 626, /* LEFT_PAREN */ - RIGHT_PAREN = 627, /* RIGHT_PAREN */ - LEFT_BRACKET = 628, /* LEFT_BRACKET */ - RIGHT_BRACKET = 629, /* RIGHT_BRACKET */ - LEFT_BRACE = 630, /* LEFT_BRACE */ - RIGHT_BRACE = 631, /* RIGHT_BRACE */ - DOT = 632, /* DOT */ - COMMA = 633, /* COMMA */ - COLON = 634, /* COLON */ - EQUAL = 635, /* EQUAL */ - SEMICOLON = 636, /* SEMICOLON */ - BANG = 637, /* BANG */ - DASH = 638, /* DASH */ - TILDE = 639, /* TILDE */ - PLUS = 640, /* PLUS */ - STAR = 641, /* STAR */ - SLASH = 642, /* SLASH */ - PERCENT = 643, /* PERCENT */ - LEFT_ANGLE = 644, /* LEFT_ANGLE */ - RIGHT_ANGLE = 645, /* RIGHT_ANGLE */ - VERTICAL_BAR = 646, /* VERTICAL_BAR */ - CARET = 647, /* CARET */ - AMPERSAND = 648, /* AMPERSAND */ - QUESTION = 649, /* QUESTION */ - INVARIANT = 650, /* INVARIANT */ - HIGH_PRECISION = 651, /* HIGH_PRECISION */ - MEDIUM_PRECISION = 652, /* MEDIUM_PRECISION */ - LOW_PRECISION = 653, /* LOW_PRECISION */ - PRECISION = 654, /* PRECISION */ - PACKED = 655, /* PACKED */ - RESOURCE = 656, /* RESOURCE */ - SUPERP = 657, /* SUPERP */ - FLOATCONSTANT = 658, /* FLOATCONSTANT */ - INTCONSTANT = 659, /* INTCONSTANT */ - UINTCONSTANT = 660, /* UINTCONSTANT */ - BOOLCONSTANT = 661, /* BOOLCONSTANT */ - IDENTIFIER = 662, /* IDENTIFIER */ - TYPE_NAME = 663, /* TYPE_NAME */ - CENTROID = 664, /* CENTROID */ - IN = 665, /* IN */ - OUT = 666, /* OUT */ - INOUT = 667, /* INOUT */ - STRUCT = 668, /* STRUCT */ - VOID = 669, /* VOID */ - WHILE = 670, /* WHILE */ - BREAK = 671, /* BREAK */ - CONTINUE = 672, /* CONTINUE */ - DO = 673, /* DO */ - ELSE = 674, /* ELSE */ - FOR = 675, /* FOR */ - IF = 676, /* IF */ - DISCARD = 677, /* DISCARD */ - RETURN = 678, /* RETURN */ - SWITCH = 679, /* SWITCH */ - CASE = 680, /* CASE */ - DEFAULT = 681, /* DEFAULT */ - TERMINATE_INVOCATION = 682, /* TERMINATE_INVOCATION */ - TERMINATE_RAY = 683, /* TERMINATE_RAY */ - IGNORE_INTERSECTION = 684, /* IGNORE_INTERSECTION */ - UNIFORM = 685, /* UNIFORM */ - SHARED = 686, /* SHARED */ - BUFFER = 687, /* BUFFER */ - TILEIMAGEEXT = 688, /* TILEIMAGEEXT */ - FLAT = 689, /* FLAT */ - SMOOTH = 690, /* SMOOTH */ - LAYOUT = 691, /* LAYOUT */ - DOUBLECONSTANT = 692, /* DOUBLECONSTANT */ - INT16CONSTANT = 693, /* INT16CONSTANT */ - UINT16CONSTANT = 694, /* UINT16CONSTANT */ - FLOAT16CONSTANT = 695, /* FLOAT16CONSTANT */ - INT32CONSTANT = 696, /* INT32CONSTANT */ - UINT32CONSTANT = 697, /* UINT32CONSTANT */ - INT64CONSTANT = 698, /* INT64CONSTANT */ - UINT64CONSTANT = 699, /* UINT64CONSTANT */ - SUBROUTINE = 700, /* SUBROUTINE */ - DEMOTE = 701, /* DEMOTE */ - FUNCTION = 702, /* FUNCTION */ - PAYLOADNV = 703, /* PAYLOADNV */ - PAYLOADINNV = 704, /* PAYLOADINNV */ - HITATTRNV = 705, /* HITATTRNV */ - CALLDATANV = 706, /* CALLDATANV */ - CALLDATAINNV = 707, /* CALLDATAINNV */ - PAYLOADEXT = 708, /* PAYLOADEXT */ - PAYLOADINEXT = 709, /* PAYLOADINEXT */ - HITATTREXT = 710, /* HITATTREXT */ - CALLDATAEXT = 711, /* CALLDATAEXT */ - CALLDATAINEXT = 712, /* CALLDATAINEXT */ - PATCH = 713, /* PATCH */ - SAMPLE = 714, /* SAMPLE */ - NONUNIFORM = 715, /* NONUNIFORM */ - COHERENT = 716, /* COHERENT */ - VOLATILE = 717, /* VOLATILE */ - RESTRICT = 718, /* RESTRICT */ - READONLY = 719, /* READONLY */ - WRITEONLY = 720, /* WRITEONLY */ - NONTEMPORAL = 721, /* NONTEMPORAL */ - DEVICECOHERENT = 722, /* DEVICECOHERENT */ - QUEUEFAMILYCOHERENT = 723, /* QUEUEFAMILYCOHERENT */ - WORKGROUPCOHERENT = 724, /* WORKGROUPCOHERENT */ - SUBGROUPCOHERENT = 725, /* SUBGROUPCOHERENT */ - NONPRIVATE = 726, /* NONPRIVATE */ - SHADERCALLCOHERENT = 727, /* SHADERCALLCOHERENT */ - NOPERSPECTIVE = 728, /* NOPERSPECTIVE */ - EXPLICITINTERPAMD = 729, /* EXPLICITINTERPAMD */ - PERVERTEXEXT = 730, /* PERVERTEXEXT */ - PERVERTEXNV = 731, /* PERVERTEXNV */ - PERPRIMITIVENV = 732, /* PERPRIMITIVENV */ - PERVIEWNV = 733, /* PERVIEWNV */ - PERTASKNV = 734, /* PERTASKNV */ - PERPRIMITIVEEXT = 735, /* PERPRIMITIVEEXT */ - TASKPAYLOADWORKGROUPEXT = 736, /* TASKPAYLOADWORKGROUPEXT */ - PRECISE = 737 /* PRECISE */ + VECTOR = 435, /* VECTOR */ + HITOBJECTNV = 436, /* HITOBJECTNV */ + HITOBJECTATTRNV = 437, /* HITOBJECTATTRNV */ + HITOBJECTEXT = 438, /* HITOBJECTEXT */ + HITOBJECTATTREXT = 439, /* HITOBJECTATTREXT */ + TENSORLAYOUTNV = 440, /* TENSORLAYOUTNV */ + TENSORVIEWNV = 441, /* TENSORVIEWNV */ + TENSORARM = 442, /* TENSORARM */ + SAMPLERCUBEARRAY = 443, /* SAMPLERCUBEARRAY */ + SAMPLERCUBEARRAYSHADOW = 444, /* SAMPLERCUBEARRAYSHADOW */ + ISAMPLERCUBEARRAY = 445, /* ISAMPLERCUBEARRAY */ + USAMPLERCUBEARRAY = 446, /* USAMPLERCUBEARRAY */ + SAMPLER1D = 447, /* SAMPLER1D */ + SAMPLER1DARRAY = 448, /* SAMPLER1DARRAY */ + SAMPLER1DARRAYSHADOW = 449, /* SAMPLER1DARRAYSHADOW */ + ISAMPLER1D = 450, /* ISAMPLER1D */ + SAMPLER1DSHADOW = 451, /* SAMPLER1DSHADOW */ + SAMPLER2DRECT = 452, /* SAMPLER2DRECT */ + SAMPLER2DRECTSHADOW = 453, /* SAMPLER2DRECTSHADOW */ + ISAMPLER2DRECT = 454, /* ISAMPLER2DRECT */ + USAMPLER2DRECT = 455, /* USAMPLER2DRECT */ + SAMPLERBUFFER = 456, /* SAMPLERBUFFER */ + ISAMPLERBUFFER = 457, /* ISAMPLERBUFFER */ + USAMPLERBUFFER = 458, /* USAMPLERBUFFER */ + SAMPLER2DMS = 459, /* SAMPLER2DMS */ + ISAMPLER2DMS = 460, /* ISAMPLER2DMS */ + USAMPLER2DMS = 461, /* USAMPLER2DMS */ + SAMPLER2DMSARRAY = 462, /* SAMPLER2DMSARRAY */ + ISAMPLER2DMSARRAY = 463, /* ISAMPLER2DMSARRAY */ + USAMPLER2DMSARRAY = 464, /* USAMPLER2DMSARRAY */ + SAMPLEREXTERNALOES = 465, /* SAMPLEREXTERNALOES */ + SAMPLEREXTERNAL2DY2YEXT = 466, /* SAMPLEREXTERNAL2DY2YEXT */ + ISAMPLER1DARRAY = 467, /* ISAMPLER1DARRAY */ + USAMPLER1D = 468, /* USAMPLER1D */ + USAMPLER1DARRAY = 469, /* USAMPLER1DARRAY */ + F16SAMPLER1D = 470, /* F16SAMPLER1D */ + F16SAMPLER2D = 471, /* F16SAMPLER2D */ + F16SAMPLER3D = 472, /* F16SAMPLER3D */ + F16SAMPLER2DRECT = 473, /* F16SAMPLER2DRECT */ + F16SAMPLERCUBE = 474, /* F16SAMPLERCUBE */ + F16SAMPLER1DARRAY = 475, /* F16SAMPLER1DARRAY */ + F16SAMPLER2DARRAY = 476, /* F16SAMPLER2DARRAY */ + F16SAMPLERCUBEARRAY = 477, /* F16SAMPLERCUBEARRAY */ + F16SAMPLERBUFFER = 478, /* F16SAMPLERBUFFER */ + F16SAMPLER2DMS = 479, /* F16SAMPLER2DMS */ + F16SAMPLER2DMSARRAY = 480, /* F16SAMPLER2DMSARRAY */ + F16SAMPLER1DSHADOW = 481, /* F16SAMPLER1DSHADOW */ + F16SAMPLER2DSHADOW = 482, /* F16SAMPLER2DSHADOW */ + F16SAMPLER1DARRAYSHADOW = 483, /* F16SAMPLER1DARRAYSHADOW */ + F16SAMPLER2DARRAYSHADOW = 484, /* F16SAMPLER2DARRAYSHADOW */ + F16SAMPLER2DRECTSHADOW = 485, /* F16SAMPLER2DRECTSHADOW */ + F16SAMPLERCUBESHADOW = 486, /* F16SAMPLERCUBESHADOW */ + F16SAMPLERCUBEARRAYSHADOW = 487, /* F16SAMPLERCUBEARRAYSHADOW */ + IMAGE1D = 488, /* IMAGE1D */ + IIMAGE1D = 489, /* IIMAGE1D */ + UIMAGE1D = 490, /* UIMAGE1D */ + IMAGE2D = 491, /* IMAGE2D */ + IIMAGE2D = 492, /* IIMAGE2D */ + UIMAGE2D = 493, /* UIMAGE2D */ + IMAGE3D = 494, /* IMAGE3D */ + IIMAGE3D = 495, /* IIMAGE3D */ + UIMAGE3D = 496, /* UIMAGE3D */ + IMAGE2DRECT = 497, /* IMAGE2DRECT */ + IIMAGE2DRECT = 498, /* IIMAGE2DRECT */ + UIMAGE2DRECT = 499, /* UIMAGE2DRECT */ + IMAGECUBE = 500, /* IMAGECUBE */ + IIMAGECUBE = 501, /* IIMAGECUBE */ + UIMAGECUBE = 502, /* UIMAGECUBE */ + IMAGEBUFFER = 503, /* IMAGEBUFFER */ + IIMAGEBUFFER = 504, /* IIMAGEBUFFER */ + UIMAGEBUFFER = 505, /* UIMAGEBUFFER */ + IMAGE1DARRAY = 506, /* IMAGE1DARRAY */ + IIMAGE1DARRAY = 507, /* IIMAGE1DARRAY */ + UIMAGE1DARRAY = 508, /* UIMAGE1DARRAY */ + IMAGE2DARRAY = 509, /* IMAGE2DARRAY */ + IIMAGE2DARRAY = 510, /* IIMAGE2DARRAY */ + UIMAGE2DARRAY = 511, /* UIMAGE2DARRAY */ + IMAGECUBEARRAY = 512, /* IMAGECUBEARRAY */ + IIMAGECUBEARRAY = 513, /* IIMAGECUBEARRAY */ + UIMAGECUBEARRAY = 514, /* UIMAGECUBEARRAY */ + IMAGE2DMS = 515, /* IMAGE2DMS */ + IIMAGE2DMS = 516, /* IIMAGE2DMS */ + UIMAGE2DMS = 517, /* UIMAGE2DMS */ + IMAGE2DMSARRAY = 518, /* IMAGE2DMSARRAY */ + IIMAGE2DMSARRAY = 519, /* IIMAGE2DMSARRAY */ + UIMAGE2DMSARRAY = 520, /* UIMAGE2DMSARRAY */ + F16IMAGE1D = 521, /* F16IMAGE1D */ + F16IMAGE2D = 522, /* F16IMAGE2D */ + F16IMAGE3D = 523, /* F16IMAGE3D */ + F16IMAGE2DRECT = 524, /* F16IMAGE2DRECT */ + F16IMAGECUBE = 525, /* F16IMAGECUBE */ + F16IMAGE1DARRAY = 526, /* F16IMAGE1DARRAY */ + F16IMAGE2DARRAY = 527, /* F16IMAGE2DARRAY */ + F16IMAGECUBEARRAY = 528, /* F16IMAGECUBEARRAY */ + F16IMAGEBUFFER = 529, /* F16IMAGEBUFFER */ + F16IMAGE2DMS = 530, /* F16IMAGE2DMS */ + F16IMAGE2DMSARRAY = 531, /* F16IMAGE2DMSARRAY */ + I64IMAGE1D = 532, /* I64IMAGE1D */ + U64IMAGE1D = 533, /* U64IMAGE1D */ + I64IMAGE2D = 534, /* I64IMAGE2D */ + U64IMAGE2D = 535, /* U64IMAGE2D */ + I64IMAGE3D = 536, /* I64IMAGE3D */ + U64IMAGE3D = 537, /* U64IMAGE3D */ + I64IMAGE2DRECT = 538, /* I64IMAGE2DRECT */ + U64IMAGE2DRECT = 539, /* U64IMAGE2DRECT */ + I64IMAGECUBE = 540, /* I64IMAGECUBE */ + U64IMAGECUBE = 541, /* U64IMAGECUBE */ + I64IMAGEBUFFER = 542, /* I64IMAGEBUFFER */ + U64IMAGEBUFFER = 543, /* U64IMAGEBUFFER */ + I64IMAGE1DARRAY = 544, /* I64IMAGE1DARRAY */ + U64IMAGE1DARRAY = 545, /* U64IMAGE1DARRAY */ + I64IMAGE2DARRAY = 546, /* I64IMAGE2DARRAY */ + U64IMAGE2DARRAY = 547, /* U64IMAGE2DARRAY */ + I64IMAGECUBEARRAY = 548, /* I64IMAGECUBEARRAY */ + U64IMAGECUBEARRAY = 549, /* U64IMAGECUBEARRAY */ + I64IMAGE2DMS = 550, /* I64IMAGE2DMS */ + U64IMAGE2DMS = 551, /* U64IMAGE2DMS */ + I64IMAGE2DMSARRAY = 552, /* I64IMAGE2DMSARRAY */ + U64IMAGE2DMSARRAY = 553, /* U64IMAGE2DMSARRAY */ + TEXTURECUBEARRAY = 554, /* TEXTURECUBEARRAY */ + ITEXTURECUBEARRAY = 555, /* ITEXTURECUBEARRAY */ + UTEXTURECUBEARRAY = 556, /* UTEXTURECUBEARRAY */ + TEXTURE1D = 557, /* TEXTURE1D */ + ITEXTURE1D = 558, /* ITEXTURE1D */ + UTEXTURE1D = 559, /* UTEXTURE1D */ + TEXTURE1DARRAY = 560, /* TEXTURE1DARRAY */ + ITEXTURE1DARRAY = 561, /* ITEXTURE1DARRAY */ + UTEXTURE1DARRAY = 562, /* UTEXTURE1DARRAY */ + TEXTURE2DRECT = 563, /* TEXTURE2DRECT */ + ITEXTURE2DRECT = 564, /* ITEXTURE2DRECT */ + UTEXTURE2DRECT = 565, /* UTEXTURE2DRECT */ + TEXTUREBUFFER = 566, /* TEXTUREBUFFER */ + ITEXTUREBUFFER = 567, /* ITEXTUREBUFFER */ + UTEXTUREBUFFER = 568, /* UTEXTUREBUFFER */ + TEXTURE2DMS = 569, /* TEXTURE2DMS */ + ITEXTURE2DMS = 570, /* ITEXTURE2DMS */ + UTEXTURE2DMS = 571, /* UTEXTURE2DMS */ + TEXTURE2DMSARRAY = 572, /* TEXTURE2DMSARRAY */ + ITEXTURE2DMSARRAY = 573, /* ITEXTURE2DMSARRAY */ + UTEXTURE2DMSARRAY = 574, /* UTEXTURE2DMSARRAY */ + F16TEXTURE1D = 575, /* F16TEXTURE1D */ + F16TEXTURE2D = 576, /* F16TEXTURE2D */ + F16TEXTURE3D = 577, /* F16TEXTURE3D */ + F16TEXTURE2DRECT = 578, /* F16TEXTURE2DRECT */ + F16TEXTURECUBE = 579, /* F16TEXTURECUBE */ + F16TEXTURE1DARRAY = 580, /* F16TEXTURE1DARRAY */ + F16TEXTURE2DARRAY = 581, /* F16TEXTURE2DARRAY */ + F16TEXTURECUBEARRAY = 582, /* F16TEXTURECUBEARRAY */ + F16TEXTUREBUFFER = 583, /* F16TEXTUREBUFFER */ + F16TEXTURE2DMS = 584, /* F16TEXTURE2DMS */ + F16TEXTURE2DMSARRAY = 585, /* F16TEXTURE2DMSARRAY */ + SUBPASSINPUT = 586, /* SUBPASSINPUT */ + SUBPASSINPUTMS = 587, /* SUBPASSINPUTMS */ + ISUBPASSINPUT = 588, /* ISUBPASSINPUT */ + ISUBPASSINPUTMS = 589, /* ISUBPASSINPUTMS */ + USUBPASSINPUT = 590, /* USUBPASSINPUT */ + USUBPASSINPUTMS = 591, /* USUBPASSINPUTMS */ + F16SUBPASSINPUT = 592, /* F16SUBPASSINPUT */ + F16SUBPASSINPUTMS = 593, /* F16SUBPASSINPUTMS */ + SPIRV_INSTRUCTION = 594, /* SPIRV_INSTRUCTION */ + SPIRV_EXECUTION_MODE = 595, /* SPIRV_EXECUTION_MODE */ + SPIRV_EXECUTION_MODE_ID = 596, /* SPIRV_EXECUTION_MODE_ID */ + SPIRV_DECORATE = 597, /* SPIRV_DECORATE */ + SPIRV_DECORATE_ID = 598, /* SPIRV_DECORATE_ID */ + SPIRV_DECORATE_STRING = 599, /* SPIRV_DECORATE_STRING */ + SPIRV_TYPE = 600, /* SPIRV_TYPE */ + SPIRV_STORAGE_CLASS = 601, /* SPIRV_STORAGE_CLASS */ + SPIRV_BY_REFERENCE = 602, /* SPIRV_BY_REFERENCE */ + SPIRV_LITERAL = 603, /* SPIRV_LITERAL */ + ATTACHMENTEXT = 604, /* ATTACHMENTEXT */ + IATTACHMENTEXT = 605, /* IATTACHMENTEXT */ + UATTACHMENTEXT = 606, /* UATTACHMENTEXT */ + LEFT_OP = 607, /* LEFT_OP */ + RIGHT_OP = 608, /* RIGHT_OP */ + INC_OP = 609, /* INC_OP */ + DEC_OP = 610, /* DEC_OP */ + LE_OP = 611, /* LE_OP */ + GE_OP = 612, /* GE_OP */ + EQ_OP = 613, /* EQ_OP */ + NE_OP = 614, /* NE_OP */ + AND_OP = 615, /* AND_OP */ + OR_OP = 616, /* OR_OP */ + XOR_OP = 617, /* XOR_OP */ + MUL_ASSIGN = 618, /* MUL_ASSIGN */ + DIV_ASSIGN = 619, /* DIV_ASSIGN */ + ADD_ASSIGN = 620, /* ADD_ASSIGN */ + MOD_ASSIGN = 621, /* MOD_ASSIGN */ + LEFT_ASSIGN = 622, /* LEFT_ASSIGN */ + RIGHT_ASSIGN = 623, /* RIGHT_ASSIGN */ + AND_ASSIGN = 624, /* AND_ASSIGN */ + XOR_ASSIGN = 625, /* XOR_ASSIGN */ + OR_ASSIGN = 626, /* OR_ASSIGN */ + SUB_ASSIGN = 627, /* SUB_ASSIGN */ + STRING_LITERAL = 628, /* STRING_LITERAL */ + LEFT_PAREN = 629, /* LEFT_PAREN */ + RIGHT_PAREN = 630, /* RIGHT_PAREN */ + LEFT_BRACKET = 631, /* LEFT_BRACKET */ + RIGHT_BRACKET = 632, /* RIGHT_BRACKET */ + LEFT_BRACE = 633, /* LEFT_BRACE */ + RIGHT_BRACE = 634, /* RIGHT_BRACE */ + DOT = 635, /* DOT */ + COMMA = 636, /* COMMA */ + COLON = 637, /* COLON */ + EQUAL = 638, /* EQUAL */ + SEMICOLON = 639, /* SEMICOLON */ + BANG = 640, /* BANG */ + DASH = 641, /* DASH */ + TILDE = 642, /* TILDE */ + PLUS = 643, /* PLUS */ + STAR = 644, /* STAR */ + SLASH = 645, /* SLASH */ + PERCENT = 646, /* PERCENT */ + LEFT_ANGLE = 647, /* LEFT_ANGLE */ + RIGHT_ANGLE = 648, /* RIGHT_ANGLE */ + VERTICAL_BAR = 649, /* VERTICAL_BAR */ + CARET = 650, /* CARET */ + AMPERSAND = 651, /* AMPERSAND */ + QUESTION = 652, /* QUESTION */ + INVARIANT = 653, /* INVARIANT */ + HIGH_PRECISION = 654, /* HIGH_PRECISION */ + MEDIUM_PRECISION = 655, /* MEDIUM_PRECISION */ + LOW_PRECISION = 656, /* LOW_PRECISION */ + PRECISION = 657, /* PRECISION */ + PACKED = 658, /* PACKED */ + RESOURCE = 659, /* RESOURCE */ + SUPERP = 660, /* SUPERP */ + FLOATCONSTANT = 661, /* FLOATCONSTANT */ + INTCONSTANT = 662, /* INTCONSTANT */ + UINTCONSTANT = 663, /* UINTCONSTANT */ + BOOLCONSTANT = 664, /* BOOLCONSTANT */ + IDENTIFIER = 665, /* IDENTIFIER */ + TYPE_NAME = 666, /* TYPE_NAME */ + CENTROID = 667, /* CENTROID */ + IN = 668, /* IN */ + OUT = 669, /* OUT */ + INOUT = 670, /* INOUT */ + STRUCT = 671, /* STRUCT */ + VOID = 672, /* VOID */ + WHILE = 673, /* WHILE */ + BREAK = 674, /* BREAK */ + CONTINUE = 675, /* CONTINUE */ + DO = 676, /* DO */ + ELSE = 677, /* ELSE */ + FOR = 678, /* FOR */ + IF = 679, /* IF */ + DISCARD = 680, /* DISCARD */ + RETURN = 681, /* RETURN */ + SWITCH = 682, /* SWITCH */ + CASE = 683, /* CASE */ + DEFAULT = 684, /* DEFAULT */ + TERMINATE_INVOCATION = 685, /* TERMINATE_INVOCATION */ + TERMINATE_RAY = 686, /* TERMINATE_RAY */ + IGNORE_INTERSECTION = 687, /* IGNORE_INTERSECTION */ + UNIFORM = 688, /* UNIFORM */ + SHARED = 689, /* SHARED */ + BUFFER = 690, /* BUFFER */ + TILEIMAGEEXT = 691, /* TILEIMAGEEXT */ + FLAT = 692, /* FLAT */ + SMOOTH = 693, /* SMOOTH */ + LAYOUT = 694, /* LAYOUT */ + DOUBLECONSTANT = 695, /* DOUBLECONSTANT */ + INT16CONSTANT = 696, /* INT16CONSTANT */ + UINT16CONSTANT = 697, /* UINT16CONSTANT */ + FLOAT16CONSTANT = 698, /* FLOAT16CONSTANT */ + INT32CONSTANT = 699, /* INT32CONSTANT */ + UINT32CONSTANT = 700, /* UINT32CONSTANT */ + INT64CONSTANT = 701, /* INT64CONSTANT */ + UINT64CONSTANT = 702, /* UINT64CONSTANT */ + SUBROUTINE = 703, /* SUBROUTINE */ + DEMOTE = 704, /* DEMOTE */ + FUNCTION = 705, /* FUNCTION */ + PAYLOADNV = 706, /* PAYLOADNV */ + PAYLOADINNV = 707, /* PAYLOADINNV */ + HITATTRNV = 708, /* HITATTRNV */ + CALLDATANV = 709, /* CALLDATANV */ + CALLDATAINNV = 710, /* CALLDATAINNV */ + PAYLOADEXT = 711, /* PAYLOADEXT */ + PAYLOADINEXT = 712, /* PAYLOADINEXT */ + HITATTREXT = 713, /* HITATTREXT */ + CALLDATAEXT = 714, /* CALLDATAEXT */ + CALLDATAINEXT = 715, /* CALLDATAINEXT */ + PATCH = 716, /* PATCH */ + SAMPLE = 717, /* SAMPLE */ + NONUNIFORM = 718, /* NONUNIFORM */ + RESOURCEHEAP = 719, /* RESOURCEHEAP */ + SAMPLERHEAP = 720, /* SAMPLERHEAP */ + COHERENT = 721, /* COHERENT */ + VOLATILE = 722, /* VOLATILE */ + RESTRICT = 723, /* RESTRICT */ + READONLY = 724, /* READONLY */ + WRITEONLY = 725, /* WRITEONLY */ + NONTEMPORAL = 726, /* NONTEMPORAL */ + DEVICECOHERENT = 727, /* DEVICECOHERENT */ + QUEUEFAMILYCOHERENT = 728, /* QUEUEFAMILYCOHERENT */ + WORKGROUPCOHERENT = 729, /* WORKGROUPCOHERENT */ + SUBGROUPCOHERENT = 730, /* SUBGROUPCOHERENT */ + NONPRIVATE = 731, /* NONPRIVATE */ + SHADERCALLCOHERENT = 732, /* SHADERCALLCOHERENT */ + NOPERSPECTIVE = 733, /* NOPERSPECTIVE */ + EXPLICITINTERPAMD = 734, /* EXPLICITINTERPAMD */ + PERVERTEXEXT = 735, /* PERVERTEXEXT */ + PERVERTEXNV = 736, /* PERVERTEXNV */ + PERPRIMITIVENV = 737, /* PERPRIMITIVENV */ + PERVIEWNV = 738, /* PERVIEWNV */ + PERTASKNV = 739, /* PERTASKNV */ + PERPRIMITIVEEXT = 740, /* PERPRIMITIVEEXT */ + TASKPAYLOADWORKGROUPEXT = 741, /* TASKPAYLOADWORKGROUPEXT */ + PRECISE = 742 /* PRECISE */ }; typedef enum yytokentype yytoken_kind_t; #endif @@ -581,7 +586,7 @@ union YYSTYPE glslang::TTypeParameters* typeParameters; } interm; -#line 585 "MachineIndependent/glslang_tab.cpp.h" +#line 590 "MachineIndependent/glslang_tab.cpp.h" }; typedef union YYSTYPE YYSTYPE; diff --git a/third_party/glslang/glslang/MachineIndependent/intermOut.cpp b/third_party/glslang/glslang/MachineIndependent/intermOut.cpp index e2745ff62d..572652d995 100644 --- a/third_party/glslang/glslang/MachineIndependent/intermOut.cpp +++ b/third_party/glslang/glslang/MachineIndependent/intermOut.cpp @@ -81,6 +81,7 @@ public: virtual bool visitLoop(TVisit, TIntermLoop* node); virtual bool visitBranch(TVisit, TIntermBranch* node); virtual bool visitSwitch(TVisit, TIntermSwitch* node); + virtual bool visitVariableDecl(TVisit, TIntermVariableDecl* node); TInfoSink& infoSink; protected: @@ -658,6 +659,11 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpConstructCooperativeVectorNV: out.debug << "Construct cooperative vector NV"; break; case EOpConstructAccStruct: out.debug << "Construct acceleration structure"; break; + case EOpBitCastArrayQCOM: out.debug << "Bitcast To Array QCOM"; break; + case EOpExtractSubArrayQCOM: out.debug << "Extract Subarray QCOM"; break; + case EOpCompositeConstructCoopMatQCOM: out.debug << "Construct Cooperative Matrix QCOM"; break; + case EOpCompositeExtractCoopMatQCOM: out.debug << "Extract Cooperative Matrix QCOM"; break; + case EOpLessThan: out.debug << "Compare Less Than"; break; case EOpGreaterThan: out.debug << "Compare Greater Than"; break; case EOpLessThanEqual: out.debug << "Compare Less Than or Equal"; break; @@ -1394,6 +1400,16 @@ bool TOutputTraverser::visitSwitch(TVisit /* visit */, TIntermSwitch* node) return false; } +bool TOutputTraverser::visitVariableDecl(TVisit /* visit */, TIntermVariableDecl* node) +{ + TInfoSink& out = infoSink; + + OutputTreeText(out, node, depth); + + out.debug << "VarDecl: " << node->getDeclSymbol()->getName() << '\n'; + return true; +} + // // This function is the one to call externally to start the traversal. // Individual functions can be initialized to 0 to skip processing of that diff --git a/third_party/glslang/glslang/MachineIndependent/iomapper.cpp b/third_party/glslang/glslang/MachineIndependent/iomapper.cpp index 26c3eaa62b..f7ab245dd9 100644 --- a/third_party/glslang/glslang/MachineIndependent/iomapper.cpp +++ b/third_party/glslang/glslang/MachineIndependent/iomapper.cpp @@ -166,7 +166,7 @@ typedef std::vector TVarLiveVector; class TVarGatherTraverser : public TLiveTraverser { public: TVarGatherTraverser(const TIntermediate& i, bool traverseDeadCode, TVarLiveMap& inList, TVarLiveMap& outList, TVarLiveMap& uniformList) - : TLiveTraverser(i, traverseDeadCode, true, true, false) + : TLiveTraverser(i, traverseDeadCode, true, true, false, false) , inputList(inList) , outputList(outList) , uniformList(uniformList) @@ -209,7 +209,7 @@ class TVarSetTraverser : public TLiveTraverser { public: TVarSetTraverser(const TIntermediate& i, const TVarLiveMap& inList, const TVarLiveMap& outList, const TVarLiveMap& uniformList) - : TLiveTraverser(i, true, true, true, false) + : TLiveTraverser(i, true, true, true, false, true) , inputList(inList) , outputList(outList) , uniformList(uniformList) @@ -888,38 +888,38 @@ bool TDefaultIoResolverBase::doAutoBindingMapping() const { return referenceInte bool TDefaultIoResolverBase::doAutoLocationMapping() const { return referenceIntermediate.getAutoMapLocations(); } -TDefaultIoResolverBase::TSlotSet::iterator TDefaultIoResolverBase::findSlot(int set, int slot) { - return std::lower_bound(slots[set].begin(), slots[set].end(), slot); +TDefaultIoResolverBase::TSlotSet::iterator TDefaultIoResolverBase::findSlot(int resource, int set, int slot) { + return std::lower_bound(slots[resource][set].begin(), slots[resource][set].end(), slot); } -bool TDefaultIoResolverBase::checkEmpty(int set, int slot) { - TSlotSet::iterator at = findSlot(set, slot); - return ! (at != slots[set].end() && *at == slot); +bool TDefaultIoResolverBase::checkEmpty(int resource, int set, int slot) { + TSlotSet::iterator at = findSlot(resource, set, slot); + return ! (at != slots[resource][set].end() && *at == slot); } -int TDefaultIoResolverBase::reserveSlot(int set, int slot, int size) { - TSlotSet::iterator at = findSlot(set, slot); +int TDefaultIoResolverBase::reserveSlot(int resource, int set, int slot, int size) { + TSlotSet::iterator at = findSlot(resource, set, slot); // tolerate aliasing, by not double-recording aliases // (policy about appropriateness of the alias is higher up) for (int i = 0; i < size; i++) { - if (at == slots[set].end() || *at != slot + i) - at = slots[set].insert(at, slot + i); + if (at == slots[resource][set].end() || *at != slot + i) + at = slots[resource][set].insert(at, slot + i); ++at; } return slot; } -int TDefaultIoResolverBase::getFreeSlot(int set, int base, int size) { - TSlotSet::iterator at = findSlot(set, base); - if (at == slots[set].end()) - return reserveSlot(set, base, size); +int TDefaultIoResolverBase::getFreeSlot(int resource, int set, int base, int size) { + TSlotSet::iterator at = findSlot(resource, set, base); + if (at == slots[resource][set].end()) + return reserveSlot(resource, set, base, size); // look for a big enough gap - for (; at != slots[set].end(); ++at) { + for (; at != slots[resource][set].end(); ++at) { if (*at - base >= size) break; base = *at + 1; } - return reserveSlot(set, base, size); + return reserveSlot(resource, set, base, size); } int TDefaultIoResolverBase::resolveSet(EShLanguage stage, TVarEntryInfo& ent) { @@ -1019,6 +1019,7 @@ uint32_t TDefaultIoResolverBase::computeTypeLocationSize(const TType& type, EShL //TDefaultGlslIoResolver TResourceType TDefaultGlslIoResolver::getResourceType(const glslang::TType& type) { + assert(isValidGlslType(type)); if (isImageType(type)) { return EResImage; } @@ -1034,6 +1035,15 @@ TResourceType TDefaultGlslIoResolver::getResourceType(const glslang::TType& type if (isUboType(type)) { return EResUbo; } + if (isCombinedSamplerType(type)) { + return EResCombinedSampler; + } + if (isAsType(type)) { + return EResAs; + } + if (isTensorType(type)) { + return EResTensor; + } return EResCount; } @@ -1113,13 +1123,13 @@ int TDefaultGlslIoResolver::resolveInOutLocation(EShLanguage stage, TVarEntryInf // // vs: out vec4 a; // fs: in vec4 a; - location = getFreeSlot(resourceKey, 0, typeLocationSize); + location = getFreeSlot(0, resourceKey, 0, typeLocationSize); storageSlotMap[resourceKey][name] = location; } } else { // the first interface declarated in a program. TVarSlotMap varSlotMap; - location = getFreeSlot(resourceKey, 0, typeLocationSize); + location = getFreeSlot(0, resourceKey, 0, typeLocationSize); varSlotMap[name] = location; storageSlotMap[resourceKey] = varSlotMap; } @@ -1186,13 +1196,13 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn // // vs: uniform vec4 a; // fs: uniform vec4 a; - location = getFreeSlot(resourceKey, 0, computeTypeLocationSize(type, currentStage)); + location = getFreeSlot(0, resourceKey, 0, computeTypeLocationSize(type, currentStage)); storageSlotMap[resourceKey][name] = location; } } else { // the first uniform declaration in a program. TVarSlotMap varSlotMap; - location = getFreeSlot(resourceKey, 0, size); + location = getFreeSlot(0, resourceKey, 0, size); varSlotMap[name] = location; storageSlotMap[resourceKey] = varSlotMap; } @@ -1212,13 +1222,12 @@ int TDefaultGlslIoResolver::resolveBinding(EShLanguage stage, TVarEntryInfo& ent // There is no 'set' qualifier in OpenGL shading language, each resource has its own // binding name space, so remap the 'set' to resource type which make each resource // binding is valid from 0 to MAX_XXRESOURCE_BINDINGS - int set = referenceIntermediate.getSpv().openGl != 0 ? resource : ent.newSet; - int resourceKey = set; + int set = referenceIntermediate.getSpv().openGl != 0 ? 0 : ent.newSet; + int resourceKey = referenceIntermediate.getSpv().openGl != 0 || referenceIntermediate.getBindingsPerResourceType() ? resource : 0; if (resource < EResCount) { if (type.getQualifier().hasBinding()) { - int newBinding = reserveSlot(resourceKey, getBaseBinding(stage, resource, set) + type.getQualifier().layoutBinding, numBindings); + int newBinding = reserveSlot(resourceKey, set, getBaseBinding(stage, resource, set) + type.getQualifier().layoutBinding, numBindings); return ent.newBinding = newBinding; - } else { // The resource in current stage is not declared with binding, but it is possible declared // with explicit binding in other stages, find the resourceSlotMap firstly to check whether @@ -1226,9 +1235,9 @@ int TDefaultGlslIoResolver::resolveBinding(EShLanguage stage, TVarEntryInfo& ent bool hasBinding = false; ent.newBinding = -1; // leave as -1 if it isn't set below - if (! resourceSlotMap[resourceKey].empty()) { - TVarSlotMap::iterator iter = resourceSlotMap[resourceKey].find(name); - if (iter != resourceSlotMap[resourceKey].end()) { + if (! resourceSlotMap[resourceKey][set].empty()) { + TVarSlotMap::iterator iter = resourceSlotMap[resourceKey][set].find(name); + if (iter != resourceSlotMap[resourceKey][set].end()) { hasBinding = true; ent.newBinding = iter->second; } @@ -1236,8 +1245,8 @@ int TDefaultGlslIoResolver::resolveBinding(EShLanguage stage, TVarEntryInfo& ent if (!hasBinding && (ent.live && doAutoBindingMapping())) { // find free slot, the caller did make sure it passes all vars with binding // first and now all are passed that do not have a binding and needs one - int binding = getFreeSlot(resourceKey, getBaseBinding(stage, resource, set), numBindings); - resourceSlotMap[resourceKey][name] = binding; + int binding = getFreeSlot(resourceKey, set, getBaseBinding(stage, resource, set), numBindings); + resourceSlotMap[resourceKey][set][name] = binding; ent.newBinding = binding; } return ent.newBinding; @@ -1292,7 +1301,7 @@ void TDefaultGlslIoResolver::reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& TVarSlotMap::iterator iter = varSlotMap.find(name); if (iter == varSlotMap.end()) { int numLocations = TIntermediate::computeTypeUniformLocationSize(type); - reserveSlot(storageKey, location, numLocations); + reserveSlot(0, storageKey, location, numLocations); varSlotMap[name] = location; } else { // Allocate location by name for OpenGL driver, so the uniform in different @@ -1318,7 +1327,7 @@ void TDefaultGlslIoResolver::reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& TVarSlotMap::iterator iter = varSlotMap.find(name); if (iter == varSlotMap.end()) { int numLocations = TIntermediate::computeTypeUniformLocationSize(type); - reserveSlot(storageKey, location, numLocations); + reserveSlot(0, storageKey, location, numLocations); varSlotMap[name] = location; } else { // Allocate location by name for OpenGL driver, so the uniform in different @@ -1340,19 +1349,18 @@ void TDefaultGlslIoResolver::reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& const TType& type = ent.symbol->getType(); const TString& name = ent.symbol->getAccessName(); TResourceType resource = getResourceType(type); - int set = referenceIntermediate.getSpv().openGl != 0 ? resource : resolveSet(ent.stage, ent); - int resourceKey = set; + int set = referenceIntermediate.getSpv().openGl != 0 ? 0 : resolveSet(ent.stage, ent); + int resourceKey = referenceIntermediate.getSpv().openGl != 0 || referenceIntermediate.getBindingsPerResourceType() ? resource : 0; if (type.getQualifier().hasBinding()) { - TVarSlotMap& varSlotMap = resourceSlotMap[resourceKey]; + TVarSlotMap& varSlotMap = resourceSlotMap[resourceKey][set]; TVarSlotMap::iterator iter = varSlotMap.find(name); int binding = type.getQualifier().layoutBinding + getBaseBinding(ent.stage, resource, set); - if (iter == varSlotMap.end()) { // Reserve the slots for the ubo, ssbo and opaques who has explicit binding int numBindings = referenceIntermediate.getSpv().openGl != 0 && type.isSizedArray() ? type.getCumulativeArraySize() : 1; varSlotMap[name] = binding; - reserveSlot(resourceKey, binding, numBindings); + reserveSlot(resourceKey, set, binding, numBindings); } else { // Allocate binding by name for OpenGL driver, so the resource in different // stages should be declared with the same binding @@ -1383,6 +1391,7 @@ struct TDefaultIoResolver : public TDefaultIoResolverBase { bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } TResourceType getResourceType(const glslang::TType& type) override { + assert(isValidGlslType(type)); if (isImageType(type)) { return EResImage; } @@ -1398,6 +1407,15 @@ struct TDefaultIoResolver : public TDefaultIoResolverBase { if (isUboType(type)) { return EResUbo; } + if (isCombinedSamplerType(type)) { + return EResCombinedSampler; + } + if (isAsType(type)) { + return EResAs; + } + if (isTensorType(type)) { + return EResTensor; + } return EResCount; } @@ -1407,14 +1425,15 @@ struct TDefaultIoResolver : public TDefaultIoResolverBase { // On OpenGL arrays of opaque types take a seperate binding for each element int numBindings = referenceIntermediate.getSpv().openGl != 0 && type.isSizedArray() ? type.getCumulativeArraySize() : 1; TResourceType resource = getResourceType(type); + int resourceKey = referenceIntermediate.getBindingsPerResourceType() ? resource : 0; if (resource < EResCount) { if (type.getQualifier().hasBinding()) { return ent.newBinding = reserveSlot( - set, getBaseBinding(stage, resource, set) + type.getQualifier().layoutBinding, numBindings); + resourceKey, set, getBaseBinding(stage, resource, set) + type.getQualifier().layoutBinding, numBindings); } else if (ent.live && doAutoBindingMapping()) { // find free slot, the caller did make sure it passes all vars with binding // first and now all are passed that do not have a binding and needs one - return ent.newBinding = getFreeSlot(set, getBaseBinding(stage, resource, set), numBindings); + return ent.newBinding = getFreeSlot(resourceKey, set, getBaseBinding(stage, resource, set), numBindings); } } return ent.newBinding = -1; @@ -1483,6 +1502,11 @@ struct TDefaultHlslIoResolver : public TDefaultIoResolverBase { if (isUboType(type)) { return EResUbo; } + // no support for combined samplers in HLSL + if (isAsType(type)) { + return EResAs; + } + // no support for tensors in HLSL return EResCount; } @@ -1490,13 +1514,14 @@ struct TDefaultHlslIoResolver : public TDefaultIoResolverBase { const TType& type = ent.symbol->getType(); const int set = getLayoutSet(type); TResourceType resource = getResourceType(type); + int resourceKey = referenceIntermediate.getBindingsPerResourceType() ? resource : 0; if (resource < EResCount) { if (type.getQualifier().hasBinding()) { - return ent.newBinding = reserveSlot(set, getBaseBinding(stage, resource, set) + type.getQualifier().layoutBinding); + return ent.newBinding = reserveSlot(resourceKey, set, getBaseBinding(stage, resource, set) + type.getQualifier().layoutBinding); } else if (ent.live && doAutoBindingMapping()) { // find free slot, the caller did make sure it passes all vars with binding // first and now all are passed that do not have a binding and needs one - return ent.newBinding = getFreeSlot(set, getBaseBinding(stage, resource, set)); + return ent.newBinding = getFreeSlot(resourceKey, set, getBaseBinding(stage, resource, set)); } } return ent.newBinding = -1; diff --git a/third_party/glslang/glslang/MachineIndependent/iomapper.h b/third_party/glslang/glslang/MachineIndependent/iomapper.h index ef513d9a60..d8c290733d 100644 --- a/third_party/glslang/glslang/MachineIndependent/iomapper.h +++ b/third_party/glslang/glslang/MachineIndependent/iomapper.h @@ -37,6 +37,7 @@ #define _IOMAPPER_INCLUDED #include +#include #include #include // @@ -55,6 +56,7 @@ public: TDefaultIoResolverBase(const TIntermediate& intermediate); typedef std::vector TSlotSet; typedef std::unordered_map TSlotSetMap; + typedef std::array TSlotSetMapResourceArray; // grow the reflection stage by stage void notifyBinding(EShLanguage, TVarEntryInfo& /*ent*/) override {} @@ -72,11 +74,11 @@ public: virtual TResourceType getResourceType(const glslang::TType& type) = 0; bool doAutoBindingMapping() const; bool doAutoLocationMapping() const; - TSlotSet::iterator findSlot(int set, int slot); - bool checkEmpty(int set, int slot); + TSlotSet::iterator findSlot(int resource, int set, int slot); + bool checkEmpty(int resource, int set, int slot); bool validateInOut(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } - int reserveSlot(int set, int slot, int size = 1); - int getFreeSlot(int set, int base, int size = 1); + int reserveSlot(int resource, int set, int slot, int size = 1); + int getFreeSlot(int resource, int set, int base, int size = 1); int resolveSet(EShLanguage /*stage*/, TVarEntryInfo& ent) override; int resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) override; int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) override; @@ -90,7 +92,7 @@ public: } uint32_t computeTypeLocationSize(const TType& type, EShLanguage stage); - TSlotSetMap slots; + TSlotSetMapResourceArray slots; bool hasError = false; protected: @@ -120,12 +122,12 @@ protected: } static bool isTextureType(const glslang::TType& type) { - return (type.getBasicType() == glslang::EbtSampler && + return (type.getBasicType() == glslang::EbtSampler && !type.getSampler().isCombined() && (type.getSampler().isTexture() || type.getSampler().isSubpass())); } static bool isUboType(const glslang::TType& type) { - return type.getQualifier().storage == EvqUniform; + return type.getQualifier().storage == EvqUniform && type.isStruct(); } static bool isImageType(const glslang::TType& type) { @@ -136,6 +138,24 @@ protected: return type.getQualifier().storage == EvqBuffer; } + static bool isCombinedSamplerType(const glslang::TType& type) { + return type.getBasicType() == glslang::EbtSampler && type.getSampler().isCombined(); + } + + static bool isAsType(const glslang::TType& type) { + return type.getBasicType() == glslang::EbtAccStruct; + } + + static bool isTensorType(const glslang::TType& type) { + return type.isTensorARM(); + } + + static bool isValidGlslType(const glslang::TType& type) { + // at most one must be true + return (isSamplerType(type) + isTextureType(type) + isUboType(type) + isImageType(type) + + isSsboType(type) + isCombinedSamplerType(type) + isAsType(type) + isTensorType(type)) <= 1; + } + // Return true if this is a SRV (shader resource view) type: static bool isSrvType(const glslang::TType& type) { return isTextureType(type) || type.getQualifier().storage == EvqBuffer; @@ -155,6 +175,7 @@ struct TDefaultGlslIoResolver : public TDefaultIoResolverBase { public: typedef std::map TVarSlotMap; // typedef std::map TSlotMap; // + typedef std::array TResourceSlotMap; TDefaultGlslIoResolver(const TIntermediate& intermediate); bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } TResourceType getResourceType(const glslang::TType& type) override; @@ -182,7 +203,7 @@ protected: // Use for mark current shader stage for resolver EShLanguage currentStage; // Slot map for storage resource(location of uniform and interface symbol) It's a program share slot - TSlotMap resourceSlotMap; + TResourceSlotMap resourceSlotMap; // Slot map for other resource(image, ubo, ssbo), It's a program share slot. TSlotMap storageSlotMap; }; diff --git a/third_party/glslang/glslang/MachineIndependent/linkValidate.cpp b/third_party/glslang/glslang/MachineIndependent/linkValidate.cpp index d7dbaa35d5..0879fa79a9 100644 --- a/third_party/glslang/glslang/MachineIndependent/linkValidate.cpp +++ b/third_party/glslang/glslang/MachineIndependent/linkValidate.cpp @@ -524,7 +524,8 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) numErrors += unit.getNumErrors(); // Only one push_constant is allowed, mergeLinkerObjects() will ensure the push_constant // is the same for all units. - if (numPushConstants > 1 || unit.numPushConstants > 1) + if (!IsRequestedExtension(glslang::E_GL_NV_push_constant_bank) && + (numPushConstants > 1 || unit.numPushConstants > 1)) error(infoSink, "Only one push_constant block is allowed per stage"); numPushConstants = std::min(numPushConstants + unit.numPushConstants, 1); @@ -535,6 +536,9 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) error(infoSink, "number of invocations must match between compilation units"); } + // The GLSL specification requires that at least one compilation unit + // must declare the vertices layout, but not all units need to do so. + // However, all declarations must match. if (vertices == TQualifier::layoutNotSet) vertices = unit.vertices; else if (unit.vertices != TQualifier::layoutNotSet && vertices != unit.vertices) { @@ -545,20 +549,30 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) else assert(0); } + + // The mesh shader extension requires that at least one compilation unit + // must declare the max_primitives layout, but not all units need to do so. + // However, all declarations must match. if (primitives == TQualifier::layoutNotSet) primitives = unit.primitives; - else if (primitives != unit.primitives) { + else if (unit.primitives != TQualifier::layoutNotSet && primitives != unit.primitives) { if (language == EShLangMesh) error(infoSink, "Contradictory layout max_primitives values"); else assert(0); } + // The GLSL specification requires that at least one compilation unit + // must declare the input primitive layout, but not all units need to do so. + // However, all declarations must match. if (inputPrimitive == ElgNone) inputPrimitive = unit.inputPrimitive; else if (unit.inputPrimitive != ElgNone && inputPrimitive != unit.inputPrimitive) error(infoSink, "Contradictory input layout primitives"); + // The GLSL specification requires that at least one compilation unit + // must declare the output primitive layout, but not all units need to do so. + // However, all declarations must match. if (outputPrimitive == ElgNone) outputPrimitive = unit.outputPrimitive; else if (unit.outputPrimitive != ElgNone && outputPrimitive != unit.outputPrimitive) @@ -567,19 +581,27 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) if (originUpperLeft != unit.originUpperLeft || pixelCenterInteger != unit.pixelCenterInteger) error(infoSink, "gl_FragCoord redeclarations must match across shaders"); + // The GLSL specification requires that at least one compilation unit + // must declare the vertex spacing layout, but not all units need to do so. + // However, all declarations must match. if (vertexSpacing == EvsNone) vertexSpacing = unit.vertexSpacing; - else if (vertexSpacing != unit.vertexSpacing) + else if (unit.vertexSpacing != EvsNone && vertexSpacing != unit.vertexSpacing) error(infoSink, "Contradictory input vertex spacing"); + // The GLSL specification requires that at least one compilation unit + // must declare the triangle ordering layout, but not all units need to do so. + // However, all declarations must match. if (vertexOrder == EvoNone) vertexOrder = unit.vertexOrder; - else if (vertexOrder != unit.vertexOrder) + else if (unit.vertexOrder != EvoNone && vertexOrder != unit.vertexOrder) error(infoSink, "Contradictory triangle ordering"); MERGE_TRUE(pointMode); for (int i = 0; i < 3; ++i) { + // The GLSL specification requires that all workgroup size declarations must match + // but not all units have to declare the layout. if (unit.localSizeNotDefault[i]) { if (!localSizeNotDefault[i]) { localSize[i] = unit.localSize[i]; @@ -589,9 +611,11 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) error(infoSink, "Contradictory local size"); } + // The GLSL specification requires that all workgroup size specialization + // ids declarations must match, but not all units have to declare the layout. if (localSizeSpecId[i] == TQualifier::layoutNotSet) localSizeSpecId[i] = unit.localSizeSpecId[i]; - else if (localSizeSpecId[i] != unit.localSizeSpecId[i]) + else if (unit.localSizeSpecId[i] != TQualifier::layoutNotSet && localSizeSpecId[i] != unit.localSizeSpecId[i]) error(infoSink, "Contradictory local size specialization ids"); } @@ -602,9 +626,11 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) MERGE_TRUE(nonCoherentStencilAttachmentReadEXT); MERGE_TRUE(nonCoherentTileAttachmentReadQCOM); + // The GLSL specification requires that all depth layout redeclarations must match, + // but not all units have to declare the layout. if (depthLayout == EldNone) depthLayout = unit.depthLayout; - else if (depthLayout != unit.depthLayout) + else if (unit.depthLayout != EldNone && depthLayout != unit.depthLayout) error(infoSink, "Contradictory depth layouts"); MERGE_TRUE(depthReplacing); @@ -615,9 +641,11 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) MERGE_TRUE(xfbMode); for (size_t b = 0; b < xfbBuffers.size(); ++b) { + // The GLSL specification requires that all xfb_stride declarations for + // the same buffer must match, but not all units have to declare the layout. if (xfbBuffers[b].stride == TQualifier::layoutXfbStrideEnd) xfbBuffers[b].stride = unit.xfbBuffers[b].stride; - else if (xfbBuffers[b].stride != unit.xfbBuffers[b].stride) + else if (unit.xfbBuffers[b].stride != TQualifier::layoutXfbStrideEnd && xfbBuffers[b].stride != unit.xfbBuffers[b].stride) error(infoSink, "Contradictory xfb_stride"); xfbBuffers[b].implicitStride = std::max(xfbBuffers[b].implicitStride, unit.xfbBuffers[b].implicitStride); if (unit.xfbBuffers[b].contains64BitType) @@ -1098,7 +1126,8 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin mergeErrorCheck(infoSink, *symbol, *unitSymbol); } // If different symbols, verify they arn't push_constant since there can only be one per stage - else if (symbol->getQualifier().isPushConstant() && unitSymbol->getQualifier().isPushConstant() && getStage() == unitStage) + else if (!IsRequestedExtension(glslang::E_GL_NV_push_constant_bank) && + (symbol->getQualifier().isPushConstant() && unitSymbol->getQualifier().isPushConstant() && getStage() == unitStage)) error(infoSink, "Only one push_constant block is allowed per stage"); } @@ -1563,7 +1592,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) // overlap/alias/missing I/O, etc. inOutLocationCheck(infoSink); - if (getNumPushConstants() > 1) + if (!IsRequestedExtension(glslang::E_GL_NV_push_constant_bank) && (getNumPushConstants() > 1)) error(infoSink, "Only one push_constant block is allowed per stage"); // invocations @@ -1959,6 +1988,8 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ set = 1; else if (qualifier.isHitObjectAttrNV()) set = 2; + else if (qualifier.isHitObjectAttrEXT()) + set = 2; else return -1; @@ -1997,7 +2028,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ // For raytracing IO (payloads and callabledata) each declaration occupies a single // slot irrespective of type. int collision = -1; // no collision - if (qualifier.isAnyPayload() || qualifier.isAnyCallable() || qualifier.isHitObjectAttrNV()) { + if (qualifier.isAnyPayload() || qualifier.isAnyCallable() || qualifier.isHitObjectAttrNV() || qualifier.isHitObjectAttrEXT()) { TRange range(qualifier.layoutLocation, qualifier.layoutLocation); collision = checkLocationRT(set, qualifier.layoutLocation); if (collision < 0) @@ -2544,6 +2575,22 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, T } } + // rules 2 and 3 + if (type.isLongVector()) { + int scalarAlign = getBaseAlignmentScalar(type, size); + uint32_t vectorSize = type.getTypeParameters()->arraySizes->getDimSize(0); + switch (vectorSize) { + case 1: // HLSL has this, GLSL does not + return scalarAlign; + case 2: + size *= 2; + return 2 * scalarAlign; + default: + size *= vectorSize; + return 4 * scalarAlign; + } + } + // rules 5 and 7 if (type.isMatrix()) { // rule 5: deref to row, not to column, meaning the size of vector is num columns instead of num rows @@ -2624,6 +2671,14 @@ int TIntermediate::getScalarAlignment(const TType& type, int& size, int& stride, return scalarAlign; } + if (type.isLongVector()) { + int scalarAlign = getBaseAlignmentScalar(type, size); + + uint32_t vectorSize = type.getTypeParameters()->arraySizes->getDimSize(0); + size *= vectorSize; + return scalarAlign; + } + if (type.isMatrix()) { TType derefType(type, 0, rowMajor); diff --git a/third_party/glslang/glslang/MachineIndependent/localintermediate.h b/third_party/glslang/glslang/MachineIndependent/localintermediate.h index 0d299bda2f..209a724583 100644 --- a/third_party/glslang/glslang/MachineIndependent/localintermediate.h +++ b/third_party/glslang/glslang/MachineIndependent/localintermediate.h @@ -48,6 +48,7 @@ #include #include #include +#include #include class TInfoSink; @@ -351,6 +352,7 @@ public: hlslOffsets(false), hlslIoMapping(false), useVariablePointers(false), + bindingsPerResourceType(false), textureSamplerTransformMode(EShTexSampTransKeep), needToLegalize(false), binaryDoubleOutput(false), @@ -574,8 +576,8 @@ public: TIntermConstantUnion* addConstantUnion(const TString*, const TSourceLoc&, bool literal = false) const; TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const; bool parseConstTree(TIntermNode*, TConstUnionArray, TOperator, const TType&, bool singleConstantParam = false); - TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&); - TIntermAggregate* addForLoop(TIntermNode*, TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, + TIntermLoop* addLoop(TIntermNode*, TIntermNode*, TIntermTyped*, bool testFirst, const TSourceLoc&); + TIntermAggregate* addForLoop(TIntermNode*, TIntermNode*, TIntermNode*, TIntermTyped*, bool testFirst, const TSourceLoc&, TIntermLoop*&); TIntermBranch* addBranch(TOperator, const TSourceLoc&); TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&); @@ -763,6 +765,16 @@ public: useReplicatedComposites = true; } bool usingReplicatedComposites() const { return useReplicatedComposites; } + void setPromoteUint32Indices() + { + promoteUint32Indices = true; + } + bool usingPromoteUint32Indices() const { return promoteUint32Indices; } + void setShader64BitIndexing() + { + shader64BitIndexing = true; + } + bool usingShader64BitIndexing() const { return shader64BitIndexing; } void setUseVariablePointers() { useVariablePointers = true; @@ -829,6 +841,13 @@ public: bool usingVariablePointers() const { return useVariablePointers; } + void setBindingsPerResourceType() + { + bindingsPerResourceType = true; + processes.addProcess("bindings-per-resource-type"); + } + bool getBindingsPerResourceType() const { return bindingsPerResourceType; } + #ifdef ENABLE_HLSL template T addCounterBufferName(const T& name) const { return name + implicitCounterName; } bool hasCounterBufferName(const TString& name) const { @@ -1151,6 +1170,13 @@ public: void updateNumericFeature(TNumericFeatures::feature f, bool on) { on ? numericFeatures.insert(f) : numericFeatures.erase(f); } + void setBuiltinAliasLookup(std::unordered_multimap symbolMap) { + builtinAliasLookup = std::move(symbolMap); + } + const std::unordered_multimap& getBuiltinAliasLookup() const { + return builtinAliasLookup; + } + protected: TIntermSymbol* addSymbol(long long Id, const TString&, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&); void error(TInfoSink& infoSink, const TSourceLoc* loc, EShMessages messages, const char*, EShLanguage unitStage = EShLangCount); @@ -1284,6 +1310,7 @@ protected: bool hlslOffsets; bool hlslIoMapping; bool useVariablePointers; + bool bindingsPerResourceType; std::set semanticNameSet; @@ -1295,6 +1322,8 @@ protected: bool maximallyReconverges; bool usePhysicalStorageBuffer; bool useReplicatedComposites { false }; + bool promoteUint32Indices { false }; + bool shader64BitIndexing { false }; TSpirvRequirement* spirvRequirement; TSpirvExecutionMode* spirvExecutionMode; @@ -1323,6 +1352,9 @@ protected: // Included text. First string is a name, second is the included text std::map includeText; + // Maps from canonical symbol name to alias symbol names + std::unordered_multimap builtinAliasLookup; + // for OpModuleProcessed, or equivalent TProcesses processes; diff --git a/third_party/glslang/glslang/MachineIndependent/parseVersions.h b/third_party/glslang/glslang/MachineIndependent/parseVersions.h index f651e29f5c..df1fa57010 100644 --- a/third_party/glslang/glslang/MachineIndependent/parseVersions.h +++ b/third_party/glslang/glslang/MachineIndependent/parseVersions.h @@ -124,8 +124,10 @@ public: virtual void fcoopmatCheckNV(const TSourceLoc&, const char* op, bool builtIn = false); virtual void intcoopmatCheckNV(const TSourceLoc&, const char *op, bool builtIn = false); virtual void coopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void coopmatConverisonCheckQCOM(const TSourceLoc& loc, const char* op, bool builtIn = false); virtual void tensorLayoutViewCheck(const TSourceLoc&, const char* op, bool builtIn = false); virtual void coopvecCheck(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void longVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); virtual void intattachmentCheck(const TSourceLoc&, const char *op, bool builtIn = false); virtual void tensorCheckARM(const TSourceLoc&, const char *op, bool builtIn = false); bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } diff --git a/third_party/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp b/third_party/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp index 5b44b1304e..90270367fb 100644 --- a/third_party/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/third_party/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -153,12 +153,57 @@ int TPpContext::CPPdefine(TPpToken* ppToken) return token; } + int pendingPoundSymbols = 0; + TPpToken savePound; // record the definition of the macro while (token != '\n' && token != EndOfInput) { - mac.body.putToken(token, ppToken); + if (token == '#') { + pendingPoundSymbols++; + if (pendingPoundSymbols == 0) { + savePound = *ppToken; + } + } else if (pendingPoundSymbols == 0) { + mac.body.putToken(token, ppToken); + } else if (pendingPoundSymbols == 1) { + // A single #: stringify + parseContext.requireProfile(ppToken->loc, ~EEsProfile, "stringify (#)"); + parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, nullptr, "stringify (#)"); + bool isArg = false; + if (token == PpAtomIdentifier) { + for (int i = (int)mac.args.size() - 1; i >= 0; i--) { + if (strcmp(atomStrings.getString(mac.args[i]), ppToken->name) == 0) { + isArg = true; + break; + } + } + } + if (!isArg) { + parseContext.ppError(ppToken->loc, "'#' is not followed by a macro parameter.", "#", ""); + return token; + } + mac.body.putToken(tStringifyLevelInput::PUSH, ppToken); + mac.body.putToken(token, ppToken); + mac.body.putToken(tStringifyLevelInput::POP, ppToken); + pendingPoundSymbols = 0; + } else if (pendingPoundSymbols % 2 == 0) { + // Any number of pastes '##' in a row: idempotent, just becomes one paste + parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)"); + parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, nullptr, "token pasting (##)"); + for (int i = 0; i < pendingPoundSymbols / 2; i++) { + mac.body.putToken(PpAtomPaste, &savePound); + } + mac.body.putToken(token, ppToken); + pendingPoundSymbols = 0; + } else { + // An odd number of '#' i.e., mix of paste and stringify: does not give valid preprocessing token + parseContext.ppError(ppToken->loc, "Illegal sequence of paste (##) and stringify (#).", "#", ""); + return token; + } + token = scanToken(ppToken); - if (token != '\n' && ppToken->space) - mac.body.putToken(' ', ppToken); + } + if (pendingPoundSymbols != 0) { + parseContext.ppError(ppToken->loc, "Macro ended with incomplete '#' paste/stringify operators", "#", ""); } // check for duplicate definition @@ -1119,7 +1164,7 @@ int TPpContext::tMacroInput::scan(TPpToken* ppToken) } // see if are preceding a ## - if (mac->body.peekUntokenizedPasting()) { + if (mac->body.peekTokenizedPasting(false)) { prepaste = true; pasting = true; } diff --git a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpContext.h b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpContext.h index 3446f1e1c9..582d119f42 100644 --- a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpContext.h @@ -311,7 +311,6 @@ public: int getToken(TParseContextBase&, TPpToken*); bool atEnd() { return currentPos >= stream.size(); } bool peekTokenizedPasting(bool lastTokenPastes); - bool peekUntokenizedPasting(); void reset() { currentPos = 0; } protected: @@ -373,22 +372,6 @@ protected: } if (!inputStack.empty() && inputStack.back()->isStringInput() && !inElseSkip) { if (token == '\n') { - bool seenNumSign = false; - for (int i = 0; i < (int)lastLineTokens.size() - 1;) { - int curPos = i; - int curToken = lastLineTokens[i++]; - if (curToken == '#' && lastLineTokens[i] == '#') { - curToken = PpAtomPaste; - i++; - } - if (curToken == '#') { - if (seenNumSign) { - parseContext.ppError(lastLineTokenLocs[curPos], "(#) can be preceded in its line only by spaces or horizontal tabs", "#", ""); - } else { - seenNumSign = true; - } - } - } lastLineTokens.clear(); lastLineTokenLocs.clear(); } else { @@ -458,6 +441,38 @@ protected: static const int marker = -3; }; + class tStringifyLevelInput : public tInput { + int what; + tStringifyLevelInput(TPpContext* pp) : tInput(pp) { } + public: + static tStringifyLevelInput popMarker(TPpContext* pp) + { + tStringifyLevelInput sl(pp); + sl.what = POP; + return sl; + } + + static tStringifyLevelInput pushMarker(TPpContext* pp) + { + tStringifyLevelInput sl(pp); + sl.what = PUSH; + return sl; + } + + int scan(TPpToken*) override + { + if (done) + return EndOfInput; + done = true; + + return what; + } + virtual int getch() override { assert(0); return EndOfInput; } + virtual void ungetch() override { assert(0); } + static const int PUSH = -4; + static const int POP = -5; + }; + class tZeroInput : public tInput { public: tZeroInput(TPpContext* pp) : tInput(pp) { } diff --git a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index df64b7bd5f..a252295631 100644 --- a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -97,7 +97,6 @@ namespace glslang { /////////////////////////////////// Floating point constants: ///////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// -// // Scan a single- or double-precision floating point constant. // Assumes that the scanner has seen at least one digit, // followed by either a decimal '.' or the letter 'e', or a @@ -1226,7 +1225,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) // int TPpContext::tokenize(TPpToken& ppToken) { - for(;;) { + int stringifyDepth = 0; + TPpToken stringifiedToken; // Tokens are appended to this as they come in + for (;;) { int token = scanToken(&ppToken); // Handle token-pasting logic @@ -1254,6 +1255,20 @@ int TPpContext::tokenize(TPpToken& ppToken) if (token == '\n') continue; + if (token == tStringifyLevelInput::PUSH) { + stringifyDepth++; + continue; + } + if (token == tStringifyLevelInput::POP) { + assert(stringifyDepth > 0); + stringifyDepth--; + if (stringifyDepth == 0) { + snprintf(ppToken.name, sizeof(ppToken.name), "%s", stringifiedToken.name); + return PpAtomConstString; + } + continue; + } + // expand macros if (token == PpAtomIdentifier) { switch (MacroExpand(&ppToken, false, true)) { @@ -1267,7 +1282,21 @@ int TPpContext::tokenize(TPpToken& ppToken) } } + bool needStringSupport = ifdepth == 0 && (token == PpAtomConstString || stringifyDepth > 0); + if (needStringSupport && parseContext.intermediate.getSource() != EShSourceHlsl) { + // HLSL allows string literals. + // GLSL allows string literals with GL_EXT_debug_printf. + const char* const string_literal_EXTs[] = { E_GL_EXT_debug_printf, E_GL_EXT_spirv_intrinsics }; + parseContext.requireExtensions(ppToken.loc, 2, string_literal_EXTs, "string literal"); + if (!parseContext.extensionTurnedOn(E_GL_EXT_debug_printf) && + !parseContext.extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) { + continue; + } + } + switch (token) { + case PpAtomConstString: + break; case PpAtomIdentifier: case PpAtomConstInt: case PpAtomConstUint: @@ -1281,17 +1310,6 @@ int TPpContext::tokenize(TPpToken& ppToken) if (ppToken.name[0] == '\0') continue; break; - case PpAtomConstString: - // HLSL allows string literals. - // GLSL allows string literals with GL_EXT_debug_printf. - if (ifdepth == 0 && parseContext.intermediate.getSource() != EShSourceHlsl) { - const char* const string_literal_EXTs[] = { E_GL_EXT_debug_printf, E_GL_EXT_spirv_intrinsics }; - parseContext.requireExtensions(ppToken.loc, 2, string_literal_EXTs, "string literal"); - if (!parseContext.extensionTurnedOn(E_GL_EXT_debug_printf) && - !parseContext.extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) - continue; - } - break; case '\'': parseContext.ppError(ppToken.loc, "character literals not supported", "\'", ""); continue; @@ -1299,6 +1317,17 @@ int TPpContext::tokenize(TPpToken& ppToken) snprintf(ppToken.name, sizeof(ppToken.name), "%s", atomStrings.getString(token)); break; } + if (stringifyDepth > 0) { + size_t existingLen = strlen(stringifiedToken.name); + char* dst = stringifiedToken.name + existingLen; + // stringify_depth would determine how many layers of \\\"\\\" are needed, if we wanted to. + if (ppToken.space) { + snprintf(dst, sizeof(stringifiedToken.name) - existingLen - 1, " %s", ppToken.name); + } else { + snprintf(dst, sizeof(stringifiedToken.name) - existingLen, "%s", ppToken.name); + } + continue; + } return token; } @@ -1329,6 +1358,7 @@ int TPpContext::tokenPaste(int token, TPpToken& ppToken) // This covers end of macro expansion if (endOfReplacementList()) { + // this should be unreachable, incomplete #/## sequences are caught at macro parsing time. parseContext.ppError(ppToken.loc, "unexpected location; end of replacement list", "##", ""); break; } diff --git a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp index e6ee64cf9e..472df78f16 100644 --- a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -105,7 +105,7 @@ void TPpContext::TokenStream::putToken(int atom, TPpToken* ppToken) } // Read the next token from a macro token stream. -int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken *ppToken) +int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken* ppToken) { if (atEnd()) return EndOfInput; @@ -113,16 +113,6 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken int atom = stream[currentPos++].get(*ppToken); ppToken->loc = parseContext.getCurrentLoc(); - // Check for ##, unless the current # is the last character - if (atom == '#') { - if (peekToken('#')) { - parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)"); - parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, nullptr, "token pasting (##)"); - currentPos++; - atom = PpAtomPaste; - } - } - return atom; } @@ -146,8 +136,10 @@ bool TPpContext::TokenStream::peekTokenizedPasting(bool lastTokenPastes) // 2. last token and we've been told after this there will be a ## - if (! lastTokenPastes) + if (! lastTokenPastes) { + currentPos = savePos; return false; + } // Getting here means the last token will be pasted, after this // Are we at the last non-whitespace token? @@ -167,29 +159,6 @@ bool TPpContext::TokenStream::peekTokenizedPasting(bool lastTokenPastes) return !moreTokens; } -// See if the next non-white-space tokens are two consecutive # -bool TPpContext::TokenStream::peekUntokenizedPasting() -{ - // don't return early, have to restore this - size_t savePos = currentPos; - - // skip white-space - while (peekToken(' ')) - ++currentPos; - - // check for ## - bool pasting = false; - if (peekToken('#')) { - ++currentPos; - if (peekToken('#')) - pasting = true; - } - - currentPos = savePos; - - return pasting; -} - void TPpContext::pushTokenStreamInput(TokenStream& ts, bool prepasting, bool expanded) { pushInput(new tTokenInput(this, &ts, prepasting, expanded)); diff --git a/third_party/glslang/glslang/Public/ShaderLang.h b/third_party/glslang/glslang/Public/ShaderLang.h index 0536cc58f7..07e4ca5c77 100644 --- a/third_party/glslang/glslang/Public/ShaderLang.h +++ b/third_party/glslang/glslang/Public/ShaderLang.h @@ -434,6 +434,9 @@ enum TResourceType { EResUbo, EResSsbo, EResUav, + EResCombinedSampler, + EResAs, + EResTensor, EResCount }; @@ -463,59 +466,60 @@ enum TBlockStorageClass // // N.B.: Destruct a linked program *before* destructing the shaders linked into it. // -class TShader { +class GLSLANG_EXPORT TShader { public: - GLSLANG_EXPORT explicit TShader(EShLanguage); - GLSLANG_EXPORT virtual ~TShader(); - GLSLANG_EXPORT void setStrings(const char* const* s, int n); - GLSLANG_EXPORT void setStringsWithLengths( + explicit TShader(EShLanguage); + virtual ~TShader(); + void setStrings(const char* const* s, int n); + void setStringsWithLengths( const char* const* s, const int* l, int n); - GLSLANG_EXPORT void setStringsWithLengthsAndNames( + void setStringsWithLengthsAndNames( const char* const* s, const int* l, const char* const* names, int n); void setPreamble(const char* s) { preamble = s; } - GLSLANG_EXPORT void setEntryPoint(const char* entryPoint); - GLSLANG_EXPORT void setSourceEntryPoint(const char* sourceEntryPointName); - GLSLANG_EXPORT void addProcesses(const std::vector&); - GLSLANG_EXPORT void setUniqueId(unsigned long long id); - GLSLANG_EXPORT void setOverrideVersion(int version); - GLSLANG_EXPORT void setDebugInfo(bool debugInfo); + void setEntryPoint(const char* entryPoint); + void setSourceEntryPoint(const char* sourceEntryPointName); + void addProcesses(const std::vector&); + void setUniqueId(unsigned long long id); + void setOverrideVersion(int version); + void setDebugInfo(bool debugInfo); // IO resolver binding data: see comments in ShaderLang.cpp - GLSLANG_EXPORT void setShiftBinding(TResourceType res, unsigned int base); - GLSLANG_EXPORT void setShiftSamplerBinding(unsigned int base); // DEPRECATED: use setShiftBinding - GLSLANG_EXPORT void setShiftTextureBinding(unsigned int base); // DEPRECATED: use setShiftBinding - GLSLANG_EXPORT void setShiftImageBinding(unsigned int base); // DEPRECATED: use setShiftBinding - GLSLANG_EXPORT void setShiftUboBinding(unsigned int base); // DEPRECATED: use setShiftBinding - GLSLANG_EXPORT void setShiftUavBinding(unsigned int base); // DEPRECATED: use setShiftBinding - GLSLANG_EXPORT void setShiftCbufferBinding(unsigned int base); // synonym for setShiftUboBinding - GLSLANG_EXPORT void setShiftSsboBinding(unsigned int base); // DEPRECATED: use setShiftBinding - GLSLANG_EXPORT void setShiftBindingForSet(TResourceType res, unsigned int base, unsigned int set); - GLSLANG_EXPORT void setResourceSetBinding(const std::vector& base); - GLSLANG_EXPORT void setAutoMapBindings(bool map); - GLSLANG_EXPORT void setAutoMapLocations(bool map); - GLSLANG_EXPORT void addUniformLocationOverride(const char* name, int loc); - GLSLANG_EXPORT void setUniformLocationBase(int base); - GLSLANG_EXPORT void setInvertY(bool invert); - GLSLANG_EXPORT void setDxPositionW(bool dxPosW); - GLSLANG_EXPORT void setEnhancedMsgs(); + void setShiftBinding(TResourceType res, unsigned int base); + void setShiftSamplerBinding(unsigned int base); // DEPRECATED: use setShiftBinding + void setShiftTextureBinding(unsigned int base); // DEPRECATED: use setShiftBinding + void setShiftImageBinding(unsigned int base); // DEPRECATED: use setShiftBinding + void setShiftUboBinding(unsigned int base); // DEPRECATED: use setShiftBinding + void setShiftUavBinding(unsigned int base); // DEPRECATED: use setShiftBinding + void setShiftCbufferBinding(unsigned int base); // synonym for setShiftUboBinding + void setShiftSsboBinding(unsigned int base); // DEPRECATED: use setShiftBinding + void setShiftBindingForSet(TResourceType res, unsigned int base, unsigned int set); + void setResourceSetBinding(const std::vector& base); + void setAutoMapBindings(bool map); + void setAutoMapLocations(bool map); + void setBindingsPerResourceType(); + void addUniformLocationOverride(const char* name, int loc); + void setUniformLocationBase(int base); + void setInvertY(bool invert); + void setDxPositionW(bool dxPosW); + void setEnhancedMsgs(); #ifdef ENABLE_HLSL - GLSLANG_EXPORT void setHlslIoMapping(bool hlslIoMap); - GLSLANG_EXPORT void setFlattenUniformArrays(bool flatten); + void setHlslIoMapping(bool hlslIoMap); + void setFlattenUniformArrays(bool flatten); #endif - GLSLANG_EXPORT void setNoStorageFormat(bool useUnknownFormat); - GLSLANG_EXPORT void setNanMinMaxClamp(bool nanMinMaxClamp); - GLSLANG_EXPORT void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode); - GLSLANG_EXPORT void addBlockStorageOverride(const char* nameStr, glslang::TBlockStorageClass backing); + void setNoStorageFormat(bool useUnknownFormat); + void setNanMinMaxClamp(bool nanMinMaxClamp); + void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode); + void addBlockStorageOverride(const char* nameStr, glslang::TBlockStorageClass backing); - GLSLANG_EXPORT void setGlobalUniformBlockName(const char* name); - GLSLANG_EXPORT void setAtomicCounterBlockName(const char* name); - GLSLANG_EXPORT void setGlobalUniformSet(unsigned int set); - GLSLANG_EXPORT void setGlobalUniformBinding(unsigned int binding); - GLSLANG_EXPORT void setAtomicCounterBlockSet(unsigned int set); - GLSLANG_EXPORT void setAtomicCounterBlockBinding(unsigned int binding); + void setGlobalUniformBlockName(const char* name); + void setAtomicCounterBlockName(const char* name); + void setGlobalUniformSet(unsigned int set); + void setGlobalUniformBinding(unsigned int binding); + void setAtomicCounterBlockSet(unsigned int set); + void setAtomicCounterBlockBinding(unsigned int binding); - GLSLANG_EXPORT void addSourceText(const char* text, size_t len); - GLSLANG_EXPORT void setSourceFile(const char* file); + void addSourceText(const char* text, size_t len); + void setSourceFile(const char* file); // For setting up the environment (cleared to nothingness in the constructor). // These must be called so that parsing is done for the right source language and @@ -664,7 +668,7 @@ public: virtual void releaseInclude(IncludeResult*) override { } }; - GLSLANG_EXPORT bool parse( + bool parse( const TBuiltInResource*, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, bool forwardCompatible, EShMessages, Includer&); @@ -690,14 +694,14 @@ public: // NOTE: Doing just preprocessing to obtain a correct preprocessed shader string // is not an officially supported or fully working path. - GLSLANG_EXPORT bool preprocess( + bool preprocess( const TBuiltInResource* builtInResources, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, bool forwardCompatible, EShMessages message, std::string* outputString, Includer& includer); - GLSLANG_EXPORT const char* getInfoLog(); - GLSLANG_EXPORT const char* getInfoDebugLog(); + const char* getInfoLog(); + const char* getInfoDebugLog(); EShLanguage getStage() const { return stage; } TIntermediate* getIntermediate() const { return intermediate; } @@ -744,16 +748,16 @@ private: // // Data needed for just a single object at the granularity exchanged by the reflection API -class TObjectReflection { +class GLSLANG_EXPORT TObjectReflection { public: - GLSLANG_EXPORT TObjectReflection(const std::string& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex); + TObjectReflection(const std::string& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex); const TType* getType() const { return type; } - GLSLANG_EXPORT int getBinding() const; - GLSLANG_EXPORT void dump() const; + int getBinding() const; + void dump() const; static TObjectReflection badReflection() { return TObjectReflection(); } - GLSLANG_EXPORT unsigned int layoutLocation() const; + unsigned int layoutLocation() const; std::string name; int offset; @@ -804,8 +808,7 @@ struct TVarEntryInfo; // // NOTE: that still limit checks are applied to bindings and sets // and may result in an error. -class TIoMapResolver -{ +class GLSLANG_EXPORT TIoMapResolver { public: virtual ~TIoMapResolver() {} @@ -877,41 +880,41 @@ GLSLANG_EXPORT TIoMapper* GetGlslIoMapper(); // // N.B.: Destruct a linked program *before* destructing the shaders linked into it. // -class TProgram { +class GLSLANG_EXPORT TProgram { public: - GLSLANG_EXPORT TProgram(); - GLSLANG_EXPORT virtual ~TProgram(); + TProgram(); + virtual ~TProgram(); void addShader(TShader* shader) { stages[shader->stage].push_back(shader); } std::list& getShaders(EShLanguage stage) { return stages[stage]; } // Link Validation interface - GLSLANG_EXPORT bool link(EShMessages); - GLSLANG_EXPORT const char* getInfoLog(); - GLSLANG_EXPORT const char* getInfoDebugLog(); + bool link(EShMessages); + const char* getInfoLog(); + const char* getInfoDebugLog(); TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; } // Reflection Interface // call first, to do liveness analysis, index mapping, etc.; returns false on failure - GLSLANG_EXPORT bool buildReflection(int opts = EShReflectionDefault); - GLSLANG_EXPORT unsigned getLocalSize(int dim) const; // return dim'th local size - GLSLANG_EXPORT unsigned getTileShadingRateQCOM(int dim) const; // return dim'th tile shading rate QCOM - GLSLANG_EXPORT int getReflectionIndex(const char *name) const; - GLSLANG_EXPORT int getReflectionPipeIOIndex(const char* name, const bool inOrOut) const; - GLSLANG_EXPORT int getNumUniformVariables() const; - GLSLANG_EXPORT const TObjectReflection& getUniform(int index) const; - GLSLANG_EXPORT int getNumUniformBlocks() const; - GLSLANG_EXPORT const TObjectReflection& getUniformBlock(int index) const; - GLSLANG_EXPORT int getNumPipeInputs() const; - GLSLANG_EXPORT const TObjectReflection& getPipeInput(int index) const; - GLSLANG_EXPORT int getNumPipeOutputs() const; - GLSLANG_EXPORT const TObjectReflection& getPipeOutput(int index) const; - GLSLANG_EXPORT int getNumBufferVariables() const; - GLSLANG_EXPORT const TObjectReflection& getBufferVariable(int index) const; - GLSLANG_EXPORT int getNumBufferBlocks() const; - GLSLANG_EXPORT const TObjectReflection& getBufferBlock(int index) const; - GLSLANG_EXPORT int getNumAtomicCounters() const; - GLSLANG_EXPORT const TObjectReflection& getAtomicCounter(int index) const; + bool buildReflection(int opts = EShReflectionDefault); + unsigned getLocalSize(int dim) const; // return dim'th local size + unsigned getTileShadingRateQCOM(int dim) const; // return dim'th tile shading rate QCOM + int getReflectionIndex(const char *name) const; + int getReflectionPipeIOIndex(const char* name, const bool inOrOut) const; + int getNumUniformVariables() const; + const TObjectReflection& getUniform(int index) const; + int getNumUniformBlocks() const; + const TObjectReflection& getUniformBlock(int index) const; + int getNumPipeInputs() const; + const TObjectReflection& getPipeInput(int index) const; + int getNumPipeOutputs() const; + const TObjectReflection& getPipeOutput(int index) const; + int getNumBufferVariables() const; + const TObjectReflection& getBufferVariable(int index) const; + int getNumBufferBlocks() const; + const TObjectReflection& getBufferBlock(int index) const; + int getNumAtomicCounters() const; + const TObjectReflection& getAtomicCounter(int index) const; // Legacy Reflection Interface - expressed in terms of above interface @@ -978,19 +981,19 @@ public: // returns a TType* const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); } - GLSLANG_EXPORT void dumpReflection(); + void dumpReflection(); // Get the IO resolver to use for mapIO - GLSLANG_EXPORT TIoMapResolver* getGlslIoResolver(EShLanguage stage); + TIoMapResolver* getGlslIoResolver(EShLanguage stage); // I/O mapping: apply base offsets and map live unbound variables // If resolver is not provided it uses the previous approach // and respects auto assignment and offsets. - GLSLANG_EXPORT bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr); + bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr); protected: - GLSLANG_EXPORT bool linkStage(EShLanguage, EShMessages); - GLSLANG_EXPORT bool crossStageCheck(EShMessages); + bool linkStage(EShLanguage, EShMessages); + bool crossStageCheck(EShMessages); TPoolAllocator* pool; std::list stages[EShLangCount]; diff --git a/third_party/glslang/glslang/Public/resource_limits_c.h b/third_party/glslang/glslang/Public/resource_limits_c.h index 3cf7442f45..4ad052b0ba 100644 --- a/third_party/glslang/glslang/Public/resource_limits_c.h +++ b/third_party/glslang/glslang/Public/resource_limits_c.h @@ -46,7 +46,7 @@ GLSLANG_EXPORT const glslang_resource_t* glslang_default_resource(void); // Returns the DefaultTBuiltInResource as a human-readable string. // NOTE: User is responsible for freeing this string. -GLSLANG_EXPORT const char* glslang_default_resource_string(); +GLSLANG_EXPORT const char* glslang_default_resource_string(void); // Decodes the resource limits from |config| to |resources|. GLSLANG_EXPORT void glslang_decode_resource_limits(glslang_resource_t* resources, char* config); diff --git a/third_party/glslang/glslang/ResourceLimits/ResourceLimits.cpp b/third_party/glslang/glslang/ResourceLimits/ResourceLimits.cpp index 0e9d1b5480..79a1b3a6d7 100644 --- a/third_party/glslang/glslang/ResourceLimits/ResourceLimits.cpp +++ b/third_party/glslang/glslang/ResourceLimits/ResourceLimits.cpp @@ -39,9 +39,9 @@ #include "glslang/Public/ResourceLimits.h" -TBuiltInResource Resources; +static TBuiltInResource Resources; -const TBuiltInResource DefaultTBuiltInResource = { +static const TBuiltInResource DefaultTBuiltInResource = { /* .MaxLights = */ 32, /* .MaxClipPlanes = */ 6, /* .MaxTextureUnits = */ 32, diff --git a/third_party/glslang/glslang/ResourceLimits/resource_limits_c.cpp b/third_party/glslang/glslang/ResourceLimits/resource_limits_c.cpp index 8909d9ef5e..64b5308460 100644 --- a/third_party/glslang/glslang/ResourceLimits/resource_limits_c.cpp +++ b/third_party/glslang/glslang/ResourceLimits/resource_limits_c.cpp @@ -42,7 +42,7 @@ const glslang_resource_t* glslang_default_resource(void) return reinterpret_cast(GetDefaultResources()); } -const char* glslang_default_resource_string() +const char* glslang_default_resource_string(void) { std::string cpp_str = GetDefaultTBuiltInResourceString(); char* c_str = (char*)malloc(cpp_str.length() + 1); diff --git a/third_party/glslang/gtests/AST.FromFile.cpp b/third_party/glslang/gtests/AST.FromFile.cpp index b8abe22bd3..b8a9112bcc 100644 --- a/third_party/glslang/gtests/AST.FromFile.cpp +++ b/third_party/glslang/gtests/AST.FromFile.cpp @@ -184,7 +184,10 @@ INSTANTIATE_TEST_SUITE_P( "aggOps.frag", "always-discard.frag", "always-discard2.frag", + "boolinput.error.frag", + "booloutput.error.vert", "conditionalDiscard.frag", + "conservativeDepth.frag", "conversion.frag", "dataOut.frag", "dataOutIndirect.frag", @@ -213,6 +216,7 @@ INSTANTIATE_TEST_SUITE_P( "runtimeArray.vert", "simpleFunctionCall.frag", "stringToDouble.vert", + "stringInvalidOps.frag", "struct.error.frag", "structAssignment.frag", "structDeref.frag", diff --git a/third_party/glslang/gtests/CMakeLists.txt b/third_party/glslang/gtests/CMakeLists.txt index cf11815a2f..27a5500c9a 100644 --- a/third_party/glslang/gtests/CMakeLists.txt +++ b/third_party/glslang/gtests/CMakeLists.txt @@ -56,14 +56,11 @@ if(GLSLANG_TESTS) ${CMAKE_CURRENT_SOURCE_DIR}/LiveTraverser.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/StructName.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/SpvPatternTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/VkRelaxed.FromFile.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/GlslMapIO.FromFile.cpp) - - if(ENABLE_SPVREMAPPER) - set(TEST_SOURCES ${TEST_SOURCES} - ${CMAKE_CURRENT_SOURCE_DIR}/Remap.FromFile.cpp) - endif() - + ${CMAKE_CURRENT_SOURCE_DIR}/GlslMapIO.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/UboUnsizedArray.cpp) add_executable(glslangtests ${TEST_SOURCES}) glslang_pch(glslangtests ${CMAKE_CURRENT_SOURCE_DIR}/pch.h) @@ -75,7 +72,8 @@ if(GLSLANG_TESTS) # doesn't have to specify the --test-root option in the normal # case that you want to use the tests from the same source tree. target_compile_definitions(glslangtests - PRIVATE GLSLANG_TEST_DIRECTORY="${GLSLANG_TEST_DIRECTORY}") + PRIVATE GLSLANG_TEST_DIRECTORY="${GLSLANG_TEST_DIRECTORY}" + PRIVATE GLSLANG_TEST_BUILD=1) target_include_directories(glslangtests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR} @@ -92,10 +90,6 @@ if(GLSLANG_TESTS) glslang glslang-default-resource-limits $<$,$,9.0>>:stdc++fs>) - if(ENABLE_SPVREMAPPER) - set(LIBRARIES ${LIBRARIES} SPVRemapper) - endif() - target_link_libraries(glslangtests PRIVATE ${LIBRARIES} gmock) # The TARGET_RUNTIME_DLL_DIRS feature requires CMake 3.27 or greater. diff --git a/third_party/glslang/gtests/GlslMapIO.FromFile.cpp b/third_party/glslang/gtests/GlslMapIO.FromFile.cpp index f672988265..7e3f3c4388 100644 --- a/third_party/glslang/gtests/GlslMapIO.FromFile.cpp +++ b/third_party/glslang/gtests/GlslMapIO.FromFile.cpp @@ -346,6 +346,7 @@ INSTANTIATE_TEST_SUITE_P( {{"iomap.blockOutVariableIn.2.vert", "iomap.blockOutVariableIn.geom"}, Semantics::OpenGL}, {{"iomap.variableOutBlockIn.2.vert", "iomap.variableOutBlockIn.geom"}, Semantics::OpenGL}, {{"iomap.mismatchedBufferTypes.vert", "iomap.mismatchedBufferTypes.frag"}, Semantics::OpenGL}, + {{"iomap.bindingPerResourceType.vert", "iomap.bindingPerResourceType.frag"}, Semantics::OpenGL}, // vulkan semantics {{"iomap.crossStage.vk.vert", "iomap.crossStage.vk.geom", "iomap.crossStage.vk.frag" }, Semantics::Vulkan}, })) diff --git a/third_party/glslang/gtests/Link.FromFile.Vk.cpp b/third_party/glslang/gtests/Link.FromFile.Vk.cpp index 61dc7be535..13b959e76e 100644 --- a/third_party/glslang/gtests/Link.FromFile.Vk.cpp +++ b/third_party/glslang/gtests/Link.FromFile.Vk.cpp @@ -121,6 +121,8 @@ INSTANTIATE_TEST_SUITE_P( {"link.vk.pcNamingInvalid.0.0.vert", "link.vk.pcNamingInvalid.0.1.vert"}, {"link.vk.multiBlocksValid.0.0.vert", "link.vk.multiBlocksValid.0.1.vert"}, {"link.vk.multiBlocksValid.1.0.geom", "link.vk.multiBlocksValid.1.1.geom"}, + {"link.vk.multiUnitLayout.0.comp", "link.vk.multiUnitLayout.1.comp"}, + {"link.vk.multiUnitLayout.2.comp", "link.vk.multiUnitLayout.0.comp"}, {"link.vk.inconsistentGLPerVertex.0.vert", "link.vk.inconsistentGLPerVertex.0.geom"}, {"link.vk.crossStageIO.0.vert", "link.vk.crossStageIO.0.frag"}, {"link.vk.crossStageIO.1.vert", "link.vk.crossStageIO.1.geom", "link.vk.crossStageIO.1.frag"}, diff --git a/third_party/glslang/gtests/Link.FromFile.cpp b/third_party/glslang/gtests/Link.FromFile.cpp index 9c34b545a8..6fd4604c77 100644 --- a/third_party/glslang/gtests/Link.FromFile.cpp +++ b/third_party/glslang/gtests/Link.FromFile.cpp @@ -111,6 +111,14 @@ INSTANTIATE_TEST_SUITE_P( {"link.multiAnonBlocksValid.0.0.vert", "link.multiAnonBlocksValid.0.1.vert"}, {"link.multiBlocksInvalid.0.0.vert", "link.multiBlocksInvalid.0.1.vert"}, {"link.multiBlocksValid.1.0.vert", "link.multiBlocksValid.1.1.vert"}, + {"link.multiUnitLayout.0.vert", "link.multiUnitLayout.1.vert"}, + {"link.multiUnitLayout.0.frag", "link.multiUnitLayout.1.frag"}, + {"link.multiUnitLayout.0.tese", "link.multiUnitLayout.1.tese"}, + {"link.multiUnitLayout.0.mesh", "link.multiUnitLayout.1.mesh"}, + {"link.multiUnitLayout.2.vert", "link.multiUnitLayout.0.vert"}, + {"link.multiUnitLayout.2.frag", "link.multiUnitLayout.0.frag"}, + {"link.multiUnitLayout.2.tese", "link.multiUnitLayout.0.tese"}, + {"link.multiUnitLayout.2.mesh", "link.multiUnitLayout.0.mesh"}, {"link.tesselation.vert", "link.tesselation.frag"}, {"link.tesselation.tese", "link.tesselation.tesc"}, {"link.redeclareBuiltin.vert", "link.redeclareBuiltin.geom"}, diff --git a/third_party/glslang/gtests/Pp.FromFile.cpp b/third_party/glslang/gtests/Pp.FromFile.cpp index 9cadd226ee..e190415996 100644 --- a/third_party/glslang/gtests/Pp.FromFile.cpp +++ b/third_party/glslang/gtests/Pp.FromFile.cpp @@ -69,7 +69,9 @@ INSTANTIATE_TEST_SUITE_P( "preprocessor.eof_missing.vert", "preprocess.arb_shading_language_include.vert", "preprocess.include_directive_missing_extension.vert", - "preprocess.inactive_stringify.vert" + "preprocess.inactive_stringify.vert", + "preprocessor.paste_stringify.vert", + "preprocessor.stringify_invalid.vert", })), FileNameAsCustomTestSuffix ); diff --git a/third_party/glslang/gtests/Remap.FromFile.cpp b/third_party/glslang/gtests/Remap.FromFile.cpp deleted file mode 100644 index f01425362e..0000000000 --- a/third_party/glslang/gtests/Remap.FromFile.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// -// Copyright (C) 2016 LunarG, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#include - -#include "TestFixture.h" - -namespace glslangtest { -namespace { - -struct RemapTestArgs { - const char* fileName; - const char* entryPoint; - Source sourceLanguage; - unsigned int remapOpts; -}; - -// We are using FileNameEntryPointPair objects as parameters for instantiating -// the template, so the global FileNameAsCustomTestSuffix() won't work since -// it assumes std::string as parameters. Thus, an overriding one here. -std::string FileNameAsCustomTestSuffix( - const ::testing::TestParamInfo& info) { - std::string name = info.param.fileName; - // A valid test case suffix cannot have '.' and '-' inside. - std::replace(name.begin(), name.end(), '.', '_'); - std::replace(name.begin(), name.end(), '-', '_'); - return name; -} - -using RemapTest = GlslangTest<::testing::TestWithParam>; - -// Remapping SPIR-V modules. -TEST_P(RemapTest, FromFile) -{ - if (GetSuffix(GetParam().fileName) == "spv") { - loadFileRemapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName, - GetParam().sourceLanguage, - Semantics::Vulkan, - Target::Spv, - GetParam().remapOpts); - } else { - loadFileCompileRemapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName, - GetParam().sourceLanguage, - Semantics::Vulkan, - Target::Spv, - GetParam().entryPoint, - GetParam().remapOpts); - } -} - -// clang-format off -INSTANTIATE_TEST_SUITE_P( - ToSpirv, RemapTest, - ::testing::ValuesIn(std::vector{ - // GLSL remapper tests - // testname entry language remapper_options - { "remap.basic.none.frag", "main", Source::GLSL, spv::spirvbin_t::NONE }, - { "remap.basic.everything.frag", "main", Source::GLSL, spv::spirvbin_t::DO_EVERYTHING }, - { "remap.basic.dcefunc.frag", "main", Source::GLSL, spv::spirvbin_t::DCE_FUNCS }, - { "remap.basic.strip.frag", "main", Source::GLSL, spv::spirvbin_t::STRIP }, - { "remap.specconst.comp", "main", Source::GLSL, spv::spirvbin_t::DO_EVERYTHING }, - { "remap.switch.none.frag", "main", Source::GLSL, spv::spirvbin_t::NONE }, - { "remap.switch.everything.frag", "main", Source::GLSL, spv::spirvbin_t::DO_EVERYTHING }, - { "remap.literal64.none.spv", "main", Source::GLSL, spv::spirvbin_t::NONE }, - { "remap.literal64.everything.spv", "main", Source::GLSL, spv::spirvbin_t::DO_EVERYTHING }, - { "remap.if.none.frag", "main", Source::GLSL, spv::spirvbin_t::NONE }, - { "remap.if.everything.frag", "main", Source::GLSL, spv::spirvbin_t::DO_EVERYTHING }, - { "remap.similar_1a.none.frag", "main", Source::GLSL, spv::spirvbin_t::NONE }, - { "remap.similar_1b.none.frag", "main", Source::GLSL, spv::spirvbin_t::NONE }, - { "remap.similar_1a.everything.frag", "main", Source::GLSL, spv::spirvbin_t::DO_EVERYTHING }, - { "remap.similar_1b.everything.frag", "main", Source::GLSL, spv::spirvbin_t::DO_EVERYTHING }, - { "remap.uniformarray.none.frag", "main", Source::GLSL, spv::spirvbin_t::NONE }, - { "remap.uniformarray.everything.frag", "main", Source::GLSL, spv::spirvbin_t::DO_EVERYTHING }, - - // HLSL remapper tests - { "remap.hlsl.sample.basic.strip.frag", "main", Source::HLSL, spv::spirvbin_t::STRIP }, - { "remap.hlsl.sample.basic.everything.frag", "main", Source::HLSL, spv::spirvbin_t::DO_EVERYTHING }, - { "remap.hlsl.sample.basic.none.frag", "main", Source::HLSL, spv::spirvbin_t::NONE }, - { "remap.hlsl.templatetypes.none.frag", "main", Source::HLSL, spv::spirvbin_t::NONE }, - { "remap.hlsl.templatetypes.everything.frag", "main", Source::HLSL, spv::spirvbin_t::DO_EVERYTHING }, - }), - FileNameAsCustomTestSuffix -); -// clang-format on - -} // anonymous namespace -} // namespace glslangtest diff --git a/third_party/glslang/gtests/Spv.FromFile.cpp b/third_party/glslang/gtests/Spv.FromFile.cpp index f19487e16e..13b09b4321 100644 --- a/third_party/glslang/gtests/Spv.FromFile.cpp +++ b/third_party/glslang/gtests/Spv.FromFile.cpp @@ -77,6 +77,8 @@ using VulkanAstSemantics = GlslangTest<::testing::TestWithParam>; using HlslIoMap = GlslangTest<::testing::TestWithParam>; using GlslIoMap = GlslangTest<::testing::TestWithParam>; using CompileVulkanToSpirvTestQCOM = GlslangTest<::testing::TestWithParam>; +using CompileVulkanToSpirv13TestQCOM = GlslangTest<::testing::TestWithParam>; +using CompileVulkanToSpirv14TestQCOM = GlslangTest<::testing::TestWithParam>; using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam>; using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam>; using CompileVulkanToSpirv14TestNV = GlslangTest<::testing::TestWithParam>; @@ -84,6 +86,7 @@ using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::t using GlslSpirvDebugInfoTest = GlslangTest<::testing::TestWithParam>; using GlslNonSemanticShaderDebugInfoTest = GlslangTest<::testing::TestWithParam>; using GlslNonSemanticShaderDebugInfoSpirv13Test = GlslangTest<::testing::TestWithParam>; +using GlslNonSemanticShaderDebugInfoVulkanLatestTest = GlslangTest<::testing::TestWithParam>; // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully // generate SPIR-V. @@ -214,6 +217,20 @@ TEST_P(CompileVulkanToSpirvTestQCOM, FromFile) Target::Spv); } +TEST_P(CompileVulkanToSpirv13TestQCOM, FromFile) +{ + loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3, + Target::Spv); +} + +TEST_P(CompileVulkanToSpirv14TestQCOM, FromFile) +{ + loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4, + Target::Spv); +} + // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled). // Expected to successfully generate SPIR-V. TEST_P(CompileVulkanToSpirvTestAMD, FromFile) @@ -269,6 +286,13 @@ TEST_P(GlslNonSemanticShaderDebugInfoSpirv13Test, FromFile) "/baseResults/", false, true, true); } +TEST_P(GlslNonSemanticShaderDebugInfoVulkanLatestTest, FromFile) +{ + loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), Source::GLSL, Semantics::Vulkan, + glslang::EShTargetVulkan_1_4, glslang::EShTargetSpv_1_6, Target::Spv, true, "", + "/baseResults/", false, true, true); +} + // clang-format off INSTANTIATE_TEST_SUITE_P( Glsl, CompileVulkanToSpirvTest, @@ -363,6 +387,13 @@ INSTANTIATE_TEST_SUITE_P( "spv.bufferhandle7.frag", "spv.bufferhandle8.frag", "spv.bufferhandle9.frag", + "spv.bufferhandle20.frag", + "spv.bufferhandle21.frag", + "spv.bufferhandle22.frag", + "spv.bufferhandle23.frag", + "spv.bufferhandle24.frag", + "spv.bufferhandle25.frag", + "spv.bufferhandleRuntimeArray.frag", "spv.bufferhandleUvec2.frag", "spv.bufferhandle_Error.frag", "spv.builtInXFB.vert", @@ -673,14 +704,40 @@ INSTANTIATE_TEST_SUITE_P( "spv.coopmatKHR_Error.comp", "spv.coopmatKHR_constructor.comp", "spv.coopmatKHR_constructorError.comp", + "spv.coopmatKHR_matmuladd_Error.comp", "spv.coopvec.comp", "spv.coopvec2.comp", "spv.coopvecloadstore.comp", "spv.coopvec_Error.comp", + "spv.coopvecloadstore_Error.comp", + "spv.coopvecStoreLocal.comp", "spv.coopvecTraining.comp", "spv.coopvecTraining_Error.comp", "spv.intcoopmat.comp", "spv.intrinsicsInteractWithCoopMat.comp", + "spv.longVector.comp", + "spv.longVectorMatMul.comp", + "spv.longVectorNotReserved.comp", + "spv.longVectorSpecConst.comp", + "spv.longVectorOperators.comp", + "spv.longVectorBuiltins.comp", + "spv.longVectorBuiltinsfp16.comp", + "spv.longVectorBuiltinsfp64.comp", + "spv.longVectorBuiltinsint8.comp", + "spv.longVectorBuiltinsint16.comp", + "spv.longVectorBuiltinsint32.comp", + "spv.longVectorBuiltinsint64.comp", + "spv.longVectorBuiltinsuint8.comp", + "spv.longVectorBuiltinsuint16.comp", + "spv.longVectorBuiltinsuint32.comp", + "spv.longVectorBuiltinsuint64.comp", + "spv.longVectorBuiltinsBitcast.comp", + "spv.longVectorBuiltinsError.comp", + "spv.longVectorBuiltinsSpecConst.comp", + "spv.longVectorBuiltinsSpecConstint32.comp", + "spv.longVectorBuiltinsSubgroup.comp", + "spv.longVectorBuiltins.frag", + "spv.longVectorStorage.comp", "spv.replicate.comp", "spv.replicatespec.comp", "spv.atomicAdd.bufferReference.comp", @@ -763,6 +820,12 @@ INSTANTIATE_TEST_SUITE_P( "spv.nv.hitobject-allops.rchit", "spv.nv.hitobject-allops.rmiss", + // SPV_EXT_shader_execution_reorder + + "spv.ext.hitobject-errors.rgen", + "spv.ext.hitobject-allops.rgen", + "spv.ext.hitobject-allops.rchit", + "spv.ext.hitobject-allops.rmiss", // SPV_NV_displacment_micromap @@ -788,6 +851,18 @@ INSTANTIATE_TEST_SUITE_P( "spv.nv.lss-spheregeomcap.rgen", "spv.nv.lss-lssgeomcap.rgen", + // SPV_EXT_descriptor_heap + + "spv.descriptorHeap.AtomicImage.comp", + "spv.descriptorHeap.AtomicImage.error.comp", + "spv.descriptorHeap.Buffer.comp", + "spv.descriptorHeap.DebugPrintf.comp", + "spv.descriptorHeap.HeapNotArray.error.comp", + "spv.descriptorHeap.HeapStrideNotHeap.error.comp", + "spv.descriptorHeap.HeapStrideNotPow2.error.comp", + "spv.descriptorHeap.PushConstant.comp", + "spv.descriptorHeap.valid.frag", + })), FileNameAsCustomTestSuffix ); @@ -803,6 +878,8 @@ INSTANTIATE_TEST_SUITE_P( "spv.1.6.samplerBuffer.frag", "spv.1.6.separate.frag", "spv.1.6.quad.frag", + "spv.64bit_indexing.comp", + "spv.64bit_indexing_error.comp", "spv.coopmat2_constructor.comp", "spv.coopmat2_error.comp", "spv.coopmat2_tensor.comp", @@ -814,6 +891,7 @@ INSTANTIATE_TEST_SUITE_P( "spv.floate5m2.comp", "spv.floate5m2.const.comp", "spv.floate5m2_error.comp", + "spv.promote_uint32_indices.comp", })), FileNameAsCustomTestSuffix ); @@ -910,15 +988,6 @@ INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P( Glsl, CompileVulkanToSpirvTestQCOM, ::testing::ValuesIn(std::vector({ - "spv.tpipSampleWeighted.frag", - "spv.tpipBoxFilter.frag", - "spv.tpipBlockMatchSSD.frag", - "spv.tpipBlockMatchSAD.frag", - "spv.tpipTextureArrays.frag", - "spv.tpipBlockMatchGatherSAD.frag", - "spv.tpipBlockMatchGatherSSD.frag", - "spv.tpipBlockMatchWindowSAD.frag", - "spv.tpipBlockMatchWindowSSD.frag", "spv.qcom.tileShading.0.comp", "spv.qcom.tileShading.1.comp", "spv.qcom.es.tileShading.0.comp", @@ -932,6 +1001,31 @@ INSTANTIATE_TEST_SUITE_P( FileNameAsCustomTestSuffix ); +INSTANTIATE_TEST_SUITE_P( + Glsl, CompileVulkanToSpirv13TestQCOM, + ::testing::ValuesIn(std::vector({ + "spv.qcom.coopmatConversion.1.comp", + "spv.qcom.coopmatConversion.2.comp", + })), + FileNameAsCustomTestSuffix +); + +INSTANTIATE_TEST_SUITE_P( + Glsl, CompileVulkanToSpirv14TestQCOM, + ::testing::ValuesIn(std::vector({ + "spv.tpipSampleWeighted.frag", + "spv.tpipBoxFilter.frag", + "spv.tpipBlockMatchSSD.frag", + "spv.tpipBlockMatchSAD.frag", + "spv.tpipTextureArrays.frag", + "spv.tpipBlockMatchGatherSAD.frag", + "spv.tpipBlockMatchGatherSSD.frag", + "spv.tpipBlockMatchWindowSAD.frag", + "spv.tpipBlockMatchWindowSSD.frag", +})), +FileNameAsCustomTestSuffix +); + INSTANTIATE_TEST_SUITE_P( Glsl, CompileVulkanToSpirvTestAMD, ::testing::ValuesIn(std::vector({ @@ -995,7 +1089,8 @@ INSTANTIATE_TEST_SUITE_P( "spv.meshShaderRedeclPerViewBuiltins.mesh", "spv.meshTaskShader.task", "spv.perprimitiveNV.frag", - "spv.nvgpushader5.frag" + "spv.nvgpushader5.frag", + "spv.pushConstantBank.vert", })), FileNameAsCustomTestSuffix ); @@ -1040,12 +1135,16 @@ INSTANTIATE_TEST_SUITE_P( "spv.debuginfo.bufferref.glsl.frag", "spv.debuginfo.const_params.glsl.comp", "spv.debuginfo.scalar_types.glsl.frag", - "spv.debuginfo.rt_types.glsl.rgen", "spv.debuginfo.include.glsl.frag", "spv.debuginfo.multiline.glsl.frag", "spv.debuginfo.implicit_br.glsl.frag", "spv.debuginfo.non_ascii.glsl.frag", "spv.debuginfo.continued.glsl.vert", + "spv.debuginfo.interface_bool.glsl.comp", + "spv.debuginfo.sampler_type.glsl.frag", + "spv.debuginfo.const_variables.glsl.frag", + "spv.debuginfo.ubo.glsl.frag", + "spv.debuginfo.declaration.glsl.frag", })), FileNameAsCustomTestSuffix ); @@ -1057,6 +1156,16 @@ INSTANTIATE_TEST_SUITE_P( })), FileNameAsCustomTestSuffix ); + +INSTANTIATE_TEST_SUITE_P( + Glsl, GlslNonSemanticShaderDebugInfoVulkanLatestTest, + ::testing::ValuesIn(std::vector({ + "spv.debuginfo.rt_types.glsl.rgen", + "spv.debuginfo.rt_nv_builtins.glsl.rahit", + "spv.debuginfo.rt_ext_builtins.glsl.rahit", + })), + FileNameAsCustomTestSuffix +); // clang-format on } // anonymous namespace diff --git a/third_party/glslang/gtests/SpvPatternTest.cpp b/third_party/glslang/gtests/SpvPatternTest.cpp new file mode 100644 index 0000000000..7b0c05e0f3 --- /dev/null +++ b/third_party/glslang/gtests/SpvPatternTest.cpp @@ -0,0 +1,210 @@ +// Copyright (C) 2025 NVIDIA Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#include "TestFixture.h" +#include "glslang/Public/ResourceLimits.h" +#include +#include +#include +#include + +namespace glslangtest { + +class SpvPatternTest : public ::testing::Test { +protected: + void SetUp() override + { + // Set up any common test state. + } + + void TearDown() override + { + // Clean up any common test state. + } + + // Helper function to compile shader and get SPIR-V disassembly. + std::string compileShaderToSpirv(const std::string& shaderSource, EShLanguage stage) + { + glslang::TShader shader(stage); + glslang::TProgram program; + + // Compile the shader + const char* shaderStrings = shaderSource.c_str(); + shader.setStrings(&shaderStrings, 1); + + if (!shader.parse(GetDefaultResources(), 450, false, EShMsgDefault)) { + return "COMPILATION_FAILED: " + std::string(shader.getInfoLog()); + } + + program.addShader(&shader); + if (!program.link(EShMsgDefault)) { + return "LINKING_FAILED: " + std::string(program.getInfoLog()); + } + + // Generate SPIR-V. + std::vector spirv; + glslang::GlslangToSpv(*program.getIntermediate(stage), spirv); + + // Disassemble SPIR-V to text. + std::ostringstream disassembly_stream; + spv::Disassemble(disassembly_stream, spirv); + + return disassembly_stream.str(); + } + + // Helper function to check if the given SPIR-V string contains a specific pattern. + bool containsPattern(const std::string& spirvText, const std::string& pattern) + { + return spirvText.find(pattern) != std::string::npos; + } + + // Helper function to check if the given SPIR-V string contains a UConvert instruction. + bool containsUConvert(const std::string& spirvText) { return containsPattern(spirvText, "UConvert"); } +}; + +// Test 1: Indexing an array with a regular int or uint should not generate a zero extension. +TEST_F(SpvPatternTest, RegularIntUintArrayIndexNoConversion) +{ + const std::string shaderSource = R"( + #version 450 core + + layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + + void main() { + uint u = 150u; + int i = 100; + float arr[200]; + float x = arr[u]; // Regular uint index + float y = arr[i]; // Regular int index + } + )"; + + std::string spirv = compileShaderToSpirv(shaderSource, EShLangCompute); + + // Check that the SPIR-V does NOT contain conversion instructions for regular int/uint indices. + EXPECT_FALSE(containsUConvert(spirv)) + << "SPIR-V should not contain OpUConvert instruction for regular int/uint array indexing.\n" + << "Generated SPIR-V:\n" + << spirv; +} + +// Test 2: Indexing an array with a variable index of type uint8_t should generate a zero extension. +TEST_F(SpvPatternTest, Uint8VariableIndexGeneratesUConvert) +{ + const std::string shaderSource = R"( + #version 450 core + #extension GL_EXT_shader_explicit_arithmetic_types : enable + + layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + + void main() { + uint8_t u8 = uint8_t(150); + float arr[200]; + float x = arr[u8]; // Variable uint8_t index + } + )"; + + std::string spirv = compileShaderToSpirv(shaderSource, EShLangCompute); + + // Check that the SPIR-V contains OpUConvert instruction for variable uint8_t index. + EXPECT_TRUE(containsUConvert(spirv)) + << "SPIR-V should contain OpUConvert instruction for variable uint8_t array indexing.\n" + << "Generated SPIR-V:\n" + << spirv; +} + +// Test 2: Indexing an array with a variable index of type uint16_t should generate a zero extension. +TEST_F(SpvPatternTest, Uint16VariableIndexGeneratesUConvert) +{ + const std::string shaderSource = R"( + #version 450 core + #extension GL_EXT_shader_explicit_arithmetic_types : enable + + layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + + void main() { + uint16_t u16 = uint16_t(150); + float arr[200]; + float x = arr[u16]; // Variable uint16_t index + } + )"; + + std::string spirv = compileShaderToSpirv(shaderSource, EShLangCompute); + + // Check that the SPIR-V contains OpUConvert instruction for variable uint16_t index. + EXPECT_TRUE(containsUConvert(spirv)) + << "SPIR-V should contain OpUConvert instruction for variable uint16_t array indexing.\n" + << "Generated SPIR-V:\n" + << spirv; +} + +// Test 3: Indexing an array with a constant index of type uint8_t should NOT generate a zero extension. +// Glslang generates small constants as regular 32-bit integers. +TEST_F(SpvPatternTest, Uint8ConstantIndexNoConversion) +{ + const std::string shaderSource = R"( + #version 450 core + #extension GL_EXT_shader_explicit_arithmetic_types : enable + + layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + + void main() { + float arr[200]; + float x = arr[uint8_t(150)]; // Constant uint8_t index + } + )"; + + std::string spirv = compileShaderToSpirv(shaderSource, EShLangCompute); + + // Check that the SPIR-V does NOT contain OpUConvert instruction for constant uint8_t index. + // Glslang generates small constants as regular 32-bit integers, so no conversion is needed. + EXPECT_FALSE(containsUConvert(spirv)) + << "SPIR-V should not contain OpUConvert instruction for constant uint8_t array indexing.\n" + << "Generated SPIR-V:\n" + << spirv; +} + +// Test 3: Indexing an array with a constant index of type uint16_t should NOT generate a zero extension. +// (Glslang generates small constants as regular 32-bit integers.) +TEST_F(SpvPatternTest, Uint16ConstantIndexNoConversion) +{ + const std::string shaderSource = R"( + #version 450 core + #extension GL_EXT_shader_explicit_arithmetic_types : enable + + layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + + void main() { + float arr[200]; + float x = arr[uint16_t(150)]; // Constant uint16_t index + } + )"; + + std::string spirv = compileShaderToSpirv(shaderSource, EShLangCompute); + + // Check that the SPIR-V does NOT contain OpUConvert instruction for constant uint16_t index. + // Glslang generates small constants as regular 32-bit integers, so no conversion is needed. + EXPECT_FALSE(containsUConvert(spirv)) + << "SPIR-V should not contain OpUConvert instruction for constant uint16_t array indexing.\n" + << "Generated SPIR-V:\n" + << spirv; +} + +} // namespace glslangtest \ No newline at end of file diff --git a/third_party/glslang/gtests/StructName.cpp b/third_party/glslang/gtests/StructName.cpp new file mode 100644 index 0000000000..0536ed4585 --- /dev/null +++ b/third_party/glslang/gtests/StructName.cpp @@ -0,0 +1,129 @@ +// Copyright (C) 2025 NVIDIA Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#include + +#include "TestFixture.h" + +namespace glslangtest { +namespace { + +using StructNameTest = GlslangTest<::testing::Test>; + +// Test the original bug report case from issue #3931. +TEST_F(StructNameTest, StructNameAsStructMember) +{ + const std::string inputFname = GlobalTestSettings.testRoot + "/struct_name_as_struct_member.frag"; + std::string input; + tryLoadFile(inputFname, "input", &input); + + EShMessages controls = DeriveOptions(Source::GLSL, Semantics::OpenGL, Target::AST); + GlslangResult result = compileAndLink("struct_name_as_struct_member.frag", input, "", controls, + glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0); + + // Should NOT have the original syntax error that was reported in the GitHub issue. + EXPECT_EQ(result.linkingError.find("syntax error, unexpected TYPE_NAME, expecting IDENTIFIER"), std::string::npos); + + // Should compile successfully. + EXPECT_EQ(result.shaderResults[0].output.find("compilation errors"), std::string::npos); +} + +// Test struct parameter after non-struct parameter (minimal regression test). +TEST_F(StructNameTest, StructParameterAfterNonStruct) +{ + const std::string inputFname = GlobalTestSettings.testRoot + "/struct_parameter_after_non_struct.frag"; + std::string input; + tryLoadFile(inputFname, "input", &input); + + EShMessages controls = DeriveOptions(Source::GLSL, Semantics::OpenGL, Target::AST); + GlslangResult result = compileAndLink("struct_parameter_after_non_struct.frag", input, "", controls, + glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0); + + // Should NOT have syntax errors related to struct types in function parameters. + EXPECT_EQ(result.linkingError.find("syntax error, unexpected IDENTIFIER"), std::string::npos); + EXPECT_EQ(result.shaderResults[0].output.find("syntax error, unexpected IDENTIFIER"), std::string::npos); + + // Should compile successfully. + EXPECT_EQ(result.shaderResults[0].output.find("compilation errors"), std::string::npos); +} + +// Test struct names as member names in declarator lists (original issue #3931) - More comprehensive patterns. +TEST_F(StructNameTest, StructMemberDeclaratorLists) +{ + const std::string inputFname = GlobalTestSettings.testRoot + "/struct_member_declarator_lists.frag"; + std::string input; + tryLoadFile(inputFname, "input", &input); + + EShMessages controls = DeriveOptions(Source::GLSL, Semantics::OpenGL, Target::AST); + GlslangResult result = compileAndLink("struct_member_declarator_lists.frag", input, "", controls, + glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0); + + // Should NOT have the original syntax error from issue #3931. + EXPECT_EQ(result.linkingError.find("syntax error, unexpected TYPE_NAME, expecting IDENTIFIER"), std::string::npos); + EXPECT_EQ(result.shaderResults[0].output.find("syntax error, unexpected TYPE_NAME, expecting IDENTIFIER"), std::string::npos); + + // Should compile successfully. + EXPECT_EQ(result.shaderResults[0].output.find("compilation errors"), std::string::npos); +} + +// Test function parameters with struct types (regression test for issue #4001). +TEST_F(StructNameTest, StructFunctionParameters) +{ + const std::string inputFname = GlobalTestSettings.testRoot + "/struct_function_parameters.frag"; + std::string input; + tryLoadFile(inputFname, "input", &input); + + EShMessages controls = DeriveOptions(Source::GLSL, Semantics::OpenGL, Target::AST); + GlslangResult result = compileAndLink("struct_function_parameters.frag", input, "", controls, + glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0); + + // Should NOT have syntax errors related to struct types in function parameters. + EXPECT_EQ(result.linkingError.find("syntax error, unexpected IDENTIFIER"), std::string::npos); + EXPECT_EQ(result.shaderResults[0].output.find("syntax error, unexpected IDENTIFIER"), std::string::npos); + + // Should compile successfully. + EXPECT_EQ(result.shaderResults[0].output.find("compilation errors"), std::string::npos); +} + +// Test struct construction patterns - comprehensive patterns including struct constructors. +TEST_F(StructNameTest, StructConstructionPatterns) +{ + const std::string inputFname = GlobalTestSettings.testRoot + "/struct_construction_patterns.frag"; + std::string input; + tryLoadFile(inputFname, "input", &input); + + EShMessages controls = DeriveOptions(Source::GLSL, Semantics::OpenGL, Target::AST); + GlslangResult result = compileAndLink("struct_construction_patterns.frag", input, "", controls, + glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0); + + // Should NOT have syntax errors in struct construction patterns. + EXPECT_EQ(result.linkingError.find("syntax error, unexpected IDENTIFIER"), std::string::npos); + EXPECT_EQ(result.shaderResults[0].output.find("syntax error, unexpected IDENTIFIER"), std::string::npos); + + // Should NOT have the original syntax error from issue #3931. + EXPECT_EQ(result.linkingError.find("syntax error, unexpected TYPE_NAME, expecting IDENTIFIER"), std::string::npos); + EXPECT_EQ(result.shaderResults[0].output.find("syntax error, unexpected TYPE_NAME, expecting IDENTIFIER"), std::string::npos); + + // Should compile successfully. + EXPECT_EQ(result.shaderResults[0].output.find("compilation errors"), std::string::npos); +} + +} // anonymous namespace +} // namespace glslangtest \ No newline at end of file diff --git a/third_party/glslang/gtests/TestFixture.h b/third_party/glslang/gtests/TestFixture.h index 68bb3c6a85..6fa25b88f1 100644 --- a/third_party/glslang/gtests/TestFixture.h +++ b/third_party/glslang/gtests/TestFixture.h @@ -48,7 +48,6 @@ #include "SPIRV/GlslangToSpv.h" #include "SPIRV/disassemble.h" #include "SPIRV/doc.h" -#include "SPIRV/SPVRemapper.h" #include "glslang/Include/Types.h" #include "glslang/Public/ResourceLimits.h" #include "glslang/Public/ShaderLang.h" @@ -378,7 +377,7 @@ public: glslang::TProgram program; program.addShader(&shader); - + success &= program.link(controls); if (success) program.mapIO(); @@ -402,72 +401,6 @@ public: } } - // This is like compileAndLink but with remapping of the SPV binary - // through spirvbin_t::remap(). While technically this could be merged - // with compileAndLink() above (with the remap step optionally being a no-op) - // it is given separately here for ease of future extraction. - GlslangResult compileLinkRemap( - const std::string shaderName, const std::string& code, - const std::string& entryPointName, EShMessages controls, - const unsigned int remapOptions = spv::spirvbin_t::NONE) - { - const EShLanguage stage = GetShaderStage(GetSuffix(shaderName)); - - glslang::TShader shader(stage); - shader.setAutoMapBindings(true); - shader.setAutoMapLocations(true); - - bool success = compile(&shader, code, entryPointName, controls); - - glslang::TProgram program; - program.addShader(&shader); - success &= program.link(controls); - if (success) - program.mapIO(); - - if (success && (controls & EShMsgSpvRules)) { - spv::SpvBuildLogger logger; - std::vector whiteListStrings; - std::vector spirv_binary; - glslang::GlslangToSpv(*program.getIntermediate(stage), - spirv_binary, &logger, &options()); - - spv::spirvbin_t(0 /*verbosity*/).remap(spirv_binary, whiteListStrings, remapOptions); - - std::ostringstream disassembly_stream; - spv::Disassemble(disassembly_stream, spirv_binary); - bool validation_result = !options().validate || logger.getAllMessages().empty(); - return {{{shaderName, shader.getInfoLog(), shader.getInfoDebugLog()},}, - program.getInfoLog(), program.getInfoDebugLog(), - validation_result, logger.getAllMessages(), disassembly_stream.str()}; - } else { - return {{{shaderName, shader.getInfoLog(), shader.getInfoDebugLog()},}, - program.getInfoLog(), program.getInfoDebugLog(), true, "", ""}; - } - } - - // remap the binary in 'code' with the options in remapOptions - GlslangResult remap( - const std::string shaderName, const std::vector& code, - EShMessages controls, - const unsigned int remapOptions = spv::spirvbin_t::NONE) - { - if ((controls & EShMsgSpvRules)) { - std::vector spirv_binary(code); // scratch copy - std::vector whiteListStrings; - spv::spirvbin_t(0 /*verbosity*/).remap(spirv_binary, whiteListStrings, remapOptions); - - std::ostringstream disassembly_stream; - spv::Disassemble(disassembly_stream, spirv_binary); - - return {{{shaderName, "", ""},}, - "", "", - true, "", disassembly_stream.str()}; - } else { - return {{{shaderName, "", ""},}, "", "", true, "", ""}; - } - } - void outputResultToStream(std::ostringstream* stream, const GlslangResult& result, EShMessages controls) @@ -554,7 +487,7 @@ public: EShMessages controls = DeriveOptions(source, semantics, target); controls = static_cast(controls | additionalOptions); GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion, - targetLanguageVersion, false, EShTexSampTransKeep, false, automap); + targetLanguageVersion, false, EShTexSampTransKeep, false, false, false, automap); // Generate the hybrid output in the way of glslang. std::ostringstream stream; @@ -627,60 +560,6 @@ public: expectedOutputFname, result.spirvWarningsErrors); } - void loadFileCompileRemapAndCheck(const std::string& testDir, - const std::string& testName, - Source source, - Semantics semantics, - Target target, - const std::string& entryPointName="", - const unsigned int remapOptions = spv::spirvbin_t::NONE) - { - const std::string inputFname = testDir + "/" + testName; - const std::string expectedOutputFname = - testDir + "/baseResults/" + testName + ".out"; - std::string input, expectedOutput; - - tryLoadFile(inputFname, "input", &input); - tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); - - const EShMessages controls = DeriveOptions(source, semantics, target); - GlslangResult result = compileLinkRemap(testName, input, entryPointName, controls, remapOptions); - - // Generate the hybrid output in the way of glslang. - std::ostringstream stream; - outputResultToStream(&stream, result, controls); - - checkEqAndUpdateIfRequested(expectedOutput, stream.str(), - expectedOutputFname, result.spirvWarningsErrors); - } - - void loadFileRemapAndCheck(const std::string& testDir, - const std::string& testName, - Source source, - Semantics semantics, - Target target, - const unsigned int remapOptions = spv::spirvbin_t::NONE) - { - const std::string inputFname = testDir + "/" + testName; - const std::string expectedOutputFname = - testDir + "/baseResults/" + testName + ".out"; - std::vector input; - std::string expectedOutput; - - tryLoadSpvFile(inputFname, "input", input); - tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); - - const EShMessages controls = DeriveOptions(source, semantics, target); - GlslangResult result = remap(testName, input, controls, remapOptions); - - // Generate the hybrid output in the way of glslang. - std::ostringstream stream; - outputResultToStream(&stream, result, controls); - - checkEqAndUpdateIfRequested(expectedOutput, stream.str(), - expectedOutputFname, result.spirvWarningsErrors); - } - // Preprocesses the given |source| code. On success, returns true, the // preprocessed shader, and warning messages. Otherwise, returns false, an // empty string, and error messages. diff --git a/third_party/glslang/gtests/UboUnsizedArray.cpp b/third_party/glslang/gtests/UboUnsizedArray.cpp new file mode 100644 index 0000000000..eec7642e80 --- /dev/null +++ b/third_party/glslang/gtests/UboUnsizedArray.cpp @@ -0,0 +1,332 @@ +// Copyright (C) 2025 NVIDIA Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#include + +#include "TestFixture.h" + +namespace glslangtest { +namespace { + +class UboUnsizedArrayTest : public GlslangTest<::testing::Test> { +protected: + // Helper function to compile shader and check for specific error message. + bool compileShouldFailWith(const std::string& code, const std::string& expectedError, + EShLanguage stage = EShLangVertex) + { + glslang::TShader shader(stage); + EShMessages controls = static_cast(EShMsgDefault | EShMsgSpvRules | EShMsgVulkanRules); + + bool success = compile(&shader, code, "", controls); + + if (success) { + // Compilation should have failed. + return false; + } + + std::string errorLog = shader.getInfoLog(); + return errorLog.find(expectedError) != std::string::npos; + } +}; + +// Test that unsized arrays in uniform blocks work when extension is enabled. +TEST_F(UboUnsizedArrayTest, BasicFunctionality) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform DataBlock { + float scale; + float values[]; // unsized array as last member + }; + + void main() { + gl_Position = vec4(values[0] * scale, 0.0, 0.0, 1.0); + } + )"; + + glslang::TShader shader(EShLangVertex); + EShMessages controls = static_cast(EShMsgDefault | EShMsgSpvRules | EShMsgVulkanRules); + EXPECT_TRUE(compile(&shader, code, "", controls)); +} + +// Test that unsized arrays work when extension is enabled. +TEST_F(UboUnsizedArrayTest, ExtensionRequired) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform DataBlock { + float scale; + float values[]; // Should work with extension + }; + + void main() { + gl_Position = vec4(values[0] * scale, 0.0, 0.0, 1.0); + } + )"; + + glslang::TShader shader(EShLangVertex); + EShMessages controls = static_cast(EShMsgDefault | EShMsgSpvRules | EShMsgVulkanRules); + EXPECT_TRUE(compile(&shader, code, "", controls)); +} + +// Test that only the last member can be unsized. +TEST_F(UboUnsizedArrayTest, OnlyLastMemberCanBeUnsized) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform DataBlock { + float scale; + float values[]; // Last member - should work + }; + + void main() { + gl_Position = vec4(values[0] * scale, 0.0, 0.0, 1.0); + } + )"; + + glslang::TShader shader(EShLangVertex); + EShMessages controls = static_cast(EShMsgDefault | EShMsgSpvRules | EShMsgVulkanRules); + EXPECT_TRUE(compile(&shader, code, "", controls)); +} + +// Test that .length() method fails on unsized arrays. +TEST_F(UboUnsizedArrayTest, LengthMethodNotAllowed) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform DataBlock { + float scale; + float values[]; + }; + + layout(location = 0) out vec4 fragColor; + + void main() { + int len = values.length(); // Should fail - length() not supported for unsized arrays in uniform blocks + fragColor = vec4(len, 0.0, 0.0, 1.0); + } + )"; + + EXPECT_TRUE( + compileShouldFailWith(code, "array must be declared with a size before using this method", EShLangFragment)); +} + +// Test that function parameters cannot be unsized arrays from uniform blocks. +TEST_F(UboUnsizedArrayTest, FunctionParameterRestriction) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform DataBlock { + float scale; + float values[]; + }; + + void processArray(float arr[10]) { + // Process array + } + + void main() { + processArray(values); // Should fail - cannot pass unsized arrays as function arguments + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); + } + )"; + + EXPECT_TRUE(compileShouldFailWith(code, "no matching overloaded function found")); +} + +// Test negative constant indexing. +TEST_F(UboUnsizedArrayTest, NegativeIndexingNotAllowed) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform DataBlock { + float scale; + float values[]; + }; + + void main() { + float value = values[-1]; // Should fail + gl_Position = vec4(value * scale, 0.0, 0.0, 1.0); + } + )"; + + EXPECT_TRUE(compileShouldFailWith(code, "index out of range")); +} + +// Test that different data types work correctly. +TEST_F(UboUnsizedArrayTest, MultipleDataTypes) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform FloatBlock { + float scale; + float floatValues[]; + }; + + layout(std140, binding=1) uniform IntBlock { + int count; + int intValues[]; + }; + + layout(std140, binding=2) uniform VecBlock { + mat4 transform; + vec4 vecValues[]; + }; + + void main() { + int baseIndex = gl_VertexIndex % 10; + float value = floatValues[baseIndex] * scale; + int ivalue = intValues[baseIndex] * count; + vec4 vvalue = vecValues[baseIndex] * transform; + + gl_Position = vec4(value + float(ivalue), vvalue.xy, 1.0); + } + )"; + + glslang::TShader shader(EShLangVertex); + EShMessages controls = static_cast(EShMsgDefault | EShMsgSpvRules | EShMsgVulkanRules); + EXPECT_TRUE(compile(&shader, code, "", controls)); +} + +// Test that general integer expressions work for indexing. +TEST_F(UboUnsizedArrayTest, GeneralIntegerIndexing) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform DataBlock { + float scale; + float values[]; + }; + + layout(std140, binding=1) uniform SizeInfo { + int arraySize; + }; + + void main() { + // Various forms of general integer expressions + int baseIndex = gl_VertexIndex % arraySize; + int offsetIndex = (baseIndex + 1) % arraySize; + int computedIndex = min(baseIndex + offsetIndex, arraySize - 1); + + float result = values[baseIndex] + values[offsetIndex] + values[computedIndex]; + gl_Position = vec4(result * scale, 0.0, 0.0, 1.0); + } + )"; + + glslang::TShader shader(EShLangVertex); + EShMessages controls = static_cast(EShMsgDefault | EShMsgSpvRules | EShMsgVulkanRules); + EXPECT_TRUE(compile(&shader, code, "", controls)); +} + +// Test SPIR-V generation for unsized arrays in uniform blocks. +TEST_F(UboUnsizedArrayTest, SpvGeneration) +{ + const std::string code = R"( + #version 450 + #extension GL_EXT_uniform_buffer_unsized_array : require + + layout(std140, binding=0) uniform DataBlock { + float scale; + float values[]; + }; + + layout(std140, binding=1) uniform SizeBlock { + int arraySize; + }; + + void main() { + int index = gl_VertexIndex % arraySize; + float value = values[index]; + gl_Position = vec4(value * scale, 0.0, 0.0, 1.0); + } + )"; + + // Compile the shader. + glslang::TShader shader(EShLangVertex); + const char* shaderStrings[1] = {code.c_str()}; + shader.setStrings(shaderStrings, 1); + + // Set up compilation options. + EShMessages messages = static_cast(EShMsgSpvRules | EShMsgVulkanRules); + shader.setEnvInput(glslang::EShSourceGlsl, EShLangVertex, glslang::EShClientVulkan, 450); + shader.setEnvClient(glslang::EShClientVulkan, glslang::EShTargetVulkan_1_0); + shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetSpv_1_0); + + // Compile. + bool success = shader.parse(GetDefaultResources(), 450, false, messages); + EXPECT_TRUE(success) << "Shader compilation failed: " << shader.getInfoLog(); + + // Link and generate SPIR-V. + glslang::TProgram program; + program.addShader(&shader); + success = program.link(messages); + EXPECT_TRUE(success) << "Program linking failed: " << program.getInfoLog(); + + // Generate SPIR-V. + spv::SpvBuildLogger logger; + std::vector spirv; + glslang::SpvOptions options; + glslang::GlslangToSpv(*program.getIntermediate(EShLangVertex), spirv, &logger, &options); + + // Disassemble SPIR-V to text for easier checking. + std::ostringstream disassembly_stream; + spv::Disassemble(disassembly_stream, spirv); + std::string spirvText = disassembly_stream.str(); + + // Check for key SPIR-V elements that indicate successful compilation. + // 1. SourceExtension for the extension + EXPECT_TRUE(spirvText.find("SourceExtension") != std::string::npos) + << "SPIR-V should contain SourceExtension for GL_EXT_uniform_buffer_unsized_array"; + + // 2. TypeRuntimeArray for the unsized array + EXPECT_TRUE(spirvText.find("TypeRuntimeArray") != std::string::npos) + << "SPIR-V should contain TypeRuntimeArray for unsized arrays"; + + // 3. Block decoration (for uniform blocks with runtime arrays) + EXPECT_TRUE(spirvText.find("Block") != std::string::npos) + << "SPIR-V should contain Block decoration for uniform blocks with runtime arrays"; + + // 4. RuntimeDescriptorArrayEXT capability + EXPECT_TRUE(spirvText.find("RuntimeDescriptorArrayEXT") != std::string::npos) + << "SPIR-V should contain RuntimeDescriptorArrayEXT capability"; + + // 5. SPV_EXT_descriptor_indexing extension + EXPECT_TRUE(spirvText.find("SPV_EXT_descriptor_indexing") != std::string::npos) + << "SPIR-V should contain SPV_EXT_descriptor_indexing extension"; +} + +} // anonymous namespace +} // namespace glslangtest \ No newline at end of file diff --git a/third_party/glslang/gtests/VkRelaxed.FromFile.cpp b/third_party/glslang/gtests/VkRelaxed.FromFile.cpp index 8b8a628aa8..ea70b576d1 100644 --- a/third_party/glslang/gtests/VkRelaxed.FromFile.cpp +++ b/third_party/glslang/gtests/VkRelaxed.FromFile.cpp @@ -297,6 +297,7 @@ INSTANTIATE_TEST_SUITE_P( {{"vk.relaxed.stagelink.vert", "vk.relaxed.stagelink.frag"}, {}}, {{"vk.relaxed.errorcheck.vert", "vk.relaxed.errorcheck.frag"}, {}}, {{"vk.relaxed.changeSet.vert", "vk.relaxed.changeSet.frag" }, { {"0"}, {"1"} } }, + {{"vk.relaxed.syntaxerror.vert", "vk.relaxed.syntaxerror.frag"}, {}}, })) ); // clang-format on diff --git a/third_party/glslang/known_good.json b/third_party/glslang/known_good.json index cd85e320f1..1dfa5dc702 100644 --- a/third_party/glslang/known_good.json +++ b/third_party/glslang/known_good.json @@ -5,14 +5,14 @@ "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Tools", "subdir" : "External/spirv-tools", - "commit": "33e02568181e3312f49a3cf33df470bf96ef293a" + "commit": "fbe4f3ad913c44fe8700545f8ffe35d1382b7093" }, { "name" : "spirv-tools/external/spirv-headers", "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Headers", "subdir" : "External/spirv-tools/external/spirv-headers", - "commit" : "2a611a970fdbc41ac2e3e328802aed9985352dca" + "commit" : "04f10f650d514df88b76d25e83db360142c7b174" }, { "name": "googletest", diff --git a/third_party/glslang/license-checker.cfg b/third_party/glslang/license-checker.cfg index 6ce7a75cef..305a04aa61 100644 --- a/third_party/glslang/license-checker.cfg +++ b/third_party/glslang/license-checker.cfg @@ -22,7 +22,6 @@ "known_good.json", "LICENSE.txt", "make-revision", - "README-spirv-remap.txt", "WORKSPACE", "glslang/OSDependent/Web/glslang.*.js", diff --git a/third_party/spirv-cross/.reuse/dep5 b/third_party/spirv-cross/.reuse/dep5 index cbdbbaed5a..d7b49bcf6f 100644 --- a/third_party/spirv-cross/.reuse/dep5 +++ b/third_party/spirv-cross/.reuse/dep5 @@ -6,6 +6,6 @@ Files: shaders*/* reference/* tests-other/* Copyright: 2016-2021 The Khronos Group, Inc. License: Apache-2.0 -Files: spirv.h spirv.hpp GLSL.std.450.h +Files: spirv.h spirv.hpp GLSL.std.450.h NonSemanticShaderDebugInfo100.h Copyright: 2016-2021 The Khronos Group, Inc. License: LicenseRef-KhronosFreeUse diff --git a/third_party/spirv-cross/CMakeLists.txt b/third_party/spirv-cross/CMakeLists.txt index f516a14cac..8e5129c8b2 100644 --- a/third_party/spirv-cross/CMakeLists.txt +++ b/third_party/spirv-cross/CMakeLists.txt @@ -56,6 +56,7 @@ option(SPIRV_CROSS_SANITIZE_THREADS "Sanitize threads" OFF) option(SPIRV_CROSS_SANITIZE_UNDEFINED "Sanitize undefined" OFF) option(SPIRV_CROSS_NAMESPACE_OVERRIDE "" "Override the namespace used in the C++ API.") +option(SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE "" "Override the namespace used by spirv.hpp (to workaround conflicts).") option(SPIRV_CROSS_FORCE_STL_TYPES "Force use of STL types instead of STL replacements in certain places. Might reduce performance." OFF) option(SPIRV_CROSS_SKIP_INSTALL "Skips installation targets." OFF) @@ -188,6 +189,14 @@ macro(spirv_cross_add_library name config_name library_type) endif() endif() + if (SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE) + if (${library_type} MATCHES "STATIC") + target_compile_definitions(${name} PUBLIC SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE=${SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE}) + else() + target_compile_definitions(${name} PRIVATE SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE=${SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE}) + endif() + endif() + if (NOT SPIRV_CROSS_SKIP_INSTALL) install(TARGETS ${name} EXPORT ${config_name}Config @@ -246,7 +255,7 @@ set(spirv-cross-util-sources ${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_util.hpp) set(spirv-cross-abi-major 0) -set(spirv-cross-abi-minor 67) +set(spirv-cross-abi-minor 68) set(spirv-cross-abi-patch 0) set(SPIRV_CROSS_VERSION ${spirv-cross-abi-major}.${spirv-cross-abi-minor}.${spirv-cross-abi-patch}) @@ -542,6 +551,14 @@ if (SPIRV_CROSS_CLI) target_link_libraries(spirv-cross-typed-id-test spirv-cross-core) set_target_properties(spirv-cross-typed-id-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}") + add_executable(spirv-cross-debug-lines-test tests-other/debug-lines.cpp) + target_link_libraries(spirv-cross-debug-lines-test spirv-cross-core) + set_target_properties(spirv-cross-debug-lines-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}") + + add_executable(spirv-cross-debug-info-test tests-other/debug-info.cpp) + target_link_libraries(spirv-cross-debug-info-test spirv-cross-core) + set_target_properties(spirv-cross-debug-info-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}") + if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")) target_compile_options(spirv-cross-c-api-test PRIVATE -std=c89 -Wall -Wextra) endif() @@ -564,6 +581,10 @@ if (SPIRV_CROSS_CLI) COMMAND $ ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/msl_ycbcr_conversion_test_2.spv) add_test(NAME spirv-cross-typed-id-test COMMAND $) + add_test(NAME spirv-cross-debug-lines-test + COMMAND $ ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/debug-lines.spv) + add_test(NAME spirv-cross-debug-info-test + COMMAND $ ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/debug-info.spv) add_test(NAME spirv-cross-test COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --parallel ${spirv-cross-externals} diff --git a/third_party/spirv-cross/Makefile b/third_party/spirv-cross/Makefile index b44eb5e8c9..9e75701f51 100644 --- a/third_party/spirv-cross/Makefile +++ b/third_party/spirv-cross/Makefile @@ -25,6 +25,9 @@ ifeq ($(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS), 1) CXXFLAGS += -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS -fno-exceptions endif +# This only builds CLI, so get extra coverage for the override. +CXXFLAGS += -DSPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE=spv_private + all: $(TARGET) -include $(DEPS) diff --git a/third_party/spirv-cross/NonSemanticShaderDebugInfo100.h b/third_party/spirv-cross/NonSemanticShaderDebugInfo100.h new file mode 100644 index 0000000000..b276b560cb --- /dev/null +++ b/third_party/spirv-cross/NonSemanticShaderDebugInfo100.h @@ -0,0 +1,171 @@ +// Copyright (c) 2018-2024 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +#ifndef SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_ +#define SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + NonSemanticShaderDebugInfo100Version = 100, + NonSemanticShaderDebugInfo100Version_BitWidthPadding = 0x7fffffff +}; +enum { + NonSemanticShaderDebugInfo100Revision = 6, + NonSemanticShaderDebugInfo100Revision_BitWidthPadding = 0x7fffffff +}; + +enum NonSemanticShaderDebugInfo100Instructions { + NonSemanticShaderDebugInfo100DebugInfoNone = 0, + NonSemanticShaderDebugInfo100DebugCompilationUnit = 1, + NonSemanticShaderDebugInfo100DebugTypeBasic = 2, + NonSemanticShaderDebugInfo100DebugTypePointer = 3, + NonSemanticShaderDebugInfo100DebugTypeQualifier = 4, + NonSemanticShaderDebugInfo100DebugTypeArray = 5, + NonSemanticShaderDebugInfo100DebugTypeVector = 6, + NonSemanticShaderDebugInfo100DebugTypedef = 7, + NonSemanticShaderDebugInfo100DebugTypeFunction = 8, + NonSemanticShaderDebugInfo100DebugTypeEnum = 9, + NonSemanticShaderDebugInfo100DebugTypeComposite = 10, + NonSemanticShaderDebugInfo100DebugTypeMember = 11, + NonSemanticShaderDebugInfo100DebugTypeInheritance = 12, + NonSemanticShaderDebugInfo100DebugTypePtrToMember = 13, + NonSemanticShaderDebugInfo100DebugTypeTemplate = 14, + NonSemanticShaderDebugInfo100DebugTypeTemplateParameter = 15, + NonSemanticShaderDebugInfo100DebugTypeTemplateTemplateParameter = 16, + NonSemanticShaderDebugInfo100DebugTypeTemplateParameterPack = 17, + NonSemanticShaderDebugInfo100DebugGlobalVariable = 18, + NonSemanticShaderDebugInfo100DebugFunctionDeclaration = 19, + NonSemanticShaderDebugInfo100DebugFunction = 20, + NonSemanticShaderDebugInfo100DebugLexicalBlock = 21, + NonSemanticShaderDebugInfo100DebugLexicalBlockDiscriminator = 22, + NonSemanticShaderDebugInfo100DebugScope = 23, + NonSemanticShaderDebugInfo100DebugNoScope = 24, + NonSemanticShaderDebugInfo100DebugInlinedAt = 25, + NonSemanticShaderDebugInfo100DebugLocalVariable = 26, + NonSemanticShaderDebugInfo100DebugInlinedVariable = 27, + NonSemanticShaderDebugInfo100DebugDeclare = 28, + NonSemanticShaderDebugInfo100DebugValue = 29, + NonSemanticShaderDebugInfo100DebugOperation = 30, + NonSemanticShaderDebugInfo100DebugExpression = 31, + NonSemanticShaderDebugInfo100DebugMacroDef = 32, + NonSemanticShaderDebugInfo100DebugMacroUndef = 33, + NonSemanticShaderDebugInfo100DebugImportedEntity = 34, + NonSemanticShaderDebugInfo100DebugSource = 35, + NonSemanticShaderDebugInfo100DebugFunctionDefinition = 101, + NonSemanticShaderDebugInfo100DebugSourceContinued = 102, + NonSemanticShaderDebugInfo100DebugLine = 103, + NonSemanticShaderDebugInfo100DebugNoLine = 104, + NonSemanticShaderDebugInfo100DebugBuildIdentifier = 105, + NonSemanticShaderDebugInfo100DebugStoragePath = 106, + NonSemanticShaderDebugInfo100DebugEntryPoint = 107, + NonSemanticShaderDebugInfo100DebugTypeMatrix = 108, + NonSemanticShaderDebugInfo100InstructionsMax = 0x7fffffff +}; + + +enum NonSemanticShaderDebugInfo100DebugInfoFlags { + NonSemanticShaderDebugInfo100None = 0x0000, + NonSemanticShaderDebugInfo100FlagIsProtected = 0x01, + NonSemanticShaderDebugInfo100FlagIsPrivate = 0x02, + NonSemanticShaderDebugInfo100FlagIsPublic = 0x03, + NonSemanticShaderDebugInfo100FlagIsLocal = 0x04, + NonSemanticShaderDebugInfo100FlagIsDefinition = 0x08, + NonSemanticShaderDebugInfo100FlagFwdDecl = 0x10, + NonSemanticShaderDebugInfo100FlagArtificial = 0x20, + NonSemanticShaderDebugInfo100FlagExplicit = 0x40, + NonSemanticShaderDebugInfo100FlagPrototyped = 0x80, + NonSemanticShaderDebugInfo100FlagObjectPointer = 0x100, + NonSemanticShaderDebugInfo100FlagStaticMember = 0x200, + NonSemanticShaderDebugInfo100FlagIndirectVariable = 0x400, + NonSemanticShaderDebugInfo100FlagLValueReference = 0x800, + NonSemanticShaderDebugInfo100FlagRValueReference = 0x1000, + NonSemanticShaderDebugInfo100FlagIsOptimized = 0x2000, + NonSemanticShaderDebugInfo100FlagIsEnumClass = 0x4000, + NonSemanticShaderDebugInfo100FlagTypePassByValue = 0x8000, + NonSemanticShaderDebugInfo100FlagTypePassByReference = 0x10000, + NonSemanticShaderDebugInfo100FlagUnknownPhysicalLayout = 0x20000, + NonSemanticShaderDebugInfo100DebugInfoFlagsMax = 0x7fffffff +}; + +enum NonSemanticShaderDebugInfo100BuildIdentifierFlags { + NonSemanticShaderDebugInfo100IdentifierPossibleDuplicates = 0x01, + NonSemanticShaderDebugInfo100BuildIdentifierFlagsMax = 0x7fffffff +}; + +enum NonSemanticShaderDebugInfo100DebugBaseTypeAttributeEncoding { + NonSemanticShaderDebugInfo100Unspecified = 0, + NonSemanticShaderDebugInfo100Address = 1, + NonSemanticShaderDebugInfo100Boolean = 2, + NonSemanticShaderDebugInfo100Float = 3, + NonSemanticShaderDebugInfo100Signed = 4, + NonSemanticShaderDebugInfo100SignedChar = 5, + NonSemanticShaderDebugInfo100Unsigned = 6, + NonSemanticShaderDebugInfo100UnsignedChar = 7, + NonSemanticShaderDebugInfo100DebugBaseTypeAttributeEncodingMax = 0x7fffffff +}; + +enum NonSemanticShaderDebugInfo100DebugCompositeType { + NonSemanticShaderDebugInfo100Class = 0, + NonSemanticShaderDebugInfo100Structure = 1, + NonSemanticShaderDebugInfo100Union = 2, + NonSemanticShaderDebugInfo100DebugCompositeTypeMax = 0x7fffffff +}; + +enum NonSemanticShaderDebugInfo100DebugTypeQualifier { + NonSemanticShaderDebugInfo100ConstType = 0, + NonSemanticShaderDebugInfo100VolatileType = 1, + NonSemanticShaderDebugInfo100RestrictType = 2, + NonSemanticShaderDebugInfo100AtomicType = 3, + NonSemanticShaderDebugInfo100DebugTypeQualifierMax = 0x7fffffff +}; + +enum NonSemanticShaderDebugInfo100DebugOperation { + NonSemanticShaderDebugInfo100Deref = 0, + NonSemanticShaderDebugInfo100Plus = 1, + NonSemanticShaderDebugInfo100Minus = 2, + NonSemanticShaderDebugInfo100PlusUconst = 3, + NonSemanticShaderDebugInfo100BitPiece = 4, + NonSemanticShaderDebugInfo100Swap = 5, + NonSemanticShaderDebugInfo100Xderef = 6, + NonSemanticShaderDebugInfo100StackValue = 7, + NonSemanticShaderDebugInfo100Constu = 8, + NonSemanticShaderDebugInfo100Fragment = 9, + NonSemanticShaderDebugInfo100DebugOperationMax = 0x7fffffff +}; + +enum NonSemanticShaderDebugInfo100DebugImportedEntity { + NonSemanticShaderDebugInfo100ImportedModule = 0, + NonSemanticShaderDebugInfo100ImportedDeclaration = 1, + NonSemanticShaderDebugInfo100DebugImportedEntityMax = 0x7fffffff +}; + + +#ifdef __cplusplus +} +#endif + +#endif // SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_ diff --git a/third_party/spirv-cross/README.md b/third_party/spirv-cross/README.md index 3a89e6c2f8..a1aa5511de 100644 --- a/third_party/spirv-cross/README.md +++ b/third_party/spirv-cross/README.md @@ -265,6 +265,10 @@ Some examples below. glslangValidator -H -V -o test.spv test.frag ``` +NOTE: This assumes Vulkan GLSL input. In general, only modern GLSL (#version 330+ for desktop) can be compiled to SPIR-V. +Typically when cross compiling GLSL, you start with modern GLSL and cross compile to older targets for compatibility, +not the other way around. + #### Converting a SPIR-V file to GLSL ES ``` diff --git a/third_party/spirv-cross/checkout_glslang_spirv_tools.sh b/third_party/spirv-cross/checkout_glslang_spirv_tools.sh index 954bb7fa5c..7f084fcf2c 100755 --- a/third_party/spirv-cross/checkout_glslang_spirv_tools.sh +++ b/third_party/spirv-cross/checkout_glslang_spirv_tools.sh @@ -2,9 +2,9 @@ # Copyright 2016-2021 The Khronos Group Inc. # SPDX-License-Identifier: Apache-2.0 -GLSLANG_REV=8a85691a0740d390761a1008b4696f57facd02c4 -SPIRV_TOOLS_REV=40eb301f320e1d85ce3bc12798022149eae3eee3 -SPIRV_HEADERS_REV=04b76709bf40a7ce8df3382060ef3620f19de566 +GLSLANG_REV=5f6c7176c5483da9af6432afb3dd962e4f8873a1 +SPIRV_TOOLS_REV=021f92a757002fcdba6a73154ed46a203d3a56b8 +SPIRV_HEADERS_REV=9268f3057354a2cb65991ba5f38b16d81e803692 PROTOCOL=https if [ -d external/glslang ]; then diff --git a/third_party/spirv-cross/main.cpp b/third_party/spirv-cross/main.cpp index 605901648e..b48c1c3cdf 100644 --- a/third_party/spirv-cross/main.cpp +++ b/third_party/spirv-cross/main.cpp @@ -47,7 +47,7 @@ #include "gitversion.h" #endif -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; using namespace std; @@ -285,7 +285,7 @@ static bool write_string_to_file(const char *path, const char *string) #pragma warning(pop) #endif -static void print_resources(const Compiler &compiler, spv::StorageClass storage, +static void print_resources(const Compiler &compiler, StorageClass storage, const SmallVector &resources) { fprintf(stderr, "%s\n", storage == StorageClassInput ? "builtin inputs" : "builtin outputs"); @@ -326,12 +326,12 @@ static void print_resources(const Compiler &compiler, spv::StorageClass storage, string builtin_str; switch (res.builtin) { - case spv::BuiltInPosition: builtin_str = "Position"; break; - case spv::BuiltInPointSize: builtin_str = "PointSize"; break; - case spv::BuiltInCullDistance: builtin_str = "CullDistance"; break; - case spv::BuiltInClipDistance: builtin_str = "ClipDistance"; break; - case spv::BuiltInTessLevelInner: builtin_str = "TessLevelInner"; break; - case spv::BuiltInTessLevelOuter: builtin_str = "TessLevelOuter"; break; + case BuiltInPosition: builtin_str = "Position"; break; + case BuiltInPointSize: builtin_str = "PointSize"; break; + case BuiltInCullDistance: builtin_str = "CullDistance"; break; + case BuiltInClipDistance: builtin_str = "ClipDistance"; break; + case BuiltInTessLevelInner: builtin_str = "TessLevelInner"; break; + case BuiltInTessLevelOuter: builtin_str = "TessLevelOuter"; break; default: builtin_str = string("builtin #") + to_string(res.builtin); } @@ -421,13 +421,13 @@ static void print_resources(const Compiler &compiler, const char *tag, const Sma fprintf(stderr, "=============\n\n"); } -static const char *execution_model_to_str(spv::ExecutionModel model) +static const char *execution_model_to_str(ExecutionModel model) { switch (model) { - case spv::ExecutionModelVertex: + case ExecutionModelVertex: return "vertex"; - case spv::ExecutionModelTessellationControl: + case ExecutionModelTessellationControl: return "tessellation control"; case ExecutionModelTessellationEvaluation: return "tessellation evaluation"; @@ -538,8 +538,8 @@ static void print_resources(const Compiler &compiler, const ShaderResources &res print_resources(compiler, "acceleration structures", res.acceleration_structures); print_resources(compiler, "tensors", res.tensors); print_resources(compiler, "record buffers", res.shader_record_buffers); - print_resources(compiler, spv::StorageClassInput, res.builtin_inputs); - print_resources(compiler, spv::StorageClassOutput, res.builtin_outputs); + print_resources(compiler, StorageClassInput, res.builtin_inputs); + print_resources(compiler, StorageClassOutput, res.builtin_outputs); } static void print_push_constant_resources(const Compiler &compiler, const SmallVector &res) @@ -744,6 +744,7 @@ struct CLIArguments bool hlsl_enable_16bit_types = false; bool hlsl_flatten_matrix_vertex_input_semantics = false; bool hlsl_preserve_structured_buffers = false; + bool hlsl_user_semantic = false; HLSLBindingFlags hlsl_binding_flags = 0; bool vulkan_semantics = false; bool flatten_multidimensional_arrays = false; @@ -852,6 +853,7 @@ static void print_help_hlsl() "\t[--hlsl-enable-16bit-types]:\n\t\tEnables native use of half/int16_t/uint16_t and ByteAddressBuffer interaction with these types. Requires SM 6.2.\n" "\t[--hlsl-flatten-matrix-vertex-input-semantics]:\n\t\tEmits matrix vertex inputs with input semantics as if they were independent vectors, e.g. TEXCOORD{2,3,4} rather than matrix form TEXCOORD2_{0,1,2}.\n" "\t[--hlsl-preserve-structured-buffers]:\n\t\tEmit SturucturedBuffer rather than ByteAddressBuffer. Requires UserTypeGOOGLE to be emitted. Intended for DXC roundtrips.\n" + "\t[--hlsl-user-semantic]:\n\t\tUses UserSemantic decoration to generate vertex input and output semantics.\n" ); // clang-format on } @@ -1175,9 +1177,9 @@ static ExecutionModel stage_to_execution_model(const std::string &stage) else if (stage == "rcall") return ExecutionModelCallableKHR; else if (stage == "mesh") - return spv::ExecutionModelMeshEXT; + return ExecutionModelMeshEXT; else if (stage == "task") - return spv::ExecutionModelTaskEXT; + return ExecutionModelTaskEXT; else SPIRV_CROSS_THROW("Invalid stage."); } @@ -1471,6 +1473,7 @@ static string compile_iteration(const CLIArguments &args, std::vector hlsl_opts.enable_16bit_types = args.hlsl_enable_16bit_types; hlsl_opts.flatten_matrix_vertex_input_semantics = args.hlsl_flatten_matrix_vertex_input_semantics; hlsl_opts.preserve_structured_buffers = args.hlsl_preserve_structured_buffers; + hlsl_opts.user_semantic = args.hlsl_user_semantic; hlsl->set_hlsl_options(hlsl_opts); hlsl->set_resource_binding_flags(args.hlsl_binding_flags); if (args.hlsl_base_vertex_index_explicit_binding) @@ -1673,6 +1676,7 @@ static int main_inner(int argc, char *argv[]) cbs.add("--hlsl-flatten-matrix-vertex-input-semantics", [&args](CLIParser &) { args.hlsl_flatten_matrix_vertex_input_semantics = true; }); cbs.add("--hlsl-preserve-structured-buffers", [&args](CLIParser &) { args.hlsl_preserve_structured_buffers = true; }); + cbs.add("--hlsl-user-semantic", [&args](CLIParser &) { args.hlsl_user_semantic = true; }); cbs.add("--vulkan-semantics", [&args](CLIParser &) { args.vulkan_semantics = true; }); cbs.add("-V", [&args](CLIParser &) { args.vulkan_semantics = true; }); cbs.add("--flatten-multidimensional-arrays", [&args](CLIParser &) { args.flatten_multidimensional_arrays = true; }); diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag new file mode 100644 index 0000000000..996d5f6fb3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag @@ -0,0 +1,21 @@ +globallycoherent RWStructuredBuffer TestBuffer : register(u0); + +static float4 out_var_SV_Target0; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target0 : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target0 = TestBuffer[0u]; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target0 = out_var_SV_Target0; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..f5c46558f6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,117 @@ +static float3 iv; +static float3 ov; + +struct SPIRV_Cross_Input +{ + float3 iv : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float3 ov : SV_Target0; +}; + +void frag_main() +{ +#line 137 "test.frag" +#line 106 "test.frag" + bool _288 = iv.x < 0.0f; + if (_288) + { +#line 107 "test.frag" + ov.x = 50.0f; + } + else + { +#line 109 "test.frag" + ov.x = 60.0f; + } +#line 114 "test.frag" + for (int _519 = 0; _519 < 4; _519++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + ov.x = 50.0f; + } + else + { +#line 109 "test.frag" + ov.x = 60.0f; + } +#line 117 "test.frag" + if (iv.y < 0.0f) + { +#line 118 "test.frag" + ov.y = 70.0f; + } + else + { +#line 120 "test.frag" + ov.y = 80.0f; + } + } +#line 126 "test.frag" + for (int _523 = 0; _523 < 4; _523++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + ov.x = 50.0f; + } + else + { +#line 109 "test.frag" + ov.x = 60.0f; + } +#line 114 "test.frag" + for (int _527 = 0; _527 < 4; _527++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + ov.x = 50.0f; + } + else + { +#line 109 "test.frag" + ov.x = 60.0f; + } +#line 117 "test.frag" + if (iv.y < 0.0f) + { +#line 118 "test.frag" + ov.y = 70.0f; + } + else + { +#line 120 "test.frag" + ov.y = 80.0f; + } + } +#line 130 "test.frag" + if (iv.z < 0.0f) + { +#line 131 "test.frag" + ov.z = 100.0f; + } + else + { +#line 133 "test.frag" + ov.z = 120.0f; + } + } +#line 142 "test.frag" +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + iv = stage_input.iv; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.ov = ov; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/fma.spv16.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/fma.spv16.asm.comp new file mode 100644 index 0000000000..aac1a07b1c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/fma.spv16.asm.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +struct SSBO +{ + float4 in_data[1]; +}; + +kernel void main0(device SSBO2& _4 [[buffer(0)]], device SSBO& _6 [[buffer(1)]]) +{ + _4.out_data[0] = fma(_6.in_data[0], _6.in_data[1], _6.in_data[1]); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/bitcast-ptr-vec.argument-tier-1.msl23.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/bitcast-ptr-vec.argument-tier-1.msl23.asm.frag index c691f1de16..48c72019ee 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/bitcast-ptr-vec.argument-tier-1.msl23.asm.frag +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/bitcast-ptr-vec.argument-tier-1.msl23.asm.frag @@ -14,13 +14,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -36,16 +32,16 @@ struct main0_out float4 out_var_SV_Target [[color(0)]]; }; -fragment main0_out main0(constant type_ConstantBuffer_PushConstants& g_PushConstants [[buffer(0)]], const device spvDescriptor>* g_Texture2DDescriptorHeap_ [[buffer(1)]], float4 gl_FragCoord [[position]]) +fragment main0_out main0(constant type_ConstantBuffer_PushConstants& g_PushConstants [[buffer(0)]], device const void* spvDescriptorSet0Binding0 [[buffer(1)]], float4 gl_FragCoord [[position]]) { - spvDescriptorArray> g_Texture2DDescriptorHeap {g_Texture2DDescriptorHeap_}; + spvDescriptorArray> g_Texture2DDescriptorHeap {spvDescriptorSet0Binding0}; main0_out out = {}; - int2 _55 = int2(gl_FragCoord.xy) - (*(reinterpret_cast(g_PushConstants.SharedConstants + 16ul))); + int2 _55 = int2(gl_FragCoord.xy) - (*(reinterpret_cast(g_PushConstants.SharedConstants + 16ul))); bool _66; if (!any(_55 < int2(0))) { - _66 = any(_55 >= (*(reinterpret_cast(g_PushConstants.SharedConstants + 24ul)))); + _66 = any(_55 >= (*(reinterpret_cast(g_PushConstants.SharedConstants + 24ul)))); } else { @@ -58,9 +54,9 @@ fragment main0_out main0(constant type_ConstantBuffer_PushConstants& g_PushConst } else { - _77 = g_Texture2DDescriptorHeap[*(reinterpret_cast(g_PushConstants.SharedConstants + 12ul))].read(uint2(int3(select(_55, int2(0), bool2(_66)), 0).xy), 0); + _77 = g_Texture2DDescriptorHeap[*(reinterpret_cast(g_PushConstants.SharedConstants + 12ul))].read(uint2(int3(select(_55, int2(0), bool2(_66)), 0).xy), 0); } - float3 _81 = powr(_77.xyz, *(reinterpret_cast(g_PushConstants.SharedConstants))); + float3 _81 = powr(_77.xyz, *(reinterpret_cast(g_PushConstants.SharedConstants))); out.out_var_SV_Target = float4(_81.x, _81.y, _81.z, _77.w); return out; } diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag new file mode 100644 index 0000000000..f4015d5116 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +constant bool _3_tmp [[function_constant(0)]]; +constant bool _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : true; +constant uint _4 = is_function_constant_defined(_3_tmp) ? uint(_3_tmp) : 0u; + +struct main0_out +{ + float4 m_2 [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.m_2 = float4(float(_4) + float(_3)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh b/third_party/spirv-cross/reference/opt/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh new file mode 100644 index 0000000000..f8f759c145 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh @@ -0,0 +1,100 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } + + object_data T& operator [] (size_t pos) object_data + { + return elements[pos]; + } + constexpr const object_data T& operator [] (size_t pos) const object_data + { + return elements[pos]; + } +}; + +void spvSetMeshOutputsEXT(uint gl_LocalInvocationIndex, threadgroup uint2& spvMeshSizes, uint vertexCount, uint primitiveCount) +{ + if (gl_LocalInvocationIndex == 0) + { + spvMeshSizes.x = vertexCount; + spvMeshSizes.y = primitiveCount; + } +} + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(128u, 1u, 1u); + +struct spvPerPrimitive +{ + float4 m_17 [[user(locn0)]]; +}; + +using spvMesh_t = mesh; + +static inline __attribute__((always_inline)) +void _4(thread uint& gl_LocalInvocationIndex, threadgroup uint2& spvMeshSizes) +{ + spvSetMeshOutputsEXT(gl_LocalInvocationIndex, spvMeshSizes, 0u, 0u); +} + +[[mesh]] void main0(uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], spvMesh_t spvMesh) +{ + threadgroup uint2 spvMeshSizes; + threadgroup spvUnsafeArray _17; + if (gl_LocalInvocationIndex == 0) spvMeshSizes.y = 0u; + _4(gl_LocalInvocationIndex, spvMeshSizes); + threadgroup_barrier(mem_flags::mem_threadgroup); + if (spvMeshSizes.y == 0) + { + return; + } + spvMesh.set_primitive_count(spvMeshSizes.y); + const uint spvThreadCount [[maybe_unused]] = (gl_WorkGroupSize.x * gl_WorkGroupSize.y * gl_WorkGroupSize.z); + for (uint spvPI = gl_LocalInvocationIndex; spvPI < spvMeshSizes.y; spvPI += spvThreadCount) + { + spvPerPrimitive spvP = {}; + spvP.m_17 = _17[spvPI]; + spvMesh.set_primitive(spvPI, spvP); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc index 6c9903e02b..d3fbdd0c93 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc @@ -13,7 +13,7 @@ struct TessLevels float outer3; }; -kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +kernel void main0(device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) { spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0); diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc index 79395a4bbb..2d840168fb 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc @@ -13,7 +13,7 @@ struct TessLevels float outer3; }; -kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +kernel void main0(device TessLevels& sb_levels [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) { uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0); diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp index 18cfd68c19..14bfd9437a 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp @@ -27,15 +27,15 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); struct spvDescriptorSetBuffer0 { - const device SSBO0* ssbo0 [[id(0)]]; + device SSBO0* ssbo0 [[id(0)]]; }; struct spvDescriptorSetBuffer1 { - const device SSBO1* ssbo1 [[id(0)]]; + device SSBO1* ssbo1 [[id(0)]]; }; -kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], device SSBO3& ssbo3 [[buffer(2)]], const device SSBO2& ssbo2 [[buffer(3)]]) +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], device SSBO3& ssbo3 [[buffer(2)]], device SSBO2& ssbo2 [[buffer(3)]]) { ssbo3.v = ((*spvDescriptorSet0.ssbo0).v + (*spvDescriptorSet1.ssbo1).v) + ssbo2.v; } diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp index f798264d37..92cd0e2513 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp @@ -14,13 +14,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -64,7 +60,7 @@ struct spvDescriptorSetBuffer1 spvDescriptor ws [[id(1)]][1] /* unsized array hack */; }; -kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { spvDescriptorArray vs {spvDescriptorSet0.vs}; spvDescriptorArray ws {spvDescriptorSet1.ws}; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.rich-descriptor.argument.device-argument-buffer.argument-tier-1.msl2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.rich-descriptor.argument.device-argument-buffer.argument-tier-1.msl2.comp index f8becad483..08b4e2cce9 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.rich-descriptor.argument.device-argument-buffer.argument-tier-1.msl2.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.rich-descriptor.argument.device-argument-buffer.argument-tier-1.msl2.comp @@ -12,47 +12,32 @@ struct spvDescriptor }; template -struct spvBufferDescriptor +struct spvBufferDescriptor; + +template +struct spvBufferDescriptor { - T value; + device T* value; int length; - const device T& operator -> () const device - { - return value; - } - const device T& operator * () const device - { - return value; - } + int padding; }; template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; template struct spvDescriptorArray { - spvDescriptorArray(const device spvBufferDescriptor* ptr) : ptr(ptr) - { - } - const device T* operator [] (size_t i) const - { - return ptr[i].value; - } - const int length(int i) const - { - return ptr[i].length; - } + spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + device T* operator [] (size_t i) const { return ptr[i].value; } + int length(int i) const { return ptr[i].length; } const device spvBufferDescriptor* ptr; }; @@ -96,7 +81,7 @@ struct spvDescriptorSetBuffer1 spvBufferDescriptor ws [[id(1)]][1] /* unsized array hack */; }; -kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { spvDescriptorArray vs {spvDescriptorSet0.vs}; spvDescriptorArray ws {spvDescriptorSet1.ws}; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array.argument.device-argument-buffer.argument-tier-1.msl2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array.argument.device-argument-buffer.argument-tier-1.msl2.comp index a32ad5f28a..0f05c01ba5 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array.argument.device-argument-buffer.argument-tier-1.msl2.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-runtime-array.argument.device-argument-buffer.argument-tier-1.msl2.comp @@ -14,13 +14,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -44,7 +40,7 @@ struct spvDescriptorSetBuffer1 spvDescriptor Ss [[id(1)]][1] /* unsized array hack */; }; -kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { spvDescriptorArray> Ts {spvDescriptorSet0.Ts}; spvDescriptorArray Ss {spvDescriptorSet1.Ss}; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.comp index dbb839f581..2c090d9247 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.comp @@ -23,7 +23,7 @@ struct SSBO3 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 _29 = _23.in_data[gl_GlobalInvocationID.x]; if (dot(_29, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.comp index ebbc144c7b..ce5a745b6c 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.comp @@ -25,7 +25,7 @@ constant uint _59_tmp [[function_constant(10)]]; constant uint _59 = is_function_constant_defined(_59_tmp) ? _59_tmp : 1u; constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_59, 1u, 1u); -kernel void main0(const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvDispatchBase [[grid_origin]]) +kernel void main0(device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvDispatchBase [[grid_origin]]) { gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; float4 _33 = _27.in_data[gl_GlobalInvocationID.x]; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.msl11.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.msl11.comp index 2d991f5db5..ea10288fa9 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.msl11.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.msl11.comp @@ -23,7 +23,7 @@ struct SSBO3 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(constant uint3& spvDispatchBase [[buffer(29)]], const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(constant uint3& spvDispatchBase [[buffer(29)]], device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; float4 _33 = _27.in_data[gl_GlobalInvocationID.x]; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp index c164b37412..9b420db8af 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp @@ -10,7 +10,7 @@ struct t24 int4 m0[2]; int m1; ulong2 m2[2]; - device t21* m3; + const device t21* m3; float2x4 m4; }; @@ -19,7 +19,7 @@ struct t21 int4 m0[2]; int m1; ulong2 m2[2]; - device t21* m3; + const device t21* m3; float2x4 m4; }; @@ -32,8 +32,8 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); kernel void main0(constant t24& u24 [[buffer(0)]], constant t35& u35 [[buffer(1)]], texture2d v295 [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { - int _155 = (((((((((((((u24.m0[0].x | (u24.m0[u35.m0[1]].x - 1)) | (u24.m1 - 2)) | int(u24.m4[0u][0] - 3.0)) | int(u24.m4[1u][0] - 5.0)) | int(u24.m4[0u][1] - 4.0)) | int(u24.m4[1u][1] - 6.0)) | (((device t21*)u24.m2[0].x)->m0[0].x - 3)) | (((device t21*)u24.m2[0].x)->m0[u35.m0[1]].x - 4)) | (((device t21*)u24.m2[0].x)->m1 - 5)) | int(((device t21*)u24.m2[0].x)->m4[0u][0] - 6.0)) | int(((device t21*)u24.m2[0].x)->m4[1u][0] - 8.0)) | int(((device t21*)u24.m2[0].x)->m4[0u][1] - 7.0)) | int(((device t21*)u24.m2[0].x)->m4[1u][1] - 9.0)) | (((device t21*)u24.m2[u35.m0[1]].x)->m0[0].x - 6); - bool _289 = (((((((((((((_155 | (((device t21*)u24.m2[u35.m0[1]].x)->m0[u35.m0[1]].x - 7)) | (((device t21*)u24.m2[u35.m0[1]].x)->m1 - 8)) | int(((device t21*)u24.m2[u35.m0[1]].x)->m4[0u][0] - 9.0)) | int(((device t21*)u24.m2[u35.m0[1]].x)->m4[1u][0] - 11.0)) | int(((device t21*)u24.m2[u35.m0[1]].x)->m4[0u][1] - 10.0)) | int(((device t21*)u24.m2[u35.m0[1]].x)->m4[1u][1] - 12.0)) | (u24.m3->m0[0].x - 9)) | (u24.m3->m0[u35.m0[1]].x - 10)) | (u24.m3->m1 - 11)) | int(u24.m3->m4[0u][0] - 12.0)) | int(u24.m3->m4[1u][0] - 14.0)) | int(u24.m3->m4[0u][1] - 13.0)) | int(u24.m3->m4[1u][1] - 15.0)) != 0; + int _155 = (((((((((((((u24.m0[0].x | (u24.m0[u35.m0[1]].x - 1)) | (u24.m1 - 2)) | int(u24.m4[0u][0] - 3.0)) | int(u24.m4[1u][0] - 5.0)) | int(u24.m4[0u][1] - 4.0)) | int(u24.m4[1u][1] - 6.0)) | (((const device t21*)u24.m2[0].x)->m0[0].x - 3)) | (((const device t21*)u24.m2[0].x)->m0[u35.m0[1]].x - 4)) | (((const device t21*)u24.m2[0].x)->m1 - 5)) | int(((const device t21*)u24.m2[0].x)->m4[0u][0] - 6.0)) | int(((const device t21*)u24.m2[0].x)->m4[1u][0] - 8.0)) | int(((const device t21*)u24.m2[0].x)->m4[0u][1] - 7.0)) | int(((const device t21*)u24.m2[0].x)->m4[1u][1] - 9.0)) | (((const device t21*)u24.m2[u35.m0[1]].x)->m0[0].x - 6); + bool _289 = (((((((((((((_155 | (((const device t21*)u24.m2[u35.m0[1]].x)->m0[u35.m0[1]].x - 7)) | (((const device t21*)u24.m2[u35.m0[1]].x)->m1 - 8)) | int(((const device t21*)u24.m2[u35.m0[1]].x)->m4[0u][0] - 9.0)) | int(((const device t21*)u24.m2[u35.m0[1]].x)->m4[1u][0] - 11.0)) | int(((const device t21*)u24.m2[u35.m0[1]].x)->m4[0u][1] - 10.0)) | int(((const device t21*)u24.m2[u35.m0[1]].x)->m4[1u][1] - 12.0)) | (u24.m3->m0[0].x - 9)) | (u24.m3->m0[u35.m0[1]].x - 10)) | (u24.m3->m1 - 11)) | int(u24.m3->m4[0u][0] - 12.0)) | int(u24.m3->m4[1u][0] - 14.0)) | int(u24.m3->m4[0u][1] - 13.0)) | int(u24.m3->m4[1u][1] - 15.0)) != 0; v295.write(select(uint4(1u, 0u, 0u, 1u), uint4(0u), bool4(_289)), uint2(int2(gl_GlobalInvocationID.xy))); } diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp new file mode 100644 index 0000000000..988895684a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp @@ -0,0 +1,45 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvDescriptor +{ + T value; +}; + +template +struct spvDescriptorArray +{ + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } + const device T* ptr; +}; + +struct SSBOW +{ + char _m0_pad[4]; + float a; +}; + +struct SSBO +{ + float b; +}; + +kernel void main0(device void* spvBufferAliasSet0Binding0 [[buffer(0)]], device void* spvBufferAliasSet1Binding0 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + spvDescriptorArray RW {spvBufferAliasSet0Binding0}; + spvDescriptorArray RO {spvBufferAliasSet0Binding0}; + spvDescriptorArray> tex2d {spvBufferAliasSet1Binding0}; + spvDescriptorArray> tex3d {spvBufferAliasSet1Binding0}; + + RW[gl_WorkGroupID.x]->a = RO[gl_WorkGroupID.x]->b; + RW[0]->a += tex2d[gl_WorkGroupID.x].read(uint2(int2(0)), 0).x; + RW[0]->a += tex3d[gl_WorkGroupID.x].read(uint3(int3(10)), 1).x; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp new file mode 100644 index 0000000000..2fb023fa8c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp @@ -0,0 +1,51 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvBufferDescriptor; + +template +struct spvBufferDescriptor +{ + device T* value; + int length; + int padding; +}; + +template +struct spvDescriptorArray; + +template +struct spvDescriptorArray +{ + spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + device T* operator [] (size_t i) const { return ptr[i].value; } + int length(int i) const { return ptr[i].length; } + const device spvBufferDescriptor* ptr; +}; + +struct SSBOW +{ + char _m0_pad[4]; + float a; +}; + +struct SSBO +{ + float b; + float unsized[1]; +}; + +kernel void main0(device void* spvBufferAliasSet0Binding0 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + spvDescriptorArray RW {spvBufferAliasSet0Binding0}; + spvDescriptorArray RO {spvBufferAliasSet0Binding0}; + + RW[gl_WorkGroupID.x]->a = RO[gl_WorkGroupID.x]->b + float(int((RO.length(gl_WorkGroupID.x) - 4) / 4)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp new file mode 100644 index 0000000000..9f057a7b21 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp @@ -0,0 +1,41 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvDescriptor +{ + T value; +}; + +template +struct spvDescriptorArray +{ + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } + const device T* ptr; +}; + +struct SSBOW +{ + char _m0_pad[4]; + float a; +}; + +struct SSBO +{ + float b; +}; + +kernel void main0(device const void* spvDescriptorSet1Binding0 [[buffer(0)]], device const void* spvDescriptorSet0Binding0 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + spvDescriptorArray RW {spvDescriptorSet1Binding0}; + spvDescriptorArray RO {spvDescriptorSet0Binding0}; + + RW[gl_WorkGroupID.x]->a = RO[gl_WorkGroupID.x]->b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/culling.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/culling.comp index 55735475a7..484461e247 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/culling.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/culling.comp @@ -23,7 +23,7 @@ struct SSBO3 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); -kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float _28 = _22.in_data[gl_GlobalInvocationID.x]; if (_28 > 12.0) diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/dowhile.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/dowhile.comp index b503c948ad..04dfbdd43e 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/dowhile.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/dowhile.comp @@ -16,7 +16,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 _59; int _60; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/extended-shuffle-types.msl23.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/extended-shuffle-types.msl23.comp new file mode 100644 index 0000000000..16ec0292ef --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/extended-shuffle-types.msl23.comp @@ -0,0 +1,96 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return simd_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!simd_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)simd_shuffle((vec)value, lane); +} + +template<> +inline ulong spvSubgroupShuffle(ulong value, ushort lane) +{ + return as_type(spvSubgroupShuffle(as_type(value), lane)); +} + +template<> +inline ulong2 spvSubgroupShuffle(ulong2 value, ushort lane) +{ + return ulong2(spvSubgroupShuffle(value.x, lane), spvSubgroupShuffle(value.y, lane)); +} + +inline ulong3 spvSubgroupShuffle(ulong3 value, ushort lane) +{ + return ulong3(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.z, lane)); +} + +inline ulong4 spvSubgroupShuffle(ulong4 value, ushort lane) +{ + return ulong4(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.zw, lane)); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return vec(spvSubgroupShuffle(vec(value), lane)); +} + +struct SSBO +{ + uchar u8_1[4]; + char2 i8_2[4]; + uchar3 u8_3[4]; + char4 i8_4[4]; + ushort u16_1[4]; + short2 i16_2[4]; + ushort3 u16_3[4]; + short4 i16_4[4]; + half f16_1[4]; + half2 f16_2[4]; + half3 f16_3[4]; + half4 f16_4[4]; + ulong u64_1[4]; + long2 i64_2[4]; + ulong3 u64_3[4]; + long4 i64_4[4]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(device SSBO& _53 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + uint _232 = gl_SubgroupInvocationID ^ 1u; + _53.u8_1[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u8_1[gl_LocalInvocationIndex], _232); + _53.i8_2[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i8_2[gl_LocalInvocationIndex], _232); + _53.u8_3[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u8_3[gl_LocalInvocationIndex], _232); + _53.i8_4[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i8_4[gl_LocalInvocationIndex], _232); + _53.u16_1[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u16_1[gl_LocalInvocationIndex], _232); + _53.i16_2[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i16_2[gl_LocalInvocationIndex], _232); + _53.u16_3[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u16_3[gl_LocalInvocationIndex], _232); + _53.i16_4[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i16_4[gl_LocalInvocationIndex], _232); + _53.u64_1[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u64_1[gl_LocalInvocationIndex], _232); + _53.i64_2[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i64_2[gl_LocalInvocationIndex], _232); + _53.u64_3[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u64_3[gl_LocalInvocationIndex], _232); + _53.i64_4[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i64_4[gl_LocalInvocationIndex], _232); + _53.f16_1[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.f16_1[gl_LocalInvocationIndex], _232); + _53.f16_2[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.f16_2[gl_LocalInvocationIndex], _232); + _53.f16_3[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.f16_3[gl_LocalInvocationIndex], _232); + _53.f16_4[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.f16_4[gl_LocalInvocationIndex], _232); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp index 0a1d298b0d..cfef152b70 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp @@ -121,7 +121,7 @@ struct MatrixIn constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device MatrixOut& _15 [[buffer(0)]], const device MatrixIn& _20 [[buffer(1)]]) +kernel void main0(device MatrixOut& _15 [[buffer(0)]], device MatrixIn& _20 [[buffer(1)]]) { _15.m2out = spvInverse2x2(_20.m2in); _15.m3out = spvInverse3x3(_20.m3in); diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.comp index 90d105bd8c..7e077b7b58 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.comp @@ -8,20 +8,20 @@ struct recurs; struct recurs { int m1; - device recurs* m2; + const device recurs* m2; }; struct recurs_1 { int m1; - device recurs_1* m2; + const device recurs_1* m2; }; constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); struct spvDescriptorSetBuffer0 { - device recurs* nums [[id(0)]]; + const device recurs* nums [[id(0)]]; texture2d tex [[id(1)]]; }; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.comp index 9e8c4bf0b0..af80001182 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.comp @@ -8,20 +8,20 @@ struct recurs; struct recurs { int m1; - device recurs* m2; + const device recurs* m2; }; struct recurs_1 { int m1; - device recurs_1* m2; + const device recurs_1* m2; }; constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device void* nums_vp [[buffer(0)]], texture2d tex [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(const device void* nums_vp [[buffer(0)]], texture2d tex [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { - device auto& nums = *(device recurs*)nums_vp; + const device auto& nums = *(const device recurs*)nums_vp; tex.write(uint4(uint((nums.m1 + nums.m2->m1) + nums.m2->m2->m1), 0u, 0u, 1u), uint2(int2(gl_GlobalInvocationID.xy))); } diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/mod.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/mod.comp index 515ff84d06..2e6b8a8c0e 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/mod.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/mod.comp @@ -32,7 +32,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 _29 = _23.in_data[gl_GlobalInvocationID.x]; _33.out_data[gl_GlobalInvocationID.x] = mod(_29, _33.out_data[gl_GlobalInvocationID.x]); diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/modf.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/modf.comp index 018e8fbeab..46335fcdcb 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/modf.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/modf.comp @@ -21,7 +21,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { ResType _32; _32._m0 = modf(_23.in_data[gl_GlobalInvocationID.x], _32._m1); diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/outer-product.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/outer-product.comp index 8e47519c41..9fd01e13b9 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/outer-product.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/outer-product.comp @@ -25,7 +25,7 @@ struct ReadSSBO constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device SSBO& _21 [[buffer(0)]], const device ReadSSBO& _26 [[buffer(1)]]) +kernel void main0(device SSBO& _21 [[buffer(0)]], device ReadSSBO& _26 [[buffer(1)]]) { float2 _29 = _26.v2; _21.m22 = float2x2(_29 * _29.x, _29 * _29.y); diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/overlapping-bindings.msl31.argument.argument-tier-1.decoration-binding.device-argument-buffer.texture-buffer-native.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/overlapping-bindings.msl31.argument.argument-tier-1.decoration-binding.device-argument-buffer.texture-buffer-native.comp index 573c4f2dad..41b59646b5 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/overlapping-bindings.msl31.argument.argument-tier-1.decoration-binding.device-argument-buffer.texture-buffer-native.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/overlapping-bindings.msl31.argument.argument-tier-1.decoration-binding.device-argument-buffer.texture-buffer-native.comp @@ -15,13 +15,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -82,7 +78,7 @@ struct spvDescriptorSetBuffer0 struct spvDescriptorSetBuffer1 { - spvDescriptor b30 [[id(0)]][1] /* unsized array hack */; + spvDescriptor b30 [[id(0)]][1] /* unsized array hack */; // Overlapping binding: spvDescriptor b31 [[id(0)]][1] /* unsized array hack */; // Overlapping binding: spvDescriptor> t31 [[id(0)]][1] /* unsized array hack */; // Overlapping binding: spvDescriptor> t32 [[id(0)]][1] /* unsized array hack */; @@ -91,7 +87,7 @@ struct spvDescriptorSetBuffer1 struct spvDescriptorSetBuffer2 { - device B20* b20 [[id(0)]][8]; + const device B20* b20 [[id(0)]][8]; // Overlapping binding: constant B21* b21 [[id(0)]][8]; // Overlapping binding: array, 8> t21 [[id(0)]]; // Overlapping binding: array, 8> t22 [[id(0)]]; @@ -100,14 +96,14 @@ struct spvDescriptorSetBuffer2 struct spvDescriptorSetBuffer3 { - device B10* b10 [[id(0)]][8]; + const device B10* b10 [[id(0)]][8]; // Overlapping binding: constant B11* b11 [[id(0)]][8]; // Overlapping binding: array, 8> u1 [[id(0)]]; }; struct spvDescriptorSetBuffer4 { - device B40* b40 [[id(0)]]; + const device B40* b40 [[id(0)]]; // Overlapping binding: constant B41* b41 [[id(0)]]; // Overlapping binding: texture2d t41 [[id(0)]]; // Overlapping binding: texture2d t42 [[id(0)]]; @@ -116,7 +112,7 @@ struct spvDescriptorSetBuffer4 kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]], constant spvDescriptorSetBuffer3& spvDescriptorSet3 [[buffer(3)]], constant spvDescriptorSetBuffer4& spvDescriptorSet4 [[buffer(4)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { - spvDescriptorArray b30 {spvDescriptorSet1.b30}; + spvDescriptorArray b30 {spvDescriptorSet1.b30}; spvDescriptorArray> t31 {reinterpret_cast>*>(&spvDescriptorSet1.b30)}; spvDescriptorArray> t32 {reinterpret_cast>*>(&spvDescriptorSet1.b30)}; spvDescriptorArray b31 {reinterpret_cast const device *>(&spvDescriptorSet1.b30)}; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.decoration-binding.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.decoration-binding.comp index c26d322cb5..5ddd5a1dbb 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.decoration-binding.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.decoration-binding.comp @@ -93,27 +93,27 @@ struct spvDescriptorSetBuffer0 // Overlapping binding: constant UBO_D* ubo_d [[id(1)]]; device SSBO_As* ssbo_as [[id(2)]][4]; // Overlapping binding: device SSBO_Bs* ssbo_bs [[id(2)]][4]; - // Overlapping binding: const device SSBO_BsRO* ssbo_bs_readonly [[id(2)]][4]; + // Overlapping binding: device SSBO_BsRO* ssbo_bs_readonly [[id(2)]][4]; constant UBO_Cs* ubo_cs [[id(6)]][4]; // Overlapping binding: constant UBO_Ds* ubo_ds [[id(6)]][4]; device SSBO_A* ssbo_a [[id(10)]]; // Overlapping binding: device SSBO_B* ssbo_b [[id(10)]]; - // Overlapping binding: const device SSBO_BRO* ssbo_b_readonly [[id(10)]]; + // Overlapping binding: device SSBO_BRO* ssbo_b_readonly [[id(10)]]; }; -kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding11 [[buffer(11)]], constant void* spvBufferAliasSet2Binding12 [[buffer(12)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding11 [[buffer(11)]], constant void* spvBufferAliasSet2Binding12 [[buffer(12)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { device auto& ssbo_e = *(device SSBO_E*)spvBufferAliasSet2Binding11; constant auto& ubo_g = *(constant UBO_G*)spvBufferAliasSet2Binding12; device auto& ssbo_f = *(device SSBO_F*)spvBufferAliasSet2Binding11; constant auto& ubo_h = *(constant UBO_H*)spvBufferAliasSet2Binding12; - const device auto& ssbo_i = *(const device SSBO_I*)spvBufferAliasSet2Binding11; + device auto& ssbo_i = *(device SSBO_I*)spvBufferAliasSet2Binding11; constant auto &ubo_d = *reinterpret_cast(spvDescriptorSet0.ubo_c); const device auto &ssbo_bs = reinterpret_cast(spvDescriptorSet0.ssbo_as); - const device auto &ssbo_bs_readonly = reinterpret_cast(spvDescriptorSet0.ssbo_as); + const device auto &ssbo_bs_readonly = reinterpret_cast(spvDescriptorSet0.ssbo_as); const device auto &ubo_ds = reinterpret_cast(spvDescriptorSet0.ubo_cs); device auto &ssbo_b = *reinterpret_cast(spvDescriptorSet0.ssbo_a); - const device auto &ssbo_b_readonly = *reinterpret_cast(spvDescriptorSet0.ssbo_a); + device auto &ssbo_b_readonly = *reinterpret_cast(spvDescriptorSet0.ssbo_a); (*spvDescriptorSet0.ssbo_a).data[gl_GlobalInvocationID.x] = (*spvDescriptorSet0.ubo_c).data[gl_WorkGroupID.x].x + _42.reg; ssbo_b.data[gl_GlobalInvocationID.x] = ubo_d.data[gl_WorkGroupID.y].xy + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; spvDescriptorSet0.ssbo_as[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = spvDescriptorSet0.ubo_cs[gl_WorkGroupID.x]->data[0].x; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.descriptor-binding.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.descriptor-binding.comp index ed4aebba18..a1fdbbe872 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.descriptor-binding.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.descriptor-binding.comp @@ -91,12 +91,12 @@ struct spvDescriptorSetBuffer0 constant UBO_C* ubo_c [[id(1)]]; device SSBO_B* ssbo_b [[id(2)]]; constant UBO_D* ubo_d [[id(3)]]; - const device SSBO_BRO* ssbo_b_readonly [[id(4)]]; + device SSBO_BRO* ssbo_b_readonly [[id(4)]]; device SSBO_As* ssbo_as [[id(5)]][4]; constant UBO_Cs* ubo_cs [[id(9)]][4]; device SSBO_Bs* ssbo_bs [[id(13)]][4]; constant UBO_Ds* ubo_ds [[id(17)]][4]; - const device SSBO_BsRO* ssbo_bs_readonly [[id(21)]][4]; + device SSBO_BsRO* ssbo_bs_readonly [[id(21)]][4]; }; kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding0 [[buffer(2)]], constant void* spvBufferAliasSet2Binding1 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) @@ -105,7 +105,7 @@ kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0 constant auto& ubo_g = *(constant UBO_G*)spvBufferAliasSet2Binding1; device auto& ssbo_f = *(device SSBO_F*)spvBufferAliasSet2Binding0; constant auto& ubo_h = *(constant UBO_H*)spvBufferAliasSet2Binding1; - const device auto& ssbo_i = *(const device SSBO_I*)spvBufferAliasSet2Binding0; + device auto& ssbo_i = *(device SSBO_I*)spvBufferAliasSet2Binding0; (*spvDescriptorSet0.ssbo_a).data[gl_GlobalInvocationID.x] = (*spvDescriptorSet0.ubo_c).data[gl_WorkGroupID.x].x + _42.reg; (*spvDescriptorSet0.ssbo_b).data[gl_GlobalInvocationID.x] = (*spvDescriptorSet0.ubo_d).data[gl_WorkGroupID.y].xy + (*spvDescriptorSet0.ssbo_b_readonly).data[gl_GlobalInvocationID.x]; spvDescriptorSet0.ssbo_as[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = spvDescriptorSet0.ubo_cs[gl_WorkGroupID.x]->data[0].x; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/read-write-only.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/read-write-only.comp index 9174b5290d..4f825aa6b0 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/read-write-only.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/read-write-only.comp @@ -23,7 +23,7 @@ struct SSBO1 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device SSBO2& __restrict _10 [[buffer(0)]], const device SSBO0& _15 [[buffer(1)]], device SSBO1& __restrict _21 [[buffer(2)]]) +kernel void main0(device SSBO2& __restrict _10 [[buffer(0)]], device SSBO0& _15 [[buffer(1)]], device SSBO1& __restrict _21 [[buffer(2)]]) { _10.data4 = _15.data0 + _21.data2; _10.data5 = _15.data1 + _21.data3; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shader_group_vote.msl21.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shader_group_vote.msl21.comp index f7e708d580..f629f85e13 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shader_group_vote.msl21.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shader_group_vote.msl21.comp @@ -30,7 +30,7 @@ struct inputData constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); -kernel void main0(device inputData& _12 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +kernel void main0(const device inputData& _12 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) { bool _31 = _12.inputDataArray[gl_LocalInvocationID.x] > 0.0; } diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-zero-init-simple.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-zero-init-simple.comp index eee0587b67..2ea6c5ace2 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-zero-init-simple.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-zero-init-simple.comp @@ -17,7 +17,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); -kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { threadgroup float sShared; { diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-zero-init.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-zero-init.comp index 41b41d7492..8b476a433b 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-zero-init.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-zero-init.comp @@ -58,7 +58,7 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); constant spvUnsafeArray _31 = spvUnsafeArray({ 0.0, 0.0, 0.0, 0.0 }); -kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _48 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _48 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { threadgroup spvUnsafeArray sShared; { diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared.comp index aefe89488c..430ceddd6d 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared.comp @@ -56,7 +56,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); -kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { threadgroup spvUnsafeArray sShared; sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x]; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-layout.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-layout.comp index 0445f5aef9..1690588056 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-layout.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-layout.comp @@ -20,7 +20,7 @@ struct SSBO constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device SSBO2& _23 [[buffer(0)]], const device SSBO& _30 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO2& _23 [[buffer(0)]], device SSBO& _30 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { _23.out_data[gl_GlobalInvocationID.x].m = _30.in_data[gl_GlobalInvocationID.x].m * _30.in_data[gl_GlobalInvocationID.x].m; } diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/torture-loop.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/torture-loop.comp index ff7e02e202..ce38b779ad 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/comp/torture-loop.comp +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/torture-loop.comp @@ -16,7 +16,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 _101; _101 = _24.in_data[gl_GlobalInvocationID.x]; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/argument-buffers.msl2.argument.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/argument-buffers.msl2.argument.frag index bdf9080bd2..b0ae71ca19 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/frag/argument-buffers.msl2.argument.frag +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/argument-buffers.msl2.argument.frag @@ -41,7 +41,7 @@ struct spvDescriptorSetBuffer1 { array, 4> uTexture2 [[id(0)]]; array uSampler [[id(4)]]; - device SSBO* m_60 [[id(6)]]; + const device SSBO* m_60 [[id(6)]]; const device SSBOs* ssbos [[id(7)]][2]; }; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/complex-expression-in-access-chain.frag index 80a02c4f99..ca94847e9a 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/frag/complex-expression-in-access-chain.frag +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/complex-expression-in-access-chain.frag @@ -29,7 +29,7 @@ struct main0_in int vIn2 [[user(locn1)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], device UBO& _34 [[buffer(0)]], texture2d Buf [[texture(0)]], sampler BufSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +fragment main0_out main0(main0_in in [[stage_in]], const device UBO& _34 [[buffer(0)]], texture2d Buf [[texture(0)]], sampler BufSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; int _40 = spvSMod(Buf.read(uint2(int2(gl_FragCoord.xy)), 0).x, 16); diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/fp16-trancendentals.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/fp16-trancendentals.frag index a661433e17..4680868396 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/frag/fp16-trancendentals.frag +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/fp16-trancendentals.frag @@ -7,12 +7,14 @@ struct main0_out { half C [[color(0)]]; half D [[color(1)]]; + half3 o3 [[color(2)]]; }; struct main0_in { half A [[user(locn0)]]; half B [[user(locn1)]]; + half3 v3 [[user(locn2)]]; }; fragment main0_out main0(main0_in in [[stage_in]]) @@ -31,11 +33,11 @@ fragment main0_out main0(main0_in in [[stage_in]]) out.D += out.C; out.C = clamp(atan(in.A), in.A, in.B); out.D += out.C; - out.C = clamp(half(fast::sinh(in.A)), in.A, in.B); + out.C = clamp(half(fast::sinh(float(in.A))), in.A, in.B); out.D += out.C; - out.C = clamp(half(fast::cosh(in.A)), in.A, in.B); + out.C = clamp(half(fast::cosh(float(in.A))), in.A, in.B); out.D += out.C; - out.C = clamp(half(fast::tanh(in.A)), in.A, in.B); + out.C = clamp(half(fast::tanh(float(in.A))), in.A, in.B); out.D += out.C; out.C = clamp(asinh(in.A), in.A, in.B); out.D += out.C; @@ -43,7 +45,7 @@ fragment main0_out main0(main0_in in [[stage_in]]) out.D += out.C; out.C = clamp(atanh(in.A), in.A, in.B); out.D += out.C; - out.C = clamp(half(fast::atan2(in.A, in.B)), in.A, in.B); + out.C = clamp(half(fast::atan2(float(in.A), float(in.B))), in.A, in.B); out.D += out.C; out.C = clamp(powr(in.A, in.B), in.A, in.B); out.D += out.C; @@ -59,6 +61,26 @@ fragment main0_out main0(main0_in in [[stage_in]]) out.D += out.C; out.C = clamp(rsqrt(in.A), in.A, in.B); out.D += out.C; + out.o3 = half3(fast::sinh(float3(in.v3))); + out.o3 += half3(fast::cosh(float3(in.v3))); + out.o3 += half3(fast::tanh(float3(in.v3))); + out.o3 += sin(in.v3); + out.o3 += cos(in.v3); + out.o3 += tan(in.v3); + out.o3 += asin(in.v3); + out.o3 += acos(in.v3); + out.o3 += atan(in.v3); + out.o3 += asinh(in.v3); + out.o3 += acosh(in.v3); + out.o3 += atanh(in.v3); + out.o3 += half3(fast::atan2(float3(out.o3), float3(in.v3))); + out.o3 += powr(out.o3, in.v3); + out.o3 += exp(in.v3); + out.o3 += exp2(in.v3); + out.o3 += log(in.v3); + out.o3 += log2(in.v3); + out.o3 += sqrt(in.v3); + out.o3 += rsqrt(in.v3); return out; } diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/runtime_array_as_argument_buffer.msl3.argument-tier-1.rich-descriptor.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/runtime_array_as_argument_buffer.msl3.argument-tier-1.rich-descriptor.frag index 48eddae505..91a9796bf1 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/frag/runtime_array_as_argument_buffer.msl3.argument-tier-1.rich-descriptor.frag +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/runtime_array_as_argument_buffer.msl3.argument-tier-1.rich-descriptor.frag @@ -40,47 +40,32 @@ struct spvDescriptor }; template -struct spvBufferDescriptor +struct spvBufferDescriptor; + +template +struct spvBufferDescriptor { - T value; + device T* value; int length; - const device T& operator -> () const device - { - return value; - } - const device T& operator * () const device - { - return value; - } + int padding; }; template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; template struct spvDescriptorArray { - spvDescriptorArray(const device spvBufferDescriptor* ptr) : ptr(ptr) - { - } - const device T* operator [] (size_t i) const - { - return ptr[i].value; - } - const int length(int i) const - { - return ptr[i].length; - } + spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + device T* operator [] (size_t i) const { return ptr[i].value; } + int length(int i) const { return ptr[i].length; } const device spvBufferDescriptor* ptr; }; @@ -100,16 +85,16 @@ struct main0_in uint inputId [[user(locn0)]]; }; -fragment void main0(main0_in in [[stage_in]], const device spvBufferDescriptor* ssbo_ [[buffer(4)]], const device spvDescriptor* ubo_ [[buffer(5)]], const device spvDescriptor>* smp_textures_ [[buffer(0)]], const device spvDescriptor>* textures_ [[buffer(2)]], const device spvDescriptor>* images_ [[buffer(6)]], const device spvDescriptor* smp_texturesSmplr_ [[buffer(1)]], const device spvDescriptor* smp_ [[buffer(3)]], const device spvDescriptor>* tlas_ [[buffer(7)]]) +fragment void main0(main0_in in [[stage_in]], device const void* spvDescriptorSet0Binding3 [[buffer(4)]], device const void* spvDescriptorSet0Binding4 [[buffer(5)]], device const void* spvDescriptorSet0Binding0 [[buffer(0)]], device const void* spvDescriptorSet0Binding2 [[buffer(2)]], device const void* spvDescriptorSet0Binding5 [[buffer(6)]], device const void* spvDescriptorSet0Binding0Smplr [[buffer(1)]], device const void* spvDescriptorSet0Binding1 [[buffer(3)]], device const void* spvDescriptorSet0Binding6 [[buffer(7)]]) { - spvDescriptorArray> smp_textures {smp_textures_}; - spvDescriptorArray smp_texturesSmplr {smp_texturesSmplr_}; - spvDescriptorArray> textures {textures_}; - spvDescriptorArray smp {smp_}; - spvDescriptorArray ssbo {ssbo_}; - spvDescriptorArray ubo {ubo_}; - spvDescriptorArray> images {images_}; - spvDescriptorArray> tlas {tlas_}; + spvDescriptorArray> smp_textures {spvDescriptorSet0Binding0}; + spvDescriptorArray smp_texturesSmplr {spvDescriptorSet0Binding0Smplr}; + spvDescriptorArray> textures {spvDescriptorSet0Binding2}; + spvDescriptorArray smp {spvDescriptorSet0Binding1}; + spvDescriptorArray ssbo {spvDescriptorSet0Binding3}; + spvDescriptorArray ubo {spvDescriptorSet0Binding4}; + spvDescriptorArray> images {spvDescriptorSet0Binding5}; + spvDescriptorArray> tlas {spvDescriptorSet0Binding6}; uint _231 = in.inputId; raytracing::intersection_query rayQuery; diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/runtime_array_as_argument_buffer_buf.msl3.argument-tier-1.rich-descriptor.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/runtime_array_as_argument_buffer_buf.msl3.argument-tier-1.rich-descriptor.frag index 8651782008..0dfe5955cb 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/frag/runtime_array_as_argument_buffer_buf.msl3.argument-tier-1.rich-descriptor.frag +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/runtime_array_as_argument_buffer_buf.msl3.argument-tier-1.rich-descriptor.frag @@ -6,18 +6,14 @@ using namespace metal; template -struct spvBufferDescriptor +struct spvBufferDescriptor; + +template +struct spvBufferDescriptor { - T value; + device T* value; int length; - const device T& operator -> () const device - { - return value; - } - const device T& operator * () const device - { - return value; - } + int padding; }; template @@ -26,17 +22,10 @@ struct spvDescriptorArray; template struct spvDescriptorArray { - spvDescriptorArray(const device spvBufferDescriptor* ptr) : ptr(ptr) - { - } - const device T* operator [] (size_t i) const - { - return ptr[i].value; - } - const int length(int i) const - { - return ptr[i].length; - } + spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + device T* operator [] (size_t i) const { return ptr[i].value; } + int length(int i) const { return ptr[i].length; } const device spvBufferDescriptor* ptr; }; @@ -51,9 +40,9 @@ struct main0_in uint inputId [[user(locn0)]]; }; -fragment void main0(main0_in in [[stage_in]], const device spvBufferDescriptor* ssbo_ [[buffer(0)]]) +fragment void main0(main0_in in [[stage_in]], device const void* spvDescriptorSet0Binding0 [[buffer(0)]]) { - spvDescriptorArray ssbo {ssbo_}; + spvDescriptorArray ssbo {spvDescriptorSet0Binding0}; uint _15 = in.inputId; if (ssbo[_15]->val == 2u) diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..c62e16fd4f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,113 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float3 ov [[color(0)]]; +}; + +struct main0_in +{ + float3 iv [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; +#line 137 "test.frag" +#line 106 "test.frag" + bool _288 = in.iv.x < 0.0; + if (_288) + { +#line 107 "test.frag" + out.ov.x = 50.0; + } + else + { +#line 109 "test.frag" + out.ov.x = 60.0; + } +#line 114 "test.frag" + for (int _519 = 0; _519 < 4; _519++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + out.ov.x = 50.0; + } + else + { +#line 109 "test.frag" + out.ov.x = 60.0; + } +#line 117 "test.frag" + if (in.iv.y < 0.0) + { +#line 118 "test.frag" + out.ov.y = 70.0; + } + else + { +#line 120 "test.frag" + out.ov.y = 80.0; + } + } +#line 126 "test.frag" + for (int _523 = 0; _523 < 4; _523++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + out.ov.x = 50.0; + } + else + { +#line 109 "test.frag" + out.ov.x = 60.0; + } +#line 114 "test.frag" + for (int _527 = 0; _527 < 4; _527++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + out.ov.x = 50.0; + } + else + { +#line 109 "test.frag" + out.ov.x = 60.0; + } +#line 117 "test.frag" + if (in.iv.y < 0.0) + { +#line 118 "test.frag" + out.ov.y = 70.0; + } + else + { +#line 120 "test.frag" + out.ov.y = 80.0; + } + } +#line 130 "test.frag" + if (in.iv.z < 0.0) + { +#line 131 "test.frag" + out.ov.z = 100.0; + } + else + { +#line 133 "test.frag" + out.ov.z = 120.0; + } + } +#line 142 "test.frag" + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/no_pointsize.default-point-size.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/no_pointsize.default-point-size.tese new file mode 100644 index 0000000000..5670a02007 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/no_pointsize.default-point-size.tese @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(1.0); + out.gl_PointSize = 1.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/buffer_device_address.msl2.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/buffer_device_address.msl2.vert index 5cca237933..76a00d3260 100644 --- a/third_party/spirv-cross/reference/opt/shaders-msl/vert/buffer_device_address.msl2.vert +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/buffer_device_address.msl2.vert @@ -24,12 +24,12 @@ struct Position struct Registers { float4x4 view_projection; - device PositionReferences* references; + const device PositionReferences* references; }; struct PositionReferences { - device Position* buffers[1]; + const device Position* buffers[1]; }; struct main0_out diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert new file mode 100644 index 0000000000..bee0dc44d7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct BlockIO +{ + float v; +}; + +struct main0_out +{ + float outBlock_v; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + BlockIO outBlock = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + outBlock.v = 1.0; + out.outBlock_v = outBlock.v; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag index 77bbf57466..e769a70d80 100644 --- a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag @@ -253,7 +253,7 @@ fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_G float _448; if (_248) { - float4 _260 = SSProfilesTexture.read(uint2(int3(1, int(uint((select(float4(0.0), SceneTexturesStruct_GBufferDTexture.sample(SceneTexturesStruct_GBufferDTextureSampler, _114, level(0.0)), bool4(!(((_240 & 4294967280u) & 16u) != 0u))).x * 255.0) + 0.5)), 0).xy), 0); + float4 _260 = SSProfilesTexture.read(uint2(int3(1, int(uint((select(float4(0.0), SceneTexturesStruct_GBufferDTexture.sample(SceneTexturesStruct_GBufferDTextureSampler, _114, level(0.0)), bool4(!((_240 & 16u) != 0u))).x * 255.0) + 0.5)), 0).xy), 0); float _263 = _260.y * 0.5; float3 _266 = _148 - (_236 * float3(_263)); float _274 = powr(fast::clamp(dot(-(_152 * float3(rsqrt(dot(_152, _152)))), _236), 0.0, 1.0), 1.0); diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc index c2d047a7c5..15cb367634 100644 --- a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc @@ -298,7 +298,7 @@ struct main0_in float4 in_var_VS_To_DS_Position [[attribute(7)]]; }; -kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) { threadgroup spvUnsafeArray temp_var_hullMainRetVal; device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/hlsl-functionality.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/hlsl-functionality.asm.comp index d30cddafec..22067e773c 100644 --- a/third_party/spirv-cross/reference/opt/shaders/asm/comp/hlsl-functionality.asm.comp +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/hlsl-functionality.asm.comp @@ -1,16 +1,16 @@ #version 450 layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -layout(binding = 0, std430) buffer Buf -{ - vec4 _data[]; -} Buf_1; - layout(binding = 1, std430) buffer Buf_count { int _count; } Buf_count_1; +layout(binding = 0, std430) buffer Buf +{ + vec4 _data[]; +} Buf_1; + void main() { int _33 = atomicAdd(Buf_count_1._count, 1); diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp.vk b/third_party/spirv-cross/reference/opt/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp.vk new file mode 100644 index 0000000000..a3980e1bd4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp.vk @@ -0,0 +1,44 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif +#extension GL_EXT_shader_16bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require +#extension GL_NV_cooperative_vector : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer Q +{ + float16_t data_q[]; +} _15; + +void main() +{ + coopvecNV _20; + coopVecLoadNV(_20, _15.data_q, 16u); + coopvecNV tempArg = _20; + coopvecNV inVec = tempArg; + coopVecStoreNV(inVec, _15.data_q, 16u); + coopvecNV _33; + coopVecMatMulAddNV(_33, inVec, gl_ComponentTypeFloat16NV, _15.data_q, 16u, gl_ComponentTypeFloat16NV, _15.data_q, 16u, gl_ComponentTypeFloat16NV, 16u, 16u, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, false, 2u); + coopvecNV tempArg_1 = _33; + inVec = tempArg_1; + coopvecNV _38; + coopVecMatMulNV(_38, inVec, gl_ComponentTypeFloat16NV, _15.data_q, 16u, gl_ComponentTypeFloat16NV, 16u, 16u, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, false, 2u); + coopvecNV tempArg_2 = _38; + inVec = tempArg_2; + coopvecNV a = coopvecNV(float16_t(0.0)); + inVec = max(inVec, inVec); + inVec[5] = inVec[3] + inVec[4]; + coopVecOuterProductAccumulateNV(inVec, inVec, _15.data_q, 0u, 0u, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, gl_ComponentTypeFloat16NV); + coopVecReduceSumAccumulateNV(inVec, _15.data_q, 0u); + coopvecNV a_8bit = coopvecNV(int8_t(0)); + coopvecNV b_32bit = coopvecNV(0); + b_32bit = (max((coopvecNV(a_8bit)), b_32bit)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/reference/opt/shaders/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..91baf60f9f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,102 @@ +#version 450 +#extension GL_GOOGLE_cpp_style_line_directive : require + +layout(location = 0) in vec3 iv; +layout(location = 0) out vec3 ov; + +void main() +{ +#line 137 "test.frag" +#line 106 "test.frag" + bool _288 = iv.x < 0.0; + if (_288) + { +#line 107 "test.frag" + ov.x = 50.0; + } + else + { +#line 109 "test.frag" + ov.x = 60.0; + } +#line 114 "test.frag" + for (int _519 = 0; _519 < 4; _519++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + ov.x = 50.0; + } + else + { +#line 109 "test.frag" + ov.x = 60.0; + } +#line 117 "test.frag" + if (iv.y < 0.0) + { +#line 118 "test.frag" + ov.y = 70.0; + } + else + { +#line 120 "test.frag" + ov.y = 80.0; + } + } +#line 126 "test.frag" + for (int _523 = 0; _523 < 4; _523++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + ov.x = 50.0; + } + else + { +#line 109 "test.frag" + ov.x = 60.0; + } +#line 114 "test.frag" + for (int _527 = 0; _527 < 4; _527++) + { +#line 106 "test.frag" + if (_288) + { +#line 107 "test.frag" + ov.x = 50.0; + } + else + { +#line 109 "test.frag" + ov.x = 60.0; + } +#line 117 "test.frag" + if (iv.y < 0.0) + { +#line 118 "test.frag" + ov.y = 70.0; + } + else + { +#line 120 "test.frag" + ov.y = 80.0; + } + } +#line 130 "test.frag" + if (iv.z < 0.0) + { +#line 131 "test.frag" + ov.z = 100.0; + } + else + { +#line 133 "test.frag" + ov.z = 120.0; + } + } +#line 142 "test.frag" +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp.vk new file mode 100644 index 0000000000..532c6578d5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp.vk @@ -0,0 +1,74 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_16bit_storage : require +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_EXT_shader_subgroup_extended_types_int8 : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_EXT_shader_subgroup_extended_types_int16 : require +#extension GL_EXT_shader_subgroup_extended_types_int64 : require +#extension GL_EXT_shader_subgroup_extended_types_float16 : require +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + uint8_t u8_1[4]; + i8vec2 i8_2[4]; + u8vec3 u8_3[4]; + i8vec4 i8_4[4]; + uint16_t u16_1[4]; + i16vec2 i16_2[4]; + u16vec3 u16_3[4]; + i16vec4 i16_4[4]; + float16_t f16_1[4]; + f16vec2 f16_2[4]; + f16vec3 f16_3[4]; + f16vec4 f16_4[4]; + double f64_1[4]; + double f64_2[4]; + double f64_3[4]; + double f64_4[4]; + uint64_t u64_1[4]; + i64vec2 i64_2[4]; + u64vec3 u64_3[4]; + i64vec4 i64_4[4]; +} _60; + +void main() +{ + mediump uint _277 = gl_SubgroupInvocationID ^ 1u; + _60.u8_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.u8_1[gl_LocalInvocationIndex], _277); + _60.i8_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.i8_2[gl_LocalInvocationIndex], _277); + _60.u8_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.u8_3[gl_LocalInvocationIndex], _277); + _60.i8_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.i8_4[gl_LocalInvocationIndex], _277); + _60.u16_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.u16_1[gl_LocalInvocationIndex], _277); + _60.i16_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.i16_2[gl_LocalInvocationIndex], _277); + _60.u16_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.u16_3[gl_LocalInvocationIndex], _277); + _60.i16_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.i16_4[gl_LocalInvocationIndex], _277); + _60.u64_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.u64_1[gl_LocalInvocationIndex], _277); + _60.i64_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.i64_2[gl_LocalInvocationIndex], _277); + _60.u64_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.u64_3[gl_LocalInvocationIndex], _277); + _60.i64_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.i64_4[gl_LocalInvocationIndex], _277); + _60.f16_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.f16_1[gl_LocalInvocationIndex], _277); + _60.f16_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.f16_2[gl_LocalInvocationIndex], _277); + _60.f16_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.f16_3[gl_LocalInvocationIndex], _277); + _60.f16_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.f16_4[gl_LocalInvocationIndex], _277); + _60.f64_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.f64_1[gl_LocalInvocationIndex], _277); + _60.f64_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.f64_2[gl_LocalInvocationIndex], _277); + _60.f64_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.f64_3[gl_LocalInvocationIndex], _277); + _60.f64_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.f64_4[gl_LocalInvocationIndex], _277); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp.vk index 28ee076af5..841936fd12 100644 --- a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp.vk +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp.vk @@ -9,11 +9,12 @@ #extension GL_EXT_shader_16bit_storage : require #extension GL_KHR_cooperative_matrix : require #extension GL_KHR_memory_scope_semantics : require +#extension GL_NV_cooperative_vector : require layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(constant_id = 0) const float spec_const = 0.0; -const vec4 _29 = vec4(spec_const); -float _53; +const vec4 _33 = vec4(spec_const); +float _62; layout(set = 0, binding = 0, std140) uniform UBO { @@ -25,11 +26,13 @@ void main() vec4 a = vec4(0.0); mat4 b = mat4(vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0)); coopmat matrix = coopmat(float16_t(0.0)); - vec4 c = _29; - vec4 _44 = vec4(ubo.uniform_float); - vec4 d = _44; - mat4 e = mat4(_44, _44, _44, _44); - float16_t _51 = float16_t(ubo.uniform_float); - coopmat matrix2 = coopmat(_51); + coopvecNV vec = coopvecNV(float16_t(0.0)); + vec4 c = _33; + vec4 _48 = vec4(ubo.uniform_float); + vec4 d = _48; + mat4 e = mat4(_48, _48, _48, _48); + float16_t _55 = float16_t(ubo.uniform_float); + coopmat matrix2 = coopmat(_55); + coopvecNV vec_dynamic = coopvecNV(_55); } diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/block-match-sad.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/block-match-sad.spv14.frag similarity index 100% rename from third_party/spirv-cross/reference/opt/shaders/vulkan/frag/block-match-sad.frag rename to third_party/spirv-cross/reference/opt/shaders/vulkan/frag/block-match-sad.spv14.frag diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/block-match-ssd.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/block-match-ssd.spv14.frag similarity index 100% rename from third_party/spirv-cross/reference/opt/shaders/vulkan/frag/block-match-ssd.frag rename to third_party/spirv-cross/reference/opt/shaders/vulkan/frag/block-match-ssd.spv14.frag diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/box-filter.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/box-filter.spv14.frag similarity index 100% rename from third_party/spirv-cross/reference/opt/shaders/vulkan/frag/box-filter.frag rename to third_party/spirv-cross/reference/opt/shaders/vulkan/frag/box-filter.spv14.frag diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag.vk new file mode 100644 index 0000000000..ceea048bce --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag.vk @@ -0,0 +1,22 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_EXT_ray_tracing_position_fetch : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT uAS; + +layout(location = 0) out vec3 o_color; +rayQueryEXT query; + +void main() +{ + rayQueryInitializeEXT(query, uAS, 4u, 255u, vec3(0.0), 0.00999999977648258209228515625, vec3(1.0, 0.0, 0.0), 1.0); + bool _32 = rayQueryProceedEXT(query); + uint _36 = rayQueryGetIntersectionTypeEXT(query, bool(1)); + if (_36 != 0u) + { + vec3 _45[3]; + rayQueryGetIntersectionTriangleVertexPositionsEXT(query, bool(1), _45); + o_color = (_45[0] + _45[1]) + _45[2]; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/sample-weighted.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/sample-weighted.spv14.frag similarity index 100% rename from third_party/spirv-cross/reference/opt/shaders/vulkan/frag/sample-weighted.frag rename to third_party/spirv-cross/reference/opt/shaders/vulkan/frag/sample-weighted.spv14.frag diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit.vk new file mode 100644 index 0000000000..fb207532f2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require +#extension GL_NV_cluster_acceleration_structure : require + +layout(location = 0) rayPayloadInEXT int payload; + +void main() +{ + payload = gl_ClusterIDNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp.vk new file mode 100644 index 0000000000..83e01a81c0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp.vk @@ -0,0 +1,64 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_NV_cluster_acceleration_structure : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std140) uniform Params +{ + uint ray_flags; + uint cull_mask; + vec3 origin; + float tmin; + vec3 dir; + float tmax; +} _18; + +layout(set = 0, binding = 2, std430) buffer SSBO +{ + int id; +} _68; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT AS; + +rayQueryEXT q; + +void main() +{ + rayQueryInitializeEXT(q, AS, _18.ray_flags, _18.cull_mask, _18.origin, _18.tmin, _18.dir, _18.tmax); + for (;;) + { + bool _47 = rayQueryProceedEXT(q); + if (_47) + { + uint _49 = rayQueryGetIntersectionTypeEXT(q, bool(0)); + bool _51 = _49 == 0u; + bool _57; + if (_51) + { + int _54 = rayQueryGetIntersectionClusterIdNV(q, bool(0)); + _57 = _54 != (-1); + } + else + { + _57 = _51; + } + if (_57) + { + rayQueryTerminateEXT(q); + rayQueryConfirmIntersectionEXT(q); + } + continue; + } + else + { + break; + } + } + uint _61 = rayQueryGetIntersectionTypeEXT(q, bool(1)); + if (_61 == 1u) + { + int _69 = rayQueryGetIntersectionClusterIdNV(q, bool(1)); + _68.id = _69; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..59e807235e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,12 @@ +#version 460 +#extension GL_EXT_ray_tracing : require +#extension GL_EXT_ray_tracing_position_fetch : require + +hitAttributeEXT vec2 attribs; +layout(location = 0) rayPayloadInEXT vec3 hitValue; + +void main() +{ + hitValue = ((gl_HitTriangleVertexPositionsEXT[0] * ((1.0 - attribs.x) - attribs.y)) + (gl_HitTriangleVertexPositionsEXT[1] * attribs.x)) + (gl_HitTriangleVertexPositionsEXT[2] * attribs.y); +} + diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.asm.frag new file mode 100644 index 0000000000..f51ab9b3a9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.asm.frag @@ -0,0 +1,109 @@ +struct StraddleResolve +{ + float3 A; + float3 B; + float3 C; + float3 D; +}; + +struct Test1 +{ + StraddleResolve a; + float b; +}; + +struct Test2 +{ + StraddleResolve a[2]; + float b; + StraddleResolve c[3][2]; + float d; +}; + +struct MatrixStraddle2x3c +{ + column_major float2x3 m; +}; + +struct MatrixStraddle2x3r +{ + row_major float2x3 m; +}; + +struct MatrixStraddle3x2c +{ + column_major float3x2 m; +}; + +struct MatrixStraddle3x2r +{ + row_major float3x2 m; +}; + +struct Test3 +{ + MatrixStraddle2x3c c23; + float dummy0; + MatrixStraddle2x3r r23; + float dummy1; + MatrixStraddle3x2c c32; + float dummy2; + MatrixStraddle3x2r r32; + float dummy3; +}; + +struct Test4 +{ + MatrixStraddle2x3c c23[2][3]; + float dummy0; + MatrixStraddle2x3r r23[2][3]; + float dummy1; +}; + +cbuffer type_Test1Cbuf : register(b0) +{ + Test1 Test1Cbuf_test1 : packoffset(c0); +}; + +cbuffer type_Test2Cbuf : register(b1) +{ + Test2 Test2Cbuf_test2 : packoffset(c0); +}; + +cbuffer type_Test3Cbuf : register(b2) +{ + Test3 Test3Cbuf_test3 : packoffset(c0); +}; + +cbuffer type_Test4Cbuf : register(b3) +{ + Test4 Test4Cbuf_test4 : packoffset(c0); +}; + + +static float4 in_var_COLOR; +static float4 out_var_SV_TARGET; + +struct SPIRV_Cross_Input +{ + float4 in_var_COLOR : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_TARGET : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_TARGET = (((in_var_COLOR + Test1Cbuf_test1.b.xxxx) + Test2Cbuf_test2.b.xxxx) + Test3Cbuf_test3.dummy0.xxxx) + Test4Cbuf_test4.dummy0.xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + in_var_COLOR = stage_input.in_var_COLOR; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_TARGET = out_var_SV_TARGET; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/basic.user-semantic.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/basic.user-semantic.asm.vert new file mode 100644 index 0000000000..c3c370b1ac --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/basic.user-semantic.asm.vert @@ -0,0 +1,30 @@ +static float4 gl_Position; +static float4 in_var_B; +static float4 out_var_A; + +struct SPIRV_Cross_Input +{ + float4 in_var_B : B; +}; + +struct SPIRV_Cross_Output +{ + float4 out_var_A : A; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + out_var_A = in_var_B; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + in_var_B = stage_input.in_var_B; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.out_var_A = out_var_A; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.comp new file mode 100644 index 0000000000..feb00ff499 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.comp @@ -0,0 +1,34 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +static const int A = SPIRV_CROSS_CONSTANT_ID_1; +static const uint _20 = (uint(A) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +static const uint _21 = SPIRV_CROSS_CONSTANT_ID_0; +static const uint3 gl_WorkGroupSize = uint3(_21, 1u, 1u); +static const uint _25 = gl_WorkGroupSize.x; +static const uint _26 = (_20 * _25); +static const uint _30 = (uint(A) + 0u); +static const uint _31 = gl_WorkGroupSize.x; +static const uint _32 = (_30 * _31); + +RWByteAddressBuffer _48 : register(u0); + +static float D[_32]; + +void comp_main() +{ + for (int i = 0; uint(i) < _26; i++) + { + D[i] = 1.0f + float(i); + } + _48.Store(4, asuint(D[int(_48.Load(0))] + D[int(_48.Load(0)) ^ 1])); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_0, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp new file mode 100644 index 0000000000..6fde9d515e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp @@ -0,0 +1,38 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +static const uint _7 = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +static const int A = SPIRV_CROSS_CONSTANT_ID_1; +static const uint _22 = (uint(A) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +static const uint _23 = SPIRV_CROSS_CONSTANT_ID_0; +static const uint3 _25 = uint3(_23, 1u, 1u); +static const uint _26 = _25.x; +static const uint _27 = (_22 * _26); +static const uint _31 = (uint(A) + 0u); +static const uint _32 = _25.x; +static const uint _33 = (_31 * _32); + +RWByteAddressBuffer _49 : register(u0); + +static float D[_33]; + +void comp_main() +{ + for (int i = 0; uint(i) < _27; i++) + { + D[i] = 1.0f + float(i); + } + _49.Store(4, asuint(D[int(_49.Load(0))] + D[int(_49.Load(0)) ^ 1])); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_0, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/query-lod-arrayed.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/query-lod-arrayed.frag new file mode 100644 index 0000000000..e779053413 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/query-lod-arrayed.frag @@ -0,0 +1,31 @@ +Texture2DArray uTex : register(t0); +SamplerState uSamp : register(s1); + +static float2 FragCoord; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + float2 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float2 FragCoord : SV_Target0; +}; + +void frag_main() +{ + float _23_tmp = uTex.CalculateLevelOfDetail(uSamp, vUV); + float2 _23 = _23_tmp.xx; + FragCoord = _23; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragCoord = FragCoord; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag new file mode 100644 index 0000000000..996d5f6fb3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag @@ -0,0 +1,21 @@ +globallycoherent RWStructuredBuffer TestBuffer : register(u0); + +static float4 out_var_SV_Target0; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target0 : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target0 = TestBuffer[0u]; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target0 = out_var_SV_Target0; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..f3784bca2c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,98 @@ +static float3 iv; +static float3 ov; + +struct SPIRV_Cross_Input +{ + float3 iv : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float3 ov : SV_Target0; +}; + +void func0() +{ +#line 104 "test.frag" +#line 106 "test.frag" + if (iv.x < 0.0f) + { +#line 107 "test.frag" + ov.x = 50.0f; + } + else + { +#line 109 "test.frag" + ov.x = 60.0f; + } +#line 110 "test.frag" +} + +void func1() +{ +#line 112 "test.frag" +#line 114 "test.frag" + for (int i = 0; i < 4; i++) + { +#line 116 "test.frag" + func0(); +#line 117 "test.frag" + if (iv.y < 0.0f) + { +#line 118 "test.frag" + ov.y = 70.0f; + } + else + { +#line 120 "test.frag" + ov.y = 80.0f; + } + } +#line 122 "test.frag" +} + +void func2() +{ +#line 124 "test.frag" +#line 126 "test.frag" + for (int i = 0; i < 4; i++) + { +#line 128 "test.frag" + func0(); +#line 129 "test.frag" + func1(); +#line 130 "test.frag" + if (iv.z < 0.0f) + { +#line 131 "test.frag" + ov.z = 100.0f; + } + else + { +#line 133 "test.frag" + ov.z = 120.0f; + } + } +#line 135 "test.frag" +} + +void frag_main() +{ +#line 137 "test.frag" +#line 139 "test.frag" + func0(); +#line 140 "test.frag" + func1(); +#line 141 "test.frag" + func2(); +#line 142 "test.frag" +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + iv = stage_input.iv; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.ov = ov; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/array-copy-physical-layout-mismatch.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/array-copy-physical-layout-mismatch.asm.comp new file mode 100644 index 0000000000..7d7cc4449b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/array-copy-physical-layout-mismatch.asm.comp @@ -0,0 +1,271 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack(thread T (&dst)[N], constant T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} +template +inline void spvArrayCopyFromConstantToStack(thread T (&dst)[N], constant vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = reinterpret_cast(src[i]); + } +} + +template +inline enable_if_t spvArrayCopyFromConstantToStack(thread vec (&dst)[N], constant vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = reinterpret_cast &>(src[i]); + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup(threadgroup T (&dst)[N], constant T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} +template +inline void spvArrayCopyFromConstantToThreadGroup(threadgroup T (&dst)[N], constant vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = reinterpret_cast(src[i]); + } +} + +template +inline enable_if_t spvArrayCopyFromConstantToThreadGroup(threadgroup vec (&dst)[N], constant vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = reinterpret_cast &>(src[i]); + } +} + +template +inline void spvArrayCopyFromStackToStack(thread T (&dst)[N], thread const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup(threadgroup T (&dst)[N], thread const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack(thread T (&dst)[N], threadgroup const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup(threadgroup T (&dst)[N], threadgroup const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice(device T (&dst)[N], device const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice(device T (&dst)[N], constant T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice(device T (&dst)[N], thread const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} +template +inline void spvArrayCopyFromStackToDevice(device vec (&dst)[N], thread const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + reinterpret_cast(dst[i]) = src[i]; + } +} + +template +inline enable_if_t spvArrayCopyFromStackToDevice(device vec (&dst)[N], thread const vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + reinterpret_cast &>(dst[i]) = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice(device T (&dst)[N], threadgroup const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} +template +inline void spvArrayCopyFromThreadGroupToDevice(device vec (&dst)[N], threadgroup const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + reinterpret_cast(dst[i]) = src[i]; + } +} + +template +inline enable_if_t spvArrayCopyFromThreadGroupToDevice(device vec (&dst)[N], threadgroup const vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + reinterpret_cast &>(dst[i]) = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack(thread T (&dst)[N], device const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} +template +inline void spvArrayCopyFromDeviceToStack(thread T (&dst)[N], device const vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = reinterpret_cast(src[i]); + } +} + +template +inline enable_if_t spvArrayCopyFromDeviceToStack(thread vec (&dst)[N], device const vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = reinterpret_cast &>(src[i]); + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup(threadgroup T (&dst)[N], device const T (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = src[i]; + } +} +template +inline void spvArrayCopyFromDeviceToThreadGroup(threadgroup T (&dst)[N], device const vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = reinterpret_cast(src[i]); + } +} + +template +inline enable_if_t spvArrayCopyFromDeviceToThreadGroup(threadgroup vec (&dst)[N], device const vec (&src)[N]) +{ + for (uint i = 0; i < N; i++) + { + dst[i] = reinterpret_cast &>(src[i]); + } +} + +struct SSBO +{ + float4 b[5]; + float4 c[5]; +}; + +kernel void main0(device SSBO& _7 [[buffer(0)]]) +{ + spvUnsafeArray a; + spvArrayCopyFromDeviceToStack(a.elements, _7.b); + spvArrayCopyFromDeviceToStack(a.elements, _7.b); + spvArrayCopyFromStackToDevice(_7.b, a.elements); + spvArrayCopyFromStackToDevice(_7.c, a.elements); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp index 0f97633399..def748bfca 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp @@ -24,7 +24,7 @@ struct _13 float2 _m0[648]; }; -kernel void main0(const device _6& _7 [[buffer(0)]], device _9& _11 [[buffer(1)]], device _13& _14 [[buffer(2)]]) +kernel void main0(device _6& _7 [[buffer(0)]], device _9& _11 [[buffer(1)]], device _13& _14 [[buffer(2)]]) { for (uint _46 = 0u; _46 < 648u; _46 += 2u) { diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp index beab3e7b68..abf58e670d 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp @@ -16,13 +16,13 @@ struct SSBORead }; static inline __attribute__((always_inline)) -void copy_out(device float& A, device const float& B) +void copy_out(device float* A, device float* B) { - A = B; + *A = *B; } -kernel void main0(device SSBO& _10 [[buffer(0)]], const device SSBORead& _14 [[buffer(1)]]) +kernel void main0(device SSBO& _10 [[buffer(0)]], device SSBORead& _14 [[buffer(1)]]) { - copy_out(_10.a, _14.b); + copy_out(&_10.a, &_14.b); } diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp16.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp16.asm.comp new file mode 100644 index 0000000000..2a64ccf95c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp16.asm.comp @@ -0,0 +1,42 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +[[clang::optnone]] T spvFAdd(T l, T r) +{ + return fma(T(1), l, r); +} + +struct SSBO +{ + float v[4]; + half f16[4]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + _9.v[gl_LocalInvocationIndex] = cos(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::sin(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::tan(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::acos(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::asin(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::atan(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::exp(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::exp2(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::log(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::log2(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::sqrt(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::rsqrt(_9.v[gl_LocalInvocationIndex])); + _9.v[gl_LocalInvocationIndex] = spvFAdd(_9.v[gl_LocalInvocationIndex], precise::powr(_9.v[gl_LocalInvocationIndex], 4.0)); + _9.f16[gl_LocalInvocationIndex] = cos(_9.f16[gl_LocalInvocationIndex]); + _9.f16[gl_LocalInvocationIndex] += sin(_9.f16[gl_LocalInvocationIndex]); + _9.f16[gl_LocalInvocationIndex] += half(fast::cosh(float(_9.f16[gl_LocalInvocationIndex]))); + _9.f16[gl_LocalInvocationIndex] += half(fast::sinh(float(_9.f16[gl_LocalInvocationIndex]))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp32.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp32.asm.comp new file mode 100644 index 0000000000..1741f70634 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp32.asm.comp @@ -0,0 +1,42 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +[[clang::optnone]] T spvFAdd(T l, T r) +{ + return fma(T(1), l, r); +} + +struct SSBO +{ + float v[4]; + half f16[4]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + _9.v[gl_LocalInvocationIndex] = precise::cos(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += sin(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += tan(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += acos(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += asin(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += atan(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += exp(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += exp2(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += log(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += log2(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += sqrt(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += rsqrt(_9.v[gl_LocalInvocationIndex]); + _9.v[gl_LocalInvocationIndex] += powr(_9.v[gl_LocalInvocationIndex], 4.0); + _9.f16[gl_LocalInvocationIndex] = cos(_9.f16[gl_LocalInvocationIndex]); + _9.f16[gl_LocalInvocationIndex] = spvFAdd(_9.f16[gl_LocalInvocationIndex], sin(_9.f16[gl_LocalInvocationIndex])); + _9.f16[gl_LocalInvocationIndex] = spvFAdd(_9.f16[gl_LocalInvocationIndex], half(precise::cosh(float(_9.f16[gl_LocalInvocationIndex])))); + _9.f16[gl_LocalInvocationIndex] = spvFAdd(_9.f16[gl_LocalInvocationIndex], half(precise::sinh(float(_9.f16[gl_LocalInvocationIndex])))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-ssbo-argument.spv16.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-ssbo-argument.spv16.asm.comp new file mode 100644 index 0000000000..b074d16f28 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-ssbo-argument.spv16.asm.comp @@ -0,0 +1,23 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct _3 +{ + uchar _m0[1]; +}; + +static inline __attribute__((always_inline)) +void _20(device uchar* _21) +{ + _21[2u] = uchar(0); +} + +kernel void main0(device _3& _2 [[buffer(0)]]) +{ + _20(&_2._m0[1u]); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-ssbo-array-argument.spv16.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-ssbo-array-argument.spv16.asm.comp new file mode 100644 index 0000000000..b25ee74535 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-ssbo-array-argument.spv16.asm.comp @@ -0,0 +1,23 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct _3 +{ + uchar _m0[16]; +}; + +static inline __attribute__((always_inline)) +void _20(device uchar (*_21)[16]) +{ + (*_21)[2u] = uchar(0); +} + +kernel void main0(device _3& _2 [[buffer(0)]]) +{ + _20(&_2._m0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/struct-name-disambiguate.asm.dynamic-buffer.msl2.argument.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/struct-name-disambiguate.asm.dynamic-buffer.msl2.argument.frag new file mode 100644 index 0000000000..636107ac80 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/struct-name-disambiguate.asm.dynamic-buffer.msl2.argument.frag @@ -0,0 +1,60 @@ +#include +#include + +using namespace metal; + +struct world_info +{ + float4 ambient_light; + float2 world_resolution; + float2 level_size; +}; + +struct spvDescriptorSetBuffer1 +{ + constant world_info* world_info [[id(0)]]; +}; + +struct spvDescriptorSetBuffer2 +{ + texture2d ui [[id(0)]]; + sampler ui_sampler [[id(1)]]; + texture2d scene [[id(2)]]; + sampler scene_sampler [[id(3)]]; +}; + +struct main0_out +{ + float4 _entryPointOutput [[color(0)]]; +}; + +struct main0_in +{ + float2 input_uv [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]], constant uint* spvDynamicOffsets [[buffer(23)]]) +{ + constant auto& world_info_1 = *(constant world_info* )((constant char* )spvDescriptorSet1.world_info + spvDynamicOffsets[1]); + main0_out out = {}; + float4 _176; + do + { + float4 _134 = spvDescriptorSet2.ui.sample(spvDescriptorSet2.ui_sampler, in.input_uv); + float4 _122 = _134; + if (_122.w == 1.0) + { + _176 = _134; + break; + } + float4 _124 = world_info_1.ambient_light; + float _150 = _124.w; + float4 _152 = world_info_1.ambient_light * _150; + _124 = _152; + _176 = _134 + (spvDescriptorSet2.scene.sample(spvDescriptorSet2.scene_sampler, in.input_uv) * _152); + break; + } while(false); + out._entryPointOutput = _176; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert index 750afcf25b..9cbcc2f7b0 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert @@ -5,16 +5,16 @@ using namespace metal; -device float* thread * constant _9 = {}; +const device float* thread * constant _9 = {}; static inline __attribute__((always_inline)) -void _10(device float* thread * const thread & _11) +void _10(const device float* thread * const thread & _11) { } vertex void main0() { - device float* thread * _14 = _9; + const device float* thread * _14 = _9; _10(_14); } diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/argument-buffer-readonly-writeonly-alias.msl2.argument.argument-tier-1.device-argument-buffer.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/argument-buffer-readonly-writeonly-alias.msl2.argument.argument-tier-1.device-argument-buffer.comp new file mode 100644 index 0000000000..28d05dc5e3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/argument-buffer-readonly-writeonly-alias.msl2.argument.argument-tier-1.device-argument-buffer.comp @@ -0,0 +1,47 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" + +#include +#include + +using namespace metal; + +template +struct spvDescriptor +{ + T value; +}; + +template +struct spvDescriptorArray +{ + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } + const device T* ptr; +}; + +struct D +{ + float data_d[1]; +}; + +struct A +{ + float data_a[1]; +}; + +struct spvDescriptorSetBuffer0 +{ + spvDescriptor d [[id(0)]][1] /* unsized array hack */; + // Overlapping binding: spvDescriptor a [[id(0)]][1] /* unsized array hack */; +}; + +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + spvDescriptorArray d {spvDescriptorSet0.d}; + spvDescriptorArray a {reinterpret_cast const device *>(&spvDescriptorSet0.d)}; + + d[gl_WorkGroupID.x]->data_d[0] = a[gl_WorkGroupID.x]->data_a[0]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/atomic-cmpxchg-packed-vector.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/atomic-cmpxchg-packed-vector.comp new file mode 100644 index 0000000000..f1455aaa1a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/atomic-cmpxchg-packed-vector.comp @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct AttData0 +{ + packed_uint3 att0[1]; +}; + +kernel void main0(device AttData0& __restrict _22 [[buffer(0)]]) +{ + uint newVal = 432u; + uint prevVal = 0u; + uint curVal = 0u; + for (;;) + { + uint _30; + do + { + _30 = prevVal; + } while (!atomic_compare_exchange_weak_explicit((device atomic_uint*)&((device uint*)&_22.att0[0])[0u], &_30, newVal, memory_order_relaxed, memory_order_relaxed) && _30 == prevVal); + curVal = _30; + if (_30 != prevVal) + { + continue; + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bda-atomics.msl23.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bda-atomics.msl23.comp index 35654fa212..b6a04934d6 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bda-atomics.msl23.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bda-atomics.msl23.comp @@ -31,7 +31,7 @@ struct SSBO constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(constant Registers& _12 [[buffer(0)]], constant UBO& _26 [[buffer(1)]], const device SSBO& _35 [[buffer(2)]]) +kernel void main0(constant Registers& _12 [[buffer(0)]], constant UBO& _26 [[buffer(1)]], device SSBO& _35 [[buffer(2)]]) { uint _23 = atomic_fetch_add_explicit((device atomic_uint*)&_12.ptr->i, 10u, memory_order_relaxed); uint _32 = atomic_fetch_add_explicit((device atomic_uint*)&_26.ptr_ubo->i, 11u, memory_order_relaxed); diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/image-cube-atomic.msl4.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/image-cube-atomic.msl4.comp new file mode 100644 index 0000000000..0ac69e56c0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/image-cube-atomic.msl4.comp @@ -0,0 +1,16 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +kernel void main0(texturecube uCube [[texture(0)]], texturecube_array uCubeArray [[texture(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _22 = uCube.atomic_fetch_add(uint3(int3(gl_GlobalInvocationID)).xy, uint3(int3(gl_GlobalInvocationID)).z, 10u).x; + uint _29 = uCubeArray.atomic_fetch_or(uint3(int3(gl_GlobalInvocationID)).xy, uint3(int3(gl_GlobalInvocationID)).z % 6u, uint3(int3(gl_GlobalInvocationID)).z / 6u, 10u).x; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/integer-dot-product.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/integer-dot-product.comp index 4f2da06d1b..dda4903f8b 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/integer-dot-product.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/integer-dot-product.comp @@ -36,10 +36,10 @@ struct InOut int result; }; -kernel void main0(device void* spvBufferAliasSet0Binding1 [[buffer(0)]]) +kernel void main0(const device void* spvBufferAliasSet0Binding1 [[buffer(0)]]) { - device auto& comp3 = *(device InOut3*)spvBufferAliasSet0Binding1; - device auto& comp2 = *(device InOut2*)spvBufferAliasSet0Binding1; + const device auto& comp3 = *(const device InOut3*)spvBufferAliasSet0Binding1; + const device auto& comp2 = *(const device InOut2*)spvBufferAliasSet0Binding1; int sdot_int = reduce_add(int4(short4(comp3.x)) * int4(short4(comp3.y))); uint sdot_uint = reduce_add(uint4(short4(comp3.x)) * uint4(short4(comp3.y))); uint udot_uint = reduce_add(uint4(comp3.x) * uint4(comp3.y)); diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/simple-bindless-ssbo.msl2.argument.argument-tier-1.device-argument-buffer.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/simple-bindless-ssbo.msl2.argument.argument-tier-1.device-argument-buffer.comp index d8107ec47d..0bff381ef9 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/simple-bindless-ssbo.msl2.argument.argument-tier-1.device-argument-buffer.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/simple-bindless-ssbo.msl2.argument.argument-tier-1.device-argument-buffer.comp @@ -14,13 +14,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -36,7 +32,7 @@ struct spvDescriptorSetBuffer0 spvDescriptor ssbos [[id(0)]][1] /* unsized array hack */; }; -kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { spvDescriptorArray ssbos {spvDescriptorSet0.ssbos}; diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl22.ios.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl22.ios.comp index 586965fa92..e0fe6e9e3a 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl22.ios.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl22.ios.comp @@ -124,6 +124,34 @@ inline vec spvSubgroupShuffle(vec value, ushort lane) return (vec)quad_shuffle((vec)value, lane); } +template<> +inline ulong spvSubgroupShuffle(ulong value, ushort lane) +{ + return as_type(spvSubgroupShuffle(as_type(value), lane)); +} + +template<> +inline ulong2 spvSubgroupShuffle(ulong2 value, ushort lane) +{ + return ulong2(spvSubgroupShuffle(value.x, lane), spvSubgroupShuffle(value.y, lane)); +} + +inline ulong3 spvSubgroupShuffle(ulong3 value, ushort lane) +{ + return ulong3(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.z, lane)); +} + +inline ulong4 spvSubgroupShuffle(ulong4 value, ushort lane) +{ + return ulong4(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.zw, lane)); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return vec(spvSubgroupShuffle(vec(value), lane)); +} + template inline T spvSubgroupShuffleXor(T value, ushort mask) { diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl23.ios.simd.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl23.ios.simd.comp index f046bbdd08..55e9e25091 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl23.ios.simd.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl23.ios.simd.comp @@ -124,6 +124,34 @@ inline vec spvSubgroupShuffle(vec value, ushort lane) return (vec)simd_shuffle((vec)value, lane); } +template<> +inline ulong spvSubgroupShuffle(ulong value, ushort lane) +{ + return as_type(spvSubgroupShuffle(as_type(value), lane)); +} + +template<> +inline ulong2 spvSubgroupShuffle(ulong2 value, ushort lane) +{ + return ulong2(spvSubgroupShuffle(value.x, lane), spvSubgroupShuffle(value.y, lane)); +} + +inline ulong3 spvSubgroupShuffle(ulong3 value, ushort lane) +{ + return ulong3(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.z, lane)); +} + +inline ulong4 spvSubgroupShuffle(ulong4 value, ushort lane) +{ + return ulong4(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.zw, lane)); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return vec(spvSubgroupShuffle(vec(value), lane)); +} + template inline T spvSubgroupShuffleXor(T value, ushort mask) { diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl3.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl3.comp new file mode 100644 index 0000000000..33f33c6370 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl3.comp @@ -0,0 +1,916 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupBroadcast(T value, ushort lane) +{ + return simd_broadcast(value, lane); +} + +template<> +inline bool spvSubgroupBroadcast(bool value, ushort lane) +{ + return !!simd_broadcast((ushort)value, lane); +} + +template +inline vec spvSubgroupBroadcast(vec value, ushort lane) +{ + return (vec)simd_broadcast((vec)value, lane); +} + +template +inline T spvSubgroupBroadcastFirst(T value) +{ + return simd_broadcast_first(value); +} + +template<> +inline bool spvSubgroupBroadcastFirst(bool value) +{ + return !!simd_broadcast_first((ushort)value); +} + +template +inline vec spvSubgroupBroadcastFirst(vec value) +{ + return (vec)simd_broadcast_first((vec)value); +} + +inline uint4 spvSubgroupBallot(bool value) +{ + simd_vote vote = simd_ballot(value); + // simd_ballot() returns a 64-bit integer-like object, but + // SPIR-V callers expect a uint4. We must convert. + // FIXME: This won't include higher bits if Apple ever supports + // 128 lanes in an SIMD-group. + return uint4(as_type((simd_vote::vote_t)vote), 0, 0); +} + +inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit) +{ + return !!extract_bits(ballot[bit / 32], bit % 32, 1); +} + +inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0); +} + +inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0); +} + +inline uint spvPopCount4(uint4 ballot) +{ + return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w); +} + +inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +template +inline bool spvSubgroupAllEqual(T value) +{ + return simd_all(all(value == simd_broadcast_first(value))); +} + +template<> +inline bool spvSubgroupAllEqual(bool value) +{ + return simd_all(value) || !simd_any(value); +} + +template +inline bool spvSubgroupAllEqual(vec value) +{ + return simd_all(all(value == (vec)simd_broadcast_first((vec)value))); +} + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return simd_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!simd_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)simd_shuffle((vec)value, lane); +} + +template<> +inline ulong spvSubgroupShuffle(ulong value, ushort lane) +{ + return as_type(spvSubgroupShuffle(as_type(value), lane)); +} + +template<> +inline ulong2 spvSubgroupShuffle(ulong2 value, ushort lane) +{ + return ulong2(spvSubgroupShuffle(value.x, lane), spvSubgroupShuffle(value.y, lane)); +} + +inline ulong3 spvSubgroupShuffle(ulong3 value, ushort lane) +{ + return ulong3(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.z, lane)); +} + +inline ulong4 spvSubgroupShuffle(ulong4 value, ushort lane) +{ + return ulong4(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.zw, lane)); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return vec(spvSubgroupShuffle(vec(value), lane)); +} + +template +inline T spvSubgroupShuffleXor(T value, ushort mask) +{ + return simd_shuffle_xor(value, mask); +} + +template<> +inline bool spvSubgroupShuffleXor(bool value, ushort mask) +{ + return !!simd_shuffle_xor((ushort)value, mask); +} + +template +inline vec spvSubgroupShuffleXor(vec value, ushort mask) +{ + return (vec)simd_shuffle_xor((vec)value, mask); +} + +template +inline T spvSubgroupShuffleUp(T value, ushort delta) +{ + return simd_shuffle_up(value, delta); +} + +template<> +inline bool spvSubgroupShuffleUp(bool value, ushort delta) +{ + return !!simd_shuffle_up((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleUp(vec value, ushort delta) +{ + return (vec)simd_shuffle_up((vec)value, delta); +} + +template +inline T spvSubgroupShuffleDown(T value, ushort delta) +{ + return simd_shuffle_down(value, delta); +} + +template<> +inline bool spvSubgroupShuffleDown(bool value, ushort delta) +{ + return !!simd_shuffle_down((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleDown(vec value, ushort delta) +{ + return (vec)simd_shuffle_down((vec)value, delta); +} + +template +inline T spvSubgroupRotate(T value, ushort delta) +{ + return simd_shuffle_rotate_down(value, delta); +} + +template<> +inline bool spvSubgroupRotate(bool value, ushort delta) +{ + return !!simd_shuffle_rotate_down((ushort)value, delta); +} + +template +inline vec spvSubgroupRotate(vec value, ushort delta) +{ + return (vec)simd_shuffle_rotate_down((vec)value, delta); +} + +template +struct spvClusteredAddDetail; + +// Base cases +template<> +struct spvClusteredAddDetail<1, 0> +{ + template + static T op(T value, uint) + { + return value; + } +}; + +template +struct spvClusteredAddDetail<1, offset> +{ + template + static T op(T value, uint lid) + { + // If the target lane is inactive, then return identity. + if (!extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], (lid ^ offset) % 32, 1)) + return 0; + return simd_shuffle_xor(value, offset); + } +}; + +template<> +struct spvClusteredAddDetail<4, 0> +{ + template + static T op(T value, uint) + { + return quad_sum(value); + } +}; + +template +struct spvClusteredAddDetail<4, offset> +{ + template + static T op(T value, uint lid) + { + // Here, we care if any of the lanes in the quad are active. + uint quad_mask = extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], ((lid ^ offset) % 32) & ~3, 4); + if (!quad_mask) + return 0; + // But we need to make sure we shuffle from an active lane. + return simd_shuffle(quad_sum(value), ((lid ^ offset) & ~3) | ctz(quad_mask)); + } +}; + +// General case +template +struct spvClusteredAddDetail +{ + template + static T op(T value, uint lid) + { + return spvClusteredAddDetail::op(value, lid) + spvClusteredAddDetail::op(value, lid); + } +}; + +template +T spvClustered_sum(T value, uint lid) +{ + return spvClusteredAddDetail::op(value, lid); +} + +template +struct spvClusteredMulDetail; + +// Base cases +template<> +struct spvClusteredMulDetail<1, 0> +{ + template + static T op(T value, uint) + { + return value; + } +}; + +template +struct spvClusteredMulDetail<1, offset> +{ + template + static T op(T value, uint lid) + { + // If the target lane is inactive, then return identity. + if (!extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], (lid ^ offset) % 32, 1)) + return 1; + return simd_shuffle_xor(value, offset); + } +}; + +template<> +struct spvClusteredMulDetail<4, 0> +{ + template + static T op(T value, uint) + { + return quad_product(value); + } +}; + +template +struct spvClusteredMulDetail<4, offset> +{ + template + static T op(T value, uint lid) + { + // Here, we care if any of the lanes in the quad are active. + uint quad_mask = extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], ((lid ^ offset) % 32) & ~3, 4); + if (!quad_mask) + return 1; + // But we need to make sure we shuffle from an active lane. + return simd_shuffle(quad_product(value), ((lid ^ offset) & ~3) | ctz(quad_mask)); + } +}; + +// General case +template +struct spvClusteredMulDetail +{ + template + static T op(T value, uint lid) + { + return spvClusteredMulDetail::op(value, lid) * spvClusteredMulDetail::op(value, lid); + } +}; + +template +T spvClustered_product(T value, uint lid) +{ + return spvClusteredMulDetail::op(value, lid); +} + +template +struct spvClusteredMinDetail; + +// Base cases +template<> +struct spvClusteredMinDetail<1, 0> +{ + template + static T op(T value, uint) + { + return value; + } +}; + +template +struct spvClusteredMinDetail<1, offset> +{ + template + static T op(T value, uint lid) + { + // If the target lane is inactive, then return identity. + if (!extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], (lid ^ offset) % 32, 1)) + return numeric_limits::max(); + return simd_shuffle_xor(value, offset); + } +}; + +template<> +struct spvClusteredMinDetail<4, 0> +{ + template + static T op(T value, uint) + { + return quad_min(value); + } +}; + +template +struct spvClusteredMinDetail<4, offset> +{ + template + static T op(T value, uint lid) + { + // Here, we care if any of the lanes in the quad are active. + uint quad_mask = extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], ((lid ^ offset) % 32) & ~3, 4); + if (!quad_mask) + return numeric_limits::max(); + // But we need to make sure we shuffle from an active lane. + return simd_shuffle(quad_min(value), ((lid ^ offset) & ~3) | ctz(quad_mask)); + } +}; + +// General case +template +struct spvClusteredMinDetail +{ + template + static T op(T value, uint lid) + { + return min(spvClusteredMinDetail::op(value, lid), spvClusteredMinDetail::op(value, lid)); + } +}; + +template +T spvClustered_min(T value, uint lid) +{ + return spvClusteredMinDetail::op(value, lid); +} + +template +struct spvClusteredMaxDetail; + +// Base cases +template<> +struct spvClusteredMaxDetail<1, 0> +{ + template + static T op(T value, uint) + { + return value; + } +}; + +template +struct spvClusteredMaxDetail<1, offset> +{ + template + static T op(T value, uint lid) + { + // If the target lane is inactive, then return identity. + if (!extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], (lid ^ offset) % 32, 1)) + return numeric_limits::min(); + return simd_shuffle_xor(value, offset); + } +}; + +template<> +struct spvClusteredMaxDetail<4, 0> +{ + template + static T op(T value, uint) + { + return quad_max(value); + } +}; + +template +struct spvClusteredMaxDetail<4, offset> +{ + template + static T op(T value, uint lid) + { + // Here, we care if any of the lanes in the quad are active. + uint quad_mask = extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], ((lid ^ offset) % 32) & ~3, 4); + if (!quad_mask) + return numeric_limits::min(); + // But we need to make sure we shuffle from an active lane. + return simd_shuffle(quad_max(value), ((lid ^ offset) & ~3) | ctz(quad_mask)); + } +}; + +// General case +template +struct spvClusteredMaxDetail +{ + template + static T op(T value, uint lid) + { + return max(spvClusteredMaxDetail::op(value, lid), spvClusteredMaxDetail::op(value, lid)); + } +}; + +template +T spvClustered_max(T value, uint lid) +{ + return spvClusteredMaxDetail::op(value, lid); +} + +template +struct spvClusteredAndDetail; + +// Base cases +template<> +struct spvClusteredAndDetail<1, 0> +{ + template + static T op(T value, uint) + { + return value; + } +}; + +template +struct spvClusteredAndDetail<1, offset> +{ + template + static T op(T value, uint lid) + { + // If the target lane is inactive, then return identity. + if (!extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], (lid ^ offset) % 32, 1)) + return ~T(0); + return simd_shuffle_xor(value, offset); + } +}; + +template<> +struct spvClusteredAndDetail<4, 0> +{ + template + static T op(T value, uint) + { + return quad_and(value); + } +}; + +template +struct spvClusteredAndDetail<4, offset> +{ + template + static T op(T value, uint lid) + { + // Here, we care if any of the lanes in the quad are active. + uint quad_mask = extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], ((lid ^ offset) % 32) & ~3, 4); + if (!quad_mask) + return ~T(0); + // But we need to make sure we shuffle from an active lane. + return simd_shuffle(quad_and(value), ((lid ^ offset) & ~3) | ctz(quad_mask)); + } +}; + +// General case +template +struct spvClusteredAndDetail +{ + template + static T op(T value, uint lid) + { + return spvClusteredAndDetail::op(value, lid) & spvClusteredAndDetail::op(value, lid); + } +}; + +template +T spvClustered_and(T value, uint lid) +{ + return spvClusteredAndDetail::op(value, lid); +} + +template +struct spvClusteredOrDetail; + +// Base cases +template<> +struct spvClusteredOrDetail<1, 0> +{ + template + static T op(T value, uint) + { + return value; + } +}; + +template +struct spvClusteredOrDetail<1, offset> +{ + template + static T op(T value, uint lid) + { + // If the target lane is inactive, then return identity. + if (!extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], (lid ^ offset) % 32, 1)) + return 0; + return simd_shuffle_xor(value, offset); + } +}; + +template<> +struct spvClusteredOrDetail<4, 0> +{ + template + static T op(T value, uint) + { + return quad_or(value); + } +}; + +template +struct spvClusteredOrDetail<4, offset> +{ + template + static T op(T value, uint lid) + { + // Here, we care if any of the lanes in the quad are active. + uint quad_mask = extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], ((lid ^ offset) % 32) & ~3, 4); + if (!quad_mask) + return 0; + // But we need to make sure we shuffle from an active lane. + return simd_shuffle(quad_or(value), ((lid ^ offset) & ~3) | ctz(quad_mask)); + } +}; + +// General case +template +struct spvClusteredOrDetail +{ + template + static T op(T value, uint lid) + { + return spvClusteredOrDetail::op(value, lid) | spvClusteredOrDetail::op(value, lid); + } +}; + +template +T spvClustered_or(T value, uint lid) +{ + return spvClusteredOrDetail::op(value, lid); +} + +template +struct spvClusteredXorDetail; + +// Base cases +template<> +struct spvClusteredXorDetail<1, 0> +{ + template + static T op(T value, uint) + { + return value; + } +}; + +template +struct spvClusteredXorDetail<1, offset> +{ + template + static T op(T value, uint lid) + { + // If the target lane is inactive, then return identity. + if (!extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], (lid ^ offset) % 32, 1)) + return 0; + return simd_shuffle_xor(value, offset); + } +}; + +template<> +struct spvClusteredXorDetail<4, 0> +{ + template + static T op(T value, uint) + { + return quad_xor(value); + } +}; + +template +struct spvClusteredXorDetail<4, offset> +{ + template + static T op(T value, uint lid) + { + // Here, we care if any of the lanes in the quad are active. + uint quad_mask = extract_bits(as_type((simd_vote::vote_t)simd_active_threads_mask())[(lid ^ offset) / 32], ((lid ^ offset) % 32) & ~3, 4); + if (!quad_mask) + return 0; + // But we need to make sure we shuffle from an active lane. + return simd_shuffle(quad_xor(value), ((lid ^ offset) & ~3) | ctz(quad_mask)); + } +}; + +// General case +template +struct spvClusteredXorDetail +{ + template + static T op(T value, uint lid) + { + return spvClusteredXorDetail::op(value, lid) ^ spvClusteredXorDetail::op(value, lid); + } +}; + +template +T spvClustered_xor(T value, uint lid) +{ + return spvClusteredXorDetail::op(value, lid); +} + +template +inline T spvQuadBroadcast(T value, uint lane) +{ + return quad_broadcast(value, lane); +} + +template<> +inline bool spvQuadBroadcast(bool value, uint lane) +{ + return !!quad_broadcast((ushort)value, lane); +} + +template +inline vec spvQuadBroadcast(vec value, uint lane) +{ + return (vec)quad_broadcast((vec)value, lane); +} + +template +inline T spvQuadSwap(T value, uint dir) +{ + return quad_shuffle_xor(value, dir + 1); +} + +template<> +inline bool spvQuadSwap(bool value, uint dir) +{ + return !!quad_shuffle_xor((ushort)value, dir + 1); +} + +template +inline vec spvQuadSwap(vec value, uint dir) +{ + return (vec)quad_shuffle_xor((vec)value, dir + 1); +} + +struct SSBO +{ + float FragColor; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void doClusteredRotate(thread uint& gl_SubgroupInvocationID) +{ + uint _15 = spvSubgroupShuffle(20u, ((gl_SubgroupInvocationID + 4u) & 7) + (gl_SubgroupInvocationID & 4294967288)); + uint rotated_clustered = _15; + bool _20 = spvSubgroupShuffle(false, ((gl_SubgroupInvocationID + 4u) & 7) + (gl_SubgroupInvocationID & 4294967288)); + bool rotated_clustered_bool = _20; +} + +kernel void main0(device SSBO& _24 [[buffer(0)]], uint gl_NumSubgroups [[simdgroups_per_threadgroup]], uint gl_SubgroupID [[simdgroup_index_in_threadgroup]], uint gl_SubgroupSize [[threads_per_simdgroup]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + uint4 gl_SubgroupEqMask = gl_SubgroupInvocationID >= 32 ? uint4(0, (1 << (gl_SubgroupInvocationID - 32)), uint2(0)) : uint4(1 << gl_SubgroupInvocationID, uint3(0)); + uint4 gl_SubgroupGeMask = uint4(insert_bits(0u, 0xFFFFFFFF, min(gl_SubgroupInvocationID, 32u), (uint)max(min((int)gl_SubgroupSize, 32) - (int)gl_SubgroupInvocationID, 0)), insert_bits(0u, 0xFFFFFFFF, (uint)max((int)gl_SubgroupInvocationID - 32, 0), (uint)max((int)gl_SubgroupSize - (int)max(gl_SubgroupInvocationID, 32u), 0)), uint2(0)); + uint4 gl_SubgroupGtMask = uint4(insert_bits(0u, 0xFFFFFFFF, min(gl_SubgroupInvocationID + 1, 32u), (uint)max(min((int)gl_SubgroupSize, 32) - (int)gl_SubgroupInvocationID - 1, 0)), insert_bits(0u, 0xFFFFFFFF, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0), (uint)max((int)gl_SubgroupSize - (int)max(gl_SubgroupInvocationID + 1, 32u), 0)), uint2(0)); + uint4 gl_SubgroupLeMask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + uint4 gl_SubgroupLtMask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + _24.FragColor = float(gl_NumSubgroups); + _24.FragColor = float(gl_SubgroupID); + _24.FragColor = float(gl_SubgroupSize); + _24.FragColor = float(gl_SubgroupInvocationID); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device); + simdgroup_barrier(mem_flags::mem_threadgroup); + simdgroup_barrier(mem_flags::mem_texture); + bool _50 = simd_is_first(); + bool elected = _50; + _24.FragColor = float4(gl_SubgroupEqMask).x; + _24.FragColor = float4(gl_SubgroupGeMask).x; + _24.FragColor = float4(gl_SubgroupGtMask).x; + _24.FragColor = float4(gl_SubgroupLeMask).x; + _24.FragColor = float4(gl_SubgroupLtMask).x; + float4 broadcasted = spvSubgroupBroadcast(float4(10.0), 8u); + bool2 broadcasted_bool = spvSubgroupBroadcast(bool2(true), 8u); + float3 first = spvSubgroupBroadcastFirst(float3(20.0)); + bool4 first_bool = spvSubgroupBroadcastFirst(bool4(false)); + uint4 ballot_value = spvSubgroupBallot(true); + bool inverse_ballot_value = spvSubgroupBallotBitExtract(ballot_value, gl_SubgroupInvocationID); + bool bit_extracted = spvSubgroupBallotBitExtract(uint4(10u), 8u); + uint bit_count = spvSubgroupBallotBitCount(ballot_value, gl_SubgroupSize); + uint inclusive_bit_count = spvSubgroupBallotInclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint exclusive_bit_count = spvSubgroupBallotExclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint lsb = spvSubgroupBallotFindLSB(ballot_value, gl_SubgroupSize); + uint msb = spvSubgroupBallotFindMSB(ballot_value, gl_SubgroupSize); + uint shuffled = spvSubgroupShuffle(10u, 8u); + bool shuffled_bool = spvSubgroupShuffle(true, 9u); + uint shuffled_xor = spvSubgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = spvSubgroupShuffleXor(false, 9u); + uint shuffled_up = spvSubgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = spvSubgroupShuffleUp(true, 4u); + uint shuffled_down = spvSubgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = spvSubgroupShuffleDown(false, 4u); + uint rotated = spvSubgroupRotate(20u, 4u); + bool rotated_bool = spvSubgroupRotate(false, 4u); + doClusteredRotate(gl_SubgroupInvocationID); + bool has_all = simd_all(true); + bool has_any = simd_any(true); + bool has_equal = spvSubgroupAllEqual(0); + has_equal = spvSubgroupAllEqual(true); + has_equal = spvSubgroupAllEqual(float3(0.0, 1.0, 2.0)); + has_equal = spvSubgroupAllEqual(bool4(true, true, false, true)); + float4 added = simd_sum(float4(20.0)); + int4 iadded = simd_sum(int4(20)); + float4 multiplied = simd_product(float4(20.0)); + int4 imultiplied = simd_product(int4(20)); + float4 lo = simd_min(float4(20.0)); + float4 hi = simd_max(float4(20.0)); + int4 slo = simd_min(int4(20)); + int4 shi = simd_max(int4(20)); + uint4 ulo = simd_min(uint4(20u)); + uint4 uhi = simd_max(uint4(20u)); + uint4 anded = simd_and(ballot_value); + uint4 ored = simd_or(ballot_value); + uint4 xored = simd_xor(ballot_value); + bool4 anded_b = bool4(simd_and(ushort4(ballot_value == uint4(42u)))); + bool4 ored_b = bool4(simd_or(ushort4(ballot_value == uint4(42u)))); + bool4 xored_b = bool4(simd_xor(ushort4(ballot_value == uint4(42u)))); + added = simd_prefix_inclusive_sum(added); + iadded = simd_prefix_inclusive_sum(iadded); + multiplied = simd_prefix_inclusive_product(multiplied); + imultiplied = simd_prefix_inclusive_product(imultiplied); + added = simd_prefix_exclusive_sum(multiplied); + multiplied = simd_prefix_exclusive_product(multiplied); + iadded = simd_prefix_exclusive_sum(imultiplied); + imultiplied = simd_prefix_exclusive_product(imultiplied); + added = spvClustered_sum<1>(added, gl_SubgroupInvocationID); + multiplied = spvClustered_product<1>(multiplied, gl_SubgroupInvocationID); + iadded = spvClustered_sum<1>(iadded, gl_SubgroupInvocationID); + imultiplied = spvClustered_product<1>(imultiplied, gl_SubgroupInvocationID); + lo = spvClustered_min<1>(lo, gl_SubgroupInvocationID); + hi = spvClustered_max<1>(hi, gl_SubgroupInvocationID); + ulo = spvClustered_min<1>(ulo, gl_SubgroupInvocationID); + uhi = spvClustered_max<1>(uhi, gl_SubgroupInvocationID); + slo = spvClustered_min<1>(slo, gl_SubgroupInvocationID); + shi = spvClustered_max<1>(shi, gl_SubgroupInvocationID); + anded = spvClustered_and<1>(anded, gl_SubgroupInvocationID); + ored = spvClustered_or<1>(ored, gl_SubgroupInvocationID); + xored = spvClustered_xor<1>(xored, gl_SubgroupInvocationID); + anded_b = bool4(spvClustered_and<1>(ushort4(anded == uint4(2u)), gl_SubgroupInvocationID)); + ored_b = bool4(spvClustered_or<1>(ushort4(ored == uint4(3u)), gl_SubgroupInvocationID)); + xored_b = bool4(spvClustered_xor<1>(ushort4(xored == uint4(4u)), gl_SubgroupInvocationID)); + added = spvClustered_sum<2>(added, gl_SubgroupInvocationID); + multiplied = spvClustered_product<2>(multiplied, gl_SubgroupInvocationID); + iadded = spvClustered_sum<2>(iadded, gl_SubgroupInvocationID); + imultiplied = spvClustered_product<2>(imultiplied, gl_SubgroupInvocationID); + lo = spvClustered_min<2>(lo, gl_SubgroupInvocationID); + hi = spvClustered_max<2>(hi, gl_SubgroupInvocationID); + ulo = spvClustered_min<2>(ulo, gl_SubgroupInvocationID); + uhi = spvClustered_max<2>(uhi, gl_SubgroupInvocationID); + slo = spvClustered_min<2>(slo, gl_SubgroupInvocationID); + shi = spvClustered_max<2>(shi, gl_SubgroupInvocationID); + anded = spvClustered_and<2>(anded, gl_SubgroupInvocationID); + ored = spvClustered_or<2>(ored, gl_SubgroupInvocationID); + xored = spvClustered_xor<2>(xored, gl_SubgroupInvocationID); + anded_b = bool4(spvClustered_and<2>(ushort4(anded == uint4(2u)), gl_SubgroupInvocationID)); + ored_b = bool4(spvClustered_or<2>(ushort4(ored == uint4(3u)), gl_SubgroupInvocationID)); + xored_b = bool4(spvClustered_xor<2>(ushort4(xored == uint4(4u)), gl_SubgroupInvocationID)); + added = spvClustered_sum<4>(added, gl_SubgroupInvocationID); + multiplied = spvClustered_product<4>(multiplied, gl_SubgroupInvocationID); + iadded = spvClustered_sum<4>(iadded, gl_SubgroupInvocationID); + imultiplied = spvClustered_product<4>(imultiplied, gl_SubgroupInvocationID); + lo = spvClustered_min<4>(lo, gl_SubgroupInvocationID); + hi = spvClustered_max<4>(hi, gl_SubgroupInvocationID); + ulo = spvClustered_min<4>(ulo, gl_SubgroupInvocationID); + uhi = spvClustered_max<4>(uhi, gl_SubgroupInvocationID); + slo = spvClustered_min<4>(slo, gl_SubgroupInvocationID); + shi = spvClustered_max<4>(shi, gl_SubgroupInvocationID); + anded = spvClustered_and<4>(anded, gl_SubgroupInvocationID); + ored = spvClustered_or<4>(ored, gl_SubgroupInvocationID); + xored = spvClustered_xor<4>(xored, gl_SubgroupInvocationID); + anded_b = bool4(spvClustered_and<4>(ushort4(anded == uint4(2u)), gl_SubgroupInvocationID)); + ored_b = bool4(spvClustered_or<4>(ushort4(ored == uint4(3u)), gl_SubgroupInvocationID)); + xored_b = bool4(spvClustered_xor<4>(ushort4(xored == uint4(4u)), gl_SubgroupInvocationID)); + added = spvClustered_sum<16>(added, gl_SubgroupInvocationID); + multiplied = spvClustered_product<16>(multiplied, gl_SubgroupInvocationID); + iadded = spvClustered_sum<16>(iadded, gl_SubgroupInvocationID); + imultiplied = spvClustered_product<16>(imultiplied, gl_SubgroupInvocationID); + lo = spvClustered_min<16>(lo, gl_SubgroupInvocationID); + hi = spvClustered_max<16>(hi, gl_SubgroupInvocationID); + ulo = spvClustered_min<16>(ulo, gl_SubgroupInvocationID); + uhi = spvClustered_max<16>(uhi, gl_SubgroupInvocationID); + slo = spvClustered_min<16>(slo, gl_SubgroupInvocationID); + shi = spvClustered_max<16>(shi, gl_SubgroupInvocationID); + anded = spvClustered_and<16>(anded, gl_SubgroupInvocationID); + ored = spvClustered_or<16>(ored, gl_SubgroupInvocationID); + xored = spvClustered_xor<16>(xored, gl_SubgroupInvocationID); + anded_b = bool4(spvClustered_and<16>(ushort4(anded == uint4(2u)), gl_SubgroupInvocationID)); + ored_b = bool4(spvClustered_or<16>(ushort4(ored == uint4(3u)), gl_SubgroupInvocationID)); + xored_b = bool4(spvClustered_xor<16>(ushort4(xored == uint4(4u)), gl_SubgroupInvocationID)); + float4 swap_horiz = spvQuadSwap(float4(20.0), 0u); + bool4 swap_horiz_bool = spvQuadSwap(bool4(true), 0u); + float4 swap_vertical = spvQuadSwap(float4(20.0), 1u); + bool4 swap_vertical_bool = spvQuadSwap(bool4(true), 1u); + float4 swap_diagonal = spvQuadSwap(float4(20.0), 2u); + bool4 swap_diagonal_bool = spvQuadSwap(bool4(true), 2u); + float4 quad_broadcast0 = spvQuadBroadcast(float4(20.0), 3u); + bool4 quad_broadcast_bool = spvQuadBroadcast(bool4(true), 3u); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp16.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp16.comp new file mode 100644 index 0000000000..49239d5a91 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp16.comp @@ -0,0 +1,34 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float v[4]; + half f16[4]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(device SSBO& _14 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + _14.v[gl_LocalInvocationIndex] = cos(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += sin(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += tan(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += acos(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += asin(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += atan(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += exp(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += exp2(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += log(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += log2(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += sqrt(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += rsqrt(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += powr(_14.v[gl_LocalInvocationIndex], 4.0); + _14.f16[gl_LocalInvocationIndex] = cos(_14.f16[gl_LocalInvocationIndex]); + _14.f16[gl_LocalInvocationIndex] += sin(_14.f16[gl_LocalInvocationIndex]); + _14.f16[gl_LocalInvocationIndex] += half(precise::cosh(float(_14.f16[gl_LocalInvocationIndex]))); + _14.f16[gl_LocalInvocationIndex] += half(precise::sinh(float(_14.f16[gl_LocalInvocationIndex]))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp32.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp32.comp new file mode 100644 index 0000000000..261daaf0b2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp32.comp @@ -0,0 +1,34 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float v[4]; + half f16[4]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(device SSBO& _14 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + _14.v[gl_LocalInvocationIndex] = precise::cos(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::sin(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::tan(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::acos(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::asin(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::atan(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::exp(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::exp2(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::log(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::log2(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::sqrt(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::rsqrt(_14.v[gl_LocalInvocationIndex]); + _14.v[gl_LocalInvocationIndex] += precise::powr(_14.v[gl_LocalInvocationIndex], 4.0); + _14.f16[gl_LocalInvocationIndex] = cos(_14.f16[gl_LocalInvocationIndex]); + _14.f16[gl_LocalInvocationIndex] += sin(_14.f16[gl_LocalInvocationIndex]); + _14.f16[gl_LocalInvocationIndex] += half(fast::cosh(float(_14.f16[gl_LocalInvocationIndex]))); + _14.f16[gl_LocalInvocationIndex] += half(fast::sinh(float(_14.f16[gl_LocalInvocationIndex]))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/transposed-temporary-expression-2.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/transposed-temporary-expression-2.comp new file mode 100644 index 0000000000..2a709bfd51 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/transposed-temporary-expression-2.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float3x4 A; + float3x4 B; + float3x4 C; + float4 D; + float w0; + float w1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +kernel void main0(device SSBO& _18 [[buffer(0)]]) +{ + float4x3 Anew; + float4x3 Bnew; + do + { + Anew = transpose(_18.A * _18.w0); + Bnew = transpose(_18.B * _18.w1); + } while (false); + _18.D = float4(float4x3(Anew[0] + Bnew[0], Anew[1] + Bnew[1], Anew[2] + Bnew[2], Anew[3] + Bnew[3]) * _18.D, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/transposed-temporary-expression.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/transposed-temporary-expression.comp new file mode 100644 index 0000000000..c9dd924edc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/transposed-temporary-expression.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float3x4 A; + float3x4 B; + float3x4 C; + float4 D; + float w0; + float w1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +kernel void main0(device SSBO& _12 [[buffer(0)]]) +{ + float3x4 _23 = _12.A * _12.w0; + float3x4 _30 = _12.B * _12.w1; + _12.D = float4(float4x3(float3(_23[0][0], _23[1][0], _23[2][0]) + float3(_30[0][0], _30[1][0], _30[2][0]), float3(_23[0][1], _23[1][1], _23[2][1]) + float3(_30[0][1], _30[1][1], _30[2][1]), float3(_23[0][2], _23[1][2], _23[2][2]) + float3(_30[0][2], _30[1][2], _30[2][2]), float3(_23[0][3], _23[1][3], _23[2][3]) + float3(_30[0][3], _30[1][3], _30[2][3])) * _12.D, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.comp new file mode 100644 index 0000000000..4b606069b5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.comp @@ -0,0 +1,98 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +constant int A = SPIRV_CROSS_CONSTANT_ID_1; +constant uint _20 = (uint(A) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +constant uint _21 = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 1u +#endif +constant uint _22 = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 1u +#endif +constant uint _23 = SPIRV_CROSS_CONSTANT_ID_3; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_21, _22, _23); +constant uint _26 = _21; +constant uint _27 = (_20 * _26); +constant uint _31 = (uint(A) + 0u); +constant uint _32 = _21; +constant uint _33 = (_31 * _32); +constant uint _59 = (uint(A) + 0u); +constant uint _61 = _23; +constant uint _62 = (_59 * _61); + +struct SSBO +{ + int I; + float V; +}; + +constant uint _88 = (uint(A) + 0u); +constant uint _89 = _23; +constant uint _90 = (_88 * _89); + +kernel void main0(device SSBO& _76 [[buffer(0)]]) +{ + spvUnsafeArray D; + spvUnsafeArray E; + for (int i = 0; uint(i) < _27; i++) + { + D[i] = 1.0 + float(uint(i) + gl_WorkGroupSize.y); + } + for (int i_1 = 0; uint(i_1) < _62; i_1++) + { + D[i_1] = 1.0 + float(uint(i_1) + gl_WorkGroupSize.y); + } + _76.V = (D[_76.I] + D[_76.I ^ 1]) + E[_76.I]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp new file mode 100644 index 0000000000..679a9f36b9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp @@ -0,0 +1,104 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant uint _7_tmp [[function_constant(0)]]; +constant uint _7 = is_function_constant_defined(_7_tmp) ? _7_tmp : 1u; +constant uint _8_tmp [[function_constant(2)]]; +constant uint _8 = is_function_constant_defined(_8_tmp) ? _8_tmp : 1u; +constant uint _9_tmp [[function_constant(3)]]; +constant uint _9 = is_function_constant_defined(_9_tmp) ? _9_tmp : 1u; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +constant int A = SPIRV_CROSS_CONSTANT_ID_1; +constant uint _23 = (uint(A) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +constant uint _24 = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 1u +#endif +constant uint _25 = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 1u +#endif +constant uint _26 = SPIRV_CROSS_CONSTANT_ID_3; +constant uint3 _28 = uint3(_24, _25, _26); +constant uint _29 = _24; +constant uint _30 = (_23 * _29); +constant uint _34 = (uint(A) + 0u); +constant uint _35 = _24; +constant uint _36 = (_34 * _35); +constant uint _62 = (uint(A) + 0u); +constant uint _64 = _26; +constant uint _65 = (_62 * _64); + +struct SSBO +{ + int I; + float V; +}; + +constant uint _91 = (uint(A) + 0u); +constant uint _92 = _26; +constant uint _93 = (_91 * _92); + +kernel void main0(device SSBO& _79 [[buffer(0)]]) +{ + spvUnsafeArray D; + spvUnsafeArray E; + for (int i = 0; uint(i) < _30; i++) + { + D[i] = 1.0 + float(uint(i) + _28.y); + } + for (int i_1 = 0; uint(i_1) < _65; i_1++) + { + D[i_1] = 1.0 + float(uint(i_1) + _28.y); + } + _79.V = (D[_79.I] + D[_79.I ^ 1]) + E[_79.I]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag index 95e07660f4..258d7a6f0c 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag @@ -100,11 +100,11 @@ void test_builtins(thread half4& v4, thread half3& v3, thread half& v1) res = cos(v4); res = tan(v4); res = asin(v4); - res = half(fast::atan2(v4, v3.xyzz)); + res = half4(fast::atan2(float4(v4), float4(v3.xyzz))); res = atan(v4); - res = half(fast::sinh(v4)); - res = half(fast::cosh(v4)); - res = half(fast::tanh(v4)); + res = half4(fast::sinh(float4(v4))); + res = half4(fast::cosh(float4(v4))); + res = half4(fast::tanh(float4(v4))); res = asinh(v4); res = acosh(v4); res = atanh(v4); @@ -150,7 +150,7 @@ void test_builtins(thread half4& v4, thread half3& v3, thread half& v1) t0 = distance(v4, v4); t0 = dot(v4, v4); half3 res3 = cross(v3, v3); - res = fast::normalize(v4); + res = normalize(v4); res = faceforward(v4, v4, v4); res = reflect(v4, v4); res = refract(v4, v4, v1); diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subgroups.nocompat.vk.msl22.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subgroups.nocompat.vk.msl22.frag index 4df9520e1e..148af11773 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subgroups.nocompat.vk.msl22.frag +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subgroups.nocompat.vk.msl22.frag @@ -129,6 +129,34 @@ inline vec spvSubgroupShuffle(vec value, ushort lane) return (vec)simd_shuffle((vec)value, lane); } +template<> +inline ulong spvSubgroupShuffle(ulong value, ushort lane) +{ + return as_type(spvSubgroupShuffle(as_type(value), lane)); +} + +template<> +inline ulong2 spvSubgroupShuffle(ulong2 value, ushort lane) +{ + return ulong2(spvSubgroupShuffle(value.x, lane), spvSubgroupShuffle(value.y, lane)); +} + +inline ulong3 spvSubgroupShuffle(ulong3 value, ushort lane) +{ + return ulong3(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.z, lane)); +} + +inline ulong4 spvSubgroupShuffle(ulong4 value, ushort lane) +{ + return ulong4(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.zw, lane)); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return vec(spvSubgroupShuffle(vec(value), lane)); +} + template inline T spvSubgroupShuffleXor(T value, ushort mask) { diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/isolated-scalar-access.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/isolated-scalar-access.comp index f1a3719158..786c4157ae 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/isolated-scalar-access.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/isolated-scalar-access.comp @@ -17,7 +17,7 @@ kernel void main0(device SSBO& _12 [[buffer(0)]]) threadgroup float4 shared_vec4; threadgroup float3 shared_vec3; ((device float*)&_12.v)[0u] = 10.0; - _12.v3[1u] = 40.0; + ((device float*)&_12.v3)[1u] = 40.0; ((device float*)&_12.cm[1])[2u] = 20.0; ((device float*)&_12.rm[1u])[3] = 30.0; ((threadgroup float*)&shared_vec4)[2u] = 40.0; diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp index 964629ceb9..4a70151ec1 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp @@ -74,8 +74,8 @@ void copy_columns(device SSBOCol& _29, device SSBORow& _41) static inline __attribute__((always_inline)) void copy_elements(device SSBOCol& _29, device SSBORow& _41) { - _29.col_major0[0][1u] = ((device float*)&_41.row_major0[1u])[0]; - ((device float*)&_41.row_major0[1u])[0] = _29.col_major0[0][1u]; + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; } kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp index e1e5640d35..23dcec30da 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp @@ -73,8 +73,8 @@ void copy_columns(device SSBOCol& _29, device SSBORow& _41) static inline __attribute__((always_inline)) void copy_elements(device SSBOCol& _29, device SSBORow& _41) { - ((device float*)&_29.col_major0[0])[1u] = _41.row_major0[1u][0]; - _41.row_major0[1u][0] = ((device float*)&_29.col_major0[0])[1u]; + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; } kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp index e754b5dc4d..3ec8376f40 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp @@ -84,8 +84,8 @@ void copy_columns(device SSBOCol& _29, device SSBORow& _41) static inline __attribute__((always_inline)) void copy_elements(device SSBOCol& _29, device SSBORow& _41) { - _29.col_major0[0][1u] = _41.row_major0[1u][0]; - _41.row_major0[1u][0] = _29.col_major0[0][1u]; + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; } kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp index 7c5c913b76..3aa52aac57 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp @@ -81,8 +81,8 @@ void copy_columns(device SSBOCol& _29, device SSBORow& _41) static inline __attribute__((always_inline)) void copy_elements(device SSBOCol& _29, device SSBORow& _41) { - ((device float*)&_29.col_major0[0])[1u] = _41.row_major0[1u][0]; - _41.row_major0[1u][0] = ((device float*)&_29.col_major0[0])[1u]; + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; } kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp index 7735f00a6b..e0ebb2ffab 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp @@ -80,8 +80,8 @@ void copy_columns(device SSBOCol& _29, device SSBORow& _41) static inline __attribute__((always_inline)) void copy_elements(device SSBOCol& _29, device SSBORow& _41) { - _29.col_major0[0][1u] = ((device float*)&_41.row_major0[1u])[0]; - ((device float*)&_41.row_major0[1u])[0] = _29.col_major0[0][1u]; + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; } kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp index 587ee4ad15..15f4efe8ca 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp @@ -17,6 +17,6 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); kernel void main0(device SSBOScalar& buffer_scalar [[buffer(0)]]) { - buffer_scalar.v[1].a[1u] = 1.0; + ((device float*)&buffer_scalar.v[1].a)[1u] = 1.0; } diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-recursive.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-recursive.comp index e0652b933d..8b56d61be8 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-recursive.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-recursive.comp @@ -28,6 +28,6 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); kernel void main0(device SSBOScalar& buffer_scalar [[buffer(0)]]) { - buffer_scalar.baz.a.a.a[3u] = 10.0; + ((device float*)&buffer_scalar.baz.a.a.a)[3u] = 10.0; } diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing.comp index a86809fee9..c0b2e1edc9 100644 --- a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing.comp +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing.comp @@ -23,7 +23,7 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); kernel void main0(device SSBOScalar& buffer_scalar [[buffer(0)]]) { - buffer_scalar.foo.a[0u] = 10.0; - buffer_scalar.bar.a[0u] = 20.0; + ((device float*)&buffer_scalar.foo.a)[0u] = 10.0; + ((device float*)&buffer_scalar.bar.a)[0u] = 20.0; } diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/block-io-array-copy.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/block-io-array-copy.vert new file mode 100644 index 0000000000..78b1a5b1e9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/block-io-array-copy.vert @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Vertex +{ + float2 umbrage; + spvUnsafeArray offset; +}; + +struct main0_out +{ + float2 aa_umbrage [[user(locn1)]]; + float4 aa_offset_0 [[user(locn2)]]; + float4 aa_offset_1 [[user(locn3)]]; + float4 aa_offset_2 [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 dd_0 [[attribute(3)]]; +}; + +static inline __attribute__((always_inline)) +void Wobble(thread const float2& uu, thread spvUnsafeArray& offset) +{ + offset[0] = float4(uu.xyxy); + offset[1] = float4(uu.xyxy); + offset[2] = float4(uu.xyxy); +} + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Vertex aa = {}; + spvUnsafeArray dd = {}; + dd[0] = in.dd_0; + float2 param = dd[0].xy; + spvUnsafeArray param_1; + Wobble(param, param_1); + aa.offset = param_1; + out.gl_Position = float4(1.0, 1.0, 0.0, 1.0); + out.aa_umbrage = aa.umbrage; + out.aa_offset_0 = aa.offset[0]; + out.aa_offset_1 = aa.offset[1]; + out.aa_offset_2 = aa.offset[2]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/fma.spv16.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/fma.spv16.asm.comp new file mode 100644 index 0000000000..aac1a07b1c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/fma.spv16.asm.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +struct SSBO +{ + float4 in_data[1]; +}; + +kernel void main0(device SSBO2& _4 [[buffer(0)]], device SSBO& _6 [[buffer(1)]]) +{ + _4.out_data[0] = fma(_6.in_data[0], _6.in_data[1], _6.in_data[1]); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp index 4a04262810..0301e50e62 100644 --- a/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp @@ -18,9 +18,9 @@ struct bar }; static inline __attribute__((always_inline)) -device foo* select_buffer(device foo& a, constant bar& cb) +device foo* select_buffer(device foo* a, constant bar& cb) { - return (cb.d != 0) ? &a : nullptr; + return (cb.d != 0) ? a : nullptr; } static inline __attribute__((always_inline)) @@ -31,7 +31,7 @@ thread uint3* select_input(thread uint3& gl_GlobalInvocationID, thread uint3& gl kernel void main0(device foo& buf [[buffer(0)]], constant bar& cb [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) { - device foo* _44 = select_buffer(buf, cb); + device foo* _44 = select_buffer(&buf, cb); device foo* _65 = _44; thread uint3* _45 = select_input(gl_GlobalInvocationID, gl_LocalInvocationID, cb); device foo* _66 = _65; diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp index 00c490c77f..12ecff77a7 100644 --- a/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp @@ -16,14 +16,14 @@ struct bar }; static inline __attribute__((always_inline)) -device int* _24(device foo& a, device bar& b, thread uint3& gl_GlobalInvocationID) +device int* _24(device foo* a, device bar* b, thread uint3& gl_GlobalInvocationID) { - return (gl_GlobalInvocationID.x != 0u) ? &a.a : &b.b; + return (gl_GlobalInvocationID.x != 0u) ? &a->a : &b->b; } kernel void main0(device foo& x [[buffer(0)]], device bar& y [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { - device int* _34 = _24(x, y, gl_GlobalInvocationID); + device int* _34 = _24(&x, &y, gl_GlobalInvocationID); device int* _33 = _34; int _37 = x.a; *_33 = 0; diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/bitcast-ptr-vec.argument-tier-1.msl23.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/bitcast-ptr-vec.argument-tier-1.msl23.asm.frag index c691f1de16..48c72019ee 100644 --- a/third_party/spirv-cross/reference/shaders-msl/asm/frag/bitcast-ptr-vec.argument-tier-1.msl23.asm.frag +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/bitcast-ptr-vec.argument-tier-1.msl23.asm.frag @@ -14,13 +14,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -36,16 +32,16 @@ struct main0_out float4 out_var_SV_Target [[color(0)]]; }; -fragment main0_out main0(constant type_ConstantBuffer_PushConstants& g_PushConstants [[buffer(0)]], const device spvDescriptor>* g_Texture2DDescriptorHeap_ [[buffer(1)]], float4 gl_FragCoord [[position]]) +fragment main0_out main0(constant type_ConstantBuffer_PushConstants& g_PushConstants [[buffer(0)]], device const void* spvDescriptorSet0Binding0 [[buffer(1)]], float4 gl_FragCoord [[position]]) { - spvDescriptorArray> g_Texture2DDescriptorHeap {g_Texture2DDescriptorHeap_}; + spvDescriptorArray> g_Texture2DDescriptorHeap {spvDescriptorSet0Binding0}; main0_out out = {}; - int2 _55 = int2(gl_FragCoord.xy) - (*(reinterpret_cast(g_PushConstants.SharedConstants + 16ul))); + int2 _55 = int2(gl_FragCoord.xy) - (*(reinterpret_cast(g_PushConstants.SharedConstants + 16ul))); bool _66; if (!any(_55 < int2(0))) { - _66 = any(_55 >= (*(reinterpret_cast(g_PushConstants.SharedConstants + 24ul)))); + _66 = any(_55 >= (*(reinterpret_cast(g_PushConstants.SharedConstants + 24ul)))); } else { @@ -58,9 +54,9 @@ fragment main0_out main0(constant type_ConstantBuffer_PushConstants& g_PushConst } else { - _77 = g_Texture2DDescriptorHeap[*(reinterpret_cast(g_PushConstants.SharedConstants + 12ul))].read(uint2(int3(select(_55, int2(0), bool2(_66)), 0).xy), 0); + _77 = g_Texture2DDescriptorHeap[*(reinterpret_cast(g_PushConstants.SharedConstants + 12ul))].read(uint2(int3(select(_55, int2(0), bool2(_66)), 0).xy), 0); } - float3 _81 = powr(_77.xyz, *(reinterpret_cast(g_PushConstants.SharedConstants))); + float3 _81 = powr(_77.xyz, *(reinterpret_cast(g_PushConstants.SharedConstants))); out.out_var_SV_Target = float4(_81.x, _81.y, _81.z, _77.w); return out; } diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag new file mode 100644 index 0000000000..f4015d5116 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +constant bool _3_tmp [[function_constant(0)]]; +constant bool _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : true; +constant uint _4 = is_function_constant_defined(_3_tmp) ? uint(_3_tmp) : 0u; + +struct main0_out +{ + float4 m_2 [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.m_2 = float4(float(_4) + float(_3)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh b/third_party/spirv-cross/reference/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh new file mode 100644 index 0000000000..f8f759c145 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh @@ -0,0 +1,100 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } + + object_data T& operator [] (size_t pos) object_data + { + return elements[pos]; + } + constexpr const object_data T& operator [] (size_t pos) const object_data + { + return elements[pos]; + } +}; + +void spvSetMeshOutputsEXT(uint gl_LocalInvocationIndex, threadgroup uint2& spvMeshSizes, uint vertexCount, uint primitiveCount) +{ + if (gl_LocalInvocationIndex == 0) + { + spvMeshSizes.x = vertexCount; + spvMeshSizes.y = primitiveCount; + } +} + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(128u, 1u, 1u); + +struct spvPerPrimitive +{ + float4 m_17 [[user(locn0)]]; +}; + +using spvMesh_t = mesh; + +static inline __attribute__((always_inline)) +void _4(thread uint& gl_LocalInvocationIndex, threadgroup uint2& spvMeshSizes) +{ + spvSetMeshOutputsEXT(gl_LocalInvocationIndex, spvMeshSizes, 0u, 0u); +} + +[[mesh]] void main0(uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], spvMesh_t spvMesh) +{ + threadgroup uint2 spvMeshSizes; + threadgroup spvUnsafeArray _17; + if (gl_LocalInvocationIndex == 0) spvMeshSizes.y = 0u; + _4(gl_LocalInvocationIndex, spvMeshSizes); + threadgroup_barrier(mem_flags::mem_threadgroup); + if (spvMeshSizes.y == 0) + { + return; + } + spvMesh.set_primitive_count(spvMeshSizes.y); + const uint spvThreadCount [[maybe_unused]] = (gl_WorkGroupSize.x * gl_WorkGroupSize.y * gl_WorkGroupSize.z); + for (uint spvPI = gl_LocalInvocationIndex; spvPI < spvMeshSizes.y; spvPI += spvThreadCount) + { + spvPerPrimitive spvP = {}; + spvP.m_17 = _17[spvPI]; + spvMesh.set_primitive(spvPI, spvP); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc b/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc index 6c9903e02b..d3fbdd0c93 100644 --- a/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc +++ b/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc @@ -13,7 +13,7 @@ struct TessLevels float outer3; }; -kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +kernel void main0(device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) { spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0); diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc b/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc index 79395a4bbb..2d840168fb 100644 --- a/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc +++ b/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc @@ -13,7 +13,7 @@ struct TessLevels float outer3; }; -kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +kernel void main0(device TessLevels& sb_levels [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) { uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0); diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp index 18cfd68c19..14bfd9437a 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp @@ -27,15 +27,15 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); struct spvDescriptorSetBuffer0 { - const device SSBO0* ssbo0 [[id(0)]]; + device SSBO0* ssbo0 [[id(0)]]; }; struct spvDescriptorSetBuffer1 { - const device SSBO1* ssbo1 [[id(0)]]; + device SSBO1* ssbo1 [[id(0)]]; }; -kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], device SSBO3& ssbo3 [[buffer(2)]], const device SSBO2& ssbo2 [[buffer(3)]]) +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], device SSBO3& ssbo3 [[buffer(2)]], device SSBO2& ssbo2 [[buffer(3)]]) { ssbo3.v = ((*spvDescriptorSet0.ssbo0).v + (*spvDescriptorSet1.ssbo1).v) + ssbo2.v; } diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp index 29a328096c..c4b52a5d2e 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp @@ -14,13 +14,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -73,7 +69,7 @@ void in_func(device SSBO& o, thread uint3& gl_GlobalInvocationID, constant UBO& o.v[gl_GlobalInvocationID.x] = ws[gl_WorkGroupID.x]->v; } -kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { spvDescriptorArray vs {spvDescriptorSet0.vs}; spvDescriptorArray ws {spvDescriptorSet1.ws}; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array-buffer.rich-descriptor.argument.device-argument-buffer.argument-tier-1.msl2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array-buffer.rich-descriptor.argument.device-argument-buffer.argument-tier-1.msl2.comp index 307f8952ce..37308af216 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array-buffer.rich-descriptor.argument.device-argument-buffer.argument-tier-1.msl2.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array-buffer.rich-descriptor.argument.device-argument-buffer.argument-tier-1.msl2.comp @@ -12,47 +12,32 @@ struct spvDescriptor }; template -struct spvBufferDescriptor +struct spvBufferDescriptor; + +template +struct spvBufferDescriptor { - T value; + device T* value; int length; - const device T& operator -> () const device - { - return value; - } - const device T& operator * () const device - { - return value; - } + int padding; }; template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; template struct spvDescriptorArray { - spvDescriptorArray(const device spvBufferDescriptor* ptr) : ptr(ptr) - { - } - const device T* operator [] (size_t i) const - { - return ptr[i].value; - } - const int length(int i) const - { - return ptr[i].length; - } + spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + device T* operator [] (size_t i) const { return ptr[i].value; } + int length(int i) const { return ptr[i].length; } const device spvBufferDescriptor* ptr; }; @@ -105,7 +90,7 @@ void in_func(device SSBO& o, thread uint3& gl_GlobalInvocationID, constant UBO& o.v[gl_GlobalInvocationID.x] = ws[gl_WorkGroupID.x]->v; } -kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { spvDescriptorArray vs {spvDescriptorSet0.vs}; spvDescriptorArray ws {spvDescriptorSet1.ws}; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array.argument.device-argument-buffer.argument-tier-1.msl2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array.argument.device-argument-buffer.argument-tier-1.msl2.comp index 02325c1e50..113e54ad45 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array.argument.device-argument-buffer.argument-tier-1.msl2.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-runtime-array.argument.device-argument-buffer.argument-tier-1.msl2.comp @@ -14,13 +14,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -51,7 +47,7 @@ void in_func(device SSBO& _13, thread uint3& gl_GlobalInvocationID, texture2d> Ts {spvDescriptorSet0.Ts}; spvDescriptorArray Ss {spvDescriptorSet1.Ss}; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/basic.comp b/third_party/spirv-cross/reference/shaders-msl/comp/basic.comp index 42518f0d1d..ff13841cd2 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/basic.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/basic.comp @@ -23,7 +23,7 @@ struct SSBO3 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 idata = _23.in_data[ident]; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.comp b/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.comp index 92d517cffb..0e6d846d19 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.comp @@ -25,7 +25,7 @@ constant uint _59_tmp [[function_constant(10)]]; constant uint _59 = is_function_constant_defined(_59_tmp) ? _59_tmp : 1u; constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_59, 1u, 1u); -kernel void main0(const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 spvDispatchBase [[grid_origin]]) +kernel void main0(device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 spvDispatchBase [[grid_origin]]) { gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; gl_WorkGroupID += spvDispatchBase; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.msl11.comp b/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.msl11.comp index 87b0b44291..99040f065f 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.msl11.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.msl11.comp @@ -23,7 +23,7 @@ struct SSBO3 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(constant uint3& spvDispatchBase [[buffer(29)]], const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(constant uint3& spvDispatchBase [[buffer(29)]], device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; gl_WorkGroupID += spvDispatchBase; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp b/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp index 35b7af540c..40090dd223 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp @@ -10,7 +10,7 @@ struct t24 int4 m0[2]; int m1; ulong2 m2[2]; - device t21* m3; + const device t21* m3; float2x4 m4; }; @@ -19,7 +19,7 @@ struct t21 int4 m0[2]; int m1; ulong2 m2[2]; - device t21* m3; + const device t21* m3; float2x4 m4; }; @@ -40,20 +40,20 @@ kernel void main0(constant t24& u24 [[buffer(0)]], constant t35& u35 [[buffer(1) v8 |= int(u24.m4[1u][0] - 5.0); v8 |= int(u24.m4[0u][1] - 4.0); v8 |= int(u24.m4[1u][1] - 6.0); - v8 |= (((device t21*)u24.m2[0].x)->m0[0].x - 3); - v8 |= (((device t21*)u24.m2[0].x)->m0[u35.m0[1]].x - 4); - v8 |= (((device t21*)u24.m2[0].x)->m1 - 5); - v8 |= int(((device t21*)u24.m2[0].x)->m4[0u][0] - 6.0); - v8 |= int(((device t21*)u24.m2[0].x)->m4[1u][0] - 8.0); - v8 |= int(((device t21*)u24.m2[0].x)->m4[0u][1] - 7.0); - v8 |= int(((device t21*)u24.m2[0].x)->m4[1u][1] - 9.0); - v8 |= (((device t21*)u24.m2[u35.m0[1]].x)->m0[0].x - 6); - v8 |= (((device t21*)u24.m2[u35.m0[1]].x)->m0[u35.m0[1]].x - 7); - v8 |= (((device t21*)u24.m2[u35.m0[1]].x)->m1 - 8); - v8 |= int(((device t21*)u24.m2[u35.m0[1]].x)->m4[0u][0] - 9.0); - v8 |= int(((device t21*)u24.m2[u35.m0[1]].x)->m4[1u][0] - 11.0); - v8 |= int(((device t21*)u24.m2[u35.m0[1]].x)->m4[0u][1] - 10.0); - v8 |= int(((device t21*)u24.m2[u35.m0[1]].x)->m4[1u][1] - 12.0); + v8 |= (((const device t21*)u24.m2[0].x)->m0[0].x - 3); + v8 |= (((const device t21*)u24.m2[0].x)->m0[u35.m0[1]].x - 4); + v8 |= (((const device t21*)u24.m2[0].x)->m1 - 5); + v8 |= int(((const device t21*)u24.m2[0].x)->m4[0u][0] - 6.0); + v8 |= int(((const device t21*)u24.m2[0].x)->m4[1u][0] - 8.0); + v8 |= int(((const device t21*)u24.m2[0].x)->m4[0u][1] - 7.0); + v8 |= int(((const device t21*)u24.m2[0].x)->m4[1u][1] - 9.0); + v8 |= (((const device t21*)u24.m2[u35.m0[1]].x)->m0[0].x - 6); + v8 |= (((const device t21*)u24.m2[u35.m0[1]].x)->m0[u35.m0[1]].x - 7); + v8 |= (((const device t21*)u24.m2[u35.m0[1]].x)->m1 - 8); + v8 |= int(((const device t21*)u24.m2[u35.m0[1]].x)->m4[0u][0] - 9.0); + v8 |= int(((const device t21*)u24.m2[u35.m0[1]].x)->m4[1u][0] - 11.0); + v8 |= int(((const device t21*)u24.m2[u35.m0[1]].x)->m4[0u][1] - 10.0); + v8 |= int(((const device t21*)u24.m2[u35.m0[1]].x)->m4[1u][1] - 12.0); v8 |= (u24.m3->m0[0].x - 9); v8 |= (u24.m3->m0[u35.m0[1]].x - 10); v8 |= (u24.m3->m1 - 11); diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp b/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp new file mode 100644 index 0000000000..e287f82a04 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp @@ -0,0 +1,51 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvDescriptor +{ + T value; +}; + +template +struct spvDescriptorArray +{ + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } + const device T* ptr; +}; + +struct SSBOW +{ + char _m0_pad[4]; + float a; +}; + +struct SSBO +{ + float b; +}; + +static inline __attribute__((always_inline)) +void in_func(const spvDescriptorArray RW, thread uint3& gl_WorkGroupID, const spvDescriptorArray RO) +{ + RW[gl_WorkGroupID.x]->a = RO[gl_WorkGroupID.x]->b; +} + +kernel void main0(device void* spvBufferAliasSet0Binding0 [[buffer(0)]], device void* spvBufferAliasSet1Binding0 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + spvDescriptorArray RW {spvBufferAliasSet0Binding0}; + spvDescriptorArray RO {spvBufferAliasSet0Binding0}; + spvDescriptorArray> tex2d {spvBufferAliasSet1Binding0}; + spvDescriptorArray> tex3d {spvBufferAliasSet1Binding0}; + + in_func(RW, gl_WorkGroupID, RO); + RW[0]->a += tex2d[gl_WorkGroupID.x].read(uint2(int2(0)), 0).x; + RW[0]->a += tex3d[gl_WorkGroupID.x].read(uint3(int3(10)), 1).x; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp b/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp new file mode 100644 index 0000000000..a745d55ea7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp @@ -0,0 +1,57 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvBufferDescriptor; + +template +struct spvBufferDescriptor +{ + device T* value; + int length; + int padding; +}; + +template +struct spvDescriptorArray; + +template +struct spvDescriptorArray +{ + spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + device T* operator [] (size_t i) const { return ptr[i].value; } + int length(int i) const { return ptr[i].length; } + const device spvBufferDescriptor* ptr; +}; + +struct SSBOW +{ + char _m0_pad[4]; + float a; +}; + +struct SSBO +{ + float b; + float unsized[1]; +}; + +static inline __attribute__((always_inline)) +void in_func(const spvDescriptorArray RW, thread uint3& gl_WorkGroupID, const spvDescriptorArray RO) +{ + RW[gl_WorkGroupID.x]->a = RO[gl_WorkGroupID.x]->b + float(int((RO.length(gl_WorkGroupID.x) - 4) / 4)); +} + +kernel void main0(device void* spvBufferAliasSet0Binding0 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + spvDescriptorArray RW {spvBufferAliasSet0Binding0}; + spvDescriptorArray RO {spvBufferAliasSet0Binding0}; + + in_func(RW, gl_WorkGroupID, RO); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp b/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp new file mode 100644 index 0000000000..8d9b729244 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp @@ -0,0 +1,47 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvDescriptor +{ + T value; +}; + +template +struct spvDescriptorArray +{ + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } + const device T* ptr; +}; + +struct SSBOW +{ + char _m0_pad[4]; + float a; +}; + +struct SSBO +{ + float b; +}; + +static inline __attribute__((always_inline)) +void in_func(const spvDescriptorArray RW, thread uint3& gl_WorkGroupID, const spvDescriptorArray RO) +{ + RW[gl_WorkGroupID.x]->a = RO[gl_WorkGroupID.x]->b; +} + +kernel void main0(device const void* spvDescriptorSet1Binding0 [[buffer(0)]], device const void* spvDescriptorSet0Binding0 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + spvDescriptorArray RW {spvDescriptorSet1Binding0}; + spvDescriptorArray RO {spvDescriptorSet0Binding0}; + + in_func(RW, gl_WorkGroupID, RO); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/culling.comp b/third_party/spirv-cross/reference/shaders-msl/comp/culling.comp index 13578363b7..5dab9e4d40 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/culling.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/culling.comp @@ -23,7 +23,7 @@ struct SSBO3 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); -kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float idata = _22.in_data[ident]; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/dowhile.comp b/third_party/spirv-cross/reference/shaders-msl/comp/dowhile.comp index 2b4de9ebb7..abd63ccb75 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/dowhile.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/dowhile.comp @@ -16,7 +16,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; int i = 0; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/extended-shuffle-types.msl23.comp b/third_party/spirv-cross/reference/shaders-msl/comp/extended-shuffle-types.msl23.comp new file mode 100644 index 0000000000..7c00ab6d21 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/extended-shuffle-types.msl23.comp @@ -0,0 +1,119 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return simd_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!simd_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)simd_shuffle((vec)value, lane); +} + +template<> +inline ulong spvSubgroupShuffle(ulong value, ushort lane) +{ + return as_type(spvSubgroupShuffle(as_type(value), lane)); +} + +template<> +inline ulong2 spvSubgroupShuffle(ulong2 value, ushort lane) +{ + return ulong2(spvSubgroupShuffle(value.x, lane), spvSubgroupShuffle(value.y, lane)); +} + +inline ulong3 spvSubgroupShuffle(ulong3 value, ushort lane) +{ + return ulong3(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.z, lane)); +} + +inline ulong4 spvSubgroupShuffle(ulong4 value, ushort lane) +{ + return ulong4(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.zw, lane)); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return vec(spvSubgroupShuffle(vec(value), lane)); +} + +struct SSBO +{ + uchar u8_1[4]; + char2 i8_2[4]; + uchar3 u8_3[4]; + char4 i8_4[4]; + ushort u16_1[4]; + short2 i16_2[4]; + ushort3 u16_3[4]; + short4 i16_4[4]; + half f16_1[4]; + half2 f16_2[4]; + half3 f16_3[4]; + half4 f16_4[4]; + ulong u64_1[4]; + long2 i64_2[4]; + ulong3 u64_3[4]; + long4 i64_4[4]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +static inline __attribute__((always_inline)) +void int80(device SSBO& _53, thread uint& gl_LocalInvocationIndex, thread uint& gl_SubgroupInvocationID) +{ + _53.u8_1[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u8_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.i8_2[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i8_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.u8_3[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u8_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.i8_4[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i8_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +static inline __attribute__((always_inline)) +void int160(device SSBO& _53, thread uint& gl_LocalInvocationIndex, thread uint& gl_SubgroupInvocationID) +{ + _53.u16_1[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u16_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.i16_2[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i16_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.u16_3[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u16_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.i16_4[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i16_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +static inline __attribute__((always_inline)) +void int64(device SSBO& _53, thread uint& gl_LocalInvocationIndex, thread uint& gl_SubgroupInvocationID) +{ + _53.u64_1[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u64_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.i64_2[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i64_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.u64_3[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.u64_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.i64_4[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.i64_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +static inline __attribute__((always_inline)) +void fp16(device SSBO& _53, thread uint& gl_LocalInvocationIndex, thread uint& gl_SubgroupInvocationID) +{ + _53.f16_1[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.f16_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.f16_2[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.f16_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.f16_3[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.f16_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _53.f16_4[gl_LocalInvocationIndex] = spvSubgroupShuffle(_53.f16_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +kernel void main0(device SSBO& _53 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + int80(_53, gl_LocalInvocationIndex, gl_SubgroupInvocationID); + int160(_53, gl_LocalInvocationIndex, gl_SubgroupInvocationID); + int64(_53, gl_LocalInvocationIndex, gl_SubgroupInvocationID); + fp16(_53, gl_LocalInvocationIndex, gl_SubgroupInvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/inverse.comp b/third_party/spirv-cross/reference/shaders-msl/comp/inverse.comp index 0a1d298b0d..cfef152b70 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/inverse.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/inverse.comp @@ -121,7 +121,7 @@ struct MatrixIn constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device MatrixOut& _15 [[buffer(0)]], const device MatrixIn& _20 [[buffer(1)]]) +kernel void main0(device MatrixOut& _15 [[buffer(0)]], device MatrixIn& _20 [[buffer(1)]]) { _15.m2out = spvInverse2x2(_20.m2in); _15.m3out = spvInverse3x3(_20.m3in); diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.comp b/third_party/spirv-cross/reference/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.comp index 4dfda2705a..db2c1a524c 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.comp @@ -8,20 +8,20 @@ struct recurs; struct recurs { int m1; - device recurs* m2; + const device recurs* m2; }; struct recurs_1 { int m1; - device recurs_1* m2; + const device recurs_1* m2; }; constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); struct spvDescriptorSetBuffer0 { - device recurs* nums [[id(0)]]; + const device recurs* nums [[id(0)]]; texture2d tex [[id(1)]]; }; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.comp b/third_party/spirv-cross/reference/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.comp index 939619c5db..792240e178 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.comp @@ -8,20 +8,20 @@ struct recurs; struct recurs { int m1; - device recurs* m2; + const device recurs* m2; }; struct recurs_1 { int m1; - device recurs_1* m2; + const device recurs_1* m2; }; constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device void* nums_vp [[buffer(0)]], texture2d tex [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(const device void* nums_vp [[buffer(0)]], texture2d tex [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { - device auto& nums = *(device recurs*)nums_vp; + const device auto& nums = *(const device recurs*)nums_vp; int rslt = 0; rslt += nums.m1; rslt += nums.m2->m1; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/mod.comp b/third_party/spirv-cross/reference/shaders-msl/comp/mod.comp index 9bbbcbba84..8f7c024d78 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/mod.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/mod.comp @@ -32,7 +32,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 v = mod(_23.in_data[ident], _33.out_data[ident]); diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/modf.comp b/third_party/spirv-cross/reference/shaders-msl/comp/modf.comp index b4ee38b0e8..4e30c135c6 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/modf.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/modf.comp @@ -21,7 +21,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; ResType _32; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/outer-product.comp b/third_party/spirv-cross/reference/shaders-msl/comp/outer-product.comp index e589642dbd..d393dc9db1 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/outer-product.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/outer-product.comp @@ -25,7 +25,7 @@ struct ReadSSBO constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device SSBO& _21 [[buffer(0)]], const device ReadSSBO& _26 [[buffer(1)]]) +kernel void main0(device SSBO& _21 [[buffer(0)]], device ReadSSBO& _26 [[buffer(1)]]) { _21.m22 = float2x2(_26.v2 * _26.v2.x, _26.v2 * _26.v2.y); _21.m23 = float2x3(_26.v3 * _26.v2.x, _26.v3 * _26.v2.y); diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/overlapping-bindings.msl31.argument.argument-tier-1.decoration-binding.device-argument-buffer.texture-buffer-native.comp b/third_party/spirv-cross/reference/shaders-msl/comp/overlapping-bindings.msl31.argument.argument-tier-1.decoration-binding.device-argument-buffer.texture-buffer-native.comp index 938eea96a5..33fd574603 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/overlapping-bindings.msl31.argument.argument-tier-1.decoration-binding.device-argument-buffer.texture-buffer-native.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/overlapping-bindings.msl31.argument.argument-tier-1.decoration-binding.device-argument-buffer.texture-buffer-native.comp @@ -15,13 +15,9 @@ struct spvDescriptor template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; @@ -81,7 +77,7 @@ struct spvDescriptorSetBuffer0 struct spvDescriptorSetBuffer1 { - spvDescriptor b30 [[id(0)]][1] /* unsized array hack */; + spvDescriptor b30 [[id(0)]][1] /* unsized array hack */; // Overlapping binding: spvDescriptor b31 [[id(0)]][1] /* unsized array hack */; // Overlapping binding: spvDescriptor> t30 [[id(0)]][1] /* unsized array hack */; // Overlapping binding: spvDescriptor> t31 [[id(0)]][1] /* unsized array hack */; @@ -92,7 +88,7 @@ struct spvDescriptorSetBuffer1 struct spvDescriptorSetBuffer2 { - device B20* b20 [[id(0)]][8]; + const device B20* b20 [[id(0)]][8]; // Overlapping binding: constant B21* b21 [[id(0)]][8]; // Overlapping binding: array, 8> t20 [[id(0)]]; // Overlapping binding: array, 8> t21 [[id(0)]]; @@ -103,14 +99,14 @@ struct spvDescriptorSetBuffer2 struct spvDescriptorSetBuffer3 { - device B10* b10 [[id(0)]][8]; + const device B10* b10 [[id(0)]][8]; // Overlapping binding: constant B11* b11 [[id(0)]][8]; // Overlapping binding: array, 8> u1 [[id(0)]]; }; struct spvDescriptorSetBuffer4 { - device B40* b40 [[id(0)]]; + const device B40* b40 [[id(0)]]; // Overlapping binding: constant B41* b41 [[id(0)]]; // Overlapping binding: depth2d t40 [[id(0)]]; // Overlapping binding: texture2d t41 [[id(0)]]; @@ -120,7 +116,7 @@ struct spvDescriptorSetBuffer4 }; static inline __attribute__((always_inline)) -void in_function(thread float4& r0, const device array, 8>& t00, const device array& s00, const device array, 8>& t01, const device array, 8>& t02, const device array, 8>& u0, thread float4& r1, device B10* constant (&b10)[8], constant B11* constant (&b11)[8], constant array, 8>& u1, thread float4& r2, constant array, 8>& t20, constant array& s20, constant array, 8>& t21, constant array, 8>& t22, device B20* constant (&b20)[8], constant array, 8>& u2, constant B21* constant (&b21)[8], const spvDescriptorArray b30, thread uint3& gl_WorkGroupID, thread float4& r3, const spvDescriptorArray> t30, const spvDescriptorArray s30, const spvDescriptorArray> t31, const spvDescriptorArray> t32, const spvDescriptorArray b31, const spvDescriptorArray> u3, thread float4& r4, depth2d t40, sampler s40, texture2d t41, texture2d t42, device B40& b40, constant B41& b41, texture_buffer u4) +void in_function(thread float4& r0, const device array, 8>& t00, const device array& s00, const device array, 8>& t01, const device array, 8>& t02, const device array, 8>& u0, thread float4& r1, const device B10* constant (&b10)[8], constant B11* constant (&b11)[8], constant array, 8>& u1, thread float4& r2, constant array, 8>& t20, constant array& s20, constant array, 8>& t21, constant array, 8>& t22, const device B20* constant (&b20)[8], constant array, 8>& u2, constant B21* constant (&b21)[8], const spvDescriptorArray b30, thread uint3& gl_WorkGroupID, thread float4& r3, const spvDescriptorArray> t30, const spvDescriptorArray s30, const spvDescriptorArray> t31, const spvDescriptorArray> t32, const spvDescriptorArray b31, const spvDescriptorArray> u3, thread float4& r4, depth2d t40, sampler s40, texture2d t41, texture2d t42, const device B40& b40, constant B41& b41, texture_buffer u4) { r0 = t00[0].sample(s00[3], float2(0.0), level(0.0)); r0.x = as_type(t01[1].read(uint2(int2(0)), 0).x); @@ -160,7 +156,7 @@ void in_function(thread float4& r0, const device array, 8>& t00 kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]], constant spvDescriptorSetBuffer3& spvDescriptorSet3 [[buffer(3)]], constant spvDescriptorSetBuffer4& spvDescriptorSet4 [[buffer(4)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { - spvDescriptorArray b30 {spvDescriptorSet1.b30}; + spvDescriptorArray b30 {spvDescriptorSet1.b30}; spvDescriptorArray> t30 {reinterpret_cast>*>(&spvDescriptorSet1.b30)}; spvDescriptorArray s30 {reinterpret_cast*>(&spvDescriptorSet1.b30)}; spvDescriptorArray> t31 {reinterpret_cast>*>(&spvDescriptorSet1.b30)}; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.decoration-binding.comp b/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.decoration-binding.comp index a689746711..95fa6e9a5e 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.decoration-binding.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.decoration-binding.comp @@ -94,16 +94,16 @@ struct spvDescriptorSetBuffer0 // Overlapping binding: constant UBO_D* ubo_d [[id(1)]]; device SSBO_As* ssbo_as [[id(2)]][4]; // Overlapping binding: device SSBO_Bs* ssbo_bs [[id(2)]][4]; - // Overlapping binding: const device SSBO_BsRO* ssbo_bs_readonly [[id(2)]][4]; + // Overlapping binding: device SSBO_BsRO* ssbo_bs_readonly [[id(2)]][4]; constant UBO_Cs* ubo_cs [[id(6)]][4]; // Overlapping binding: constant UBO_Ds* ubo_ds [[id(6)]][4]; device SSBO_A* ssbo_a [[id(10)]]; // Overlapping binding: device SSBO_B* ssbo_b [[id(10)]]; - // Overlapping binding: const device SSBO_BRO* ssbo_b_readonly [[id(10)]]; + // Overlapping binding: device SSBO_BRO* ssbo_b_readonly [[id(10)]]; }; static inline __attribute__((always_inline)) -void func0(device SSBO_A& ssbo_a, thread uint3& gl_GlobalInvocationID, constant UBO_C& ubo_c, thread uint3& gl_WorkGroupID, constant Registers& _42, device SSBO_B& ssbo_b, constant UBO_D& ubo_d, const device SSBO_BRO& ssbo_b_readonly) +void func0(device SSBO_A& ssbo_a, thread uint3& gl_GlobalInvocationID, constant UBO_C& ubo_c, thread uint3& gl_WorkGroupID, constant Registers& _42, device SSBO_B& ssbo_b, constant UBO_D& ubo_d, device SSBO_BRO& ssbo_b_readonly) { ssbo_a.data[gl_GlobalInvocationID.x] = ubo_c.data[gl_WorkGroupID.x].x + _42.reg; ssbo_b.data[gl_GlobalInvocationID.x] = ubo_d.data[gl_WorkGroupID.y].xy + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; @@ -116,31 +116,31 @@ void func1(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, de } static inline __attribute__((always_inline)) -void func2(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_Bs* const device (&ssbo_bs)[4], constant UBO_Ds* const device (&ubo_ds)[4], const device SSBO_BsRO* const device (&ssbo_bs_readonly)[4]) +void func2(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_Bs* const device (&ssbo_bs)[4], constant UBO_Ds* const device (&ubo_ds)[4], device SSBO_BsRO* const device (&ssbo_bs_readonly)[4]) { ssbo_bs[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = ubo_ds[gl_WorkGroupID.x]->data[0].xy + ssbo_bs_readonly[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x]; } static inline __attribute__((always_inline)) -void func3(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_E& ssbo_e, constant UBO_G& ubo_g, device SSBO_F& ssbo_f, constant UBO_H& ubo_h, const device SSBO_I& ssbo_i) +void func3(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_E& ssbo_e, constant UBO_G& ubo_g, device SSBO_F& ssbo_f, constant UBO_H& ubo_h, device SSBO_I& ssbo_i) { ssbo_e.data[gl_GlobalInvocationID.x] = ubo_g.data[gl_WorkGroupID.x].x; ssbo_f.data[gl_GlobalInvocationID.x] = ubo_h.data[gl_WorkGroupID.y].xy + ssbo_i.data[gl_GlobalInvocationID.x]; } -kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding11 [[buffer(11)]], constant void* spvBufferAliasSet2Binding12 [[buffer(12)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding11 [[buffer(11)]], constant void* spvBufferAliasSet2Binding12 [[buffer(12)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { device auto& ssbo_e = *(device SSBO_E*)spvBufferAliasSet2Binding11; constant auto& ubo_g = *(constant UBO_G*)spvBufferAliasSet2Binding12; device auto& ssbo_f = *(device SSBO_F*)spvBufferAliasSet2Binding11; constant auto& ubo_h = *(constant UBO_H*)spvBufferAliasSet2Binding12; - const device auto& ssbo_i = *(const device SSBO_I*)spvBufferAliasSet2Binding11; + device auto& ssbo_i = *(device SSBO_I*)spvBufferAliasSet2Binding11; constant auto &ubo_d = *reinterpret_cast(spvDescriptorSet0.ubo_c); const device auto &ssbo_bs = reinterpret_cast(spvDescriptorSet0.ssbo_as); - const device auto &ssbo_bs_readonly = reinterpret_cast(spvDescriptorSet0.ssbo_as); + const device auto &ssbo_bs_readonly = reinterpret_cast(spvDescriptorSet0.ssbo_as); const device auto &ubo_ds = reinterpret_cast(spvDescriptorSet0.ubo_cs); device auto &ssbo_b = *reinterpret_cast(spvDescriptorSet0.ssbo_a); - const device auto &ssbo_b_readonly = *reinterpret_cast(spvDescriptorSet0.ssbo_a); + device auto &ssbo_b_readonly = *reinterpret_cast(spvDescriptorSet0.ssbo_a); func0((*spvDescriptorSet0.ssbo_a), gl_GlobalInvocationID, (*spvDescriptorSet0.ubo_c), gl_WorkGroupID, _42, ssbo_b, ubo_d, ssbo_b_readonly); func1(gl_GlobalInvocationID, gl_WorkGroupID, spvDescriptorSet0.ssbo_as, spvDescriptorSet0.ubo_cs); func2(gl_GlobalInvocationID, gl_WorkGroupID, ssbo_bs, ubo_ds, ssbo_bs_readonly); diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.descriptor-binding.comp b/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.descriptor-binding.comp index d30f12964d..f6562c23ec 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.descriptor-binding.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.descriptor-binding.comp @@ -93,16 +93,16 @@ struct spvDescriptorSetBuffer0 constant UBO_C* ubo_c [[id(1)]]; device SSBO_B* ssbo_b [[id(2)]]; constant UBO_D* ubo_d [[id(3)]]; - const device SSBO_BRO* ssbo_b_readonly [[id(4)]]; + device SSBO_BRO* ssbo_b_readonly [[id(4)]]; device SSBO_As* ssbo_as [[id(5)]][4]; constant UBO_Cs* ubo_cs [[id(9)]][4]; device SSBO_Bs* ssbo_bs [[id(13)]][4]; constant UBO_Ds* ubo_ds [[id(17)]][4]; - const device SSBO_BsRO* ssbo_bs_readonly [[id(21)]][4]; + device SSBO_BsRO* ssbo_bs_readonly [[id(21)]][4]; }; static inline __attribute__((always_inline)) -void func0(device SSBO_A& ssbo_a, thread uint3& gl_GlobalInvocationID, constant UBO_C& ubo_c, thread uint3& gl_WorkGroupID, constant Registers& _42, device SSBO_B& ssbo_b, constant UBO_D& ubo_d, const device SSBO_BRO& ssbo_b_readonly) +void func0(device SSBO_A& ssbo_a, thread uint3& gl_GlobalInvocationID, constant UBO_C& ubo_c, thread uint3& gl_WorkGroupID, constant Registers& _42, device SSBO_B& ssbo_b, constant UBO_D& ubo_d, device SSBO_BRO& ssbo_b_readonly) { ssbo_a.data[gl_GlobalInvocationID.x] = ubo_c.data[gl_WorkGroupID.x].x + _42.reg; ssbo_b.data[gl_GlobalInvocationID.x] = ubo_d.data[gl_WorkGroupID.y].xy + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; @@ -115,13 +115,13 @@ void func1(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, de } static inline __attribute__((always_inline)) -void func2(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_Bs* constant (&ssbo_bs)[4], constant UBO_Ds* constant (&ubo_ds)[4], const device SSBO_BsRO* constant (&ssbo_bs_readonly)[4]) +void func2(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_Bs* constant (&ssbo_bs)[4], constant UBO_Ds* constant (&ubo_ds)[4], device SSBO_BsRO* constant (&ssbo_bs_readonly)[4]) { ssbo_bs[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = ubo_ds[gl_WorkGroupID.x]->data[0].xy + ssbo_bs_readonly[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x]; } static inline __attribute__((always_inline)) -void func3(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_E& ssbo_e, constant UBO_G& ubo_g, device SSBO_F& ssbo_f, constant UBO_H& ubo_h, const device SSBO_I& ssbo_i) +void func3(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_E& ssbo_e, constant UBO_G& ubo_g, device SSBO_F& ssbo_f, constant UBO_H& ubo_h, device SSBO_I& ssbo_i) { ssbo_e.data[gl_GlobalInvocationID.x] = ubo_g.data[gl_WorkGroupID.x].x; ssbo_f.data[gl_GlobalInvocationID.x] = ubo_h.data[gl_WorkGroupID.y].xy + ssbo_i.data[gl_GlobalInvocationID.x]; @@ -133,7 +133,7 @@ kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0 constant auto& ubo_g = *(constant UBO_G*)spvBufferAliasSet2Binding1; device auto& ssbo_f = *(device SSBO_F*)spvBufferAliasSet2Binding0; constant auto& ubo_h = *(constant UBO_H*)spvBufferAliasSet2Binding1; - const device auto& ssbo_i = *(const device SSBO_I*)spvBufferAliasSet2Binding0; + device auto& ssbo_i = *(device SSBO_I*)spvBufferAliasSet2Binding0; func0((*spvDescriptorSet0.ssbo_a), gl_GlobalInvocationID, (*spvDescriptorSet0.ubo_c), gl_WorkGroupID, _42, (*spvDescriptorSet0.ssbo_b), (*spvDescriptorSet0.ubo_d), (*spvDescriptorSet0.ssbo_b_readonly)); func1(gl_GlobalInvocationID, gl_WorkGroupID, spvDescriptorSet0.ssbo_as, spvDescriptorSet0.ubo_cs); func2(gl_GlobalInvocationID, gl_WorkGroupID, spvDescriptorSet0.ssbo_bs, spvDescriptorSet0.ubo_ds, spvDescriptorSet0.ssbo_bs_readonly); diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/read-write-only.comp b/third_party/spirv-cross/reference/shaders-msl/comp/read-write-only.comp index 9174b5290d..4f825aa6b0 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/read-write-only.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/read-write-only.comp @@ -23,7 +23,7 @@ struct SSBO1 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device SSBO2& __restrict _10 [[buffer(0)]], const device SSBO0& _15 [[buffer(1)]], device SSBO1& __restrict _21 [[buffer(2)]]) +kernel void main0(device SSBO2& __restrict _10 [[buffer(0)]], device SSBO0& _15 [[buffer(1)]], device SSBO1& __restrict _21 [[buffer(2)]]) { _10.data4 = _15.data0 + _21.data2; _10.data5 = _15.data1 + _21.data3; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shader_group_vote.msl21.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shader_group_vote.msl21.comp index 62555b109b..f60e712783 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/shader_group_vote.msl21.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shader_group_vote.msl21.comp @@ -30,7 +30,7 @@ struct inputData constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); -kernel void main0(device inputData& _12 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +kernel void main0(const device inputData& _12 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) { float thisLaneData = _12.inputDataArray[gl_LocalInvocationID.x]; bool laneActive = thisLaneData > 0.0; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared-zero-init-simple.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared-zero-init-simple.comp index ec6029f9be..601fb2e40b 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/shared-zero-init-simple.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared-zero-init-simple.comp @@ -17,7 +17,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); -kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { threadgroup float sShared; { diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared-zero-init.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared-zero-init.comp index 2d0e55b96f..cc7f20e4d8 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/shared-zero-init.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared-zero-init.comp @@ -58,7 +58,7 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); constant spvUnsafeArray _31 = spvUnsafeArray({ 0.0, 0.0, 0.0, 0.0 }); -kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _48 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _48 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { threadgroup spvUnsafeArray sShared; { diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared.comp index ee8154f078..c38fa2e5b6 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/shared.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared.comp @@ -56,7 +56,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); -kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { threadgroup spvUnsafeArray sShared; uint ident = gl_GlobalInvocationID.x; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/struct-layout.comp b/third_party/spirv-cross/reference/shaders-msl/comp/struct-layout.comp index 8f2ab2d60c..8626dc41be 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/struct-layout.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/struct-layout.comp @@ -20,7 +20,7 @@ struct SSBO constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(device SSBO2& _23 [[buffer(0)]], const device SSBO& _30 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO2& _23 [[buffer(0)]], device SSBO& _30 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; _23.out_data[ident].m = _30.in_data[ident].m * _30.in_data[ident].m; diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp b/third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp index e92e71d61d..a0805e1942 100644 --- a/third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp +++ b/third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp @@ -16,7 +16,7 @@ struct SSBO2 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); -kernel void main0(const device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 idat = _24.in_data[ident]; diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag b/third_party/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag index 7516b11dbc..a2f78fb5cb 100644 --- a/third_party/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag +++ b/third_party/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag @@ -43,7 +43,7 @@ struct spvDescriptorSetBuffer1 { array, 4> uTexture2 [[id(0)]]; array uSampler [[id(4)]]; - device SSBO* m_60 [[id(6)]]; + const device SSBO* m_60 [[id(6)]]; const device SSBOs* ssbos [[id(7)]][2]; }; @@ -63,7 +63,7 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 sample_in_function2(texture2d uTexture, sampler uTextureSmplr, thread float2& vUV, constant array, 4>& uTexture2, constant array& uSampler, constant array, 2>& uTextures, constant array& uTexturesSmplr, device SSBO& _60, const device SSBOs* constant (&ssbos)[2], constant Push& registers) +float4 sample_in_function2(texture2d uTexture, sampler uTextureSmplr, thread float2& vUV, constant array, 4>& uTexture2, constant array& uSampler, constant array, 2>& uTextures, constant array& uTexturesSmplr, const device SSBO& _60, const device SSBOs* constant (&ssbos)[2], constant Push& registers) { float4 ret = uTexture.sample(uTextureSmplr, vUV); ret += uTexture2[2].sample(uSampler[1], vUV); @@ -75,7 +75,7 @@ float4 sample_in_function2(texture2d uTexture, sampler uTextureSmplr, thr } static inline __attribute__((always_inline)) -float4 sample_in_function(texture2d uTexture, sampler uTextureSmplr, thread float2& vUV, constant array, 4>& uTexture2, constant array& uSampler, constant array, 2>& uTextures, constant array& uTexturesSmplr, device SSBO& _60, const device SSBOs* constant (&ssbos)[2], constant Push& registers, constant UBO& _90, constant UBOs* constant (&ubos)[4]) +float4 sample_in_function(texture2d uTexture, sampler uTextureSmplr, thread float2& vUV, constant array, 4>& uTexture2, constant array& uSampler, constant array, 2>& uTextures, constant array& uTexturesSmplr, const device SSBO& _60, const device SSBOs* constant (&ssbos)[2], constant Push& registers, constant UBO& _90, constant UBOs* constant (&ubos)[4]) { float4 ret = sample_in_function2(uTexture, uTextureSmplr, vUV, uTexture2, uSampler, uTextures, uTexturesSmplr, _60, ssbos, registers); ret += _90.ubo; diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/reference/shaders-msl/frag/complex-expression-in-access-chain.frag index ea92be0d7d..e6b7fbd51b 100644 --- a/third_party/spirv-cross/reference/shaders-msl/frag/complex-expression-in-access-chain.frag +++ b/third_party/spirv-cross/reference/shaders-msl/frag/complex-expression-in-access-chain.frag @@ -29,7 +29,7 @@ struct main0_in int vIn2 [[user(locn1)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], device UBO& _34 [[buffer(0)]], texture2d Buf [[texture(0)]], sampler BufSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +fragment main0_out main0(main0_in in [[stage_in]], const device UBO& _34 [[buffer(0)]], texture2d Buf [[texture(0)]], sampler BufSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; int4 coords = Buf.read(uint2(int2(gl_FragCoord.xy)), 0); diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/fp16-trancendentals.frag b/third_party/spirv-cross/reference/shaders-msl/frag/fp16-trancendentals.frag index a661433e17..4680868396 100644 --- a/third_party/spirv-cross/reference/shaders-msl/frag/fp16-trancendentals.frag +++ b/third_party/spirv-cross/reference/shaders-msl/frag/fp16-trancendentals.frag @@ -7,12 +7,14 @@ struct main0_out { half C [[color(0)]]; half D [[color(1)]]; + half3 o3 [[color(2)]]; }; struct main0_in { half A [[user(locn0)]]; half B [[user(locn1)]]; + half3 v3 [[user(locn2)]]; }; fragment main0_out main0(main0_in in [[stage_in]]) @@ -31,11 +33,11 @@ fragment main0_out main0(main0_in in [[stage_in]]) out.D += out.C; out.C = clamp(atan(in.A), in.A, in.B); out.D += out.C; - out.C = clamp(half(fast::sinh(in.A)), in.A, in.B); + out.C = clamp(half(fast::sinh(float(in.A))), in.A, in.B); out.D += out.C; - out.C = clamp(half(fast::cosh(in.A)), in.A, in.B); + out.C = clamp(half(fast::cosh(float(in.A))), in.A, in.B); out.D += out.C; - out.C = clamp(half(fast::tanh(in.A)), in.A, in.B); + out.C = clamp(half(fast::tanh(float(in.A))), in.A, in.B); out.D += out.C; out.C = clamp(asinh(in.A), in.A, in.B); out.D += out.C; @@ -43,7 +45,7 @@ fragment main0_out main0(main0_in in [[stage_in]]) out.D += out.C; out.C = clamp(atanh(in.A), in.A, in.B); out.D += out.C; - out.C = clamp(half(fast::atan2(in.A, in.B)), in.A, in.B); + out.C = clamp(half(fast::atan2(float(in.A), float(in.B))), in.A, in.B); out.D += out.C; out.C = clamp(powr(in.A, in.B), in.A, in.B); out.D += out.C; @@ -59,6 +61,26 @@ fragment main0_out main0(main0_in in [[stage_in]]) out.D += out.C; out.C = clamp(rsqrt(in.A), in.A, in.B); out.D += out.C; + out.o3 = half3(fast::sinh(float3(in.v3))); + out.o3 += half3(fast::cosh(float3(in.v3))); + out.o3 += half3(fast::tanh(float3(in.v3))); + out.o3 += sin(in.v3); + out.o3 += cos(in.v3); + out.o3 += tan(in.v3); + out.o3 += asin(in.v3); + out.o3 += acos(in.v3); + out.o3 += atan(in.v3); + out.o3 += asinh(in.v3); + out.o3 += acosh(in.v3); + out.o3 += atanh(in.v3); + out.o3 += half3(fast::atan2(float3(out.o3), float3(in.v3))); + out.o3 += powr(out.o3, in.v3); + out.o3 += exp(in.v3); + out.o3 += exp2(in.v3); + out.o3 += log(in.v3); + out.o3 += log2(in.v3); + out.o3 += sqrt(in.v3); + out.o3 += rsqrt(in.v3); return out; } diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/runtime_array_as_argument_buffer.msl3.argument-tier-1.rich-descriptor.frag b/third_party/spirv-cross/reference/shaders-msl/frag/runtime_array_as_argument_buffer.msl3.argument-tier-1.rich-descriptor.frag index df108182a3..c8bfddd19c 100644 --- a/third_party/spirv-cross/reference/shaders-msl/frag/runtime_array_as_argument_buffer.msl3.argument-tier-1.rich-descriptor.frag +++ b/third_party/spirv-cross/reference/shaders-msl/frag/runtime_array_as_argument_buffer.msl3.argument-tier-1.rich-descriptor.frag @@ -40,47 +40,32 @@ struct spvDescriptor }; template -struct spvBufferDescriptor +struct spvBufferDescriptor; + +template +struct spvBufferDescriptor { - T value; + device T* value; int length; - const device T& operator -> () const device - { - return value; - } - const device T& operator * () const device - { - return value; - } + int padding; }; template struct spvDescriptorArray { - spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value) - { - } - const device T& operator [] (size_t i) const - { - return ptr[i]; - } + spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + const device T& operator [] (size_t i) const { return ptr[i]; } const device T* ptr; }; template struct spvDescriptorArray { - spvDescriptorArray(const device spvBufferDescriptor* ptr) : ptr(ptr) - { - } - const device T* operator [] (size_t i) const - { - return ptr[i].value; - } - const int length(int i) const - { - return ptr[i].length; - } + spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + device T* operator [] (size_t i) const { return ptr[i].value; } + int length(int i) const { return ptr[i].length; } const device spvBufferDescriptor* ptr; }; @@ -202,16 +187,16 @@ void explicit_tlas(const raytracing::acceleration_structure* ssbo_ [[buffer(4)]], const device spvDescriptor* ubo_ [[buffer(5)]], const device spvDescriptor>* smp_textures_ [[buffer(0)]], const device spvDescriptor>* textures_ [[buffer(2)]], const device spvDescriptor>* images_ [[buffer(6)]], const device spvDescriptor* smp_texturesSmplr_ [[buffer(1)]], const device spvDescriptor* smp_ [[buffer(3)]], const device spvDescriptor>* tlas_ [[buffer(7)]]) +fragment void main0(main0_in in [[stage_in]], device const void* spvDescriptorSet0Binding3 [[buffer(4)]], device const void* spvDescriptorSet0Binding4 [[buffer(5)]], device const void* spvDescriptorSet0Binding0 [[buffer(0)]], device const void* spvDescriptorSet0Binding2 [[buffer(2)]], device const void* spvDescriptorSet0Binding5 [[buffer(6)]], device const void* spvDescriptorSet0Binding0Smplr [[buffer(1)]], device const void* spvDescriptorSet0Binding1 [[buffer(3)]], device const void* spvDescriptorSet0Binding6 [[buffer(7)]]) { - spvDescriptorArray> smp_textures {smp_textures_}; - spvDescriptorArray smp_texturesSmplr {smp_texturesSmplr_}; - spvDescriptorArray> textures {textures_}; - spvDescriptorArray smp {smp_}; - spvDescriptorArray ssbo {ssbo_}; - spvDescriptorArray ubo {ubo_}; - spvDescriptorArray> images {images_}; - spvDescriptorArray> tlas {tlas_}; + spvDescriptorArray> smp_textures {spvDescriptorSet0Binding0}; + spvDescriptorArray smp_texturesSmplr {spvDescriptorSet0Binding0Smplr}; + spvDescriptorArray> textures {spvDescriptorSet0Binding2}; + spvDescriptorArray smp {spvDescriptorSet0Binding1}; + spvDescriptorArray ssbo {spvDescriptorSet0Binding3}; + spvDescriptorArray ubo {spvDescriptorSet0Binding4}; + spvDescriptorArray> images {spvDescriptorSet0Binding5}; + spvDescriptorArray> tlas {spvDescriptorSet0Binding6}; implicit_combined_texture(smp_textures, smp_texturesSmplr, in.inputId); implicit_texture(in.inputId, textures, smp); diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/runtime_array_as_argument_buffer_buf.msl3.argument-tier-1.rich-descriptor.frag b/third_party/spirv-cross/reference/shaders-msl/frag/runtime_array_as_argument_buffer_buf.msl3.argument-tier-1.rich-descriptor.frag index 8651782008..0dfe5955cb 100644 --- a/third_party/spirv-cross/reference/shaders-msl/frag/runtime_array_as_argument_buffer_buf.msl3.argument-tier-1.rich-descriptor.frag +++ b/third_party/spirv-cross/reference/shaders-msl/frag/runtime_array_as_argument_buffer_buf.msl3.argument-tier-1.rich-descriptor.frag @@ -6,18 +6,14 @@ using namespace metal; template -struct spvBufferDescriptor +struct spvBufferDescriptor; + +template +struct spvBufferDescriptor { - T value; + device T* value; int length; - const device T& operator -> () const device - { - return value; - } - const device T& operator * () const device - { - return value; - } + int padding; }; template @@ -26,17 +22,10 @@ struct spvDescriptorArray; template struct spvDescriptorArray { - spvDescriptorArray(const device spvBufferDescriptor* ptr) : ptr(ptr) - { - } - const device T* operator [] (size_t i) const - { - return ptr[i].value; - } - const int length(int i) const - { - return ptr[i].length; - } + spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {} + spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {} + device T* operator [] (size_t i) const { return ptr[i].value; } + int length(int i) const { return ptr[i].length; } const device spvBufferDescriptor* ptr; }; @@ -51,9 +40,9 @@ struct main0_in uint inputId [[user(locn0)]]; }; -fragment void main0(main0_in in [[stage_in]], const device spvBufferDescriptor* ssbo_ [[buffer(0)]]) +fragment void main0(main0_in in [[stage_in]], device const void* spvDescriptorSet0Binding0 [[buffer(0)]]) { - spvDescriptorArray ssbo {ssbo_}; + spvDescriptorArray ssbo {spvDescriptorSet0Binding0}; uint _15 = in.inputId; if (ssbo[_15]->val == 2u) diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/reference/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..0289314f96 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,99 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float3 ov [[color(0)]]; +}; + +struct main0_in +{ + float3 iv [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +void func0(thread float3& iv, thread float3& ov) +{ +#line 104 "test.frag" +#line 106 "test.frag" + if (iv.x < 0.0) + { +#line 107 "test.frag" + ov.x = 50.0; + } + else + { +#line 109 "test.frag" + ov.x = 60.0; + } +#line 110 "test.frag" +} + +static inline __attribute__((always_inline)) +void func1(thread float3& iv, thread float3& ov) +{ +#line 112 "test.frag" +#line 114 "test.frag" + for (int i = 0; i < 4; i++) + { +#line 116 "test.frag" + func0(iv, ov); +#line 117 "test.frag" + if (iv.y < 0.0) + { +#line 118 "test.frag" + ov.y = 70.0; + } + else + { +#line 120 "test.frag" + ov.y = 80.0; + } + } +#line 122 "test.frag" +} + +static inline __attribute__((always_inline)) +void func2(thread float3& iv, thread float3& ov) +{ +#line 124 "test.frag" +#line 126 "test.frag" + for (int i = 0; i < 4; i++) + { +#line 128 "test.frag" + func0(iv, ov); +#line 129 "test.frag" + func1(iv, ov); +#line 130 "test.frag" + if (iv.z < 0.0) + { +#line 131 "test.frag" + ov.z = 100.0; + } + else + { +#line 133 "test.frag" + ov.z = 120.0; + } + } +#line 135 "test.frag" +} + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; +#line 137 "test.frag" +#line 139 "test.frag" + func0(in.iv, out.ov); +#line 140 "test.frag" + func1(in.iv, out.ov); +#line 141 "test.frag" + func2(in.iv, out.ov); +#line 142 "test.frag" + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/no_pointsize.default-point-size.tese b/third_party/spirv-cross/reference/shaders-msl/tese/no_pointsize.default-point-size.tese new file mode 100644 index 0000000000..5670a02007 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/no_pointsize.default-point-size.tese @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(1.0); + out.gl_PointSize = 1.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/buffer_device_address.msl2.vert b/third_party/spirv-cross/reference/shaders-msl/vert/buffer_device_address.msl2.vert index 970b2fd2f7..2b82b9e5b3 100644 --- a/third_party/spirv-cross/reference/shaders-msl/vert/buffer_device_address.msl2.vert +++ b/third_party/spirv-cross/reference/shaders-msl/vert/buffer_device_address.msl2.vert @@ -24,12 +24,12 @@ struct Position struct Registers { float4x4 view_projection; - device PositionReferences* references; + const device PositionReferences* references; }; struct PositionReferences { - device Position* buffers[1]; + const device Position* buffers[1]; }; struct main0_out @@ -42,7 +42,7 @@ vertex main0_out main0(constant Registers& registers [[buffer(0)]], uint gl_Inst { main0_out out = {}; int slice = int(gl_InstanceIndex); - device Position* __restrict positions = registers.references->buffers[slice]; + const device Position* __restrict positions = registers.references->buffers[slice]; float2 pos = positions->positions[int(gl_VertexIndex)] * 2.5; pos += ((float2(float(spvSMod(slice, 8)), float(slice / 8)) - float2(3.5)) * 3.0); out.gl_Position = registers.view_projection * float4(pos, 0.0, 1.0); diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert new file mode 100644 index 0000000000..dd3b86e318 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert @@ -0,0 +1,33 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct BlockIO +{ + float v; +}; + +struct main0_out +{ + float outBlock_v; +}; + +static inline __attribute__((always_inline)) +void func(thread BlockIO& outBlock) +{ + outBlock.v = 1.0; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + BlockIO outBlock = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + func(outBlock); + out.outBlock_v = outBlock.v; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/array-copy-physical-layout-mismatch-ubo.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/array-copy-physical-layout-mismatch-ubo.asm.comp new file mode 100644 index 0000000000..aa6b320b3e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/array-copy-physical-layout-mismatch-ubo.asm.comp @@ -0,0 +1,15 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std140) uniform UBO +{ + vec2 b[5]; + vec2 c[5]; +} _7; + +void main() +{ + vec2 a[5] = _7.b; + a = _7.c; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/image-cube-atomic.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/image-cube-atomic.comp new file mode 100644 index 0000000000..e5df256289 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/image-cube-atomic.comp @@ -0,0 +1,12 @@ +#version 450 +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, r32ui) uniform uimageCube uCube; +layout(binding = 1, r32ui) uniform uimageCubeArray uCubeArray; + +void main() +{ + uint _22 = imageAtomicAdd(uCube, ivec3(gl_GlobalInvocationID), 10u); + uint _29 = imageAtomicOr(uCubeArray, ivec3(gl_GlobalInvocationID), 10u); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.comp new file mode 100644 index 0000000000..3b5f0434e8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.comp @@ -0,0 +1,35 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +const int A = SPIRV_CROSS_CONSTANT_ID_1; +const uint _20 = (uint(A) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +const uint _25 = gl_WorkGroupSize.x; +const uint _26 = (_20 * _25); +const uint _30 = (uint(A) + 0u); +const uint _31 = gl_WorkGroupSize.x; +const uint _32 = (_30 * _31); + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_0, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int I; + float V; +} _48; + +float D[_32]; + +void main() +{ + for (int i = 0; uint(i) < _26; i++) + { + D[i] = 1.0 + float(i); + } + _48.V = D[_48.I] + D[_48.I ^ 1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp new file mode 100644 index 0000000000..8c21039b46 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp @@ -0,0 +1,40 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +const int A = SPIRV_CROSS_CONSTANT_ID_1; +const uint _22 = (uint(A) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +const uint _23 = SPIRV_CROSS_CONSTANT_ID_0; +const uvec3 _25 = uvec3(_23, 1u, 1u); +const uint _26 = _25.x; +const uint _27 = (_22 * _26); +const uint _31 = (uint(A) + 0u); +const uint _32 = _25.x; +const uint _33 = (_31 * _32); + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_0, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int I; + float V; +} _49; + +float D[_33]; + +void main() +{ + for (int i = 0; uint(i) < _27; i++) + { + D[i] = 1.0 + float(i); + } + _49.V = D[_49.I] + D[_49.I ^ 1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp new file mode 100644 index 0000000000..0e83b230cf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp @@ -0,0 +1,35 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 2 +#endif +const int A = SPIRV_CROSS_CONSTANT_ID_0; +const uint _20 = (uint(A) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +const uint _25 = gl_WorkGroupSize.x; +const uint _26 = (_20 * _25); +const uint _30 = (uint(A) + 0u); +const uint _31 = gl_WorkGroupSize.x; +const uint _32 = (_30 * _31); + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_0, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int I; + float V; +} _48; + +float D[_32]; + +void main() +{ + for (int i = 0; uint(i) < _26; i++) + { + D[i] = 1.0 + float(i); + } + _48.V = D[_48.I] + D[_48.I ^ 1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp.vk new file mode 100644 index 0000000000..739feff035 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp.vk @@ -0,0 +1,28 @@ +#version 450 +layout(local_size_x_id = 0, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const int A = 2; +const uint _20 = (uint(A) + 0u); +const uint _25 = gl_WorkGroupSize.x; +const uint _26 = (_20 * _25); +const uint _30 = (uint(A) + 0u); +const uint _31 = gl_WorkGroupSize.x; +const uint _32 = (_30 * _31); + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + int I; + float V; +} _48; + +float D[_32]; + +void main() +{ + for (int i = 0; uint(i) < _26; i++) + { + D[i] = 1.0 + float(i); + } + _48.V = D[_48.I] + D[_48.I ^ 1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc index c2d047a7c5..15cb367634 100644 --- a/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc @@ -298,7 +298,7 @@ struct main0_in float4 in_var_VS_To_DS_Position [[attribute(7)]]; }; -kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) { threadgroup spvUnsafeArray temp_var_hullMainRetVal; device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/hlsl-functionality.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/hlsl-functionality.asm.comp index f4926ea29f..b71e99921b 100644 --- a/third_party/spirv-cross/reference/shaders/asm/comp/hlsl-functionality.asm.comp +++ b/third_party/spirv-cross/reference/shaders/asm/comp/hlsl-functionality.asm.comp @@ -1,16 +1,16 @@ #version 450 layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -layout(binding = 0, std430) buffer Buf -{ - vec4 _data[]; -} Buf_1; - layout(binding = 1, std430) buffer Buf_count { int _count; } Buf_count_1; +layout(binding = 0, std430) buffer Buf +{ + vec4 _data[]; +} Buf_1; + void _main() { int _25 = atomicAdd(Buf_count_1._count, 1); diff --git a/third_party/spirv-cross/reference/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp.vk b/third_party/spirv-cross/reference/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp.vk new file mode 100644 index 0000000000..a3980e1bd4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp.vk @@ -0,0 +1,44 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif +#extension GL_EXT_shader_16bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require +#extension GL_NV_cooperative_vector : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer Q +{ + float16_t data_q[]; +} _15; + +void main() +{ + coopvecNV _20; + coopVecLoadNV(_20, _15.data_q, 16u); + coopvecNV tempArg = _20; + coopvecNV inVec = tempArg; + coopVecStoreNV(inVec, _15.data_q, 16u); + coopvecNV _33; + coopVecMatMulAddNV(_33, inVec, gl_ComponentTypeFloat16NV, _15.data_q, 16u, gl_ComponentTypeFloat16NV, _15.data_q, 16u, gl_ComponentTypeFloat16NV, 16u, 16u, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, false, 2u); + coopvecNV tempArg_1 = _33; + inVec = tempArg_1; + coopvecNV _38; + coopVecMatMulNV(_38, inVec, gl_ComponentTypeFloat16NV, _15.data_q, 16u, gl_ComponentTypeFloat16NV, 16u, 16u, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, false, 2u); + coopvecNV tempArg_2 = _38; + inVec = tempArg_2; + coopvecNV a = coopvecNV(float16_t(0.0)); + inVec = max(inVec, inVec); + inVec[5] = inVec[3] + inVec[4]; + coopVecOuterProductAccumulateNV(inVec, inVec, _15.data_q, 0u, 0u, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, gl_ComponentTypeFloat16NV); + coopVecReduceSumAccumulateNV(inVec, _15.data_q, 0u); + coopvecNV a_8bit = coopvecNV(int8_t(0)); + coopvecNV b_32bit = coopvecNV(0); + b_32bit = (max((coopvecNV(a_8bit)), b_32bit)); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/reference/shaders/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..dbe3f3c563 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,83 @@ +#version 450 +#extension GL_GOOGLE_cpp_style_line_directive : require + +layout(location = 0) in vec3 iv; +layout(location = 0) out vec3 ov; + +void func0() +{ +#line 104 "test.frag" +#line 106 "test.frag" + if (iv.x < 0.0) + { +#line 107 "test.frag" + ov.x = 50.0; + } + else + { +#line 109 "test.frag" + ov.x = 60.0; + } +#line 110 "test.frag" +} + +void func1() +{ +#line 112 "test.frag" +#line 114 "test.frag" + for (int i = 0; i < 4; i++) + { +#line 116 "test.frag" + func0(); +#line 117 "test.frag" + if (iv.y < 0.0) + { +#line 118 "test.frag" + ov.y = 70.0; + } + else + { +#line 120 "test.frag" + ov.y = 80.0; + } + } +#line 122 "test.frag" +} + +void func2() +{ +#line 124 "test.frag" +#line 126 "test.frag" + for (int i = 0; i < 4; i++) + { +#line 128 "test.frag" + func0(); +#line 129 "test.frag" + func1(); +#line 130 "test.frag" + if (iv.z < 0.0) + { +#line 131 "test.frag" + ov.z = 100.0; + } + else + { +#line 133 "test.frag" + ov.z = 120.0; + } + } +#line 135 "test.frag" +} + +void main() +{ +#line 137 "test.frag" +#line 139 "test.frag" + func0(); +#line 140 "test.frag" + func1(); +#line 141 "test.frag" + func2(); +#line 142 "test.frag" +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp.vk new file mode 100644 index 0000000000..8070f2dcf3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp.vk @@ -0,0 +1,98 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_16bit_storage : require +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_EXT_shader_subgroup_extended_types_int8 : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_EXT_shader_subgroup_extended_types_int16 : require +#extension GL_EXT_shader_subgroup_extended_types_int64 : require +#extension GL_EXT_shader_subgroup_extended_types_float16 : require +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + uint8_t u8_1[4]; + i8vec2 i8_2[4]; + u8vec3 u8_3[4]; + i8vec4 i8_4[4]; + uint16_t u16_1[4]; + i16vec2 i16_2[4]; + u16vec3 u16_3[4]; + i16vec4 i16_4[4]; + float16_t f16_1[4]; + f16vec2 f16_2[4]; + f16vec3 f16_3[4]; + f16vec4 f16_4[4]; + double f64_1[4]; + double f64_2[4]; + double f64_3[4]; + double f64_4[4]; + uint64_t u64_1[4]; + i64vec2 i64_2[4]; + u64vec3 u64_3[4]; + i64vec4 i64_4[4]; +} _60; + +void int8() +{ + _60.u8_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.u8_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.i8_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.i8_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.u8_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.u8_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.i8_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.i8_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +void int16() +{ + _60.u16_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.u16_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.i16_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.i16_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.u16_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.u16_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.i16_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.i16_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +void int64() +{ + _60.u64_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.u64_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.i64_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.i64_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.u64_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.u64_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.i64_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.i64_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +void fp16() +{ + _60.f16_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.f16_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.f16_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.f16_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.f16_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.f16_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.f16_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.f16_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +void fp64() +{ + _60.f64_1[gl_LocalInvocationIndex] = subgroupShuffle(_60.f64_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.f64_2[gl_LocalInvocationIndex] = subgroupShuffle(_60.f64_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.f64_3[gl_LocalInvocationIndex] = subgroupShuffle(_60.f64_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); + _60.f64_4[gl_LocalInvocationIndex] = subgroupShuffle(_60.f64_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1u); +} + +void main() +{ + int8(); + int16(); + int64(); + fp16(); + fp64(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp.vk index 0e3b1a874f..e536aee903 100644 --- a/third_party/spirv-cross/reference/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp.vk +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp.vk @@ -9,11 +9,12 @@ #extension GL_EXT_shader_16bit_storage : require #extension GL_KHR_cooperative_matrix : require #extension GL_KHR_memory_scope_semantics : require +#extension GL_NV_cooperative_vector : require layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(constant_id = 0) const float spec_const = 0.0; -const vec4 _29 = vec4(spec_const); -const float _34[8] = float[](1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0); +const vec4 _33 = vec4(spec_const); +const float _38[8] = float[](1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0); layout(set = 0, binding = 0, std140) uniform UBO { @@ -25,10 +26,13 @@ void main() vec4 a = vec4(0.0); mat4 b = mat4(vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0)); coopmat matrix = coopmat(float16_t(0.0)); - vec4 c = _29; + coopvecNV vec = coopvecNV(float16_t(0.0)); + vec4 c = _33; vec4 d = vec4(ubo.uniform_float); mat4 e = mat4(d, d, d, d); - float16_t _51 = float16_t(ubo.uniform_float); - coopmat matrix2 = coopmat(_51); + float16_t _55 = float16_t(ubo.uniform_float); + coopmat matrix2 = coopmat(_55); + float16_t _60 = float16_t(ubo.uniform_float); + coopvecNV vec_dynamic = coopvecNV(_60); } diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/block-match-sad.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/block-match-sad.spv14.frag similarity index 100% rename from third_party/spirv-cross/reference/shaders/vulkan/frag/block-match-sad.frag rename to third_party/spirv-cross/reference/shaders/vulkan/frag/block-match-sad.spv14.frag diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/block-match-ssd.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/block-match-ssd.spv14.frag similarity index 100% rename from third_party/spirv-cross/reference/shaders/vulkan/frag/block-match-ssd.frag rename to third_party/spirv-cross/reference/shaders/vulkan/frag/block-match-ssd.spv14.frag diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/box-filter.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/box-filter.spv14.frag similarity index 100% rename from third_party/spirv-cross/reference/shaders/vulkan/frag/box-filter.frag rename to third_party/spirv-cross/reference/shaders/vulkan/frag/box-filter.spv14.frag diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag.vk new file mode 100644 index 0000000000..1edc85e76a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag.vk @@ -0,0 +1,26 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_EXT_ray_tracing_position_fetch : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT uAS; + +layout(location = 0) out vec3 o_color; +rayQueryEXT query; + +void main() +{ + float tmin = 0.00999999977648258209228515625; + float tmax = 1000.0; + vec3 dir = vec3(1.0, 0.0, 0.0); + rayQueryInitializeEXT(query, uAS, 4u, 255u, vec3(0.0), tmin, dir, 1.0); + bool _32 = rayQueryProceedEXT(query); + uint _36 = rayQueryGetIntersectionTypeEXT(query, bool(1)); + if (_36 != 0u) + { + vec3 _45[3]; + rayQueryGetIntersectionTriangleVertexPositionsEXT(query, bool(1), _45); + vec3 vs[3] = _45; + o_color = (vs[0] + vs[1]) + vs[2]; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/sample-weighted.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/sample-weighted.spv14.frag similarity index 100% rename from third_party/spirv-cross/reference/shaders/vulkan/frag/sample-weighted.frag rename to third_party/spirv-cross/reference/shaders/vulkan/frag/sample-weighted.spv14.frag diff --git a/third_party/spirv-cross/reference/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit.vk b/third_party/spirv-cross/reference/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit.vk new file mode 100644 index 0000000000..fb207532f2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require +#extension GL_NV_cluster_acceleration_structure : require + +layout(location = 0) rayPayloadInEXT int payload; + +void main() +{ + payload = gl_ClusterIDNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp.vk new file mode 100644 index 0000000000..83e01a81c0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp.vk @@ -0,0 +1,64 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_NV_cluster_acceleration_structure : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std140) uniform Params +{ + uint ray_flags; + uint cull_mask; + vec3 origin; + float tmin; + vec3 dir; + float tmax; +} _18; + +layout(set = 0, binding = 2, std430) buffer SSBO +{ + int id; +} _68; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT AS; + +rayQueryEXT q; + +void main() +{ + rayQueryInitializeEXT(q, AS, _18.ray_flags, _18.cull_mask, _18.origin, _18.tmin, _18.dir, _18.tmax); + for (;;) + { + bool _47 = rayQueryProceedEXT(q); + if (_47) + { + uint _49 = rayQueryGetIntersectionTypeEXT(q, bool(0)); + bool _51 = _49 == 0u; + bool _57; + if (_51) + { + int _54 = rayQueryGetIntersectionClusterIdNV(q, bool(0)); + _57 = _54 != (-1); + } + else + { + _57 = _51; + } + if (_57) + { + rayQueryTerminateEXT(q); + rayQueryConfirmIntersectionEXT(q); + } + continue; + } + else + { + break; + } + } + uint _61 = rayQueryGetIntersectionTypeEXT(q, bool(1)); + if (_61 == 1u) + { + int _69 = rayQueryGetIntersectionClusterIdNV(q, bool(1)); + _68.id = _69; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..15e7bf8085 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require +#extension GL_EXT_ray_tracing_position_fetch : require + +hitAttributeEXT vec2 attribs; +layout(location = 0) rayPayloadInEXT vec3 hitValue; + +void main() +{ + vec3 barycentricCoords = vec3((1.0 - attribs.x) - attribs.y, attribs.x, attribs.y); + vec3 pos0 = gl_HitTriangleVertexPositionsEXT[0]; + vec3 pos1 = gl_HitTriangleVertexPositionsEXT[1]; + vec3 pos2 = gl_HitTriangleVertexPositionsEXT[2]; + hitValue = ((pos0 * barycentricCoords.x) + (pos1 * barycentricCoords.y)) + (pos2 * barycentricCoords.z); +} + diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.asm.frag new file mode 100644 index 0000000000..806f38f268 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.asm.frag @@ -0,0 +1,186 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_COLOR %out_var_SV_TARGET + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Test1Cbuf "type.Test1Cbuf" + OpMemberName %type_Test1Cbuf 0 "test1" + OpName %Test1 "Test1" + OpMemberName %Test1 0 "a" + OpMemberName %Test1 1 "b" + OpName %StraddleResolve "StraddleResolve" + OpMemberName %StraddleResolve 0 "A" + OpMemberName %StraddleResolve 1 "B" + OpMemberName %StraddleResolve 2 "C" + OpMemberName %StraddleResolve 3 "D" + OpName %Test1Cbuf "Test1Cbuf" + OpName %type_Test2Cbuf "type.Test2Cbuf" + OpMemberName %type_Test2Cbuf 0 "test2" + OpName %Test2 "Test2" + OpMemberName %Test2 0 "a" + OpMemberName %Test2 1 "b" + OpMemberName %Test2 2 "c" + OpMemberName %Test2 3 "d" + OpName %Test2Cbuf "Test2Cbuf" + OpName %type_Test3Cbuf "type.Test3Cbuf" + OpMemberName %type_Test3Cbuf 0 "test3" + OpName %Test3 "Test3" + OpMemberName %Test3 0 "c23" + OpMemberName %Test3 1 "dummy0" + OpMemberName %Test3 2 "r23" + OpMemberName %Test3 3 "dummy1" + OpMemberName %Test3 4 "c32" + OpMemberName %Test3 5 "dummy2" + OpMemberName %Test3 6 "r32" + OpMemberName %Test3 7 "dummy3" + OpName %MatrixStraddle2x3c "MatrixStraddle2x3c" + OpMemberName %MatrixStraddle2x3c 0 "m" + OpName %MatrixStraddle2x3r "MatrixStraddle2x3r" + OpMemberName %MatrixStraddle2x3r 0 "m" + OpName %MatrixStraddle3x2c "MatrixStraddle3x2c" + OpMemberName %MatrixStraddle3x2c 0 "m" + OpName %MatrixStraddle3x2r "MatrixStraddle3x2r" + OpMemberName %MatrixStraddle3x2r 0 "m" + OpName %Test3Cbuf "Test3Cbuf" + OpName %type_Test4Cbuf "type.Test4Cbuf" + OpMemberName %type_Test4Cbuf 0 "test4" + OpName %Test4 "Test4" + OpMemberName %Test4 0 "c23" + OpMemberName %Test4 1 "dummy0" + OpMemberName %Test4 2 "r23" + OpMemberName %Test4 3 "dummy1" + OpName %Test4Cbuf "Test4Cbuf" + OpName %in_var_COLOR "in.var.COLOR" + OpName %out_var_SV_TARGET "out.var.SV_TARGET" + OpName %main "main" + OpDecorate %in_var_COLOR Location 0 + OpDecorate %out_var_SV_TARGET Location 0 + OpDecorate %Test1Cbuf DescriptorSet 0 + OpDecorate %Test1Cbuf Binding 0 + OpDecorate %Test2Cbuf DescriptorSet 0 + OpDecorate %Test2Cbuf Binding 1 + OpDecorate %Test3Cbuf DescriptorSet 0 + OpDecorate %Test3Cbuf Binding 2 + OpDecorate %Test4Cbuf DescriptorSet 0 + OpDecorate %Test4Cbuf Binding 3 + OpMemberDecorate %StraddleResolve 0 Offset 0 + OpMemberDecorate %StraddleResolve 1 Offset 16 + OpMemberDecorate %StraddleResolve 2 Offset 32 + OpMemberDecorate %StraddleResolve 3 Offset 48 + OpMemberDecorate %Test1 0 Offset 0 + OpMemberDecorate %Test1 1 Offset 60 + OpMemberDecorate %type_Test1Cbuf 0 Offset 0 + OpDecorate %type_Test1Cbuf Block + OpDecorate %_arr_StraddleResolve_uint_2 ArrayStride 64 + OpDecorate %_arr__arr_StraddleResolve_uint_2_uint_3 ArrayStride 128 + OpMemberDecorate %Test2 0 Offset 0 + OpMemberDecorate %Test2 1 Offset 124 + OpMemberDecorate %Test2 2 Offset 128 + OpMemberDecorate %Test2 3 Offset 508 + OpMemberDecorate %type_Test2Cbuf 0 Offset 0 + OpDecorate %type_Test2Cbuf Block + OpMemberDecorate %MatrixStraddle2x3c 0 Offset 0 + OpMemberDecorate %MatrixStraddle2x3c 0 MatrixStride 16 + OpMemberDecorate %MatrixStraddle2x3c 0 RowMajor + OpMemberDecorate %MatrixStraddle2x3r 0 Offset 0 + OpMemberDecorate %MatrixStraddle2x3r 0 MatrixStride 16 + OpMemberDecorate %MatrixStraddle2x3r 0 ColMajor + OpMemberDecorate %MatrixStraddle3x2c 0 Offset 0 + OpMemberDecorate %MatrixStraddle3x2c 0 MatrixStride 16 + OpMemberDecorate %MatrixStraddle3x2c 0 RowMajor + OpMemberDecorate %MatrixStraddle3x2r 0 Offset 0 + OpMemberDecorate %MatrixStraddle3x2r 0 MatrixStride 16 + OpMemberDecorate %MatrixStraddle3x2r 0 ColMajor + OpMemberDecorate %Test3 0 Offset 0 + OpMemberDecorate %Test3 1 Offset 40 + OpMemberDecorate %Test3 2 Offset 48 + OpMemberDecorate %Test3 3 Offset 76 + OpMemberDecorate %Test3 4 Offset 80 + OpMemberDecorate %Test3 5 Offset 108 + OpMemberDecorate %Test3 6 Offset 112 + OpMemberDecorate %Test3 7 Offset 152 + OpMemberDecorate %type_Test3Cbuf 0 Offset 0 + OpDecorate %type_Test3Cbuf Block + OpDecorate %_arr_MatrixStraddle2x3c_uint_3 ArrayStride 48 + OpDecorate %_arr__arr_MatrixStraddle2x3c_uint_3_uint_2 ArrayStride 144 + OpDecorate %_arr_MatrixStraddle2x3r_uint_3 ArrayStride 32 + OpDecorate %_arr__arr_MatrixStraddle2x3r_uint_3_uint_2 ArrayStride 96 + OpMemberDecorate %Test4 0 Offset 0 + OpMemberDecorate %Test4 1 Offset 280 + OpMemberDecorate %Test4 2 Offset 288 + OpMemberDecorate %Test4 3 Offset 476 + OpMemberDecorate %type_Test4Cbuf 0 Offset 0 + OpDecorate %type_Test4Cbuf Block + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%StraddleResolve = OpTypeStruct %v3float %v3float %v3float %v3float + %Test1 = OpTypeStruct %StraddleResolve %float +%type_Test1Cbuf = OpTypeStruct %Test1 +%_ptr_Uniform_type_Test1Cbuf = OpTypePointer Uniform %type_Test1Cbuf + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_StraddleResolve_uint_2 = OpTypeArray %StraddleResolve %uint_2 + %uint_3 = OpConstant %uint 3 +%_arr__arr_StraddleResolve_uint_2_uint_3 = OpTypeArray %_arr_StraddleResolve_uint_2 %uint_3 + %Test2 = OpTypeStruct %_arr_StraddleResolve_uint_2 %float %_arr__arr_StraddleResolve_uint_2_uint_3 %float +%type_Test2Cbuf = OpTypeStruct %Test2 +%_ptr_Uniform_type_Test2Cbuf = OpTypePointer Uniform %type_Test2Cbuf +%mat2v3float = OpTypeMatrix %v3float 2 +%MatrixStraddle2x3c = OpTypeStruct %mat2v3float +%MatrixStraddle2x3r = OpTypeStruct %mat2v3float + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%MatrixStraddle3x2c = OpTypeStruct %mat3v2float +%MatrixStraddle3x2r = OpTypeStruct %mat3v2float + %Test3 = OpTypeStruct %MatrixStraddle2x3c %float %MatrixStraddle2x3r %float %MatrixStraddle3x2c %float %MatrixStraddle3x2r %float +%type_Test3Cbuf = OpTypeStruct %Test3 +%_ptr_Uniform_type_Test3Cbuf = OpTypePointer Uniform %type_Test3Cbuf +%_arr_MatrixStraddle2x3c_uint_3 = OpTypeArray %MatrixStraddle2x3c %uint_3 +%_arr__arr_MatrixStraddle2x3c_uint_3_uint_2 = OpTypeArray %_arr_MatrixStraddle2x3c_uint_3 %uint_2 +%_arr_MatrixStraddle2x3r_uint_3 = OpTypeArray %MatrixStraddle2x3r %uint_3 +%_arr__arr_MatrixStraddle2x3r_uint_3_uint_2 = OpTypeArray %_arr_MatrixStraddle2x3r_uint_3 %uint_2 + %Test4 = OpTypeStruct %_arr__arr_MatrixStraddle2x3c_uint_3_uint_2 %float %_arr__arr_MatrixStraddle2x3r_uint_3_uint_2 %float +%type_Test4Cbuf = OpTypeStruct %Test4 +%_ptr_Uniform_type_Test4Cbuf = OpTypePointer Uniform %type_Test4Cbuf + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %46 = OpTypeFunction %void +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Test1Cbuf = OpVariable %_ptr_Uniform_type_Test1Cbuf Uniform + %Test2Cbuf = OpVariable %_ptr_Uniform_type_Test2Cbuf Uniform + %Test3Cbuf = OpVariable %_ptr_Uniform_type_Test3Cbuf Uniform + %Test4Cbuf = OpVariable %_ptr_Uniform_type_Test4Cbuf Uniform +%in_var_COLOR = OpVariable %_ptr_Input_v4float Input +%out_var_SV_TARGET = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %46 + %48 = OpLabel + %49 = OpLoad %v4float %in_var_COLOR + %50 = OpAccessChain %_ptr_Uniform_float %Test1Cbuf %int_0 %int_1 + %51 = OpLoad %float %50 + %52 = OpCompositeConstruct %v4float %51 %51 %51 %51 + %53 = OpFAdd %v4float %49 %52 + %54 = OpAccessChain %_ptr_Uniform_float %Test2Cbuf %int_0 %int_1 + %55 = OpLoad %float %54 + %56 = OpCompositeConstruct %v4float %55 %55 %55 %55 + %57 = OpFAdd %v4float %53 %56 + %58 = OpAccessChain %_ptr_Uniform_float %Test3Cbuf %int_0 %int_1 + %59 = OpLoad %float %58 + %60 = OpCompositeConstruct %v4float %59 %59 %59 %59 + %61 = OpFAdd %v4float %57 %60 + %62 = OpAccessChain %_ptr_Uniform_float %Test4Cbuf %int_0 %int_1 + %63 = OpLoad %float %62 + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + %65 = OpFAdd %v4float %61 %64 + OpStore %out_var_SV_TARGET %65 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.hlsl b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.hlsl new file mode 100644 index 0000000000..c725ca1258 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/packing/cbuffer-hard-packing.hlsl @@ -0,0 +1,95 @@ +// dxc -Tps_6_0 cbuffer-hard-packing.hlsl -spirv -fvk-use-dx-layout -Fo /tmp/test.spv && spirv-dis -o cbuffer-hard-packing.asm.frag /tmp/test.spv + +struct PSInput +{ + float4 color : COLOR; +}; + +struct StraddleResolve +{ + float3 A; + float3 B; + float3 C; + float3 D; +}; + +struct MatrixStraddle2x3c +{ + column_major float2x3 m; +}; + +struct MatrixStraddle2x3r +{ + row_major float2x3 m; +}; + +struct MatrixStraddle3x2c +{ + column_major float3x2 m; +}; + +struct MatrixStraddle3x2r +{ + row_major float3x2 m; +}; + +struct Test1 +{ + StraddleResolve a; + float b; +}; + +struct Test2 +{ + StraddleResolve a[2]; + float b; + StraddleResolve c[3][2]; + float d; +}; + +struct Test3 +{ + MatrixStraddle2x3c c23; + float dummy0; + MatrixStraddle2x3r r23; + float dummy1; + MatrixStraddle3x2c c32; + float dummy2; + MatrixStraddle3x2r r32; + float dummy3; +}; + +struct Test4 +{ + MatrixStraddle2x3c c23[2][3]; + float dummy0; + MatrixStraddle2x3r r23[2][3]; + float dummy1; +}; + + +// Wrap in inner struct to ensure we get exact behavior since we cannot lean on packoffset() in this style. +cbuffer Test1Cbuf +{ + Test1 test1; +}; + +cbuffer Test2Cbuf +{ + Test2 test2; +}; + +cbuffer Test3Cbuf +{ + Test3 test3; +}; + +cbuffer Test4Cbuf +{ + Test4 test4; +}; + +float4 main(PSInput input) : SV_TARGET +{ + return input.color + test1.b + test2.b + test3.dummy0 + test4.dummy0; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/basic.user-semantic.asm.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/basic.user-semantic.asm.vert new file mode 100644 index 0000000000..f8532347bc --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/basic.user-semantic.asm.vert @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %in_var_B %gl_Position %out_var_A + OpSource HLSL 600 + OpName %in_var_B "in.var.B" + OpName %out_var_A "out.var.A" + OpName %main "main" + OpDecorateString %in_var_B UserSemantic "B" + OpDecorate %gl_Position BuiltIn Position + OpDecorateString %gl_Position UserSemantic "SV_Position" + OpDecorateString %out_var_A UserSemantic "A" + OpDecorate %in_var_B Location 0 + OpDecorate %out_var_A Location 0 + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %12 = OpTypeFunction %void + %in_var_B = OpVariable %_ptr_Input_v4float Input +%gl_Position = OpVariable %_ptr_Output_v4float Output + %out_var_A = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %12 + %13 = OpLabel + %14 = OpLoad %v4float %in_var_B + OpStore %gl_Position %8 + OpStore %out_var_A %14 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.comp new file mode 100644 index 0000000000..4a159d4764 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x_id = 0) in; + +layout(constant_id = 1) const int A = 2; +float D[A * gl_WorkGroupSize.x]; + +layout(set = 0, binding = 0) buffer SSBO +{ + int I; + float V; +}; + +void main () +{ + for (int i = 0; i < A * gl_WorkGroupSize.x; i++) + D[i] = 1.0 + float(i); + V = D[I] + D[I ^ 1]; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp new file mode 100644 index 0000000000..4a159d4764 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x_id = 0) in; + +layout(constant_id = 1) const int A = 2; +float D[A * gl_WorkGroupSize.x]; + +layout(set = 0, binding = 0) buffer SSBO +{ + int I; + float V; +}; + +void main () +{ + for (int i = 0; i < A * gl_WorkGroupSize.x; i++) + D[i] = 1.0 + float(i); + V = D[I] + D[I ^ 1]; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/query-lod-arrayed.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/query-lod-arrayed.frag new file mode 100644 index 0000000000..d262a9a5a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/query-lod-arrayed.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0) in vec2 vUV; +layout(location = 0) out vec2 FragCoord; +layout(binding = 0) uniform texture2DArray uTex; +layout(binding = 1) uniform sampler uSamp; + +void main() +{ + FragCoord = textureQueryLod(sampler2DArray(uTex, uSamp), vUV); +} diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag new file mode 100644 index 0000000000..9c9b3468fe --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/globally-coherent-structured-buffer.structured.asm.frag @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + OpExtension "SPV_GOOGLE_user_type" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target0 + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_RWStructuredBuffer_v4float "type.RWStructuredBuffer.v4float" + OpName %TestBuffer "TestBuffer" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %main "main" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %TestBuffer DescriptorSet 0 + OpDecorate %TestBuffer Binding 0 + OpDecorate %TestBuffer Coherent + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %type_RWStructuredBuffer_v4float 0 Offset 0 + OpDecorate %type_RWStructuredBuffer_v4float BufferBlock + OpDecorateString %TestBuffer UserTypeGOOGLE "globallycoherent rwstructuredbuffer:" + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%type_RWStructuredBuffer_v4float = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_type_RWStructuredBuffer_v4float = OpTypePointer Uniform %type_RWStructuredBuffer_v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %TestBuffer = OpVariable %_ptr_Uniform_type_RWStructuredBuffer_v4float Uniform +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %17 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_v4float %TestBuffer %int_0 %uint_0 + %19 = OpLoad %v4float %18 + OpStore %out_var_SV_Target0 %19 + OpReturn + OpFunctionEnd \ No newline at end of file diff --git a/third_party/spirv-cross/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..85f3f3269d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,46 @@ +#version 450 +#extension GL_GOOGLE_cpp_style_line_directive : require +#line 100 "test.frag" + +layout(location = 0) in vec3 iv; +layout(location = 0) out vec3 ov; + +void func0() +{ + if (iv.x < 0.0) + ov.x = 50.0; + else + ov.x = 60.0; +} + +void func1() +{ + for (int i = 0; i < 4; i++) + { + func0(); + if (iv.y < 0.0) + ov.y = 70.0; + else + ov.y = 80.0; + } +} + +void func2() +{ + for (int i = 0; i < 4; i++) + { + func0(); + func1(); + if (iv.z < 0.0) + ov.z = 100.0; + else + ov.z = 120.0; + } +} + +void main () +{ + func0(); + func1(); + func2(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/array-copy-physical-layout-mismatch.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/array-copy-physical-layout-mismatch.asm.comp new file mode 100644 index 0000000000..bc465285e9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/array-copy-physical-layout-mismatch.asm.comp @@ -0,0 +1,47 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %a "a" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "b" + OpMemberName %SSBO 1 "c" + OpName %_ "" + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %SSBO BufferBlock + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 80 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 +%_ptr_Function__arr_float_uint_5 = OpTypePointer Function %_arr_float_uint_5 +%_ptr_Uniform__arr_float_uint_5 = OpTypePointer Uniform %_arr_float_uint_5 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %SSBO = OpTypeStruct %_arr_float_uint_5 %_arr_float_uint_5 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function__arr_float_uint_5 Function + %ptr_b = OpAccessChain %_ptr_Uniform__arr_float_uint_5 %_ %int_0 + %ptr_c = OpAccessChain %_ptr_Uniform__arr_float_uint_5 %_ %int_1 + %loaded_b = OpLoad %_arr_float_uint_5 %ptr_b + OpStore %a %loaded_b + OpCopyMemory %a %ptr_b + %loaded_a = OpLoad %_arr_float_uint_5 %a + OpStore %ptr_b %loaded_a + OpCopyMemory %ptr_c %a + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp16.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp16.asm.comp new file mode 100644 index 0000000000..fca4fff77e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp16.asm.comp @@ -0,0 +1,225 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 173 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageBuffer16BitAccess + OpCapability FloatControls2 + OpExtension "SPV_KHR_16bit_storage" + OpExtension "SPV_KHR_float_controls2" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 4 1 1 + OpExecutionModeId %main FPFastMathDefault %half %fp32_modes + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpMemberName %SSBO 1 "f16" + OpName %_ "" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpDecorate %_arr_float_uint_4 ArrayStride 4 + OpDecorate %_arr_half_uint_4 ArrayStride 2 + OpDecorate %SSBO BufferBlock + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %24 FPFastMathMode NotNaN|NotInf + OpDecorate %30 FPFastMathMode NotNaN ; This isn't enough to avoid precise:: + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %fp32_modes = OpConstant %uint 0x7000f + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %half = OpTypeFloat 16 +%_arr_half_uint_4 = OpTypeArray %half %uint_4 + %SSBO = OpTypeStruct %_arr_float_uint_4 %_arr_half_uint_4 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_4 = OpConstant %float 4 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_half = OpTypePointer Uniform %half + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %uint %gl_LocalInvocationIndex + %20 = OpLoad %uint %gl_LocalInvocationIndex + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %20 + %23 = OpLoad %float %22 + %24 = OpExtInst %float %1 Cos %23 + %25 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %19 + OpStore %25 %24 + %26 = OpLoad %uint %gl_LocalInvocationIndex + %27 = OpLoad %uint %gl_LocalInvocationIndex + %28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %27 + %29 = OpLoad %float %28 + %30 = OpExtInst %float %1 Sin %29 + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %26 + %32 = OpLoad %float %31 + %33 = OpFAdd %float %32 %30 + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %26 + OpStore %34 %33 + %35 = OpLoad %uint %gl_LocalInvocationIndex + %36 = OpLoad %uint %gl_LocalInvocationIndex + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %36 + %38 = OpLoad %float %37 + %39 = OpExtInst %float %1 Tan %38 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %35 + %41 = OpLoad %float %40 + %42 = OpFAdd %float %41 %39 + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %35 + OpStore %43 %42 + %44 = OpLoad %uint %gl_LocalInvocationIndex + %45 = OpLoad %uint %gl_LocalInvocationIndex + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %45 + %47 = OpLoad %float %46 + %48 = OpExtInst %float %1 Acos %47 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %44 + %50 = OpLoad %float %49 + %51 = OpFAdd %float %50 %48 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %44 + OpStore %52 %51 + %53 = OpLoad %uint %gl_LocalInvocationIndex + %54 = OpLoad %uint %gl_LocalInvocationIndex + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %54 + %56 = OpLoad %float %55 + %57 = OpExtInst %float %1 Asin %56 + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %53 + %59 = OpLoad %float %58 + %60 = OpFAdd %float %59 %57 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %53 + OpStore %61 %60 + %62 = OpLoad %uint %gl_LocalInvocationIndex + %63 = OpLoad %uint %gl_LocalInvocationIndex + %64 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %63 + %65 = OpLoad %float %64 + %66 = OpExtInst %float %1 Atan %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %62 + %68 = OpLoad %float %67 + %69 = OpFAdd %float %68 %66 + %70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %62 + OpStore %70 %69 + %71 = OpLoad %uint %gl_LocalInvocationIndex + %72 = OpLoad %uint %gl_LocalInvocationIndex + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %72 + %74 = OpLoad %float %73 + %75 = OpExtInst %float %1 Exp %74 + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %71 + %77 = OpLoad %float %76 + %78 = OpFAdd %float %77 %75 + %79 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %71 + OpStore %79 %78 + %80 = OpLoad %uint %gl_LocalInvocationIndex + %81 = OpLoad %uint %gl_LocalInvocationIndex + %82 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %81 + %83 = OpLoad %float %82 + %84 = OpExtInst %float %1 Exp2 %83 + %85 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %80 + %86 = OpLoad %float %85 + %87 = OpFAdd %float %86 %84 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %80 + OpStore %88 %87 + %89 = OpLoad %uint %gl_LocalInvocationIndex + %90 = OpLoad %uint %gl_LocalInvocationIndex + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %90 + %92 = OpLoad %float %91 + %93 = OpExtInst %float %1 Log %92 + %94 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %89 + %95 = OpLoad %float %94 + %96 = OpFAdd %float %95 %93 + %97 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %89 + OpStore %97 %96 + %98 = OpLoad %uint %gl_LocalInvocationIndex + %99 = OpLoad %uint %gl_LocalInvocationIndex + %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %99 + %101 = OpLoad %float %100 + %102 = OpExtInst %float %1 Log2 %101 + %103 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %98 + %104 = OpLoad %float %103 + %105 = OpFAdd %float %104 %102 + %106 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %98 + OpStore %106 %105 + %107 = OpLoad %uint %gl_LocalInvocationIndex + %108 = OpLoad %uint %gl_LocalInvocationIndex + %109 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %108 + %110 = OpLoad %float %109 + %111 = OpExtInst %float %1 Sqrt %110 + %112 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %107 + %113 = OpLoad %float %112 + %114 = OpFAdd %float %113 %111 + %115 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %107 + OpStore %115 %114 + %116 = OpLoad %uint %gl_LocalInvocationIndex + %117 = OpLoad %uint %gl_LocalInvocationIndex + %118 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %117 + %119 = OpLoad %float %118 + %120 = OpExtInst %float %1 InverseSqrt %119 + %121 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %116 + %122 = OpLoad %float %121 + %123 = OpFAdd %float %122 %120 + %124 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %116 + OpStore %124 %123 + %125 = OpLoad %uint %gl_LocalInvocationIndex + %126 = OpLoad %uint %gl_LocalInvocationIndex + %127 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %126 + %128 = OpLoad %float %127 + %130 = OpExtInst %float %1 Pow %128 %float_4 + %131 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %125 + %132 = OpLoad %float %131 + %133 = OpFAdd %float %132 %130 + %134 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %125 + OpStore %134 %133 + %136 = OpLoad %uint %gl_LocalInvocationIndex + %137 = OpLoad %uint %gl_LocalInvocationIndex + %139 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %137 + %140 = OpLoad %half %139 + %141 = OpExtInst %half %1 Cos %140 + %142 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %136 + OpStore %142 %141 + %143 = OpLoad %uint %gl_LocalInvocationIndex + %144 = OpLoad %uint %gl_LocalInvocationIndex + %145 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %144 + %146 = OpLoad %half %145 + %147 = OpExtInst %half %1 Sin %146 + %148 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %143 + %149 = OpLoad %half %148 + %150 = OpFAdd %half %149 %147 + %151 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %143 + OpStore %151 %150 + %152 = OpLoad %uint %gl_LocalInvocationIndex + %153 = OpLoad %uint %gl_LocalInvocationIndex + %154 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %153 + %155 = OpLoad %half %154 + %156 = OpExtInst %half %1 Cosh %155 + %157 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %152 + %158 = OpLoad %half %157 + %159 = OpFAdd %half %158 %156 + %160 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %152 + OpStore %160 %159 + %161 = OpLoad %uint %gl_LocalInvocationIndex + %162 = OpLoad %uint %gl_LocalInvocationIndex + %163 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %162 + %164 = OpLoad %half %163 + %165 = OpExtInst %half %1 Sinh %164 + %166 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %161 + %167 = OpLoad %half %166 + %168 = OpFAdd %half %167 %165 + %169 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %161 + OpStore %169 %168 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp32.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp32.asm.comp new file mode 100644 index 0000000000..c95c72ddbd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/trancendentals-float-controls-2-fp32.asm.comp @@ -0,0 +1,224 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 173 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageBuffer16BitAccess + OpCapability FloatControls2 + OpExtension "SPV_KHR_16bit_storage" + OpExtension "SPV_KHR_float_controls2" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 4 1 1 + OpExecutionModeId %main FPFastMathDefault %float %fp32_modes + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpMemberName %SSBO 1 "f16" + OpName %_ "" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpDecorate %_arr_float_uint_4 ArrayStride 4 + OpDecorate %_arr_half_uint_4 ArrayStride 2 + OpDecorate %SSBO BufferBlock + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %24 FPFastMathMode None + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %fp32_modes = OpConstant %uint 0x7000f + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %half = OpTypeFloat 16 +%_arr_half_uint_4 = OpTypeArray %half %uint_4 + %SSBO = OpTypeStruct %_arr_float_uint_4 %_arr_half_uint_4 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_4 = OpConstant %float 4 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_half = OpTypePointer Uniform %half + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %uint %gl_LocalInvocationIndex + %20 = OpLoad %uint %gl_LocalInvocationIndex + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %20 + %23 = OpLoad %float %22 + %24 = OpExtInst %float %1 Cos %23 + %25 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %19 + OpStore %25 %24 + %26 = OpLoad %uint %gl_LocalInvocationIndex + %27 = OpLoad %uint %gl_LocalInvocationIndex + %28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %27 + %29 = OpLoad %float %28 + %30 = OpExtInst %float %1 Sin %29 + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %26 + %32 = OpLoad %float %31 + %33 = OpFAdd %float %32 %30 + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %26 + OpStore %34 %33 + %35 = OpLoad %uint %gl_LocalInvocationIndex + %36 = OpLoad %uint %gl_LocalInvocationIndex + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %36 + %38 = OpLoad %float %37 + %39 = OpExtInst %float %1 Tan %38 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %35 + %41 = OpLoad %float %40 + %42 = OpFAdd %float %41 %39 + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %35 + OpStore %43 %42 + %44 = OpLoad %uint %gl_LocalInvocationIndex + %45 = OpLoad %uint %gl_LocalInvocationIndex + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %45 + %47 = OpLoad %float %46 + %48 = OpExtInst %float %1 Acos %47 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %44 + %50 = OpLoad %float %49 + %51 = OpFAdd %float %50 %48 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %44 + OpStore %52 %51 + %53 = OpLoad %uint %gl_LocalInvocationIndex + %54 = OpLoad %uint %gl_LocalInvocationIndex + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %54 + %56 = OpLoad %float %55 + %57 = OpExtInst %float %1 Asin %56 + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %53 + %59 = OpLoad %float %58 + %60 = OpFAdd %float %59 %57 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %53 + OpStore %61 %60 + %62 = OpLoad %uint %gl_LocalInvocationIndex + %63 = OpLoad %uint %gl_LocalInvocationIndex + %64 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %63 + %65 = OpLoad %float %64 + %66 = OpExtInst %float %1 Atan %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %62 + %68 = OpLoad %float %67 + %69 = OpFAdd %float %68 %66 + %70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %62 + OpStore %70 %69 + %71 = OpLoad %uint %gl_LocalInvocationIndex + %72 = OpLoad %uint %gl_LocalInvocationIndex + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %72 + %74 = OpLoad %float %73 + %75 = OpExtInst %float %1 Exp %74 + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %71 + %77 = OpLoad %float %76 + %78 = OpFAdd %float %77 %75 + %79 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %71 + OpStore %79 %78 + %80 = OpLoad %uint %gl_LocalInvocationIndex + %81 = OpLoad %uint %gl_LocalInvocationIndex + %82 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %81 + %83 = OpLoad %float %82 + %84 = OpExtInst %float %1 Exp2 %83 + %85 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %80 + %86 = OpLoad %float %85 + %87 = OpFAdd %float %86 %84 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %80 + OpStore %88 %87 + %89 = OpLoad %uint %gl_LocalInvocationIndex + %90 = OpLoad %uint %gl_LocalInvocationIndex + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %90 + %92 = OpLoad %float %91 + %93 = OpExtInst %float %1 Log %92 + %94 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %89 + %95 = OpLoad %float %94 + %96 = OpFAdd %float %95 %93 + %97 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %89 + OpStore %97 %96 + %98 = OpLoad %uint %gl_LocalInvocationIndex + %99 = OpLoad %uint %gl_LocalInvocationIndex + %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %99 + %101 = OpLoad %float %100 + %102 = OpExtInst %float %1 Log2 %101 + %103 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %98 + %104 = OpLoad %float %103 + %105 = OpFAdd %float %104 %102 + %106 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %98 + OpStore %106 %105 + %107 = OpLoad %uint %gl_LocalInvocationIndex + %108 = OpLoad %uint %gl_LocalInvocationIndex + %109 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %108 + %110 = OpLoad %float %109 + %111 = OpExtInst %float %1 Sqrt %110 + %112 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %107 + %113 = OpLoad %float %112 + %114 = OpFAdd %float %113 %111 + %115 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %107 + OpStore %115 %114 + %116 = OpLoad %uint %gl_LocalInvocationIndex + %117 = OpLoad %uint %gl_LocalInvocationIndex + %118 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %117 + %119 = OpLoad %float %118 + %120 = OpExtInst %float %1 InverseSqrt %119 + %121 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %116 + %122 = OpLoad %float %121 + %123 = OpFAdd %float %122 %120 + %124 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %116 + OpStore %124 %123 + %125 = OpLoad %uint %gl_LocalInvocationIndex + %126 = OpLoad %uint %gl_LocalInvocationIndex + %127 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %126 + %128 = OpLoad %float %127 + %130 = OpExtInst %float %1 Pow %128 %float_4 + %131 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %125 + %132 = OpLoad %float %131 + %133 = OpFAdd %float %132 %130 + %134 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %125 + OpStore %134 %133 + %136 = OpLoad %uint %gl_LocalInvocationIndex + %137 = OpLoad %uint %gl_LocalInvocationIndex + %139 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %137 + %140 = OpLoad %half %139 + %141 = OpExtInst %half %1 Cos %140 + %142 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %136 + OpStore %142 %141 + %143 = OpLoad %uint %gl_LocalInvocationIndex + %144 = OpLoad %uint %gl_LocalInvocationIndex + %145 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %144 + %146 = OpLoad %half %145 + %147 = OpExtInst %half %1 Sin %146 + %148 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %143 + %149 = OpLoad %half %148 + %150 = OpFAdd %half %149 %147 + %151 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %143 + OpStore %151 %150 + %152 = OpLoad %uint %gl_LocalInvocationIndex + %153 = OpLoad %uint %gl_LocalInvocationIndex + %154 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %153 + %155 = OpLoad %half %154 + %156 = OpExtInst %half %1 Cosh %155 + %157 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %152 + %158 = OpLoad %half %157 + %159 = OpFAdd %half %158 %156 + %160 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %152 + OpStore %160 %159 + %161 = OpLoad %uint %gl_LocalInvocationIndex + %162 = OpLoad %uint %gl_LocalInvocationIndex + %163 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %162 + %164 = OpLoad %half %163 + %165 = OpExtInst %half %1 Sinh %164 + %166 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %161 + %167 = OpLoad %half %166 + %168 = OpFAdd %half %167 %165 + %169 = OpAccessChain %_ptr_Uniform_half %_ %int_1 %161 + OpStore %169 %168 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-ssbo-argument.spv16.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-ssbo-argument.spv16.asm.comp new file mode 100644 index 0000000000..0cb7917036 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-ssbo-argument.spv16.asm.comp @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.6 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 24 +; Schema: 0 + OpCapability VariablePointersStorageBuffer + OpCapability Int8 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 + OpExecutionMode %1 LocalSize 16 1 1 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + OpDecorate %_struct_3 Block + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_runtimearr_uchar ArrayStride 1 + OpDecorate %_ptr_StorageBuffer_uchar ArrayStride 1 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uchar = OpTypeInt 8 0 + %uchar_0 = OpConstant %uchar 0 +%_runtimearr_uchar = OpTypeRuntimeArray %uchar + %_struct_3 = OpTypeStruct %_runtimearr_uchar +%_ptr_StorageBuffer_uchar = OpTypePointer StorageBuffer %uchar +%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3 + %2 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %15 = OpTypeFunction %void %_ptr_StorageBuffer_uchar + %16 = OpTypeFunction %void + %1 = OpFunction %void None %16 + %17 = OpLabel + %18 = OpAccessChain %_ptr_StorageBuffer_uchar %2 %uint_0 %uint_1 + %19 = OpFunctionCall %void %20 %18 + OpReturn + OpFunctionEnd + %20 = OpFunction %void None %15 + %21 = OpFunctionParameter %_ptr_StorageBuffer_uchar + %22 = OpLabel + %23 = OpPtrAccessChain %_ptr_StorageBuffer_uchar %21 %uint_2 + OpStore %23 %uchar_0 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-ssbo-array-argument.spv16.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-ssbo-array-argument.spv16.asm.comp new file mode 100644 index 0000000000..8dd687ca94 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-ssbo-array-argument.spv16.asm.comp @@ -0,0 +1,45 @@ +; SPIR-V +; Version: 1.6 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 24 +; Schema: 0 + OpCapability VariablePointersStorageBuffer + OpCapability Int8 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 + OpExecutionMode %1 LocalSize 16 1 1 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + OpDecorate %_struct_3 Block + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %uchar_array ArrayStride 1 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_16 = OpConstant %uint 16 + %uchar = OpTypeInt 8 0 + %uchar_0 = OpConstant %uchar 0 +%uchar_array = OpTypeArray %uchar %uint_16 + %_struct_3 = OpTypeStruct %uchar_array +%_ptr_StorageBuffer_uchar = OpTypePointer StorageBuffer %uchar +%_ptr_StorageBuffer_uchar_array = OpTypePointer StorageBuffer %uchar_array +%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3 + %2 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %15 = OpTypeFunction %void %_ptr_StorageBuffer_uchar_array + %16 = OpTypeFunction %void + %1 = OpFunction %void None %16 + %17 = OpLabel + %18 = OpAccessChain %_ptr_StorageBuffer_uchar_array %2 %uint_0 + %19 = OpFunctionCall %void %20 %18 + OpReturn + OpFunctionEnd + %20 = OpFunction %void None %15 + %21 = OpFunctionParameter %_ptr_StorageBuffer_uchar_array + %22 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_uchar %21 %uint_2 + OpStore %23 %uchar_0 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/struct-name-disambiguate.asm.dynamic-buffer.msl2.argument.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/struct-name-disambiguate.asm.dynamic-buffer.msl2.argument.frag new file mode 100644 index 0000000000..2219ecd956 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/struct-name-disambiguate.asm.dynamic-buffer.msl2.argument.frag @@ -0,0 +1,113 @@ + +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 11 +; Bound: 177 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %92 %96 + OpExecutionMode %4 OriginUpperLeft + OpSource HLSL 500 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %4 "main" + OpName %19 "ui" + OpName %23 "ui_sampler" + OpName %46 "scene" + OpName %48 "scene_sampler" + OpName %55 "world_info" + OpMemberName %55 0 "ambient_light" + OpMemberName %55 1 "world_resolution" + OpMemberName %55 2 "level_size" + OpName %57 "world_info" + OpName %92 "input.uv" + OpName %96 "@entryPointOutput" + OpDecorate %19 Binding 1 + OpDecorate %19 DescriptorSet 2 + OpDecorate %23 Binding 1 + OpDecorate %23 DescriptorSet 2 + OpDecorate %46 Binding 0 + OpDecorate %46 DescriptorSet 2 + OpDecorate %48 Binding 0 + OpDecorate %48 DescriptorSet 2 + OpDecorate %55 Block + OpMemberDecorate %55 0 Offset 0 + OpMemberDecorate %55 1 Offset 16 + OpMemberDecorate %55 2 Offset 24 + OpDecorate %57 Binding 2 + OpDecorate %57 DescriptorSet 1 + OpDecorate %92 Location 0 + OpDecorate %96 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeVector %6 2 + %15 = OpTypePointer Function %7 + %17 = OpTypeImage %6 2D 0 0 0 1 Unknown + %18 = OpTypePointer UniformConstant %17 + %19 = OpVariable %18 UniformConstant + %21 = OpTypeSampler + %22 = OpTypePointer UniformConstant %21 + %23 = OpVariable %22 UniformConstant + %25 = OpTypeSampledImage %17 + %27 = OpTypeInt 32 1 + %33 = OpTypeInt 32 0 + %34 = OpConstant %33 3 + %35 = OpTypePointer Function %6 + %38 = OpConstant %6 1 + %39 = OpTypeBool + %46 = OpVariable %18 UniformConstant + %48 = OpVariable %22 UniformConstant + %55 = OpTypeStruct %7 %8 %8 + %56 = OpTypePointer Uniform %55 + %57 = OpVariable %56 Uniform + %58 = OpConstant %27 0 + %59 = OpTypePointer Uniform %7 + %91 = OpTypePointer Input %8 + %92 = OpVariable %91 Input + %95 = OpTypePointer Output %7 + %96 = OpVariable %95 Output + %115 = OpConstant %33 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %122 = OpVariable %15 Function + %124 = OpVariable %15 Function + %93 = OpLoad %8 %92 + OpSelectionMerge %166 None + OpSwitch %115 %128 + %128 = OpLabel + %129 = OpLoad %17 %19 + %130 = OpLoad %21 %23 + %131 = OpSampledImage %25 %129 %130 + %134 = OpImageSampleImplicitLod %7 %131 %93 + OpStore %122 %134 + %135 = OpAccessChain %35 %122 %34 + %136 = OpLoad %6 %135 + %137 = OpFOrdEqual %39 %136 %38 + OpSelectionMerge %140 None + OpBranchConditional %137 %138 %140 + %138 = OpLabel + OpBranch %166 + %140 = OpLabel + %141 = OpLoad %17 %46 + %142 = OpLoad %21 %48 + %143 = OpSampledImage %25 %141 %142 + %146 = OpImageSampleImplicitLod %7 %143 %93 + %147 = OpAccessChain %59 %57 %58 + %148 = OpLoad %7 %147 + OpStore %124 %148 + %149 = OpAccessChain %35 %124 %34 + %150 = OpLoad %6 %149 + %152 = OpVectorTimesScalar %7 %148 %150 + OpStore %124 %152 + %164 = OpFMul %7 %146 %152 + %165 = OpFAdd %7 %134 %164 + OpBranch %166 + %166 = OpLabel + %176 = OpPhi %7 %134 %138 %165 %140 + OpStore %96 %176 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/argument-buffer-readonly-writeonly-alias.msl2.argument.argument-tier-1.device-argument-buffer.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/argument-buffer-readonly-writeonly-alias.msl2.argument.argument-tier-1.device-argument-buffer.comp new file mode 100644 index 0000000000..f5f05a1aea --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/argument-buffer-readonly-writeonly-alias.msl2.argument.argument-tier-1.device-argument-buffer.comp @@ -0,0 +1,9 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout (binding = 0) readonly buffer A {float data_a[];} a[]; +layout (binding = 0) writeonly buffer D {float data_d[];} d[]; + +void main() { + d[gl_WorkGroupID.x].data_d[0] = a[gl_WorkGroupID.x].data_a[0]; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/atomic-cmpxchg-packed-vector.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/atomic-cmpxchg-packed-vector.comp new file mode 100644 index 0000000000..f54fc5f524 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/atomic-cmpxchg-packed-vector.comp @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_nonuniform_qualifier : enable +#extension GL_EXT_scalar_block_layout : require + +layout(scalar, binding=1) restrict buffer AttData0 { + uvec3 att0[]; +}; + +void main() { + uint newVal = 432; + uint prevVal = 0; + uint curVal = 0; + + while ( (curVal = atomicCompSwap(att0[0].x, prevVal, newVal)) != prevVal) + { + } +}; diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/extract-atomics-from-function.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/extract-atomics-from-function.comp index c1b7632f85..ce730ba64b 100644 --- a/third_party/spirv-cross/shaders-msl-no-opt/comp/extract-atomics-from-function.comp +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/extract-atomics-from-function.comp @@ -48,7 +48,7 @@ void testCompSwap() void testStore() { - atomicStore(var, 10u, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed); + atomicStore(var, 10u, gl_ScopeDevice, 0, gl_SemanticsRelaxed); } void foo() diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/image-cube-atomic.msl4.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/image-cube-atomic.msl4.comp new file mode 100644 index 0000000000..8da819b007 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/image-cube-atomic.msl4.comp @@ -0,0 +1,11 @@ +#version 450 +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0, r32ui) uniform uimageCube uCube; +layout(set = 0, binding = 1, r32ui) uniform uimageCubeArray uCubeArray; + +void main() +{ + imageAtomicAdd(uCube, ivec3(gl_GlobalInvocationID), 10u); + imageAtomicOr(uCubeArray, ivec3(gl_GlobalInvocationID), 10u); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl3.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl3.comp new file mode 100644 index 0000000000..c8172fd95c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.vk.msl3.comp @@ -0,0 +1,211 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require +#extension GL_KHR_shader_subgroup_rotate : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +void doClusteredRotate() +{ + uint rotated_clustered = subgroupClusteredRotate(20u, 4u, 8u); + bool rotated_clustered_bool = subgroupClusteredRotate(false, 4u, 8u); +} + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + bvec2 broadcasted_bool = subgroupBroadcast(bvec2(true), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + bvec4 first_bool = subgroupBroadcastFirst(bvec4(false)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + bool shuffled_bool = subgroupShuffle(true, 9u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = subgroupShuffleXor(false, 9u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = subgroupShuffleUp(true, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = subgroupShuffleDown(false, 4u); + + // rotate + uint rotated = subgroupRotate(20u, 4u); + bool rotated_bool = subgroupRotate(false, 4u); + doClusteredRotate(); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(0); + has_equal = subgroupAllEqual(true); + has_equal = subgroupAllEqual(vec3(0.0, 1.0, 2.0)); + has_equal = subgroupAllEqual(bvec4(true, true, false, true)); + + // arithmetic + vec4 added = subgroupAdd(vec4(20.0)); + ivec4 iadded = subgroupAdd(ivec4(20)); + vec4 multiplied = subgroupMul(vec4(20.0)); + ivec4 imultiplied = subgroupMul(ivec4(20)); + vec4 lo = subgroupMin(vec4(20.0)); + vec4 hi = subgroupMax(vec4(20.0)); + ivec4 slo = subgroupMin(ivec4(20)); + ivec4 shi = subgroupMax(ivec4(20)); + uvec4 ulo = subgroupMin(uvec4(20)); + uvec4 uhi = subgroupMax(uvec4(20)); + uvec4 anded = subgroupAnd(ballot_value); + uvec4 ored = subgroupOr(ballot_value); + uvec4 xored = subgroupXor(ballot_value); + bvec4 anded_b = subgroupAnd(equal(ballot_value, uvec4(42))); + bvec4 ored_b = subgroupOr(equal(ballot_value, uvec4(42))); + bvec4 xored_b = subgroupXor(equal(ballot_value, uvec4(42))); + + added = subgroupInclusiveAdd(added); + iadded = subgroupInclusiveAdd(iadded); + multiplied = subgroupInclusiveMul(multiplied); + imultiplied = subgroupInclusiveMul(imultiplied); + //lo = subgroupInclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupInclusiveMax(hi); + //slo = subgroupInclusiveMin(slo); + //shi = subgroupInclusiveMax(shi); + //ulo = subgroupInclusiveMin(ulo); + //uhi = subgroupInclusiveMax(uhi); + //anded = subgroupInclusiveAnd(anded); + //ored = subgroupInclusiveOr(ored); + //xored = subgroupInclusiveXor(ored); + //added = subgroupExclusiveAdd(lo); + + added = subgroupExclusiveAdd(multiplied); + multiplied = subgroupExclusiveMul(multiplied); + iadded = subgroupExclusiveAdd(imultiplied); + imultiplied = subgroupExclusiveMul(imultiplied); + //lo = subgroupExclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupExclusiveMax(hi); + //ulo = subgroupExclusiveMin(ulo); + //uhi = subgroupExclusiveMax(uhi); + //slo = subgroupExclusiveMin(slo); + //shi = subgroupExclusiveMax(shi); + //anded = subgroupExclusiveAnd(anded); + //ored = subgroupExclusiveOr(ored); + //xored = subgroupExclusiveXor(ored); + + // clustered + added = subgroupClusteredAdd(added, 1u); + multiplied = subgroupClusteredMul(multiplied, 1u); + iadded = subgroupClusteredAdd(iadded, 1u); + imultiplied = subgroupClusteredMul(imultiplied, 1u); + lo = subgroupClusteredMin(lo, 1u); + hi = subgroupClusteredMax(hi, 1u); + ulo = subgroupClusteredMin(ulo, 1u); + uhi = subgroupClusteredMax(uhi, 1u); + slo = subgroupClusteredMin(slo, 1u); + shi = subgroupClusteredMax(shi, 1u); + anded = subgroupClusteredAnd(anded, 1u); + ored = subgroupClusteredOr(ored, 1u); + xored = subgroupClusteredXor(xored, 1u); + + anded_b = subgroupClusteredAnd(equal(anded, uvec4(2u)), 1u); + ored_b = subgroupClusteredOr(equal(ored, uvec4(3u)), 1u); + xored_b = subgroupClusteredXor(equal(xored, uvec4(4u)), 1u); + + added = subgroupClusteredAdd(added, 2u); + multiplied = subgroupClusteredMul(multiplied, 2u); + iadded = subgroupClusteredAdd(iadded, 2u); + imultiplied = subgroupClusteredMul(imultiplied, 2u); + lo = subgroupClusteredMin(lo, 2u); + hi = subgroupClusteredMax(hi, 2u); + ulo = subgroupClusteredMin(ulo, 2u); + uhi = subgroupClusteredMax(uhi, 2u); + slo = subgroupClusteredMin(slo, 2u); + shi = subgroupClusteredMax(shi, 2u); + anded = subgroupClusteredAnd(anded, 2u); + ored = subgroupClusteredOr(ored, 2u); + xored = subgroupClusteredXor(xored, 2u); + + anded_b = subgroupClusteredAnd(equal(anded, uvec4(2u)), 2u); + ored_b = subgroupClusteredOr(equal(ored, uvec4(3u)), 2u); + xored_b = subgroupClusteredXor(equal(xored, uvec4(4u)), 2u); + + added = subgroupClusteredAdd(added, 4u); + multiplied = subgroupClusteredMul(multiplied, 4u); + iadded = subgroupClusteredAdd(iadded, 4u); + imultiplied = subgroupClusteredMul(imultiplied, 4u); + lo = subgroupClusteredMin(lo, 4u); + hi = subgroupClusteredMax(hi, 4u); + ulo = subgroupClusteredMin(ulo, 4u); + uhi = subgroupClusteredMax(uhi, 4u); + slo = subgroupClusteredMin(slo, 4u); + shi = subgroupClusteredMax(shi, 4u); + anded = subgroupClusteredAnd(anded, 4u); + ored = subgroupClusteredOr(ored, 4u); + xored = subgroupClusteredXor(xored, 4u); + + anded_b = subgroupClusteredAnd(equal(anded, uvec4(2u)), 4u); + ored_b = subgroupClusteredOr(equal(ored, uvec4(3u)), 4u); + xored_b = subgroupClusteredXor(equal(xored, uvec4(4u)), 4u); + + added = subgroupClusteredAdd(added, 16u); + multiplied = subgroupClusteredMul(multiplied, 16u); + iadded = subgroupClusteredAdd(iadded, 16u); + imultiplied = subgroupClusteredMul(imultiplied, 16u); + lo = subgroupClusteredMin(lo, 16u); + hi = subgroupClusteredMax(hi, 16u); + ulo = subgroupClusteredMin(ulo, 16u); + uhi = subgroupClusteredMax(uhi, 16u); + slo = subgroupClusteredMin(slo, 16u); + shi = subgroupClusteredMax(shi, 16u); + anded = subgroupClusteredAnd(anded, 16u); + ored = subgroupClusteredOr(ored, 16u); + xored = subgroupClusteredXor(xored, 16u); + + anded_b = subgroupClusteredAnd(equal(anded, uvec4(2u)), 16u); + ored_b = subgroupClusteredOr(equal(ored, uvec4(3u)), 16u); + xored_b = subgroupClusteredXor(equal(xored, uvec4(4u)), 16u); + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + bvec4 swap_horiz_bool = subgroupQuadSwapHorizontal(bvec4(true)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + bvec4 swap_vertical_bool = subgroupQuadSwapVertical(bvec4(true)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + bvec4 swap_diagonal_bool = subgroupQuadSwapDiagonal(bvec4(true)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); + bvec4 quad_broadcast_bool = subgroupQuadBroadcast(bvec4(true), 3u); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp16.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp16.comp new file mode 100644 index 0000000000..4f9e82f37b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp16.comp @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_spirv_intrinsics : require +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +layout(local_size_x = 4) in; + +layout(set = 0, binding = 0) buffer SSBO +{ + float v[4]; + float16_t f16[4]; +}; + +// SignedZeroInfNanPreserve 16 +spirv_execution_mode(capabilities = [4466], extensions = ["SPV_KHR_float_controls"], 4461, 16); + +void main () +{ + v[gl_LocalInvocationIndex] = cos(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += sin(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += tan(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += acos(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += asin(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += atan(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += exp(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += exp2(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += log(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += log2(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += sqrt(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += inversesqrt(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += pow(v[gl_LocalInvocationIndex], 4.0); + + f16[gl_LocalInvocationIndex] = cos(f16[gl_LocalInvocationIndex]); + f16[gl_LocalInvocationIndex] += sin(f16[gl_LocalInvocationIndex]); + f16[gl_LocalInvocationIndex] += cosh(f16[gl_LocalInvocationIndex]); + f16[gl_LocalInvocationIndex] += sinh(f16[gl_LocalInvocationIndex]); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp32.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp32.comp new file mode 100644 index 0000000000..8995457c92 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/trancendental-float-controls-1-fp32.comp @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_spirv_intrinsics : require +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +layout(local_size_x = 4) in; + +layout(set = 0, binding = 0) buffer SSBO +{ + float v[4]; + float16_t f16[4]; +}; + +// SignedZeroInfNanPreserve 32 +spirv_execution_mode(capabilities = [4466], extensions = ["SPV_KHR_float_controls"], 4461, 32); + +void main () +{ + v[gl_LocalInvocationIndex] = cos(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += sin(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += tan(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += acos(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += asin(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += atan(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += exp(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += exp2(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += log(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += log2(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += sqrt(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += inversesqrt(v[gl_LocalInvocationIndex]); + v[gl_LocalInvocationIndex] += pow(v[gl_LocalInvocationIndex], 4.0); + + f16[gl_LocalInvocationIndex] = cos(f16[gl_LocalInvocationIndex]); + f16[gl_LocalInvocationIndex] += sin(f16[gl_LocalInvocationIndex]); + f16[gl_LocalInvocationIndex] += cosh(f16[gl_LocalInvocationIndex]); + f16[gl_LocalInvocationIndex] += sinh(f16[gl_LocalInvocationIndex]); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/transposed-temporary-expression-2.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/transposed-temporary-expression-2.comp new file mode 100644 index 0000000000..3f526942c7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/transposed-temporary-expression-2.comp @@ -0,0 +1,24 @@ +#version 450 +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0) buffer SSBO +{ + layout(row_major) mat4x3 A; + layout(row_major) mat4x3 B; + layout(row_major) mat4x3 C; + vec4 D; + float w0; + float w1; +}; + +void main() +{ + mat4x3 Anew; + mat4x3 Bnew; + do + { + Anew = A * w0; + Bnew = B * w1; + } while(false); + D = vec4((Anew + Bnew) * D, 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/transposed-temporary-expression.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/transposed-temporary-expression.comp new file mode 100644 index 0000000000..ab56bd0395 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/transposed-temporary-expression.comp @@ -0,0 +1,17 @@ +#version 450 +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0) buffer SSBO +{ + layout(row_major) mat4x3 A; + layout(row_major) mat4x3 B; + layout(row_major) mat4x3 C; + vec4 D; + float w0; + float w1; +}; + +void main() +{ + D = vec4((A * w0 + B * w1) * D, 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.comp new file mode 100644 index 0000000000..d29e08005b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.comp @@ -0,0 +1,21 @@ +#version 450 +layout(local_size_x_id = 0, local_size_y_id = 2, local_size_z_id = 3) in; + +layout(constant_id = 1) const int A = 2; +float D[A * gl_WorkGroupSize.x]; +float E[A * gl_WorkGroupSize.z]; + +layout(set = 0, binding = 0) buffer SSBO +{ + int I; + float V; +}; + +void main () +{ + for (int i = 0; i < A * gl_WorkGroupSize.x; i++) + D[i] = 1.0 + float(i + gl_WorkGroupSize.y); + for (int i = 0; i < A * gl_WorkGroupSize.z; i++) + D[i] = 1.0 + float(i + gl_WorkGroupSize.y); + V = D[I] + D[I ^ 1] + E[I]; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp new file mode 100644 index 0000000000..d29e08005b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp @@ -0,0 +1,21 @@ +#version 450 +layout(local_size_x_id = 0, local_size_y_id = 2, local_size_z_id = 3) in; + +layout(constant_id = 1) const int A = 2; +float D[A * gl_WorkGroupSize.x]; +float E[A * gl_WorkGroupSize.z]; + +layout(set = 0, binding = 0) buffer SSBO +{ + int I; + float V; +}; + +void main () +{ + for (int i = 0; i < A * gl_WorkGroupSize.x; i++) + D[i] = 1.0 + float(i + gl_WorkGroupSize.y); + for (int i = 0; i < A * gl_WorkGroupSize.z; i++) + D[i] = 1.0 + float(i + gl_WorkGroupSize.y); + V = D[I] + D[I ^ 1] + E[I]; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/block-io-array-copy.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/block-io-array-copy.vert new file mode 100644 index 0000000000..13ffd56582 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/block-io-array-copy.vert @@ -0,0 +1,21 @@ +#version 450 + +void Wobble(vec2 uu, out vec4 offset[3]) +{ + offset[0] = vec4(uu, uu); + offset[1] = vec4(uu, uu); + offset[2] = vec4(uu, uu); +} + +layout(location = 3) in vec3 dd[1]; + +layout(location = 1) out Vertex { + vec2 umbrage; + vec4 offset[3]; +} aa; + +void main() +{ + Wobble(dd[0].st, aa.offset); + gl_Position = vec4(1.0, 1.0, 0.0, 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/fma.spv16.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/fma.spv16.asm.comp new file mode 100644 index 0000000000..ec57f19fe3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/fma.spv16.asm.comp @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.6 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpCapability FMAKHR + OpExtension "SPV_KHR_fma" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource ESSL 310 + OpName %main "main" + OpName %SSBO2 "SSBO2" + OpMemberName %SSBO2 0 "out_data" + OpName %_ "" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "in_data" + OpName %__0 "" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpDecorate %SSBO2 Block + OpMemberDecorate %SSBO2 0 NonReadable + OpMemberDecorate %SSBO2 0 Offset 0 + OpDecorate %_ NonReadable + OpDecorate %_ Binding 1 + OpDecorate %_ DescriptorSet 0 + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 NonWritable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO2 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer_SSBO2 = OpTypePointer StorageBuffer %SSBO2 + %_ = OpVariable %_ptr_StorageBuffer_SSBO2 StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %__0 = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %29 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_StorageBuffer_v4float %__0 %int_0 %int_0 + %20 = OpLoad %v4float %19 + %22 = OpAccessChain %_ptr_StorageBuffer_v4float %__0 %int_0 %int_1 + %23 = OpLoad %v4float %22 + %24 = OpFmaKHR %v4float %20 %23 %23 + %25 = OpAccessChain %_ptr_StorageBuffer_v4float %_ %int_0 %int_0 + OpStore %25 %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag new file mode 100644 index 0000000000..fdbab875ea --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/spec-constant-bool-mixed.asm.frag @@ -0,0 +1,38 @@ +; SPIR-V +; Option A test: same SpecId used for bool and uint +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %outColor +OpExecutionMode %main OriginUpperLeft + +OpDecorate %outColor Location 0 +OpDecorate %specBool SpecId 0 +OpDecorate %specUint SpecId 0 + +%void = OpTypeVoid +%fn = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%bool = OpTypeBool + +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 + +%specBool = OpSpecConstantTrue %bool +%specUint = OpSpecConstant %uint 0 + +%ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %ptr_Output_v4float Output + +%main = OpFunction %void None %fn +%entry = OpLabel +%u_to_f = OpConvertUToF %float %specUint +%sel = OpSelect %float %specBool %float_1 %float_0 +%sum = OpFAdd %float %u_to_f %sel +%vec = OpCompositeConstruct %v4float %sum %sum %sum %sum +OpStore %outColor %vec +OpReturn +OpFunctionEnd + + diff --git a/third_party/spirv-cross/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh b/third_party/spirv-cross/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh new file mode 100644 index 0000000000..6530417f2d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/mesh/mesh-shader-no-vertices.asm.msl3.spv14.vk.mesh @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 18 +; Schema: 0 + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %4 "main" %17 + OpExecutionMode %4 LocalSize 128 1 1 + OpExecutionMode %4 OutputVertices 256 + OpExecutionMode %4 OutputPrimitivesEXT 256 + OpExecutionMode %4 OutputTrianglesEXT + OpDecorate %11 BuiltIn WorkgroupSize + OpDecorate %17 Location 0 + OpDecorate %17 PerPrimitiveEXT + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpConstant %6 0 + %8 = OpTypeVector %6 3 + %9 = OpConstant %6 128 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %8 %9 %10 %10 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpConstant %6 256 + %15 = OpTypeArray %13 %14 + %16 = OpTypePointer Output %15 + %17 = OpVariable %16 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSetMeshOutputsEXT %7 %7 + OpReturn + OpFunctionEnd \ No newline at end of file diff --git a/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp b/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp new file mode 100644 index 0000000000..943aaad8b3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.comp @@ -0,0 +1,28 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require +#extension GL_EXT_samplerless_texture_functions : require + +layout(binding = 0) readonly buffer SSBO +{ + float b; +} RO[]; + +layout(set = 0, binding = 0) writeonly buffer SSBOW +{ + layout(offset = 4) float a; +} RW[]; + +void in_func() +{ + RW[gl_WorkGroupID.x].a = RO[gl_WorkGroupID.x].b; +} + +layout(set = 1, binding = 0) uniform texture2D tex2d[]; +layout(set = 1, binding = 0) uniform texture3D tex3d[]; + +void main() +{ + in_func(); + RW[0].a += texelFetch(tex2d[gl_WorkGroupID.x], ivec2(0), 0).x; + RW[0].a += texelFetch(tex3d[gl_WorkGroupID.x], ivec3(10), 1).x; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp b/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp new file mode 100644 index 0000000000..29c1531ebb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete-aliasing.msl2.argument-tier-1.rich-descriptor.comp @@ -0,0 +1,24 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require +#extension GL_EXT_samplerless_texture_functions : require + +layout(binding = 0) readonly buffer SSBO +{ + float b; + float unsized[]; +} RO[]; + +layout(set = 0, binding = 0) writeonly buffer SSBOW +{ + layout(offset = 4) float a; +} RW[]; + +void in_func() +{ + RW[gl_WorkGroupID.x].a = RO[gl_WorkGroupID.x].b + RO[gl_WorkGroupID.x].unsized.length(); +} + +void main() +{ + in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp b/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp new file mode 100644 index 0000000000..2b7fb835be --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/buffers-unsized-discrete.msl2.argument-tier-1.comp @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(binding = 0) readonly buffer SSBO +{ + float b; +} RO[]; + +layout(set = 1, binding = 0) writeonly buffer SSBOW +{ + layout(offset = 4) float a; +} RW[]; + +void in_func() +{ + RW[gl_WorkGroupID.x].a = RO[gl_WorkGroupID.x].b; +} + +void main() +{ + in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/extended-shuffle-types.msl23.comp b/third_party/spirv-cross/shaders-msl/comp/extended-shuffle-types.msl23.comp new file mode 100644 index 0000000000..020e203045 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/extended-shuffle-types.msl23.comp @@ -0,0 +1,78 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_shuffle : require + +#extension GL_EXT_shader_subgroup_extended_types_int8 : require +#extension GL_EXT_shader_subgroup_extended_types_int16 : require +#extension GL_EXT_shader_subgroup_extended_types_float16 : require +#extension GL_EXT_shader_subgroup_extended_types_int64 : require + +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require + +layout(local_size_x = 4) in; + +layout(set = 0, binding = 0) buffer SSBO +{ + uint8_t u8_1[4]; + i8vec2 i8_2[4]; + u8vec3 u8_3[4]; + i8vec4 i8_4[4]; + + uint16_t u16_1[4]; + i16vec2 i16_2[4]; + u16vec3 u16_3[4]; + i16vec4 i16_4[4]; + + float16_t f16_1[4]; + f16vec2 f16_2[4]; + f16vec3 f16_3[4]; + f16vec4 f16_4[4]; + + uint64_t u64_1[4]; + i64vec2 i64_2[4]; + u64vec3 u64_3[4]; + i64vec4 i64_4[4]; +}; + +void int8() +{ + u8_1[gl_LocalInvocationIndex] = subgroupShuffle(u8_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i8_2[gl_LocalInvocationIndex] = subgroupShuffle(i8_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + u8_3[gl_LocalInvocationIndex] = subgroupShuffle(u8_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i8_4[gl_LocalInvocationIndex] = subgroupShuffle(i8_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void int16() +{ + u16_1[gl_LocalInvocationIndex] = subgroupShuffle(u16_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i16_2[gl_LocalInvocationIndex] = subgroupShuffle(i16_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + u16_3[gl_LocalInvocationIndex] = subgroupShuffle(u16_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i16_4[gl_LocalInvocationIndex] = subgroupShuffle(i16_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void fp16() +{ + f16_1[gl_LocalInvocationIndex] = subgroupShuffle(f16_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f16_2[gl_LocalInvocationIndex] = subgroupShuffle(f16_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f16_3[gl_LocalInvocationIndex] = subgroupShuffle(f16_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f16_4[gl_LocalInvocationIndex] = subgroupShuffle(f16_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void int64() +{ + u64_1[gl_LocalInvocationIndex] = subgroupShuffle(u64_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i64_2[gl_LocalInvocationIndex] = subgroupShuffle(i64_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + u64_3[gl_LocalInvocationIndex] = subgroupShuffle(u64_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i64_4[gl_LocalInvocationIndex] = subgroupShuffle(i64_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void main() +{ + int8(); + int16(); + int64(); + fp16(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/fp16-trancendentals.frag b/third_party/spirv-cross/shaders-msl/frag/fp16-trancendentals.frag index ea4065d217..1000ca027f 100644 --- a/third_party/spirv-cross/shaders-msl/frag/fp16-trancendentals.frag +++ b/third_party/spirv-cross/shaders-msl/frag/fp16-trancendentals.frag @@ -6,6 +6,9 @@ layout(location = 1) in float16_t B; layout(location = 0) out float16_t C; layout(location = 1) out float16_t D; +layout(location = 2) in f16vec3 v3; +layout(location = 2) out f16vec3 o3; + void main() { D = 0.0hf; @@ -29,5 +32,27 @@ void main() C = clamp(log2(A), A, B); D += C; C = clamp(sqrt(A), A, B); D += C; C = clamp(inversesqrt(A), A, B); D += C; + + // Vector variants since it tripped up overload resolution. + o3 = sinh(v3); + o3 += cosh(v3); + o3 += tanh(v3); + o3 += sin(v3); + o3 += cos(v3); + o3 += tan(v3); + o3 += asin(v3); + o3 += acos(v3); + o3 += atan(v3); + o3 += asinh(v3); + o3 += acosh(v3); + o3 += atanh(v3); + o3 += atan(o3, v3); + o3 += pow(o3, v3); + o3 += exp(v3); + o3 += exp2(v3); + o3 += log(v3); + o3 += log2(v3); + o3 += sqrt(v3); + o3 += inversesqrt(v3); } diff --git a/third_party/spirv-cross/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..85f3f3269d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,46 @@ +#version 450 +#extension GL_GOOGLE_cpp_style_line_directive : require +#line 100 "test.frag" + +layout(location = 0) in vec3 iv; +layout(location = 0) out vec3 ov; + +void func0() +{ + if (iv.x < 0.0) + ov.x = 50.0; + else + ov.x = 60.0; +} + +void func1() +{ + for (int i = 0; i < 4; i++) + { + func0(); + if (iv.y < 0.0) + ov.y = 70.0; + else + ov.y = 80.0; + } +} + +void func2() +{ + for (int i = 0; i < 4; i++) + { + func0(); + func1(); + if (iv.z < 0.0) + ov.z = 100.0; + else + ov.z = 120.0; + } +} + +void main () +{ + func0(); + func1(); + func2(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/no_pointsize.default-point-size.tese b/third_party/spirv-cross/shaders-msl/tese/no_pointsize.default-point-size.tese new file mode 100644 index 0000000000..877d448325 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/no_pointsize.default-point-size.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, triangles, fractional_even_spacing, point_mode) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert b/third_party/spirv-cross/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert new file mode 100644 index 0000000000..c22971c8a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/vertex-to-tess-block-io-leaf.for-tess.vert @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 5) out BlockIO +{ + float v; +} outBlock; + +void func() +{ + outBlock.v = 1.0; +} + +void main(void) +{ + func(); +} diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/array-copy-physical-layout-mismatch-ubo.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/array-copy-physical-layout-mismatch-ubo.asm.comp new file mode 100644 index 0000000000..0cf827894c --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/array-copy-physical-layout-mismatch-ubo.asm.comp @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %a "a" + OpName %UBO "UBO" + OpMemberName %UBO 0 "b" + OpMemberName %UBO 1 "c" + OpName %_ "" + OpDecorate %_arr_vec2_uint_5 ArrayStride 16 + OpDecorate %UBO Block + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 1 Offset 80 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %vec2 = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_vec2_uint_5 = OpTypeArray %vec2 %uint_5 +%_ptr_Function__arr_vec2_uint_5 = OpTypePointer Function %_arr_vec2_uint_5 +%_ptr_Uniform__arr_vec2_uint_5 = OpTypePointer Uniform %_arr_vec2_uint_5 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %UBO = OpTypeStruct %_arr_vec2_uint_5 %_arr_vec2_uint_5 +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %_ = OpVariable %_ptr_Uniform_UBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function__arr_vec2_uint_5 Function + %ptr_b = OpAccessChain %_ptr_Uniform__arr_vec2_uint_5 %_ %int_0 + %ptr_c = OpAccessChain %_ptr_Uniform__arr_vec2_uint_5 %_ %int_1 + %loaded_b = OpLoad %_arr_vec2_uint_5 %ptr_b + OpStore %a %loaded_b + OpCopyMemory %a %ptr_c + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/comp/image-cube-atomic.comp b/third_party/spirv-cross/shaders-no-opt/comp/image-cube-atomic.comp new file mode 100644 index 0000000000..8da819b007 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/image-cube-atomic.comp @@ -0,0 +1,11 @@ +#version 450 +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0, r32ui) uniform uimageCube uCube; +layout(set = 0, binding = 1, r32ui) uniform uimageCubeArray uCubeArray; + +void main() +{ + imageAtomicAdd(uCube, ivec3(gl_GlobalInvocationID), 10u); + imageAtomicOr(uCubeArray, ivec3(gl_GlobalInvocationID), 10u); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.comp b/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.comp new file mode 100644 index 0000000000..4a159d4764 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x_id = 0) in; + +layout(constant_id = 1) const int A = 2; +float D[A * gl_WorkGroupSize.x]; + +layout(set = 0, binding = 0) buffer SSBO +{ + int I; + float V; +}; + +void main () +{ + for (int i = 0; i < A * gl_WorkGroupSize.x; i++) + D[i] = 1.0 + float(i); + V = D[I] + D[I ^ 1]; +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp b/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp new file mode 100644 index 0000000000..4a159d4764 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.spv16.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x_id = 0) in; + +layout(constant_id = 1) const int A = 2; +float D[A * gl_WorkGroupSize.x]; + +layout(set = 0, binding = 0) buffer SSBO +{ + int I; + float V; +}; + +void main () +{ + for (int i = 0; i < A * gl_WorkGroupSize.x; i++) + D[i] = 1.0 + float(i); + V = D[I] + D[I ^ 1]; +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp b/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp new file mode 100644 index 0000000000..a31f8ae65b --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/workgroup-size-spec-constant-array.vk.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x_id = 0) in; + +layout(constant_id = 0) const int A = 2; +float D[A * gl_WorkGroupSize.x]; + +layout(set = 0, binding = 0) buffer SSBO +{ + int I; + float V; +}; + +void main () +{ + for (int i = 0; i < A * gl_WorkGroupSize.x; i++) + D[i] = 1.0 + float(i); + V = D[I] + D[I ^ 1]; +} diff --git a/third_party/spirv-cross/shaders/asm/comp/hlsl-functionality.asm.comp b/third_party/spirv-cross/shaders/asm/comp/hlsl-functionality.asm.comp index d431113972..796ce87097 100644 --- a/third_party/spirv-cross/shaders/asm/comp/hlsl-functionality.asm.comp +++ b/third_party/spirv-cross/shaders/asm/comp/hlsl-functionality.asm.comp @@ -30,17 +30,17 @@ OpDecorateId %Buf_0 HlslCounterBufferGOOGLE %Buf_count_0 %void = OpTypeVoid %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %Buf_count = OpTypeStruct %int +%_ptr_Uniform_Buf_count = OpTypePointer Uniform %Buf_count +%Buf_count_0 = OpVariable %_ptr_Uniform_Buf_count Uniform %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %_runtimearr_v4float = OpTypeRuntimeArray %v4float %Buf = OpTypeStruct %_runtimearr_v4float %_ptr_Uniform_Buf = OpTypePointer Uniform %Buf %Buf_0 = OpVariable %_ptr_Uniform_Buf Uniform - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %Buf_count = OpTypeStruct %int -%_ptr_Uniform_Buf_count = OpTypePointer Uniform %Buf_count -%Buf_count_0 = OpVariable %_ptr_Uniform_Buf_count Uniform %_ptr_Uniform_int = OpTypePointer Uniform %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 diff --git a/third_party/spirv-cross/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp b/third_party/spirv-cross/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp new file mode 100644 index 0000000000..89a2bf229c --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/cooperative-vec-nv.spv16.vk.nocompat.comp @@ -0,0 +1,62 @@ +#version 450 + +#extension GL_EXT_shader_16bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : enable +#extension GL_EXT_shader_explicit_arithmetic_types_int32 : enable + +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_NV_cooperative_vector : enable +#extension GL_EXT_buffer_reference : enable +#extension GL_EXT_null_initializer : enable + +layout(local_size_x = 64) in; + +layout (binding = 0) buffer Q {float16_t data_q[];}; + + +void main() +{ + coopvecNV inVec; + coopvecNV outVec; + + + coopVecLoadNV(inVec, data_q, 16); + coopVecStoreNV(inVec, data_q, 16); + + const int matrixLayout = 3; + const int interpretation = gl_ComponentTypeFloat16NV; + coopVecMatMulAddNV(inVec, + inVec, + interpretation, + data_q, + 16, + interpretation, + data_q, + 16, + interpretation, + 16, 16, + matrixLayout, + false, + 2); + coopVecMatMulNV(inVec, + inVec, + interpretation, + data_q, + 16, + interpretation, + 16, 16, + matrixLayout, + false, + 2); + coopvecNV a = coopvecNV(0); + inVec = max(inVec, inVec); + inVec[5] = inVec[3] + inVec[4]; + + coopVecOuterProductAccumulateNV(inVec, inVec, data_q, 0, 0, matrixLayout, gl_ComponentTypeFloat16NV); + coopVecReduceSumAccumulateNV(inVec, data_q, 0); + + coopvecNV a_8bit = coopvecNV(0); + coopvecNV b_32bit = coopvecNV(0); + b_32bit = max(coopvecNV(a_8bit), b_32bit); +} diff --git a/third_party/spirv-cross/shaders/frag/shader-debug-info-line-directives.line.gV.frag b/third_party/spirv-cross/shaders/frag/shader-debug-info-line-directives.line.gV.frag new file mode 100644 index 0000000000..85f3f3269d --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/shader-debug-info-line-directives.line.gV.frag @@ -0,0 +1,46 @@ +#version 450 +#extension GL_GOOGLE_cpp_style_line_directive : require +#line 100 "test.frag" + +layout(location = 0) in vec3 iv; +layout(location = 0) out vec3 ov; + +void func0() +{ + if (iv.x < 0.0) + ov.x = 50.0; + else + ov.x = 60.0; +} + +void func1() +{ + for (int i = 0; i < 4; i++) + { + func0(); + if (iv.y < 0.0) + ov.y = 70.0; + else + ov.y = 80.0; + } +} + +void func2() +{ + for (int i = 0; i < 4; i++) + { + func0(); + func1(); + if (iv.z < 0.0) + ov.z = 100.0; + else + ov.z = 120.0; + } +} + +void main () +{ + func0(); + func1(); + func2(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp b/third_party/spirv-cross/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp new file mode 100644 index 0000000000..4283c4f0f7 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/extended-subgroup-types.vk.nocompat.comp @@ -0,0 +1,92 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_shuffle : require + +#extension GL_EXT_shader_subgroup_extended_types_int8 : require +#extension GL_EXT_shader_subgroup_extended_types_int16 : require +#extension GL_EXT_shader_subgroup_extended_types_float16 : require +#extension GL_EXT_shader_subgroup_extended_types_int64 : require + +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require + +layout(local_size_x = 4) in; + +layout(set = 0, binding = 0) buffer SSBO +{ + uint8_t u8_1[4]; + i8vec2 i8_2[4]; + u8vec3 u8_3[4]; + i8vec4 i8_4[4]; + + uint16_t u16_1[4]; + i16vec2 i16_2[4]; + u16vec3 u16_3[4]; + i16vec4 i16_4[4]; + + float16_t f16_1[4]; + f16vec2 f16_2[4]; + f16vec3 f16_3[4]; + f16vec4 f16_4[4]; + + double f64_1[4]; + double f64_2[4]; + double f64_3[4]; + double f64_4[4]; + + uint64_t u64_1[4]; + i64vec2 i64_2[4]; + u64vec3 u64_3[4]; + i64vec4 i64_4[4]; +}; + +void int8() +{ + u8_1[gl_LocalInvocationIndex] = subgroupShuffle(u8_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i8_2[gl_LocalInvocationIndex] = subgroupShuffle(i8_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + u8_3[gl_LocalInvocationIndex] = subgroupShuffle(u8_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i8_4[gl_LocalInvocationIndex] = subgroupShuffle(i8_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void int16() +{ + u16_1[gl_LocalInvocationIndex] = subgroupShuffle(u16_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i16_2[gl_LocalInvocationIndex] = subgroupShuffle(i16_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + u16_3[gl_LocalInvocationIndex] = subgroupShuffle(u16_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i16_4[gl_LocalInvocationIndex] = subgroupShuffle(i16_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void fp16() +{ + f16_1[gl_LocalInvocationIndex] = subgroupShuffle(f16_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f16_2[gl_LocalInvocationIndex] = subgroupShuffle(f16_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f16_3[gl_LocalInvocationIndex] = subgroupShuffle(f16_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f16_4[gl_LocalInvocationIndex] = subgroupShuffle(f16_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void fp64() +{ + f64_1[gl_LocalInvocationIndex] = subgroupShuffle(f64_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f64_2[gl_LocalInvocationIndex] = subgroupShuffle(f64_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f64_3[gl_LocalInvocationIndex] = subgroupShuffle(f64_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + f64_4[gl_LocalInvocationIndex] = subgroupShuffle(f64_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void int64() +{ + u64_1[gl_LocalInvocationIndex] = subgroupShuffle(u64_1[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i64_2[gl_LocalInvocationIndex] = subgroupShuffle(i64_2[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + u64_3[gl_LocalInvocationIndex] = subgroupShuffle(u64_3[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); + i64_4[gl_LocalInvocationIndex] = subgroupShuffle(i64_4[gl_LocalInvocationIndex], gl_SubgroupInvocationID ^ 1); +} + +void main() +{ + int8(); + int16(); + int64(); + fp16(); + fp64(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp b/third_party/spirv-cross/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp index efea995b61..2b0197698f 100644 --- a/third_party/spirv-cross/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp +++ b/third_party/spirv-cross/shaders/vulkan/comp/replicated-composites.spv16.vk.nocompat.comp @@ -5,7 +5,7 @@ #extension GL_KHR_memory_scope_semantics : enable #extension GL_KHR_cooperative_matrix : enable -//#extension GL_NV_cooperative_vector : enable +#extension GL_NV_cooperative_vector : enable layout (constant_id = 0) const float spec_const = 0; layout (set = 0, binding = 0) uniform UBO { @@ -17,7 +17,7 @@ void main() { vec4 a = vec4(0.0); mat4 b = mat4(vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0)); coopmat matrix = coopmat(0); - //coopvecNV vec = coopvecNV(0); + coopvecNV vec = coopvecNV(0); vec4 c = vec4(spec_const); float array[] = float[](1.0, 1.0, 1.0, 1.0, 1.0, 1.0f, 1.0, 1.0f); @@ -25,4 +25,5 @@ void main() { vec4 d = vec4(ubo.uniform_float); mat4 e = mat4(d, d, d, d); coopmat matrix2 = coopmat(ubo.uniform_float); + coopvecNV vec_dynamic = coopvecNV(ubo.uniform_float); } diff --git a/third_party/spirv-cross/shaders/vulkan/frag/block-match-sad.frag b/third_party/spirv-cross/shaders/vulkan/frag/block-match-sad.spv14.frag similarity index 100% rename from third_party/spirv-cross/shaders/vulkan/frag/block-match-sad.frag rename to third_party/spirv-cross/shaders/vulkan/frag/block-match-sad.spv14.frag diff --git a/third_party/spirv-cross/shaders/vulkan/frag/block-match-ssd.frag b/third_party/spirv-cross/shaders/vulkan/frag/block-match-ssd.spv14.frag similarity index 100% rename from third_party/spirv-cross/shaders/vulkan/frag/block-match-ssd.frag rename to third_party/spirv-cross/shaders/vulkan/frag/block-match-ssd.spv14.frag diff --git a/third_party/spirv-cross/shaders/vulkan/frag/box-filter.frag b/third_party/spirv-cross/shaders/vulkan/frag/box-filter.spv14.frag similarity index 100% rename from third_party/spirv-cross/shaders/vulkan/frag/box-filter.frag rename to third_party/spirv-cross/shaders/vulkan/frag/box-filter.spv14.frag diff --git a/third_party/spirv-cross/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag b/third_party/spirv-cross/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag new file mode 100644 index 0000000000..22cc9c1387 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/rq-position-fetch.vk.spv14.nocompat.frag @@ -0,0 +1,25 @@ +#version 460 +#extension GL_EXT_ray_query : enable +#extension GL_EXT_ray_tracing_position_fetch : require + +layout(location = 0) out vec3 o_color; +layout(set = 0, binding = 0) uniform accelerationStructureEXT uAS; + +void main(void) +{ + float tmin = 0.01; + float tmax = 1000.0; + vec3 dir = vec3(1.0, 0.0, 0.0); + + rayQueryEXT query; + rayQueryInitializeEXT(query, uAS, gl_RayFlagsTerminateOnFirstHitEXT, 0xFF, vec3(0.0), tmin, dir, 1.0); + + rayQueryProceedEXT(query); + + if (rayQueryGetIntersectionTypeEXT(query, true) != gl_RayQueryCommittedIntersectionNoneEXT) + { + vec3 vs[3]; + rayQueryGetIntersectionTriangleVertexPositionsEXT(query, true, vs); + o_color = vs[0] + vs[1] + vs[2]; + } +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/sample-weighted.frag b/third_party/spirv-cross/shaders/vulkan/frag/sample-weighted.spv14.frag similarity index 100% rename from third_party/spirv-cross/shaders/vulkan/frag/sample-weighted.frag rename to third_party/spirv-cross/shaders/vulkan/frag/sample-weighted.spv14.frag diff --git a/third_party/spirv-cross/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit b/third_party/spirv-cross/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit new file mode 100644 index 0000000000..cc53e76c2c --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/nv/cluster-id.spv14.nocompat.vk.rahit @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require +#extension GL_NV_cluster_acceleration_structure : require + +rayPayloadInEXT int payload; + +void main() +{ + payload = gl_ClusterIDNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp new file mode 100644 index 0000000000..a60167e70a --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/nv/ray-query-cluster-id.spv14.nocompat.vk.comp @@ -0,0 +1,40 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_EXT_ray_tracing : require +#extension GL_NV_cluster_acceleration_structure : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT AS; + +layout(set = 0, binding = 1) uniform Params +{ + uint ray_flags; + uint cull_mask; + vec3 origin; + float tmin; + vec3 dir; + float tmax; +}; + +layout(set = 0, binding = 2) buffer SSBO +{ + int id; +}; + +void main() +{ + rayQueryEXT q; + rayQueryInitializeEXT(q, AS, ray_flags, cull_mask, origin, tmin, dir, tmax); + + while (rayQueryProceedEXT(q)) + { + if (rayQueryGetIntersectionTypeEXT(q, false) == gl_RayQueryCandidateIntersectionTriangleEXT + && rayQueryGetIntersectionClusterIdNV(q, false) != gl_ClusterIDNoneNV) + { + rayQueryTerminateEXT(q); + rayQueryConfirmIntersectionEXT(q); + } + } + + if (rayQueryGetIntersectionTypeEXT(q, true) == gl_RayQueryCommittedIntersectionTriangleEXT) + id = rayQueryGetIntersectionClusterIdNV(q, true); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..d294518a69 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/position_fetch.spv14.nocompat.vk.rchit @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require +#extension GL_EXT_ray_tracing_position_fetch : require + +layout(location = 0) rayPayloadInEXT vec3 hitValue; +hitAttributeEXT vec2 attribs; + +void main() +{ + const vec3 barycentricCoords = vec3(1.0 - attribs.x - attribs.y, attribs.x, attribs.y); + + vec3 pos0 = gl_HitTriangleVertexPositionsEXT[0]; + vec3 pos1 = gl_HitTriangleVertexPositionsEXT[1]; + vec3 pos2 = gl_HitTriangleVertexPositionsEXT[2]; + + hitValue = pos0 * barycentricCoords.x + pos1 * barycentricCoords.y + pos2 * barycentricCoords.z; +} diff --git a/third_party/spirv-cross/spirv.h b/third_party/spirv-cross/spirv.h index 005d451d33..26bc6d9d8b 100644 --- a/third_party/spirv-cross/spirv.h +++ b/third_party/spirv-cross/spirv.h @@ -642,6 +642,7 @@ typedef enum SpvDecoration_ { SpvDecorationHostAccessINTEL = 6188, SpvDecorationInitModeINTEL = 6190, SpvDecorationImplementInRegisterMapINTEL = 6191, + SpvDecorationConditionalINTEL = 6247, SpvDecorationCacheControlLoadINTEL = 6442, SpvDecorationCacheControlStoreINTEL = 6443, SpvDecorationMax = 0x7fffffff, @@ -1107,6 +1108,7 @@ typedef enum SpvCapability_ { SpvCapabilityTextureBoxFilterQCOM = 4485, SpvCapabilityTextureBlockMatchQCOM = 4486, SpvCapabilityTileShadingQCOM = 4495, + SpvCapabilityCooperativeMatrixConversionQCOM = 4496, SpvCapabilityTextureBlockMatch2QCOM = 4498, SpvCapabilityFloat16ImageAMD = 5008, SpvCapabilityImageGatherBiasLodAMD = 5009, @@ -1258,6 +1260,7 @@ typedef enum SpvCapability_ { SpvCapabilityBitInstructions = 6025, SpvCapabilityGroupNonUniformRotateKHR = 6026, SpvCapabilityFloatControls2 = 6029, + SpvCapabilityFMAKHR = 6030, SpvCapabilityAtomicFloat32AddEXT = 6033, SpvCapabilityAtomicFloat64AddEXT = 6034, SpvCapabilityLongCompositesINTEL = 6089, @@ -1282,6 +1285,9 @@ typedef enum SpvCapability_ { SpvCapabilitySubgroup2DBlockTransposeINTEL = 6230, SpvCapabilitySubgroupMatrixMultiplyAccumulateINTEL = 6236, SpvCapabilityTernaryBitwiseFunctionINTEL = 6241, + SpvCapabilityUntypedVariableLengthArrayINTEL = 6243, + SpvCapabilitySpecConditionalINTEL = 6245, + SpvCapabilityFunctionVariantsINTEL = 6246, SpvCapabilityGroupUniformArithmeticKHR = 6400, SpvCapabilityTensorFloat32RoundingINTEL = 6425, SpvCapabilityMaskedGatherScatterINTEL = 6427, @@ -1970,12 +1976,14 @@ typedef enum SpvOp_ { SpvOpUntypedInBoundsPtrAccessChainKHR = 4424, SpvOpUntypedArrayLengthKHR = 4425, SpvOpUntypedPrefetchKHR = 4426, + SpvOpFmaKHR = 4427, SpvOpSubgroupAllKHR = 4428, SpvOpSubgroupAnyKHR = 4429, SpvOpSubgroupAllEqualKHR = 4430, SpvOpGroupNonUniformRotateKHR = 4431, SpvOpSubgroupReadInvocationKHR = 4432, SpvOpExtInstWithForwardRefsKHR = 4433, + SpvOpUntypedGroupAsyncCopyKHR = 4434, SpvOpTraceRayKHR = 4445, SpvOpExecuteCallableKHR = 4446, SpvOpConvertUToAccelerationStructureKHR = 4447, @@ -2012,10 +2020,14 @@ typedef enum SpvOp_ { SpvOpImageBoxFilterQCOM = 4481, SpvOpImageBlockMatchSSDQCOM = 4482, SpvOpImageBlockMatchSADQCOM = 4483, + SpvOpBitCastArrayQCOM = 4497, SpvOpImageBlockMatchWindowSSDQCOM = 4500, SpvOpImageBlockMatchWindowSADQCOM = 4501, SpvOpImageBlockMatchGatherSSDQCOM = 4502, SpvOpImageBlockMatchGatherSADQCOM = 4503, + SpvOpCompositeConstructCoopMatQCOM = 4540, + SpvOpCompositeExtractCoopMatQCOM = 4541, + SpvOpExtractSubArrayQCOM = 4542, SpvOpGroupIAddNonUniformAMD = 5000, SpvOpGroupFAddNonUniformAMD = 5001, SpvOpGroupFMinNonUniformAMD = 5002, @@ -2097,6 +2109,7 @@ typedef enum SpvOp_ { SpvOpTypeAccelerationStructureNV = 5341, SpvOpExecuteCallableNV = 5344, SpvOpRayQueryGetClusterIdNV = 5345, + SpvOpRayQueryGetIntersectionClusterIdNV = 5345, SpvOpHitObjectGetClusterIdNV = 5346, SpvOpTypeCooperativeMatrixNV = 5358, SpvOpCooperativeMatrixLoadNV = 5359, @@ -2406,6 +2419,14 @@ typedef enum SpvOp_ { SpvOpSubgroup2DBlockStoreINTEL = 6235, SpvOpSubgroupMatrixMultiplyAccumulateINTEL = 6237, SpvOpBitwiseFunctionINTEL = 6242, + SpvOpUntypedVariableLengthArrayINTEL = 6244, + SpvOpConditionalExtensionINTEL = 6248, + SpvOpConditionalEntryPointINTEL = 6249, + SpvOpConditionalCapabilityINTEL = 6250, + SpvOpSpecConstantTargetINTEL = 6251, + SpvOpSpecConstantArchitectureINTEL = 6252, + SpvOpSpecConstantCapabilitiesINTEL = 6253, + SpvOpConditionalCopyObjectINTEL = 6254, SpvOpGroupIMulKHR = 6401, SpvOpGroupFMulKHR = 6402, SpvOpGroupBitwiseAndKHR = 6403, @@ -2800,12 +2821,14 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpUntypedInBoundsPtrAccessChainKHR: *hasResult = true; *hasResultType = true; break; case SpvOpUntypedArrayLengthKHR: *hasResult = true; *hasResultType = true; break; case SpvOpUntypedPrefetchKHR: *hasResult = false; *hasResultType = false; break; + case SpvOpFmaKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; case SpvOpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; case SpvOpExtInstWithForwardRefsKHR: *hasResult = true; *hasResultType = true; break; + case SpvOpUntypedGroupAsyncCopyKHR: *hasResult = true; *hasResultType = true; break; case SpvOpTraceRayKHR: *hasResult = false; *hasResultType = false; break; case SpvOpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; case SpvOpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break; @@ -2836,10 +2859,14 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break; case SpvOpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break; case SpvOpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break; + case SpvOpBitCastArrayQCOM: *hasResult = true; *hasResultType = true; break; case SpvOpImageBlockMatchWindowSSDQCOM: *hasResult = true; *hasResultType = true; break; case SpvOpImageBlockMatchWindowSADQCOM: *hasResult = true; *hasResultType = true; break; case SpvOpImageBlockMatchGatherSSDQCOM: *hasResult = true; *hasResultType = true; break; case SpvOpImageBlockMatchGatherSADQCOM: *hasResult = true; *hasResultType = true; break; + case SpvOpCompositeConstructCoopMatQCOM: *hasResult = true; *hasResultType = true; break; + case SpvOpCompositeExtractCoopMatQCOM: *hasResult = true; *hasResultType = true; break; + case SpvOpExtractSubArrayQCOM: *hasResult = true; *hasResultType = true; break; case SpvOpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case SpvOpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case SpvOpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; @@ -2918,7 +2945,7 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; case SpvOpTypeAccelerationStructureKHR: *hasResult = true; *hasResultType = false; break; case SpvOpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; - case SpvOpRayQueryGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case SpvOpRayQueryGetIntersectionClusterIdNV: *hasResult = true; *hasResultType = true; break; case SpvOpHitObjectGetClusterIdNV: *hasResult = true; *hasResultType = true; break; case SpvOpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; case SpvOpCooperativeMatrixLoadNV: *hasResult = true; *hasResultType = true; break; @@ -3225,6 +3252,14 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpSubgroup2DBlockStoreINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpSubgroupMatrixMultiplyAccumulateINTEL: *hasResult = true; *hasResultType = true; break; case SpvOpBitwiseFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpUntypedVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpConditionalExtensionINTEL: *hasResult = false; *hasResultType = false; break; + case SpvOpConditionalEntryPointINTEL: *hasResult = false; *hasResultType = false; break; + case SpvOpConditionalCapabilityINTEL: *hasResult = false; *hasResultType = false; break; + case SpvOpSpecConstantTargetINTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpSpecConstantArchitectureINTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpSpecConstantCapabilitiesINTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpConditionalCopyObjectINTEL: *hasResult = true; *hasResultType = true; break; case SpvOpGroupIMulKHR: *hasResult = true; *hasResultType = true; break; case SpvOpGroupFMulKHR: *hasResult = true; *hasResultType = true; break; case SpvOpGroupBitwiseAndKHR: *hasResult = true; *hasResultType = true; break; @@ -3765,6 +3800,7 @@ inline const char* SpvDecorationToString(SpvDecoration value) { case SpvDecorationHostAccessINTEL: return "HostAccessINTEL"; case SpvDecorationInitModeINTEL: return "InitModeINTEL"; case SpvDecorationImplementInRegisterMapINTEL: return "ImplementInRegisterMapINTEL"; + case SpvDecorationConditionalINTEL: return "ConditionalINTEL"; case SpvDecorationCacheControlLoadINTEL: return "CacheControlLoadINTEL"; case SpvDecorationCacheControlStoreINTEL: return "CacheControlStoreINTEL"; default: return "Unknown"; @@ -4055,6 +4091,7 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilityTextureBoxFilterQCOM: return "TextureBoxFilterQCOM"; case SpvCapabilityTextureBlockMatchQCOM: return "TextureBlockMatchQCOM"; case SpvCapabilityTileShadingQCOM: return "TileShadingQCOM"; + case SpvCapabilityCooperativeMatrixConversionQCOM: return "CooperativeMatrixConversionQCOM"; case SpvCapabilityTextureBlockMatch2QCOM: return "TextureBlockMatch2QCOM"; case SpvCapabilityFloat16ImageAMD: return "Float16ImageAMD"; case SpvCapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD"; @@ -4181,6 +4218,7 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilityBitInstructions: return "BitInstructions"; case SpvCapabilityGroupNonUniformRotateKHR: return "GroupNonUniformRotateKHR"; case SpvCapabilityFloatControls2: return "FloatControls2"; + case SpvCapabilityFMAKHR: return "FMAKHR"; case SpvCapabilityAtomicFloat32AddEXT: return "AtomicFloat32AddEXT"; case SpvCapabilityAtomicFloat64AddEXT: return "AtomicFloat64AddEXT"; case SpvCapabilityLongCompositesINTEL: return "LongCompositesINTEL"; @@ -4204,6 +4242,9 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilitySubgroup2DBlockTransposeINTEL: return "Subgroup2DBlockTransposeINTEL"; case SpvCapabilitySubgroupMatrixMultiplyAccumulateINTEL: return "SubgroupMatrixMultiplyAccumulateINTEL"; case SpvCapabilityTernaryBitwiseFunctionINTEL: return "TernaryBitwiseFunctionINTEL"; + case SpvCapabilityUntypedVariableLengthArrayINTEL: return "UntypedVariableLengthArrayINTEL"; + case SpvCapabilitySpecConditionalINTEL: return "SpecConditionalINTEL"; + case SpvCapabilityFunctionVariantsINTEL: return "FunctionVariantsINTEL"; case SpvCapabilityGroupUniformArithmeticKHR: return "GroupUniformArithmeticKHR"; case SpvCapabilityTensorFloat32RoundingINTEL: return "TensorFloat32RoundingINTEL"; case SpvCapabilityMaskedGatherScatterINTEL: return "MaskedGatherScatterINTEL"; @@ -4773,12 +4814,14 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpUntypedInBoundsPtrAccessChainKHR: return "OpUntypedInBoundsPtrAccessChainKHR"; case SpvOpUntypedArrayLengthKHR: return "OpUntypedArrayLengthKHR"; case SpvOpUntypedPrefetchKHR: return "OpUntypedPrefetchKHR"; + case SpvOpFmaKHR: return "OpFmaKHR"; case SpvOpSubgroupAllKHR: return "OpSubgroupAllKHR"; case SpvOpSubgroupAnyKHR: return "OpSubgroupAnyKHR"; case SpvOpSubgroupAllEqualKHR: return "OpSubgroupAllEqualKHR"; case SpvOpGroupNonUniformRotateKHR: return "OpGroupNonUniformRotateKHR"; case SpvOpSubgroupReadInvocationKHR: return "OpSubgroupReadInvocationKHR"; case SpvOpExtInstWithForwardRefsKHR: return "OpExtInstWithForwardRefsKHR"; + case SpvOpUntypedGroupAsyncCopyKHR: return "OpUntypedGroupAsyncCopyKHR"; case SpvOpTraceRayKHR: return "OpTraceRayKHR"; case SpvOpExecuteCallableKHR: return "OpExecuteCallableKHR"; case SpvOpConvertUToAccelerationStructureKHR: return "OpConvertUToAccelerationStructureKHR"; @@ -4809,10 +4852,14 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpImageBoxFilterQCOM: return "OpImageBoxFilterQCOM"; case SpvOpImageBlockMatchSSDQCOM: return "OpImageBlockMatchSSDQCOM"; case SpvOpImageBlockMatchSADQCOM: return "OpImageBlockMatchSADQCOM"; + case SpvOpBitCastArrayQCOM: return "OpBitCastArrayQCOM"; case SpvOpImageBlockMatchWindowSSDQCOM: return "OpImageBlockMatchWindowSSDQCOM"; case SpvOpImageBlockMatchWindowSADQCOM: return "OpImageBlockMatchWindowSADQCOM"; case SpvOpImageBlockMatchGatherSSDQCOM: return "OpImageBlockMatchGatherSSDQCOM"; case SpvOpImageBlockMatchGatherSADQCOM: return "OpImageBlockMatchGatherSADQCOM"; + case SpvOpCompositeConstructCoopMatQCOM: return "OpCompositeConstructCoopMatQCOM"; + case SpvOpCompositeExtractCoopMatQCOM: return "OpCompositeExtractCoopMatQCOM"; + case SpvOpExtractSubArrayQCOM: return "OpExtractSubArrayQCOM"; case SpvOpGroupIAddNonUniformAMD: return "OpGroupIAddNonUniformAMD"; case SpvOpGroupFAddNonUniformAMD: return "OpGroupFAddNonUniformAMD"; case SpvOpGroupFMinNonUniformAMD: return "OpGroupFMinNonUniformAMD"; @@ -5198,6 +5245,14 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpSubgroup2DBlockStoreINTEL: return "OpSubgroup2DBlockStoreINTEL"; case SpvOpSubgroupMatrixMultiplyAccumulateINTEL: return "OpSubgroupMatrixMultiplyAccumulateINTEL"; case SpvOpBitwiseFunctionINTEL: return "OpBitwiseFunctionINTEL"; + case SpvOpUntypedVariableLengthArrayINTEL: return "OpUntypedVariableLengthArrayINTEL"; + case SpvOpConditionalExtensionINTEL: return "OpConditionalExtensionINTEL"; + case SpvOpConditionalEntryPointINTEL: return "OpConditionalEntryPointINTEL"; + case SpvOpConditionalCapabilityINTEL: return "OpConditionalCapabilityINTEL"; + case SpvOpSpecConstantTargetINTEL: return "OpSpecConstantTargetINTEL"; + case SpvOpSpecConstantArchitectureINTEL: return "OpSpecConstantArchitectureINTEL"; + case SpvOpSpecConstantCapabilitiesINTEL: return "OpSpecConstantCapabilitiesINTEL"; + case SpvOpConditionalCopyObjectINTEL: return "OpConditionalCopyObjectINTEL"; case SpvOpGroupIMulKHR: return "OpGroupIMulKHR"; case SpvOpGroupFMulKHR: return "OpGroupFMulKHR"; case SpvOpGroupBitwiseAndKHR: return "OpGroupBitwiseAndKHR"; diff --git a/third_party/spirv-cross/spirv.hpp b/third_party/spirv-cross/spirv.hpp index f7a7bf835e..086fcc48c9 100644 --- a/third_party/spirv-cross/spirv.hpp +++ b/third_party/spirv-cross/spirv.hpp @@ -638,6 +638,7 @@ enum Decoration { DecorationHostAccessINTEL = 6188, DecorationInitModeINTEL = 6190, DecorationImplementInRegisterMapINTEL = 6191, + DecorationConditionalINTEL = 6247, DecorationCacheControlLoadINTEL = 6442, DecorationCacheControlStoreINTEL = 6443, DecorationMax = 0x7fffffff, @@ -1103,6 +1104,7 @@ enum Capability { CapabilityTextureBoxFilterQCOM = 4485, CapabilityTextureBlockMatchQCOM = 4486, CapabilityTileShadingQCOM = 4495, + CapabilityCooperativeMatrixConversionQCOM = 4496, CapabilityTextureBlockMatch2QCOM = 4498, CapabilityFloat16ImageAMD = 5008, CapabilityImageGatherBiasLodAMD = 5009, @@ -1254,6 +1256,7 @@ enum Capability { CapabilityBitInstructions = 6025, CapabilityGroupNonUniformRotateKHR = 6026, CapabilityFloatControls2 = 6029, + CapabilityFMAKHR = 6030, CapabilityAtomicFloat32AddEXT = 6033, CapabilityAtomicFloat64AddEXT = 6034, CapabilityLongCompositesINTEL = 6089, @@ -1278,6 +1281,9 @@ enum Capability { CapabilitySubgroup2DBlockTransposeINTEL = 6230, CapabilitySubgroupMatrixMultiplyAccumulateINTEL = 6236, CapabilityTernaryBitwiseFunctionINTEL = 6241, + CapabilityUntypedVariableLengthArrayINTEL = 6243, + CapabilitySpecConditionalINTEL = 6245, + CapabilityFunctionVariantsINTEL = 6246, CapabilityGroupUniformArithmeticKHR = 6400, CapabilityTensorFloat32RoundingINTEL = 6425, CapabilityMaskedGatherScatterINTEL = 6427, @@ -1966,12 +1972,14 @@ enum Op { OpUntypedInBoundsPtrAccessChainKHR = 4424, OpUntypedArrayLengthKHR = 4425, OpUntypedPrefetchKHR = 4426, + OpFmaKHR = 4427, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, OpGroupNonUniformRotateKHR = 4431, OpSubgroupReadInvocationKHR = 4432, OpExtInstWithForwardRefsKHR = 4433, + OpUntypedGroupAsyncCopyKHR = 4434, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, OpConvertUToAccelerationStructureKHR = 4447, @@ -2008,10 +2016,14 @@ enum Op { OpImageBoxFilterQCOM = 4481, OpImageBlockMatchSSDQCOM = 4482, OpImageBlockMatchSADQCOM = 4483, + OpBitCastArrayQCOM = 4497, OpImageBlockMatchWindowSSDQCOM = 4500, OpImageBlockMatchWindowSADQCOM = 4501, OpImageBlockMatchGatherSSDQCOM = 4502, OpImageBlockMatchGatherSADQCOM = 4503, + OpCompositeConstructCoopMatQCOM = 4540, + OpCompositeExtractCoopMatQCOM = 4541, + OpExtractSubArrayQCOM = 4542, OpGroupIAddNonUniformAMD = 5000, OpGroupFAddNonUniformAMD = 5001, OpGroupFMinNonUniformAMD = 5002, @@ -2093,6 +2105,7 @@ enum Op { OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, OpRayQueryGetClusterIdNV = 5345, + OpRayQueryGetIntersectionClusterIdNV = 5345, OpHitObjectGetClusterIdNV = 5346, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, @@ -2402,6 +2415,14 @@ enum Op { OpSubgroup2DBlockStoreINTEL = 6235, OpSubgroupMatrixMultiplyAccumulateINTEL = 6237, OpBitwiseFunctionINTEL = 6242, + OpUntypedVariableLengthArrayINTEL = 6244, + OpConditionalExtensionINTEL = 6248, + OpConditionalEntryPointINTEL = 6249, + OpConditionalCapabilityINTEL = 6250, + OpSpecConstantTargetINTEL = 6251, + OpSpecConstantArchitectureINTEL = 6252, + OpSpecConstantCapabilitiesINTEL = 6253, + OpConditionalCopyObjectINTEL = 6254, OpGroupIMulKHR = 6401, OpGroupFMulKHR = 6402, OpGroupBitwiseAndKHR = 6403, @@ -2796,12 +2817,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpUntypedInBoundsPtrAccessChainKHR: *hasResult = true; *hasResultType = true; break; case OpUntypedArrayLengthKHR: *hasResult = true; *hasResultType = true; break; case OpUntypedPrefetchKHR: *hasResult = false; *hasResultType = false; break; + case OpFmaKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; case OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; case OpExtInstWithForwardRefsKHR: *hasResult = true; *hasResultType = true; break; + case OpUntypedGroupAsyncCopyKHR: *hasResult = true; *hasResultType = true; break; case OpTraceRayKHR: *hasResult = false; *hasResultType = false; break; case OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; case OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break; @@ -2832,10 +2855,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break; case OpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break; case OpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break; + case OpBitCastArrayQCOM: *hasResult = true; *hasResultType = true; break; case OpImageBlockMatchWindowSSDQCOM: *hasResult = true; *hasResultType = true; break; case OpImageBlockMatchWindowSADQCOM: *hasResult = true; *hasResultType = true; break; case OpImageBlockMatchGatherSSDQCOM: *hasResult = true; *hasResultType = true; break; case OpImageBlockMatchGatherSADQCOM: *hasResult = true; *hasResultType = true; break; + case OpCompositeConstructCoopMatQCOM: *hasResult = true; *hasResultType = true; break; + case OpCompositeExtractCoopMatQCOM: *hasResult = true; *hasResultType = true; break; + case OpExtractSubArrayQCOM: *hasResult = true; *hasResultType = true; break; case OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; @@ -2914,7 +2941,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; case OpTypeAccelerationStructureKHR: *hasResult = true; *hasResultType = false; break; case OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; - case OpRayQueryGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionClusterIdNV: *hasResult = true; *hasResultType = true; break; case OpHitObjectGetClusterIdNV: *hasResult = true; *hasResultType = true; break; case OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; case OpCooperativeMatrixLoadNV: *hasResult = true; *hasResultType = true; break; @@ -3221,6 +3248,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpSubgroup2DBlockStoreINTEL: *hasResult = false; *hasResultType = false; break; case OpSubgroupMatrixMultiplyAccumulateINTEL: *hasResult = true; *hasResultType = true; break; case OpBitwiseFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case OpUntypedVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; + case OpConditionalExtensionINTEL: *hasResult = false; *hasResultType = false; break; + case OpConditionalEntryPointINTEL: *hasResult = false; *hasResultType = false; break; + case OpConditionalCapabilityINTEL: *hasResult = false; *hasResultType = false; break; + case OpSpecConstantTargetINTEL: *hasResult = true; *hasResultType = true; break; + case OpSpecConstantArchitectureINTEL: *hasResult = true; *hasResultType = true; break; + case OpSpecConstantCapabilitiesINTEL: *hasResult = true; *hasResultType = true; break; + case OpConditionalCopyObjectINTEL: *hasResult = true; *hasResultType = true; break; case OpGroupIMulKHR: *hasResult = true; *hasResultType = true; break; case OpGroupFMulKHR: *hasResult = true; *hasResultType = true; break; case OpGroupBitwiseAndKHR: *hasResult = true; *hasResultType = true; break; @@ -3761,6 +3796,7 @@ inline const char* DecorationToString(Decoration value) { case DecorationHostAccessINTEL: return "HostAccessINTEL"; case DecorationInitModeINTEL: return "InitModeINTEL"; case DecorationImplementInRegisterMapINTEL: return "ImplementInRegisterMapINTEL"; + case DecorationConditionalINTEL: return "ConditionalINTEL"; case DecorationCacheControlLoadINTEL: return "CacheControlLoadINTEL"; case DecorationCacheControlStoreINTEL: return "CacheControlStoreINTEL"; default: return "Unknown"; @@ -4051,6 +4087,7 @@ inline const char* CapabilityToString(Capability value) { case CapabilityTextureBoxFilterQCOM: return "TextureBoxFilterQCOM"; case CapabilityTextureBlockMatchQCOM: return "TextureBlockMatchQCOM"; case CapabilityTileShadingQCOM: return "TileShadingQCOM"; + case CapabilityCooperativeMatrixConversionQCOM: return "CooperativeMatrixConversionQCOM"; case CapabilityTextureBlockMatch2QCOM: return "TextureBlockMatch2QCOM"; case CapabilityFloat16ImageAMD: return "Float16ImageAMD"; case CapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD"; @@ -4177,6 +4214,7 @@ inline const char* CapabilityToString(Capability value) { case CapabilityBitInstructions: return "BitInstructions"; case CapabilityGroupNonUniformRotateKHR: return "GroupNonUniformRotateKHR"; case CapabilityFloatControls2: return "FloatControls2"; + case CapabilityFMAKHR: return "FMAKHR"; case CapabilityAtomicFloat32AddEXT: return "AtomicFloat32AddEXT"; case CapabilityAtomicFloat64AddEXT: return "AtomicFloat64AddEXT"; case CapabilityLongCompositesINTEL: return "LongCompositesINTEL"; @@ -4200,6 +4238,9 @@ inline const char* CapabilityToString(Capability value) { case CapabilitySubgroup2DBlockTransposeINTEL: return "Subgroup2DBlockTransposeINTEL"; case CapabilitySubgroupMatrixMultiplyAccumulateINTEL: return "SubgroupMatrixMultiplyAccumulateINTEL"; case CapabilityTernaryBitwiseFunctionINTEL: return "TernaryBitwiseFunctionINTEL"; + case CapabilityUntypedVariableLengthArrayINTEL: return "UntypedVariableLengthArrayINTEL"; + case CapabilitySpecConditionalINTEL: return "SpecConditionalINTEL"; + case CapabilityFunctionVariantsINTEL: return "FunctionVariantsINTEL"; case CapabilityGroupUniformArithmeticKHR: return "GroupUniformArithmeticKHR"; case CapabilityTensorFloat32RoundingINTEL: return "TensorFloat32RoundingINTEL"; case CapabilityMaskedGatherScatterINTEL: return "MaskedGatherScatterINTEL"; @@ -4769,12 +4810,14 @@ inline const char* OpToString(Op value) { case OpUntypedInBoundsPtrAccessChainKHR: return "OpUntypedInBoundsPtrAccessChainKHR"; case OpUntypedArrayLengthKHR: return "OpUntypedArrayLengthKHR"; case OpUntypedPrefetchKHR: return "OpUntypedPrefetchKHR"; + case OpFmaKHR: return "OpFmaKHR"; case OpSubgroupAllKHR: return "OpSubgroupAllKHR"; case OpSubgroupAnyKHR: return "OpSubgroupAnyKHR"; case OpSubgroupAllEqualKHR: return "OpSubgroupAllEqualKHR"; case OpGroupNonUniformRotateKHR: return "OpGroupNonUniformRotateKHR"; case OpSubgroupReadInvocationKHR: return "OpSubgroupReadInvocationKHR"; case OpExtInstWithForwardRefsKHR: return "OpExtInstWithForwardRefsKHR"; + case OpUntypedGroupAsyncCopyKHR: return "OpUntypedGroupAsyncCopyKHR"; case OpTraceRayKHR: return "OpTraceRayKHR"; case OpExecuteCallableKHR: return "OpExecuteCallableKHR"; case OpConvertUToAccelerationStructureKHR: return "OpConvertUToAccelerationStructureKHR"; @@ -4805,10 +4848,14 @@ inline const char* OpToString(Op value) { case OpImageBoxFilterQCOM: return "OpImageBoxFilterQCOM"; case OpImageBlockMatchSSDQCOM: return "OpImageBlockMatchSSDQCOM"; case OpImageBlockMatchSADQCOM: return "OpImageBlockMatchSADQCOM"; + case OpBitCastArrayQCOM: return "OpBitCastArrayQCOM"; case OpImageBlockMatchWindowSSDQCOM: return "OpImageBlockMatchWindowSSDQCOM"; case OpImageBlockMatchWindowSADQCOM: return "OpImageBlockMatchWindowSADQCOM"; case OpImageBlockMatchGatherSSDQCOM: return "OpImageBlockMatchGatherSSDQCOM"; case OpImageBlockMatchGatherSADQCOM: return "OpImageBlockMatchGatherSADQCOM"; + case OpCompositeConstructCoopMatQCOM: return "OpCompositeConstructCoopMatQCOM"; + case OpCompositeExtractCoopMatQCOM: return "OpCompositeExtractCoopMatQCOM"; + case OpExtractSubArrayQCOM: return "OpExtractSubArrayQCOM"; case OpGroupIAddNonUniformAMD: return "OpGroupIAddNonUniformAMD"; case OpGroupFAddNonUniformAMD: return "OpGroupFAddNonUniformAMD"; case OpGroupFMinNonUniformAMD: return "OpGroupFMinNonUniformAMD"; @@ -5194,6 +5241,14 @@ inline const char* OpToString(Op value) { case OpSubgroup2DBlockStoreINTEL: return "OpSubgroup2DBlockStoreINTEL"; case OpSubgroupMatrixMultiplyAccumulateINTEL: return "OpSubgroupMatrixMultiplyAccumulateINTEL"; case OpBitwiseFunctionINTEL: return "OpBitwiseFunctionINTEL"; + case OpUntypedVariableLengthArrayINTEL: return "OpUntypedVariableLengthArrayINTEL"; + case OpConditionalExtensionINTEL: return "OpConditionalExtensionINTEL"; + case OpConditionalEntryPointINTEL: return "OpConditionalEntryPointINTEL"; + case OpConditionalCapabilityINTEL: return "OpConditionalCapabilityINTEL"; + case OpSpecConstantTargetINTEL: return "OpSpecConstantTargetINTEL"; + case OpSpecConstantArchitectureINTEL: return "OpSpecConstantArchitectureINTEL"; + case OpSpecConstantCapabilitiesINTEL: return "OpSpecConstantCapabilitiesINTEL"; + case OpConditionalCopyObjectINTEL: return "OpConditionalCopyObjectINTEL"; case OpGroupIMulKHR: return "OpGroupIMulKHR"; case OpGroupFMulKHR: return "OpGroupFMulKHR"; case OpGroupBitwiseAndKHR: return "OpGroupBitwiseAndKHR"; diff --git a/third_party/spirv-cross/spirv_cfg.cpp b/third_party/spirv-cross/spirv_cfg.cpp index 9329947981..c68886d989 100644 --- a/third_party/spirv-cross/spirv_cfg.cpp +++ b/third_party/spirv-cross/spirv_cfg.cpp @@ -81,31 +81,105 @@ bool CFG::is_back_edge(uint32_t to) const // We have a back edge if the visit order is set with the temporary magic value 0. // Crossing edges will have already been recorded with a visit order. auto itr = visit_order.find(to); - return itr != end(visit_order) && itr->second.get() == 0; + return itr != end(visit_order) && itr->second.visited_branches && !itr->second.visited_resolve; } -bool CFG::has_visited_forward_edge(uint32_t to) const +bool CFG::has_visited_branch(uint32_t to) const { - // If > 0, we have visited the edge already, and this is not a back edge branch. auto itr = visit_order.find(to); - return itr != end(visit_order) && itr->second.get() > 0; + return itr != end(visit_order) && itr->second.visited_branches; } -bool CFG::post_order_visit(uint32_t block_id) +void CFG::post_order_visit_entry(uint32_t block) { - // If we have already branched to this block (back edge), stop recursion. - // If our branches are back-edges, we do not record them. - // We have to record crossing edges however. - if (has_visited_forward_edge(block_id)) - return true; - else if (is_back_edge(block_id)) - return false; + visit_stack.push_back(block); - // Block back-edges from recursively revisiting ourselves. - visit_order[block_id].get() = 0; + while (!visit_stack.empty()) + { + bool keep_iterating; + do + { + // Reverse the order to allow for stack-like behavior and preserves the visit order from recursive algorithm. + // Traverse depth first. + uint32_t to_visit = visit_stack.back(); + last_visited_size = visit_stack.size(); + post_order_visit_branches(to_visit); + keep_iterating = last_visited_size != visit_stack.size(); + if (keep_iterating) + std::reverse(visit_stack.begin() + last_visited_size, visit_stack.end()); + } while (keep_iterating); + // We've reached the end of some tree leaf. Resolve the stack. + // Any node which has been visited for real can be popped now. + while (!visit_stack.empty() && visit_order[visit_stack.back()].visited_branches) + { + post_order_visit_resolve(visit_stack.back()); + visit_stack.pop_back(); + } + } +} + +void CFG::visit_branch(uint32_t block_id) +{ + // Prune obvious duplicates. + if (std::find(visit_stack.begin() + last_visited_size, visit_stack.end(), block_id) == visit_stack.end() && + !has_visited_branch(block_id)) + { + visit_stack.push_back(block_id); + } +} + +void CFG::post_order_visit_branches(uint32_t block_id) +{ auto &block = compiler.get(block_id); + auto &visit = visit_order[block_id]; + if (visit.visited_branches) + return; + visit.visited_branches = true; + + if (block.merge == SPIRBlock::MergeLoop) + visit_branch(block.merge_block); + else if (block.merge == SPIRBlock::MergeSelection) + visit_branch(block.next_block); + + // First visit our branch targets. + switch (block.terminator) + { + case SPIRBlock::Direct: + visit_branch(block.next_block); + break; + + case SPIRBlock::Select: + visit_branch(block.true_block); + visit_branch(block.false_block); + break; + + case SPIRBlock::MultiSelect: + { + const auto &cases = compiler.get_case_list(block); + for (const auto &target : cases) + visit_branch(target.block); + if (block.default_block) + visit_branch(block.default_block); + break; + } + + default: + break; + } +} + +void CFG::post_order_visit_resolve(uint32_t block_id) +{ + auto &block = compiler.get(block_id); + + auto &visit_block = visit_order[block_id]; + assert(visit_block.visited_branches); + auto &visited = visit_order[block_id].visited_resolve; + if (visited) + return; + // If this is a loop header, add an implied branch to the merge target. // This is needed to avoid annoying cases with do { ... } while(false) loops often generated by inliners. // To the CFG, this is linear control flow, but we risk picking the do/while scope as our dominating block. @@ -116,21 +190,21 @@ bool CFG::post_order_visit(uint32_t block_id) // is lower than inside the loop, which is going to be key for some traversal algorithms like post-dominance analysis. // For selection constructs true/false blocks will end up visiting the merge block directly and it works out fine, // but for loops, only the header might end up actually branching to merge block. - if (block.merge == SPIRBlock::MergeLoop && post_order_visit(block.merge_block)) + if (block.merge == SPIRBlock::MergeLoop && !is_back_edge(block.merge_block)) add_branch(block_id, block.merge_block); // First visit our branch targets. switch (block.terminator) { case SPIRBlock::Direct: - if (post_order_visit(block.next_block)) + if (!is_back_edge(block.next_block)) add_branch(block_id, block.next_block); break; case SPIRBlock::Select: - if (post_order_visit(block.true_block)) + if (!is_back_edge(block.true_block)) add_branch(block_id, block.true_block); - if (post_order_visit(block.false_block)) + if (!is_back_edge(block.false_block)) add_branch(block_id, block.false_block); break; @@ -139,10 +213,10 @@ bool CFG::post_order_visit(uint32_t block_id) const auto &cases = compiler.get_case_list(block); for (const auto &target : cases) { - if (post_order_visit(target.block)) + if (!is_back_edge(target.block)) add_branch(block_id, target.block); } - if (block.default_block && post_order_visit(block.default_block)) + if (block.default_block && !is_back_edge(block.default_block)) add_branch(block_id, block.default_block); break; } @@ -157,7 +231,7 @@ bool CFG::post_order_visit(uint32_t block_id) // We can use the variable without a Phi since there is only one possible parent here. // However, in this case, we need to hoist out the inner variable to outside the branch. // Use same strategy as loops. - if (block.merge == SPIRBlock::MergeSelection && post_order_visit(block.next_block)) + if (block.merge == SPIRBlock::MergeSelection && !is_back_edge(block.next_block)) { // If there is only one preceding edge to the merge block and it's not ourselves, we need a fixup. // Add a fake branch so any dominator in either the if (), or else () block, or a lone case statement @@ -201,10 +275,9 @@ bool CFG::post_order_visit(uint32_t block_id) } } - // Then visit ourselves. Start counting at one, to let 0 be a magic value for testing back vs. crossing edges. - visit_order[block_id].get() = ++visit_count; + visited = true; + visit_block.order = ++visit_count; post_order.push_back(block_id); - return true; } void CFG::build_post_order_visit_order() @@ -213,11 +286,12 @@ void CFG::build_post_order_visit_order() visit_count = 0; visit_order.clear(); post_order.clear(); - post_order_visit(block); + post_order_visit_entry(block); } void CFG::add_branch(uint32_t from, uint32_t to) { + assert(from && to); const auto add_unique = [](SmallVector &l, uint32_t value) { auto itr = find(begin(l), end(l), value); if (itr == end(l)) diff --git a/third_party/spirv-cross/spirv_cfg.hpp b/third_party/spirv-cross/spirv_cfg.hpp index 1d85fe0a97..1c21ea070b 100644 --- a/third_party/spirv-cross/spirv_cfg.hpp +++ b/third_party/spirv-cross/spirv_cfg.hpp @@ -68,7 +68,7 @@ public: { auto itr = visit_order.find(block); assert(itr != std::end(visit_order)); - int v = itr->second.get(); + int v = itr->second.order; assert(v > 0); return uint32_t(v); } @@ -114,17 +114,9 @@ public: private: struct VisitOrder { - int &get() - { - return v; - } - - const int &get() const - { - return v; - } - - int v = -1; + int order = -1; + bool visited_resolve = false; + bool visited_branches = false; }; Compiler &compiler; @@ -139,11 +131,17 @@ private: void add_branch(uint32_t from, uint32_t to); void build_post_order_visit_order(); void build_immediate_dominators(); - bool post_order_visit(uint32_t block); + void post_order_visit_branches(uint32_t block); + void post_order_visit_resolve(uint32_t block); + void post_order_visit_entry(uint32_t block); uint32_t visit_count = 0; bool is_back_edge(uint32_t to) const; - bool has_visited_forward_edge(uint32_t to) const; + bool has_visited_branch(uint32_t to) const; + void visit_branch(uint32_t block_id); + + SmallVector visit_stack; + size_t last_visited_size = 0; }; class DominatorBuilder diff --git a/third_party/spirv-cross/spirv_common.hpp b/third_party/spirv-cross/spirv_common.hpp index afb77b231e..43ad1a6f13 100644 --- a/third_party/spirv-cross/spirv_common.hpp +++ b/third_party/spirv-cross/spirv_common.hpp @@ -27,8 +27,17 @@ #ifndef SPV_ENABLE_UTILITY_CODE #define SPV_ENABLE_UTILITY_CODE #endif -#include "spirv.hpp" +// Pragmatic hack to avoid symbol conflicts when including both hpp11 and hpp headers in same translation unit. +// This is an unfortunate SPIRV-Headers issue that we cannot easily deal with ourselves. +#ifdef SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#define spv SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#define SPIRV_CROSS_SPV_HEADER_NAMESPACE SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#else +#define SPIRV_CROSS_SPV_HEADER_NAMESPACE spv +#endif + +#include "spirv.hpp" #include "spirv_cross_containers.hpp" #include "spirv_cross_error_handling.hpp" #include @@ -389,6 +398,7 @@ enum Types TypeAccessChain, TypeUndef, TypeString, + TypeDebugLocalVariable, TypeCount }; @@ -518,6 +528,18 @@ struct SPIRString : IVariant SPIRV_CROSS_DECLARE_CLONE(SPIRString) }; +struct SPIRDebugLocalVariable : IVariant +{ + enum + { + type = TypeDebugLocalVariable + }; + + uint32_t name_id; + + SPIRV_CROSS_DECLARE_CLONE(SPIRDebugLocalVariable) +}; + // This type is only used by backends which need to access the combined image and sampler IDs separately after // the OpSampledImage opcode. struct SPIRCombinedImageSampler : IVariant @@ -595,6 +617,7 @@ struct SPIRType : IVariant Sampler, AccelerationStructure, RayQuery, + CoopVecNV, // Keep internal types at the end. ControlPointArray, @@ -631,13 +654,29 @@ struct SPIRType : IVariant bool pointer = false; bool forward_pointer = false; - struct + union { - uint32_t use_id = 0; - uint32_t rows_id = 0; - uint32_t columns_id = 0; - uint32_t scope_id = 0; - } cooperative; + struct + { + uint32_t use_id; + uint32_t rows_id; + uint32_t columns_id; + uint32_t scope_id; + } cooperative; + + struct + { + uint32_t component_type_id; + uint32_t component_count_id; + } coopVecNV; + + struct + { + uint32_t type; + uint32_t rank; + uint32_t shape; + } tensor; + } ext; spv::StorageClass storage = spv::StorageClassGeneric; @@ -659,13 +698,6 @@ struct SPIRType : IVariant spv::AccessQualifier access; } image = {}; - struct TensorType - { - TypeID type; - TypeID rank; - TypeID shape; - } tensor; - // Structs can be declared multiple times if they are used as part of interface blocks. // We want to detect this so that we only emit the struct definition once. // Since we cannot rely on OpName to be equal, we need to figure out aliases. @@ -702,6 +734,12 @@ struct SPIRExtension : IVariant NonSemanticGeneric }; + enum ShaderDebugInfoOps + { + DebugLine = 103, + DebugSource = 35 + }; + explicit SPIRExtension(Extension ext_) : ext(ext_) { @@ -728,6 +766,10 @@ struct SPIREntryPoint std::string name; std::string orig_name; std::unordered_map fp_fast_math_defaults; + bool signed_zero_inf_nan_preserve_8 = false; + bool signed_zero_inf_nan_preserve_16 = false; + bool signed_zero_inf_nan_preserve_32 = false; + bool signed_zero_inf_nan_preserve_64 = false; SmallVector interface_variables; Bitset flags; @@ -960,6 +1002,7 @@ struct SPIRBlock : IVariant // All access to these variables are dominated by this block, // so before branching anywhere we need to make sure that we declare these variables. SmallVector dominated_variables; + SmallVector rearm_dominated_variables; // These are variables which should be declared in a for loop header, if we // fail to use a classic for-loop, @@ -1154,6 +1197,9 @@ struct SPIRVariable : IVariant // Temporaries which can remain forwarded as long as this variable is not modified. SmallVector dependees; + // ShaderDebugInfo local variables attached to this variable via DebugDeclare + SmallVector debug_local_variables; + bool deferred_declaration = false; bool phi_variable = false; @@ -1346,7 +1392,7 @@ struct SPIRConstant : IVariant inline float scalar_bf8(uint32_t col = 0, uint32_t row = 0) const { - return f16_to_f32(scalar_u8(col, row) << 8); + return f16_to_f32(uint16_t(scalar_u8(col, row) << 8)); } inline float scalar_f32(uint32_t col = 0, uint32_t row = 0) const @@ -1781,7 +1827,7 @@ struct Meta { std::string alias; std::string qualified_alias; - std::string hlsl_semantic; + std::string user_semantic; std::string user_type; Bitset decoration_flags; spv::BuiltIn builtin_type = spv::BuiltInMax; @@ -1855,7 +1901,8 @@ private: static inline bool type_is_floating_point(const SPIRType &type) { - return type.basetype == SPIRType::Half || type.basetype == SPIRType::Float || type.basetype == SPIRType::Double; + return type.basetype == SPIRType::Half || type.basetype == SPIRType::Float || type.basetype == SPIRType::Double || + type.basetype == SPIRType::BFloat16 || type.basetype == SPIRType::FloatE5M2 || type.basetype == SPIRType::FloatE4M3; } static inline bool type_is_integral(const SPIRType &type) @@ -2040,4 +2087,7 @@ struct hash> }; } // namespace std +#ifdef SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#undef spv +#endif #endif diff --git a/third_party/spirv-cross/spirv_common.hpp.orig b/third_party/spirv-cross/spirv_common.hpp.orig index 8715da4080..cd06f754ca 100644 --- a/third_party/spirv-cross/spirv_common.hpp.orig +++ b/third_party/spirv-cross/spirv_common.hpp.orig @@ -27,8 +27,17 @@ #ifndef SPV_ENABLE_UTILITY_CODE #define SPV_ENABLE_UTILITY_CODE #endif -#include "spirv.hpp" +// Pragmatic hack to avoid symbol conflicts when including both hpp11 and hpp headers in same translation unit. +// This is an unfortunate SPIRV-Headers issue that we cannot easily deal with ourselves. +#ifdef SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#define spv SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#define SPIRV_CROSS_SPV_HEADER_NAMESPACE SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#else +#define SPIRV_CROSS_SPV_HEADER_NAMESPACE spv +#endif + +#include "spirv.hpp" #include "spirv_cross_containers.hpp" #include "spirv_cross_error_handling.hpp" #include @@ -368,6 +377,7 @@ enum Types TypeAccessChain, TypeUndef, TypeString, + TypeDebugLocalVariable, TypeCount }; @@ -497,6 +507,18 @@ struct SPIRString : IVariant SPIRV_CROSS_DECLARE_CLONE(SPIRString) }; +struct SPIRDebugLocalVariable : IVariant +{ + enum + { + type = TypeDebugLocalVariable + }; + + uint32_t name_id; + + SPIRV_CROSS_DECLARE_CLONE(SPIRDebugLocalVariable) +}; + // This type is only used by backends which need to access the combined image and sampler IDs separately after // the OpSampledImage opcode. struct SPIRCombinedImageSampler : IVariant @@ -574,6 +596,7 @@ struct SPIRType : IVariant Sampler, AccelerationStructure, RayQuery, + CoopVecNV, // Keep internal types at the end. ControlPointArray, @@ -610,13 +633,29 @@ struct SPIRType : IVariant bool pointer = false; bool forward_pointer = false; - struct + union { - uint32_t use_id = 0; - uint32_t rows_id = 0; - uint32_t columns_id = 0; - uint32_t scope_id = 0; - } cooperative; + struct + { + uint32_t use_id; + uint32_t rows_id; + uint32_t columns_id; + uint32_t scope_id; + } cooperative; + + struct + { + uint32_t component_type_id; + uint32_t component_count_id; + } coopVecNV; + + struct + { + uint32_t type; + uint32_t rank; + uint32_t shape; + } tensor; + } ext; spv::StorageClass storage = spv::StorageClassGeneric; @@ -638,13 +677,6 @@ struct SPIRType : IVariant spv::AccessQualifier access; } image = {}; - struct TensorType - { - TypeID type; - TypeID rank; - TypeID shape; - } tensor; - // Structs can be declared multiple times if they are used as part of interface blocks. // We want to detect this so that we only emit the struct definition once. // Since we cannot rely on OpName to be equal, we need to figure out aliases. @@ -681,6 +713,12 @@ struct SPIRExtension : IVariant NonSemanticGeneric }; + enum ShaderDebugInfoOps + { + DebugLine = 103, + DebugSource = 35 + }; + explicit SPIRExtension(Extension ext_) : ext(ext_) { @@ -707,6 +745,10 @@ struct SPIREntryPoint std::string name; std::string orig_name; std::unordered_map fp_fast_math_defaults; + bool signed_zero_inf_nan_preserve_8 = false; + bool signed_zero_inf_nan_preserve_16 = false; + bool signed_zero_inf_nan_preserve_32 = false; + bool signed_zero_inf_nan_preserve_64 = false; SmallVector interface_variables; Bitset flags; @@ -939,6 +981,7 @@ struct SPIRBlock : IVariant // All access to these variables are dominated by this block, // so before branching anywhere we need to make sure that we declare these variables. SmallVector dominated_variables; + SmallVector rearm_dominated_variables; // These are variables which should be declared in a for loop header, if we // fail to use a classic for-loop, @@ -1133,6 +1176,9 @@ struct SPIRVariable : IVariant // Temporaries which can remain forwarded as long as this variable is not modified. SmallVector dependees; + // ShaderDebugInfo local variables attached to this variable via DebugDeclare + SmallVector debug_local_variables; + bool deferred_declaration = false; bool phi_variable = false; @@ -1325,7 +1371,7 @@ struct SPIRConstant : IVariant inline float scalar_bf8(uint32_t col = 0, uint32_t row = 0) const { - return f16_to_f32(scalar_u8(col, row) << 8); + return f16_to_f32(uint16_t(scalar_u8(col, row) << 8)); } inline float scalar_f32(uint32_t col = 0, uint32_t row = 0) const @@ -1760,7 +1806,7 @@ struct Meta { std::string alias; std::string qualified_alias; - std::string hlsl_semantic; + std::string user_semantic; std::string user_type; Bitset decoration_flags; spv::BuiltIn builtin_type = spv::BuiltInMax; @@ -1834,7 +1880,8 @@ private: static inline bool type_is_floating_point(const SPIRType &type) { - return type.basetype == SPIRType::Half || type.basetype == SPIRType::Float || type.basetype == SPIRType::Double; + return type.basetype == SPIRType::Half || type.basetype == SPIRType::Float || type.basetype == SPIRType::Double || + type.basetype == SPIRType::BFloat16 || type.basetype == SPIRType::FloatE5M2 || type.basetype == SPIRType::FloatE4M3; } static inline bool type_is_integral(const SPIRType &type) @@ -2019,4 +2066,7 @@ struct hash> }; } // namespace std +#ifdef SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#undef spv +#endif #endif diff --git a/third_party/spirv-cross/spirv_cpp.cpp b/third_party/spirv-cross/spirv_cpp.cpp index 61c30e9e55..4bb6fc261f 100644 --- a/third_party/spirv-cross/spirv_cpp.cpp +++ b/third_party/spirv-cross/spirv_cpp.cpp @@ -23,7 +23,7 @@ #include "spirv_cpp.hpp" -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; using namespace std; diff --git a/third_party/spirv-cross/spirv_cross.cpp b/third_party/spirv-cross/spirv_cross.cpp index c63443ab1b..1031d3ff65 100644 --- a/third_party/spirv-cross/spirv_cross.cpp +++ b/third_party/spirv-cross/spirv_cross.cpp @@ -31,7 +31,7 @@ #include using namespace std; -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; Compiler::Compiler(vector ir_) @@ -376,6 +376,7 @@ void Compiler::register_global_read_dependencies(const SPIRBlock &block, uint32_ case OpLoad: case OpCooperativeMatrixLoadKHR: + case OpCooperativeVectorLoadNV: case OpImageRead: { // If we're in a storage class which does not get invalidated, adding dependencies here is no big deal. @@ -627,7 +628,7 @@ bool Compiler::is_immutable(uint32_t id) const return false; } -static inline bool storage_class_is_interface(spv::StorageClass storage) +static inline bool storage_class_is_interface(StorageClass storage) { switch (storage) { @@ -660,8 +661,8 @@ bool Compiler::is_hidden_variable(const SPIRVariable &var, bool include_builtins // In SPIR-V 1.4 and up we must also use the active variable interface to disable global variables // which are not part of the entry point. - if (ir.get_spirv_version() >= 0x10400 && var.storage != spv::StorageClassGeneric && - var.storage != spv::StorageClassFunction && !interface_variable_exists_in_entry_point(var.self)) + if (ir.get_spirv_version() >= 0x10400 && var.storage != StorageClassGeneric && + var.storage != StorageClassFunction && !interface_variable_exists_in_entry_point(var.self)) { return true; } @@ -741,6 +742,14 @@ bool Compiler::is_physical_pointer(const SPIRType &type) const return type.op == OpTypePointer && type.storage == StorageClassPhysicalStorageBuffer; } +bool Compiler::is_physical_or_buffer_pointer(const SPIRType &type) const +{ + return type.op == OpTypePointer && + (type.storage == StorageClassPhysicalStorageBuffer || type.storage == StorageClassUniform || + type.storage == StorageClassStorageBuffer || type.storage == StorageClassWorkgroup || + type.storage == StorageClassPushConstant); +} + bool Compiler::is_physical_pointer_to_buffer_block(const SPIRType &type) const { return is_physical_pointer(type) && get_pointee_type(type).self == type.parent_type && @@ -1177,11 +1186,8 @@ bool Compiler::type_is_top_level_block(const SPIRType &type) const return has_decoration(type.self, DecorationBlock) || has_decoration(type.self, DecorationBufferBlock); } -bool Compiler::type_is_block_like(const SPIRType &type) const +bool Compiler::type_is_explicit_layout(const SPIRType &type) const { - if (type_is_top_level_block(type)) - return true; - if (type.basetype == SPIRType::Struct) { // Block-like types may have Offset decorations. @@ -1193,6 +1199,14 @@ bool Compiler::type_is_block_like(const SPIRType &type) const return false; } +bool Compiler::type_is_block_like(const SPIRType &type) const +{ + if (type_is_top_level_block(type)) + return true; + else + return type_is_explicit_layout(type); +} + void Compiler::parse_fixup() { // Figure out specialization constants for work group sizes. @@ -1335,7 +1349,7 @@ const SPIRType &Compiler::get_pointee_type(uint32_t type_id) const uint32_t Compiler::get_variable_data_type_id(const SPIRVariable &var) const { - if (var.phi_variable || var.storage == spv::StorageClass::StorageClassAtomicCounter) + if (var.phi_variable || var.storage == StorageClassAtomicCounter) return var.basetype; return get_pointee_type_id(var.basetype); } @@ -1372,7 +1386,7 @@ bool Compiler::is_sampled_image_type(const SPIRType &type) type.image.dim != DimBuffer; } -void Compiler::set_member_decoration_string(TypeID id, uint32_t index, spv::Decoration decoration, +void Compiler::set_member_decoration_string(TypeID id, uint32_t index, Decoration decoration, const std::string &argument) { ir.set_member_decoration_string(id, index, decoration, argument); @@ -1433,7 +1447,7 @@ void Compiler::unset_member_decoration(TypeID id, uint32_t index, Decoration dec ir.unset_member_decoration(id, index, decoration); } -void Compiler::set_decoration_string(ID id, spv::Decoration decoration, const std::string &argument) +void Compiler::set_decoration_string(ID id, Decoration decoration, const std::string &argument) { ir.set_decoration_string(id, decoration, argument); } @@ -1596,7 +1610,7 @@ void Compiler::unset_decoration(ID id, Decoration decoration) ir.unset_decoration(id, decoration); } -bool Compiler::get_binary_offset_for_decoration(VariableID id, spv::Decoration decoration, uint32_t &word_offset) const +bool Compiler::get_binary_offset_for_decoration(VariableID id, Decoration decoration, uint32_t &word_offset) const { auto *m = ir.find_meta(id); if (!m) @@ -1901,6 +1915,15 @@ bool Compiler::traverse_all_reachable_opcodes(const SPIRBlock &block, OpcodeHand handler.set_current_block(block); handler.rearm_current_block(block); + if (handler.enable_result_types) + { + for (auto &phi: block.phi_variables) + { + auto &v = get(phi.function_variable); + handler.result_types[phi.function_variable] = v.basetype; + } + } + // Ideally, perhaps traverse the CFG instead of all blocks in order to eliminate dead blocks, // but this shouldn't be a problem in practice unless the SPIR-V is doing insane things like recursing // inside dead blocks ... @@ -1912,11 +1935,24 @@ bool Compiler::traverse_all_reachable_opcodes(const SPIRBlock &block, OpcodeHand if (!handler.handle(op, ops, i.length)) return false; + if (handler.enable_result_types) + { + // If it has one, keep track of the instruction's result type, mapped by ID + uint32_t result_type, result_id; + if (instruction_to_result_type(result_type, result_id, op, ops, i.length)) + handler.result_types[result_id] = result_type; + } + if (op == OpFunctionCall) { auto &func = get(ops[2]); if (handler.follow_function_call(func)) { + if (handler.enable_result_types) + for (auto &arg : func.arguments) + if (!arg.alias_global_variable) + handler.result_types[arg.id] = arg.type; + if (!handler.begin_function_scope(ops, i.length)) return false; if (!traverse_all_reachable_opcodes(get(ops[2]), handler)) @@ -2451,7 +2487,7 @@ uint32_t Compiler::get_work_group_size_specialization_constants(SpecializationCo return execution.workgroup_size.constant; } -uint32_t Compiler::get_execution_mode_argument(spv::ExecutionMode mode, uint32_t index) const +uint32_t Compiler::get_execution_mode_argument(ExecutionMode mode, uint32_t index) const { auto &execution = get_entry_point(); switch (mode) @@ -2637,14 +2673,14 @@ SmallVector Compiler::get_entry_points_and_stages() const return entries; } -void Compiler::rename_entry_point(const std::string &old_name, const std::string &new_name, spv::ExecutionModel model) +void Compiler::rename_entry_point(const std::string &old_name, const std::string &new_name, ExecutionModel model) { auto &entry = get_entry_point(old_name, model); entry.orig_name = new_name; entry.name = new_name; } -void Compiler::set_entry_point(const std::string &name, spv::ExecutionModel model) +void Compiler::set_entry_point(const std::string &name, ExecutionModel model) { auto &entry = get_entry_point(name, model); ir.default_entry_point = entry.self; @@ -3340,7 +3376,7 @@ void Compiler::analyze_parameter_preservation( Compiler::AnalyzeVariableScopeAccessHandler::AnalyzeVariableScopeAccessHandler(Compiler &compiler_, SPIRFunction &entry_) - : compiler(compiler_) + : OpcodeHandler(compiler_) , entry(entry_) { } @@ -3458,11 +3494,11 @@ bool Compiler::AnalyzeVariableScopeAccessHandler::handle_terminator(const SPIRBl return true; } -bool Compiler::AnalyzeVariableScopeAccessHandler::handle(spv::Op op, const uint32_t *args, uint32_t length) +bool Compiler::AnalyzeVariableScopeAccessHandler::handle(Op op, const uint32_t *args, uint32_t length) { // Keep track of the types of temporaries, so we can hoist them out as necessary. uint32_t result_type = 0, result_id = 0; - if (compiler.instruction_to_result_type(result_type, result_id, op, args, length)) + if (instruction_to_result_type(result_type, result_id, op, args, length)) { // For some opcodes, we will need to override the result id. // If we need to hoist the temporary, the temporary type is the input, not the result. @@ -3575,7 +3611,7 @@ bool Compiler::AnalyzeVariableScopeAccessHandler::handle(spv::Op op, const uint3 case OpCopyObject: { - // OpCopyObject copies the underlying non-pointer type, + // OpCopyObject copies the underlying non-pointer type, // so any temp variable should be declared using the underlying type. // If the type is a pointer, get its base type and overwrite the result type mapping. auto &type = compiler.get(result_type); @@ -3805,7 +3841,7 @@ bool Compiler::AnalyzeVariableScopeAccessHandler::handle(spv::Op op, const uint3 } Compiler::StaticExpressionAccessHandler::StaticExpressionAccessHandler(Compiler &compiler_, uint32_t variable_id_) - : compiler(compiler_) + : OpcodeHandler(compiler_) , variable_id(variable_id_) { } @@ -3815,7 +3851,7 @@ bool Compiler::StaticExpressionAccessHandler::follow_function_call(const SPIRFun return false; } -bool Compiler::StaticExpressionAccessHandler::handle(spv::Op op, const uint32_t *args, uint32_t length) +bool Compiler::StaticExpressionAccessHandler::handle(Op op, const uint32_t *args, uint32_t length) { switch (op) { @@ -4346,6 +4382,7 @@ bool Compiler::may_read_undefined_variable_in_block(const SPIRBlock &block, uint case OpCopyObject: case OpLoad: + case OpCooperativeVectorLoadNV: case OpCooperativeMatrixLoadKHR: if (ops[2] == var) return true; @@ -4374,7 +4411,7 @@ bool Compiler::may_read_undefined_variable_in_block(const SPIRBlock &block, uint return true; } -bool Compiler::GeometryEmitDisocveryHandler::handle(spv::Op opcode, const uint32_t *, uint32_t) +bool Compiler::GeometryEmitDisocveryHandler::handle(Op opcode, const uint32_t *, uint32_t) { if (opcode == OpEmitVertex || opcode == OpEndPrimitive) { @@ -4392,8 +4429,9 @@ bool Compiler::GeometryEmitDisocveryHandler::begin_function_scope(const uint32_t return true; } -bool Compiler::GeometryEmitDisocveryHandler::end_function_scope([[maybe_unused]] const uint32_t *stream, uint32_t) +bool Compiler::GeometryEmitDisocveryHandler::end_function_scope(const uint32_t *stream, uint32_t) { + (void)stream; assert(function_stack.back() == &compiler.get(stream[2])); function_stack.pop_back(); @@ -4514,7 +4552,7 @@ void Compiler::ActiveBuiltinHandler::add_if_builtin_or_block(uint32_t id) add_if_builtin(id, true); } -bool Compiler::ActiveBuiltinHandler::handle(spv::Op opcode, const uint32_t *args, uint32_t length) +bool Compiler::ActiveBuiltinHandler::handle(Op opcode, const uint32_t *args, uint32_t length) { switch (opcode) { @@ -4709,7 +4747,7 @@ void Compiler::analyze_image_and_sampler_usage() comparison_ids.insert(combined.combined_id); } -bool Compiler::CombinedImageSamplerDrefHandler::handle(spv::Op opcode, const uint32_t *args, uint32_t) +bool Compiler::CombinedImageSamplerDrefHandler::handle(Op opcode, const uint32_t *args, uint32_t) { // Mark all sampled images which are used with Dref. switch (opcode) @@ -4818,11 +4856,11 @@ void Compiler::build_function_control_flow_graphs_and_analyze() } Compiler::CFGBuilder::CFGBuilder(Compiler &compiler_) - : compiler(compiler_) + : OpcodeHandler(compiler_) { } -bool Compiler::CFGBuilder::handle(spv::Op, const uint32_t *, uint32_t) +bool Compiler::CFGBuilder::handle(Op, const uint32_t *, uint32_t) { return true; } @@ -4998,7 +5036,7 @@ void Compiler::make_constant_null(uint32_t id, uint32_t type) } } -const SmallVector &Compiler::get_declared_capabilities() const +const SmallVector &Compiler::get_declared_capabilities() const { return ir.declared_capabilities; } @@ -5040,12 +5078,12 @@ std::string Compiler::get_remapped_declared_block_name(uint32_t id, bool fallbac bool Compiler::reflection_ssbo_instance_name_is_significant() const { - if (ir.source.known) + if (!ir.sources.empty() && ir.sources[0].known) { // UAVs from HLSL source tend to be declared in a way where the type is reused // but the instance name is significant, and that's the name we should report. // For GLSL, SSBOs each have their own block type as that's how GLSL is written. - return ir.source.hlsl; + return ir.sources[0].hlsl; } unordered_set ssbo_type_ids; @@ -5073,7 +5111,7 @@ bool Compiler::reflection_ssbo_instance_name_is_significant() const return aliased_ssbo_types; } -bool Compiler::instruction_to_result_type(uint32_t &result_type, uint32_t &result_id, spv::Op op, +bool Compiler::instruction_to_result_type(uint32_t &result_type, uint32_t &result_id, Op op, const uint32_t *args, uint32_t length) { if (length < 2) @@ -5120,7 +5158,7 @@ Bitset Compiler::combined_decoration_for_member(const SPIRType &type, uint32_t i return flags; } -bool Compiler::is_desktop_only_format(spv::ImageFormat format) +bool Compiler::is_desktop_only_format(ImageFormat format) { switch (format) { @@ -5190,7 +5228,7 @@ void Compiler::clear_force_recompile() } Compiler::PhysicalStorageBufferPointerHandler::PhysicalStorageBufferPointerHandler(Compiler &compiler_) - : compiler(compiler_) + : OpcodeHandler(compiler_) { } @@ -5239,7 +5277,7 @@ bool Compiler::PhysicalStorageBufferPointerHandler::type_is_bda_block_entry(uint uint32_t Compiler::PhysicalStorageBufferPointerHandler::get_minimum_scalar_alignment(const SPIRType &type) const { - if (type.storage == spv::StorageClassPhysicalStorageBuffer) + if (type.storage == StorageClassPhysicalStorageBuffer) return 8; else if (type.basetype == SPIRType::Struct) { @@ -5481,6 +5519,7 @@ bool Compiler::InterlockedResourceAccessHandler::handle(Op opcode, const uint32_ { case OpLoad: case OpCooperativeMatrixLoadKHR: + case OpCooperativeVectorLoadNV: { if (length < 3) return false; @@ -5559,6 +5598,7 @@ bool Compiler::InterlockedResourceAccessHandler::handle(Op opcode, const uint32_ case OpImageWrite: case OpAtomicStore: case OpCooperativeMatrixStoreKHR: + case OpCooperativeVectorStoreNV: { if (length < 1) return false; @@ -5755,3 +5795,13 @@ void Compiler::add_loop_level() { current_loop_level++; } + +const SPIRType *Compiler::OpcodeHandler::get_expression_result_type(uint32_t id) const +{ + auto itr = result_types.find(id); + if (itr == result_types.end()) + return nullptr; + + return &compiler.get(itr->second); +} + diff --git a/third_party/spirv-cross/spirv_cross.hpp b/third_party/spirv-cross/spirv_cross.hpp index 5093716917..f72d79979e 100644 --- a/third_party/spirv-cross/spirv_cross.hpp +++ b/third_party/spirv-cross/spirv_cross.hpp @@ -27,12 +27,20 @@ #ifndef SPV_ENABLE_UTILITY_CODE #define SPV_ENABLE_UTILITY_CODE #endif + +// Pragmatic hack to avoid symbol conflicts when including both hpp11 and hpp headers in same translation unit. +// This is an unfortunate SPIRV-Headers issue that we cannot easily deal with ourselves. +#ifdef SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#define spv SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#endif + #include "spirv.hpp" #include "spirv_cfg.hpp" #include "spirv_cross_parsed_ir.hpp" namespace SPIRV_CROSS_NAMESPACE { +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; struct Resource { // Resources are identified with their SPIR-V ID. @@ -69,7 +77,7 @@ struct BuiltInResource // A builtin present here does not necessarily mean it's considered an active builtin, // since variable ID "activeness" is only tracked on OpVariable level, not Block members. // For that, update_active_builtins() -> has_active_builtin() can be used to further refine the reflection. - spv::BuiltIn builtin; + BuiltIn builtin; // This is the actual value type of the builtin. // Typically float4, float, array for the gl_PerVertex builtins. @@ -152,7 +160,7 @@ enum BufferPackingStandard struct EntryPoint { std::string name; - spv::ExecutionModel execution_model; + ExecutionModel execution_model; }; class Compiler @@ -183,8 +191,8 @@ public: const std::string &get_name(ID id) const; // Applies a decoration to an ID. Effectively injects OpDecorate. - void set_decoration(ID id, spv::Decoration decoration, uint32_t argument = 0); - void set_decoration_string(ID id, spv::Decoration decoration, const std::string &argument); + void set_decoration(ID id, Decoration decoration, uint32_t argument = 0); + void set_decoration_string(ID id, Decoration decoration, const std::string &argument); // Overrides the identifier OpName of an ID. // Identifiers beginning with underscores or identifiers which contain double underscores @@ -192,22 +200,22 @@ public: void set_name(ID id, const std::string &name); // Gets a bitmask for the decorations which are applied to ID. - // I.e. (1ull << spv::DecorationFoo) | (1ull << spv::DecorationBar) + // I.e. (1ull << DecorationFoo) | (1ull << DecorationBar) const Bitset &get_decoration_bitset(ID id) const; // Returns whether the decoration has been applied to the ID. - bool has_decoration(ID id, spv::Decoration decoration) const; + bool has_decoration(ID id, Decoration decoration) const; // Gets the value for decorations which take arguments. - // If the decoration is a boolean (i.e. spv::DecorationNonWritable), + // If the decoration is a boolean (i.e. DecorationNonWritable), // 1 will be returned. // If decoration doesn't exist or decoration is not recognized, // 0 will be returned. - uint32_t get_decoration(ID id, spv::Decoration decoration) const; - const std::string &get_decoration_string(ID id, spv::Decoration decoration) const; + uint32_t get_decoration(ID id, Decoration decoration) const; + const std::string &get_decoration_string(ID id, Decoration decoration) const; // Removes the decoration for an ID. - void unset_decoration(ID id, spv::Decoration decoration); + void unset_decoration(ID id, Decoration decoration); // Gets the SPIR-V type associated with ID. // Mostly used with Resource::type_id and Resource::base_type_id to parse the underlying type of a resource. @@ -217,7 +225,7 @@ public: const SPIRType &get_type_from_variable(VariableID id) const; // Gets the underlying storage class for an OpVariable. - spv::StorageClass get_storage_class(VariableID id) const; + StorageClass get_storage_class(VariableID id) const; // If get_name() is an empty string, get the fallback name which will be used // instead in the disassembled source. @@ -232,8 +240,8 @@ public: const std::string &get_member_name(TypeID id, uint32_t index) const; // Given an OpTypeStruct in ID, obtain the OpMemberDecoration for member number "index". - uint32_t get_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration) const; - const std::string &get_member_decoration_string(TypeID id, uint32_t index, spv::Decoration decoration) const; + uint32_t get_member_decoration(TypeID id, uint32_t index, Decoration decoration) const; + const std::string &get_member_decoration_string(TypeID id, uint32_t index, Decoration decoration) const; // Sets the member identifier for OpTypeStruct ID, member number "index". void set_member_name(TypeID id, uint32_t index, const std::string &name); @@ -246,15 +254,15 @@ public: const Bitset &get_member_decoration_bitset(TypeID id, uint32_t index) const; // Returns whether the decoration has been applied to a member of a struct. - bool has_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration) const; + bool has_member_decoration(TypeID id, uint32_t index, Decoration decoration) const; // Similar to set_decoration, but for struct members. - void set_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration, uint32_t argument = 0); - void set_member_decoration_string(TypeID id, uint32_t index, spv::Decoration decoration, + void set_member_decoration(TypeID id, uint32_t index, Decoration decoration, uint32_t argument = 0); + void set_member_decoration_string(TypeID id, uint32_t index, Decoration decoration, const std::string &argument); // Unsets a member decoration, similar to unset_decoration. - void unset_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration); + void unset_member_decoration(TypeID id, uint32_t index, Decoration decoration); // Gets the fallback name for a member, similar to get_fallback_name. virtual const std::string get_fallback_member_name(uint32_t index) const @@ -340,28 +348,28 @@ public: // Names for entry points in the SPIR-V module may alias if they belong to different execution models. // To disambiguate, we must pass along with the entry point names the execution model. SmallVector get_entry_points_and_stages() const; - void set_entry_point(const std::string &entry, spv::ExecutionModel execution_model); + void set_entry_point(const std::string &entry, ExecutionModel execution_model); // Renames an entry point from old_name to new_name. // If old_name is currently selected as the current entry point, it will continue to be the current entry point, // albeit with a new name. // get_entry_points() is essentially invalidated at this point. void rename_entry_point(const std::string &old_name, const std::string &new_name, - spv::ExecutionModel execution_model); - const SPIREntryPoint &get_entry_point(const std::string &name, spv::ExecutionModel execution_model) const; - SPIREntryPoint &get_entry_point(const std::string &name, spv::ExecutionModel execution_model); + ExecutionModel execution_model); + const SPIREntryPoint &get_entry_point(const std::string &name, ExecutionModel execution_model) const; + SPIREntryPoint &get_entry_point(const std::string &name, ExecutionModel execution_model); const std::string &get_cleansed_entry_point_name(const std::string &name, - spv::ExecutionModel execution_model) const; + ExecutionModel execution_model) const; // Traverses all reachable opcodes and sets active_builtins to a bitmask of all builtin variables which are accessed in the shader. void update_active_builtins(); - bool has_active_builtin(spv::BuiltIn builtin, spv::StorageClass storage) const; + bool has_active_builtin(BuiltIn builtin, StorageClass storage) const; // Query and modify OpExecutionMode. const Bitset &get_execution_mode_bitset() const; - void unset_execution_mode(spv::ExecutionMode mode); - void set_execution_mode(spv::ExecutionMode mode, uint32_t arg0 = 0, uint32_t arg1 = 0, uint32_t arg2 = 0); + void unset_execution_mode(ExecutionMode mode); + void set_execution_mode(ExecutionMode mode, uint32_t arg0 = 0, uint32_t arg1 = 0, uint32_t arg2 = 0); // Gets argument for an execution mode (LocalSize, Invocations, OutputVertices). // For LocalSize or LocalSizeId, the index argument is used to select the dimension (X = 0, Y = 1, Z = 2). @@ -369,8 +377,8 @@ public: // LocalSizeId query returns an ID. If LocalSizeId execution mode is not used, it returns 0. // LocalSize always returns a literal. If execution mode is LocalSizeId, // the literal (spec constant or not) is still returned. - uint32_t get_execution_mode_argument(spv::ExecutionMode mode, uint32_t index = 0) const; - spv::ExecutionModel get_execution_model() const; + uint32_t get_execution_mode_argument(ExecutionMode mode, uint32_t index = 0) const; + ExecutionModel get_execution_model() const; bool is_tessellation_shader() const; bool is_tessellating_triangles() const; @@ -483,7 +491,7 @@ public: // If the decoration was declared, sets the word_offset to an offset into the provided SPIR-V binary buffer and returns true, // otherwise, returns false. // If the decoration does not have any value attached to it (e.g. DecorationRelaxedPrecision), this function will also return false. - bool get_binary_offset_for_decoration(VariableID id, spv::Decoration decoration, uint32_t &word_offset) const; + bool get_binary_offset_for_decoration(VariableID id, Decoration decoration, uint32_t &word_offset) const; // HLSL counter buffer reflection interface. // Append/Consume/Increment/Decrement in HLSL is implemented as two "neighbor" buffer objects where @@ -509,7 +517,7 @@ public: bool buffer_get_hlsl_counter_buffer(VariableID id, uint32_t &counter_id) const; // Gets the list of all SPIR-V Capabilities which were declared in the SPIR-V module. - const SmallVector &get_declared_capabilities() const; + const SmallVector &get_declared_capabilities() const; // Gets the list of all SPIR-V extensions which were declared in the SPIR-V module. const SmallVector &get_declared_extensions() const; @@ -541,6 +549,9 @@ public: return position_invariant; } + const ParsedIR &get_ir() const { return ir; } + uint32_t evaluate_constant_u32(uint32_t id) const; + protected: const uint32_t *stream(const Instruction &instr) const { @@ -672,20 +683,21 @@ protected: const SPIREntryPoint &get_entry_point() const; SPIREntryPoint &get_entry_point(); - static bool is_tessellation_shader(spv::ExecutionModel model); + static bool is_tessellation_shader(ExecutionModel model); virtual std::string to_name(uint32_t id, bool allow_alias = true) const; bool is_builtin_variable(const SPIRVariable &var) const; bool is_builtin_type(const SPIRType &type) const; bool is_hidden_variable(const SPIRVariable &var, bool include_builtins = false) const; bool is_immutable(uint32_t id) const; - bool is_member_builtin(const SPIRType &type, uint32_t index, spv::BuiltIn *builtin) const; + bool is_member_builtin(const SPIRType &type, uint32_t index, BuiltIn *builtin) const; bool is_scalar(const SPIRType &type) const; bool is_vector(const SPIRType &type) const; bool is_matrix(const SPIRType &type) const; bool is_array(const SPIRType &type) const; bool is_pointer(const SPIRType &type) const; bool is_physical_pointer(const SPIRType &type) const; + bool is_physical_or_buffer_pointer(const SPIRType &type) const; bool is_physical_pointer_to_buffer_block(const SPIRType &type) const; static bool is_runtime_size_array(const SPIRType &type); uint32_t expression_type_id(uint32_t id) const; @@ -788,11 +800,12 @@ protected: // Used internally to implement various traversals for queries. struct OpcodeHandler { + explicit OpcodeHandler(Compiler &compiler_) : compiler(compiler_) {} virtual ~OpcodeHandler() = default; // Return true if traversal should continue. // If false, traversal will end immediately. - virtual bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) = 0; + virtual bool handle(Op opcode, const uint32_t *args, uint32_t length) = 0; virtual bool handle_terminator(const SPIRBlock &) { return true; @@ -823,20 +836,40 @@ protected: { return true; } + + Compiler &compiler; + std::unordered_map result_types; + const SPIRType *get_expression_result_type(uint32_t id) const; + bool enable_result_types = false; + + template T &get(uint32_t id) + { + return compiler.get(id); + } + + template const T &get(uint32_t id) const + { + return compiler.get(id); + } + + template + T &set(uint32_t id, P &&... args) + { + return compiler.set(id, std::forward

(args)...); + } }; struct BufferAccessHandler : OpcodeHandler { BufferAccessHandler(const Compiler &compiler_, SmallVector &ranges_, uint32_t id_) - : compiler(compiler_) + : OpcodeHandler(const_cast(compiler_)) , ranges(ranges_) , id(id_) { } - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; - const Compiler &compiler; SmallVector &ranges; uint32_t id; @@ -846,29 +879,26 @@ protected: struct InterfaceVariableAccessHandler : OpcodeHandler { InterfaceVariableAccessHandler(const Compiler &compiler_, std::unordered_set &variables_) - : compiler(compiler_) + : OpcodeHandler(const_cast(compiler_)) , variables(variables_) { } - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; - const Compiler &compiler; std::unordered_set &variables; }; struct CombinedImageSamplerHandler : OpcodeHandler { - CombinedImageSamplerHandler(Compiler &compiler_) - : compiler(compiler_) + explicit CombinedImageSamplerHandler(Compiler &compiler_) + : OpcodeHandler(compiler_) { } - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; bool begin_function_scope(const uint32_t *args, uint32_t length) override; bool end_function_scope(const uint32_t *args, uint32_t length) override; - Compiler &compiler; - // Each function in the call stack needs its own remapping for parameters so we can deduce which global variable each texture/sampler the parameter is statically bound to. std::stack> parameter_remapping; std::stack functions; @@ -882,27 +912,24 @@ protected: struct DummySamplerForCombinedImageHandler : OpcodeHandler { - DummySamplerForCombinedImageHandler(Compiler &compiler_) - : compiler(compiler_) + explicit DummySamplerForCombinedImageHandler(Compiler &compiler_) + : OpcodeHandler(compiler_) { } - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; - - Compiler &compiler; + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; bool need_dummy_sampler = false; }; struct ActiveBuiltinHandler : OpcodeHandler { - ActiveBuiltinHandler(Compiler &compiler_) - : compiler(compiler_) + explicit ActiveBuiltinHandler(Compiler &compiler_) + : OpcodeHandler(compiler_) { } - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; - Compiler &compiler; + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; - void handle_builtin(const SPIRType &type, spv::BuiltIn builtin, const Bitset &decoration_flags); + void handle_builtin(const SPIRType &type, BuiltIn builtin, const Bitset &decoration_flags); void add_if_builtin(uint32_t id); void add_if_builtin_or_block(uint32_t id); void add_if_builtin(uint32_t id, bool allow_blocks); @@ -954,13 +981,12 @@ protected: struct CombinedImageSamplerDrefHandler : OpcodeHandler { - CombinedImageSamplerDrefHandler(Compiler &compiler_) - : compiler(compiler_) + explicit CombinedImageSamplerDrefHandler(Compiler &compiler_) + : OpcodeHandler(compiler_) { } - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; - Compiler &compiler; std::unordered_set dref_combined_samplers; }; @@ -968,14 +994,13 @@ protected: { CombinedImageSamplerUsageHandler(Compiler &compiler_, const std::unordered_set &dref_combined_samplers_) - : compiler(compiler_) + : OpcodeHandler(compiler_) , dref_combined_samplers(dref_combined_samplers_) { } bool begin_function_scope(const uint32_t *args, uint32_t length) override; - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; - Compiler &compiler; + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; const std::unordered_set &dref_combined_samplers; std::unordered_map> dependency_hierarchy; @@ -997,8 +1022,7 @@ protected: explicit CFGBuilder(Compiler &compiler_); bool follow_function_call(const SPIRFunction &func) override; - bool handle(spv::Op op, const uint32_t *args, uint32_t length) override; - Compiler &compiler; + bool handle(Op op, const uint32_t *args, uint32_t length) override; std::unordered_map> function_cfgs; }; @@ -1012,10 +1036,9 @@ protected: void notify_variable_access(uint32_t id, uint32_t block); bool id_is_phi_variable(uint32_t id) const; bool id_is_potential_temporary(uint32_t id) const; - bool handle(spv::Op op, const uint32_t *args, uint32_t length) override; + bool handle(Op op, const uint32_t *args, uint32_t length) override; bool handle_terminator(const SPIRBlock &block) override; - Compiler &compiler; SPIRFunction &entry; std::unordered_map> accessed_variables_to_block; std::unordered_map> accessed_temporaries_to_block; @@ -1033,9 +1056,8 @@ protected: { StaticExpressionAccessHandler(Compiler &compiler_, uint32_t variable_id_); bool follow_function_call(const SPIRFunction &) override; - bool handle(spv::Op op, const uint32_t *args, uint32_t length) override; + bool handle(Op op, const uint32_t *args, uint32_t length) override; - Compiler &compiler; uint32_t variable_id; uint32_t static_expression = 0; uint32_t write_count = 0; @@ -1049,8 +1071,7 @@ protected: struct PhysicalStorageBufferPointerHandler : OpcodeHandler { explicit PhysicalStorageBufferPointerHandler(Compiler &compiler_); - bool handle(spv::Op op, const uint32_t *args, uint32_t length) override; - Compiler &compiler; + bool handle(Op op, const uint32_t *args, uint32_t length) override; std::unordered_set non_block_types; std::unordered_map physical_block_type_meta; @@ -1077,12 +1098,11 @@ protected: struct GeometryEmitDisocveryHandler : OpcodeHandler { explicit GeometryEmitDisocveryHandler(Compiler &compiler_) - : compiler(compiler_) + : OpcodeHandler(compiler_) { } - Compiler &compiler; - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; bool begin_function_scope(const uint32_t *, uint32_t) override; bool end_function_scope(const uint32_t *, uint32_t) override; SmallVector function_stack; @@ -1097,16 +1117,15 @@ protected: struct InterlockedResourceAccessHandler : OpcodeHandler { InterlockedResourceAccessHandler(Compiler &compiler_, uint32_t entry_point_id) - : compiler(compiler_) + : OpcodeHandler(compiler_) { call_stack.push_back(entry_point_id); } - bool handle(spv::Op op, const uint32_t *args, uint32_t length) override; + bool handle(Op op, const uint32_t *args, uint32_t length) override; bool begin_function_scope(const uint32_t *args, uint32_t length) override; bool end_function_scope(const uint32_t *args, uint32_t length) override; - Compiler &compiler; bool in_crit_sec = false; uint32_t interlock_function_id = 0; @@ -1122,17 +1141,16 @@ protected: struct InterlockedResourceAccessPrepassHandler : OpcodeHandler { InterlockedResourceAccessPrepassHandler(Compiler &compiler_, uint32_t entry_point_id) - : compiler(compiler_) + : OpcodeHandler(compiler_) { call_stack.push_back(entry_point_id); } void rearm_current_block(const SPIRBlock &block) override; - bool handle(spv::Op op, const uint32_t *args, uint32_t length) override; + bool handle(Op op, const uint32_t *args, uint32_t length) override; bool begin_function_scope(const uint32_t *args, uint32_t length) override; bool end_function_scope(const uint32_t *args, uint32_t length) override; - Compiler &compiler; uint32_t interlock_function_id = 0; uint32_t current_block_id = 0; bool split_function_case = false; @@ -1149,11 +1167,11 @@ protected: std::unordered_map declared_block_names; - bool instruction_to_result_type(uint32_t &result_type, uint32_t &result_id, spv::Op op, const uint32_t *args, - uint32_t length); + static bool instruction_to_result_type( + uint32_t &result_type, uint32_t &result_id, Op op, const uint32_t *args, uint32_t length); Bitset combined_decoration_for_member(const SPIRType &type, uint32_t index) const; - static bool is_desktop_only_format(spv::ImageFormat format); + static bool is_desktop_only_format(ImageFormat format); bool is_depth_image(const SPIRType &type, uint32_t id) const; @@ -1172,6 +1190,7 @@ protected: bool type_contains_recursion(const SPIRType &type); bool type_is_array_of_pointers(const SPIRType &type) const; bool type_is_block_like(const SPIRType &type) const; + bool type_is_explicit_layout(const SPIRType &type) const; bool type_is_top_level_block(const SPIRType &type) const; bool type_is_opaque_value(const SPIRType &type) const; @@ -1181,7 +1200,6 @@ protected: bool flush_phi_required(BlockID from, BlockID to) const; uint32_t evaluate_spec_constant_u32(const SPIRConstantOp &spec) const; - uint32_t evaluate_constant_u32(uint32_t id) const; bool is_vertex_like_shader() const; @@ -1197,4 +1215,8 @@ private: }; } // namespace SPIRV_CROSS_NAMESPACE +#ifdef SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE +#undef spv +#endif + #endif diff --git a/third_party/spirv-cross/spirv_cross_c.cpp b/third_party/spirv-cross/spirv_cross_c.cpp index 8a4a49279c..1604385e50 100644 --- a/third_party/spirv-cross/spirv_cross_c.cpp +++ b/third_party/spirv-cross/spirv_cross_c.cpp @@ -75,6 +75,7 @@ #define SPVC_END_SAFE_SCOPE(context, error) #endif +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace std; using namespace SPIRV_CROSS_NAMESPACE; @@ -528,6 +529,10 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c case SPVC_COMPILER_OPTION_HLSL_PRESERVE_STRUCTURED_BUFFERS: options->hlsl.preserve_structured_buffers = value != 0; break; + + case SPVC_COMPILER_OPTION_HLSL_USER_SEMANTIC: + options->hlsl.user_semantic = value != 0; + break; #endif #if SPIRV_CROSS_C_API_MSL @@ -957,7 +962,7 @@ spvc_result spvc_compiler_mask_stage_output_by_builtin(spvc_compiler compiler, S return SPVC_ERROR_INVALID_ARGUMENT; } - static_cast(compiler->compiler.get())->mask_stage_output_by_builtin(spv::BuiltIn(builtin)); + static_cast(compiler->compiler.get())->mask_stage_output_by_builtin(BuiltIn(builtin)); return SPVC_SUCCESS; #else (void)builtin; @@ -1080,7 +1085,7 @@ spvc_result spvc_compiler_hlsl_add_resource_binding(spvc_compiler compiler, HLSLResourceBinding bind; bind.binding = binding->binding; bind.desc_set = binding->desc_set; - bind.stage = static_cast(binding->stage); + bind.stage = static_cast(binding->stage); bind.cbv.register_binding = binding->cbv.register_binding; bind.cbv.register_space = binding->cbv.register_space; bind.uav.register_binding = binding->uav.register_binding; @@ -1109,7 +1114,7 @@ spvc_bool spvc_compiler_hlsl_is_resource_used(spvc_compiler compiler, SpvExecuti } auto &hlsl = *static_cast(compiler->compiler.get()); - return hlsl.is_hlsl_resource_binding_used(static_cast(model), set, binding) ? SPVC_TRUE : + return hlsl.is_hlsl_resource_binding_used(static_cast(model), set, binding) ? SPVC_TRUE : SPVC_FALSE; #else (void)model; @@ -1240,7 +1245,7 @@ spvc_result spvc_compiler_msl_add_vertex_attribute(spvc_compiler compiler, const MSLShaderInterfaceVariable attr; attr.location = va->location; attr.format = static_cast(va->format); - attr.builtin = static_cast(va->builtin); + attr.builtin = static_cast(va->builtin); msl.add_msl_shader_input(attr); return SPVC_SUCCESS; #else @@ -1263,7 +1268,7 @@ spvc_result spvc_compiler_msl_add_shader_input(spvc_compiler compiler, const spv MSLShaderInterfaceVariable input; input.location = si->location; input.format = static_cast(si->format); - input.builtin = static_cast(si->builtin); + input.builtin = static_cast(si->builtin); input.vecsize = si->vecsize; msl.add_msl_shader_input(input); return SPVC_SUCCESS; @@ -1287,7 +1292,7 @@ spvc_result spvc_compiler_msl_add_shader_input_2(spvc_compiler compiler, const s MSLShaderInterfaceVariable input; input.location = si->location; input.format = static_cast(si->format); - input.builtin = static_cast(si->builtin); + input.builtin = static_cast(si->builtin); input.vecsize = si->vecsize; input.rate = static_cast(si->rate); msl.add_msl_shader_input(input); @@ -1312,7 +1317,7 @@ spvc_result spvc_compiler_msl_add_shader_output(spvc_compiler compiler, const sp MSLShaderInterfaceVariable output; output.location = so->location; output.format = static_cast(so->format); - output.builtin = static_cast(so->builtin); + output.builtin = static_cast(so->builtin); output.vecsize = so->vecsize; msl.add_msl_shader_output(output); return SPVC_SUCCESS; @@ -1336,7 +1341,7 @@ spvc_result spvc_compiler_msl_add_shader_output_2(spvc_compiler compiler, const MSLShaderInterfaceVariable output; output.location = so->location; output.format = static_cast(so->format); - output.builtin = static_cast(so->builtin); + output.builtin = static_cast(so->builtin); output.vecsize = so->vecsize; output.rate = static_cast(so->rate); msl.add_msl_shader_output(output); @@ -1362,7 +1367,7 @@ spvc_result spvc_compiler_msl_add_resource_binding(spvc_compiler compiler, MSLResourceBinding bind; bind.binding = binding->binding; bind.desc_set = binding->desc_set; - bind.stage = static_cast(binding->stage); + bind.stage = static_cast(binding->stage); bind.msl_buffer = binding->msl_buffer; bind.msl_texture = binding->msl_texture; bind.msl_sampler = binding->msl_sampler; @@ -1389,7 +1394,7 @@ spvc_result spvc_compiler_msl_add_resource_binding_2(spvc_compiler compiler, MSLResourceBinding bind; bind.binding = binding->binding; bind.desc_set = binding->desc_set; - bind.stage = static_cast(binding->stage); + bind.stage = static_cast(binding->stage); bind.msl_buffer = binding->msl_buffer; bind.msl_texture = binding->msl_texture; bind.msl_sampler = binding->msl_sampler; @@ -1535,7 +1540,7 @@ spvc_bool spvc_compiler_msl_is_resource_used(spvc_compiler compiler, SpvExecutio } auto &msl = *static_cast(compiler->compiler.get()); - return msl.is_msl_resource_binding_used(static_cast(model), set, binding) ? SPVC_TRUE : + return msl.is_msl_resource_binding_used(static_cast(model), set, binding) ? SPVC_TRUE : SPVC_FALSE; #else (void)model; @@ -2082,13 +2087,13 @@ spvc_result spvc_resources_get_builtin_resource_list_for_type( void spvc_compiler_set_decoration(spvc_compiler compiler, SpvId id, SpvDecoration decoration, unsigned argument) { - compiler->compiler->set_decoration(id, static_cast(decoration), argument); + compiler->compiler->set_decoration(id, static_cast(decoration), argument); } void spvc_compiler_set_decoration_string(spvc_compiler compiler, SpvId id, SpvDecoration decoration, const char *argument) { - compiler->compiler->set_decoration_string(id, static_cast(decoration), argument); + compiler->compiler->set_decoration_string(id, static_cast(decoration), argument); } void spvc_compiler_set_name(spvc_compiler compiler, SpvId id, const char *argument) @@ -2099,13 +2104,13 @@ void spvc_compiler_set_name(spvc_compiler compiler, SpvId id, const char *argume void spvc_compiler_set_member_decoration(spvc_compiler compiler, spvc_type_id id, unsigned member_index, SpvDecoration decoration, unsigned argument) { - compiler->compiler->set_member_decoration(id, member_index, static_cast(decoration), argument); + compiler->compiler->set_member_decoration(id, member_index, static_cast(decoration), argument); } void spvc_compiler_set_member_decoration_string(spvc_compiler compiler, spvc_type_id id, unsigned member_index, SpvDecoration decoration, const char *argument) { - compiler->compiler->set_member_decoration_string(id, member_index, static_cast(decoration), + compiler->compiler->set_member_decoration_string(id, member_index, static_cast(decoration), argument); } @@ -2116,24 +2121,24 @@ void spvc_compiler_set_member_name(spvc_compiler compiler, spvc_type_id id, unsi void spvc_compiler_unset_decoration(spvc_compiler compiler, SpvId id, SpvDecoration decoration) { - compiler->compiler->unset_decoration(id, static_cast(decoration)); + compiler->compiler->unset_decoration(id, static_cast(decoration)); } void spvc_compiler_unset_member_decoration(spvc_compiler compiler, spvc_type_id id, unsigned member_index, SpvDecoration decoration) { - compiler->compiler->unset_member_decoration(id, member_index, static_cast(decoration)); + compiler->compiler->unset_member_decoration(id, member_index, static_cast(decoration)); } spvc_bool spvc_compiler_has_decoration(spvc_compiler compiler, SpvId id, SpvDecoration decoration) { - return compiler->compiler->has_decoration(id, static_cast(decoration)) ? SPVC_TRUE : SPVC_FALSE; + return compiler->compiler->has_decoration(id, static_cast(decoration)) ? SPVC_TRUE : SPVC_FALSE; } spvc_bool spvc_compiler_has_member_decoration(spvc_compiler compiler, spvc_type_id id, unsigned member_index, SpvDecoration decoration) { - return compiler->compiler->has_member_decoration(id, member_index, static_cast(decoration)) ? + return compiler->compiler->has_member_decoration(id, member_index, static_cast(decoration)) ? SPVC_TRUE : SPVC_FALSE; } @@ -2145,24 +2150,24 @@ const char *spvc_compiler_get_name(spvc_compiler compiler, SpvId id) unsigned spvc_compiler_get_decoration(spvc_compiler compiler, SpvId id, SpvDecoration decoration) { - return compiler->compiler->get_decoration(id, static_cast(decoration)); + return compiler->compiler->get_decoration(id, static_cast(decoration)); } const char *spvc_compiler_get_decoration_string(spvc_compiler compiler, SpvId id, SpvDecoration decoration) { - return compiler->compiler->get_decoration_string(id, static_cast(decoration)).c_str(); + return compiler->compiler->get_decoration_string(id, static_cast(decoration)).c_str(); } unsigned spvc_compiler_get_member_decoration(spvc_compiler compiler, spvc_type_id id, unsigned member_index, SpvDecoration decoration) { - return compiler->compiler->get_member_decoration(id, member_index, static_cast(decoration)); + return compiler->compiler->get_member_decoration(id, member_index, static_cast(decoration)); } const char *spvc_compiler_get_member_decoration_string(spvc_compiler compiler, spvc_type_id id, unsigned member_index, SpvDecoration decoration) { - return compiler->compiler->get_member_decoration_string(id, member_index, static_cast(decoration)) + return compiler->compiler->get_member_decoration_string(id, member_index, static_cast(decoration)) .c_str(); } @@ -2207,7 +2212,7 @@ spvc_result spvc_compiler_set_entry_point(spvc_compiler compiler, const char *na { SPVC_BEGIN_SAFE_SCOPE { - compiler->compiler->set_entry_point(name, static_cast(model)); + compiler->compiler->set_entry_point(name, static_cast(model)); } SPVC_END_SAFE_SCOPE(compiler->context, SPVC_ERROR_INVALID_ARGUMENT) return SPVC_SUCCESS; @@ -2218,7 +2223,7 @@ spvc_result spvc_compiler_rename_entry_point(spvc_compiler compiler, const char { SPVC_BEGIN_SAFE_SCOPE { - compiler->compiler->rename_entry_point(old_name, new_name, static_cast(model)); + compiler->compiler->rename_entry_point(old_name, new_name, static_cast(model)); } SPVC_END_SAFE_SCOPE(compiler->context, SPVC_ERROR_INVALID_ARGUMENT) return SPVC_SUCCESS; @@ -2230,7 +2235,7 @@ const char *spvc_compiler_get_cleansed_entry_point_name(spvc_compiler compiler, SPVC_BEGIN_SAFE_SCOPE { auto cleansed_name = - compiler->compiler->get_cleansed_entry_point_name(name, static_cast(model)); + compiler->compiler->get_cleansed_entry_point_name(name, static_cast(model)); return compiler->context->allocate_name(cleansed_name); } SPVC_END_SAFE_SCOPE(compiler->context, nullptr) @@ -2238,19 +2243,19 @@ const char *spvc_compiler_get_cleansed_entry_point_name(spvc_compiler compiler, void spvc_compiler_set_execution_mode(spvc_compiler compiler, SpvExecutionMode mode) { - compiler->compiler->set_execution_mode(static_cast(mode)); + compiler->compiler->set_execution_mode(static_cast(mode)); } void spvc_compiler_set_execution_mode_with_arguments(spvc_compiler compiler, SpvExecutionMode mode, unsigned arg0, unsigned arg1, unsigned arg2) { - compiler->compiler->set_execution_mode(static_cast(mode), arg0, arg1, arg2); + compiler->compiler->set_execution_mode(static_cast(mode), arg0, arg1, arg2); } void spvc_compiler_unset_execution_mode(spvc_compiler compiler, SpvExecutionMode mode) { - compiler->compiler->unset_execution_mode(static_cast(mode)); + compiler->compiler->unset_execution_mode(static_cast(mode)); } spvc_result spvc_compiler_get_execution_modes(spvc_compiler compiler, const SpvExecutionMode **modes, size_t *num_modes) @@ -2272,13 +2277,13 @@ spvc_result spvc_compiler_get_execution_modes(spvc_compiler compiler, const SpvE unsigned spvc_compiler_get_execution_mode_argument(spvc_compiler compiler, SpvExecutionMode mode) { - return compiler->compiler->get_execution_mode_argument(static_cast(mode)); + return compiler->compiler->get_execution_mode_argument(static_cast(mode)); } unsigned spvc_compiler_get_execution_mode_argument_by_index(spvc_compiler compiler, SpvExecutionMode mode, unsigned index) { - return compiler->compiler->get_execution_mode_argument(static_cast(mode), index); + return compiler->compiler->get_execution_mode_argument(static_cast(mode), index); } SpvExecutionModel spvc_compiler_get_execution_model(spvc_compiler compiler) @@ -2293,7 +2298,7 @@ void spvc_compiler_update_active_builtins(spvc_compiler compiler) spvc_bool spvc_compiler_has_active_builtin(spvc_compiler compiler, SpvBuiltIn builtin, SpvStorageClass storage) { - return compiler->compiler->has_active_builtin(static_cast(builtin), static_cast(storage)) ? + return compiler->compiler->has_active_builtin(static_cast(builtin), static_cast(storage)) ? SPVC_TRUE : SPVC_FALSE; } @@ -2722,7 +2727,7 @@ spvc_bool spvc_compiler_get_binary_offset_for_decoration(spvc_compiler compiler, unsigned *word_offset) { uint32_t off = 0; - bool ret = compiler->compiler->get_binary_offset_for_decoration(id, static_cast(decoration), off); + bool ret = compiler->compiler->get_binary_offset_for_decoration(id, static_cast(decoration), off); if (ret) { *word_offset = off; @@ -2755,7 +2760,7 @@ spvc_result spvc_compiler_get_declared_capabilities(spvc_compiler compiler, cons size_t *num_capabilities) { auto &caps = compiler->compiler->get_declared_capabilities(); - static_assert(sizeof(SpvCapability) == sizeof(spv::Capability), "Enum size mismatch."); + static_assert(sizeof(SpvCapability) == sizeof(Capability), "Enum size mismatch."); *capabilities = reinterpret_cast(caps.data()); *num_capabilities = caps.size(); return SPVC_SUCCESS; diff --git a/third_party/spirv-cross/spirv_cross_c.h b/third_party/spirv-cross/spirv_cross_c.h index f360711e8e..30f1c459cc 100644 --- a/third_party/spirv-cross/spirv_cross_c.h +++ b/third_party/spirv-cross/spirv_cross_c.h @@ -40,7 +40,7 @@ extern "C" { /* Bumped if ABI or API breaks backwards compatibility. */ #define SPVC_C_API_VERSION_MAJOR 0 /* Bumped if APIs or enumerations are added in a backwards compatible way. */ -#define SPVC_C_API_VERSION_MINOR 67 +#define SPVC_C_API_VERSION_MINOR 68 /* Bumped if internal implementation details change. */ #define SPVC_C_API_VERSION_PATCH 0 @@ -753,6 +753,8 @@ typedef enum spvc_compiler_option SPVC_COMPILER_OPTION_MSL_ENABLE_POINT_SIZE_DEFAULT = 93 | SPVC_COMPILER_OPTION_MSL_BIT, + SPVC_COMPILER_OPTION_HLSL_USER_SEMANTIC = 94 | SPVC_COMPILER_OPTION_HLSL_BIT, + SPVC_COMPILER_OPTION_INT_MAX = 0x7fffffff } spvc_compiler_option; diff --git a/third_party/spirv-cross/spirv_cross_parsed_ir.cpp b/third_party/spirv-cross/spirv_cross_parsed_ir.cpp index 760b8037d4..bb9a5f58ed 100644 --- a/third_party/spirv-cross/spirv_cross_parsed_ir.cpp +++ b/third_party/spirv-cross/spirv_cross_parsed_ir.cpp @@ -26,7 +26,7 @@ #include using namespace std; -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; namespace SPIRV_CROSS_NAMESPACE { @@ -49,6 +49,7 @@ ParsedIR::ParsedIR() pool_group->pools[TypeAccessChain].reset(new ObjectPool); pool_group->pools[TypeUndef].reset(new ObjectPool); pool_group->pools[TypeString].reset(new ObjectPool); + pool_group->pools[TypeDebugLocalVariable].reset(new ObjectPool); } // Should have been default-implemented, but need this on MSVC 2013. @@ -78,7 +79,7 @@ ParsedIR &ParsedIR::operator=(ParsedIR &&other) SPIRV_CROSS_NOEXCEPT memory_model = other.memory_model; default_entry_point = other.default_entry_point; - source = other.source; + sources = std::move(other.sources); loop_iteration_depth_hard = other.loop_iteration_depth_hard; loop_iteration_depth_soft = other.loop_iteration_depth_soft; @@ -110,7 +111,7 @@ ParsedIR &ParsedIR::operator=(const ParsedIR &other) continue_block_to_loop_header = other.continue_block_to_loop_header; entry_points = other.entry_points; default_entry_point = other.default_entry_point; - source = other.source; + sources = other.sources; loop_iteration_depth_hard = other.loop_iteration_depth_hard; loop_iteration_depth_soft = other.loop_iteration_depth_soft; addressing_model = other.addressing_model; @@ -366,8 +367,8 @@ void ParsedIR::set_decoration_string(ID id, Decoration decoration, const string switch (decoration) { - case DecorationHlslSemanticGOOGLE: - dec.hlsl_semantic = argument; + case DecorationUserSemantic: + dec.user_semantic = argument; break; case DecorationUserTypeGOOGLE: @@ -527,8 +528,27 @@ void ParsedIR::mark_used_as_array_length(ID id) switch (ids[id].get_type()) { case TypeConstant: - get(id).is_used_as_array_length = true; + { + auto &c = get(id); + c.is_used_as_array_length = true; + + // Mark composite dependencies as well. + for (auto &sub_id: c.m.id) + if (sub_id) + mark_used_as_array_length(sub_id); + + for (uint32_t col = 0; col < c.m.columns; col++) + { + for (auto &sub_id : c.m.c[col].id) + if (sub_id) + mark_used_as_array_length(sub_id); + } + + for (auto &sub_id : c.subconstants) + if (sub_id) + mark_used_as_array_length(sub_id); break; + } case TypeConstantOp: { @@ -667,8 +687,8 @@ const string &ParsedIR::get_decoration_string(ID id, Decoration decoration) cons switch (decoration) { - case DecorationHlslSemanticGOOGLE: - return dec.hlsl_semantic; + case DecorationUserSemantic: + return dec.user_semantic; case DecorationUserTypeGOOGLE: return dec.user_type; @@ -728,8 +748,8 @@ void ParsedIR::unset_decoration(ID id, Decoration decoration) dec.spec_id = 0; break; - case DecorationHlslSemanticGOOGLE: - dec.hlsl_semantic.clear(); + case DecorationUserSemantic: + dec.user_semantic.clear(); break; case DecorationFPRoundingMode: @@ -824,8 +844,8 @@ void ParsedIR::set_member_decoration_string(TypeID id, uint32_t index, Decoratio switch (decoration) { - case DecorationHlslSemanticGOOGLE: - dec.hlsl_semantic = argument; + case DecorationUserSemantic: + dec.user_semantic = argument; break; default: @@ -845,8 +865,8 @@ const string &ParsedIR::get_member_decoration_string(TypeID id, uint32_t index, switch (decoration) { - case DecorationHlslSemanticGOOGLE: - return dec.hlsl_semantic; + case DecorationUserSemantic: + return dec.user_semantic; default: return empty_string; @@ -899,8 +919,8 @@ void ParsedIR::unset_member_decoration(TypeID id, uint32_t index, Decoration dec dec.spec_id = 0; break; - case DecorationHlslSemanticGOOGLE: - dec.hlsl_semantic.clear(); + case DecorationUserSemantic: + dec.user_semantic.clear(); break; default: diff --git a/third_party/spirv-cross/spirv_cross_parsed_ir.hpp b/third_party/spirv-cross/spirv_cross_parsed_ir.hpp index 3892248aaa..b1e76f2053 100644 --- a/third_party/spirv-cross/spirv_cross_parsed_ir.hpp +++ b/third_party/spirv-cross/spirv_cross_parsed_ir.hpp @@ -30,6 +30,7 @@ namespace SPIRV_CROSS_NAMESPACE { +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; // This data structure holds all information needed to perform cross-compilation and reflection. // It is the output of the Parser, but any implementation could create this structure. @@ -87,7 +88,7 @@ public: // Declared capabilities and extensions in the SPIR-V module. // Not really used except for reflection at the moment. - SmallVector declared_capabilities; + SmallVector declared_capabilities; SmallVector declared_extensions; // Meta data about blocks. The cross-compiler needs to query if a block is either of these types. @@ -111,18 +112,34 @@ public: struct Source { + SourceLanguage lang = SourceLanguageUnknown; uint32_t version = 0; bool es = false; bool known = false; bool hlsl = false; + ID file_id = 0; // string + ID define_id = 0; // only non-zero for DebugSource + std::string source; + + struct Marker + { + ID line; // in source + ID col; // in source + ID offset; // in spirv stream + ID function_id; + ID block_id; + }; + + SmallVector line_markers; // sorted by line + Source() = default; }; - Source source; + std::vector sources; - spv::AddressingModel addressing_model = spv::AddressingModelMax; - spv::MemoryModel memory_model = spv::MemoryModelMax; + AddressingModel addressing_model = AddressingModelMax; + MemoryModel memory_model = MemoryModelMax; // Decoration handling methods. // Can be useful for simple "raw" reflection. @@ -130,25 +147,25 @@ public: // and might as well just have the whole suite of decoration/name handling in one place. void set_name(ID id, const std::string &name); const std::string &get_name(ID id) const; - void set_decoration(ID id, spv::Decoration decoration, uint32_t argument = 0); - void set_decoration_string(ID id, spv::Decoration decoration, const std::string &argument); - bool has_decoration(ID id, spv::Decoration decoration) const; - uint32_t get_decoration(ID id, spv::Decoration decoration) const; - const std::string &get_decoration_string(ID id, spv::Decoration decoration) const; + void set_decoration(ID id, Decoration decoration, uint32_t argument = 0); + void set_decoration_string(ID id, Decoration decoration, const std::string &argument); + bool has_decoration(ID id, Decoration decoration) const; + uint32_t get_decoration(ID id, Decoration decoration) const; + const std::string &get_decoration_string(ID id, Decoration decoration) const; const Bitset &get_decoration_bitset(ID id) const; - void unset_decoration(ID id, spv::Decoration decoration); + void unset_decoration(ID id, Decoration decoration); // Decoration handling methods (for members of a struct). void set_member_name(TypeID id, uint32_t index, const std::string &name); const std::string &get_member_name(TypeID id, uint32_t index) const; - void set_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration, uint32_t argument = 0); - void set_member_decoration_string(TypeID id, uint32_t index, spv::Decoration decoration, + void set_member_decoration(TypeID id, uint32_t index, Decoration decoration, uint32_t argument = 0); + void set_member_decoration_string(TypeID id, uint32_t index, Decoration decoration, const std::string &argument); - uint32_t get_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration) const; - const std::string &get_member_decoration_string(TypeID id, uint32_t index, spv::Decoration decoration) const; - bool has_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration) const; + uint32_t get_member_decoration(TypeID id, uint32_t index, Decoration decoration) const; + const std::string &get_member_decoration_string(TypeID id, uint32_t index, Decoration decoration) const; + bool has_member_decoration(TypeID id, uint32_t index, Decoration decoration) const; const Bitset &get_member_decoration_bitset(TypeID id, uint32_t index) const; - void unset_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration); + void unset_member_decoration(TypeID id, uint32_t index, Decoration decoration); void mark_used_as_array_length(ID id); uint32_t increase_bound_by(uint32_t count); @@ -231,7 +248,6 @@ public: uint32_t get_spirv_version() const; -private: template T &get(uint32_t id) { @@ -244,6 +260,7 @@ private: return variant_get(ids[id]); } +private: mutable uint32_t loop_iteration_depth_hard = 0; mutable uint32_t loop_iteration_depth_soft = 0; std::string empty_string; diff --git a/third_party/spirv-cross/spirv_cross_util.cpp b/third_party/spirv-cross/spirv_cross_util.cpp index 7cff010d1c..f30706f592 100644 --- a/third_party/spirv-cross/spirv_cross_util.cpp +++ b/third_party/spirv-cross/spirv_cross_util.cpp @@ -24,7 +24,7 @@ #include "spirv_cross_util.hpp" #include "spirv_common.hpp" -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; namespace spirv_cross_util @@ -34,10 +34,10 @@ void rename_interface_variable(Compiler &compiler, const SmallVector & { for (auto &v : resources) { - if (!compiler.has_decoration(v.id, spv::DecorationLocation)) + if (!compiler.has_decoration(v.id, DecorationLocation)) continue; - auto loc = compiler.get_decoration(v.id, spv::DecorationLocation); + auto loc = compiler.get_decoration(v.id, DecorationLocation); if (loc != location) continue; @@ -61,16 +61,16 @@ void inherit_combined_sampler_bindings(Compiler &compiler) auto &samplers = compiler.get_combined_image_samplers(); for (auto &s : samplers) { - if (compiler.has_decoration(s.image_id, spv::DecorationDescriptorSet)) + if (compiler.has_decoration(s.image_id, DecorationDescriptorSet)) { - uint32_t set = compiler.get_decoration(s.image_id, spv::DecorationDescriptorSet); - compiler.set_decoration(s.combined_id, spv::DecorationDescriptorSet, set); + uint32_t set = compiler.get_decoration(s.image_id, DecorationDescriptorSet); + compiler.set_decoration(s.combined_id, DecorationDescriptorSet, set); } - if (compiler.has_decoration(s.image_id, spv::DecorationBinding)) + if (compiler.has_decoration(s.image_id, DecorationBinding)) { - uint32_t binding = compiler.get_decoration(s.image_id, spv::DecorationBinding); - compiler.set_decoration(s.combined_id, spv::DecorationBinding, binding); + uint32_t binding = compiler.get_decoration(s.image_id, DecorationBinding); + compiler.set_decoration(s.combined_id, DecorationBinding, binding); } } } diff --git a/third_party/spirv-cross/spirv_glsl.cpp b/third_party/spirv-cross/spirv_glsl.cpp index ee8614d345..964fde5f2b 100644 --- a/third_party/spirv-cross/spirv_glsl.cpp +++ b/third_party/spirv-cross/spirv_glsl.cpp @@ -37,10 +37,13 @@ #endif #include -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; using namespace std; +namespace SPIRV_CROSS_NAMESPACE +{ + enum ExtraSubExpressionType { // Create masks above any legal ID range to allow multiple address spaces into the extra_sub_expressions map. @@ -48,6 +51,46 @@ enum ExtraSubExpressionType EXTRA_SUB_EXPRESSION_TYPE_AUX = 0x20000000 }; +struct GlslConstantNameMapping +{ + uint32_t value; + const char *alias; +}; + +#define DEF_GLSL_MAPPING(x) { x, "gl_" #x } +#define DEF_GLSL_MAPPING_EXT(x) { x##KHR, "gl_" #x } +static const GlslConstantNameMapping CoopVecComponentTypeNames[] = { + DEF_GLSL_MAPPING(ComponentTypeFloat16NV), + DEF_GLSL_MAPPING(ComponentTypeFloat32NV), + DEF_GLSL_MAPPING(ComponentTypeFloat64NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt8NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt16NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt32NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt64NV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt8NV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt16NV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt32NV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt64NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt8PackedNV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt8PackedNV), + DEF_GLSL_MAPPING(ComponentTypeFloatE4M3NV), + DEF_GLSL_MAPPING(ComponentTypeFloatE5M2NV), +}; + +static const GlslConstantNameMapping CoopVecMatrixLayoutNames[] = { + DEF_GLSL_MAPPING(CooperativeVectorMatrixLayoutRowMajorNV), + DEF_GLSL_MAPPING(CooperativeVectorMatrixLayoutColumnMajorNV), + DEF_GLSL_MAPPING(CooperativeVectorMatrixLayoutInferencingOptimalNV), + DEF_GLSL_MAPPING(CooperativeVectorMatrixLayoutTrainingOptimalNV), +}; + +static const GlslConstantNameMapping CoopMatMatrixLayoutNames[] = { + DEF_GLSL_MAPPING_EXT(CooperativeMatrixLayoutRowMajor), + DEF_GLSL_MAPPING_EXT(CooperativeMatrixLayoutColumnMajor), +}; +#undef DEF_GLSL_MAPPING +#undef DEF_GLSL_MAPPING_EXT + static bool is_unsigned_opcode(Op op) { // Don't have to be exhaustive, only relevant for legacy target checking ... @@ -159,13 +202,14 @@ static BufferPackingStandard packing_to_substruct_packing(BufferPackingStandard return packing; } } +} void CompilerGLSL::init() { - if (ir.source.known) + if (!ir.sources.empty() && ir.sources.front().known) { - options.es = ir.source.es; - options.version = ir.source.version; + options.es = ir.sources.front().es; + options.version = ir.sources.front().version; } // Query the locale to see what the decimal point is. @@ -235,7 +279,7 @@ static const char *to_pls_layout(PlsFormat format) } } -static std::pair pls_format_to_basetype(PlsFormat format) +static std::pair pls_format_to_basetype(PlsFormat format) { switch (format) { @@ -246,17 +290,17 @@ static std::pair pls_format_to_basetype(PlsFormat f case PlsRGB10A2: case PlsRGBA8: case PlsRG16: - return std::make_pair(spv::OpTypeFloat, SPIRType::Float); + return std::make_pair(OpTypeFloat, SPIRType::Float); case PlsRGBA8I: case PlsRG16I: - return std::make_pair(spv::OpTypeInt, SPIRType::Int); + return std::make_pair(OpTypeInt, SPIRType::Int); case PlsRGB10A2UI: case PlsRGBA8UI: case PlsRG16UI: case PlsR32UI: - return std::make_pair(spv::OpTypeInt, SPIRType::UInt); + return std::make_pair(OpTypeInt, SPIRType::UInt); } } @@ -622,6 +666,20 @@ void CompilerGLSL::find_static_extensions() ray_tracing_is_khr = true; break; + case CapabilityRayQueryPositionFetchKHR: + if (options.es || options.version < 460 || !options.vulkan_semantics) + SPIRV_CROSS_THROW("RayQuery Position Fetch requires Vulkan GLSL 460."); + require_extension_internal("GL_EXT_ray_tracing_position_fetch"); + ray_tracing_is_khr = true; + break; + + case CapabilityRayTracingPositionFetchKHR: + if (options.es || options.version < 460 || !options.vulkan_semantics) + SPIRV_CROSS_THROW("Ray Tracing Position Fetch requires Vulkan GLSL 460."); + require_extension_internal("GL_EXT_ray_tracing_position_fetch"); + ray_tracing_is_khr = true; + break; + case CapabilityRayTraversalPrimitiveCullingKHR: if (options.es || options.version < 460 || !options.vulkan_semantics) SPIRV_CROSS_THROW("RayQuery requires Vulkan GLSL 460."); @@ -629,6 +687,13 @@ void CompilerGLSL::find_static_extensions() ray_tracing_is_khr = true; break; + case CapabilityRayTracingClusterAccelerationStructureNV: + if (options.es || options.version < 460 || !options.vulkan_semantics) + SPIRV_CROSS_THROW("Cluster AS requires Vulkan GLSL 460."); + require_extension_internal("GL_NV_cluster_acceleration_structure"); + ray_tracing_is_khr = true; + break; + case CapabilityTensorsARM: if (options.es || options.version < 460 || !options.vulkan_semantics) SPIRV_CROSS_THROW("Tensor requires Vulkan GLSL 460."); @@ -1437,7 +1502,7 @@ string CompilerGLSL::layout_for_member(const SPIRType &type, uint32_t index) return res; } -const char *CompilerGLSL::format_to_glsl(spv::ImageFormat format) +const char *CompilerGLSL::format_to_glsl(ImageFormat format) { if (options.es && is_desktop_only_format(format)) SPIRV_CROSS_THROW("Attempting to use image format not supported in ES profile."); @@ -1702,10 +1767,32 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f { uint32_t packed_size = to_array_size_literal(type) * type_to_packed_array_stride(type, flags, packing); - // For arrays of vectors and matrices in HLSL, the last element has a size which depends on its vector size, - // so that it is possible to pack other vectors into the last element. - if (packing_is_hlsl(packing) && type.basetype != SPIRType::Struct) - packed_size -= (4 - type.vecsize) * (type.width / 8); + if (packing_is_hlsl(packing)) + { + // For arrays of vectors and matrices in HLSL, the last element has a size which depends on its vector size, + // so that it is possible to pack other vectors into the last element. + if (type.basetype != SPIRType::Struct) + { + if (flags.get(DecorationRowMajor) && type.columns > 1) + packed_size -= (4 - type.columns) * (type.width / 8); + else + packed_size -= (4 - type.vecsize) * (type.width / 8); + } + else + { + const auto *base_type = &type; + while (is_array(*base_type)) + { + auto &new_type = get(base_type->parent_type); + if (!is_array(new_type)) + break; + base_type = &new_type; + } + + packed_size -= type_to_packed_array_stride(*base_type, flags, packing); + packed_size += type_to_packed_size(get(base_type->parent_type), flags, packing); + } + } return packed_size; } @@ -1724,15 +1811,27 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f uint32_t packed_alignment = type_to_packed_alignment(member_type, member_flags, packing); uint32_t alignment = max(packed_alignment, pad_alignment); - // The next member following a struct member is aligned to the base alignment of the struct that came before. - // GL 4.5 spec, 7.6.2.2. - if (member_type.basetype == SPIRType::Struct) - pad_alignment = packed_alignment; + uint32_t element_size = type_to_packed_size(member_type, member_flags, packing); + pad_alignment = 1; + + if (packing_is_hlsl(packing)) + { + // HLSL is primarily a "cannot-straddle-vec4" language. + uint32_t begin_word = size / 16; + uint32_t end_word = (size + element_size - 1) / 16; + if (begin_word != end_word) + alignment = max(alignment, 16u); + } else - pad_alignment = 1; + { + // The next member following a struct member is aligned to the base alignment of the struct that came before. + // GL 4.5 spec, 7.6.2.2. + if (member_type.basetype == SPIRType::Struct) + pad_alignment = packed_alignment; + } size = (size + alignment - 1) & ~(alignment - 1); - size += type_to_packed_size(member_type, member_flags, packing); + size += element_size; } } else @@ -1750,9 +1849,7 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f if (flags.get(DecorationColMajor) && type.columns > 1) { - if (packing_is_vec4_padded(packing)) - size = type.columns * 4 * base_alignment; - else if (type.vecsize == 3) + if (packing_is_vec4_padded(packing) || type.vecsize == 3) size = type.columns * 4 * base_alignment; else size = type.columns * type.vecsize * base_alignment; @@ -1760,9 +1857,7 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f if (flags.get(DecorationRowMajor) && type.vecsize > 1) { - if (packing_is_vec4_padded(packing)) - size = type.vecsize * 4 * base_alignment; - else if (type.columns == 3) + if (packing_is_vec4_padded(packing) || type.columns == 3) size = type.vecsize * 4 * base_alignment; else size = type.vecsize * type.columns * base_alignment; @@ -1771,7 +1866,12 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f // For matrices in HLSL, the last element has a size which depends on its vector size, // so that it is possible to pack other vectors into the last element. if (packing_is_hlsl(packing) && type.columns > 1) - size -= (4 - type.vecsize) * (type.width / 8); + { + if (flags.get(DecorationRowMajor)) + size -= (4 - type.columns) * (type.width / 8); + else + size -= (4 - type.vecsize) * (type.width / 8); + } } } @@ -1862,7 +1962,7 @@ bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackin // The next member following a struct member is aligned to the base alignment of the struct that came before. // GL 4.5 spec, 7.6.2.2. - if (memb_type.basetype == SPIRType::Struct && !memb_type.pointer) + if (!packing_is_hlsl(packing) && memb_type.basetype == SPIRType::Struct && !memb_type.pointer) pad_alignment = packed_alignment; else pad_alignment = 1; @@ -1890,13 +1990,16 @@ bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackin } // Verify array stride rules. - if (is_array(memb_type) && - type_to_packed_array_stride(memb_type, member_flags, packing) != - type_struct_member_array_stride(type, i)) + if (is_array(memb_type)) { - if (failed_validation_index) - *failed_validation_index = i; - return false; + auto packed_array_stride = type_to_packed_array_stride(memb_type, member_flags, packing); + auto member_array_stride = type_struct_member_array_stride(type, i); + if (packed_array_stride != member_array_stride) + { + if (failed_validation_index) + *failed_validation_index = i; + return false; + } } // Verify that sub-structs also follow packing rules. @@ -2571,7 +2674,7 @@ void CompilerGLSL::emit_buffer_block_flattened(const SPIRVariable &var) SPIRV_CROSS_THROW("Basic types in a flattened UBO must be float, int or uint."); auto flags = ir.get_buffer_block_flags(var); - statement("uniform ", flags_to_qualifiers_glsl(tmp, flags), type_to_glsl(tmp), " ", buffer_name, "[", + statement("uniform ", flags_to_qualifiers_glsl(tmp, 0, flags), type_to_glsl(tmp), " ", buffer_name, "[", buffer_size, "];"); } else @@ -4285,7 +4388,7 @@ void CompilerGLSL::emit_subgroup_arithmetic_workaround(const std::string &func, } } -void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) +void CompilerGLSL::emit_extension_workarounds(ExecutionModel model) { static const char *workaround_types[] = { "int", "ivec2", "ivec3", "ivec4", "uint", "uvec2", "uvec3", "uvec4", "float", "vec2", "vec3", "vec4", "double", "dvec2", "dvec3", "dvec4" }; @@ -4604,7 +4707,7 @@ void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupMemBarrier)) { - if (model == spv::ExecutionModelGLCompute) + if (model == ExecutionModelGLCompute) { statement("#ifndef GL_KHR_shader_subgroup_basic"); statement("void subgroupMemoryBarrier() { groupMemoryBarrier(); }"); @@ -4690,7 +4793,7 @@ void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) } auto arithmetic_feature_helper = - [&](Supp::Feature feat, std::string func_name, spv::Op op, spv::GroupOperation group_op) + [&](Supp::Feature feat, std::string func_name, Op op, GroupOperation group_op) { if (shader_subgroup_supporter.is_feature_requested(feat)) { @@ -4998,10 +5101,10 @@ void CompilerGLSL::emit_polyfills(uint32_t polyfills, bool relaxed) // Returns a string representation of the ID, usable as a function arg. // Default is to simply return the expression representation fo the arg ID. // Subclasses may override to modify the return value. -string CompilerGLSL::to_func_call_arg(const SPIRFunction::Parameter &, uint32_t id) +string CompilerGLSL::to_func_call_arg(const SPIRFunction::Parameter &arg, uint32_t id) { // BDA expects pointers through function interface. - if (is_physical_pointer(expression_type(id))) + if (!arg.alias_global_variable && is_physical_or_buffer_pointer(expression_type(id))) return to_pointer_expression(id); // Make sure that we use the name of the original variable, and not the parameter alias. @@ -5812,8 +5915,22 @@ string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop) case OpCompositeExtract: { - auto expr = access_chain_internal(cop.arguments[0], &cop.arguments[1], uint32_t(cop.arguments.size() - 1), - ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, nullptr); + // Trivial vector extracts (of WorkGroupSize typically), + // punch through to the input spec constant if the composite is used as array size. + const auto *c = maybe_get(cop.arguments[0]); + + string expr; + if (c && cop.arguments.size() == 2 && c->is_used_as_array_length && + !backend.supports_spec_constant_array_size && + is_vector(get(c->constant_type))) + { + expr = to_expression(c->specialization_constant_id(0, cop.arguments[1])); + } + else + { + expr = access_chain_internal(cop.arguments[0], &cop.arguments[1], uint32_t(cop.arguments.size() - 1), + ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, nullptr); + } return expr; } @@ -5961,9 +6078,9 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, require_extension_internal("GL_EXT_null_initializer"); return backend.constant_null_initializer; } - else if (c.replicated && type.op != spv::OpTypeArray) + else if (c.replicated && type.op != OpTypeArray) { - if (type.op == spv::OpTypeMatrix) + if (type.op == OpTypeMatrix) { uint32_t num_elements = type.columns; // GLSL does not allow the replication constructor for matrices @@ -6098,7 +6215,7 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, else return join(type_to_glsl(type), "(0)"); } - else if (c.columns() == 1 && type.op != spv::OpTypeCooperativeMatrixKHR) + else if (c.columns() == 1 && type.op != OpTypeCooperativeMatrixKHR) { auto res = constant_expression_vector(c, 0); @@ -6825,10 +6942,20 @@ void CompilerGLSL::emit_uninitialized_temporary(uint32_t result_type, uint32_t r if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) initializer = join(" = ", to_zero_initialized_expression(result_type)); - statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(result_id)), initializer, ";"); + statement(flags_to_qualifiers_glsl(type, result_id, flags), variable_decl(type, to_name(result_id)), initializer, ";"); } } +bool CompilerGLSL::can_declare_inline_temporary(uint32_t id) const +{ + if (!block_temporary_hoisting && current_continue_block && !hoisted_temporaries.count(id)) + return false; + if (hoisted_temporaries.count(id)) + return false; + + return true; +} + string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id) { auto &type = get(result_type); @@ -6860,7 +6987,7 @@ string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id) // The result_id has not been made into an expression yet, so use flags interface. add_local_variable_name(result_id); auto &flags = get_decoration_bitset(result_id); - return join(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(result_id)), " = "); + return join(flags_to_qualifiers_glsl(type, result_id, flags), variable_decl(type, to_name(result_id)), " = "); } } @@ -6906,6 +7033,42 @@ SPIRExpression &CompilerGLSL::emit_op(uint32_t result_type, uint32_t result_id, } } +void CompilerGLSL::emit_transposed_op(uint32_t result_type, uint32_t result_id, const string &rhs, bool forwarding) +{ + if (forwarding && (forced_temporaries.find(result_id) == end(forced_temporaries))) + { + // Just forward it without temporary. + // If the forward is trivial, we do not force flushing to temporary for this expression. + forwarded_temporaries.insert(result_id); + auto &e = set(result_id, rhs, result_type, true); + e.need_transpose = true; + } + else if (can_declare_inline_temporary(result_id)) + { + // If expression isn't immutable, bind it to a temporary and make the new temporary immutable (they always are). + // Since the expression is transposed, we have to ensure the temporary is the transposed type. + + auto &transposed_type_id = extra_sub_expressions[result_id]; + if (!transposed_type_id) + { + auto dummy_type = get(result_type); + std::swap(dummy_type.columns, dummy_type.vecsize); + transposed_type_id = ir.increase_bound_by(1); + set(transposed_type_id, dummy_type); + } + + statement(declare_temporary(transposed_type_id, result_id), rhs, ";"); + auto &e = set(result_id, to_name(result_id), result_type, true); + e.need_transpose = true; + } + else + { + // If we cannot declare the temporary because it's already been hoisted, we don't have the + // chance to override the temporary type ourselves. Just transpose() the expression. + emit_op(result_type, result_id, join("transpose(", rhs, ")"), forwarding); + } +} + void CompilerGLSL::emit_unary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op) { bool forward = should_forward(op0); @@ -6933,7 +7096,7 @@ void CompilerGLSL::emit_binary_op(uint32_t result_type, uint32_t result_id, uint { // Various FP arithmetic opcodes such as add, sub, mul will hit this. bool force_temporary_precise = backend.support_precise_qualifier && - has_decoration(result_id, DecorationNoContraction) && + has_legacy_nocontract(result_type, result_id) && type_is_floating_point(get(result_type)); bool forward = should_forward(op0) && should_forward(op1) && !force_temporary_precise; @@ -7417,29 +7580,29 @@ string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtyp const char *type; switch (imgtype.image.dim) { - case spv::Dim1D: + case Dim1D: // Force 2D path for ES. if (options.es) type = (imgtype.image.arrayed && !options.es) ? "2DArray" : "2D"; else type = (imgtype.image.arrayed && !options.es) ? "1DArray" : "1D"; break; - case spv::Dim2D: + case Dim2D: type = (imgtype.image.arrayed && !options.es) ? "2DArray" : "2D"; break; - case spv::Dim3D: + case Dim3D: type = "3D"; break; - case spv::DimCube: + case DimCube: type = "Cube"; break; - case spv::DimRect: + case DimRect: type = "2DRect"; break; - case spv::DimBuffer: + case DimBuffer: type = "Buffer"; break; - case spv::DimSubpassData: + case DimSubpassData: type = "2D"; break; default: @@ -7482,7 +7645,7 @@ string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtyp else SPIRV_CROSS_THROW(join(op, " not allowed on depth samplers in legacy ES")); - if (imgtype.image.dim == spv::DimCube) + if (imgtype.image.dim == DimCube) return "shadowCubeNV"; } @@ -7749,7 +7912,7 @@ string CompilerGLSL::to_combined_image_sampler(VariableID image_id, VariableID s } } -bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op, const uint32_t *ops) +bool CompilerGLSL::is_supported_subgroup_op_in_opengl(Op op, const uint32_t *ops) { switch (op) { @@ -8011,19 +8174,19 @@ std::string CompilerGLSL::to_texture_op(const Instruction &i, bool sparse, bool uint32_t coord_components = 0; switch (imgtype.image.dim) { - case spv::Dim1D: + case Dim1D: coord_components = 1; break; - case spv::Dim2D: + case Dim2D: coord_components = 2; break; - case spv::Dim3D: + case Dim3D: coord_components = 3; break; - case spv::DimCube: + case DimCube: coord_components = 3; break; - case spv::DimBuffer: + case DimBuffer: coord_components = 1; break; default: @@ -9464,6 +9627,35 @@ void CompilerGLSL::emit_subgroup_op(const Instruction &i) auto int_type = to_signed_basetype(integer_width); auto uint_type = to_unsigned_basetype(integer_width); + if (options.vulkan_semantics) + { + auto &return_type = get(ops[0]); + switch (return_type.basetype) + { + case SPIRType::SByte: + case SPIRType::UByte: + require_extension_internal("GL_EXT_shader_subgroup_extended_types_int8"); + break; + + case SPIRType::Short: + case SPIRType::UShort: + require_extension_internal("GL_EXT_shader_subgroup_extended_types_int16"); + break; + + case SPIRType::Half: + require_extension_internal("GL_EXT_shader_subgroup_extended_types_float16"); + break; + + case SPIRType::Int64: + case SPIRType::UInt64: + require_extension_internal("GL_EXT_shader_subgroup_extended_types_int64"); + break; + + default: + break; + } + } + switch (op) { case OpGroupNonUniformElect: @@ -9983,9 +10175,9 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) auto model = get_entry_point().model; switch (model) { - case spv::ExecutionModelIntersectionKHR: - case spv::ExecutionModelAnyHitKHR: - case spv::ExecutionModelClosestHitKHR: + case ExecutionModelIntersectionKHR: + case ExecutionModelAnyHitKHR: + case ExecutionModelClosestHitKHR: // gl_InstanceID is allowed in these shaders. break; @@ -10317,6 +10509,22 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) case BuiltInCullPrimitiveEXT: return "gl_CullPrimitiveEXT"; + case BuiltInHitTriangleVertexPositionsKHR: + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Need Vulkan semantics for EXT_ray_tracing_position_fetch."); + require_extension_internal("GL_EXT_ray_tracing_position_fetch"); + return "gl_HitTriangleVertexPositionsEXT"; + } + + case BuiltInClusterIDNV: + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Can only use ClusterIDNV in Vulkan GLSL."); + require_extension_internal("GL_NV_cluster_acceleration_structure"); + return "gl_ClusterIDNV"; + } + default: return join("gl_BuiltIn_", convert_to_string(builtin)); } @@ -10429,7 +10637,7 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice bool dimension_flatten = false; bool access_meshlet_position_y = false; bool chain_is_builtin = false; - spv::BuiltIn chained_builtin = {}; + BuiltIn chained_builtin = {}; if (auto *base_expr = maybe_get(base)) { @@ -10560,8 +10768,8 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice if (ptr_chain_array_entry) expr = join("(", expr, ")"); } - // Arrays - else if (!type->array.empty()) + // Arrays and OpTypeCooperativeVectorNV (aka fancy arrays) + else if (!type->array.empty() || type->op == OpTypeCooperativeVectorNV) { // If we are flattening multidimensional arrays, only create opening bracket on first // array index. @@ -10960,7 +11168,7 @@ bool CompilerGLSL::check_physical_type_cast(std::string &, const SPIRType *, uin return false; } -bool CompilerGLSL::prepare_access_chain_for_scalar_access(std::string &, const SPIRType &, spv::StorageClass, bool &) +bool CompilerGLSL::prepare_access_chain_for_scalar_access(std::string &, const SPIRType &, StorageClass, bool &) { return false; } @@ -11469,7 +11677,7 @@ bool CompilerGLSL::should_dereference(uint32_t id) // If id is a variable but not a phi variable, we should not dereference it. // BDA passed around as parameters are always pointers. if (auto *var = maybe_get(id)) - return (var->parameter && is_physical_pointer(type)) || var->phi_variable; + return (var->parameter && is_physical_or_buffer_pointer(type)) || var->phi_variable; if (auto *expr = maybe_get(id)) { @@ -11505,8 +11713,8 @@ bool CompilerGLSL::should_dereference(uint32_t id) bool CompilerGLSL::should_dereference_caller_param(uint32_t id) { const auto &type = expression_type(id); - // BDA is always passed around as pointers. - if (is_physical_pointer(type)) + // BDA is always passed around as pointers. Similarly, we need to pass variable buffer pointers as pointers. + if (is_physical_or_buffer_pointer(type)) return false; return should_dereference(id); @@ -11666,7 +11874,7 @@ void CompilerGLSL::emit_variable_temporary_copies(const SPIRVariable &var) { auto &type = get(var.basetype); auto &flags = get_decoration_bitset(var.self); - statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, join("_", var.self, "_copy")), ";"); + statement(flags_to_qualifiers_glsl(type, var.self, flags), variable_decl(type, join("_", var.self, "_copy")), ";"); flushed_phi_variables.insert(var.self); } } @@ -11807,7 +12015,7 @@ string CompilerGLSL::build_composite_combiner(uint32_t return_type, const uint32 // Can only merge swizzles for vectors. auto &type = get(return_type); bool can_apply_swizzle_opt = type.basetype != SPIRType::Struct && type.array.empty() && type.columns == 1 && - type.op != spv::OpTypeCooperativeMatrixKHR; + type.op != OpTypeCooperativeMatrixKHR; bool swizzle_optimization = false; for (uint32_t i = 0; i < length; i++) @@ -12934,7 +13142,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (composite_type_is_complex) allow_base_expression = false; - if (composite_type.op == spv::OpTypeCooperativeMatrixKHR) + if (composite_type.op == OpTypeCooperativeMatrixKHR) allow_base_expression = false; // Packed expressions or physical ID mapped expressions cannot be split up. @@ -13395,8 +13603,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[3])), " * ", enclose_expression(to_unpacked_row_major_matrix_expression(ops[2]))); bool forward = should_forward(ops[2]) && should_forward(ops[3]); - auto &e = emit_op(ops[0], ops[1], expr, forward); - e.need_transpose = true; + emit_transposed_op(ops[0], ops[1], expr, forward); a->need_transpose = true; b->need_transpose = true; inherit_expression_dependencies(ops[1], ops[2]); @@ -13419,8 +13626,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[2])), " * ", to_enclosed_unpacked_expression(ops[3])); bool forward = should_forward(ops[2]) && should_forward(ops[3]); - auto &e = emit_op(ops[0], ops[1], expr, forward); - e.need_transpose = true; + emit_transposed_op(ops[0], ops[1], expr, forward); a->need_transpose = true; inherit_expression_dependencies(ops[1], ops[2]); inherit_expression_dependencies(ops[1], ops[3]); @@ -13895,8 +14101,8 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (type.op == OpTypeCooperativeMatrixKHR && opcode == OpFConvert) { auto &expr_type = expression_type(ops[2]); - if (get(type.cooperative.use_id).scalar() != - get(expr_type.cooperative.use_id).scalar()) + if (get(type.ext.cooperative.use_id).scalar() != + get(expr_type.ext.cooperative.use_id).scalar()) { // Somewhat questionable with spec constant uses. if (!options.vulkan_semantics) @@ -13906,7 +14112,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) } if ((type.basetype == SPIRType::FloatE4M3 || type.basetype == SPIRType::FloatE5M2) && - has_decoration(id, spv::DecorationSaturatedToLargestFloat8NormalConversionEXT)) + has_decoration(id, DecorationSaturatedToLargestFloat8NormalConversionEXT)) { emit_uninitialized_temporary_expression(result_type, id); statement("saturatedConvertEXT(", to_expression(id), ", ", to_unpacked_expression(ops[2]), ");"); @@ -15061,8 +15267,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) { emit_spv_amd_gcn_shader_op(ops[0], ops[1], ops[3], &ops[4], length - 4); } + else if (ext == SPIRExtension::NonSemanticShaderDebugInfo) + { + emit_non_semantic_shader_debug_info(ops[0], ops[1], ops[3], &ops[4], length - 4); + } else if (ext == SPIRExtension::SPV_debug_info || - ext == SPIRExtension::NonSemanticShaderDebugInfo || ext == SPIRExtension::NonSemanticGeneric) { break; // Ignore SPIR-V debug information extended instructions. @@ -15208,7 +15417,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) uint32_t result_type = ops[0]; uint32_t id = ops[1]; - if (type.image.dim == spv::DimSubpassData) + if (type.image.dim == DimSubpassData) { emit_unary_func_op(result_type, id, ops[2], "fragmentMaskFetchAMD"); } @@ -15227,7 +15436,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) uint32_t result_type = ops[0]; uint32_t id = ops[1]; - if (type.image.dim == spv::DimSubpassData) + if (type.image.dim == DimSubpassData) { emit_binary_func_op(result_type, id, ops[2], ops[4], "fragmentFetchAMD"); } @@ -15437,6 +15646,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) flush_variable_declaration(ops[0]); statement("rayQueryConfirmIntersectionEXT(", to_expression(ops[0]), ");"); break; + case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: + flush_variable_declaration(ops[1]); + emit_uninitialized_temporary_expression(ops[0], ops[1]); + statement("rayQueryGetIntersectionTriangleVertexPositionsEXT(", to_expression(ops[2]), ", bool(", to_expression(ops[3]), "), ", to_expression(ops[1]), ");"); + break; #define GLSL_RAY_QUERY_GET_OP(op) \ case OpRayQueryGet##op##KHR: \ flush_variable_declaration(ops[2]); \ @@ -15467,6 +15681,10 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) GLSL_RAY_QUERY_GET_OP2(IntersectionWorldToObject); #undef GLSL_RAY_QUERY_GET_OP #undef GLSL_RAY_QUERY_GET_OP2 + case OpRayQueryGetClusterIdNV: + flush_variable_declaration(ops[2]); + emit_op(ops[0], ops[1], join("rayQueryGetIntersectionClusterIdNV(", to_expression(ops[2]), ", ", "bool(", to_expression(ops[3]), "))"), false); + break; case OpTensorQuerySizeARM: flush_variable_declaration(ops[1]); // tensorSizeARM(tensor, dimension) @@ -15487,21 +15705,21 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) std::string tensor_operands; if (ops[4] == 0) tensor_operands = "0x0u"; - else if (ops[4] == spv::TensorOperandsNontemporalARMMask) + else if (ops[4] == TensorOperandsNontemporalARMMask) tensor_operands = "gl_TensorOperandsNonTemporalARM"; - else if (ops[4] == spv::TensorOperandsOutOfBoundsValueARMMask) + else if (ops[4] == TensorOperandsOutOfBoundsValueARMMask) tensor_operands = "gl_TensorOperandsOutOfBoundsValueARM"; - else if (ops[4] == (spv::TensorOperandsNontemporalARMMask | spv::TensorOperandsOutOfBoundsValueARMMask)) + else if (ops[4] == (TensorOperandsNontemporalARMMask | TensorOperandsOutOfBoundsValueARMMask)) tensor_operands = "gl_TensorOperandsNonTemporalARM | gl_TensorOperandsOutOfBoundsValueARM"; else SPIRV_CROSS_THROW("Invalid tensorOperands for tensorReadARM."); - if ((ops[4] & spv::TensorOperandsOutOfBoundsValueARMMask) && length != 6) + if ((ops[4] & TensorOperandsOutOfBoundsValueARMMask) && length != 6) SPIRV_CROSS_THROW("gl_TensorOperandsOutOfBoundsValueARM requires an outOfBoundsValue argument."); args.push_back(tensor_operands); // tensorOperands } if (length >= 6) { - if ((length > 6) || (ops[4] & spv::TensorOperandsOutOfBoundsValueARMMask) == 0) + if ((length > 6) || (ops[4] & TensorOperandsOutOfBoundsValueARMMask) == 0) SPIRV_CROSS_THROW("Too many arguments to tensorReadARM."); args.push_back(to_expression(ops[5])); // outOfBoundsValue } @@ -15525,7 +15743,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) std::string tensor_operands; if (ops[3] == 0) tensor_operands = "0x0u"; - else if (ops[3] == spv::TensorOperandsNontemporalARMMask) + else if (ops[3] == TensorOperandsNontemporalARMMask) tensor_operands = "gl_TensorOperandsNonTemporalARM"; else SPIRV_CROSS_THROW("Invalid tensorOperands for tensorWriteARM."); @@ -15683,6 +15901,104 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) break; } + case OpCooperativeVectorLoadNV: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + emit_uninitialized_temporary_expression(result_type, id); + + statement("coopVecLoadNV(", to_expression(id), ", ", to_expression(ops[2]), ", ", to_expression(ops[3]), ");"); + register_read(id, ops[2], false); + break; + } + + case OpCooperativeVectorStoreNV: + { + uint32_t id = ops[0]; + + statement("coopVecStoreNV(", to_expression(ops[2]), ", ", to_expression(id), ", ", to_expression(ops[1]), ");"); + register_write(ops[2]); + break; + } + + case OpCooperativeVectorOuterProductAccumulateNV: + { + auto buf = ops[0]; + auto offset = ops[1]; + auto v1 = ops[2]; + auto v2 = ops[3]; + auto matrix_layout_id = ops[4]; + auto matrix_iterpretation_id = ops[5]; + auto matrix_stride_id = length >= 6 ? ops[6] : 0; + statement(join("coopVecOuterProductAccumulateNV(", to_expression(v1), ", ", to_expression(v2), ", ", + to_expression(buf), ", ", to_expression(offset), ", ", + matrix_stride_id ? to_expression(matrix_stride_id) : "0", + ", ", to_pretty_expression_if_int_constant( + matrix_layout_id, std::begin(CoopVecMatrixLayoutNames), std::end(CoopVecMatrixLayoutNames)), + ", ", to_pretty_expression_if_int_constant( + matrix_iterpretation_id, std::begin(CoopVecComponentTypeNames), std::end(CoopVecComponentTypeNames)), + ");")); + register_write(ops[0]); + break; + } + + case OpCooperativeVectorReduceSumAccumulateNV: + { + auto buf = ops[0]; + auto offset = ops[1]; + auto v1 = ops[2]; + statement(join("coopVecReduceSumAccumulateNV(", to_expression(v1), ", ", to_expression(buf), ", ", + to_expression(offset), ");")); + register_write(ops[0]); + break; + } + + case OpCooperativeVectorMatrixMulNV: + case OpCooperativeVectorMatrixMulAddNV: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + emit_uninitialized_temporary_expression(result_type, id); + + std::string stmt; + switch (opcode) + { + case OpCooperativeVectorMatrixMulAddNV: + stmt += "coopVecMatMulAddNV("; + break; + case OpCooperativeVectorMatrixMulNV: + stmt += "coopVecMatMulNV("; + break; + default: + SPIRV_CROSS_THROW("Invalid op code for coopvec instruction."); + } + for (uint32_t i = 1; i < length; i++) + { + // arguments 3, 6 and in case of MulAddNv also 9 use component type int constants + if (i == 3 || i == 6 || (i == 9 && opcode == OpCooperativeVectorMatrixMulAddNV)) + { + stmt += to_pretty_expression_if_int_constant( + ops[i], std::begin(CoopVecComponentTypeNames), std::end(CoopVecComponentTypeNames)); + } + else if ((i == 12 && opcode == OpCooperativeVectorMatrixMulAddNV) || + (i == 9 && opcode == OpCooperativeVectorMatrixMulNV)) + { + stmt += to_pretty_expression_if_int_constant( + ops[i], std::begin(CoopVecMatrixLayoutNames), std::end(CoopVecMatrixLayoutNames)); + } + else + stmt += to_expression(ops[i]); + + if (i < length - 1) + stmt += ", "; + } + stmt += ");"; + statement(stmt); + break; + } + case OpCooperativeMatrixLengthKHR: { // Need to synthesize a dummy temporary, since the SPIR-V opcode is based on the type. @@ -15710,27 +16026,10 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (!is_forcing_recompilation()) split_expr = split_coopmat_pointer(expr); - string layout_expr; - if (const auto *layout = maybe_get(ops[3])) - { - if (!layout->specialization) - { - if (layout->scalar() == spv::CooperativeMatrixLayoutColumnMajorKHR) - layout_expr = "gl_CooperativeMatrixLayoutColumnMajor"; - else - layout_expr = "gl_CooperativeMatrixLayoutRowMajor"; - } - } - - if (layout_expr.empty()) - layout_expr = join("int(", to_expression(ops[3]), ")"); - - statement("coopMatLoad(", - to_expression(id), ", ", - split_expr.first, ", ", - split_expr.second, ", ", - to_expression(ops[4]), ", ", - layout_expr, ");"); + string layout_expr = to_pretty_expression_if_int_constant( + ops[3], std::begin(CoopMatMatrixLayoutNames), std::end(CoopMatMatrixLayoutNames)); + statement("coopMatLoad(", to_expression(id), ", ", split_expr.first, ", ", split_expr.second, ", ", + to_expression(ops[4]), ", ", layout_expr, ");"); register_read(id, ops[2], false); break; @@ -15750,27 +16049,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (!is_forcing_recompilation()) split_expr = split_coopmat_pointer(expr); - string layout_expr; - if (const auto *layout = maybe_get(ops[2])) - { - if (!layout->specialization) - { - if (layout->scalar() == spv::CooperativeMatrixLayoutColumnMajorKHR) - layout_expr = "gl_CooperativeMatrixLayoutColumnMajor"; - else - layout_expr = "gl_CooperativeMatrixLayoutRowMajor"; - } - } + string layout_expr = to_pretty_expression_if_int_constant( + ops[2], std::begin(CoopMatMatrixLayoutNames), std::end(CoopMatMatrixLayoutNames)); - if (layout_expr.empty()) - layout_expr = join("int(", to_expression(ops[2]), ")"); - - statement("coopMatStore(", - to_expression(ops[1]), ", ", - split_expr.first, ", ", - split_expr.second, ", ", - to_expression(ops[3]), ", ", - layout_expr, ");"); + statement("coopMatStore(", to_expression(ops[1]), ", ", split_expr.first, ", ", split_expr.second, ", ", + to_expression(ops[3]), ", ", layout_expr, ");"); // TODO: Do we care about memory operands? @@ -15810,15 +16093,15 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) auto value_to_replicate = to_expression(ops[2]); std::string rhs; // Matrices don't have a replicating constructor for vectors. Need to manually replicate - if (type.op == spv::OpTypeMatrix || type.op == spv::OpTypeArray) + if (type.op == OpTypeMatrix || type.op == OpTypeArray) { - if (type.op == spv::OpTypeArray && type.array.size() != 1) + if (type.op == OpTypeArray && type.array.size() != 1) { SPIRV_CROSS_THROW( "Multi-dimensional arrays currently not supported for OpCompositeConstructReplicateEXT"); } - uint32_t num_elements = type.op == spv::OpTypeMatrix ? type.columns : type.array[0]; - if (backend.use_initializer_list && type.op == spv::OpTypeArray) + uint32_t num_elements = type.op == OpTypeMatrix ? type.columns : type.array[0]; + if (backend.use_initializer_list && type.op == OpTypeArray) { rhs += "{"; } @@ -15833,7 +16116,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (i < num_elements - 1) rhs += ", "; } - if (backend.use_initializer_list && type.op == spv::OpTypeArray) + if (backend.use_initializer_list && type.op == OpTypeArray) rhs += "}"; else rhs += ")"; @@ -16063,7 +16346,7 @@ void CompilerGLSL::emit_struct_member(const SPIRType &type, uint32_t member_type if (is_block) qualifiers = to_interpolation_qualifiers(memberflags); - statement(layout_for_member(type, index), qualifiers, qualifier, flags_to_qualifiers_glsl(membertype, memberflags), + statement(layout_for_member(type, index), qualifiers, qualifier, flags_to_qualifiers_glsl(membertype, 0, memberflags), variable_decl(membertype, to_member_name(type, index)), ";"); } @@ -16071,7 +16354,7 @@ void CompilerGLSL::emit_struct_padding_target(const SPIRType &) { } -string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, const Bitset &flags) +string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, uint32_t id, const Bitset &flags) { // GL_EXT_buffer_reference variables can be marked as restrict. if (flags.get(DecorationRestrictPointerEXT)) @@ -16079,8 +16362,12 @@ string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, const Bitset string qual; - if (type_is_floating_point(type) && flags.get(DecorationNoContraction) && backend.support_precise_qualifier) + if (type_is_floating_point(type) && + (flags.get(DecorationNoContraction) || (type.self && has_legacy_nocontract(type.self, id))) && + backend.support_precise_qualifier) + { qual = "precise "; + } // Structs do not have precision qualifiers, neither do doubles (desktop only anyways, so no mediump/highp). bool type_supports_precision = @@ -16149,7 +16436,7 @@ string CompilerGLSL::to_precision_qualifiers_glsl(uint32_t id) if (result_type.width < 32) return "mediump "; } - return flags_to_qualifiers_glsl(type, ir.meta[id].decoration.decoration_flags); + return flags_to_qualifiers_glsl(type, id, ir.meta[id].decoration.decoration_flags); } void CompilerGLSL::fixup_io_block_patch_primitive_qualifiers(const SPIRVariable &var) @@ -16674,12 +16961,12 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) return "rayQueryEXT"; case SPIRType::Tensor: - if (type.tensor.rank == 0) + if (type.ext.tensor.rank == 0) SPIRV_CROSS_THROW("GLSL tensors must have a Rank."); - if (type.tensor.shape != 0) + if (type.ext.tensor.shape != 0) SPIRV_CROSS_THROW("GLSL tensors cannot have a Shape."); - return join("tensorARM<", type_to_glsl(get(type.tensor.type)), ", ", - to_expression(type.tensor.rank), ">"); + return join("tensorARM<", type_to_glsl(get(type.ext.tensor.type)), ", ", + to_expression(type.ext.tensor.rank), ">"); case SPIRType::Void: return "void"; @@ -16708,17 +16995,28 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) require_extension_internal("GL_ARB_shader_atomic_counters"); } + if (type.op == OpTypeCooperativeVectorNV) + { + require_extension_internal("GL_NV_cooperative_vector"); + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Cooperative vector NV only available in Vulkan."); + + std::string component_type_str = type_to_glsl(get(type.ext.coopVecNV.component_type_id)); + + return join("coopvecNV<", component_type_str, ", ", to_expression(type.ext.coopVecNV.component_count_id), ">"); + } + const SPIRType *coop_type = &type; while (is_pointer(*coop_type) || is_array(*coop_type)) coop_type = &get(coop_type->parent_type); - if (coop_type->op == spv::OpTypeCooperativeMatrixKHR) + if (coop_type->op == OpTypeCooperativeMatrixKHR) { require_extension_internal("GL_KHR_cooperative_matrix"); if (!options.vulkan_semantics) SPIRV_CROSS_THROW("Cooperative matrix only available in Vulkan."); // GLSL doesn't support this as spec constant, which makes sense ... - uint32_t use_type = get(coop_type->cooperative.use_id).scalar(); + uint32_t use_type = get(coop_type->ext.cooperative.use_id).scalar(); const char *use = nullptr; switch (use_type) @@ -16740,14 +17038,14 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) } string scope_expr; - if (const auto *scope = maybe_get(coop_type->cooperative.scope_id)) + if (const auto *scope = maybe_get(coop_type->ext.cooperative.scope_id)) { if (!scope->specialization) { require_extension_internal("GL_KHR_memory_scope_semantics"); - if (scope->scalar() == spv::ScopeSubgroup) + if (scope->scalar() == ScopeSubgroup) scope_expr = "gl_ScopeSubgroup"; - else if (scope->scalar() == spv::ScopeWorkgroup) + else if (scope->scalar() == ScopeWorkgroup) scope_expr = "gl_ScopeWorkgroup"; else SPIRV_CROSS_THROW("Invalid scope for cooperative matrix."); @@ -16755,12 +17053,12 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) } if (scope_expr.empty()) - scope_expr = to_expression(coop_type->cooperative.scope_id); + scope_expr = to_expression(coop_type->ext.cooperative.scope_id); return join("coopmat<", type_to_glsl(get(coop_type->parent_type)), ", ", scope_expr, ", ", - to_expression(coop_type->cooperative.rows_id), ", ", - to_expression(coop_type->cooperative.columns_id), ", ", use, ">"); + to_expression(coop_type->ext.cooperative.rows_id), ", ", + to_expression(coop_type->ext.cooperative.columns_id), ", ", use, ">"); } if (type.vecsize == 1 && type.columns == 1) // Scalar builtin @@ -16979,7 +17277,7 @@ void CompilerGLSL::flatten_buffer_block(VariableID id) flattened_buffer_blocks.insert(id); } -bool CompilerGLSL::builtin_translates_to_nonarray(spv::BuiltIn /*builtin*/) const +bool CompilerGLSL::builtin_translates_to_nonarray(BuiltIn /*builtin*/) const { return false; // GLSL itself does not need to translate array builtin types to non-array builtin types } @@ -17024,7 +17322,7 @@ void CompilerGLSL::add_function_overload(const SPIRFunction &func) uint32_t type_id = get_pointee_type_id(arg.type); // Workaround glslang bug. It seems to only consider the base type when resolving overloads. - if (get(type_id).op == spv::OpTypeCooperativeMatrixKHR) + if (get(type_id).op == OpTypeCooperativeMatrixKHR) type_id = get(type_id).parent_type; auto &type = get(type_id); @@ -17083,7 +17381,7 @@ void CompilerGLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret string decl; auto &type = get(func.return_type); - decl += flags_to_qualifiers_glsl(type, return_flags); + decl += flags_to_qualifiers_glsl(type, 0, return_flags); decl += type_to_glsl(type); decl += type_to_array_glsl(type, 0); decl += " "; @@ -17941,7 +18239,7 @@ void CompilerGLSL::emit_hoisted_temporaries(SmallVector> &tempo if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) initializer = join(" = ", to_zero_initialized_expression(tmp.first)); - statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(tmp.second)), initializer, ";"); + statement(flags_to_qualifiers_glsl(type, tmp.second, flags), variable_decl(type, to_name(tmp.second)), initializer, ";"); hoisted_temporaries.insert(tmp.second); forced_temporaries.insert(tmp.second); @@ -17956,7 +18254,7 @@ void CompilerGLSL::emit_hoisted_temporaries(SmallVector> &tempo { uint32_t mirror_id = mirrored_precision_itr->second; auto &mirror_flags = get_decoration_bitset(mirror_id); - statement(flags_to_qualifiers_glsl(type, mirror_flags), + statement(flags_to_qualifiers_glsl(type, mirror_id, mirror_flags), variable_decl(type, to_name(mirror_id)), initializer, ";"); // The temporary might be read from before it's assigned, set up the expression now. @@ -17967,6 +18265,26 @@ void CompilerGLSL::emit_hoisted_temporaries(SmallVector> &tempo } void CompilerGLSL::emit_block_chain(SPIRBlock &block) +{ + SmallVector cleanup_stack; + BlockID next_block = emit_block_chain_inner(block); + + while (next_block != 0) + { + cleanup_stack.push_back(next_block); + next_block = emit_block_chain_inner(get(next_block)); + } + + while (!cleanup_stack.empty()) + { + emit_block_chain_cleanup(get(cleanup_stack.back())); + cleanup_stack.pop_back(); + } + + emit_block_chain_cleanup(block); +} + +BlockID CompilerGLSL::emit_block_chain_inner(SPIRBlock &block) { bool select_branch_to_true_block = false; bool select_branch_to_false_block = false; @@ -18017,12 +18335,13 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) } // Remember deferred declaration state. We will restore it before returning. - SmallVector rearm_dominated_variables(block.dominated_variables.size()); + assert(block.rearm_dominated_variables.empty()); + block.rearm_dominated_variables.resize(block.dominated_variables.size()); for (size_t i = 0; i < block.dominated_variables.size(); i++) { uint32_t var_id = block.dominated_variables[i]; auto &var = get(var_id); - rearm_dominated_variables[i] = var.deferred_declaration; + block.rearm_dominated_variables[i] = var.deferred_declaration; } // This is the method often used by spirv-opt to implement loops. @@ -18615,6 +18934,8 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) SPIRV_CROSS_THROW("Unimplemented block terminator."); } + BlockID trailing_block_id = 0; + if (block.next_block && emit_next_block) { // If we hit this case, we're dealing with an unconditional branch, which means we will output @@ -18622,8 +18943,10 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) if (block.merge != SPIRBlock::MergeSelection) { flush_phi(block.self, block.next_block); + // For a direct branch, need to remember to invalidate expressions in the next linear block instead. - get(block.next_block).invalidate_expressions = block.invalidate_expressions; + get(block.next_block).invalidate_expressions.clear(); + std::swap(get(block.next_block).invalidate_expressions, block.invalidate_expressions); } // For switch fallthrough cases, we terminate the chain here, but we still need to handle Phi. @@ -18644,7 +18967,15 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) branch_to_continue(block.self, block.next_block); } else if (BlockID(block.self) != block.next_block) - emit_block_chain(get(block.next_block)); + { + // Recursing here is quite scary since it's quite easy to stack overflow if + // the SPIR-V is constructed a particular way. + // We have to simulate the tail call ourselves. + if (block.merge != SPIRBlock::MergeLoop) + trailing_block_id = block.next_block; + else + emit_block_chain(get(block.next_block)); + } } } @@ -18686,20 +19017,28 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) if (is_continue(block.merge_block)) branch_to_continue(block.self, block.merge_block); else - emit_block_chain(get(block.merge_block)); + trailing_block_id = block.merge_block; } + return trailing_block_id; +} + +void CompilerGLSL::emit_block_chain_cleanup(SPIRBlock &block) +{ // Forget about control dependent expressions now. block.invalidate_expressions.clear(); - // After we return, we must be out of scope, so if we somehow have to re-emit this function, + // After we return, we must be out of scope, so if we somehow have to re-emit this block, // re-declare variables if necessary. - assert(rearm_dominated_variables.size() == block.dominated_variables.size()); + // We only need one array here for rearm_dominated_variables, + // since it should be impossible for the same block to be remitted in the same chain twice. + assert(block.rearm_dominated_variables.size() == block.dominated_variables.size()); for (size_t i = 0; i < block.dominated_variables.size(); i++) { uint32_t var = block.dominated_variables[i]; - get(var).deferred_declaration = rearm_dominated_variables[i]; + get(var).deferred_declaration = block.rearm_dominated_variables[i]; } + block.rearm_dominated_variables.clear(); // Just like for deferred declaration, we need to forget about loop variable enable // if our block chain is reinstantiated later. @@ -19241,6 +19580,34 @@ void CompilerGLSL::emit_line_directive(uint32_t file_id, uint32_t line_literal) } } +void CompilerGLSL::emit_non_semantic_shader_debug_info(uint32_t, uint32_t result_id, uint32_t eop, + const uint32_t *args, uint32_t) +{ + if (!options.emit_line_directives) + return; + + switch (eop) + { + case SPIRExtension::DebugLine: + { + // We're missing line end and columns here, but I don't think we can emit those in any meaningful way. + emit_line_directive(args[0], get(args[1]).scalar()); + break; + } + + case SPIRExtension::DebugSource: + { + // Forward the string declaration here. We ignore the optional text operand. + auto &str = get(args[0]).str; + set(result_id, str); + break; + } + + default: + break; + } +} + void CompilerGLSL::emit_copy_logical_type(uint32_t lhs_id, uint32_t lhs_type_id, uint32_t rhs_id, uint32_t rhs_type_id, SmallVector chain) { @@ -19776,7 +20143,7 @@ bool CompilerGLSL::is_stage_output_location_masked(uint32_t location, uint32_t c return masked_output_locations.count({ location, component }) != 0; } -bool CompilerGLSL::is_stage_output_builtin_masked(spv::BuiltIn builtin) const +bool CompilerGLSL::is_stage_output_builtin_masked(BuiltIn builtin) const { return masked_output_builtins.count(builtin) != 0; } @@ -19880,3 +20247,96 @@ std::string CompilerGLSL::format_double(double value) const return convert_to_string(value, current_locale_radix_character); } +std::string CompilerGLSL::to_pretty_expression_if_int_constant( + uint32_t id, + const GlslConstantNameMapping *mapping_start, const GlslConstantNameMapping *mapping_end, + bool register_expression_read) +{ + auto *c = maybe_get(id); + if (c && !c->specialization) + { + auto value = c->scalar(); + auto pretty_name = std::find_if(mapping_start, mapping_end, + [value](const GlslConstantNameMapping &mapping) { return mapping.value == value; }); + if (pretty_name != mapping_end) + return pretty_name->alias; + } + return join("int(", to_expression(id, register_expression_read), ")"); +} + +uint32_t CompilerGLSL::get_fp_fast_math_flags_for_op(uint32_t result_type, uint32_t id) const +{ + uint32_t fp_flags = ~0; + + if (!type_is_floating_point(get(result_type))) + return fp_flags; + + auto &ep = get_entry_point(); + + // Per-operation flag supersedes all defaults. + if (id != 0 && has_decoration(id, DecorationFPFastMathMode)) + return get_decoration(id, DecorationFPFastMathMode); + + // Handle float_controls1 execution modes. + uint32_t width = get(result_type).width; + + bool szinp = false; + + switch (width) + { + case 8: + szinp = ep.signed_zero_inf_nan_preserve_8; + break; + + case 16: + szinp = ep.signed_zero_inf_nan_preserve_16; + break; + + case 32: + szinp = ep.signed_zero_inf_nan_preserve_32; + break; + + case 64: + szinp = ep.signed_zero_inf_nan_preserve_64; + break; + + default: + break; + } + + if (szinp) + fp_flags &= ~(FPFastMathModeNSZMask | FPFastMathModeNotInfMask | FPFastMathModeNotNaNMask); + + // Legacy NoContraction deals with any kind of transform to the expression. + if (id != 0 && has_decoration(id, DecorationNoContraction)) + fp_flags &= ~(FPFastMathModeAllowContractMask | FPFastMathModeAllowTransformMask | FPFastMathModeAllowReassocMask); + + // Handle float_controls2 execution modes. + bool found_default = false; + for (auto &fp_pair : ep.fp_fast_math_defaults) + { + if (get(fp_pair.first).width == width && fp_pair.second) + { + fp_flags &= get(fp_pair.second).scalar(); + found_default = true; + } + } + + // From SPV_KHR_float_controls2: + // "This definition implies that, if the entry point set any FPFastMathDefault execution mode + // then any type for which a default is not set uses no fast math flags + // (although this can still be overridden on a per-operation basis). + // Modules must not mix setting fast math modes explicitly using this extension and relying on older API defaults." + if (!found_default && !ep.fp_fast_math_defaults.empty()) + fp_flags = 0; + + return fp_flags; +} + +bool CompilerGLSL::has_legacy_nocontract(uint32_t result_type, uint32_t id) const +{ + const auto fp_flags = FPFastMathModeAllowContractMask | + FPFastMathModeAllowTransformMask | + FPFastMathModeAllowReassocMask; + return (get_fp_fast_math_flags_for_op(result_type, id) & fp_flags) != fp_flags; +} diff --git a/third_party/spirv-cross/spirv_glsl.cpp.orig b/third_party/spirv-cross/spirv_glsl.cpp.orig index 8a3c21da68..90fa14be95 100644 --- a/third_party/spirv-cross/spirv_glsl.cpp.orig +++ b/third_party/spirv-cross/spirv_glsl.cpp.orig @@ -37,10 +37,13 @@ #endif #include -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; using namespace std; +namespace SPIRV_CROSS_NAMESPACE +{ + enum ExtraSubExpressionType { // Create masks above any legal ID range to allow multiple address spaces into the extra_sub_expressions map. @@ -48,6 +51,46 @@ enum ExtraSubExpressionType EXTRA_SUB_EXPRESSION_TYPE_AUX = 0x20000000 }; +struct GlslConstantNameMapping +{ + uint32_t value; + const char *alias; +}; + +#define DEF_GLSL_MAPPING(x) { x, "gl_" #x } +#define DEF_GLSL_MAPPING_EXT(x) { x##KHR, "gl_" #x } +static const GlslConstantNameMapping CoopVecComponentTypeNames[] = { + DEF_GLSL_MAPPING(ComponentTypeFloat16NV), + DEF_GLSL_MAPPING(ComponentTypeFloat32NV), + DEF_GLSL_MAPPING(ComponentTypeFloat64NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt8NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt16NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt32NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt64NV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt8NV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt16NV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt32NV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt64NV), + DEF_GLSL_MAPPING(ComponentTypeSignedInt8PackedNV), + DEF_GLSL_MAPPING(ComponentTypeUnsignedInt8PackedNV), + DEF_GLSL_MAPPING(ComponentTypeFloatE4M3NV), + DEF_GLSL_MAPPING(ComponentTypeFloatE5M2NV), +}; + +static const GlslConstantNameMapping CoopVecMatrixLayoutNames[] = { + DEF_GLSL_MAPPING(CooperativeVectorMatrixLayoutRowMajorNV), + DEF_GLSL_MAPPING(CooperativeVectorMatrixLayoutColumnMajorNV), + DEF_GLSL_MAPPING(CooperativeVectorMatrixLayoutInferencingOptimalNV), + DEF_GLSL_MAPPING(CooperativeVectorMatrixLayoutTrainingOptimalNV), +}; + +static const GlslConstantNameMapping CoopMatMatrixLayoutNames[] = { + DEF_GLSL_MAPPING_EXT(CooperativeMatrixLayoutRowMajor), + DEF_GLSL_MAPPING_EXT(CooperativeMatrixLayoutColumnMajor), +}; +#undef DEF_GLSL_MAPPING +#undef DEF_GLSL_MAPPING_EXT + static bool is_unsigned_opcode(Op op) { // Don't have to be exhaustive, only relevant for legacy target checking ... @@ -159,13 +202,14 @@ static BufferPackingStandard packing_to_substruct_packing(BufferPackingStandard return packing; } } +} void CompilerGLSL::init() { - if (ir.source.known) + if (!ir.sources.empty() && ir.sources.front().known) { - options.es = ir.source.es; - options.version = ir.source.version; + options.es = ir.sources.front().es; + options.version = ir.sources.front().version; } // Query the locale to see what the decimal point is. @@ -223,7 +267,7 @@ static const char *to_pls_layout(PlsFormat format) } } -static std::pair pls_format_to_basetype(PlsFormat format) +static std::pair pls_format_to_basetype(PlsFormat format) { switch (format) { @@ -234,17 +278,17 @@ static std::pair pls_format_to_basetype(PlsFormat f case PlsRGB10A2: case PlsRGBA8: case PlsRG16: - return std::make_pair(spv::OpTypeFloat, SPIRType::Float); + return std::make_pair(OpTypeFloat, SPIRType::Float); case PlsRGBA8I: case PlsRG16I: - return std::make_pair(spv::OpTypeInt, SPIRType::Int); + return std::make_pair(OpTypeInt, SPIRType::Int); case PlsRGB10A2UI: case PlsRGBA8UI: case PlsRG16UI: case PlsR32UI: - return std::make_pair(spv::OpTypeInt, SPIRType::UInt); + return std::make_pair(OpTypeInt, SPIRType::UInt); } } @@ -610,6 +654,20 @@ void CompilerGLSL::find_static_extensions() ray_tracing_is_khr = true; break; + case CapabilityRayQueryPositionFetchKHR: + if (options.es || options.version < 460 || !options.vulkan_semantics) + SPIRV_CROSS_THROW("RayQuery Position Fetch requires Vulkan GLSL 460."); + require_extension_internal("GL_EXT_ray_tracing_position_fetch"); + ray_tracing_is_khr = true; + break; + + case CapabilityRayTracingPositionFetchKHR: + if (options.es || options.version < 460 || !options.vulkan_semantics) + SPIRV_CROSS_THROW("Ray Tracing Position Fetch requires Vulkan GLSL 460."); + require_extension_internal("GL_EXT_ray_tracing_position_fetch"); + ray_tracing_is_khr = true; + break; + case CapabilityRayTraversalPrimitiveCullingKHR: if (options.es || options.version < 460 || !options.vulkan_semantics) SPIRV_CROSS_THROW("RayQuery requires Vulkan GLSL 460."); @@ -617,6 +675,13 @@ void CompilerGLSL::find_static_extensions() ray_tracing_is_khr = true; break; + case CapabilityRayTracingClusterAccelerationStructureNV: + if (options.es || options.version < 460 || !options.vulkan_semantics) + SPIRV_CROSS_THROW("Cluster AS requires Vulkan GLSL 460."); + require_extension_internal("GL_NV_cluster_acceleration_structure"); + ray_tracing_is_khr = true; + break; + case CapabilityTensorsARM: if (options.es || options.version < 460 || !options.vulkan_semantics) SPIRV_CROSS_THROW("Tensor requires Vulkan GLSL 460."); @@ -1425,7 +1490,7 @@ string CompilerGLSL::layout_for_member(const SPIRType &type, uint32_t index) return res; } -const char *CompilerGLSL::format_to_glsl(spv::ImageFormat format) +const char *CompilerGLSL::format_to_glsl(ImageFormat format) { if (options.es && is_desktop_only_format(format)) SPIRV_CROSS_THROW("Attempting to use image format not supported in ES profile."); @@ -1690,10 +1755,32 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f { uint32_t packed_size = to_array_size_literal(type) * type_to_packed_array_stride(type, flags, packing); - // For arrays of vectors and matrices in HLSL, the last element has a size which depends on its vector size, - // so that it is possible to pack other vectors into the last element. - if (packing_is_hlsl(packing) && type.basetype != SPIRType::Struct) - packed_size -= (4 - type.vecsize) * (type.width / 8); + if (packing_is_hlsl(packing)) + { + // For arrays of vectors and matrices in HLSL, the last element has a size which depends on its vector size, + // so that it is possible to pack other vectors into the last element. + if (type.basetype != SPIRType::Struct) + { + if (flags.get(DecorationRowMajor) && type.columns > 1) + packed_size -= (4 - type.columns) * (type.width / 8); + else + packed_size -= (4 - type.vecsize) * (type.width / 8); + } + else + { + const auto *base_type = &type; + while (is_array(*base_type)) + { + auto &new_type = get(base_type->parent_type); + if (!is_array(new_type)) + break; + base_type = &new_type; + } + + packed_size -= type_to_packed_array_stride(*base_type, flags, packing); + packed_size += type_to_packed_size(get(base_type->parent_type), flags, packing); + } + } return packed_size; } @@ -1712,15 +1799,27 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f uint32_t packed_alignment = type_to_packed_alignment(member_type, member_flags, packing); uint32_t alignment = max(packed_alignment, pad_alignment); - // The next member following a struct member is aligned to the base alignment of the struct that came before. - // GL 4.5 spec, 7.6.2.2. - if (member_type.basetype == SPIRType::Struct) - pad_alignment = packed_alignment; + uint32_t element_size = type_to_packed_size(member_type, member_flags, packing); + pad_alignment = 1; + + if (packing_is_hlsl(packing)) + { + // HLSL is primarily a "cannot-straddle-vec4" language. + uint32_t begin_word = size / 16; + uint32_t end_word = (size + element_size - 1) / 16; + if (begin_word != end_word) + alignment = max(alignment, 16u); + } else - pad_alignment = 1; + { + // The next member following a struct member is aligned to the base alignment of the struct that came before. + // GL 4.5 spec, 7.6.2.2. + if (member_type.basetype == SPIRType::Struct) + pad_alignment = packed_alignment; + } size = (size + alignment - 1) & ~(alignment - 1); - size += type_to_packed_size(member_type, member_flags, packing); + size += element_size; } } else @@ -1738,9 +1837,7 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f if (flags.get(DecorationColMajor) && type.columns > 1) { - if (packing_is_vec4_padded(packing)) - size = type.columns * 4 * base_alignment; - else if (type.vecsize == 3) + if (packing_is_vec4_padded(packing) || type.vecsize == 3) size = type.columns * 4 * base_alignment; else size = type.columns * type.vecsize * base_alignment; @@ -1748,9 +1845,7 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f if (flags.get(DecorationRowMajor) && type.vecsize > 1) { - if (packing_is_vec4_padded(packing)) - size = type.vecsize * 4 * base_alignment; - else if (type.columns == 3) + if (packing_is_vec4_padded(packing) || type.columns == 3) size = type.vecsize * 4 * base_alignment; else size = type.vecsize * type.columns * base_alignment; @@ -1759,7 +1854,12 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f // For matrices in HLSL, the last element has a size which depends on its vector size, // so that it is possible to pack other vectors into the last element. if (packing_is_hlsl(packing) && type.columns > 1) - size -= (4 - type.vecsize) * (type.width / 8); + { + if (flags.get(DecorationRowMajor)) + size -= (4 - type.columns) * (type.width / 8); + else + size -= (4 - type.vecsize) * (type.width / 8); + } } } @@ -1850,7 +1950,7 @@ bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackin // The next member following a struct member is aligned to the base alignment of the struct that came before. // GL 4.5 spec, 7.6.2.2. - if (memb_type.basetype == SPIRType::Struct && !memb_type.pointer) + if (!packing_is_hlsl(packing) && memb_type.basetype == SPIRType::Struct && !memb_type.pointer) pad_alignment = packed_alignment; else pad_alignment = 1; @@ -1878,13 +1978,16 @@ bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackin } // Verify array stride rules. - if (is_array(memb_type) && - type_to_packed_array_stride(memb_type, member_flags, packing) != - type_struct_member_array_stride(type, i)) + if (is_array(memb_type)) { - if (failed_validation_index) - *failed_validation_index = i; - return false; + auto packed_array_stride = type_to_packed_array_stride(memb_type, member_flags, packing); + auto member_array_stride = type_struct_member_array_stride(type, i); + if (packed_array_stride != member_array_stride) + { + if (failed_validation_index) + *failed_validation_index = i; + return false; + } } // Verify that sub-structs also follow packing rules. @@ -2559,7 +2662,7 @@ void CompilerGLSL::emit_buffer_block_flattened(const SPIRVariable &var) SPIRV_CROSS_THROW("Basic types in a flattened UBO must be float, int or uint."); auto flags = ir.get_buffer_block_flags(var); - statement("uniform ", flags_to_qualifiers_glsl(tmp, flags), type_to_glsl(tmp), " ", buffer_name, "[", + statement("uniform ", flags_to_qualifiers_glsl(tmp, 0, flags), type_to_glsl(tmp), " ", buffer_name, "[", buffer_size, "];"); } else @@ -4273,7 +4376,7 @@ void CompilerGLSL::emit_subgroup_arithmetic_workaround(const std::string &func, } } -void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) +void CompilerGLSL::emit_extension_workarounds(ExecutionModel model) { static const char *workaround_types[] = { "int", "ivec2", "ivec3", "ivec4", "uint", "uvec2", "uvec3", "uvec4", "float", "vec2", "vec3", "vec4", "double", "dvec2", "dvec3", "dvec4" }; @@ -4592,7 +4695,7 @@ void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupMemBarrier)) { - if (model == spv::ExecutionModelGLCompute) + if (model == ExecutionModelGLCompute) { statement("#ifndef GL_KHR_shader_subgroup_basic"); statement("void subgroupMemoryBarrier() { groupMemoryBarrier(); }"); @@ -4678,7 +4781,7 @@ void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) } auto arithmetic_feature_helper = - [&](Supp::Feature feat, std::string func_name, spv::Op op, spv::GroupOperation group_op) + [&](Supp::Feature feat, std::string func_name, Op op, GroupOperation group_op) { if (shader_subgroup_supporter.is_feature_requested(feat)) { @@ -4986,10 +5089,10 @@ void CompilerGLSL::emit_polyfills(uint32_t polyfills, bool relaxed) // Returns a string representation of the ID, usable as a function arg. // Default is to simply return the expression representation fo the arg ID. // Subclasses may override to modify the return value. -string CompilerGLSL::to_func_call_arg(const SPIRFunction::Parameter &, uint32_t id) +string CompilerGLSL::to_func_call_arg(const SPIRFunction::Parameter &arg, uint32_t id) { // BDA expects pointers through function interface. - if (is_physical_pointer(expression_type(id))) + if (!arg.alias_global_variable && is_physical_or_buffer_pointer(expression_type(id))) return to_pointer_expression(id); // Make sure that we use the name of the original variable, and not the parameter alias. @@ -5800,8 +5903,22 @@ string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop) case OpCompositeExtract: { - auto expr = access_chain_internal(cop.arguments[0], &cop.arguments[1], uint32_t(cop.arguments.size() - 1), - ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, nullptr); + // Trivial vector extracts (of WorkGroupSize typically), + // punch through to the input spec constant if the composite is used as array size. + const auto *c = maybe_get(cop.arguments[0]); + + string expr; + if (c && cop.arguments.size() == 2 && c->is_used_as_array_length && + !backend.supports_spec_constant_array_size && + is_vector(get(c->constant_type))) + { + expr = to_expression(c->specialization_constant_id(0, cop.arguments[1])); + } + else + { + expr = access_chain_internal(cop.arguments[0], &cop.arguments[1], uint32_t(cop.arguments.size() - 1), + ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, nullptr); + } return expr; } @@ -5949,9 +6066,9 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, require_extension_internal("GL_EXT_null_initializer"); return backend.constant_null_initializer; } - else if (c.replicated && type.op != spv::OpTypeArray) + else if (c.replicated && type.op != OpTypeArray) { - if (type.op == spv::OpTypeMatrix) + if (type.op == OpTypeMatrix) { uint32_t num_elements = type.columns; // GLSL does not allow the replication constructor for matrices @@ -6086,7 +6203,7 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, else return join(type_to_glsl(type), "(0)"); } - else if (c.columns() == 1 && type.op != spv::OpTypeCooperativeMatrixKHR) + else if (c.columns() == 1 && type.op != OpTypeCooperativeMatrixKHR) { auto res = constant_expression_vector(c, 0); @@ -6813,10 +6930,20 @@ void CompilerGLSL::emit_uninitialized_temporary(uint32_t result_type, uint32_t r if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) initializer = join(" = ", to_zero_initialized_expression(result_type)); - statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(result_id)), initializer, ";"); + statement(flags_to_qualifiers_glsl(type, result_id, flags), variable_decl(type, to_name(result_id)), initializer, ";"); } } +bool CompilerGLSL::can_declare_inline_temporary(uint32_t id) const +{ + if (!block_temporary_hoisting && current_continue_block && !hoisted_temporaries.count(id)) + return false; + if (hoisted_temporaries.count(id)) + return false; + + return true; +} + string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id) { auto &type = get(result_type); @@ -6848,7 +6975,7 @@ string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id) // The result_id has not been made into an expression yet, so use flags interface. add_local_variable_name(result_id); auto &flags = get_decoration_bitset(result_id); - return join(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(result_id)), " = "); + return join(flags_to_qualifiers_glsl(type, result_id, flags), variable_decl(type, to_name(result_id)), " = "); } } @@ -6894,6 +7021,42 @@ SPIRExpression &CompilerGLSL::emit_op(uint32_t result_type, uint32_t result_id, } } +void CompilerGLSL::emit_transposed_op(uint32_t result_type, uint32_t result_id, const string &rhs, bool forwarding) +{ + if (forwarding && (forced_temporaries.find(result_id) == end(forced_temporaries))) + { + // Just forward it without temporary. + // If the forward is trivial, we do not force flushing to temporary for this expression. + forwarded_temporaries.insert(result_id); + auto &e = set(result_id, rhs, result_type, true); + e.need_transpose = true; + } + else if (can_declare_inline_temporary(result_id)) + { + // If expression isn't immutable, bind it to a temporary and make the new temporary immutable (they always are). + // Since the expression is transposed, we have to ensure the temporary is the transposed type. + + auto &transposed_type_id = extra_sub_expressions[result_id]; + if (!transposed_type_id) + { + auto dummy_type = get(result_type); + std::swap(dummy_type.columns, dummy_type.vecsize); + transposed_type_id = ir.increase_bound_by(1); + set(transposed_type_id, dummy_type); + } + + statement(declare_temporary(transposed_type_id, result_id), rhs, ";"); + auto &e = set(result_id, to_name(result_id), result_type, true); + e.need_transpose = true; + } + else + { + // If we cannot declare the temporary because it's already been hoisted, we don't have the + // chance to override the temporary type ourselves. Just transpose() the expression. + emit_op(result_type, result_id, join("transpose(", rhs, ")"), forwarding); + } +} + void CompilerGLSL::emit_unary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op) { bool forward = should_forward(op0); @@ -6921,7 +7084,7 @@ void CompilerGLSL::emit_binary_op(uint32_t result_type, uint32_t result_id, uint { // Various FP arithmetic opcodes such as add, sub, mul will hit this. bool force_temporary_precise = backend.support_precise_qualifier && - has_decoration(result_id, DecorationNoContraction) && + has_legacy_nocontract(result_type, result_id) && type_is_floating_point(get(result_type)); bool forward = should_forward(op0) && should_forward(op1) && !force_temporary_precise; @@ -7405,29 +7568,29 @@ string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtyp const char *type; switch (imgtype.image.dim) { - case spv::Dim1D: + case Dim1D: // Force 2D path for ES. if (options.es) type = (imgtype.image.arrayed && !options.es) ? "2DArray" : "2D"; else type = (imgtype.image.arrayed && !options.es) ? "1DArray" : "1D"; break; - case spv::Dim2D: + case Dim2D: type = (imgtype.image.arrayed && !options.es) ? "2DArray" : "2D"; break; - case spv::Dim3D: + case Dim3D: type = "3D"; break; - case spv::DimCube: + case DimCube: type = "Cube"; break; - case spv::DimRect: + case DimRect: type = "2DRect"; break; - case spv::DimBuffer: + case DimBuffer: type = "Buffer"; break; - case spv::DimSubpassData: + case DimSubpassData: type = "2D"; break; default: @@ -7470,7 +7633,7 @@ string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtyp else SPIRV_CROSS_THROW(join(op, " not allowed on depth samplers in legacy ES")); - if (imgtype.image.dim == spv::DimCube) + if (imgtype.image.dim == DimCube) return "shadowCubeNV"; } @@ -7737,7 +7900,7 @@ string CompilerGLSL::to_combined_image_sampler(VariableID image_id, VariableID s } } -bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op, const uint32_t *ops) +bool CompilerGLSL::is_supported_subgroup_op_in_opengl(Op op, const uint32_t *ops) { switch (op) { @@ -7999,19 +8162,19 @@ std::string CompilerGLSL::to_texture_op(const Instruction &i, bool sparse, bool uint32_t coord_components = 0; switch (imgtype.image.dim) { - case spv::Dim1D: + case Dim1D: coord_components = 1; break; - case spv::Dim2D: + case Dim2D: coord_components = 2; break; - case spv::Dim3D: + case Dim3D: coord_components = 3; break; - case spv::DimCube: + case DimCube: coord_components = 3; break; - case spv::DimBuffer: + case DimBuffer: coord_components = 1; break; default: @@ -9452,6 +9615,35 @@ void CompilerGLSL::emit_subgroup_op(const Instruction &i) auto int_type = to_signed_basetype(integer_width); auto uint_type = to_unsigned_basetype(integer_width); + if (options.vulkan_semantics) + { + auto &return_type = get(ops[0]); + switch (return_type.basetype) + { + case SPIRType::SByte: + case SPIRType::UByte: + require_extension_internal("GL_EXT_shader_subgroup_extended_types_int8"); + break; + + case SPIRType::Short: + case SPIRType::UShort: + require_extension_internal("GL_EXT_shader_subgroup_extended_types_int16"); + break; + + case SPIRType::Half: + require_extension_internal("GL_EXT_shader_subgroup_extended_types_float16"); + break; + + case SPIRType::Int64: + case SPIRType::UInt64: + require_extension_internal("GL_EXT_shader_subgroup_extended_types_int64"); + break; + + default: + break; + } + } + switch (op) { case OpGroupNonUniformElect: @@ -9971,9 +10163,9 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) auto model = get_entry_point().model; switch (model) { - case spv::ExecutionModelIntersectionKHR: - case spv::ExecutionModelAnyHitKHR: - case spv::ExecutionModelClosestHitKHR: + case ExecutionModelIntersectionKHR: + case ExecutionModelAnyHitKHR: + case ExecutionModelClosestHitKHR: // gl_InstanceID is allowed in these shaders. break; @@ -10305,6 +10497,22 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) case BuiltInCullPrimitiveEXT: return "gl_CullPrimitiveEXT"; + case BuiltInHitTriangleVertexPositionsKHR: + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Need Vulkan semantics for EXT_ray_tracing_position_fetch."); + require_extension_internal("GL_EXT_ray_tracing_position_fetch"); + return "gl_HitTriangleVertexPositionsEXT"; + } + + case BuiltInClusterIDNV: + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Can only use ClusterIDNV in Vulkan GLSL."); + require_extension_internal("GL_NV_cluster_acceleration_structure"); + return "gl_ClusterIDNV"; + } + default: return join("gl_BuiltIn_", convert_to_string(builtin)); } @@ -10417,7 +10625,7 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice bool dimension_flatten = false; bool access_meshlet_position_y = false; bool chain_is_builtin = false; - spv::BuiltIn chained_builtin = {}; + BuiltIn chained_builtin = {}; if (auto *base_expr = maybe_get(base)) { @@ -10548,8 +10756,8 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice if (ptr_chain_array_entry) expr = join("(", expr, ")"); } - // Arrays - else if (!type->array.empty()) + // Arrays and OpTypeCooperativeVectorNV (aka fancy arrays) + else if (!type->array.empty() || type->op == OpTypeCooperativeVectorNV) { // If we are flattening multidimensional arrays, only create opening bracket on first // array index. @@ -10948,7 +11156,7 @@ bool CompilerGLSL::check_physical_type_cast(std::string &, const SPIRType *, uin return false; } -bool CompilerGLSL::prepare_access_chain_for_scalar_access(std::string &, const SPIRType &, spv::StorageClass, bool &) +bool CompilerGLSL::prepare_access_chain_for_scalar_access(std::string &, const SPIRType &, StorageClass, bool &) { return false; } @@ -11457,7 +11665,7 @@ bool CompilerGLSL::should_dereference(uint32_t id) // If id is a variable but not a phi variable, we should not dereference it. // BDA passed around as parameters are always pointers. if (auto *var = maybe_get(id)) - return (var->parameter && is_physical_pointer(type)) || var->phi_variable; + return (var->parameter && is_physical_or_buffer_pointer(type)) || var->phi_variable; if (auto *expr = maybe_get(id)) { @@ -11493,8 +11701,8 @@ bool CompilerGLSL::should_dereference(uint32_t id) bool CompilerGLSL::should_dereference_caller_param(uint32_t id) { const auto &type = expression_type(id); - // BDA is always passed around as pointers. - if (is_physical_pointer(type)) + // BDA is always passed around as pointers. Similarly, we need to pass variable buffer pointers as pointers. + if (is_physical_or_buffer_pointer(type)) return false; return should_dereference(id); @@ -11654,7 +11862,7 @@ void CompilerGLSL::emit_variable_temporary_copies(const SPIRVariable &var) { auto &type = get(var.basetype); auto &flags = get_decoration_bitset(var.self); - statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, join("_", var.self, "_copy")), ";"); + statement(flags_to_qualifiers_glsl(type, var.self, flags), variable_decl(type, join("_", var.self, "_copy")), ";"); flushed_phi_variables.insert(var.self); } } @@ -11795,7 +12003,7 @@ string CompilerGLSL::build_composite_combiner(uint32_t return_type, const uint32 // Can only merge swizzles for vectors. auto &type = get(return_type); bool can_apply_swizzle_opt = type.basetype != SPIRType::Struct && type.array.empty() && type.columns == 1 && - type.op != spv::OpTypeCooperativeMatrixKHR; + type.op != OpTypeCooperativeMatrixKHR; bool swizzle_optimization = false; for (uint32_t i = 0; i < length; i++) @@ -12922,7 +13130,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (composite_type_is_complex) allow_base_expression = false; - if (composite_type.op == spv::OpTypeCooperativeMatrixKHR) + if (composite_type.op == OpTypeCooperativeMatrixKHR) allow_base_expression = false; // Packed expressions or physical ID mapped expressions cannot be split up. @@ -13383,8 +13591,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[3])), " * ", enclose_expression(to_unpacked_row_major_matrix_expression(ops[2]))); bool forward = should_forward(ops[2]) && should_forward(ops[3]); - auto &e = emit_op(ops[0], ops[1], expr, forward); - e.need_transpose = true; + emit_transposed_op(ops[0], ops[1], expr, forward); a->need_transpose = true; b->need_transpose = true; inherit_expression_dependencies(ops[1], ops[2]); @@ -13407,8 +13614,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[2])), " * ", to_enclosed_unpacked_expression(ops[3])); bool forward = should_forward(ops[2]) && should_forward(ops[3]); - auto &e = emit_op(ops[0], ops[1], expr, forward); - e.need_transpose = true; + emit_transposed_op(ops[0], ops[1], expr, forward); a->need_transpose = true; inherit_expression_dependencies(ops[1], ops[2]); inherit_expression_dependencies(ops[1], ops[3]); @@ -13883,8 +14089,8 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (type.op == OpTypeCooperativeMatrixKHR && opcode == OpFConvert) { auto &expr_type = expression_type(ops[2]); - if (get(type.cooperative.use_id).scalar() != - get(expr_type.cooperative.use_id).scalar()) + if (get(type.ext.cooperative.use_id).scalar() != + get(expr_type.ext.cooperative.use_id).scalar()) { // Somewhat questionable with spec constant uses. if (!options.vulkan_semantics) @@ -13894,7 +14100,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) } if ((type.basetype == SPIRType::FloatE4M3 || type.basetype == SPIRType::FloatE5M2) && - has_decoration(id, spv::DecorationSaturatedToLargestFloat8NormalConversionEXT)) + has_decoration(id, DecorationSaturatedToLargestFloat8NormalConversionEXT)) { emit_uninitialized_temporary_expression(result_type, id); statement("saturatedConvertEXT(", to_expression(id), ", ", to_unpacked_expression(ops[2]), ");"); @@ -15049,8 +15255,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) { emit_spv_amd_gcn_shader_op(ops[0], ops[1], ops[3], &ops[4], length - 4); } + else if (ext == SPIRExtension::NonSemanticShaderDebugInfo) + { + emit_non_semantic_shader_debug_info(ops[0], ops[1], ops[3], &ops[4], length - 4); + } else if (ext == SPIRExtension::SPV_debug_info || - ext == SPIRExtension::NonSemanticShaderDebugInfo || ext == SPIRExtension::NonSemanticGeneric) { break; // Ignore SPIR-V debug information extended instructions. @@ -15196,7 +15405,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) uint32_t result_type = ops[0]; uint32_t id = ops[1]; - if (type.image.dim == spv::DimSubpassData) + if (type.image.dim == DimSubpassData) { emit_unary_func_op(result_type, id, ops[2], "fragmentMaskFetchAMD"); } @@ -15215,7 +15424,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) uint32_t result_type = ops[0]; uint32_t id = ops[1]; - if (type.image.dim == spv::DimSubpassData) + if (type.image.dim == DimSubpassData) { emit_binary_func_op(result_type, id, ops[2], ops[4], "fragmentFetchAMD"); } @@ -15425,6 +15634,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) flush_variable_declaration(ops[0]); statement("rayQueryConfirmIntersectionEXT(", to_expression(ops[0]), ");"); break; + case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: + flush_variable_declaration(ops[1]); + emit_uninitialized_temporary_expression(ops[0], ops[1]); + statement("rayQueryGetIntersectionTriangleVertexPositionsEXT(", to_expression(ops[2]), ", bool(", to_expression(ops[3]), "), ", to_expression(ops[1]), ");"); + break; #define GLSL_RAY_QUERY_GET_OP(op) \ case OpRayQueryGet##op##KHR: \ flush_variable_declaration(ops[2]); \ @@ -15455,6 +15669,10 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) GLSL_RAY_QUERY_GET_OP2(IntersectionWorldToObject); #undef GLSL_RAY_QUERY_GET_OP #undef GLSL_RAY_QUERY_GET_OP2 + case OpRayQueryGetClusterIdNV: + flush_variable_declaration(ops[2]); + emit_op(ops[0], ops[1], join("rayQueryGetIntersectionClusterIdNV(", to_expression(ops[2]), ", ", "bool(", to_expression(ops[3]), "))"), false); + break; case OpTensorQuerySizeARM: flush_variable_declaration(ops[1]); // tensorSizeARM(tensor, dimension) @@ -15475,21 +15693,21 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) std::string tensor_operands; if (ops[4] == 0) tensor_operands = "0x0u"; - else if (ops[4] == spv::TensorOperandsNontemporalARMMask) + else if (ops[4] == TensorOperandsNontemporalARMMask) tensor_operands = "gl_TensorOperandsNonTemporalARM"; - else if (ops[4] == spv::TensorOperandsOutOfBoundsValueARMMask) + else if (ops[4] == TensorOperandsOutOfBoundsValueARMMask) tensor_operands = "gl_TensorOperandsOutOfBoundsValueARM"; - else if (ops[4] == (spv::TensorOperandsNontemporalARMMask | spv::TensorOperandsOutOfBoundsValueARMMask)) + else if (ops[4] == (TensorOperandsNontemporalARMMask | TensorOperandsOutOfBoundsValueARMMask)) tensor_operands = "gl_TensorOperandsNonTemporalARM | gl_TensorOperandsOutOfBoundsValueARM"; else SPIRV_CROSS_THROW("Invalid tensorOperands for tensorReadARM."); - if ((ops[4] & spv::TensorOperandsOutOfBoundsValueARMMask) && length != 6) + if ((ops[4] & TensorOperandsOutOfBoundsValueARMMask) && length != 6) SPIRV_CROSS_THROW("gl_TensorOperandsOutOfBoundsValueARM requires an outOfBoundsValue argument."); args.push_back(tensor_operands); // tensorOperands } if (length >= 6) { - if ((length > 6) || (ops[4] & spv::TensorOperandsOutOfBoundsValueARMMask) == 0) + if ((length > 6) || (ops[4] & TensorOperandsOutOfBoundsValueARMMask) == 0) SPIRV_CROSS_THROW("Too many arguments to tensorReadARM."); args.push_back(to_expression(ops[5])); // outOfBoundsValue } @@ -15513,7 +15731,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) std::string tensor_operands; if (ops[3] == 0) tensor_operands = "0x0u"; - else if (ops[3] == spv::TensorOperandsNontemporalARMMask) + else if (ops[3] == TensorOperandsNontemporalARMMask) tensor_operands = "gl_TensorOperandsNonTemporalARM"; else SPIRV_CROSS_THROW("Invalid tensorOperands for tensorWriteARM."); @@ -15671,6 +15889,104 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) break; } + case OpCooperativeVectorLoadNV: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + emit_uninitialized_temporary_expression(result_type, id); + + statement("coopVecLoadNV(", to_expression(id), ", ", to_expression(ops[2]), ", ", to_expression(ops[3]), ");"); + register_read(id, ops[2], false); + break; + } + + case OpCooperativeVectorStoreNV: + { + uint32_t id = ops[0]; + + statement("coopVecStoreNV(", to_expression(ops[2]), ", ", to_expression(id), ", ", to_expression(ops[1]), ");"); + register_write(ops[2]); + break; + } + + case OpCooperativeVectorOuterProductAccumulateNV: + { + auto buf = ops[0]; + auto offset = ops[1]; + auto v1 = ops[2]; + auto v2 = ops[3]; + auto matrix_layout_id = ops[4]; + auto matrix_iterpretation_id = ops[5]; + auto matrix_stride_id = length >= 6 ? ops[6] : 0; + statement(join("coopVecOuterProductAccumulateNV(", to_expression(v1), ", ", to_expression(v2), ", ", + to_expression(buf), ", ", to_expression(offset), ", ", + matrix_stride_id ? to_expression(matrix_stride_id) : "0", + ", ", to_pretty_expression_if_int_constant( + matrix_layout_id, std::begin(CoopVecMatrixLayoutNames), std::end(CoopVecMatrixLayoutNames)), + ", ", to_pretty_expression_if_int_constant( + matrix_iterpretation_id, std::begin(CoopVecComponentTypeNames), std::end(CoopVecComponentTypeNames)), + ");")); + register_write(ops[0]); + break; + } + + case OpCooperativeVectorReduceSumAccumulateNV: + { + auto buf = ops[0]; + auto offset = ops[1]; + auto v1 = ops[2]; + statement(join("coopVecReduceSumAccumulateNV(", to_expression(v1), ", ", to_expression(buf), ", ", + to_expression(offset), ");")); + register_write(ops[0]); + break; + } + + case OpCooperativeVectorMatrixMulNV: + case OpCooperativeVectorMatrixMulAddNV: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + emit_uninitialized_temporary_expression(result_type, id); + + std::string stmt; + switch (opcode) + { + case OpCooperativeVectorMatrixMulAddNV: + stmt += "coopVecMatMulAddNV("; + break; + case OpCooperativeVectorMatrixMulNV: + stmt += "coopVecMatMulNV("; + break; + default: + SPIRV_CROSS_THROW("Invalid op code for coopvec instruction."); + } + for (uint32_t i = 1; i < length; i++) + { + // arguments 3, 6 and in case of MulAddNv also 9 use component type int constants + if (i == 3 || i == 6 || (i == 9 && opcode == OpCooperativeVectorMatrixMulAddNV)) + { + stmt += to_pretty_expression_if_int_constant( + ops[i], std::begin(CoopVecComponentTypeNames), std::end(CoopVecComponentTypeNames)); + } + else if ((i == 12 && opcode == OpCooperativeVectorMatrixMulAddNV) || + (i == 9 && opcode == OpCooperativeVectorMatrixMulNV)) + { + stmt += to_pretty_expression_if_int_constant( + ops[i], std::begin(CoopVecMatrixLayoutNames), std::end(CoopVecMatrixLayoutNames)); + } + else + stmt += to_expression(ops[i]); + + if (i < length - 1) + stmt += ", "; + } + stmt += ");"; + statement(stmt); + break; + } + case OpCooperativeMatrixLengthKHR: { // Need to synthesize a dummy temporary, since the SPIR-V opcode is based on the type. @@ -15698,27 +16014,10 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (!is_forcing_recompilation()) split_expr = split_coopmat_pointer(expr); - string layout_expr; - if (const auto *layout = maybe_get(ops[3])) - { - if (!layout->specialization) - { - if (layout->scalar() == spv::CooperativeMatrixLayoutColumnMajorKHR) - layout_expr = "gl_CooperativeMatrixLayoutColumnMajor"; - else - layout_expr = "gl_CooperativeMatrixLayoutRowMajor"; - } - } - - if (layout_expr.empty()) - layout_expr = join("int(", to_expression(ops[3]), ")"); - - statement("coopMatLoad(", - to_expression(id), ", ", - split_expr.first, ", ", - split_expr.second, ", ", - to_expression(ops[4]), ", ", - layout_expr, ");"); + string layout_expr = to_pretty_expression_if_int_constant( + ops[3], std::begin(CoopMatMatrixLayoutNames), std::end(CoopMatMatrixLayoutNames)); + statement("coopMatLoad(", to_expression(id), ", ", split_expr.first, ", ", split_expr.second, ", ", + to_expression(ops[4]), ", ", layout_expr, ");"); register_read(id, ops[2], false); break; @@ -15738,27 +16037,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (!is_forcing_recompilation()) split_expr = split_coopmat_pointer(expr); - string layout_expr; - if (const auto *layout = maybe_get(ops[2])) - { - if (!layout->specialization) - { - if (layout->scalar() == spv::CooperativeMatrixLayoutColumnMajorKHR) - layout_expr = "gl_CooperativeMatrixLayoutColumnMajor"; - else - layout_expr = "gl_CooperativeMatrixLayoutRowMajor"; - } - } + string layout_expr = to_pretty_expression_if_int_constant( + ops[2], std::begin(CoopMatMatrixLayoutNames), std::end(CoopMatMatrixLayoutNames)); - if (layout_expr.empty()) - layout_expr = join("int(", to_expression(ops[2]), ")"); - - statement("coopMatStore(", - to_expression(ops[1]), ", ", - split_expr.first, ", ", - split_expr.second, ", ", - to_expression(ops[3]), ", ", - layout_expr, ");"); + statement("coopMatStore(", to_expression(ops[1]), ", ", split_expr.first, ", ", split_expr.second, ", ", + to_expression(ops[3]), ", ", layout_expr, ");"); // TODO: Do we care about memory operands? @@ -15798,15 +16081,15 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) auto value_to_replicate = to_expression(ops[2]); std::string rhs; // Matrices don't have a replicating constructor for vectors. Need to manually replicate - if (type.op == spv::OpTypeMatrix || type.op == spv::OpTypeArray) + if (type.op == OpTypeMatrix || type.op == OpTypeArray) { - if (type.op == spv::OpTypeArray && type.array.size() != 1) + if (type.op == OpTypeArray && type.array.size() != 1) { SPIRV_CROSS_THROW( "Multi-dimensional arrays currently not supported for OpCompositeConstructReplicateEXT"); } - uint32_t num_elements = type.op == spv::OpTypeMatrix ? type.columns : type.array[0]; - if (backend.use_initializer_list && type.op == spv::OpTypeArray) + uint32_t num_elements = type.op == OpTypeMatrix ? type.columns : type.array[0]; + if (backend.use_initializer_list && type.op == OpTypeArray) { rhs += "{"; } @@ -15821,7 +16104,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (i < num_elements - 1) rhs += ", "; } - if (backend.use_initializer_list && type.op == spv::OpTypeArray) + if (backend.use_initializer_list && type.op == OpTypeArray) rhs += "}"; else rhs += ")"; @@ -16051,7 +16334,7 @@ void CompilerGLSL::emit_struct_member(const SPIRType &type, uint32_t member_type if (is_block) qualifiers = to_interpolation_qualifiers(memberflags); - statement(layout_for_member(type, index), qualifiers, qualifier, flags_to_qualifiers_glsl(membertype, memberflags), + statement(layout_for_member(type, index), qualifiers, qualifier, flags_to_qualifiers_glsl(membertype, 0, memberflags), variable_decl(membertype, to_member_name(type, index)), ";"); } @@ -16059,7 +16342,7 @@ void CompilerGLSL::emit_struct_padding_target(const SPIRType &) { } -string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, const Bitset &flags) +string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, uint32_t id, const Bitset &flags) { // GL_EXT_buffer_reference variables can be marked as restrict. if (flags.get(DecorationRestrictPointerEXT)) @@ -16067,8 +16350,12 @@ string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, const Bitset string qual; - if (type_is_floating_point(type) && flags.get(DecorationNoContraction) && backend.support_precise_qualifier) + if (type_is_floating_point(type) && + (flags.get(DecorationNoContraction) || (type.self && has_legacy_nocontract(type.self, id))) && + backend.support_precise_qualifier) + { qual = "precise "; + } // Structs do not have precision qualifiers, neither do doubles (desktop only anyways, so no mediump/highp). bool type_supports_precision = @@ -16137,7 +16424,7 @@ string CompilerGLSL::to_precision_qualifiers_glsl(uint32_t id) if (result_type.width < 32) return "mediump "; } - return flags_to_qualifiers_glsl(type, ir.meta[id].decoration.decoration_flags); + return flags_to_qualifiers_glsl(type, id, ir.meta[id].decoration.decoration_flags); } void CompilerGLSL::fixup_io_block_patch_primitive_qualifiers(const SPIRVariable &var) @@ -16662,12 +16949,12 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) return "rayQueryEXT"; case SPIRType::Tensor: - if (type.tensor.rank == 0) + if (type.ext.tensor.rank == 0) SPIRV_CROSS_THROW("GLSL tensors must have a Rank."); - if (type.tensor.shape != 0) + if (type.ext.tensor.shape != 0) SPIRV_CROSS_THROW("GLSL tensors cannot have a Shape."); - return join("tensorARM<", type_to_glsl(get(type.tensor.type)), ", ", - to_expression(type.tensor.rank), ">"); + return join("tensorARM<", type_to_glsl(get(type.ext.tensor.type)), ", ", + to_expression(type.ext.tensor.rank), ">"); case SPIRType::Void: return "void"; @@ -16696,17 +16983,28 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) require_extension_internal("GL_ARB_shader_atomic_counters"); } + if (type.op == OpTypeCooperativeVectorNV) + { + require_extension_internal("GL_NV_cooperative_vector"); + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Cooperative vector NV only available in Vulkan."); + + std::string component_type_str = type_to_glsl(get(type.ext.coopVecNV.component_type_id)); + + return join("coopvecNV<", component_type_str, ", ", to_expression(type.ext.coopVecNV.component_count_id), ">"); + } + const SPIRType *coop_type = &type; while (is_pointer(*coop_type) || is_array(*coop_type)) coop_type = &get(coop_type->parent_type); - if (coop_type->op == spv::OpTypeCooperativeMatrixKHR) + if (coop_type->op == OpTypeCooperativeMatrixKHR) { require_extension_internal("GL_KHR_cooperative_matrix"); if (!options.vulkan_semantics) SPIRV_CROSS_THROW("Cooperative matrix only available in Vulkan."); // GLSL doesn't support this as spec constant, which makes sense ... - uint32_t use_type = get(coop_type->cooperative.use_id).scalar(); + uint32_t use_type = get(coop_type->ext.cooperative.use_id).scalar(); const char *use = nullptr; switch (use_type) @@ -16728,14 +17026,14 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) } string scope_expr; - if (const auto *scope = maybe_get(coop_type->cooperative.scope_id)) + if (const auto *scope = maybe_get(coop_type->ext.cooperative.scope_id)) { if (!scope->specialization) { require_extension_internal("GL_KHR_memory_scope_semantics"); - if (scope->scalar() == spv::ScopeSubgroup) + if (scope->scalar() == ScopeSubgroup) scope_expr = "gl_ScopeSubgroup"; - else if (scope->scalar() == spv::ScopeWorkgroup) + else if (scope->scalar() == ScopeWorkgroup) scope_expr = "gl_ScopeWorkgroup"; else SPIRV_CROSS_THROW("Invalid scope for cooperative matrix."); @@ -16743,12 +17041,12 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) } if (scope_expr.empty()) - scope_expr = to_expression(coop_type->cooperative.scope_id); + scope_expr = to_expression(coop_type->ext.cooperative.scope_id); return join("coopmat<", type_to_glsl(get(coop_type->parent_type)), ", ", scope_expr, ", ", - to_expression(coop_type->cooperative.rows_id), ", ", - to_expression(coop_type->cooperative.columns_id), ", ", use, ">"); + to_expression(coop_type->ext.cooperative.rows_id), ", ", + to_expression(coop_type->ext.cooperative.columns_id), ", ", use, ">"); } if (type.vecsize == 1 && type.columns == 1) // Scalar builtin @@ -16967,7 +17265,7 @@ void CompilerGLSL::flatten_buffer_block(VariableID id) flattened_buffer_blocks.insert(id); } -bool CompilerGLSL::builtin_translates_to_nonarray(spv::BuiltIn /*builtin*/) const +bool CompilerGLSL::builtin_translates_to_nonarray(BuiltIn /*builtin*/) const { return false; // GLSL itself does not need to translate array builtin types to non-array builtin types } @@ -17012,7 +17310,7 @@ void CompilerGLSL::add_function_overload(const SPIRFunction &func) uint32_t type_id = get_pointee_type_id(arg.type); // Workaround glslang bug. It seems to only consider the base type when resolving overloads. - if (get(type_id).op == spv::OpTypeCooperativeMatrixKHR) + if (get(type_id).op == OpTypeCooperativeMatrixKHR) type_id = get(type_id).parent_type; auto &type = get(type_id); @@ -17071,7 +17369,7 @@ void CompilerGLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret string decl; auto &type = get(func.return_type); - decl += flags_to_qualifiers_glsl(type, return_flags); + decl += flags_to_qualifiers_glsl(type, 0, return_flags); decl += type_to_glsl(type); decl += type_to_array_glsl(type, 0); decl += " "; @@ -17929,7 +18227,7 @@ void CompilerGLSL::emit_hoisted_temporaries(SmallVector> &tempo if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) initializer = join(" = ", to_zero_initialized_expression(tmp.first)); - statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(tmp.second)), initializer, ";"); + statement(flags_to_qualifiers_glsl(type, tmp.second, flags), variable_decl(type, to_name(tmp.second)), initializer, ";"); hoisted_temporaries.insert(tmp.second); forced_temporaries.insert(tmp.second); @@ -17944,7 +18242,7 @@ void CompilerGLSL::emit_hoisted_temporaries(SmallVector> &tempo { uint32_t mirror_id = mirrored_precision_itr->second; auto &mirror_flags = get_decoration_bitset(mirror_id); - statement(flags_to_qualifiers_glsl(type, mirror_flags), + statement(flags_to_qualifiers_glsl(type, mirror_id, mirror_flags), variable_decl(type, to_name(mirror_id)), initializer, ";"); // The temporary might be read from before it's assigned, set up the expression now. @@ -17955,6 +18253,26 @@ void CompilerGLSL::emit_hoisted_temporaries(SmallVector> &tempo } void CompilerGLSL::emit_block_chain(SPIRBlock &block) +{ + SmallVector cleanup_stack; + BlockID next_block = emit_block_chain_inner(block); + + while (next_block != 0) + { + cleanup_stack.push_back(next_block); + next_block = emit_block_chain_inner(get(next_block)); + } + + while (!cleanup_stack.empty()) + { + emit_block_chain_cleanup(get(cleanup_stack.back())); + cleanup_stack.pop_back(); + } + + emit_block_chain_cleanup(block); +} + +BlockID CompilerGLSL::emit_block_chain_inner(SPIRBlock &block) { bool select_branch_to_true_block = false; bool select_branch_to_false_block = false; @@ -18005,12 +18323,13 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) } // Remember deferred declaration state. We will restore it before returning. - SmallVector rearm_dominated_variables(block.dominated_variables.size()); + assert(block.rearm_dominated_variables.empty()); + block.rearm_dominated_variables.resize(block.dominated_variables.size()); for (size_t i = 0; i < block.dominated_variables.size(); i++) { uint32_t var_id = block.dominated_variables[i]; auto &var = get(var_id); - rearm_dominated_variables[i] = var.deferred_declaration; + block.rearm_dominated_variables[i] = var.deferred_declaration; } // This is the method often used by spirv-opt to implement loops. @@ -18603,6 +18922,8 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) SPIRV_CROSS_THROW("Unimplemented block terminator."); } + BlockID trailing_block_id = 0; + if (block.next_block && emit_next_block) { // If we hit this case, we're dealing with an unconditional branch, which means we will output @@ -18610,8 +18931,10 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) if (block.merge != SPIRBlock::MergeSelection) { flush_phi(block.self, block.next_block); + // For a direct branch, need to remember to invalidate expressions in the next linear block instead. - get(block.next_block).invalidate_expressions = block.invalidate_expressions; + get(block.next_block).invalidate_expressions.clear(); + std::swap(get(block.next_block).invalidate_expressions, block.invalidate_expressions); } // For switch fallthrough cases, we terminate the chain here, but we still need to handle Phi. @@ -18632,7 +18955,15 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) branch_to_continue(block.self, block.next_block); } else if (BlockID(block.self) != block.next_block) - emit_block_chain(get(block.next_block)); + { + // Recursing here is quite scary since it's quite easy to stack overflow if + // the SPIR-V is constructed a particular way. + // We have to simulate the tail call ourselves. + if (block.merge != SPIRBlock::MergeLoop) + trailing_block_id = block.next_block; + else + emit_block_chain(get(block.next_block)); + } } } @@ -18674,20 +19005,28 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) if (is_continue(block.merge_block)) branch_to_continue(block.self, block.merge_block); else - emit_block_chain(get(block.merge_block)); + trailing_block_id = block.merge_block; } + return trailing_block_id; +} + +void CompilerGLSL::emit_block_chain_cleanup(SPIRBlock &block) +{ // Forget about control dependent expressions now. block.invalidate_expressions.clear(); - // After we return, we must be out of scope, so if we somehow have to re-emit this function, + // After we return, we must be out of scope, so if we somehow have to re-emit this block, // re-declare variables if necessary. - assert(rearm_dominated_variables.size() == block.dominated_variables.size()); + // We only need one array here for rearm_dominated_variables, + // since it should be impossible for the same block to be remitted in the same chain twice. + assert(block.rearm_dominated_variables.size() == block.dominated_variables.size()); for (size_t i = 0; i < block.dominated_variables.size(); i++) { uint32_t var = block.dominated_variables[i]; - get(var).deferred_declaration = rearm_dominated_variables[i]; + get(var).deferred_declaration = block.rearm_dominated_variables[i]; } + block.rearm_dominated_variables.clear(); // Just like for deferred declaration, we need to forget about loop variable enable // if our block chain is reinstantiated later. @@ -19229,6 +19568,34 @@ void CompilerGLSL::emit_line_directive(uint32_t file_id, uint32_t line_literal) } } +void CompilerGLSL::emit_non_semantic_shader_debug_info(uint32_t, uint32_t result_id, uint32_t eop, + const uint32_t *args, uint32_t) +{ + if (!options.emit_line_directives) + return; + + switch (eop) + { + case SPIRExtension::DebugLine: + { + // We're missing line end and columns here, but I don't think we can emit those in any meaningful way. + emit_line_directive(args[0], get(args[1]).scalar()); + break; + } + + case SPIRExtension::DebugSource: + { + // Forward the string declaration here. We ignore the optional text operand. + auto &str = get(args[0]).str; + set(result_id, str); + break; + } + + default: + break; + } +} + void CompilerGLSL::emit_copy_logical_type(uint32_t lhs_id, uint32_t lhs_type_id, uint32_t rhs_id, uint32_t rhs_type_id, SmallVector chain) { @@ -19764,7 +20131,7 @@ bool CompilerGLSL::is_stage_output_location_masked(uint32_t location, uint32_t c return masked_output_locations.count({ location, component }) != 0; } -bool CompilerGLSL::is_stage_output_builtin_masked(spv::BuiltIn builtin) const +bool CompilerGLSL::is_stage_output_builtin_masked(BuiltIn builtin) const { return masked_output_builtins.count(builtin) != 0; } @@ -19868,3 +20235,96 @@ std::string CompilerGLSL::format_double(double value) const return convert_to_string(value, current_locale_radix_character); } +std::string CompilerGLSL::to_pretty_expression_if_int_constant( + uint32_t id, + const GlslConstantNameMapping *mapping_start, const GlslConstantNameMapping *mapping_end, + bool register_expression_read) +{ + auto *c = maybe_get(id); + if (c && !c->specialization) + { + auto value = c->scalar(); + auto pretty_name = std::find_if(mapping_start, mapping_end, + [value](const GlslConstantNameMapping &mapping) { return mapping.value == value; }); + if (pretty_name != mapping_end) + return pretty_name->alias; + } + return join("int(", to_expression(id, register_expression_read), ")"); +} + +uint32_t CompilerGLSL::get_fp_fast_math_flags_for_op(uint32_t result_type, uint32_t id) const +{ + uint32_t fp_flags = ~0; + + if (!type_is_floating_point(get(result_type))) + return fp_flags; + + auto &ep = get_entry_point(); + + // Per-operation flag supersedes all defaults. + if (id != 0 && has_decoration(id, DecorationFPFastMathMode)) + return get_decoration(id, DecorationFPFastMathMode); + + // Handle float_controls1 execution modes. + uint32_t width = get(result_type).width; + + bool szinp = false; + + switch (width) + { + case 8: + szinp = ep.signed_zero_inf_nan_preserve_8; + break; + + case 16: + szinp = ep.signed_zero_inf_nan_preserve_16; + break; + + case 32: + szinp = ep.signed_zero_inf_nan_preserve_32; + break; + + case 64: + szinp = ep.signed_zero_inf_nan_preserve_64; + break; + + default: + break; + } + + if (szinp) + fp_flags &= ~(FPFastMathModeNSZMask | FPFastMathModeNotInfMask | FPFastMathModeNotNaNMask); + + // Legacy NoContraction deals with any kind of transform to the expression. + if (id != 0 && has_decoration(id, DecorationNoContraction)) + fp_flags &= ~(FPFastMathModeAllowContractMask | FPFastMathModeAllowTransformMask | FPFastMathModeAllowReassocMask); + + // Handle float_controls2 execution modes. + bool found_default = false; + for (auto &fp_pair : ep.fp_fast_math_defaults) + { + if (get(fp_pair.first).width == width && fp_pair.second) + { + fp_flags &= get(fp_pair.second).scalar(); + found_default = true; + } + } + + // From SPV_KHR_float_controls2: + // "This definition implies that, if the entry point set any FPFastMathDefault execution mode + // then any type for which a default is not set uses no fast math flags + // (although this can still be overridden on a per-operation basis). + // Modules must not mix setting fast math modes explicitly using this extension and relying on older API defaults." + if (!found_default && !ep.fp_fast_math_defaults.empty()) + fp_flags = 0; + + return fp_flags; +} + +bool CompilerGLSL::has_legacy_nocontract(uint32_t result_type, uint32_t id) const +{ + const auto fp_flags = FPFastMathModeAllowContractMask | + FPFastMathModeAllowTransformMask | + FPFastMathModeAllowReassocMask; + return (get_fp_fast_math_flags_for_op(result_type, id) & fp_flags) != fp_flags; +} diff --git a/third_party/spirv-cross/spirv_glsl.hpp b/third_party/spirv-cross/spirv_glsl.hpp index 03ff330ccf..98e93ee99d 100644 --- a/third_party/spirv-cross/spirv_glsl.hpp +++ b/third_party/spirv-cross/spirv_glsl.hpp @@ -32,6 +32,9 @@ namespace SPIRV_CROSS_NAMESPACE { +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; +struct GlslConstantNameMapping; + enum PlsFormat { PlsNone = 0, @@ -287,7 +290,7 @@ public: // This option is only meaningful for MSL and HLSL, since GLSL matches by location directly. // Masking builtins only takes effect if the builtin in question is part of the stage output interface. void mask_stage_output_by_location(uint32_t location, uint32_t component); - void mask_stage_output_by_builtin(spv::BuiltIn builtin); + void mask_stage_output_by_builtin(BuiltIn builtin); // Allow to control how to format float literals in the output. // Set to "nullptr" to use the default "convert_to_string" function. @@ -387,7 +390,7 @@ protected: }; // TODO remove this function when all subgroup ops are supported (or make it always return true) - static bool is_supported_subgroup_op_in_opengl(spv::Op op, const uint32_t *ops); + static bool is_supported_subgroup_op_in_opengl(Op op, const uint32_t *ops); void reset(uint32_t iteration_count); void emit_function(SPIRFunction &func, const Bitset &return_flags); @@ -414,7 +417,7 @@ protected: // For relax_nan_checks. GLSLstd450 get_remapped_glsl_op(GLSLstd450 std450_op) const; - spv::Op get_remapped_spirv_op(spv::Op op) const; + Op get_remapped_spirv_op(Op op) const; virtual void emit_glsl_op(uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count); @@ -426,6 +429,8 @@ protected: const uint32_t *args, uint32_t count); virtual void emit_spv_amd_gcn_shader_op(uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count); + void emit_non_semantic_shader_debug_info(uint32_t result_type, uint32_t result_id, uint32_t op, + const uint32_t *args, uint32_t count); virtual void emit_header(); void emit_line_directive(uint32_t file_id, uint32_t line_literal); void build_workgroup_size(SmallVector &arguments, const SpecializationConstant &x, @@ -439,7 +444,7 @@ protected: SmallVector &inherited_expressions); virtual void emit_subgroup_op(const Instruction &i); virtual std::string type_to_glsl(const SPIRType &type, uint32_t id = 0); - virtual std::string builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage); + virtual std::string builtin_to_glsl(BuiltIn builtin, StorageClass storage); virtual void emit_struct_member(const SPIRType &type, uint32_t member_type_id, uint32_t index, const std::string &qualifier = "", uint32_t base_offset = 0); virtual void emit_struct_padding_target(const SPIRType &type); @@ -451,7 +456,7 @@ protected: virtual std::string constant_expression_vector(const SPIRConstant &c, uint32_t vector); virtual void emit_fixup(); virtual std::string variable_decl(const SPIRType &type, const std::string &name, uint32_t id = 0); - virtual bool variable_decl_is_remapped_storage(const SPIRVariable &var, spv::StorageClass storage) const; + virtual bool variable_decl_is_remapped_storage(const SPIRVariable &var, StorageClass storage) const; virtual std::string to_func_call_arg(const SPIRFunction::Parameter &arg, uint32_t id); virtual void emit_workgroup_initialization(const SPIRVariable &var); @@ -496,7 +501,7 @@ protected: virtual std::string unpack_expression_type(std::string expr_str, const SPIRType &type, uint32_t physical_type_id, bool packed_type, bool row_major); - virtual bool builtin_translates_to_nonarray(spv::BuiltIn builtin) const; + virtual bool builtin_translates_to_nonarray(BuiltIn builtin) const; virtual bool is_user_type_structured(uint32_t id) const; @@ -662,20 +667,21 @@ protected: bool workgroup_size_is_hidden = false; bool requires_relaxed_precision_analysis = false; bool implicit_c_integer_promotion_rules = false; + bool supports_spec_constant_array_size = true; } backend; void emit_struct(SPIRType &type); void emit_resources(); - void emit_extension_workarounds(spv::ExecutionModel model); - void emit_subgroup_arithmetic_workaround(const std::string &func, spv::Op op, spv::GroupOperation group_op); + void emit_extension_workarounds(ExecutionModel model); + void emit_subgroup_arithmetic_workaround(const std::string &func, Op op, GroupOperation group_op); void emit_polyfills(uint32_t polyfills, bool relaxed); void emit_buffer_block_native(const SPIRVariable &var); void emit_buffer_reference_block(uint32_t type_id, bool forward_declaration); void emit_buffer_block_legacy(const SPIRVariable &var); void emit_buffer_block_flattened(const SPIRVariable &type); - void fixup_implicit_builtin_block_names(spv::ExecutionModel model); - void emit_declared_builtin_block(spv::StorageClass storage, spv::ExecutionModel model); - bool should_force_emit_builtin_block(spv::StorageClass storage); + void fixup_implicit_builtin_block_names(ExecutionModel model); + void emit_declared_builtin_block(StorageClass storage, ExecutionModel model); + bool should_force_emit_builtin_block(StorageClass storage); void emit_push_constant_block_vulkan(const SPIRVariable &var); void emit_push_constant_block_glsl(const SPIRVariable &var); void emit_interface_block(const SPIRVariable &type); @@ -685,6 +691,8 @@ protected: void emit_flattened_io_block_member(const std::string &basename, const SPIRType &type, const char *qual, const SmallVector &indices); void emit_block_chain(SPIRBlock &block); + BlockID emit_block_chain_inner(SPIRBlock &block); + void emit_block_chain_cleanup(SPIRBlock &block); void emit_hoisted_temporaries(SmallVector> &temporaries); int get_constant_mapping_to_workgroup_component(const SPIRConstant &constant) const; void emit_constant(const SPIRConstant &constant); @@ -755,6 +763,7 @@ protected: bool expression_read_implies_multiple_reads(uint32_t id) const; SPIRExpression &emit_op(uint32_t result_type, uint32_t result_id, const std::string &rhs, bool forward_rhs, bool suppress_usage_tracking = false); + void emit_transposed_op(uint32_t result_type, uint32_t result_id, const std::string &rhs, bool forward_rhs); void access_chain_internal_append_index(std::string &expr, uint32_t base, const SPIRType *type, AccessChainFlags flags, bool &access_chain_is_arrayed, uint32_t index); @@ -766,12 +775,12 @@ protected: // Relevant for PtrAccessChain / BDA. virtual uint32_t get_physical_type_stride(const SPIRType &type) const; - spv::StorageClass get_expression_effective_storage_class(uint32_t ptr); + StorageClass get_expression_effective_storage_class(uint32_t ptr); virtual bool access_chain_needs_stage_io_builtin_translation(uint32_t base); virtual bool check_physical_type_cast(std::string &expr, const SPIRType *type, uint32_t physical_type); virtual bool prepare_access_chain_for_scalar_access(std::string &expr, const SPIRType &type, - spv::StorageClass storage, bool &is_packed); + StorageClass storage, bool &is_packed); std::string access_chain(uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type, AccessChainMeta *meta = nullptr, bool ptr_chain = false); @@ -797,11 +806,16 @@ protected: const char *index_to_swizzle(uint32_t index); std::string remap_swizzle(const SPIRType &result_type, uint32_t input_components, const std::string &expr); std::string declare_temporary(uint32_t type, uint32_t id); + bool can_declare_inline_temporary(uint32_t id) const; void emit_uninitialized_temporary(uint32_t type, uint32_t id); SPIRExpression &emit_uninitialized_temporary_expression(uint32_t type, uint32_t id); virtual void append_global_func_args(const SPIRFunction &func, uint32_t index, SmallVector &arglist); std::string to_non_uniform_aware_expression(uint32_t id); std::string to_atomic_ptr_expression(uint32_t id); + std::string to_pretty_expression_if_int_constant( + uint32_t id, + const GlslConstantNameMapping *mapping_start, const GlslConstantNameMapping *mapping_end, + bool register_expression_read = true); std::string to_expression(uint32_t id, bool register_expression_read = true); std::string to_composite_constructor_expression(const SPIRType &parent_type, uint32_t id, bool block_like_type); std::string to_rerolled_array_expression(const SPIRType &parent_type, const std::string &expr, const SPIRType &type); @@ -830,15 +844,15 @@ protected: void emit_output_variable_initializer(const SPIRVariable &var); std::string to_precision_qualifiers_glsl(uint32_t id); virtual const char *to_storage_qualifiers_glsl(const SPIRVariable &var); - std::string flags_to_qualifiers_glsl(const SPIRType &type, const Bitset &flags); - const char *format_to_glsl(spv::ImageFormat format); + std::string flags_to_qualifiers_glsl(const SPIRType &type, uint32_t id, const Bitset &flags); + const char *format_to_glsl(ImageFormat format); virtual std::string layout_for_member(const SPIRType &type, uint32_t index); virtual std::string to_interpolation_qualifiers(const Bitset &flags); std::string layout_for_variable(const SPIRVariable &variable); std::string to_combined_image_sampler(VariableID image_id, VariableID samp_id); virtual bool skip_argument(uint32_t id) const; virtual bool emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, - spv::StorageClass lhs_storage, spv::StorageClass rhs_storage); + StorageClass lhs_storage, StorageClass rhs_storage); virtual void emit_block_hints(const SPIRBlock &block); virtual std::string to_initializer_expression(const SPIRVariable &var); virtual std::string to_zero_initialized_expression(uint32_t type_id); @@ -1013,7 +1027,7 @@ protected: bool type_is_empty(const SPIRType &type); - bool can_use_io_location(spv::StorageClass storage, bool block); + bool can_use_io_location(StorageClass storage, bool block); const Instruction *get_next_instruction_in_block(const Instruction &instr); static uint32_t mask_relevant_memory_semantics(uint32_t semantics); @@ -1028,7 +1042,7 @@ protected: // Builtins in GLSL are always specific signedness, but the SPIR-V can declare them // as either unsigned or signed. // Sometimes we will need to automatically perform casts on load and store to make this work. - virtual SPIRType::BaseType get_builtin_basetype(spv::BuiltIn builtin, SPIRType::BaseType default_type); + virtual SPIRType::BaseType get_builtin_basetype(BuiltIn builtin, SPIRType::BaseType default_type); virtual void cast_to_variable_store(uint32_t target_id, std::string &expr, const SPIRType &expr_type); virtual void cast_from_variable_load(uint32_t source_id, std::string &expr, const SPIRType &expr_type); void unroll_array_from_complex_load(uint32_t target_id, uint32_t source_id, std::string &expr); @@ -1057,7 +1071,7 @@ protected: static const char *vector_swizzle(int vecsize, int index); bool is_stage_output_location_masked(uint32_t location, uint32_t component) const; - bool is_stage_output_builtin_masked(spv::BuiltIn builtin) const; + bool is_stage_output_builtin_masked(BuiltIn builtin) const; bool is_stage_output_variable_masked(const SPIRVariable &var) const; bool is_stage_output_block_member_masked(const SPIRVariable &var, uint32_t index, bool strip_array) const; bool is_per_primitive_variable(const SPIRVariable &var) const; @@ -1070,6 +1084,9 @@ protected: std::string format_float(float value) const; std::string format_double(double value) const; + uint32_t get_fp_fast_math_flags_for_op(uint32_t result_type, uint32_t id) const; + bool has_legacy_nocontract(uint32_t result_type, uint32_t id) const; + private: void init(); diff --git a/third_party/spirv-cross/spirv_hlsl.cpp b/third_party/spirv-cross/spirv_hlsl.cpp index 1ec4cb70fe..a18fa3c602 100644 --- a/third_party/spirv-cross/spirv_hlsl.cpp +++ b/third_party/spirv-cross/spirv_hlsl.cpp @@ -27,7 +27,7 @@ #include #include -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; using namespace std; @@ -491,9 +491,9 @@ string CompilerHLSL::type_to_glsl(const SPIRType &type, uint32_t id) case SPIRType::Double: return join("double", type.vecsize); case SPIRType::Int64: - return join("i64vec", type.vecsize); + return join("int64_t", type.vecsize); case SPIRType::UInt64: - return join("u64vec", type.vecsize); + return join("uint64_t", type.vecsize); default: return "???"; } @@ -1021,7 +1021,13 @@ void CompilerHLSL::emit_interface_block_member_in_struct(const SPIRVariable &var { auto &execution = get_entry_point(); auto type = get(var.basetype); - auto semantic = to_semantic(location, execution.model, var.storage); + + std::string semantic; + if (hlsl_options.user_semantic && has_member_decoration(var.self, member_index, DecorationUserSemantic)) + semantic = get_member_decoration_string(var.self, member_index, DecorationUserSemantic); + else + semantic = to_semantic(location, execution.model, var.storage); + auto mbr_name = join(to_name(type.self), "_", to_member_name(type, member_index)); auto &mbr_type = get(type.member_types[member_index]); @@ -1080,17 +1086,28 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord auto name = to_name(var.self); if (use_location_number) { - uint32_t location_number; + uint32_t location_number = UINT32_MAX; - // If an explicit location exists, use it with TEXCOORD[N] semantic. - // Otherwise, pick a vacant location. - if (has_decoration(var.self, DecorationLocation)) - location_number = get_decoration(var.self, DecorationLocation); + std::string semantic; + bool has_user_semantic = false; + + if (hlsl_options.user_semantic && has_decoration(var.self, DecorationUserSemantic)) + { + semantic = get_decoration_string(var.self, DecorationUserSemantic); + has_user_semantic = true; + } else - location_number = get_vacant_location(); + { + // If an explicit location exists, use it with TEXCOORD[N] semantic. + // Otherwise, pick a vacant location. + if (has_decoration(var.self, DecorationLocation)) + location_number = get_decoration(var.self, DecorationLocation); + else + location_number = get_vacant_location(); - // Allow semantic remap if specified. - auto semantic = to_semantic(location_number, execution.model, var.storage); + // Allow semantic remap if specified. + semantic = to_semantic(location_number, execution.model, var.storage); + } if (need_matrix_unroll && type.columns > 1) { @@ -1104,14 +1121,15 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord newtype.columns = 1; string effective_semantic; - if (hlsl_options.flatten_matrix_vertex_input_semantics) + if (hlsl_options.flatten_matrix_vertex_input_semantics && !has_user_semantic) effective_semantic = to_semantic(location_number, execution.model, var.storage); else effective_semantic = join(semantic, "_", i); statement(to_interpolation_qualifiers(get_decoration_bitset(var.self)), variable_decl(newtype, join(name, "_", i)), " : ", effective_semantic, ";"); - active_locations.insert(location_number++); + if (location_number != UINT32_MAX) + active_locations.insert(location_number++); } } else @@ -1127,10 +1145,13 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord statement(to_interpolation_qualifiers(get_decoration_bitset(var.self)), variable_decl(decl_type, name), " : ", semantic, ";"); - // Structs and arrays should consume more locations. - uint32_t consumed_locations = type_to_consumed_locations(decl_type); - for (uint32_t i = 0; i < consumed_locations; i++) - active_locations.insert(location_number + i); + if (location_number != UINT32_MAX) + { + // Structs and arrays should consume more locations. + uint32_t consumed_locations = type_to_consumed_locations(decl_type); + for (uint32_t i = 0; i < consumed_locations; i++) + active_locations.insert(location_number + i); + } } } else @@ -1139,7 +1160,7 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord } } -std::string CompilerHLSL::builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage) +std::string CompilerHLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) { switch (builtin) { @@ -1595,6 +1616,7 @@ void CompilerHLSL::replace_illegal_names() "Texture3D", "TextureCube", "TextureCubeArray", "true", "typedef", "triangle", "triangleadj", "TriangleStream", "uint", "uniform", "unorm", "unsigned", "vector", "vertexfragment", "VertexShader", "vertices", "void", "volatile", "while", + "signed", }; CompilerGLSL::replace_illegal_names(keywords); @@ -1709,9 +1731,11 @@ void CompilerHLSL::emit_resources() ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { auto &type = this->get(var.basetype); + bool is_hidden = is_hidden_io_variable(var); + if (var.storage != StorageClassFunction && !var.remapped_variable && type.pointer && (var.storage == StorageClassInput || var.storage == StorageClassOutput) && !is_builtin_variable(var) && - interface_variable_exists_in_entry_point(var.self)) + interface_variable_exists_in_entry_point(var.self) && !is_hidden) { // Builtin variables are handled separately. emit_interface_block_globally(var); @@ -1747,8 +1771,10 @@ void CompilerHLSL::emit_resources() if (var.storage != StorageClassInput && var.storage != StorageClassOutput) return; + bool is_hidden = is_hidden_io_variable(var); + if (!var.remapped_variable && type.pointer && !is_builtin_variable(var) && - interface_variable_exists_in_entry_point(var.self)) + interface_variable_exists_in_entry_point(var.self) && !is_hidden) { if (block) { @@ -3029,7 +3055,7 @@ string CompilerHLSL::get_inner_entry_point_name() const SPIRV_CROSS_THROW("Unsupported execution model."); } -uint32_t CompilerHLSL::input_vertices_from_execution_mode(spirv_cross::SPIREntryPoint &execution) const +uint32_t CompilerHLSL::input_vertices_from_execution_mode(SPIREntryPoint &execution) const { uint32_t input_vertices = 1; @@ -3061,7 +3087,7 @@ void CompilerHLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret auto &type = get(func.return_type); if (type.array.empty()) { - decl += flags_to_qualifiers_glsl(type, return_flags); + decl += flags_to_qualifiers_glsl(type, 0, return_flags); decl += type_to_glsl(type); decl += " "; } @@ -3482,10 +3508,12 @@ void CompilerHLSL::emit_hlsl_entry_point() if (var.storage != StorageClassInput) return; + bool is_hidden = is_hidden_io_variable(var); + bool need_matrix_unroll = var.storage == StorageClassInput && execution.model == ExecutionModelVertex; if (!var.remapped_variable && type.pointer && !is_builtin_variable(var) && - interface_variable_exists_in_entry_point(var.self)) + interface_variable_exists_in_entry_point(var.self) && !is_hidden) { if (block) { @@ -3760,19 +3788,19 @@ void CompilerHLSL::emit_texture_op(const Instruction &i, bool sparse) uint32_t coord_components = 0; switch (imgtype.image.dim) { - case spv::Dim1D: + case Dim1D: coord_components = 1; break; - case spv::Dim2D: + case Dim2D: coord_components = 2; break; - case spv::Dim3D: + case Dim3D: coord_components = 3; break; - case spv::DimCube: + case DimCube: coord_components = 3; break; - case spv::DimBuffer: + case DimBuffer: coord_components = 1; break; default: @@ -3783,7 +3811,7 @@ void CompilerHLSL::emit_texture_op(const Instruction &i, bool sparse) if (dref) inherited_expressions.push_back(dref); - if (imgtype.image.arrayed) + if (imgtype.image.arrayed && op != OpImageQueryLod) coord_components++; uint32_t bias = 0; @@ -4001,7 +4029,7 @@ void CompilerHLSL::emit_texture_op(const Instruction &i, bool sparse) { if (dref) { - if (imgtype.image.dim != spv::Dim1D && imgtype.image.dim != spv::Dim2D) + if (imgtype.image.dim != Dim1D && imgtype.image.dim != Dim2D) { SPIRV_CROSS_THROW( "Depth comparison is only supported for 1D and 2D textures in HLSL shader model 2/3."); @@ -5436,7 +5464,7 @@ void CompilerHLSL::emit_access_chain(const Instruction &instruction) } } -void CompilerHLSL::emit_atomic(const uint32_t *ops, uint32_t length, spv::Op op) +void CompilerHLSL::emit_atomic(const uint32_t *ops, uint32_t length, Op op) { const char *atomic_op = nullptr; @@ -7113,12 +7141,36 @@ bool CompilerHLSL::is_hlsl_force_storage_buffer_as_uav(ID id) const return true; } - const uint32_t desc_set = get_decoration(id, spv::DecorationDescriptorSet); - const uint32_t binding = get_decoration(id, spv::DecorationBinding); + const uint32_t desc_set = get_decoration(id, DecorationDescriptorSet); + const uint32_t binding = get_decoration(id, DecorationBinding); return (force_uav_buffer_bindings.find({ desc_set, binding }) != force_uav_buffer_bindings.end()); } +bool CompilerHLSL::is_hidden_io_variable(const SPIRVariable &var) const +{ + if (!is_hidden_variable(var)) + return false; + + // It is too risky to remove stage IO variables that are linkable since it affects link compatibility. + // For vertex inputs and fragment outputs, it's less of a concern and we want reflection data + // to match reality. + + bool is_external_linkage = + (get_execution_model() == ExecutionModelVertex && var.storage == StorageClassInput) || + (get_execution_model() == ExecutionModelFragment && var.storage == StorageClassOutput); + + if (!is_external_linkage) + return false; + + // Unused output I/O variables might still be required to implement framebuffer fetch. + if (var.storage == StorageClassOutput && !is_legacy() && + location_is_framebuffer_fetch(get_decoration(var.self, DecorationLocation)) != 0) + return false; + + return true; +} + void CompilerHLSL::set_hlsl_force_storage_buffer_as_uav(uint32_t desc_set, uint32_t binding) { SetBindingPair pair = { desc_set, binding }; @@ -7134,6 +7186,7 @@ bool CompilerHLSL::is_user_type_structured(uint32_t id) const const std::string &user_type = get_decoration_string(id, DecorationUserTypeGOOGLE); return user_type.compare(0, 16, "structuredbuffer") == 0 || user_type.compare(0, 18, "rwstructuredbuffer") == 0 || + user_type.compare(0, 35, "globallycoherent rwstructuredbuffer") == 0 || user_type.compare(0, 33, "rasterizerorderedstructuredbuffer") == 0; } return false; diff --git a/third_party/spirv-cross/spirv_hlsl.hpp b/third_party/spirv-cross/spirv_hlsl.hpp index 4303bb7d5f..0d5181b9d9 100644 --- a/third_party/spirv-cross/spirv_hlsl.hpp +++ b/third_party/spirv-cross/spirv_hlsl.hpp @@ -29,6 +29,7 @@ namespace SPIRV_CROSS_NAMESPACE { +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; // Interface which remaps vertex inputs to a fixed semantic name to make linking easier. struct HLSLVertexAttributeRemap { @@ -87,7 +88,7 @@ using HLSLBindingFlags = uint32_t; // For deeper control of push constants, set_root_constant_layouts() can be used instead. struct HLSLResourceBinding { - spv::ExecutionModel stage = spv::ExecutionModelMax; + ExecutionModel stage = ExecutionModelMax; uint32_t desc_set = 0; uint32_t binding = 0; @@ -150,6 +151,9 @@ public: // This relies on UserTypeGOOGLE to encode the buffer type either as "structuredbuffer" or "rwstructuredbuffer" // whereas the type can be extended with an optional subtype, e.g. "structuredbuffer:int". bool preserve_structured_buffers = false; + + // Use UserSemantic decoration info (if specified), otherwise use default mechanism (such as add_vertex_attribute_remap or TEXCOORD#). + bool user_semantic = false; }; explicit CompilerHLSL(std::vector spirv_) @@ -216,7 +220,7 @@ public: // is_hlsl_resource_binding_used() will return true after calling ::compile() if // the set/binding combination was used by the HLSL code. void add_hlsl_resource_binding(const HLSLResourceBinding &resource); - bool is_hlsl_resource_binding_used(spv::ExecutionModel model, uint32_t set, uint32_t binding) const; + bool is_hlsl_resource_binding_used(ExecutionModel model, uint32_t set, uint32_t binding) const; // Controls which storage buffer bindings will be forced to be declared as UAVs. void set_hlsl_force_storage_buffer_as_uav(uint32_t desc_set, uint32_t binding); @@ -255,7 +259,7 @@ private: void emit_specialization_constants_and_structs(); void emit_composite_constants(); void emit_fixup() override; - std::string builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage) override; + std::string builtin_to_glsl(BuiltIn builtin, StorageClass storage) override; std::string layout_for_member(const SPIRType &type, uint32_t index) override; std::string to_interpolation_qualifiers(const Bitset &flags) override; std::string bitcast_glsl_op(const SPIRType &result_type, const SPIRType &argument_type) override; @@ -281,7 +285,7 @@ private: const SmallVector &composite_chain); std::string write_access_chain_value(uint32_t value, const SmallVector &composite_chain, bool enclose); void emit_store(const Instruction &instruction); - void emit_atomic(const uint32_t *ops, uint32_t length, spv::Op op); + void emit_atomic(const uint32_t *ops, uint32_t length, Op op); void emit_subgroup_op(const Instruction &i) override; void emit_block_hints(const SPIRBlock &block) override; @@ -294,9 +298,10 @@ private: const char *to_storage_qualifiers_glsl(const SPIRVariable &var) override; void replace_illegal_names() override; - SPIRType::BaseType get_builtin_basetype(spv::BuiltIn builtin, SPIRType::BaseType default_type) override; + SPIRType::BaseType get_builtin_basetype(BuiltIn builtin, SPIRType::BaseType default_type) override; bool is_hlsl_force_storage_buffer_as_uav(ID id) const; + bool is_hidden_io_variable(const SPIRVariable &var) const; Options hlsl_options; @@ -379,7 +384,7 @@ private: uint32_t type_to_consumed_locations(const SPIRType &type) const; - std::string to_semantic(uint32_t location, spv::ExecutionModel em, spv::StorageClass sc); + std::string to_semantic(uint32_t location, ExecutionModel em, StorageClass sc); uint32_t num_workgroups_builtin = 0; HLSLBindingFlags resource_binding_flags = 0; diff --git a/third_party/spirv-cross/spirv_msl.cpp b/third_party/spirv-cross/spirv_msl.cpp index 1c4f1ed13a..025427cc83 100644 --- a/third_party/spirv-cross/spirv_msl.cpp +++ b/third_party/spirv-cross/spirv_msl.cpp @@ -28,7 +28,7 @@ #include #include -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; using namespace std; @@ -124,7 +124,7 @@ void CompilerMSL::add_msl_resource_binding(const MSLResourceBinding &binding) void CompilerMSL::add_dynamic_buffer(uint32_t desc_set, uint32_t binding, uint32_t index) { SetBindingPair pair = { desc_set, binding }; - buffers_requiring_dynamic_offset[pair] = { index, 0 }; + buffers_requiring_dynamic_offset[pair] = { index, 0, "" }; } void CompilerMSL::add_inline_uniform_block(uint32_t desc_set, uint32_t binding) @@ -164,7 +164,7 @@ bool CompilerMSL::is_msl_shader_output_used(uint32_t location) location_outputs_in_use_fallback.count(location) == 0; } -uint32_t CompilerMSL::get_automatic_builtin_input_location(spv::BuiltIn builtin) const +uint32_t CompilerMSL::get_automatic_builtin_input_location(BuiltIn builtin) const { auto itr = builtin_to_automatic_input_location.find(builtin); if (itr == builtin_to_automatic_input_location.end()) @@ -173,7 +173,7 @@ uint32_t CompilerMSL::get_automatic_builtin_input_location(spv::BuiltIn builtin) return itr->second; } -uint32_t CompilerMSL::get_automatic_builtin_output_location(spv::BuiltIn builtin) const +uint32_t CompilerMSL::get_automatic_builtin_output_location(BuiltIn builtin) const { auto itr = builtin_to_automatic_output_location.find(builtin); if (itr == builtin_to_automatic_output_location.end()) @@ -242,7 +242,7 @@ void CompilerMSL::set_fragment_output_components(uint32_t location, uint32_t com fragment_output_components[location] = components; } -bool CompilerMSL::builtin_translates_to_nonarray(spv::BuiltIn builtin) const +bool CompilerMSL::builtin_translates_to_nonarray(BuiltIn builtin) const { return (builtin == BuiltInSampleMask); } @@ -279,15 +279,15 @@ void CompilerMSL::build_implicit_builtins() bool force_frag_depth_passthrough = get_execution_model() == ExecutionModelFragment && !uses_explicit_early_fragment_test() && need_subpass_input && msl_options.enable_frag_depth_builtin && msl_options.input_attachment_is_ds_attachment; - bool need_point_size = + needs_point_size_output = msl_options.enable_point_size_builtin && msl_options.enable_point_size_default && - get_execution_model() == ExecutionModelVertex; + entry_point_is_vertex(); if (need_subpass_input || need_sample_pos || need_subgroup_mask || need_vertex_params || need_tesc_params || need_tese_params || need_multiview || need_dispatch_base || need_vertex_base_params || need_grid_params || needs_sample_id || needs_subgroup_invocation_id || needs_subgroup_size || needs_helper_invocation || has_additional_fixed_sample_mask() || need_local_invocation_index || need_workgroup_size || - force_frag_depth_passthrough || need_point_size || is_mesh_shader()) + force_frag_depth_passthrough || needs_point_size_output || is_mesh_shader()) { bool has_frag_coord = false; bool has_sample_id = false; @@ -315,7 +315,7 @@ void CompilerMSL::build_implicit_builtins() return; auto &type = this->get(var.basetype); - if (need_point_size && has_decoration(type.self, DecorationBlock)) + if (needs_point_size_output && has_decoration(type.self, DecorationBlock)) { const auto member_count = static_cast(type.member_types.size()); for (uint32_t i = 0; i < member_count; i++) @@ -684,28 +684,6 @@ void CompilerMSL::build_implicit_builtins() mark_implicit_builtin(StorageClassInput, BuiltInBaseInstance, var_id); } - if (need_multiview) - { - // Multiview shaders are not allowed to write to gl_Layer, ostensibly because - // it is implicitly written from gl_ViewIndex, but we have to do that explicitly. - // Note that we can't just abuse gl_ViewIndex for this purpose: it's an input, but - // gl_Layer is an output in vertex-pipeline shaders. - uint32_t type_ptr_out_id = ir.increase_bound_by(2); - SPIRType uint_type_ptr_out = get_uint_type(); - uint_type_ptr.op = OpTypePointer; - uint_type_ptr_out.pointer = true; - uint_type_ptr_out.pointer_depth++; - uint_type_ptr_out.parent_type = get_uint_type_id(); - uint_type_ptr_out.storage = StorageClassOutput; - auto &ptr_out_type = set(type_ptr_out_id, uint_type_ptr_out); - ptr_out_type.self = get_uint_type_id(); - uint32_t var_id = type_ptr_out_id + 1; - set(var_id, type_ptr_out_id, StorageClassOutput); - set_decoration(var_id, DecorationBuiltIn, BuiltInLayer); - builtin_layer_id = var_id; - mark_implicit_builtin(StorageClassOutput, BuiltInLayer, var_id); - } - if (need_multiview && !has_view_idx) { uint32_t var_id = ir.increase_bound_by(1); @@ -718,6 +696,28 @@ void CompilerMSL::build_implicit_builtins() } } + if (need_multiview) + { + // Multiview shaders are not allowed to write to gl_Layer, ostensibly because + // it is implicitly written from gl_ViewIndex, but we have to do that explicitly. + // Note that we can't just abuse gl_ViewIndex for this purpose: it's an input, but + // gl_Layer is an output in vertex-pipeline shaders. + uint32_t type_ptr_out_id = ir.increase_bound_by(2); + SPIRType uint_type_ptr_out = get_uint_type(); + uint_type_ptr_out.op = OpTypePointer; + uint_type_ptr_out.pointer = true; + uint_type_ptr_out.pointer_depth++; + uint_type_ptr_out.parent_type = get_uint_type_id(); + uint_type_ptr_out.storage = StorageClassOutput; + auto &ptr_out_type = set(type_ptr_out_id, uint_type_ptr_out); + ptr_out_type.self = get_uint_type_id(); + uint32_t var_id = type_ptr_out_id + 1; + set(var_id, type_ptr_out_id, StorageClassOutput); + set_decoration(var_id, DecorationBuiltIn, BuiltInLayer); + builtin_layer_id = var_id; + mark_implicit_builtin(StorageClassOutput, BuiltInLayer, var_id); + } + if ((need_tesc_params && (msl_options.multi_patch_workgroup || !has_invocation_id || !has_primitive_id)) || (need_tese_params && !has_primitive_id) || need_grid_params) { @@ -894,7 +894,7 @@ void CompilerMSL::build_implicit_builtins() set(type_id, bool_type); SPIRType bool_type_ptr_in = bool_type; - bool_type_ptr_in.op = spv::OpTypePointer; + bool_type_ptr_in.op = OpTypePointer; bool_type_ptr_in.pointer = true; bool_type_ptr_in.pointer_depth++; bool_type_ptr_in.parent_type = type_id; @@ -998,7 +998,7 @@ void CompilerMSL::build_implicit_builtins() set(type_id, float_type); SPIRType float_type_ptr_in = float_type; - float_type_ptr_in.op = spv::OpTypePointer; + float_type_ptr_in.op = OpTypePointer; float_type_ptr_in.pointer = true; float_type_ptr_in.pointer_depth++; float_type_ptr_in.parent_type = type_id; @@ -1013,7 +1013,7 @@ void CompilerMSL::build_implicit_builtins() active_output_builtins.set(BuiltInFragDepth); } - if (!has_point_size && need_point_size) + if (!has_point_size && needs_point_size_output) { uint32_t offset = ir.increase_bound_by(3); uint32_t type_id = offset; @@ -1028,7 +1028,7 @@ void CompilerMSL::build_implicit_builtins() set(type_id, float_type); SPIRType float_type_ptr_in = float_type; - float_type_ptr_in.op = spv::OpTypePointer; + float_type_ptr_in.op = OpTypePointer; float_type_ptr_in.pointer = true; float_type_ptr_in.pointer_depth++; float_type_ptr_in.parent_type = type_id; @@ -1182,7 +1182,7 @@ void CompilerMSL::build_implicit_builtins() builtin_mesh_sizes_id = var_id; } - if (get_execution_model() == spv::ExecutionModelTaskEXT) + if (get_execution_model() == ExecutionModelTaskEXT) { uint32_t offset = ir.increase_bound_by(3); uint32_t type_id = offset; @@ -1194,7 +1194,7 @@ void CompilerMSL::build_implicit_builtins() set(type_id, mesh_grid_type); SPIRType mesh_grid_type_ptr = mesh_grid_type; - mesh_grid_type_ptr.op = spv::OpTypePointer; + mesh_grid_type_ptr.op = OpTypePointer; mesh_grid_type_ptr.pointer = true; mesh_grid_type_ptr.pointer_depth++; mesh_grid_type_ptr.parent_type = type_id; @@ -1211,7 +1211,7 @@ void CompilerMSL::build_implicit_builtins() // Checks if the specified builtin variable (e.g. gl_InstanceIndex) is marked as active. // If not, it marks it as active and forces a recompilation. // This might be used when the optimization of inactive builtins was too optimistic (e.g. when "spvOut" is emitted). -void CompilerMSL::ensure_builtin(spv::StorageClass storage, spv::BuiltIn builtin) +void CompilerMSL::ensure_builtin(StorageClass storage, BuiltIn builtin) { Bitset *active_builtins = nullptr; switch (storage) @@ -1494,24 +1494,27 @@ void CompilerMSL::emit_entry_point_declarations() // Emit dynamic buffers here. for (auto &dynamic_buffer : buffers_requiring_dynamic_offset) { - if (!dynamic_buffer.second.second) + if (!dynamic_buffer.second.var_id) { // Could happen if no buffer was used at requested binding point. continue; } - const auto &var = get(dynamic_buffer.second.second); + const auto &var = get(dynamic_buffer.second.var_id); uint32_t var_id = var.self; const auto &type = get_variable_data_type(var); + + add_local_variable_name(var.self); string name = to_name(var.self); + uint32_t desc_set = get_decoration(var.self, DecorationDescriptorSet); uint32_t arg_id = argument_buffer_ids[desc_set]; - uint32_t base_index = dynamic_buffer.second.first; + uint32_t base_index = dynamic_buffer.second.base_index; if (is_array(type)) { is_using_builtin_array = true; - statement(get_argument_address_space(var), " ", type_to_glsl(type), "* ", to_restrict(var_id, true), name, + statement(get_variable_address_space(var), " ", type_to_glsl(type), "* ", to_restrict(var_id, true), name, type_to_array_glsl(type, var_id), " ="); uint32_t array_size = get_resource_array_size(type, var_id); @@ -1522,9 +1525,9 @@ void CompilerMSL::emit_entry_point_declarations() for (uint32_t i = 0; i < array_size; i++) { - statement("(", get_argument_address_space(var), " ", type_to_glsl(type), "* ", - to_restrict(var_id, false), ")((", get_argument_address_space(var), " char* ", - to_restrict(var_id, false), ")", to_name(arg_id), ".", ensure_valid_name(name, "m"), + statement("(", get_variable_address_space(var), " ", type_to_glsl(type), "* ", + to_restrict(var_id, false), ")((", get_variable_address_space(var), " char* ", + to_restrict(var_id, false), ")", to_name(arg_id), ".", dynamic_buffer.second.mbr_name, "[", i, "]", " + ", to_name(dynamic_offsets_buffer_id), "[", base_index + i, "]),"); } @@ -1534,10 +1537,10 @@ void CompilerMSL::emit_entry_point_declarations() } else { - statement(get_argument_address_space(var), " auto& ", to_restrict(var_id, true), name, " = *(", - get_argument_address_space(var), " ", type_to_glsl(type), "* ", to_restrict(var_id, false), ")((", - get_argument_address_space(var), " char* ", to_restrict(var_id, false), ")", to_name(arg_id), ".", - ensure_valid_name(name, "m"), " + ", to_name(dynamic_offsets_buffer_id), "[", base_index, "]);"); + statement(get_variable_address_space(var), " auto& ", to_restrict(var_id, true), name, " = *(", + get_variable_address_space(var), " ", type_to_glsl(type), "* ", to_restrict(var_id, false), ")((", + get_variable_address_space(var), " char* ", to_restrict(var_id, false), ")", to_name(arg_id), ".", + dynamic_buffer.second.mbr_name, " + ", to_name(dynamic_offsets_buffer_id), "[", base_index, "]);"); } } @@ -1547,6 +1550,8 @@ void CompilerMSL::emit_entry_point_declarations() const auto &var = *arg; const auto &type = get_variable_data_type(var); const auto &buffer_type = get_variable_element_type(var); + + // This has already been added as a resource name. const string name = to_name(var.self); if (is_var_runtime_size_array(var)) @@ -1557,10 +1562,24 @@ void CompilerMSL::emit_entry_point_declarations() } string resource_name; + if (descriptor_set_is_argument_buffer(get_decoration(var.self, DecorationDescriptorSet))) + { resource_name = ir.meta[var.self].decoration.qualified_alias; + } else - resource_name = name + "_"; + { + bool is_aliased = std::find_if(buffer_aliases_discrete.begin(), buffer_aliases_discrete.end(), + [&](uint32_t id) { return var.self == id; }) != buffer_aliases_discrete.end(); + + uint32_t desc_set = get_decoration(var.self, DecorationDescriptorSet); + uint32_t desc_binding = get_decoration(var.self, DecorationBinding); + + if (is_aliased) + resource_name = join("spvBufferAliasSet", desc_set, "Binding", desc_binding); + else + resource_name = join("spvDescriptorSet", desc_set, "Binding", desc_binding); + } switch (type.basetype) { @@ -1572,10 +1591,10 @@ void CompilerMSL::emit_entry_point_declarations() case SPIRType::SampledImage: statement("spvDescriptorArray<", type_to_glsl(buffer_type, var.self), "> ", name, " {", resource_name, "};"); // Unsupported with argument buffer for now. - statement("spvDescriptorArray ", name, "Smplr {", name, "Smplr_};"); + statement("spvDescriptorArray ", name, "Smplr {", resource_name, "Smplr};"); break; case SPIRType::Struct: - statement("spvDescriptorArray<", get_argument_address_space(var), " ", type_to_glsl(buffer_type), "*> ", + statement("spvDescriptorArray<", get_variable_address_space(var), " ", type_to_glsl(buffer_type), "*> ", name, " {", resource_name, "};"); break; default: @@ -1586,7 +1605,7 @@ void CompilerMSL::emit_entry_point_declarations() else if (!type.array.empty() && type.basetype == SPIRType::Struct) { // Emit only buffer arrays here. - statement(get_argument_address_space(var), " ", type_to_glsl(buffer_type), "* ", + statement(get_variable_address_space(var), " ", type_to_glsl(buffer_type), "* ", to_restrict(var.self, true), name, "[] ="); begin_scope(); uint32_t array_size = get_resource_array_size(type, var.self); @@ -1604,8 +1623,14 @@ void CompilerMSL::emit_entry_point_declarations() for (auto &var_id : buffer_aliases_discrete) { const auto &var = get(var_id); + + // We already declare this alias in a different way. + if (is_var_runtime_size_array(var)) + continue; + const auto &type = get_variable_data_type(var); - auto addr_space = get_argument_address_space(var); + auto addr_space = get_variable_address_space(var); + // This resource name has already been added. auto name = to_name(var_id); uint32_t desc_set = get_decoration(var_id, DecorationDescriptorSet); @@ -1619,36 +1644,6 @@ void CompilerMSL::emit_entry_point_declarations() // Discrete descriptors are processed in entry point emission every compiler iteration. buffer_aliases_discrete.clear(); - for (auto &var_pair : buffer_aliases_argument) - { - uint32_t var_id = var_pair.first; - uint32_t alias_id = var_pair.second; - - const auto &var = get(var_id); - const auto &type = get_variable_data_type(var); - auto addr_space = get_argument_address_space(var); - - if (type.array.empty()) - { - statement(addr_space, " auto& ", to_restrict(var_id, true), to_name(var_id), " = (", addr_space, " ", - type_to_glsl(type), "&)", ir.meta[alias_id].decoration.qualified_alias, ";"); - } - else - { - const char *desc_addr_space = descriptor_address_space(var_id, var.storage, "thread"); - - // Esoteric type cast. Reference to array of pointers. - // Auto here defers to UBO or SSBO. The address space of the reference needs to refer to the - // address space of the argument buffer itself, which is usually constant, but can be const device for - // large argument buffers. - is_using_builtin_array = true; - statement(desc_addr_space, " auto& ", to_restrict(var_id, true), to_name(var_id), " = (", addr_space, " ", - type_to_glsl(type), "* ", desc_addr_space, " (&)", - type_to_array_glsl(type, var_id), ")", ir.meta[alias_id].decoration.qualified_alias, ";"); - is_using_builtin_array = false; - } - } - // Emit disabled fragment outputs. std::sort(disabled_frag_outputs.begin(), disabled_frag_outputs.end()); for (uint32_t var_id : disabled_frag_outputs) @@ -1711,6 +1706,7 @@ string CompilerMSL::compile() backend.array_is_value_type_in_buffer_blocks = false; backend.support_pointer_to_pointer = true; backend.implicit_c_integer_promotion_rules = true; + backend.supports_spec_constant_array_size = false; capture_output_to_buffer = msl_options.capture_output_to_buffer; is_rasterization_disabled = msl_options.disable_rasterization || capture_output_to_buffer; @@ -1880,6 +1876,9 @@ void CompilerMSL::preprocess_op_codes() (preproc.uses_image_write && !msl_options.supports_msl_version(2, 2))) is_rasterization_disabled = true; + // FIXME: This currently does not consider BDA side effects, so we cannot deduce const device for BDA. + has_descriptor_side_effects_buffer = preproc.uses_buffer_write; + // Tessellation control shaders are run as compute functions in Metal, and so // must capture their output to a buffer. if (is_tesc_shader() || (get_execution_model() == ExecutionModelVertex && msl_options.vertex_for_tessellation)) @@ -2705,7 +2704,7 @@ uint32_t CompilerMSL::build_msl_interpolant_type(uint32_t type_id, bool is_noper return new_type_id; } -bool CompilerMSL::add_component_variable_to_interface_block(spv::StorageClass storage, const std::string &ib_var_ref, +bool CompilerMSL::add_component_variable_to_interface_block(StorageClass storage, const std::string &ib_var_ref, SPIRVariable &var, const SPIRType &type, InterfaceBlockMeta &meta) @@ -3765,7 +3764,7 @@ void CompilerMSL::add_tess_level_input(const std::string &base_ref, const std::s } } -bool CompilerMSL::variable_storage_requires_stage_io(spv::StorageClass storage) const +bool CompilerMSL::variable_storage_requires_stage_io(StorageClass storage) const { if (storage == StorageClassOutput) return !capture_output_to_buffer; @@ -4874,7 +4873,7 @@ uint32_t CompilerMSL::ensure_correct_builtin_type(uint32_t type_id, BuiltIn buil uint32_t ptr_type_id = next_id++; auto &ptr_type = set(ptr_type_id, base_type); - ptr_type.op = spv::OpTypePointer; + ptr_type.op = OpTypePointer; ptr_type.pointer = true; ptr_type.pointer_depth++; ptr_type.storage = type.storage; @@ -5874,8 +5873,8 @@ void CompilerMSL::emit_custom_templates() begin_scope(); statement("return elements[pos];"); end_scope(); - if (get_execution_model() == spv::ExecutionModelMeshEXT || - get_execution_model() == spv::ExecutionModelTaskEXT) + if (get_execution_model() == ExecutionModelMeshEXT || + get_execution_model() == ExecutionModelTaskEXT) { statement(""); statement("object_data T& operator [] (size_t pos) object_data"); @@ -6171,14 +6170,31 @@ void CompilerMSL::emit_custom_functions() "device", "device", "device", "device", "thread", "threadgroup", }; + static const bool src_is_physical_with_mismatch[] = { + true, true, false, + false, false, false, + false, false, false, + false, true, true, + }; + + static const bool dst_is_physical_with_mismatch[] = { + false, false, false, + false, false, false, + false, false, true, + true, false, false, + }; + for (uint32_t variant = 0; variant < 12; variant++) { + assert(!src_is_physical_with_mismatch[variant] || !dst_is_physical_with_mismatch[variant]); bool is_multidim = spv_func == SPVFuncImplArrayCopyMultidim; - const char* dim = is_multidim ? "[N][M]" : "[N]"; + const char *dim = is_multidim ? "[N][M]" : "[N]"; + + // Simple base case. statement("template" : ">"); statement("inline void spvArrayCopy", function_name_tags[variant], "(", - dst_address_space[variant], " T (&dst)", dim, ", ", - src_address_space[variant], " T (&src)", dim, ")"); + dst_address_space[variant], " T (&dst)", dim, ", ", + src_address_space[variant], " T (&src)", dim, ")"); begin_scope(); statement("for (uint i = 0; i < N; i++)"); begin_scope(); @@ -6188,6 +6204,81 @@ void CompilerMSL::emit_custom_functions() statement("dst[i] = src[i];"); end_scope(); end_scope(); + + if (spv_function_implementations.count(SPVFuncImplArrayCopyExtendedSrc) && + src_is_physical_with_mismatch[variant]) + { + // 1st overload, src can be magic vector where dst is a scalar. + // Need reinterpret casts to be memory model correct. LLVM vectors are broken otherwise. + statement("template" : ">"); + statement("inline void spvArrayCopy", function_name_tags[variant], "(", + dst_address_space[variant], " T (&dst)", dim, ", ", + src_address_space[variant], " vec (&src)", dim, ")"); + begin_scope(); + statement("for (uint i = 0; i < N; i++)"); + begin_scope(); + if (is_multidim) + statement("spvArrayCopy", function_name_tags[variant], "(dst[i], src[i]);"); + else + statement("dst[i] = reinterpret_cast<", src_address_space[variant], " T &>(src[i]);"); + end_scope(); + end_scope(); + + statement(""); + + // 2nd overload, both are vectors, but need SFINAE magic to avoid ambiguous case. + statement("template" : ">"); + statement("inline enable_if_t spvArrayCopy", function_name_tags[variant], "(", + dst_address_space[variant], " vec (&dst)", dim, ", ", + src_address_space[variant], " vec (&src)", dim, ")"); + begin_scope(); + statement("for (uint i = 0; i < N; i++)"); + begin_scope(); + if (is_multidim) + statement("spvArrayCopy", function_name_tags[variant], "(dst[i], src[i]);"); + else + statement("dst[i] = reinterpret_cast<", src_address_space[variant], " vec &>(src[i]);"); + end_scope(); + end_scope(); + } + + if (spv_function_implementations.count(SPVFuncImplArrayCopyExtendedDst) && + dst_is_physical_with_mismatch[variant]) + { + // 1st overload, src can be magic vector where dst is a scalar. + // Need reinterpret casts to be memory model correct. LLVM vectors are broken otherwise. + statement("template" : ">"); + statement("inline void spvArrayCopy", function_name_tags[variant], "(", + dst_address_space[variant], " vec (&dst)", dim, ", ", + src_address_space[variant], " T (&src)", dim, ")"); + begin_scope(); + statement("for (uint i = 0; i < N; i++)"); + begin_scope(); + if (is_multidim) + statement("spvArrayCopy", function_name_tags[variant], "(dst[i], src[i]);"); + else + statement("reinterpret_cast<", dst_address_space[variant], " T &>(dst[i]) = src[i];"); + end_scope(); + end_scope(); + + statement(""); + + // 2nd overload, both are vectors, but need SFINAE magic to avoid ambiguous case. + statement("template" : ">"); + statement("inline enable_if_t spvArrayCopy", function_name_tags[variant], "(", + dst_address_space[variant], " vec (&dst)", dim, ", ", + src_address_space[variant], " vec (&src)", dim, ")"); + begin_scope(); + statement("for (uint i = 0; i < N; i++)"); + begin_scope(); + if (is_multidim) + statement("spvArrayCopy", function_name_tags[variant], "(dst[i], src[i]);"); + else + statement("reinterpret_cast<", dst_address_space[variant], " vec &>(dst[i]) = src[i];"); + end_scope(); + end_scope(); + } + statement(""); } break; @@ -6982,6 +7073,40 @@ void CompilerMSL::emit_custom_functions() statement("return (vec)simd_shuffle((vec)value, lane);"); end_scope(); statement(""); + + if (msl_options.supports_msl_version(2, 2)) + { + // Despite being a template in MSL, it does not support 64-bit shuffles. + // Unsure if there's a cleaner way to statically unroll based on vec<> template, but this will do. + statement("template<>"); + statement("inline ulong spvSubgroupShuffle(ulong value, ushort lane)"); + begin_scope(); + statement("return as_type(spvSubgroupShuffle(as_type(value), lane));"); + end_scope(); + statement(""); + statement("template<>"); + statement("inline ulong2 spvSubgroupShuffle(ulong2 value, ushort lane)"); + begin_scope(); + statement("return ulong2(spvSubgroupShuffle(value.x, lane), spvSubgroupShuffle(value.y, lane));"); + end_scope(); + statement(""); + statement("inline ulong3 spvSubgroupShuffle(ulong3 value, ushort lane)"); + begin_scope(); + statement("return ulong3(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.z, lane));"); + end_scope(); + statement(""); + statement("inline ulong4 spvSubgroupShuffle(ulong4 value, ushort lane)"); + begin_scope(); + statement("return ulong4(spvSubgroupShuffle(value.xy, lane), spvSubgroupShuffle(value.zw, lane));"); + end_scope(); + statement(""); + statement("template"); + statement("inline vec spvSubgroupShuffle(vec value, ushort lane)"); + begin_scope(); + statement("return vec(spvSubgroupShuffle(vec(value), lane));"); + end_scope(); + statement(""); + } break; case SPVFuncImplSubgroupShuffleXor: @@ -8031,18 +8156,14 @@ void CompilerMSL::emit_custom_functions() case SPVFuncImplVariableSizedDescriptor: statement("template"); - statement("struct spvBufferDescriptor"); + statement("struct spvBufferDescriptor;"); + statement(""); + statement("template"); + statement("struct spvBufferDescriptor"); begin_scope(); - statement("T value;"); + statement("device T* value;"); statement("int length;"); - statement("const device T& operator -> () const device"); - begin_scope(); - statement("return value;"); - end_scope(); - statement("const device T& operator * () const device"); - begin_scope(); - statement("return value;"); - end_scope(); + statement("int padding;"); end_scope_decl(); statement(""); break; @@ -8053,13 +8174,9 @@ void CompilerMSL::emit_custom_functions() statement("template"); statement("struct spvDescriptorArray"); begin_scope(); - statement("spvDescriptorArray(const device spvDescriptor* ptr) : ptr(&ptr->value)"); - begin_scope(); - end_scope(); - statement("const device T& operator [] (size_t i) const"); - begin_scope(); - statement("return ptr[i];"); - end_scope(); + statement("spvDescriptorArray(const device spvDescriptor* ptr_) : ptr(&ptr_->value) {}"); + statement("spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {}"); + statement("const device T& operator [] (size_t i) const { return ptr[i]; }"); statement("const device T* ptr;"); end_scope_decl(); statement(""); @@ -8077,17 +8194,10 @@ void CompilerMSL::emit_custom_functions() statement("template"); statement("struct spvDescriptorArray"); begin_scope(); - statement("spvDescriptorArray(const device spvBufferDescriptor* ptr) : ptr(ptr)"); - begin_scope(); - end_scope(); - statement("const device T* operator [] (size_t i) const"); - begin_scope(); - statement("return ptr[i].value;"); - end_scope(); - statement("const int length(int i) const"); - begin_scope(); - statement("return ptr[i].length;"); - end_scope(); + statement("spvDescriptorArray(const device spvBufferDescriptor* ptr_) : ptr(ptr_) {}"); + statement("spvDescriptorArray(const device void *ptr_) : spvDescriptorArray(static_cast*>(ptr_)) {}"); + statement("device T* operator [] (size_t i) const { return ptr[i].value; }"); + statement("int length(int i) const { return ptr[i].length; }"); statement("const device spvBufferDescriptor* ptr;"); end_scope_decl(); statement(""); @@ -8291,8 +8401,9 @@ void CompilerMSL::emit_resources() else if (execution.flags.get(ExecutionModeOutputPoints)) topology = "topology::point"; + const char *per_vertex = mesh_out_per_vertex ? "spvPerVertex" : "float4"; const char *per_primitive = mesh_out_per_primitive ? "spvPerPrimitive" : "void"; - statement("using spvMesh_t = mesh<", "spvPerVertex, ", per_primitive, ", ", execution.output_vertices, ", ", + statement("using spvMesh_t = mesh<", per_vertex, ", ", per_primitive, ", ", execution.output_vertices, ", ", execution.output_primitives, ", ", topology, ">;"); statement(""); } @@ -8410,9 +8521,22 @@ void CompilerMSL::emit_specialization_constants_and_structs() if (unique_func_constants[constant_id] == c.self) statement("constant ", sc_type_name, " ", sc_tmp_name, " [[function_constant(", constant_id, ")]];"); - statement("constant ", sc_type_name, " ", sc_name, " = is_function_constant_defined(", sc_tmp_name, - ") ? ", bitcast_expression(type, sc_tmp_type, sc_tmp_name), " : ", constant_expression(c), - ";"); + // RenderDoc and other instrumentation may reuse the same SpecId with different base types. + // We deduplicate to one [[function_constant(id)]] temp and then initialize all variants from it. + // Metal forbids as_type to/from 'bool', so if either side is Boolean, avoid bitcasting here and + // prefer a value cast via a constructor instead (e.g. uint(tmp) / float(tmp) / bool(tmp)). + // This preserves expected toggle semantics and prevents illegal MSL like as_type(bool_tmp). + { + string sc_true_expr; + if (sc_tmp_type == type.basetype) + sc_true_expr = sc_tmp_name; + else if (sc_tmp_type == SPIRType::Boolean || type.basetype == SPIRType::Boolean) + sc_true_expr = join(sc_type_name, "(", sc_tmp_name, ")"); + else + sc_true_expr = bitcast_expression(type, sc_tmp_type, sc_tmp_name); + statement("constant ", sc_type_name, " ", sc_name, " = is_function_constant_defined(", sc_tmp_name, + ") ? ", sc_true_expr, " : ", constant_expression(c), ";"); + } } else if (has_decoration(c.self, DecorationSpecId)) { @@ -9212,13 +9336,18 @@ bool CompilerMSL::is_out_of_bounds_tessellation_level(uint32_t id_lhs) } bool CompilerMSL::prepare_access_chain_for_scalar_access(std::string &expr, const SPIRType &type, - spv::StorageClass storage, bool &is_packed) + StorageClass storage, bool &is_packed) { // If there is any risk of writes happening with the access chain in question, // and there is a risk of concurrent write access to other components, // we must cast the access chain to a plain pointer to ensure we only access the exact scalars we expect. // The MSL compiler refuses to allow component-level access for any non-packed vector types. - if (!is_packed && (storage == StorageClassStorageBuffer || storage == StorageClassWorkgroup)) + // MSL refuses to take address or reference to vector component, even for packed types, so just force + // through the pointer cast. No much we can do sadly. + // For packed types, we could technically omit this if we know the reference does not have to turn into a pointer + // of some kind, but that requires external analysis passes to figure out, and + // this case is likely rare enough that we don't need to bother. + if (storage == StorageClassStorageBuffer || storage == StorageClassWorkgroup) { const char *addr_space = storage == StorageClassWorkgroup ? "threadgroup" : "device"; expr = join("((", addr_space, " ", type_to_glsl(type), "*)&", enclose_expression(expr), ")"); @@ -9542,26 +9671,30 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) break; case OpFMul: - if (msl_options.invariant_float_math || has_decoration(ops[1], DecorationNoContraction)) + if (msl_options.invariant_float_math || has_legacy_nocontract(ops[0], ops[1])) MSL_BFOP(spvFMul); else MSL_BOP(*); break; case OpFAdd: - if (msl_options.invariant_float_math || has_decoration(ops[1], DecorationNoContraction)) + if (msl_options.invariant_float_math || has_legacy_nocontract(ops[0], ops[1])) MSL_BFOP(spvFAdd); else MSL_BOP(+); break; case OpFSub: - if (msl_options.invariant_float_math || has_decoration(ops[1], DecorationNoContraction)) + if (msl_options.invariant_float_math || has_legacy_nocontract(ops[0], ops[1])) MSL_BFOP(spvFSub); else MSL_BOP(-); break; + case OpFmaKHR: + MSL_TFOP(fma); + break; + // Atomics case OpAtomicExchange: { @@ -10054,7 +10187,7 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) case OpVectorTimesMatrix: case OpMatrixTimesVector: { - if (!msl_options.invariant_float_math && !has_decoration(ops[1], DecorationNoContraction)) + if (!msl_options.invariant_float_math && !has_legacy_nocontract(ops[0], ops[1])) { CompilerGLSL::emit_instruction(instruction); break; @@ -10096,7 +10229,7 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) case OpMatrixTimesMatrix: { - if (!msl_options.invariant_float_math && !has_decoration(ops[1], DecorationNoContraction)) + if (!msl_options.invariant_float_math && !has_legacy_nocontract(ops[0], ops[1])) { CompilerGLSL::emit_instruction(instruction); break; @@ -10117,8 +10250,7 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) enclose_expression(to_unpacked_row_major_matrix_expression(ops[2])), ")"); bool forward = should_forward(ops[2]) && should_forward(ops[3]); - auto &e = emit_op(ops[0], ops[1], expr, forward); - e.need_transpose = true; + emit_transposed_op(ops[0], ops[1], expr, forward); a->need_transpose = true; b->need_transpose = true; inherit_expression_dependencies(ops[1], ops[2]); @@ -10782,13 +10914,13 @@ bool CompilerMSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rh auto *lhs_var = maybe_get_backing_variable(lhs_id); if (lhs_var && lhs_storage == StorageClassStorageBuffer && storage_class_array_is_thread(lhs_var->storage)) lhs_is_array_template = true; - else if (lhs_var && lhs_storage != StorageClassGeneric && type_is_block_like(get(lhs_var->basetype))) + else if (lhs_var && lhs_storage != StorageClassGeneric && type_is_explicit_layout(get(lhs_var->basetype))) lhs_is_array_template = false; auto *rhs_var = maybe_get_backing_variable(rhs_id); if (rhs_var && rhs_storage == StorageClassStorageBuffer && storage_class_array_is_thread(rhs_var->storage)) rhs_is_array_template = true; - else if (rhs_var && rhs_storage != StorageClassGeneric && type_is_block_like(get(rhs_var->basetype))) + else if (rhs_var && rhs_storage != StorageClassGeneric && type_is_explicit_layout(get(rhs_var->basetype))) rhs_is_array_template = false; // If threadgroup storage qualifiers are *not* used: @@ -10865,6 +10997,12 @@ bool CompilerMSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rh else SPIRV_CROSS_THROW("Unknown storage class used for copying arrays."); + // Should be very rare, but mark if we need extra magic template overloads. + if (has_extended_decoration(lhs_id, SPIRVCrossDecorationPhysicalTypeID)) + add_spv_func_and_recompile(SPVFuncImplArrayCopyExtendedDst); + if (has_extended_decoration(rhs_id, SPIRVCrossDecorationPhysicalTypeID)) + add_spv_func_and_recompile(SPVFuncImplArrayCopyExtendedSrc); + // Pass internal array of spvUnsafeArray<> into wrapper functions if (lhs_is_array_template && rhs_is_array_template && !msl_options.force_native_arrays) statement("spvArrayCopy", tag, "(", lhs, ".elements, ", to_expression(rhs_id), ".elements);"); @@ -10879,7 +11017,7 @@ bool CompilerMSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rh return true; } -uint32_t CompilerMSL::get_physical_tess_level_array_size(spv::BuiltIn builtin) const +uint32_t CompilerMSL::get_physical_tess_level_array_size(BuiltIn builtin) const { if (is_tessellating_triangles()) return builtin == BuiltInTessLevelInner ? 1 : 3; @@ -11050,7 +11188,7 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, } exp += join(image_expr, ".", op, "("); - if (ptr_type.storage == StorageClassImage && res_type->image.arrayed) + if (ptr_type.storage == StorageClassImage && (res_type->image.arrayed || res_type->image.dim == DimCube)) { switch (res_type->image.dim) { @@ -11059,13 +11197,21 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, exp += join("uint2(", coord, ".x, 0), ", coord, ".y"); else exp += join(coord, ".x, ", coord, ".y"); - break; case Dim2D: exp += join(coord, ".xy, ", coord, ".z"); break; + case DimCube: + if (!msl_options.supports_msl_version(4, 0)) + SPIRV_CROSS_THROW("Cannot do atomics on Cube textures before 4.0."); + + if (res_type->image.arrayed) + exp += join(coord, ".xy, ", coord, ".z % 6u, ", coord, ".z / 6u"); + else + exp += join(coord, ".xy, ", coord, ".z"); + break; default: - SPIRV_CROSS_THROW("Cannot do atomics on Cube textures."); + SPIRV_CROSS_THROW("Cannot do atomics on unknown dimension."); } } else if (ptr_type.storage == StorageClassImage && res_type->image.dim == Dim1D && msl_options.texture_1D_as_2D) @@ -11092,7 +11238,7 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, } else if (var && ptr_type.storage != StorageClassPhysicalStorageBuffer) { - exp += get_argument_address_space(*var); + exp += get_variable_address_space(*var); } else { @@ -11239,35 +11385,76 @@ void CompilerMSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, auto &restype = get(result_type); + // Only precise:: preserves NaN in trancendentals (supposedly, cannot find documentation for this). + const auto drop_nan_inf = FPFastMathModeNotInfMask | FPFastMathModeNotNaNMask; + bool preserve_nan = (get_fp_fast_math_flags_for_op(result_type, id) & drop_nan_inf) != drop_nan_inf; + const char *preserve_str = preserve_nan ? "precise" : "fast"; + + // TODO: Emit the default behavior to match existing code. Might need to be revisited. + // Only fp32 has the precise:: override. +#define EMIT_PRECISE_OVERRIDE(glsl_op, op) \ + case GLSLstd450##glsl_op: \ + if (restype.basetype == SPIRType::Float && preserve_nan) \ + emit_unary_func_op(result_type, id, args[0], "precise::" op); \ + else \ + CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count); \ + break + switch (op) { + EMIT_PRECISE_OVERRIDE(Cos, "cos"); + EMIT_PRECISE_OVERRIDE(Sin, "sin"); + EMIT_PRECISE_OVERRIDE(Tan, "tan"); + EMIT_PRECISE_OVERRIDE(Acos, "acos"); + EMIT_PRECISE_OVERRIDE(Asin, "asin"); + EMIT_PRECISE_OVERRIDE(Atan, "atan"); + EMIT_PRECISE_OVERRIDE(Exp, "exp"); + EMIT_PRECISE_OVERRIDE(Exp2, "exp2"); + EMIT_PRECISE_OVERRIDE(Log, "log"); + EMIT_PRECISE_OVERRIDE(Log2, "log2"); + EMIT_PRECISE_OVERRIDE(Sqrt, "sqrt"); +#undef EMIT_PRECISE_OVERRIDE + case GLSLstd450Sinh: if (restype.basetype == SPIRType::Half) { + auto ftype = restype; + ftype.basetype = SPIRType::Float; + // MSL does not have overload for half. Force-cast back to half. - auto expr = join("half(fast::sinh(", to_unpacked_expression(args[0]), "))"); + auto expr = join(type_to_glsl(restype), "(", preserve_str, "::sinh(", type_to_glsl(ftype), "(", to_unpacked_expression(args[0]), ")))"); emit_op(result_type, id, expr, should_forward(args[0])); inherit_expression_dependencies(id, args[0]); } + else if (preserve_nan) + emit_unary_func_op(result_type, id, args[0], "precise::sinh"); else emit_unary_func_op(result_type, id, args[0], "fast::sinh"); break; case GLSLstd450Cosh: if (restype.basetype == SPIRType::Half) { + auto ftype = restype; + ftype.basetype = SPIRType::Float; + // MSL does not have overload for half. Force-cast back to half. - auto expr = join("half(fast::cosh(", to_unpacked_expression(args[0]), "))"); + auto expr = join(type_to_glsl(restype), "(", preserve_str, "::cosh(", type_to_glsl(ftype), "(", to_unpacked_expression(args[0]), ")))"); emit_op(result_type, id, expr, should_forward(args[0])); inherit_expression_dependencies(id, args[0]); } + else if (preserve_nan) + emit_unary_func_op(result_type, id, args[0], "precise::cosh"); else emit_unary_func_op(result_type, id, args[0], "fast::cosh"); break; case GLSLstd450Tanh: if (restype.basetype == SPIRType::Half) { + auto ftype = restype; + ftype.basetype = SPIRType::Float; + // MSL does not have overload for half. Force-cast back to half. - auto expr = join("half(fast::tanh(", to_unpacked_expression(args[0]), "))"); + auto expr = join(type_to_glsl(restype), "(", preserve_str, "::tanh(", type_to_glsl(ftype), "(", to_unpacked_expression(args[0]), ")))"); emit_op(result_type, id, expr, should_forward(args[0])); inherit_expression_dependencies(id, args[0]); } @@ -11278,7 +11465,13 @@ void CompilerMSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, if (restype.basetype == SPIRType::Half) { // MSL does not have overload for half. Force-cast back to half. - auto expr = join("half(fast::atan2(", to_unpacked_expression(args[0]), ", ", to_unpacked_expression(args[1]), "))"); + auto ftype = restype; + ftype.basetype = SPIRType::Float; + + auto expr = join(type_to_glsl(restype), + "(", preserve_str, "::atan2(", + type_to_glsl(ftype), "(", to_unpacked_expression(args[0]), "), ", + type_to_glsl(ftype), "(", to_unpacked_expression(args[1]), ")))"); emit_op(result_type, id, expr, should_forward(args[0]) && should_forward(args[1])); inherit_expression_dependencies(id, args[0]); inherit_expression_dependencies(id, args[1]); @@ -11287,7 +11480,10 @@ void CompilerMSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, emit_binary_func_op(result_type, id, args[0], args[1], "precise::atan2"); break; case GLSLstd450InverseSqrt: - emit_unary_func_op(result_type, id, args[0], "rsqrt"); + if (restype.basetype == SPIRType::Float && preserve_nan) + emit_unary_func_op(result_type, id, args[0], "precise::rsqrt"); + else + emit_unary_func_op(result_type, id, args[0], "rsqrt"); break; case GLSLstd450RoundEven: emit_unary_func_op(result_type, id, args[0], "rint"); @@ -11519,11 +11715,14 @@ void CompilerMSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, { auto &exp_type = expression_type(args[0]); // MSL does not support scalar versions here. - // MSL has no implementation for normalize in the fast:: namespace for half2 and half3 + // MSL has no implementation for normalize in the fast:: namespace for half // Returns -1 or 1 for valid input, sign() does the job. + + // precise::normalize asm looks ridiculous. + // Don't think this actually matters unless proven otherwise. if (exp_type.vecsize == 1) emit_unary_func_op(result_type, id, args[0], "sign"); - else if (exp_type.vecsize <= 3 && exp_type.basetype == SPIRType::Half) + else if (exp_type.basetype == SPIRType::Half) emit_unary_func_op(result_type, id, args[0], "normalize"); else emit_unary_func_op(result_type, id, args[0], "fast::normalize"); @@ -11586,7 +11785,10 @@ void CompilerMSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, case GLSLstd450Pow: // powr makes x < 0.0 undefined, just like SPIR-V. - emit_binary_func_op(result_type, id, args[0], args[1], "powr"); + if (restype.basetype == SPIRType::Float && preserve_nan) + emit_binary_func_op(result_type, id, args[0], args[1], "precise::powr"); + else + emit_binary_func_op(result_type, id, args[0], args[1], "powr"); break; default: @@ -12973,7 +13175,6 @@ string CompilerMSL::to_swizzle_expression(uint32_t id) string CompilerMSL::to_buffer_size_expression(uint32_t id) { auto expr = to_expression(id); - auto index = expr.find_first_of('['); // This is quite crude, but we need to translate the reference name (*spvDescriptorSetN.name) to // the pointer expression spvDescriptorSetN.name to make a reasonable expression here. @@ -12981,17 +13182,26 @@ string CompilerMSL::to_buffer_size_expression(uint32_t id) if (expr.size() >= 3 && expr[0] == '(' && expr[1] == '*') expr = address_of_expression(expr); + auto index = expr.find_first_of('['); + string buffer_expr, array_expr; + + if (index != string::npos) + { + buffer_expr = expr.substr(0, index); + array_expr = expr.substr(index); + } + // If a buffer is part of an argument buffer translate this to a legal identifier. for (auto &c : expr) if (c == '.') c = '_'; if (index == string::npos) + { return expr + buffer_size_name_suffix; + } else { - auto buffer_expr = expr.substr(0, index); - auto array_expr = expr.substr(index); if (auto var = maybe_get_backing_variable(id)) { if (is_var_runtime_size_array(*var)) @@ -13004,6 +13214,11 @@ string CompilerMSL::to_buffer_size_expression(uint32_t id) return buffer_expr + ".length(" + array_expr.substr(1, last_pos - 1) + ")"; } } + + for (auto &c : buffer_expr) + if (c == '.') + c = '_'; + return buffer_expr + buffer_size_name_suffix + array_expr; } } @@ -13058,17 +13273,20 @@ string CompilerMSL::convert_row_major_matrix(string exp_str, const SPIRType &exp // Called automatically at the end of the entry point function void CompilerMSL::emit_fixup() { - if (is_vertex_like_shader() && stage_out_var_id && !qual_pos_var_name.empty() && !capture_output_to_buffer) + if (stage_out_var_id && !capture_output_to_buffer) { - if (msl_options.enable_point_size_default && !writes_to_point_size) + if (needs_point_size_output && !writes_to_point_size) statement(builtin_to_glsl(BuiltInPointSize, StorageClassOutput), " = ", format_float(msl_options.default_point_size), ";"); - if (options.vertex.fixup_clipspace) - statement(qual_pos_var_name, ".z = (", qual_pos_var_name, ".z + ", qual_pos_var_name, - ".w) * 0.5; // Adjust clip-space for Metal"); + if (is_vertex_like_shader() && !qual_pos_var_name.empty()) + { + if (options.vertex.fixup_clipspace) + statement(qual_pos_var_name, ".z = (", qual_pos_var_name, ".z + ", qual_pos_var_name, + ".w) * 0.5; // Adjust clip-space for Metal"); - if (options.vertex.flip_vert_y) - statement(qual_pos_var_name, ".y = -(", qual_pos_var_name, ".y);", " // Invert Y-axis for Metal"); + if (options.vertex.flip_vert_y) + statement(qual_pos_var_name, ".y = -(", qual_pos_var_name, ".y);", " // Invert Y-axis for Metal"); + } } } @@ -13722,7 +13940,7 @@ uint32_t CompilerMSL::get_member_location(uint32_t type_id, uint32_t index, uint return k_unknown_location; } -uint32_t CompilerMSL::get_or_allocate_builtin_input_member_location(spv::BuiltIn builtin, +uint32_t CompilerMSL::get_or_allocate_builtin_input_member_location(BuiltIn builtin, uint32_t type_id, uint32_t index, uint32_t *comp) { @@ -13767,7 +13985,7 @@ uint32_t CompilerMSL::get_or_allocate_builtin_input_member_location(spv::BuiltIn return loc; } -uint32_t CompilerMSL::get_or_allocate_builtin_output_member_location(spv::BuiltIn builtin, +uint32_t CompilerMSL::get_or_allocate_builtin_output_member_location(BuiltIn builtin, uint32_t type_id, uint32_t index, uint32_t *comp) { @@ -13810,6 +14028,26 @@ uint32_t CompilerMSL::get_or_allocate_builtin_output_member_location(spv::BuiltI return loc; } +bool CompilerMSL::entry_point_is_vertex() const +{ + // MSL vertex entrypoint is used for non-tessellation vertex stage or tessellation evaluation stage. + return (get_execution_model() == ExecutionModelVertex && !msl_options.vertex_for_tessellation) || + get_execution_model() == ExecutionModelTessellationEvaluation; +} + +bool CompilerMSL::entry_point_returns_stage_output() const +{ + if (get_execution_model() == ExecutionModelVertex && msl_options.vertex_for_tessellation) + return false; + bool ep_should_return_output = !get_is_rasterization_disabled(); + return stage_out_var_id && ep_should_return_output; +} + +bool CompilerMSL::entry_point_requires_const_device_buffers() const +{ + return !has_descriptor_side_effects_buffer && !capture_output_to_buffer; +} + // Returns the type declaration for a function, including the // entry type if the current function is the entry point function string CompilerMSL::func_type_decl(SPIRType &type) @@ -13820,8 +14058,7 @@ string CompilerMSL::func_type_decl(SPIRType &type) return return_type; // If an outgoing interface block has been defined, and it should be returned, override the entry point return type - bool ep_should_return_output = !get_is_rasterization_disabled(); - if (stage_out_var_id && ep_should_return_output) + if (entry_point_returns_stage_output()) return_type = type_to_glsl(get_stage_out_struct_type()) + type_to_array_glsl(type, 0); // Prepend a entry type, based on the execution model @@ -13884,7 +14121,7 @@ bool CompilerMSL::is_tese_shader() const bool CompilerMSL::is_mesh_shader() const { - return get_execution_model() == spv::ExecutionModelMeshEXT; + return get_execution_model() == ExecutionModelMeshEXT; } bool CompilerMSL::uses_explicit_early_fragment_test() @@ -13894,11 +14131,17 @@ bool CompilerMSL::uses_explicit_early_fragment_test() } // In MSL, address space qualifiers are required for all pointer or reference variables -string CompilerMSL::get_argument_address_space(const SPIRVariable &argument) +string CompilerMSL::get_variable_address_space(const SPIRVariable &argument) { const auto &type = get(argument.basetype); - // BDA is always passed around by value. There is no storage class for the argument itself. - if (is_physical_pointer(type)) + return get_type_address_space(type, argument.self, true); +} + +string CompilerMSL::get_leaf_argument_address_space(const SPIRVariable &argument) +{ + const auto &type = get(argument.basetype); + // BDA and variable buffer pointer is always passed around by (pointer) value. There is no storage class for the argument itself. + if (is_physical_or_buffer_pointer(type)) return ""; return get_type_address_space(type, argument.self, true); } @@ -13944,26 +14187,19 @@ string CompilerMSL::get_type_address_space(const SPIRType &type, uint32_t id, bo break; case StorageClassStorageBuffer: + case StorageClassPhysicalStorageBuffer: { - // For arguments from variable pointers, we use the write count deduction, so - // we should not assume any constness here. Only for global SSBOs. - bool readonly = false; - if (!var || has_decoration(type.self, DecorationBlock)) - readonly = flags.get(DecorationNonWritable); - - if (decoration_flags_signal_coherent(flags)) - readonly = false; - - addr_space = readonly ? "const device" : "device"; + // When dealing with descriptor aliasing, it becomes very problematic to make use of + // readonly qualifiers. + // If rasterization is not disabled in vertex/tese, Metal does not allow side effects and refuses to compile "device", + // even if there are no writes. Just force const device. + if (entry_point_requires_const_device_buffers() && type.basetype != SPIRType::AtomicCounter) + addr_space = "const device"; + else + addr_space = "device"; break; } - case StorageClassPhysicalStorageBuffer: - // We cannot fully trust NonWritable coming from glslang due to a bug in buffer_reference handling. - // There isn't much gain in emitting const in C++ languages anyway. - addr_space = "device"; - break; - case StorageClassUniform: case StorageClassUniformConstant: case StorageClassPushConstant: @@ -13971,12 +14207,18 @@ string CompilerMSL::get_type_address_space(const SPIRType &type, uint32_t id, bo { bool ssbo = has_decoration(type.self, DecorationBufferBlock); if (ssbo) - addr_space = flags.get(DecorationNonWritable) ? "const device" : "device"; + { + if (entry_point_requires_const_device_buffers() && type.basetype != SPIRType::AtomicCounter) + addr_space = "const device"; + else + addr_space = "device"; + } else addr_space = "constant"; } else if (!argument) { + // This is used for helper UBOs we insert ourselves. addr_space = "constant"; } else if (type_is_msl_framebuffer_fetch(type)) @@ -13984,6 +14226,7 @@ string CompilerMSL::get_type_address_space(const SPIRType &type, uint32_t id, bo // Subpass inputs are passed around by value. addr_space = ""; } + break; case StorageClassFunction: @@ -14027,6 +14270,10 @@ string CompilerMSL::get_type_address_space(const SPIRType &type, uint32_t id, bo addr_space = "threadgroup"; } + // BlockIO is passed as thread and lowered on return from main. + if (get_execution_model() == ExecutionModelVertex && has_decoration(type.self, DecorationBlock)) + addr_space = "thread"; + if (!addr_space) addr_space = "device"; } @@ -14046,6 +14293,9 @@ string CompilerMSL::get_type_address_space(const SPIRType &type, uint32_t id, bo break; } + if (!addr_space && var && is_var_runtime_size_array(*var)) + addr_space = "device"; + if (!addr_space) { // No address space for plain values. @@ -14497,7 +14747,7 @@ string CompilerMSL::entry_point_args_argument_buffer(bool append_comma) claimed_bindings.set(buffer_binding); - ep_args += get_argument_address_space(var) + " "; + ep_args += get_variable_address_space(var) + " "; if (recursive_inputs.count(type.self)) ep_args += string("void* ") + to_restrict(id, true) + to_name(id) + "_vp"; @@ -14589,17 +14839,21 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) // For fully mutable-style aliasing, we need argument buffers where we can exploit the fact // that descriptors are all 8 bytes. SPIRVariable *discrete_descriptor_alias = nullptr; - if (var.storage == StorageClassUniform || var.storage == StorageClassStorageBuffer) + + const auto resource_is_aliasing_candidate = [this](const SPIRVariable &var_) { + return is_var_runtime_size_array(var_) || var_.storage == StorageClassUniform || + var_.storage == StorageClassStorageBuffer; + }; + + if (resource_is_aliasing_candidate(var)) { for (auto &resource : resources) { - if (get_decoration(resource.var->self, DecorationDescriptorSet) == + if (resource_is_aliasing_candidate(*resource.var) && + get_decoration(resource.var->self, DecorationDescriptorSet) == get_decoration(var_id, DecorationDescriptorSet) && get_decoration(resource.var->self, DecorationBinding) == - get_decoration(var_id, DecorationBinding) && - resource.basetype == SPIRType::Struct && type.basetype == SPIRType::Struct && - (resource.var->storage == StorageClassUniform || - resource.var->storage == StorageClassStorageBuffer)) + get_decoration(var_id, DecorationBinding)) { discrete_descriptor_alias = resource.var; // Self-reference marks that we should declare the resource, @@ -14608,6 +14862,13 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) // Need to promote interlocked usage so that the primary declaration is correct. if (interlocked_resources.count(var_id)) interlocked_resources.insert(resource.var->self); + + // Aliasing with unroll just gets too messy to deal with. I sure hope this never comes up ... + if ((is_array(get_variable_data_type(*resource.var)) && !is_var_runtime_size_array(*resource.var)) || + (is_array(get_variable_data_type(var)) && !is_var_runtime_size_array(var))) + { + SPIRV_CROSS_THROW("Attempting to alias same binding with a descriptor array which is not implemented through argument buffers. This is unsupported."); + } break; } } @@ -14678,6 +14939,57 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) uint32_t var_id = var.self; + if (is_var_runtime_size_array(var)) + { + add_spv_func_and_recompile(SPVFuncImplVariableDescriptorArray); + const bool ssbo = has_decoration(type.self, DecorationBufferBlock); + if ((var.storage == StorageClassStorageBuffer || ssbo) && msl_options.runtime_array_rich_descriptor) + add_spv_func_and_recompile(SPVFuncImplVariableSizedDescriptor); + else + add_spv_func_and_recompile(SPVFuncImplVariableDescriptor); + } + + if (r.discrete_descriptor_alias) + { + if (r.var == r.discrete_descriptor_alias) + { + auto primary_name = join("spvBufferAliasSet", + get_decoration(var_id, DecorationDescriptorSet), + "Binding", + get_decoration(var_id, DecorationBinding)); + + // Declare the primary alias as void* + if (!ep_args.empty()) + ep_args += ", "; + ep_args += get_variable_address_space(var) + " void* " + primary_name; + ep_args += " [[buffer(" + convert_to_string(r.index) + ")"; + if (interlocked_resources.count(var_id)) + ep_args += ", raster_order_group(0)"; + ep_args += "]]"; + } + + buffer_aliases_discrete.push_back(r.var->self); + continue; + } + + uint32_t desc_set = get_decoration(var_id, DecorationDescriptorSet); + uint32_t desc_binding = get_decoration(var_id, DecorationBinding); + + if (is_var_runtime_size_array(var)) + { + // This must be implemented as an argument buffer. Cast to intended descriptor array type on-demand. + if (!ep_args.empty()) + ep_args += ", "; + ep_args += join("device const void* spvDescriptorSet", desc_set, "Binding", desc_binding); + if (type.basetype == SPIRType::SampledImage && r.basetype == SPIRType::Sampler) + ep_args += "Smplr"; + ep_args += " [[buffer(" + convert_to_string(r.index) + ")"; + if (interlocked_resources.count(var_id)) + ep_args += ", raster_order_group(0)"; + ep_args += "]]"; + continue; + } + switch (r.basetype) { case SPIRType::Struct: @@ -14686,80 +14998,31 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) if (m.members.size() == 0) break; - if (r.discrete_descriptor_alias) - { - if (r.var == r.discrete_descriptor_alias) - { - auto primary_name = join("spvBufferAliasSet", - get_decoration(var_id, DecorationDescriptorSet), - "Binding", - get_decoration(var_id, DecorationBinding)); - - // Declare the primary alias as void* - if (!ep_args.empty()) - ep_args += ", "; - ep_args += get_argument_address_space(var) + " void* " + primary_name; - ep_args += " [[buffer(" + convert_to_string(r.index) + ")"; - if (interlocked_resources.count(var_id)) - ep_args += ", raster_order_group(0)"; - ep_args += "]]"; - } - - buffer_aliases_discrete.push_back(r.var->self); - } - else if (!type.array.empty()) + if (!type.array.empty()) { if (type.array.size() > 1) SPIRV_CROSS_THROW("Arrays of arrays of buffers are not supported."); is_using_builtin_array = true; - if (is_var_runtime_size_array(var)) + uint32_t array_size = get_resource_array_size(type, var_id); + for (uint32_t i = 0; i < array_size; ++i) { - add_spv_func_and_recompile(SPVFuncImplVariableDescriptorArray); if (!ep_args.empty()) ep_args += ", "; - const bool ssbo = has_decoration(type.self, DecorationBufferBlock); - if ((var.storage == spv::StorageClassStorageBuffer || ssbo) && - msl_options.runtime_array_rich_descriptor) - { - add_spv_func_and_recompile(SPVFuncImplVariableSizedDescriptor); - ep_args += "const device spvBufferDescriptor<" + get_argument_address_space(var) + " " + - type_to_glsl(type) + "*>* "; - } - else - { - add_spv_func_and_recompile(SPVFuncImplVariableDescriptor); - ep_args += "const device spvDescriptor<" + get_argument_address_space(var) + " " + - type_to_glsl(type) + "*>* "; - } - ep_args += to_restrict(var_id, true) + r.name + "_"; - ep_args += " [[buffer(" + convert_to_string(r.index) + ")"; + ep_args += get_variable_address_space(var) + " " + type_to_glsl(type) + "* " + + to_restrict(var_id, true) + r.name + "_" + convert_to_string(i); + ep_args += " [[buffer(" + convert_to_string(r.index + i) + ")"; if (interlocked_resources.count(var_id)) ep_args += ", raster_order_group(0)"; ep_args += "]]"; } - else - { - uint32_t array_size = get_resource_array_size(type, var_id); - for (uint32_t i = 0; i < array_size; ++i) - { - if (!ep_args.empty()) - ep_args += ", "; - ep_args += get_argument_address_space(var) + " " + type_to_glsl(type) + "* " + - to_restrict(var_id, true) + r.name + "_" + convert_to_string(i); - ep_args += " [[buffer(" + convert_to_string(r.index + i) + ")"; - if (interlocked_resources.count(var_id)) - ep_args += ", raster_order_group(0)"; - ep_args += "]]"; - } - } is_using_builtin_array = false; } else { if (!ep_args.empty()) ep_args += ", "; - ep_args += get_argument_address_space(var) + " "; + ep_args += get_variable_address_space(var) + " "; if (recursive_inputs.count(type.self)) ep_args += string("void* ") + to_restrict(var_id, true) + r.name + "_vp"; @@ -14777,10 +15040,7 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) if (!ep_args.empty()) ep_args += ", "; ep_args += sampler_type(type, var_id, false) + " " + r.name; - if (is_var_runtime_size_array(var)) - ep_args += "_ [[buffer(" + convert_to_string(r.index) + ")]]"; - else - ep_args += " [[sampler(" + convert_to_string(r.index) + ")]]"; + ep_args += " [[sampler(" + convert_to_string(r.index) + ")]]"; break; case SPIRType::Image: { @@ -14795,10 +15055,7 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) if (r.plane > 0) ep_args += join(plane_name_suffix, r.plane); - if (is_var_runtime_size_array(var)) - ep_args += "_ [[buffer(" + convert_to_string(r.index) + ")"; - else - ep_args += " [[texture(" + convert_to_string(r.index) + ")"; + ep_args += " [[texture(" + convert_to_string(r.index) + ")"; if (interlocked_resources.count(var_id)) ep_args += ", raster_order_group(0)"; @@ -14828,23 +15085,10 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) } case SPIRType::AccelerationStructure: { - if (is_var_runtime_size_array(var)) - { - add_spv_func_and_recompile(SPVFuncImplVariableDescriptor); - const auto &parent_type = get(type.parent_type); - if (!ep_args.empty()) - ep_args += ", "; - ep_args += "const device spvDescriptor<" + type_to_glsl(parent_type) + ">* " + - to_restrict(var_id, true) + r.name + "_"; - ep_args += " [[buffer(" + convert_to_string(r.index) + ")]]"; - } - else - { - if (!ep_args.empty()) - ep_args += ", "; - ep_args += type_to_glsl(type, var_id) + " " + r.name; - ep_args += " [[buffer(" + convert_to_string(r.index) + ")]]"; - } + if (!ep_args.empty()) + ep_args += ", "; + ep_args += type_to_glsl(type, var_id) + " " + r.name; + ep_args += " [[buffer(" + convert_to_string(r.index) + ")]]"; break; } default: @@ -14970,7 +15214,7 @@ void CompilerMSL::fix_up_shader_inputs_outputs() { recursive_inputs.insert(type.self); entry_func.fixup_hooks_in.push_back([this, &type, &var, var_id]() { - auto addr_space = get_argument_address_space(var); + auto addr_space = get_variable_address_space(var); auto var_name = to_name(var_id); statement(addr_space, " auto& ", to_restrict(var_id, true), var_name, " = *(", addr_space, " ", type_to_glsl(type), "*)", var_name, "_vp;"); @@ -15667,7 +15911,7 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) // Physical pointer types are passed by pointer, not reference. auto &data_type = get_variable_data_type(var); - bool passed_by_value = is_physical_pointer(var_type); + bool passed_by_value = arg.alias_global_variable ? false : is_physical_or_buffer_pointer(var_type); auto &type = passed_by_value ? var_type : data_type; // If we need to modify the name of the variable, make sure we use the original variable. @@ -15679,10 +15923,18 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) bool constref = !arg.alias_global_variable && !passed_by_value && is_pointer(var_type) && arg.write_count == 0; // Framebuffer fetch is plain value, const looks out of place, but it is not wrong. // readonly coming from glslang is not reliable in all cases. - if (type_is_msl_framebuffer_fetch(type) || type_storage == StorageClassPhysicalStorageBuffer) + // For UBOs, readonly is implied, and for SSBOs we use global check. + if (type_is_msl_framebuffer_fetch(type) || + type_storage == StorageClassStorageBuffer || + type_storage == StorageClassUniform || + type_storage == StorageClassPhysicalStorageBuffer) + { constref = false; + } else if (type_storage == StorageClassUniformConstant) + { constref = true; + } bool type_is_image = type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage || type.basetype == SPIRType::Sampler; @@ -15702,7 +15954,7 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) spv_function_implementations.count(SPVFuncImplDynamicImageSampler); // Allow Metal to use the array template to make arrays a value type - string address_space = get_argument_address_space(var); + string address_space = arg.alias_global_variable ? get_variable_address_space(var) : get_leaf_argument_address_space(var); bool builtin = has_decoration(var.self, DecorationBuiltIn); auto builtin_type = BuiltIn(get_decoration(arg.id, DecorationBuiltIn)); @@ -15799,10 +16051,29 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) } else { - if (!address_space.empty()) - decl = join(address_space, " ", decl); - decl += " "; - decl += to_expression(name_id); + // Variable pointer to array is kinda awkward ... + bool pointer_to_logical_buffer_array = + !is_physical_pointer(type) && is_pointer(type) && + has_decoration(type.parent_type, DecorationArrayStride); + + if (pointer_to_logical_buffer_array) + { + decl.pop_back(); + decl += " (*"; + decl += to_expression(name_id); + decl += ")"; + bool old_is_using_builtin_array = is_using_builtin_array; + is_using_builtin_array = true; + decl += type_to_array_glsl(type, name_id); + is_using_builtin_array = old_is_using_builtin_array; + } + else + { + if (!address_space.empty()) + decl = join(address_space, " ", decl); + decl += " "; + decl += to_expression(name_id); + } } } else if (is_array(type) && !type_is_image) @@ -16109,6 +16380,7 @@ const std::unordered_set &CompilerMSL::get_reserved_keyword_set() "quad_broadcast", "thread", "threadgroup", + "signed", }; return keywords; @@ -16246,6 +16518,13 @@ const std::unordered_set &CompilerMSL::get_illegal_func_names() "M_2_SQRTPI", "M_SQRT2", "M_SQRT1_2", + "int8", + "uint8", + "int16", + "uint16", + "float8", + "float16", + "signed", }; return illegal_func_names; @@ -16414,8 +16693,11 @@ string CompilerMSL::type_to_glsl(const SPIRType &type, uint32_t id, bool member) // the C-style nesting works right. // FIXME: This is somewhat of a hack. bool old_is_using_builtin_array = is_using_builtin_array; + bool pointer_to_buffer_array = is_pointer(type) && has_decoration(type.parent_type, DecorationArrayStride); if (is_physical_pointer(type)) is_using_builtin_array = false; + else if (pointer_to_buffer_array) + is_using_builtin_array = true; type_name = join(type_address_space, " ", type_to_glsl(*p_parent_type, id)); @@ -16610,7 +16892,7 @@ string CompilerMSL::type_to_array_glsl(const SPIRType &type, uint32_t variable_i default: if (type_is_array_of_pointers(type) || using_builtin_array()) { - const SPIRVariable *var = variable_id ? &get(variable_id) : nullptr; + const SPIRVariable *var = variable_id ? maybe_get(variable_id) : nullptr; if (var && (var->storage == StorageClassUniform || var->storage == StorageClassStorageBuffer) && is_array(get_variable_data_type(*var))) { @@ -16639,7 +16921,7 @@ string CompilerMSL::constant_op_expression(const SPIRConstantOp &cop) } } -bool CompilerMSL::variable_decl_is_remapped_storage(const SPIRVariable &variable, spv::StorageClass storage) const +bool CompilerMSL::variable_decl_is_remapped_storage(const SPIRVariable &variable, StorageClass storage) const { if (variable.storage == storage) return true; @@ -17385,13 +17667,18 @@ void CompilerMSL::emit_subgroup_cluster_op_cast(uint32_t result_type, uint32_t r inherit_expression_dependencies(result_id, op0); } +// Note: Metal forbids bitcasting to/from 'bool' using as_type. This function is used widely +// for generating casts in the backend. To avoid generating illegal MSL when the canonical +// function constant type (from deduplicated SpecId) is Boolean, fall back to value-cast in +// that case by returning type_to_glsl(out_type) instead of as_type<...>. string CompilerMSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &in_type) { if (out_type.basetype == in_type.basetype) return ""; - assert(out_type.basetype != SPIRType::Boolean); - assert(in_type.basetype != SPIRType::Boolean); + // Avoid bitcasting to/from booleans in MSL; use value cast instead. + if (out_type.basetype == SPIRType::Boolean || in_type.basetype == SPIRType::Boolean) + return type_to_glsl(out_type); bool integral_cast = type_is_integral(out_type) && type_is_integral(in_type) && (out_type.vecsize == in_type.vecsize); bool same_size_cast = (out_type.width * out_type.vecsize) == (in_type.width * in_type.vecsize); @@ -17776,7 +18063,10 @@ string CompilerMSL::builtin_qualifier(BuiltIn builtin) { // thread_execution_width is an alias for threads_per_simdgroup, and it's only available since 1.0, // but not in fragment. - return "thread_execution_width"; + if (msl_options.supports_msl_version(3, 0)) + return "threads_per_simdgroup"; + else + return "thread_execution_width"; } case BuiltInNumSubgroups: @@ -17806,6 +18096,7 @@ string CompilerMSL::builtin_qualifier(BuiltIn builtin) return "thread_index_in_simdgroup"; } else if (execution.model == ExecutionModelKernel || execution.model == ExecutionModelGLCompute || + execution.model == ExecutionModelTaskEXT || execution.model == ExecutionModelMeshEXT || execution.model == ExecutionModelTessellationControl || (execution.model == ExecutionModelVertex && msl_options.vertex_for_tessellation)) { @@ -18282,7 +18573,7 @@ void CompilerMSL::analyze_workgroup_variables() }); } -bool CompilerMSL::SampledImageScanner::handle(spv::Op opcode, const uint32_t *args, uint32_t length) +bool CompilerMSL::SampledImageScanner::handle(Op opcode, const uint32_t *args, uint32_t length) { switch (opcode) { @@ -18294,12 +18585,12 @@ bool CompilerMSL::SampledImageScanner::handle(spv::Op opcode, const uint32_t *ar return false; uint32_t result_type = args[0]; - auto &type = compiler.get(result_type); + auto &type = get(result_type); if ((type.basetype != SPIRType::Image && type.basetype != SPIRType::SampledImage) || type.image.sampled != 1) return true; uint32_t id = args[1]; - compiler.set(id, "", result_type, true); + set(id, "", result_type, true); break; } case OpImageSampleExplicitLod: @@ -18313,9 +18604,9 @@ bool CompilerMSL::SampledImageScanner::handle(spv::Op opcode, const uint32_t *ar case OpImageFetch: case OpImageGather: case OpImageDrefGather: - compiler.has_sampled_images = - compiler.has_sampled_images || compiler.is_sampled_image_type(compiler.expression_type(args[2])); - compiler.needs_swizzle_buffer_def = compiler.needs_swizzle_buffer_def || compiler.has_sampled_images; + self.has_sampled_images = + self.has_sampled_images || self.is_sampled_image_type(self.expression_type(args[2])); + self.needs_swizzle_buffer_def = self.needs_swizzle_buffer_def || self.has_sampled_images; break; default: break; @@ -18345,7 +18636,7 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui SPVFuncImpl spv_func = get_spv_func_impl(opcode, args, length); if (spv_func != SPVFuncImplNone) { - compiler.spv_function_implementations.insert(spv_func); + self.spv_function_implementations.insert(spv_func); suppress_missing_prototypes = true; } @@ -18363,9 +18654,9 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui // Emulate texture2D atomic operations case OpImageTexelPointer: { - if (!compiler.msl_options.supports_msl_version(3, 1)) + if (!self.msl_options.supports_msl_version(3, 1)) { - auto *var = compiler.maybe_get_backing_variable(args[2]); + auto *var = self.maybe_get_backing_variable(args[2]); image_pointers_emulated[args[1]] = var ? var->self : ID(0); } break; @@ -18401,7 +18692,7 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui if (it != image_pointers_emulated.end()) { uses_image_write = true; - compiler.atomic_image_vars_emulated.insert(it->second); + self.atomic_image_vars_emulated.insert(it->second); } else check_resource_write(args[2]); @@ -18414,7 +18705,7 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui auto it = image_pointers_emulated.find(args[0]); if (it != image_pointers_emulated.end()) { - compiler.atomic_image_vars_emulated.insert(it->second); + self.atomic_image_vars_emulated.insert(it->second); uses_image_write = true; } else @@ -18428,7 +18719,7 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui auto it = image_pointers_emulated.find(args[2]); if (it != image_pointers_emulated.end()) { - compiler.atomic_image_vars_emulated.insert(it->second); + self.atomic_image_vars_emulated.insert(it->second); } break; } @@ -18453,7 +18744,7 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui // Add the correct invocation ID for calculating clustered rotate case. if (length > 5) { - if (static_cast(compiler.evaluate_constant_u32(args[2])) == ScopeSubgroup) + if (static_cast(self.evaluate_constant_u32(args[2])) == ScopeSubgroup) needs_subgroup_invocation_id = true; else needs_local_invocation_index = true; @@ -18477,18 +18768,18 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui case OpGroupNonUniformLogicalOr: case OpGroupNonUniformLogicalXor: if ((compiler.get_execution_model() != ExecutionModelFragment || - compiler.msl_options.supports_msl_version(2, 2)) && + self.msl_options.supports_msl_version(2, 2)) && args[3] == GroupOperationClusteredReduce) needs_subgroup_invocation_id = true; break; case OpArrayLength: { - auto *var = compiler.maybe_get_backing_variable(args[2]); + auto *var = self.maybe_get_backing_variable(args[2]); if (var != nullptr) { - if (!compiler.is_var_runtime_size_array(*var)) - compiler.buffers_requiring_array_length.insert(var->self); + if (!self.is_var_runtime_size_array(*var)) + self.buffers_requiring_array_length.insert(var->self); } break; } @@ -18502,16 +18793,16 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui uint32_t id = args[1]; uint32_t ptr = args[2]; - compiler.set(id, "", result_type, true); - compiler.register_read(id, ptr, true); - compiler.ir.ids[id].set_allow_type_rewrite(); + set(id, "", result_type, true); + self.register_read(id, ptr, true); + self.ir.ids[id].set_allow_type_rewrite(); break; } case OpExtInst: { uint32_t extension_set = args[2]; - SPIRExtension::Extension ext = compiler.get(extension_set).ext; + SPIRExtension::Extension ext = get(extension_set).ext; if (ext == SPIRExtension::GLSL) { auto op_450 = static_cast(args[3]); @@ -18521,15 +18812,15 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui case GLSLstd450InterpolateAtSample: case GLSLstd450InterpolateAtOffset: { - if (!compiler.msl_options.supports_msl_version(2, 3)) + if (!self.msl_options.supports_msl_version(2, 3)) SPIRV_CROSS_THROW("Pull-model interpolation requires MSL 2.3."); // Fragment varyings used with pull-model interpolation need special handling, // due to the way pull-model interpolation works in Metal. - auto *var = compiler.maybe_get_backing_variable(args[4]); + auto *var = self.maybe_get_backing_variable(args[4]); if (var) { - compiler.pull_model_inputs.insert(var->self); - auto &var_type = compiler.get_variable_element_type(*var); + self.pull_model_inputs.insert(var->self); + auto &var_type = self.get_variable_element_type(*var); // In addition, if this variable has a 'Sample' decoration, we need the sample ID // in order to do default interpolation. if (compiler.has_decoration(var->self, DecorationSample)) @@ -18558,14 +18849,14 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui else if (ext == SPIRExtension::NonSemanticDebugPrintf) { // Operation 1 is printf. - if (args[3] == 1 && !compiler.msl_options.supports_msl_version(3, 2)) + if (args[3] == 1 && !self.msl_options.supports_msl_version(3, 2)) SPIRV_CROSS_THROW("Debug printf requires MSL 3.2."); } break; } case OpIsHelperInvocationEXT: - if (compiler.needs_manual_helper_invocation_updates()) + if (self.needs_manual_helper_invocation_updates()) needs_helper_invocation = true; break; @@ -18573,20 +18864,27 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui break; } - // If it has one, keep track of the instruction's result type, mapped by ID - uint32_t result_type, result_id; - if (compiler.instruction_to_result_type(result_type, result_id, opcode, args, length)) - result_types[result_id] = result_type; - return true; } // If the variable is a Uniform or StorageBuffer, mark that a resource has been written to. void CompilerMSL::OpCodePreprocessor::check_resource_write(uint32_t var_id) { - auto *p_var = compiler.maybe_get_backing_variable(var_id); - StorageClass sc = p_var ? p_var->storage : StorageClassMax; - if (sc == StorageClassUniform || sc == StorageClassStorageBuffer) + auto *type = get_expression_result_type(var_id); + auto sc = StorageClassMax; + + if (type) + { + sc = type->storage; + } + else + { + auto *var = self.maybe_get_backing_variable(var_id); + if (var) + sc = var->storage; + } + + if (sc == StorageClassUniform || sc == StorageClassStorageBuffer || sc == StorageClassPhysicalStorageBuffer) uses_buffer_write = true; } @@ -18603,11 +18901,8 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o case OpFAdd: case OpFSub: - if (compiler.msl_options.invariant_float_math || - compiler.has_decoration(args[1], DecorationNoContraction)) - { + if (self.msl_options.invariant_float_math || self.has_legacy_nocontract(args[0], args[1])) return opcode == OpFAdd ? SPVFuncImplFAdd : SPVFuncImplFSub; - } break; case OpFMul: @@ -18615,11 +18910,8 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o case OpMatrixTimesVector: case OpVectorTimesMatrix: case OpMatrixTimesMatrix: - if (compiler.msl_options.invariant_float_math || - compiler.has_decoration(args[1], DecorationNoContraction)) - { + if (self.msl_options.invariant_float_math || self.has_legacy_nocontract(args[0], args[1])) return SPVFuncImplFMul; - } break; case OpQuantizeToF16: @@ -18653,8 +18945,8 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o auto it = image_pointers_emulated.find(args[opcode == OpAtomicStore ? 0 : 2]); if (it != image_pointers_emulated.end()) { - uint32_t tid = compiler.get(it->second).basetype; - if (tid && compiler.get(tid).image.dim == Dim2D) + uint32_t tid = get(it->second).basetype; + if (tid && get(tid).image.dim == Dim2D) return SPVFuncImplImage2DAtomicCoords; } break; @@ -18666,7 +18958,7 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o { // Retrieve the image type, and if it's a Buffer, emit a texel coordinate function uint32_t tid = result_types[args[opcode == OpImageWrite ? 0 : 2]]; - if (tid && compiler.get(tid).image.dim == DimBuffer && !compiler.msl_options.texture_buffer_native) + if (tid && get(tid).image.dim == DimBuffer && !self.msl_options.texture_buffer_native) return SPVFuncImplTexelBufferCoords; break; } @@ -18674,7 +18966,7 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o case OpExtInst: { uint32_t extension_set = args[2]; - if (compiler.get(extension_set).ext == SPIRExtension::GLSL) + if (get(extension_set).ext == SPIRExtension::GLSL) { auto op_450 = static_cast(args[3]); switch (op_450) @@ -18693,28 +18985,28 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o return SPVFuncImplSSign; case GLSLstd450Reflect: { - auto &type = compiler.get(args[0]); + auto &type = get(args[0]); if (type.vecsize == 1) return SPVFuncImplReflectScalar; break; } case GLSLstd450Refract: { - auto &type = compiler.get(args[0]); + auto &type = get(args[0]); if (type.vecsize == 1) return SPVFuncImplRefractScalar; break; } case GLSLstd450FaceForward: { - auto &type = compiler.get(args[0]); + auto &type = get(args[0]); if (type.vecsize == 1) return SPVFuncImplFaceForwardScalar; break; } case GLSLstd450MatrixInverse: { - auto &mat_type = compiler.get(args[0]); + auto &mat_type = get(args[0]); switch (mat_type.columns) { case 2: @@ -19508,7 +19800,7 @@ void CompilerMSL::analyze_argument_buffers() auto &ptr_type = set(ptr_type_id, OpTypePointer); ptr_type = buffer_type; - ptr_type.op = spv::OpTypePointer; + ptr_type.op = OpTypePointer; ptr_type.pointer = true; ptr_type.pointer_depth++; ptr_type.parent_type = type_id; @@ -19610,6 +19902,8 @@ void CompilerMSL::analyze_argument_buffers() next_arg_buff_index += resource.plane_count * count; } + // Here we're locking down the member name early before compilation loops, so ensure that + // the resource name is not reused, even through a reset(). string mbr_name = ensure_valid_name(resource.name, "m"); if (resource.plane > 0) mbr_name += join(plane_name_suffix, resource.plane); @@ -19667,7 +19961,9 @@ void CompilerMSL::analyze_argument_buffers() { // Don't set the qualified name here; we'll define a variable holding the corrected buffer address later. buffer_type.member_types.push_back(var.basetype); - buffers_requiring_dynamic_offset[pair].second = var.self; + auto &dynamic_buffer = buffers_requiring_dynamic_offset[pair]; + dynamic_buffer.var_id = var.self; + dynamic_buffer.mbr_name = mbr_name; } else if (inline_uniform_blocks.count(pair)) { @@ -19739,7 +20035,7 @@ void CompilerMSL::analyze_argument_buffers() { recursive_inputs.insert(type_id); auto &entry_func = this->get(ir.default_entry_point); - auto addr_space = get_argument_address_space(buffer_var); + auto addr_space = get_variable_address_space(buffer_var); entry_func.fixup_hooks_in.push_back([this, addr_space, buffer_name, buffer_type_name]() { statement(addr_space, " auto& ", buffer_name, " = *(", addr_space, " ", buffer_type_name, "*)", buffer_name, "_vp;"); }); @@ -19782,7 +20078,7 @@ void CompilerMSL::add_argument_buffer_padding_buffer_type(SPIRType &struct_type, uint32_t ptr_type_id = buff_type_id + 1; auto &ptr_type = set(ptr_type_id, OpTypePointer); ptr_type = buff_type; - ptr_type.op = spv::OpTypePointer; + ptr_type.op = OpTypePointer; ptr_type.pointer = true; ptr_type.pointer_depth++; ptr_type.parent_type = buff_type_id; @@ -19900,7 +20196,7 @@ bool CompilerMSL::specialization_constant_is_macro(uint32_t const_id) const } // Start with all fast math flags enabled, and selectively disable based execution modes and float controls -uint32_t CompilerMSL::get_fp_fast_math_flags(bool incl_ops) +uint32_t CompilerMSL::get_fp_fast_math_flags(bool incl_ops) const { uint32_t fp_flags = ~0; auto &ep = get_entry_point(); diff --git a/third_party/spirv-cross/spirv_msl.hpp b/third_party/spirv-cross/spirv_msl.hpp index 99cbb5e138..033cb903bf 100644 --- a/third_party/spirv-cross/spirv_msl.hpp +++ b/third_party/spirv-cross/spirv_msl.hpp @@ -33,6 +33,7 @@ namespace SPIRV_CROSS_NAMESPACE { +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; // Indicates the format of a shader interface variable. Currently limited to specifying // if the input is an 8-bit unsigned integer, 16-bit unsigned integer, or @@ -78,7 +79,7 @@ struct MSLShaderInterfaceVariable uint32_t location = 0; uint32_t component = 0; MSLShaderVariableFormat format = MSL_SHADER_VARIABLE_FORMAT_OTHER; - spv::BuiltIn builtin = spv::BuiltInMax; + BuiltIn builtin = BuiltInMax; uint32_t vecsize = 0; MSLShaderVariableRate rate = MSL_SHADER_VARIABLE_RATE_PER_VERTEX; }; @@ -104,7 +105,7 @@ struct MSLShaderInterfaceVariable // become a [[buffer(N)]], [[texture(N)]] or [[sampler(N)]] depending on the resource types used. struct MSLResourceBinding { - spv::ExecutionModel stage = spv::ExecutionModelMax; + ExecutionModel stage = ExecutionModelMax; SPIRType::BaseType basetype = SPIRType::Unknown; uint32_t desc_set = 0; uint32_t binding = 0; @@ -591,9 +592,9 @@ public: // rasterization if vertex shader requires rasterization to be disabled. bool get_is_rasterization_disabled() const { - return is_rasterization_disabled && (get_entry_point().model == spv::ExecutionModelVertex || - get_entry_point().model == spv::ExecutionModelTessellationControl || - get_entry_point().model == spv::ExecutionModelTessellationEvaluation); + return is_rasterization_disabled && (get_entry_point().model == ExecutionModelVertex || + get_entry_point().model == ExecutionModelTessellationControl || + get_entry_point().model == ExecutionModelTessellationEvaluation); } // Provide feedback to calling API to allow it to pass an auxiliary @@ -706,20 +707,20 @@ public: // This is typical for tessellation builtin inputs such as tess levels, gl_Position, etc. // This returns k_unknown_location if the location was explicitly assigned with // add_msl_shader_input or the builtin is not used, otherwise returns N in [[attribute(N)]]. - uint32_t get_automatic_builtin_input_location(spv::BuiltIn builtin) const; + uint32_t get_automatic_builtin_input_location(BuiltIn builtin) const; // If not using add_msl_shader_output, it's possible // that certain builtin attributes need to be automatically assigned locations. // This is typical for tessellation builtin outputs such as tess levels, gl_Position, etc. // This returns k_unknown_location if the location were explicitly assigned with // add_msl_shader_output or the builtin were not used, otherwise returns N in [[attribute(N)]]. - uint32_t get_automatic_builtin_output_location(spv::BuiltIn builtin) const; + uint32_t get_automatic_builtin_output_location(BuiltIn builtin) const; // NOTE: Only resources which are remapped using add_msl_resource_binding will be reported here. // Constexpr samplers are always assumed to be emitted. // No specific MSLResourceBinding remapping is required for constexpr samplers as long as they are remapped // by remap_constexpr_sampler(_by_binding). - bool is_msl_resource_binding_used(spv::ExecutionModel model, uint32_t set, uint32_t binding) const; + bool is_msl_resource_binding_used(ExecutionModel model, uint32_t set, uint32_t binding) const; // This must only be called after a successful call to CompilerMSL::compile(). // For a variable resource ID obtained through reflection API, report the automatically assigned resource index. @@ -777,7 +778,7 @@ public: // If incl_ops is enabled, the FPFastMathMode of any SPIR-V operations are also included in the bitwise-AND // to determine the minimal fast-math that applies to all default execution modes and all operations. // The returned value is also affected by execution modes SignedZeroInfNanPreserve and ContractionOff. - uint32_t get_fp_fast_math_flags(bool incl_ops); + uint32_t get_fp_fast_math_flags(bool incl_ops) const; protected: // An enum of SPIR-V functions that are implemented in additional @@ -795,6 +796,8 @@ protected: SPVFuncImplSSign, SPVFuncImplArrayCopy, SPVFuncImplArrayCopyMultidim, + SPVFuncImplArrayCopyExtendedSrc, + SPVFuncImplArrayCopyExtendedDst, SPVFuncImplTexelBufferCoords, SPVFuncImplImage2DAtomicCoords, // Emulate texture2D atomic operations SPVFuncImplGradientCube, @@ -931,14 +934,14 @@ protected: std::string type_to_array_glsl(const SPIRType &type, uint32_t variable_id) override; std::string constant_op_expression(const SPIRConstantOp &cop) override; - bool variable_decl_is_remapped_storage(const SPIRVariable &variable, spv::StorageClass storage) const override; + bool variable_decl_is_remapped_storage(const SPIRVariable &variable, StorageClass storage) const override; // GCC workaround of lambdas calling protected functions (for older GCC versions) std::string variable_decl(const SPIRType &type, const std::string &name, uint32_t id = 0) override; std::string image_type_glsl(const SPIRType &type, uint32_t id, bool member) override; std::string sampler_type(const SPIRType &type, uint32_t id, bool member); - std::string builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage) override; + std::string builtin_to_glsl(BuiltIn builtin, StorageClass storage) override; std::string to_func_call_arg(const SPIRFunction::Parameter &arg, uint32_t id) override; std::string to_name(uint32_t id, bool allow_alias = true) const override; std::string to_function_name(const TextureFunctionNameArguments &args) override; @@ -950,7 +953,7 @@ protected: bool is_packed, bool row_major) override; // Returns true for BuiltInSampleMask because gl_SampleMask[] is an array in SPIR-V, but [[sample_mask]] is a scalar in Metal. - bool builtin_translates_to_nonarray(spv::BuiltIn builtin) const override; + bool builtin_translates_to_nonarray(BuiltIn builtin) const override; std::string bitcast_glsl_op(const SPIRType &result_type, const SPIRType &argument_type) override; bool emit_complex_bitcast(uint32_t result_id, uint32_t id, uint32_t op0) override; @@ -990,8 +993,8 @@ protected: void extract_global_variables_from_function(uint32_t func_id, std::set &added_arg_ids, std::unordered_set &global_var_ids, std::unordered_set &processed_func_ids); - uint32_t add_interface_block(spv::StorageClass storage, bool patch = false); - uint32_t add_interface_block_pointer(uint32_t ib_var_id, spv::StorageClass storage); + uint32_t add_interface_block(StorageClass storage, bool patch = false); + uint32_t add_interface_block_pointer(uint32_t ib_var_id, StorageClass storage); uint32_t add_meshlet_block(bool per_primitive); struct InterfaceBlockMeta @@ -1012,23 +1015,23 @@ protected: std::string to_tesc_invocation_id(); void emit_local_masked_variable(const SPIRVariable &masked_var, bool strip_array); - void add_variable_to_interface_block(spv::StorageClass storage, const std::string &ib_var_ref, SPIRType &ib_type, + void add_variable_to_interface_block(StorageClass storage, const std::string &ib_var_ref, SPIRType &ib_type, SPIRVariable &var, InterfaceBlockMeta &meta); - void add_composite_variable_to_interface_block(spv::StorageClass storage, const std::string &ib_var_ref, + void add_composite_variable_to_interface_block(StorageClass storage, const std::string &ib_var_ref, SPIRType &ib_type, SPIRVariable &var, InterfaceBlockMeta &meta); - void add_plain_variable_to_interface_block(spv::StorageClass storage, const std::string &ib_var_ref, + void add_plain_variable_to_interface_block(StorageClass storage, const std::string &ib_var_ref, SPIRType &ib_type, SPIRVariable &var, InterfaceBlockMeta &meta); - bool add_component_variable_to_interface_block(spv::StorageClass storage, const std::string &ib_var_ref, + bool add_component_variable_to_interface_block(StorageClass storage, const std::string &ib_var_ref, SPIRVariable &var, const SPIRType &type, InterfaceBlockMeta &meta); - void add_plain_member_variable_to_interface_block(spv::StorageClass storage, + void add_plain_member_variable_to_interface_block(StorageClass storage, const std::string &ib_var_ref, SPIRType &ib_type, SPIRVariable &var, SPIRType &var_type, uint32_t mbr_idx, InterfaceBlockMeta &meta, const std::string &mbr_name_qual, const std::string &var_chain_qual, uint32_t &location, uint32_t &var_mbr_idx); - void add_composite_member_variable_to_interface_block(spv::StorageClass storage, + void add_composite_member_variable_to_interface_block(StorageClass storage, const std::string &ib_var_ref, SPIRType &ib_type, SPIRVariable &var, SPIRType &var_type, uint32_t mbr_idx, InterfaceBlockMeta &meta, @@ -1040,11 +1043,11 @@ protected: void add_tess_level_input(const std::string &base_ref, const std::string &mbr_name, SPIRVariable &var); void ensure_struct_members_valid_vecsizes(SPIRType &struct_type, uint32_t &location); - void fix_up_interface_member_indices(spv::StorageClass storage, uint32_t ib_type_id); + void fix_up_interface_member_indices(StorageClass storage, uint32_t ib_type_id); void mark_location_as_used_by_shader(uint32_t location, const SPIRType &type, - spv::StorageClass storage, bool fallback = false); - uint32_t ensure_correct_builtin_type(uint32_t type_id, spv::BuiltIn builtin); + StorageClass storage, bool fallback = false); + uint32_t ensure_correct_builtin_type(uint32_t type_id, BuiltIn builtin); uint32_t ensure_correct_input_type(uint32_t type_id, uint32_t location, uint32_t component, uint32_t num_components, bool strip_array); @@ -1059,6 +1062,9 @@ protected: void fix_up_shader_inputs_outputs(); + bool entry_point_is_vertex() const; + bool entry_point_returns_stage_output() const; + bool entry_point_requires_const_device_buffers() const; std::string func_type_decl(SPIRType &type); std::string entry_point_args_classic(bool append_comma); std::string entry_point_args_argument_buffer(bool append_comma); @@ -1072,23 +1078,23 @@ protected: std::string to_buffer_size_expression(uint32_t id); bool is_sample_rate() const; bool is_intersection_query() const; - bool is_direct_input_builtin(spv::BuiltIn builtin); - std::string builtin_qualifier(spv::BuiltIn builtin); - std::string builtin_type_decl(spv::BuiltIn builtin, uint32_t id = 0); - std::string built_in_func_arg(spv::BuiltIn builtin, bool prefix_comma); + bool is_direct_input_builtin(BuiltIn builtin); + std::string builtin_qualifier(BuiltIn builtin); + std::string builtin_type_decl(BuiltIn builtin, uint32_t id = 0); + std::string built_in_func_arg(BuiltIn builtin, bool prefix_comma); std::string member_attribute_qualifier(const SPIRType &type, uint32_t index); std::string member_location_attribute_qualifier(const SPIRType &type, uint32_t index); std::string argument_decl(const SPIRFunction::Parameter &arg); - const char *descriptor_address_space(uint32_t id, spv::StorageClass storage, const char *plain_address_space) const; + const char *descriptor_address_space(uint32_t id, StorageClass storage, const char *plain_address_space) const; std::string round_fp_tex_coords(std::string tex_coords, bool coord_is_fp); uint32_t get_metal_resource_index(SPIRVariable &var, SPIRType::BaseType basetype, uint32_t plane = 0); uint32_t get_member_location(uint32_t type_id, uint32_t index, uint32_t *comp = nullptr) const; - uint32_t get_or_allocate_builtin_input_member_location(spv::BuiltIn builtin, + uint32_t get_or_allocate_builtin_input_member_location(BuiltIn builtin, uint32_t type_id, uint32_t index, uint32_t *comp = nullptr); - uint32_t get_or_allocate_builtin_output_member_location(spv::BuiltIn builtin, + uint32_t get_or_allocate_builtin_output_member_location(BuiltIn builtin, uint32_t type_id, uint32_t index, uint32_t *comp = nullptr); - uint32_t get_physical_tess_level_array_size(spv::BuiltIn builtin) const; + uint32_t get_physical_tess_level_array_size(BuiltIn builtin) const; uint32_t get_physical_type_stride(const SPIRType &type) const override; @@ -1122,7 +1128,9 @@ protected: void mark_struct_members_packed(const SPIRType &type); void ensure_member_packing_rules_msl(SPIRType &ib_type, uint32_t index); bool validate_member_packing_rules_msl(const SPIRType &type, uint32_t index) const; - std::string get_argument_address_space(const SPIRVariable &argument); + std::string get_variable_address_space(const SPIRVariable &argument); + // Special case of get_variable_address_space which is only used for leaf functions. + std::string get_leaf_argument_address_space(const SPIRVariable &argument); std::string get_type_address_space(const SPIRType &type, uint32_t id, bool argument = false); bool decoration_flags_signal_volatile(const Bitset &flags) const; bool decoration_flags_signal_coherent(const Bitset &flags) const; @@ -1134,7 +1142,7 @@ protected: std::string get_tess_factor_struct_name(); SPIRType &get_uint_type(); uint32_t get_uint_type_id(); - void emit_atomic_func_op(uint32_t result_type, uint32_t result_id, const char *op, spv::Op opcode, + void emit_atomic_func_op(uint32_t result_type, uint32_t result_id, const char *op, Op opcode, uint32_t mem_order_1, uint32_t mem_order_2, bool has_mem_order_2, uint32_t op0, uint32_t op1 = 0, bool op1_is_pointer = false, bool op1_is_literal = false, uint32_t op2 = 0); const char *get_memory_order(uint32_t spv_mem_sem); @@ -1142,7 +1150,7 @@ protected: void add_typedef_line(const std::string &line); void emit_barrier(uint32_t id_exe_scope, uint32_t id_mem_scope, uint32_t id_mem_sem); bool emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, - spv::StorageClass lhs_storage, spv::StorageClass rhs_storage) override; + StorageClass lhs_storage, StorageClass rhs_storage) override; void build_implicit_builtins(); uint32_t build_constant_uint_array_pointer(); void emit_entry_point_declarations() override; @@ -1192,7 +1200,7 @@ protected: void analyze_workgroup_variables(); bool access_chain_needs_stage_io_builtin_translation(uint32_t base) override; - bool prepare_access_chain_for_scalar_access(std::string &expr, const SPIRType &type, spv::StorageClass storage, + bool prepare_access_chain_for_scalar_access(std::string &expr, const SPIRType &type, StorageClass storage, bool &is_packed) override; void fix_up_interpolant_access_chain(const uint32_t *ops, uint32_t length); bool check_physical_type_cast(std::string &expr, const SPIRType *type, uint32_t physical_type) override; @@ -1201,9 +1209,9 @@ protected: bool emit_tessellation_io_load(uint32_t result_type, uint32_t id, uint32_t ptr); bool is_out_of_bounds_tessellation_level(uint32_t id_lhs); - void ensure_builtin(spv::StorageClass storage, spv::BuiltIn builtin); + void ensure_builtin(StorageClass storage, BuiltIn builtin); - void mark_implicit_builtin(spv::StorageClass storage, spv::BuiltIn builtin, uint32_t id); + void mark_implicit_builtin(StorageClass storage, BuiltIn builtin, uint32_t id); std::string convert_to_f32(const std::string &expr, uint32_t components); @@ -1264,6 +1272,7 @@ protected: bool using_builtin_array() const; bool is_rasterization_disabled = false; + bool has_descriptor_side_effects_buffer = false; bool capture_output_to_buffer = false; bool needs_swizzle_buffer_def = false; bool used_swizzle_buffer = false; @@ -1274,6 +1283,7 @@ protected: bool needs_sample_id = false; bool needs_helper_invocation = false; bool needs_workgroup_zero_init = false; + bool needs_point_size_output = false; bool writes_to_depth = false; bool writes_to_point_size = false; std::string qual_pos_var_name; @@ -1292,7 +1302,7 @@ protected: std::string patch_output_buffer_var_name = "spvPatchOut"; std::string tess_factor_buffer_var_name = "spvTessLevel"; std::string index_buffer_var_name = "spvIndices"; - spv::Op previous_instruction_opcode = spv::OpNop; + Op previous_instruction_opcode = OpNop; // Must be ordered since declaration is in a specific order. std::map constexpr_samplers_by_id; @@ -1300,7 +1310,6 @@ protected: const MSLConstexprSampler *find_constexpr_sampler(uint32_t id) const; std::unordered_set buffers_requiring_array_length; - SmallVector> buffer_aliases_argument; SmallVector buffer_aliases_discrete; std::unordered_set atomic_image_vars_emulated; // Emulate texture2D atomic operations std::unordered_set pull_model_inputs; @@ -1309,7 +1318,13 @@ protected: SmallVector entry_point_bindings; // Must be ordered since array is in a specific order. - std::map> buffers_requiring_dynamic_offset; + struct DynamicBuffer + { + uint32_t base_index; + uint32_t var_id; + std::string mbr_name; + }; + std::map buffers_requiring_dynamic_offset; SmallVector disabled_frag_outputs; @@ -1346,7 +1361,7 @@ protected: bool type_is_msl_framebuffer_fetch(const SPIRType &type) const; bool is_supported_argument_buffer_type(const SPIRType &type) const; - bool variable_storage_requires_stage_io(spv::StorageClass storage) const; + bool variable_storage_requires_stage_io(StorageClass storage) const; bool needs_manual_helper_invocation_updates() const { @@ -1354,7 +1369,7 @@ protected: } bool needs_frag_discard_checks() const { - return get_execution_model() == spv::ExecutionModelFragment && msl_options.supports_msl_version(2, 3) && + return get_execution_model() == ExecutionModelFragment && msl_options.supports_msl_version(2, 3) && msl_options.check_discarded_frag_stores && frag_shader_needs_discard_checks; } @@ -1364,17 +1379,17 @@ protected: // OpcodeHandler that handles several MSL preprocessing operations. struct OpCodePreprocessor : OpcodeHandler { - OpCodePreprocessor(CompilerMSL &compiler_) - : compiler(compiler_) + explicit OpCodePreprocessor(CompilerMSL &compiler_) + : OpcodeHandler(compiler_), self(compiler_) { + enable_result_types = true; } - bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; - CompilerMSL::SPVFuncImpl get_spv_func_impl(spv::Op opcode, const uint32_t *args, uint32_t length); + bool handle(Op opcode, const uint32_t *args, uint32_t length) override; + CompilerMSL::SPVFuncImpl get_spv_func_impl(Op opcode, const uint32_t *args, uint32_t length); void check_resource_write(uint32_t var_id); - CompilerMSL &compiler; - std::unordered_map result_types; + CompilerMSL &self; std::unordered_map image_pointers_emulated; // Emulate texture2D atomic operations bool suppress_missing_prototypes = false; bool uses_atomics = false; @@ -1391,14 +1406,13 @@ protected: // OpcodeHandler that scans for uses of sampled images struct SampledImageScanner : OpcodeHandler { - SampledImageScanner(CompilerMSL &compiler_) - : compiler(compiler_) + explicit SampledImageScanner(CompilerMSL &compiler_) + : OpcodeHandler(compiler_), self(compiler_) { } - bool handle(spv::Op opcode, const uint32_t *args, uint32_t) override; - - CompilerMSL &compiler; + CompilerMSL &self; + bool handle(Op opcode, const uint32_t *args, uint32_t) override; }; // Sorts the members of a SPIRType and associated Meta info based on a settable sorting diff --git a/third_party/spirv-cross/spirv_parser.cpp b/third_party/spirv-cross/spirv_parser.cpp index cbc60d4703..d2e7dfa5f6 100644 --- a/third_party/spirv-cross/spirv_parser.cpp +++ b/third_party/spirv-cross/spirv_parser.cpp @@ -22,10 +22,11 @@ */ #include "spirv_parser.hpp" +#include "NonSemanticShaderDebugInfo100.h" #include using namespace std; -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; namespace SPIRV_CROSS_NAMESPACE { @@ -43,7 +44,7 @@ static bool decoration_is_string(Decoration decoration) { switch (decoration) { - case DecorationHlslSemanticGOOGLE: + case DecorationUserSemantic: return true; default: @@ -137,6 +138,15 @@ void Parser::parse() } forward_pointer_fixups.clear(); + for (auto &source : ir.sources) + { + auto cmp = [](const ParsedIR::Source::Marker &a, const ParsedIR::Source::Marker &b) { + return a.line < b.line; + }; + + std::sort(source.line_markers.begin(), source.line_markers.end(), cmp); + } + if (current_function) SPIRV_CROSS_THROW("Function was not terminated."); if (current_block) @@ -194,7 +204,6 @@ void Parser::parse(const Instruction &instruction) switch (op) { - case OpSourceContinued: case OpSourceExtension: case OpNop: case OpModuleProcessed: @@ -213,38 +222,53 @@ void Parser::parse(const Instruction &instruction) case OpSource: { - auto lang = static_cast(ops[0]); - switch (lang) + ir.sources.emplace_back(); + auto &source = ir.sources.back(); + source.lang = static_cast(ops[0]); + + switch (source.lang) { case SourceLanguageESSL: - ir.source.es = true; - ir.source.version = ops[1]; - ir.source.known = true; - ir.source.hlsl = false; + source.es = true; + source.version = ops[1]; + source.known = true; + source.hlsl = false; break; case SourceLanguageGLSL: - ir.source.es = false; - ir.source.version = ops[1]; - ir.source.known = true; - ir.source.hlsl = false; + source.es = false; + source.version = ops[1]; + source.known = true; + source.hlsl = false; break; case SourceLanguageHLSL: // For purposes of cross-compiling, this is GLSL 450. - ir.source.es = false; - ir.source.version = 450; - ir.source.known = true; - ir.source.hlsl = true; + source.es = false; + source.version = 450; + source.known = true; + source.hlsl = true; break; default: - ir.source.known = false; + source.known = false; break; } + + if (length >= 3) + source.file_id = ops[2]; + + if (length >= 4) + source.source = extract_string(ir.spirv, instruction.offset + 3); + break; } + case OpSourceContinued: + if (!ir.sources.empty()) + ir.sources.back().source += extract_string(ir.spirv, instruction.offset); + break; + case OpUndef: { uint32_t result_type = ops[0]; @@ -318,6 +342,72 @@ void Parser::parse(const Instruction &instruction) ir.load_type_width.insert({ ops[1], type->width }); } } + + if (op == OpExtInst && length > 4) + { + // Don't want to deal with ForwardRefs here. + auto &ext = get(ops[2]); + if (ext.ext == SPIRExtension::NonSemanticShaderDebugInfo) + { + const auto instr = ops[3]; + if (instr == NonSemanticShaderDebugInfo100DebugSource) + { + set(ops[1], get(ops[4]).str); + + ir.sources.emplace_back(); + auto &source = ir.sources.back(); + source.file_id = ops[4]; + source.define_id = ops[1]; + if (length >= 6) + source.source = ir.get(ops[5]).str; + } + else if (instr == NonSemanticShaderDebugInfo100DebugSourceContinued) + { + if (length < 5) + SPIRV_CROSS_THROW("Invalid arguments for ShaderDebugInfo100DebugSourceContinued"); + if (!ir.sources.empty()) + ir.sources.back().source += ir.get(ops[4]).str; + } + else if (instr == NonSemanticShaderDebugInfo100DebugLine) + { + if (length < 9) + SPIRV_CROSS_THROW("Invalid arguments for ShaderDebugInfo100DebugLine"); + auto source_id = ops[4]; + auto line_start = ir.get(ops[5]).scalar_i32(); + auto col_start = ir.get(ops[7]).scalar_i32(); + + for (auto &source : ir.sources) + { + if (source.define_id != source_id) + continue; + + source.line_markers.emplace_back(); + auto &marker = source.line_markers.back(); + marker.line = line_start; + marker.col = col_start; + marker.offset = instruction.offset - 1; + marker.function_id = current_function ? current_function->self : ID(0); + marker.block_id = current_block ? current_block->self : ID(0); + break; + } + } + else if (instr == NonSemanticShaderDebugInfo100DebugLocalVariable) + { + if (length < 11) + SPIRV_CROSS_THROW("Invalid arguments for ShaderDebugInfo100DebugLocalVariable"); + auto &lvar = set(ops[1]); + lvar.name_id = ops[4]; + } + else if (instr == NonSemanticShaderDebugInfo100DebugDeclare) + { + if (length < 7) + SPIRV_CROSS_THROW("Invalid arguments for ShaderDebugInfo100DebugDeclare"); + auto &lvar = get(ops[4]); + auto &var = get(ops[5]); + var.debug_local_variables.push_back(lvar.self); + } + } + } break; } @@ -369,6 +459,30 @@ void Parser::parse(const Instruction &instruction) execution.output_primitives = ops[2]; break; + case ExecutionModeSignedZeroInfNanPreserve: + switch (ops[2]) + { + case 8: + execution.signed_zero_inf_nan_preserve_8 = true; + break; + + case 16: + execution.signed_zero_inf_nan_preserve_16 = true; + break; + + case 32: + execution.signed_zero_inf_nan_preserve_32 = true; + break; + + case 64: + execution.signed_zero_inf_nan_preserve_64 = true; + break; + + default: + SPIRV_CROSS_THROW("Invalid bit-width for SignedZeroInfNanPreserve."); + } + break; + default: break; } @@ -557,7 +671,7 @@ void Parser::parse(const Instruction &instruction) { if (length > 2) { - if (ops[2] == spv::FPEncodingBFloat16KHR) + if (ops[2] == FPEncodingBFloat16KHR) type.basetype = SPIRType::BFloat16; else SPIRV_CROSS_THROW("Unrecognized encoding for OpTypeFloat 16."); @@ -569,9 +683,9 @@ void Parser::parse(const Instruction &instruction) { if (length < 2) SPIRV_CROSS_THROW("Missing encoding for OpTypeFloat 8."); - else if (ops[2] == spv::FPEncodingFloat8E4M3EXT) + else if (ops[2] == FPEncodingFloat8E4M3EXT) type.basetype = SPIRType::FloatE4M3; - else if (ops[2] == spv::FPEncodingFloat8E5M2EXT) + else if (ops[2] == FPEncodingFloat8E5M2EXT) type.basetype = SPIRType::FloatE5M2; else SPIRV_CROSS_THROW("Invalid encoding for OpTypeFloat 8."); @@ -633,15 +747,33 @@ void Parser::parse(const Instruction &instruction) auto &matrixbase = set(id, base); matrixbase.op = op; - matrixbase.cooperative.scope_id = ops[2]; - matrixbase.cooperative.rows_id = ops[3]; - matrixbase.cooperative.columns_id = ops[4]; - matrixbase.cooperative.use_id = ops[5]; + matrixbase.ext.cooperative.scope_id = ops[2]; + matrixbase.ext.cooperative.rows_id = ops[3]; + matrixbase.ext.cooperative.columns_id = ops[4]; + matrixbase.ext.cooperative.use_id = ops[5]; matrixbase.self = id; matrixbase.parent_type = ops[1]; break; } + case OpTypeCooperativeVectorNV: + { + uint32_t id = ops[0]; + auto &type = set(id, op); + + type.basetype = SPIRType::CoopVecNV; + type.op = op; + type.ext.coopVecNV.component_type_id = ops[1]; + type.ext.coopVecNV.component_count_id = ops[2]; + type.parent_type = ops[1]; + + // CoopVec-Nv can be used with integer operations like SMax where + // where spirv-opt does explicit checks on integer bitwidth + auto component_type = get(type.ext.coopVecNV.component_type_id); + type.width = component_type.width; + break; + } + case OpTypeArray: { uint32_t id = ops[0]; @@ -844,11 +976,12 @@ void Parser::parse(const Instruction &instruction) uint32_t id = ops[0]; auto &type = set(id, op); type.basetype = SPIRType::Tensor; - type.tensor.type = ops[1]; + type.ext.tensor = {}; + type.ext.tensor.type = ops[1]; if (length >= 3) - type.tensor.rank = ops[2]; + type.ext.tensor.rank = ops[2]; if (length >= 4) - type.tensor.shape = ops[3]; + type.ext.tensor.shape = ops[3]; break; } @@ -888,7 +1021,7 @@ void Parser::parse(const Instruction &instruction) uint32_t id = ops[1]; // Instead of a temporary, create a new function-wide temporary with this ID instead. - auto &var = set(id, result_type, spv::StorageClassFunction); + auto &var = set(id, result_type, StorageClassFunction); var.phi_variable = true; current_function->add_local_variable(id); @@ -1322,6 +1455,24 @@ void Parser::parse(const Instruction &instruction) current_function->entry_line.line_literal = ops[1]; } } + + uint32_t file = ops[0]; + uint32_t line = ops[1]; + + for (auto &source : ir.sources) + { + if (source.file_id == file) + { + source.line_markers.emplace_back(); + auto &marker = source.line_markers.back(); + marker.line = line; + marker.offset = instruction.offset - 1; + marker.function_id = current_function ? current_function->self : ID(0); + marker.block_id = current_block ? current_block->self : ID(0); + break; + } + } + break; } diff --git a/third_party/spirv-cross/spirv_reflect.cpp b/third_party/spirv-cross/spirv_reflect.cpp index fc0975b8a8..3807613041 100644 --- a/third_party/spirv-cross/spirv_reflect.cpp +++ b/third_party/spirv-cross/spirv_reflect.cpp @@ -25,7 +25,7 @@ #include "spirv_glsl.hpp" #include -using namespace spv; +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE; using namespace std; @@ -449,7 +449,7 @@ void CompilerReflection::emit_type_member_qualifiers(const SPIRType &type, uint3 } } -string CompilerReflection::execution_model_to_str(spv::ExecutionModel model) +string CompilerReflection::execution_model_to_str(ExecutionModel model) { switch (model) { @@ -477,6 +477,12 @@ string CompilerReflection::execution_model_to_str(spv::ExecutionModel model) return "rmiss"; case ExecutionModelCallableNV: return "rcall"; + case ExecutionModelMeshNV: + case ExecutionModelMeshEXT: + return "mesh"; + case ExecutionModelTaskNV: + case ExecutionModelTaskEXT: + return "task"; default: return "???"; } @@ -504,7 +510,9 @@ void CompilerReflection::emit_entry_points() json_stream->begin_json_object(); json_stream->emit_json_key_value("name", e.name); json_stream->emit_json_key_value("mode", execution_model_to_str(e.execution_model)); - if (e.execution_model == ExecutionModelGLCompute) + if (e.execution_model == ExecutionModelGLCompute || e.execution_model == ExecutionModelMeshEXT || + e.execution_model == ExecutionModelMeshNV || e.execution_model == ExecutionModelTaskEXT || + e.execution_model == ExecutionModelTaskNV) { const auto &spv_entry = get_entry_point(e.name, e.execution_model); diff --git a/third_party/spirv-cross/spirv_reflect.hpp b/third_party/spirv-cross/spirv_reflect.hpp index a129ba54da..492a951f99 100644 --- a/third_party/spirv-cross/spirv_reflect.hpp +++ b/third_party/spirv-cross/spirv_reflect.hpp @@ -34,6 +34,7 @@ class Stream; namespace SPIRV_CROSS_NAMESPACE { +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; class CompilerReflection : public CompilerGLSL { using Parent = CompilerGLSL; @@ -67,7 +68,7 @@ public: std::string compile() override; private: - static std::string execution_model_to_str(spv::ExecutionModel model); + static std::string execution_model_to_str(ExecutionModel model); void emit_entry_points(); void emit_types(); diff --git a/third_party/spirv-cross/test_shaders.py b/third_party/spirv-cross/test_shaders.py index 146e5c1ef5..9ac4e14a7e 100755 --- a/third_party/spirv-cross/test_shaders.py +++ b/third_party/spirv-cross/test_shaders.py @@ -117,6 +117,8 @@ def print_msl_compiler_version(): pass def path_to_msl_standard(shader): + if '.msl4.' in shader: + return '-std=metal4.0' if '.msl32.' in shader: return '-std=metal3.2' if '.msl31.' in shader: @@ -157,9 +159,11 @@ def path_to_msl_standard(shader): return '-std=macos-metal1.2' def path_to_msl_standard_cli(shader): - if '.msl32.' in shader: + if '.msl4.' in shader: + return '40000' + elif '.msl32.' in shader: return '30200' - if '.msl31.' in shader: + elif '.msl31.' in shader: return '30100' elif '.msl3.' in shader: return '30000' @@ -181,6 +185,13 @@ def path_to_msl_standard_cli(shader): ignore_win_metal_tool = False def validate_shader_msl(shader, opt): msl_path = reference_path(shader[0], shader[1], opt) + + # The 4.0 compiler for Windows is outdated and broken, so we cannot rely on version checks either. + cli_standard = path_to_msl_standard_cli(msl_path) + ci_supports_version = int(cli_standard) <= 30200 + if not ci_supports_version: + return + global ignore_win_metal_tool try: if '.ios.' in msl_path: @@ -192,10 +203,8 @@ def validate_shader_msl(shader, opt): subprocess.check_call(['xcrun', '--sdk', msl_os, 'metal', '-x', 'metal', path_to_msl_standard(msl_path), '-Werror', '-Wno-unused-variable', msl_path]) print('Compiled Metal shader: ' + msl_path) # display after so xcrun FNF is silent elif not ignore_win_metal_tool: - # Use Metal Windows toolkit to test on Linux (Wine) and Windows. Running offline tool on Linux gets weird. - # Normal winepath doesn't work, it must be Z:/abspath *exactly* for some bizarre reason. - target_path = msl_path if platform.system == 'Windows' else ('Z:' + os.path.abspath(msl_path)) - subprocess.check_call(['metal', '-x', 'metal', path_to_msl_standard(msl_path), '-Werror', '-Wno-unused-variable', target_path]) + # Use Metal Windows toolkit to test on Linux (Wine) and Windows. + subprocess.check_call(['metal', '-x', 'metal', path_to_msl_standard(msl_path), '-Werror', '-Wno-unused-variable', msl_path]) except OSError as oe: if (oe.errno != errno.ENOENT): # Ignore xcrun or metal not found error @@ -228,7 +237,12 @@ def cross_compile_msl(shader, spirv, opt, iterations, paths): if spirv: subprocess.check_call(spirv_cmd) else: - subprocess.check_call([paths.glslang, '--amb' ,'--target-env', glslang_env, '-V', '-o', spirv_path, shader]) + glslang_cmd = [paths.glslang, '--amb' ,'--target-env', glslang_env, '-V', '-o', spirv_path, shader] + if '.g.' in shader: + glslang_cmd.append('-g') + if '.gV.' in shader: + glslang_cmd.append('-gV') + subprocess.check_call(glslang_cmd) if opt and (not shader_is_invalid_spirv(shader)): if '.graphics-robust-access.' in shader: @@ -521,7 +535,12 @@ def cross_compile_hlsl(shader, spirv, opt, force_no_external_validation, iterati if spirv: subprocess.check_call(spirv_cmd) else: - subprocess.check_call([paths.glslang, '--amb', '--target-env', glslang_env, '-V', '-o', spirv_path, shader]) + glslang_cmd = [paths.glslang, '--amb', '--target-env', glslang_env, '-V', '-o', spirv_path, shader] + if '.g.' in shader: + glslang_cmd.append('-g') + if '.gV.' in shader: + glslang_cmd.append('-gV') + subprocess.check_call(glslang_cmd) if opt and (not shader_is_invalid_spirv(hlsl_path)): subprocess.check_call([paths.spirv_opt, '--skip-validation', '-O', '-o', spirv_path, spirv_path]) @@ -551,6 +570,8 @@ def cross_compile_hlsl(shader, spirv, opt, force_no_external_validation, iterati hlsl_args.append('--hlsl-preserve-structured-buffers') if '.flip-vert-y.' in shader: hlsl_args.append('--flip-vert-y') + if '.user-semantic.' in shader: + hlsl_args.append('--hlsl-user-semantic') subprocess.check_call(hlsl_args) @@ -908,6 +929,10 @@ def test_shader_msl(stats, shader, args, paths): def test_shader_hlsl(stats, shader, args, paths): joined_path = os.path.join(shader[0], shader[1]) + + if os.path.splitext(joined_path)[1] == '.hlsl': + return + print('Testing HLSL shader:', joined_path) is_spirv = shader_is_spirv(shader[1]) noopt = shader_is_noopt(shader[1]) diff --git a/third_party/spirv-cross/tests-other/debug-info.cpp b/third_party/spirv-cross/tests-other/debug-info.cpp new file mode 100644 index 0000000000..d75f2c5bbf --- /dev/null +++ b/third_party/spirv-cross/tests-other/debug-info.cpp @@ -0,0 +1,104 @@ +// Testbench for OpLine instructions getting parsed correctly + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#include +#include +#include + +using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE; + +#define SPVC_CHECK(x) do { \ + if (!(x)) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) + +#define SPVC_CHECKED_CALL(x) do { \ + if ((x) != SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) + +static std::vector read_file(const char *path) +{ + long len; + FILE *file = fopen(path, "rb"); + + if (!file) + return {}; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + std::vector buffer(len / sizeof(uint32_t)); + if (fread(buffer.data(), 1, len, file) != (size_t)len) + { + fclose(file); + return {}; + } + + fclose(file); + return buffer; +} + +int main(int argc, char **argv) +{ + if (argc != 2) + return EXIT_FAILURE; + + auto buffer = read_file(argv[1]); + if (buffer.empty()) + return EXIT_FAILURE; + + spirv_cross::Compiler compiler(std::move(buffer)); + auto& ir = compiler.get_ir(); + SPVC_CHECK(ir.sources.size() == 3u); + + // See debug-lines.spv + constexpr auto src0 = R"SRC(#include "test.h" + +[shader("compute")] +void main() { + int a = 7; + float b = 8; + uint c = foo(a, b); +} + +)SRC"; + + constexpr auto src1 = R"SRC(uint foo(int a, float b) { + return uint(a + b); +} +)SRC"; + + // first source is empty OpSource + SPVC_CHECK(ir.sources[0].source.empty()); + SPVC_CHECK(ir.sources[0].lang == SourceLanguageSlang); + + SPVC_CHECK(ir.sources[1].source == src1); + SPVC_CHECK(ir.sources[2].source == src0); + + SPVC_CHECK(ir.sources[1].line_markers.size() == 2); + SPVC_CHECK(ir.sources[1].line_markers[0].line == 2); + SPVC_CHECK(ir.sources[1].line_markers[0].col == 2); + SPVC_CHECK(ir.sources[1].line_markers[1].function_id != 0); + SPVC_CHECK(ir.sources[1].line_markers[1].block_id != 0); + SPVC_CHECK(ir.sources[1].line_markers[1].line == 2); + + SPVC_CHECK(ir.sources[2].line_markers.size() == 5); + SPVC_CHECK(ir.sources[2].line_markers[0].line == 5); + SPVC_CHECK(ir.sources[2].line_markers[0].col == 2); + SPVC_CHECK(ir.sources[2].line_markers[1].function_id != 0); + SPVC_CHECK(ir.sources[2].line_markers[1].block_id != 0); + SPVC_CHECK(ir.sources[2].line_markers[4].line == 7); + +} + diff --git a/third_party/spirv-cross/tests-other/debug-lines.cpp b/third_party/spirv-cross/tests-other/debug-lines.cpp new file mode 100644 index 0000000000..11780686fc --- /dev/null +++ b/third_party/spirv-cross/tests-other/debug-lines.cpp @@ -0,0 +1,99 @@ +// Testbench for OpLine instructions getting parsed correctly + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#include +#include +#include + +#define SPVC_CHECK(x) do { \ + if (!(x)) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) + +#define SPVC_CHECKED_CALL(x) do { \ + if ((x) != SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) + +static std::vector read_file(const char *path) +{ + long len; + FILE *file = fopen(path, "rb"); + + if (!file) + return {}; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + std::vector buffer(len / sizeof(uint32_t)); + if (fread(buffer.data(), 1, len, file) != (size_t)len) + { + fclose(file); + return {}; + } + + fclose(file); + return buffer; +} + +int main(int argc, char **argv) +{ + if (argc != 2) + return EXIT_FAILURE; + + auto buffer = read_file(argv[1]); + if (buffer.empty()) + return EXIT_FAILURE; + + spirv_cross::Compiler compiler(std::move(buffer)); + auto& ir = compiler.get_ir(); + SPVC_CHECK(ir.sources.size() == 2u); + + // See debug-lines.spv + constexpr auto src0 = R"SRC(// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed entry-point main +#line 1 +#extension GL_GOOGLE_include_directive : require + +#include "test.h" + +void main() { + int a = 7; + float b = 8; + uint c = foo(a, b); +} +)SRC"; + + constexpr auto src1 = R"SRC(uint foo(int a, float b) { + return uint(a + b); +} +)SRC"; + + SPVC_CHECK(ir.sources[0].source == src0); + SPVC_CHECK(ir.sources[1].source == src1); + + SPVC_CHECK(ir.sources[0].line_markers.size() == 5); + SPVC_CHECK(ir.sources[0].line_markers[0].line == 5); + SPVC_CHECK(ir.sources[0].line_markers[0].col == 0); + SPVC_CHECK(ir.sources[0].line_markers[1].function_id != 0); + SPVC_CHECK(ir.sources[0].line_markers[1].block_id != 0); + SPVC_CHECK(ir.sources[0].line_markers[4].line == 9); + + SPVC_CHECK(ir.sources[1].line_markers.size() == 2); + SPVC_CHECK(ir.sources[1].line_markers[0].line == 1); + SPVC_CHECK(ir.sources[1].line_markers[1].function_id != 0); + SPVC_CHECK(ir.sources[1].line_markers[1].block_id != 0); + SPVC_CHECK(ir.sources[1].line_markers[1].line == 2); +} diff --git a/third_party/spirv-headers/.github/workflows/presubmit.yml b/third_party/spirv-headers/.github/workflows/presubmit.yml index 841e251fd2..22ca2e3ad3 100644 --- a/third_party/spirv-headers/.github/workflows/presubmit.yml +++ b/third_party/spirv-headers/.github/workflows/presubmit.yml @@ -5,6 +5,13 @@ permissions: contents: read jobs: + validate_json: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - name: Validate + run: python3 tools/check_grammar/check_grammar.py include/spirv/unified1/*.json + build: name: Build ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -12,7 +19,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Ubuntu packages if: matrix.os == 'ubuntu-latest' run: sudo apt install -y dos2unix @@ -52,7 +59,7 @@ jobs: test_cmake_min_required: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: lukka/get-cmake@latest with: cmakeVersion: 3.14.0 @@ -64,7 +71,7 @@ jobs: test_cmake_latest: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: lukka/get-cmake@latest - name: CMake build run: | @@ -74,7 +81,7 @@ jobs: add_subdirectory: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: lukka/get-cmake@latest with: cmakeVersion: 3.15.0 @@ -86,7 +93,7 @@ jobs: find_package: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: lukka/get-cmake@latest with: cmakeVersion: 3.15.0 @@ -102,7 +109,7 @@ jobs: find_pkg_config: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: lukka/get-cmake@latest with: cmakeVersion: 3.15.0 @@ -119,7 +126,7 @@ jobs: find_pkg_config_absolute: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: lukka/get-cmake@latest with: cmakeVersion: 3.15.0 @@ -141,6 +148,6 @@ jobs: container: khronosgroup/docker-images@sha256:724f67d8562445523644abf017d5d192b369fafc122de75e9d26792c649821a0 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: REUSE license checker run: reuse lint \ No newline at end of file diff --git a/third_party/spirv-headers/BUILD.bazel b/third_party/spirv-headers/BUILD.bazel index 13ca69937f..e7224a56c3 100644 --- a/third_party/spirv-headers/BUILD.bazel +++ b/third_party/spirv-headers/BUILD.bazel @@ -128,6 +128,11 @@ filegroup( srcs = ["include/spirv/unified1/extinst.tosa.001000.1.grammar.json"], ) +filegroup( + name = "spirv_ext_inst_arm_motion_engine_100", + srcs = ["include/spirv/unified1/extinst.arm.motion-engine.100.grammar.json"], +) + cc_library( name = "spirv_common_headers", hdrs = [ @@ -137,6 +142,7 @@ cc_library( "include/spirv/1.1/OpenCL.std.h", "include/spirv/1.2/GLSL.std.450.h", "include/spirv/1.2/OpenCL.std.h", + "include/spirv/unified1/ArmMotionEngine.100.h", "include/spirv/unified1/GLSL.std.450.h", "include/spirv/unified1/NonSemanticClspvReflection.h", "include/spirv/unified1/NonSemanticDebugPrintf.h", diff --git a/third_party/spirv-headers/include/spirv/spir-v.xml b/third_party/spirv-headers/include/spirv/spir-v.xml index b7c794763d..605bc47cee 100644 --- a/third_party/spirv-headers/include/spirv/spir-v.xml +++ b/third_party/spirv-headers/include/spirv/spir-v.xml @@ -81,7 +81,8 @@ - + + @@ -139,13 +140,14 @@ + - + @@ -173,13 +175,14 @@ + - + diff --git a/third_party/spirv-headers/include/spirv/unified1/ArmMotionEngine.100.h b/third_party/spirv-headers/include/spirv/unified1/ArmMotionEngine.100.h new file mode 100644 index 0000000000..b7842907b5 --- /dev/null +++ b/third_party/spirv-headers/include/spirv/unified1/ArmMotionEngine.100.h @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2022-2025 Arm Ltd. +// SPDX-License-Identifier: MIT + +#ifndef SPIRV_UNIFIED1_ArmMotionEngine_100_H_ +#define SPIRV_UNIFIED1_ArmMotionEngine_100_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + ArmMotionEngineVersion = 100, + ArmMotionEngineVersion_BitWidthPadding = 0x7fffffff +}; +enum { + ArmMotionEngineRevision = 1, + ArmMotionEngineRevision_BitWidthPadding = 0x7fffffff +}; + +enum ArmMotionEngineInstructions { + ArmMotionEngineMIN_SAD = 0, + ArmMotionEngineMIN_SAD_COST = 1, + ArmMotionEngineRAW_SAD = 2, + ArmMotionEngineInstructionsMax = 0x7fffffff +}; + + +#ifdef __cplusplus +} +#endif + +#endif // SPIRV_UNIFIED1_ArmMotionEngine_100_H_ diff --git a/third_party/spirv-headers/include/spirv/unified1/TOSA.001000.1.h b/third_party/spirv-headers/include/spirv/unified1/TOSA.001000.1.h index 3da296907e..619024cf9d 100644 --- a/third_party/spirv-headers/include/spirv/unified1/TOSA.001000.1.h +++ b/third_party/spirv-headers/include/spirv/unified1/TOSA.001000.1.h @@ -9,7 +9,7 @@ extern "C" { #endif enum { - TOSAVersion = 1000000, + TOSAVersion = 1000001, TOSAVersion_BitWidthPadding = 0x7fffffff }; enum { diff --git a/third_party/spirv-headers/include/spirv/unified1/extinst.arm.motion-engine.100.grammar.json b/third_party/spirv-headers/include/spirv/unified1/extinst.arm.motion-engine.100.grammar.json new file mode 100644 index 0000000000..abcc16e4f0 --- /dev/null +++ b/third_party/spirv-headers/include/spirv/unified1/extinst.arm.motion-engine.100.grammar.json @@ -0,0 +1,133 @@ +{ + "copyright": [ + "SPDX-FileCopyrightText: 2022-2025 Arm Ltd.", + "SPDX-License-Identifier: MIT" + ], + "version": 100, + "revision": 1, + "instructions": [ + { + "opname": "MIN_SAD", + "opcode": 0, + "operands": [ + { + "kind": "IdRef", + "name": "kernel_sizes" + }, + { + "kind": "IdRef", + "name": "search_window_sizes" + }, + { + "kind": "IdRef", + "name": "input_strides" + }, + { + "kind": "IdRef", + "name": "window_strides" + }, + { + "kind": "IdRef", + "name": "window_offsets" + }, + { + "kind": "IdRef", + "name": "padding" + }, + { + "kind": "IdRef", + "name": "search_pattern" + }, + { + "kind": "IdRef", + "name": "input0" + }, + { + "kind": "IdRef", + "name": "input1" + } + ] + }, + { + "opname": "MIN_SAD_COST", + "opcode": 1, + "operands": [ + { + "kind": "IdRef", + "name": "kernel_sizes" + }, + { + "kind": "IdRef", + "name": "search_window_sizes" + }, + { + "kind": "IdRef", + "name": "input_strides" + }, + { + "kind": "IdRef", + "name": "window_strides" + }, + { + "kind": "IdRef", + "name": "window_offsets" + }, + { + "kind": "IdRef", + "name": "padding" + }, + { + "kind": "IdRef", + "name": "search_pattern" + }, + { + "kind": "IdRef", + "name": "input0" + }, + { + "kind": "IdRef", + "name": "input1" + } + ] + }, + { + "opname": "RAW_SAD", + "opcode": 2, + "operands": [ + { + "kind": "IdRef", + "name": "kernel_sizes" + }, + { + "kind": "IdRef", + "name": "search_window_sizes" + }, + { + "kind": "IdRef", + "name": "input_strides" + }, + { + "kind": "IdRef", + "name": "window_strides" + }, + { + "kind": "IdRef", + "name": "window_offsets" + }, + { + "kind": "IdRef", + "name": "padding" + }, + { + "kind": "IdRef", + "name": "input0" + }, + { + "kind": "IdRef", + "name": "input1" + } + ] + } + ], + "operand_kinds": [] +} diff --git a/third_party/spirv-headers/include/spirv/unified1/extinst.debuginfo.grammar.json b/third_party/spirv-headers/include/spirv/unified1/extinst.debuginfo.grammar.json index d723d6129a..b73874d6ec 100644 --- a/third_party/spirv-headers/include/spirv/unified1/extinst.debuginfo.grammar.json +++ b/third_party/spirv-headers/include/spirv/unified1/extinst.debuginfo.grammar.json @@ -432,35 +432,35 @@ "enumerants" : [ { "enumerant" : "Unspecified", - "value" : "0" + "value" : 0 }, { "enumerant" : "Address", - "value" : "1" + "value" : 1 }, { "enumerant" : "Boolean", - "value" : "2" + "value" : 2 }, { "enumerant" : "Float", - "value" : "4" + "value" : 4 }, { "enumerant" : "Signed", - "value" : "5" + "value" : 5 }, { "enumerant" : "SignedChar", - "value" : "6" + "value" : 6 }, { "enumerant" : "Unsigned", - "value" : "7" + "value" : 7 }, { "enumerant" : "UnsignedChar", - "value" : "8" + "value" : 8 } ] }, @@ -470,15 +470,15 @@ "enumerants" : [ { "enumerant" : "Class", - "value" : "0" + "value" : 0 }, { "enumerant" : "Structure", - "value" : "1" + "value" : 1 }, { "enumerant" : "Union", - "value" : "2" + "value" : 2 } ] }, @@ -488,15 +488,15 @@ "enumerants" : [ { "enumerant" : "ConstType", - "value" : "0" + "value" : 0 }, { "enumerant" : "VolatileType", - "value" : "1" + "value" : 1 }, { "enumerant" : "RestrictType", - "value" : "2" + "value" : 2 } ] }, @@ -506,26 +506,26 @@ "enumerants" : [ { "enumerant" : "Deref", - "value" : "0" + "value" : 0 }, { "enumerant" : "Plus", - "value" : "1" + "value" : 1 }, { "enumerant" : "Minus", - "value" : "2" + "value" : 2 }, { "enumerant" : "PlusUconst", - "value" : "3", + "value" : 3, "parameters" : [ { "kind" : "LiteralInteger" } ] }, { "enumerant" : "BitPiece", - "value" : "4", + "value" : 4, "parameters" : [ { "kind" : "LiteralInteger" }, { "kind" : "LiteralInteger" } @@ -533,19 +533,19 @@ }, { "enumerant" : "Swap", - "value" : "5" + "value" : 5 }, { "enumerant" : "Xderef", - "value" : "6" + "value" : 6 }, { "enumerant" : "StackValue", - "value" : "7" + "value" : 7 }, { "enumerant" : "Constu", - "value" : "8", + "value" : 8, "parameters" : [ { "kind" : "LiteralInteger" } ] diff --git a/third_party/spirv-headers/include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json b/third_party/spirv-headers/include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json index effbdd3fbe..305f171123 100644 --- a/third_party/spirv-headers/include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json +++ b/third_party/spirv-headers/include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json @@ -547,35 +547,35 @@ "enumerants" : [ { "enumerant" : "Unspecified", - "value" : "0" + "value" : 0 }, { "enumerant" : "Address", - "value" : "1" + "value" : 1 }, { "enumerant" : "Boolean", - "value" : "2" + "value" : 2 }, { "enumerant" : "Float", - "value" : "3" + "value" : 3 }, { "enumerant" : "Signed", - "value" : "4" + "value" : 4 }, { "enumerant" : "SignedChar", - "value" : "5" + "value" : 5 }, { "enumerant" : "Unsigned", - "value" : "6" + "value" : 6 }, { "enumerant" : "UnsignedChar", - "value" : "7" + "value" : 7 } ] }, @@ -585,15 +585,15 @@ "enumerants" : [ { "enumerant" : "Class", - "value" : "0" + "value" : 0 }, { "enumerant" : "Structure", - "value" : "1" + "value" : 1 }, { "enumerant" : "Union", - "value" : "2" + "value" : 2 } ] }, @@ -603,19 +603,19 @@ "enumerants" : [ { "enumerant" : "ConstType", - "value" : "0" + "value" : 0 }, { "enumerant" : "VolatileType", - "value" : "1" + "value" : 1 }, { "enumerant" : "RestrictType", - "value" : "2" + "value" : 2 }, { "enumerant" : "AtomicType", - "value" : "3" + "value" : 3 } ] }, @@ -625,26 +625,26 @@ "enumerants" : [ { "enumerant" : "Deref", - "value" : "0" + "value" : 0 }, { "enumerant" : "Plus", - "value" : "1" + "value" : 1 }, { "enumerant" : "Minus", - "value" : "2" + "value" : 2 }, { "enumerant" : "PlusUconst", - "value" : "3", + "value" : 3, "parameters" : [ { "kind" : "IdRef" } ] }, { "enumerant" : "BitPiece", - "value" : "4", + "value" : 4, "parameters" : [ { "kind" : "IdRef" }, { "kind" : "IdRef" } @@ -652,26 +652,26 @@ }, { "enumerant" : "Swap", - "value" : "5" + "value" : 5 }, { "enumerant" : "Xderef", - "value" : "6" + "value" : 6 }, { "enumerant" : "StackValue", - "value" : "7" + "value" : 7 }, { "enumerant" : "Constu", - "value" : "8", + "value" : 8, "parameters" : [ { "kind" : "IdRef" } ] }, { "enumerant" : "Fragment", - "value" : "9", + "value" : 9, "parameters" : [ { "kind" : "IdRef" }, { "kind" : "IdRef" } @@ -685,11 +685,11 @@ "enumerants" : [ { "enumerant" : "ImportedModule", - "value" : "0" + "value" : 0 }, { "enumerant" : "ImportedDeclaration", - "value" : "1" + "value" : 1 } ] } diff --git a/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json b/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json index 6d4d6e3e59..598d0f6b1b 100644 --- a/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json +++ b/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json @@ -485,35 +485,35 @@ "enumerants" : [ { "enumerant" : "Unspecified", - "value" : "0" + "value" : 0 }, { "enumerant" : "Address", - "value" : "1" + "value" : 1 }, { "enumerant" : "Boolean", - "value" : "2" + "value" : 2 }, { "enumerant" : "Float", - "value" : "3" + "value" : 3 }, { "enumerant" : "Signed", - "value" : "4" + "value" : 4 }, { "enumerant" : "SignedChar", - "value" : "5" + "value" : 5 }, { "enumerant" : "Unsigned", - "value" : "6" + "value" : 6 }, { "enumerant" : "UnsignedChar", - "value" : "7" + "value" : 7 } ] }, @@ -523,15 +523,15 @@ "enumerants" : [ { "enumerant" : "Class", - "value" : "0" + "value" : 0 }, { "enumerant" : "Structure", - "value" : "1" + "value" : 1 }, { "enumerant" : "Union", - "value" : "2" + "value" : 2 } ] }, @@ -541,19 +541,19 @@ "enumerants" : [ { "enumerant" : "ConstType", - "value" : "0" + "value" : 0 }, { "enumerant" : "VolatileType", - "value" : "1" + "value" : 1 }, { "enumerant" : "RestrictType", - "value" : "2" + "value" : 2 }, { "enumerant" : "AtomicType", - "value" : "3" + "value" : 3 } ] }, @@ -563,26 +563,26 @@ "enumerants" : [ { "enumerant" : "Deref", - "value" : "0" + "value" : 0 }, { "enumerant" : "Plus", - "value" : "1" + "value" : 1 }, { "enumerant" : "Minus", - "value" : "2" + "value" : 2 }, { "enumerant" : "PlusUconst", - "value" : "3", + "value" : 3, "parameters" : [ { "kind" : "LiteralInteger" } ] }, { "enumerant" : "BitPiece", - "value" : "4", + "value" : 4, "parameters" : [ { "kind" : "LiteralInteger" }, { "kind" : "LiteralInteger" } @@ -590,26 +590,26 @@ }, { "enumerant" : "Swap", - "value" : "5" + "value" : 5 }, { "enumerant" : "Xderef", - "value" : "6" + "value" : 6 }, { "enumerant" : "StackValue", - "value" : "7" + "value" : 7 }, { "enumerant" : "Constu", - "value" : "8", + "value" : 8, "parameters" : [ { "kind" : "LiteralInteger" } ] }, { "enumerant" : "Fragment", - "value" : "9", + "value" : 9, "parameters" : [ { "kind" : "LiteralInteger" }, { "kind" : "LiteralInteger" } @@ -623,11 +623,11 @@ "enumerants" : [ { "enumerant" : "ImportedModule", - "value" : "0" + "value" : 0 }, { "enumerant" : "ImportedDeclaration", - "value" : "1" + "value" : 1 } ] } diff --git a/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.std.100.grammar.json b/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.std.100.grammar.json index 79394dd876..0b335af28c 100644 --- a/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.std.100.grammar.json +++ b/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.std.100.grammar.json @@ -708,6 +708,130 @@ { "kind" : "IdRef", "name" : "x" } ] }, + { + "opname" : "fclamp", + "opcode" : 95, + "operands" : [ + { "kind" : "IdRef", "name" : "x" }, + { "kind" : "IdRef", "name" : "minval" }, + { "kind" : "IdRef", "name" : "maxval" } + ] + }, + { + "opname" : "degrees", + "opcode" :96, + "operands" : [ + { "kind" : "IdRef", "name" : "radians" } + ] + }, + { + "opname" : "fmax_common", + "opcode" : 97, + "operands" : [ + { "kind" : "IdRef", "name" : "x" }, + { "kind" : "IdRef", "name" : "y" } + ] + }, + { + "opname" : "fmin_common", + "opcode" : 98, + "operands" : [ + { "kind" : "IdRef", "name" : "x" }, + { "kind" : "IdRef", "name" : "y" } + ] + }, + { + "opname" : "mix", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "x" }, + { "kind" : "IdRef", "name" : "y" }, + { "kind" : "IdRef", "name" : "a" } + ] + }, + { + "opname" : "radians", + "opcode" : 100, + "operands" : [ + { "kind" : "IdRef", "name" : "degrees" } + ] + }, + { + "opname" : "step", + "opcode" : 101, + "operands" : [ + { "kind" : "IdRef", "name" : "edge" }, + { "kind" : "IdRef", "name" : "x" } + ] + }, + { + "opname" : "smoothstep", + "opcode" : 102, + "operands" : [ + { "kind" : "IdRef", "name" : "edge0" }, + { "kind" : "IdRef", "name" : "edge1" }, + { "kind" : "IdRef", "name" : "x" } + ] + }, + { + "opname" : "sign", + "opcode" : 103, + "operands" : [ + { "kind" : "IdRef", "name" : "x" } + ] + }, + { + "opname" : "cross", + "opcode" : 104, + "operands" : [ + { "kind" : "IdRef", "name" : "p0" }, + { "kind" : "IdRef", "name" : "p1" } + ] + }, + { + "opname" : "distance", + "opcode" : 105, + "operands" : [ + { "kind" : "IdRef", "name" : "p0" }, + { "kind" : "IdRef", "name" : "p1" } + ] + }, + { + "opname" : "length", + "opcode" : 106, + "operands" : [ + { "kind" : "IdRef", "name" : "p" } + ] + }, + { + "opname" : "normalize", + "opcode" : 107, + "operands" : [ + { "kind" : "IdRef", "name" : "p" } + ] + }, + { + "opname" : "fast_distance", + "opcode" : 108, + "operands" : [ + { "kind" : "IdRef", "name" : "p0" }, + { "kind" : "IdRef", "name" : "p1" } + ] + }, + { + "opname" : "fast_length", + "opcode" : 109, + "operands" : [ + { "kind" : "IdRef", "name" : "p" } + ] + }, + { + "opname" : "fast_normalize", + "opcode" : 110, + "operands" : [ + { "kind" : "IdRef", "name" : "p" } + ] + }, { "opname" : "s_abs", "opcode" : 141, @@ -951,180 +1075,6 @@ { "kind" : "IdRef", "name" : "y" } ] }, - { - "opname" : "u_abs", - "opcode" : 201, - "operands" : [ - { "kind" : "IdRef", "name" : "x" } - ] - }, - { - "opname" : "u_abs_diff", - "opcode" : 202, - "operands" : [ - { "kind" : "IdRef", "name" : "x" }, - { "kind" : "IdRef", "name" : "y" } - ] - }, - { - "opname" : "u_mul_hi", - "opcode" : 203, - "operands" : [ - { "kind" : "IdRef", "name" : "x" }, - { "kind" : "IdRef", "name" : "y" } - ] - }, - { - "opname" : "u_mad_hi", - "opcode" : 204, - "operands" : [ - { "kind" : "IdRef", "name" : "a" }, - { "kind" : "IdRef", "name" : "b" }, - { "kind" : "IdRef", "name" : "c" } - ] - }, - { - "opname" : "fclamp", - "opcode" : 95, - "operands" : [ - { "kind" : "IdRef", "name" : "x" }, - { "kind" : "IdRef", "name" : "minval" }, - { "kind" : "IdRef", "name" : "maxval" } - ] - }, - { - "opname" : "degrees", - "opcode" :96, - "operands" : [ - { "kind" : "IdRef", "name" : "radians" } - ] - }, - { - "opname" : "fmax_common", - "opcode" : 97, - "operands" : [ - { "kind" : "IdRef", "name" : "x" }, - { "kind" : "IdRef", "name" : "y" } - ] - }, - { - "opname" : "fmin_common", - "opcode" : 98, - "operands" : [ - { "kind" : "IdRef", "name" : "x" }, - { "kind" : "IdRef", "name" : "y" } - ] - }, - { - "opname" : "mix", - "opcode" : 99, - "operands" : [ - { "kind" : "IdRef", "name" : "x" }, - { "kind" : "IdRef", "name" : "y" }, - { "kind" : "IdRef", "name" : "a" } - ] - }, - { - "opname" : "radians", - "opcode" : 100, - "operands" : [ - { "kind" : "IdRef", "name" : "degrees" } - ] - }, - { - "opname" : "step", - "opcode" : 101, - "operands" : [ - { "kind" : "IdRef", "name" : "edge" }, - { "kind" : "IdRef", "name" : "x" } - ] - }, - { - "opname" : "smoothstep", - "opcode" : 102, - "operands" : [ - { "kind" : "IdRef", "name" : "edge0" }, - { "kind" : "IdRef", "name" : "edge1" }, - { "kind" : "IdRef", "name" : "x" } - ] - }, - { - "opname" : "sign", - "opcode" : 103, - "operands" : [ - { "kind" : "IdRef", "name" : "x" } - ] - }, - { - "opname" : "cross", - "opcode" : 104, - "operands" : [ - { "kind" : "IdRef", "name" : "p0" }, - { "kind" : "IdRef", "name" : "p1" } - ] - }, - { - "opname" : "distance", - "opcode" : 105, - "operands" : [ - { "kind" : "IdRef", "name" : "p0" }, - { "kind" : "IdRef", "name" : "p1" } - ] - }, - { - "opname" : "length", - "opcode" : 106, - "operands" : [ - { "kind" : "IdRef", "name" : "p" } - ] - }, - { - "opname" : "normalize", - "opcode" : 107, - "operands" : [ - { "kind" : "IdRef", "name" : "p" } - ] - }, - { - "opname" : "fast_distance", - "opcode" : 108, - "operands" : [ - { "kind" : "IdRef", "name" : "p0" }, - { "kind" : "IdRef", "name" : "p1" } - ] - }, - { - "opname" : "fast_length", - "opcode" : 109, - "operands" : [ - { "kind" : "IdRef", "name" : "p" } - ] - }, - { - "opname" : "fast_normalize", - "opcode" : 110, - "operands" : [ - { "kind" : "IdRef", "name" : "p" } - ] - }, - { - "opname" : "bitselect", - "opcode" : 186, - "operands" : [ - { "kind" : "IdRef", "name" : "a" }, - { "kind" : "IdRef", "name" : "b" }, - { "kind" : "IdRef", "name" : "c" } - ] - }, - { - "opname" : "select", - "opcode" : 187, - "operands" : [ - { "kind" : "IdRef", "name" : "a" }, - { "kind" : "IdRef", "name" : "b" }, - { "kind" : "IdRef", "name" : "c" } - ] - }, { "opname" : "vloadn", "opcode" : 171, @@ -1258,6 +1208,56 @@ { "kind" : "IdRef", "name" : "ptr" }, { "kind" : "IdRef", "name" : "num elements" } ] + }, + { + "opname" : "bitselect", + "opcode" : 186, + "operands" : [ + { "kind" : "IdRef", "name" : "a" }, + { "kind" : "IdRef", "name" : "b" }, + { "kind" : "IdRef", "name" : "c" } + ] + }, + { + "opname" : "select", + "opcode" : 187, + "operands" : [ + { "kind" : "IdRef", "name" : "a" }, + { "kind" : "IdRef", "name" : "b" }, + { "kind" : "IdRef", "name" : "c" } + ] + }, + { + "opname" : "u_abs", + "opcode" : 201, + "operands" : [ + { "kind" : "IdRef", "name" : "x" } + ] + }, + { + "opname" : "u_abs_diff", + "opcode" : 202, + "operands" : [ + { "kind" : "IdRef", "name" : "x" }, + { "kind" : "IdRef", "name" : "y" } + ] + }, + { + "opname" : "u_mul_hi", + "opcode" : 203, + "operands" : [ + { "kind" : "IdRef", "name" : "x" }, + { "kind" : "IdRef", "name" : "y" } + ] + }, + { + "opname" : "u_mad_hi", + "opcode" : 204, + "operands" : [ + { "kind" : "IdRef", "name" : "a" }, + { "kind" : "IdRef", "name" : "b" }, + { "kind" : "IdRef", "name" : "c" } + ] } ] } diff --git a/third_party/spirv-headers/include/spirv/unified1/extinst.tosa.001000.1.grammar.json b/third_party/spirv-headers/include/spirv/unified1/extinst.tosa.001000.1.grammar.json index cabab82fb5..1eabf584c7 100644 --- a/third_party/spirv-headers/include/spirv/unified1/extinst.tosa.001000.1.grammar.json +++ b/third_party/spirv-headers/include/spirv/unified1/extinst.tosa.001000.1.grammar.json @@ -3,7 +3,7 @@ "SPDX-FileCopyrightText: 2022-2025 Arm Ltd.", "SPDX-License-Identifier: MIT" ], - "version": 1000000, + "version": 1000001, "revision": 1, "instructions": [ { diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.bf b/third_party/spirv-headers/include/spirv/unified1/spirv.bf index 95469e77d8..bf0e90ad36 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.bf +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.bf @@ -192,6 +192,7 @@ namespace Spv SampleInterlockUnorderedEXT = 5369, ShadingRateInterlockOrderedEXT = 5370, ShadingRateInterlockUnorderedEXT = 5371, + Shader64BitIndexingEXT = 5427, SharedLocalMemorySizeINTEL = 5618, RoundingModeRTPINTEL = 5620, RoundingModeRTNINTEL = 5621, @@ -247,8 +248,11 @@ namespace Spv PhysicalStorageBufferEXT = 5349, HitObjectAttributeNV = 5385, TaskPayloadWorkgroupEXT = 5402, + HitObjectAttributeEXT = 5411, CodeSectionINTEL = 5605, + DeviceOnlyALTERA = 5936, DeviceOnlyINTEL = 5936, + HostOnlyALTERA = 5937, HostOnlyINTEL = 5937, Max = 0x7fffffff, } @@ -501,6 +505,7 @@ namespace Spv NoCapture = 5, NoWrite = 6, NoReadWrite = 7, + RuntimeAlignedALTERA = 5940, RuntimeAlignedINTEL = 5940, Max = 0x7fffffff, } @@ -569,6 +574,8 @@ namespace Spv PayloadNodeSparseArrayAMDX = 5099, PayloadNodeArraySizeAMDX = 5100, PayloadDispatchIndirectAMDX = 5105, + ArrayStrideIdEXT = 5124, + OffsetIdEXT = 5125, OverrideCoverageNV = 5248, PassthroughNV = 5250, ViewportRelativeNV = 5252, @@ -585,7 +592,10 @@ namespace Spv RestrictPointerEXT = 5355, AliasedPointer = 5356, AliasedPointerEXT = 5356, + MemberOffsetNV = 5358, HitObjectShaderRecordBufferNV = 5386, + HitObjectShaderRecordBufferEXT = 5389, + BankNV = 5397, BindlessSamplerNV = 5398, BindlessImageNV = 5399, BoundSamplerNV = 5400, @@ -606,54 +616,95 @@ namespace Spv UserTypeGOOGLE = 5636, FunctionRoundingModeINTEL = 5822, FunctionDenormModeINTEL = 5823, + RegisterALTERA = 5825, RegisterINTEL = 5825, + MemoryALTERA = 5826, MemoryINTEL = 5826, + NumbanksALTERA = 5827, NumbanksINTEL = 5827, + BankwidthALTERA = 5828, BankwidthINTEL = 5828, + MaxPrivateCopiesALTERA = 5829, MaxPrivateCopiesINTEL = 5829, + SinglepumpALTERA = 5830, SinglepumpINTEL = 5830, + DoublepumpALTERA = 5831, DoublepumpINTEL = 5831, + MaxReplicatesALTERA = 5832, MaxReplicatesINTEL = 5832, + SimpleDualPortALTERA = 5833, SimpleDualPortINTEL = 5833, + MergeALTERA = 5834, MergeINTEL = 5834, + BankBitsALTERA = 5835, BankBitsINTEL = 5835, + ForcePow2DepthALTERA = 5836, ForcePow2DepthINTEL = 5836, + StridesizeALTERA = 5883, StridesizeINTEL = 5883, + WordsizeALTERA = 5884, WordsizeINTEL = 5884, + TrueDualPortALTERA = 5885, TrueDualPortINTEL = 5885, + BurstCoalesceALTERA = 5899, BurstCoalesceINTEL = 5899, + CacheSizeALTERA = 5900, CacheSizeINTEL = 5900, + DontStaticallyCoalesceALTERA = 5901, DontStaticallyCoalesceINTEL = 5901, + PrefetchALTERA = 5902, PrefetchINTEL = 5902, + StallEnableALTERA = 5905, StallEnableINTEL = 5905, + FuseLoopsInFunctionALTERA = 5907, FuseLoopsInFunctionINTEL = 5907, + MathOpDSPModeALTERA = 5909, MathOpDSPModeINTEL = 5909, AliasScopeINTEL = 5914, NoAliasINTEL = 5915, + InitiationIntervalALTERA = 5917, InitiationIntervalINTEL = 5917, + MaxConcurrencyALTERA = 5918, MaxConcurrencyINTEL = 5918, + PipelineEnableALTERA = 5919, PipelineEnableINTEL = 5919, + BufferLocationALTERA = 5921, BufferLocationINTEL = 5921, + IOPipeStorageALTERA = 5944, IOPipeStorageINTEL = 5944, FunctionFloatingPointModeINTEL = 6080, SingleElementVectorINTEL = 6085, VectorComputeCallableFunctionINTEL = 6087, MediaBlockIOINTEL = 6140, + StallFreeALTERA = 6151, StallFreeINTEL = 6151, FPMaxErrorDecorationINTEL = 6170, + LatencyControlLabelALTERA = 6172, LatencyControlLabelINTEL = 6172, + LatencyControlConstraintALTERA = 6173, LatencyControlConstraintINTEL = 6173, + ConduitKernelArgumentALTERA = 6175, ConduitKernelArgumentINTEL = 6175, + RegisterMapKernelArgumentALTERA = 6176, RegisterMapKernelArgumentINTEL = 6176, + MMHostInterfaceAddressWidthALTERA = 6177, MMHostInterfaceAddressWidthINTEL = 6177, + MMHostInterfaceDataWidthALTERA = 6178, MMHostInterfaceDataWidthINTEL = 6178, + MMHostInterfaceLatencyALTERA = 6179, MMHostInterfaceLatencyINTEL = 6179, + MMHostInterfaceReadWriteModeALTERA = 6180, MMHostInterfaceReadWriteModeINTEL = 6180, + MMHostInterfaceMaxBurstALTERA = 6181, MMHostInterfaceMaxBurstINTEL = 6181, + MMHostInterfaceWaitRequestALTERA = 6182, MMHostInterfaceWaitRequestINTEL = 6182, + StableKernelArgumentALTERA = 6183, StableKernelArgumentINTEL = 6183, HostAccessINTEL = 6188, + InitModeALTERA = 6190, InitModeINTEL = 6190, + ImplementInRegisterMapALTERA = 6191, ImplementInRegisterMapINTEL = 6191, ConditionalINTEL = 6247, CacheControlLoadINTEL = 6442, @@ -739,6 +790,8 @@ namespace Spv FragStencilRefEXT = 5014, RemainingRecursionLevelsAMDX = 5021, ShaderIndexAMDX = 5073, + SamplerHeapEXT = 5122, + ResourceHeapEXT = 5123, ViewportMaskNV = 5253, SecondaryPositionNV = 5257, SecondaryViewportMaskNV = 5258, @@ -839,15 +892,25 @@ namespace Spv IterationMultiple = 6, PeelCount = 7, PartialCount = 8, + InitiationIntervalALTERA = 16, InitiationIntervalINTEL = 16, + MaxConcurrencyALTERA = 17, MaxConcurrencyINTEL = 17, + DependencyArrayALTERA = 18, DependencyArrayINTEL = 18, + PipelineEnableALTERA = 19, PipelineEnableINTEL = 19, + LoopCoalesceALTERA = 20, LoopCoalesceINTEL = 20, + MaxInterleavingALTERA = 21, MaxInterleavingINTEL = 21, + SpeculatedIterationsALTERA = 22, SpeculatedIterationsINTEL = 22, + NoFusionALTERA = 23, NoFusionINTEL = 23, + LoopCountALTERA = 24, LoopCountINTEL = 24, + MaxReinvocationDelayALTERA = 25, MaxReinvocationDelayINTEL = 25, Max = 0x7fffffff, } @@ -864,15 +927,25 @@ namespace Spv IterationMultiple = 0x00000040, PeelCount = 0x00000080, PartialCount = 0x00000100, + InitiationIntervalALTERA = 0x00010000, InitiationIntervalINTEL = 0x00010000, + MaxConcurrencyALTERA = 0x00020000, MaxConcurrencyINTEL = 0x00020000, + DependencyArrayALTERA = 0x00040000, DependencyArrayINTEL = 0x00040000, + PipelineEnableALTERA = 0x00080000, PipelineEnableINTEL = 0x00080000, + LoopCoalesceALTERA = 0x00100000, LoopCoalesceINTEL = 0x00100000, + MaxInterleavingALTERA = 0x00200000, MaxInterleavingINTEL = 0x00200000, + SpeculatedIterationsALTERA = 0x00400000, SpeculatedIterationsINTEL = 0x00400000, + NoFusionALTERA = 0x00800000, NoFusionINTEL = 0x00800000, + LoopCountALTERA = 0x01000000, LoopCountINTEL = 0x01000000, + MaxReinvocationDelayALTERA = 0x02000000, MaxReinvocationDelayINTEL = 0x02000000, } @@ -993,8 +1066,11 @@ namespace Spv InclusiveScan = 1, ExclusiveScan = 2, ClusteredReduce = 3, + PartitionedReduceEXT = 6, PartitionedReduceNV = 6, + PartitionedInclusiveScanEXT = 7, PartitionedInclusiveScanNV = 7, + PartitionedExclusiveScanEXT = 8, PartitionedExclusiveScanNV = 8, Max = 0x7fffffff, } @@ -1154,6 +1230,7 @@ namespace Spv BFloat16TypeKHR = 5116, BFloat16DotProductKHR = 5117, BFloat16CooperativeMatrixKHR = 5118, + DescriptorHeapEXT = 5128, SampleMaskOverrideCoverageNV = 5249, GeometryShaderPassthroughNV = 5251, ShaderViewportIndexLayerEXT = 5254, @@ -1171,6 +1248,7 @@ namespace Spv ComputeDerivativeGroupQuadsNV = 5288, FragmentDensityEXT = 5291, ShadingRateNV = 5291, + GroupNonUniformPartitionedEXT = 5297, GroupNonUniformPartitionedNV = 5297, ShaderNonUniform = 5301, ShaderNonUniformEXT = 5301, @@ -1218,6 +1296,7 @@ namespace Spv DisplacementMicromapNV = 5380, RayTracingOpacityMicromapEXT = 5381, ShaderInvocationReorderNV = 5383, + ShaderInvocationReorderEXT = 5388, BindlessTextureNV = 5390, RayQueryPositionFetchKHR = 5391, CooperativeVectorNV = 5394, @@ -1226,6 +1305,9 @@ namespace Spv RawAccessChainsNV = 5414, RayTracingSpheresGeometryNV = 5418, RayTracingLinearSweptSpheresGeometryNV = 5419, + PushConstantBanksNV = 5423, + LongVectorEXT = 5425, + Shader64BitIndexingEXT = 5426, CooperativeMatrixReductionsNV = 5430, CooperativeMatrixConversionsNV = 5431, CooperativeMatrixPerElementOperationsNV = 5432, @@ -1255,26 +1337,42 @@ namespace Spv SubgroupAvcMotionEstimationChromaINTEL = 5698, VariableLengthArrayINTEL = 5817, FunctionFloatControlINTEL = 5821, + FPGAMemoryAttributesALTERA = 5824, FPGAMemoryAttributesINTEL = 5824, FPFastMathModeINTEL = 5837, + ArbitraryPrecisionIntegersALTERA = 5844, ArbitraryPrecisionIntegersINTEL = 5844, + ArbitraryPrecisionFloatingPointALTERA = 5845, ArbitraryPrecisionFloatingPointINTEL = 5845, UnstructuredLoopControlsINTEL = 5886, + FPGALoopControlsALTERA = 5888, FPGALoopControlsINTEL = 5888, KernelAttributesINTEL = 5892, FPGAKernelAttributesINTEL = 5897, + FPGAMemoryAccessesALTERA = 5898, FPGAMemoryAccessesINTEL = 5898, + FPGAClusterAttributesALTERA = 5904, FPGAClusterAttributesINTEL = 5904, + LoopFuseALTERA = 5906, LoopFuseINTEL = 5906, + FPGADSPControlALTERA = 5908, FPGADSPControlINTEL = 5908, MemoryAccessAliasingINTEL = 5910, + FPGAInvocationPipeliningAttributesALTERA = 5916, FPGAInvocationPipeliningAttributesINTEL = 5916, + FPGABufferLocationALTERA = 5920, FPGABufferLocationINTEL = 5920, + ArbitraryPrecisionFixedPointALTERA = 5922, ArbitraryPrecisionFixedPointINTEL = 5922, + USMStorageClassesALTERA = 5935, USMStorageClassesINTEL = 5935, + RuntimeAlignedAttributeALTERA = 5939, RuntimeAlignedAttributeINTEL = 5939, + IOPipesALTERA = 5943, IOPipesINTEL = 5943, + BlockingPipesALTERA = 5945, BlockingPipesINTEL = 5945, + FPGARegALTERA = 5948, FPGARegINTEL = 5948, DotProductInputAll = 6016, DotProductInputAllKHR = 6016, @@ -1290,6 +1388,7 @@ namespace Spv BitInstructions = 6025, GroupNonUniformRotateKHR = 6026, FloatControls2 = 6029, + FMAKHR = 6030, AtomicFloat32AddEXT = 6033, AtomicFloat64AddEXT = 6034, LongCompositesINTEL = 6089, @@ -1300,13 +1399,18 @@ namespace Spv BFloat16ConversionINTEL = 6115, SplitBarrierINTEL = 6141, ArithmeticFenceEXT = 6144, + FPGAClusterAttributesV2ALTERA = 6150, FPGAClusterAttributesV2INTEL = 6150, FPGAKernelAttributesv2INTEL = 6161, + TaskSequenceALTERA = 6162, TaskSequenceINTEL = 6162, FPMaxErrorINTEL = 6169, + FPGALatencyControlALTERA = 6171, FPGALatencyControlINTEL = 6171, + FPGAArgumentInterfacesALTERA = 6174, FPGAArgumentInterfacesINTEL = 6174, GlobalVariableHostAccessINTEL = 6187, + GlobalVariableFPGADecorationsALTERA = 6189, GlobalVariableFPGADecorationsINTEL = 6189, SubgroupBufferPrefetchINTEL = 6220, Subgroup2DBlockIOINTEL = 6228, @@ -1314,6 +1418,7 @@ namespace Spv Subgroup2DBlockTransposeINTEL = 6230, SubgroupMatrixMultiplyAccumulateINTEL = 6236, TernaryBitwiseFunctionINTEL = 6241, + UntypedVariableLengthArrayINTEL = 6243, SpecConditionalINTEL = 6245, FunctionVariantsINTEL = 6246, GroupUniformArithmeticKHR = 6400, @@ -1541,7 +1646,9 @@ namespace Spv [AllowDuplicates, CRepr] public enum InitializationModeQualifier { + InitOnDeviceReprogramALTERA = 0, InitOnDeviceReprogramINTEL = 0, + InitOnDeviceResetALTERA = 1, InitOnDeviceResetINTEL = 1, Max = 0x7fffffff, } @@ -2040,12 +2147,14 @@ namespace Spv OpUntypedInBoundsPtrAccessChainKHR = 4424, OpUntypedArrayLengthKHR = 4425, OpUntypedPrefetchKHR = 4426, + OpFmaKHR = 4427, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, OpGroupNonUniformRotateKHR = 4431, OpSubgroupReadInvocationKHR = 4432, OpExtInstWithForwardRefsKHR = 4433, + OpUntypedGroupAsyncCopyKHR = 4434, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, OpConvertUToAccelerationStructureKHR = 4447, @@ -2111,6 +2220,11 @@ namespace Spv OpSpecConstantStringAMDX = 5104, OpGroupNonUniformQuadAllKHR = 5110, OpGroupNonUniformQuadAnyKHR = 5111, + OpTypeBufferEXT = 5115, + OpBufferPointerEXT = 5119, + OpUntypedImageTexelPointerEXT = 5126, + OpMemberDecorateIdEXT = 5127, + OpConstantSizeOfEXT = 5129, OpHitObjectRecordHitMotionNV = 5249, OpHitObjectRecordHitWithIndexMotionNV = 5250, OpHitObjectRecordMissMotionNV = 5251, @@ -2146,6 +2260,7 @@ namespace Spv OpTypeHitObjectNV = 5281, OpImageSampleFootprintNV = 5283, OpTypeCooperativeVectorNV = 5288, + OpTypeVectorIdEXT = 5288, OpCooperativeVectorMatrixMulNV = 5289, OpCooperativeVectorOuterProductAccumulateNV = 5290, OpCooperativeVectorReduceSumAccumulateNV = 5291, @@ -2153,12 +2268,43 @@ namespace Spv OpCooperativeMatrixConvertNV = 5293, OpEmitMeshTasksEXT = 5294, OpSetMeshOutputsEXT = 5295, + OpGroupNonUniformPartitionEXT = 5296, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, OpFetchMicroTriangleVertexPositionNV = 5300, OpFetchMicroTriangleVertexBarycentricNV = 5301, OpCooperativeVectorLoadNV = 5302, OpCooperativeVectorStoreNV = 5303, + OpHitObjectRecordFromQueryEXT = 5304, + OpHitObjectRecordMissEXT = 5305, + OpHitObjectRecordMissMotionEXT = 5306, + OpHitObjectGetIntersectionTriangleVertexPositionsEXT = 5307, + OpHitObjectGetRayFlagsEXT = 5308, + OpHitObjectSetShaderBindingTableRecordIndexEXT = 5309, + OpHitObjectReorderExecuteShaderEXT = 5310, + OpHitObjectTraceReorderExecuteEXT = 5311, + OpHitObjectTraceMotionReorderExecuteEXT = 5312, + OpTypeHitObjectEXT = 5313, + OpReorderThreadWithHintEXT = 5314, + OpReorderThreadWithHitObjectEXT = 5315, + OpHitObjectTraceRayEXT = 5316, + OpHitObjectTraceRayMotionEXT = 5317, + OpHitObjectRecordEmptyEXT = 5318, + OpHitObjectExecuteShaderEXT = 5319, + OpHitObjectGetCurrentTimeEXT = 5320, + OpHitObjectGetAttributesEXT = 5321, + OpHitObjectGetHitKindEXT = 5322, + OpHitObjectGetPrimitiveIndexEXT = 5323, + OpHitObjectGetGeometryIndexEXT = 5324, + OpHitObjectGetInstanceIdEXT = 5325, + OpHitObjectGetInstanceCustomIndexEXT = 5326, + OpHitObjectGetObjectRayOriginEXT = 5327, + OpHitObjectGetObjectRayDirectionEXT = 5328, + OpHitObjectGetWorldRayDirectionEXT = 5329, + OpHitObjectGetWorldRayOriginEXT = 5330, + OpHitObjectGetObjectToWorldEXT = 5331, + OpHitObjectGetWorldToObjectEXT = 5332, + OpHitObjectGetRayTMaxEXT = 5333, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, @@ -2171,7 +2317,14 @@ namespace Spv OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, OpRayQueryGetClusterIdNV = 5345, + OpRayQueryGetIntersectionClusterIdNV = 5345, OpHitObjectGetClusterIdNV = 5346, + OpHitObjectGetRayTMinEXT = 5347, + OpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, + OpHitObjectGetShaderRecordBufferHandleEXT = 5349, + OpHitObjectIsEmptyEXT = 5350, + OpHitObjectIsHitEXT = 5351, + OpHitObjectIsMissEXT = 5352, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixStoreNV = 5360, @@ -2378,23 +2531,41 @@ namespace Spv OpVariableLengthArrayINTEL = 5818, OpSaveMemoryINTEL = 5819, OpRestoreMemoryINTEL = 5820, + OpArbitraryFloatSinCosPiALTERA = 5840, OpArbitraryFloatSinCosPiINTEL = 5840, + OpArbitraryFloatCastALTERA = 5841, OpArbitraryFloatCastINTEL = 5841, + OpArbitraryFloatCastFromIntALTERA = 5842, OpArbitraryFloatCastFromIntINTEL = 5842, + OpArbitraryFloatCastToIntALTERA = 5843, OpArbitraryFloatCastToIntINTEL = 5843, + OpArbitraryFloatAddALTERA = 5846, OpArbitraryFloatAddINTEL = 5846, + OpArbitraryFloatSubALTERA = 5847, OpArbitraryFloatSubINTEL = 5847, + OpArbitraryFloatMulALTERA = 5848, OpArbitraryFloatMulINTEL = 5848, + OpArbitraryFloatDivALTERA = 5849, OpArbitraryFloatDivINTEL = 5849, + OpArbitraryFloatGTALTERA = 5850, OpArbitraryFloatGTINTEL = 5850, + OpArbitraryFloatGEALTERA = 5851, OpArbitraryFloatGEINTEL = 5851, + OpArbitraryFloatLTALTERA = 5852, OpArbitraryFloatLTINTEL = 5852, + OpArbitraryFloatLEALTERA = 5853, OpArbitraryFloatLEINTEL = 5853, + OpArbitraryFloatEQALTERA = 5854, OpArbitraryFloatEQINTEL = 5854, + OpArbitraryFloatRecipALTERA = 5855, OpArbitraryFloatRecipINTEL = 5855, + OpArbitraryFloatRSqrtALTERA = 5856, OpArbitraryFloatRSqrtINTEL = 5856, + OpArbitraryFloatCbrtALTERA = 5857, OpArbitraryFloatCbrtINTEL = 5857, + OpArbitraryFloatHypotALTERA = 5858, OpArbitraryFloatHypotINTEL = 5858, + OpArbitraryFloatSqrtALTERA = 5859, OpArbitraryFloatSqrtINTEL = 5859, OpArbitraryFloatLogINTEL = 5860, OpArbitraryFloatLog2INTEL = 5861, @@ -2423,21 +2594,37 @@ namespace Spv OpAliasDomainDeclINTEL = 5911, OpAliasScopeDeclINTEL = 5912, OpAliasScopeListDeclINTEL = 5913, + OpFixedSqrtALTERA = 5923, OpFixedSqrtINTEL = 5923, + OpFixedRecipALTERA = 5924, OpFixedRecipINTEL = 5924, + OpFixedRsqrtALTERA = 5925, OpFixedRsqrtINTEL = 5925, + OpFixedSinALTERA = 5926, OpFixedSinINTEL = 5926, + OpFixedCosALTERA = 5927, OpFixedCosINTEL = 5927, + OpFixedSinCosALTERA = 5928, OpFixedSinCosINTEL = 5928, + OpFixedSinPiALTERA = 5929, OpFixedSinPiINTEL = 5929, + OpFixedCosPiALTERA = 5930, OpFixedCosPiINTEL = 5930, + OpFixedSinCosPiALTERA = 5931, OpFixedSinCosPiINTEL = 5931, + OpFixedLogALTERA = 5932, OpFixedLogINTEL = 5932, + OpFixedExpALTERA = 5933, OpFixedExpINTEL = 5933, + OpPtrCastToCrossWorkgroupALTERA = 5934, OpPtrCastToCrossWorkgroupINTEL = 5934, + OpCrossWorkgroupCastToPtrALTERA = 5938, OpCrossWorkgroupCastToPtrINTEL = 5938, + OpReadPipeBlockingALTERA = 5946, OpReadPipeBlockingINTEL = 5946, + OpWritePipeBlockingALTERA = 5947, OpWritePipeBlockingINTEL = 5947, + OpFPGARegALTERA = 5949, OpFPGARegINTEL = 5949, OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayFlagsKHR = 6017, @@ -2467,10 +2654,15 @@ namespace Spv OpControlBarrierArriveINTEL = 6142, OpControlBarrierWaitINTEL = 6143, OpArithmeticFenceEXT = 6145, + OpTaskSequenceCreateALTERA = 6163, OpTaskSequenceCreateINTEL = 6163, + OpTaskSequenceAsyncALTERA = 6164, OpTaskSequenceAsyncINTEL = 6164, + OpTaskSequenceGetALTERA = 6165, OpTaskSequenceGetINTEL = 6165, + OpTaskSequenceReleaseALTERA = 6166, OpTaskSequenceReleaseINTEL = 6166, + OpTypeTaskSequenceALTERA = 6199, OpTypeTaskSequenceINTEL = 6199, OpSubgroupBlockPrefetchINTEL = 6221, OpSubgroup2DBlockLoadINTEL = 6231, @@ -2480,6 +2672,7 @@ namespace Spv OpSubgroup2DBlockStoreINTEL = 6235, OpSubgroupMatrixMultiplyAccumulateINTEL = 6237, OpBitwiseFunctionINTEL = 6242, + OpUntypedVariableLengthArrayINTEL = 6244, OpConditionalExtensionINTEL = 6248, OpConditionalEntryPointINTEL = 6249, OpConditionalCapabilityINTEL = 6250, diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.core.grammar.json b/third_party/spirv-headers/include/spirv/unified1/spirv.core.grammar.json index f9b01b468a..21451e2889 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.core.grammar.json +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.core.grammar.json @@ -1359,6 +1359,7 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "Value" } ], + "capabilities" : [ "Shader" ], "version": "1.0" }, { @@ -3918,7 +3919,7 @@ { "kind" : "IdResult" }, { "kind" : "IdScope", "name" : "Execution" }, { "kind" : "IdRef", "name" : "Value" }, - { "kind" : "IdRef", "name" : "Id" } + { "kind" : "IdRef", "name" : "Invocation Id" } ], "capabilities" : [ "GroupNonUniformBallot" ], "version" : "1.3" @@ -4025,7 +4026,7 @@ { "kind" : "IdResult" }, { "kind" : "IdScope", "name" : "Execution" }, { "kind" : "IdRef", "name" : "Value" }, - { "kind" : "IdRef", "name" : "Id" } + { "kind" : "IdRef", "name" : "Invocation Id" } ], "capabilities" : [ "GroupNonUniformShuffle" ], "version" : "1.3" @@ -4084,7 +4085,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4099,7 +4100,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4114,7 +4115,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4129,7 +4130,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4144,7 +4145,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4159,7 +4160,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4174,7 +4175,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4189,7 +4190,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4204,7 +4205,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4219,7 +4220,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4234,7 +4235,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4249,7 +4250,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4264,7 +4265,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4279,7 +4280,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4294,7 +4295,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4309,7 +4310,7 @@ { "kind" : "IdRef", "name" : "Value" }, { "kind" : "IdRef", "name" : "ClusterSize", "quantifier" : "?" } ], - "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedNV" ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered", "GroupNonUniformPartitionedEXT" ], "version" : "1.3" }, { @@ -4574,7 +4575,6 @@ "capabilities" : [ "UntypedPointersKHR" ], - "provisional" : true, "version" : "None", "operands" : [ { "kind" : "IdResult" }, @@ -4586,7 +4586,6 @@ "class" : "Memory", "opcode" : 4418, "capabilities" : [ "UntypedPointersKHR" ], - "provisional" : true, "version" : "None", "operands" : [ { "kind" : "IdResultType" }, @@ -4601,7 +4600,6 @@ "class" : "Memory", "opcode" : 4419, "capabilities" : [ "UntypedPointersKHR" ], - "provisional" : true, "version" : "None", "operands" : [ { "kind" : "IdResultType" }, @@ -4616,7 +4614,6 @@ "class" : "Memory", "opcode" : 4420, "capabilities" : [ "UntypedPointersKHR" ], - "provisional" : true, "version" : "None", "operands" : [ { "kind" : "IdResultType" }, @@ -4657,7 +4654,6 @@ "class" : "Memory", "opcode" : 4423, "capabilities" : [ "UntypedPointersKHR" ], - "provisional" : true, "version" : "None", "operands" : [ { "kind" : "IdResultType" }, @@ -4673,7 +4669,6 @@ "class" : "Memory", "opcode" : 4424, "capabilities" : [ "UntypedPointersKHR" ], - "provisional" : true, "version" : "None", "operands" : [ { "kind" : "IdResultType" }, @@ -4689,7 +4684,6 @@ "class" : "Memory", "opcode" : 4425, "capabilities" : [ "UntypedPointersKHR" ], - "provisional" : true, "version" : "None", "operands" : [ { "kind" : "IdResultType" }, @@ -4704,7 +4698,6 @@ "class" : "Memory", "opcode" : 4426, "capabilities" : [ "UntypedPointersKHR" ], - "provisional" : true, "version" : "None", "operands" : [ { "kind" : "IdRef", "name" : "Pointer Type" }, @@ -4714,6 +4707,20 @@ { "kind" : "IdRef", "quantifier" : "?", "name" : "Cache Type" } ] }, + { + "opname" : "OpFmaKHR", + "class" : "Arithmetic", + "opcode" : 4427, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "Operand 1" }, + { "kind" : "IdRef", "name" : "Operand 2" }, + { "kind" : "IdRef", "name" : "Operand 3" } + ], + "capabilities" : [ "FMAKHR" ], + "version" : "None" + }, { "opname" : "OpSubgroupAllKHR", "class" : "Group", @@ -4802,6 +4809,26 @@ "extensions" : [ "SPV_KHR_relaxed_extended_instruction" ], "version": "None" }, + { + "opname" : "OpUntypedGroupAsyncCopyKHR", + "class" : "Group", + "opcode" : 4434, + "capabilities" : [ "UntypedPointersKHR" ], + "version" : "None", + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "Execution" }, + { "kind" : "IdRef", "name" : "Destination" }, + { "kind" : "IdRef", "name" : "Source" }, + { "kind" : "IdRef", "name" : "Element Num Bytes" }, + { "kind" : "IdRef", "name" : "Num Elements" }, + { "kind" : "IdRef", "name" : "Stride" }, + { "kind" : "IdRef", "name" : "Event" }, + { "kind" : "MemoryAccess", "quantifier" : "?", "name" : "Destination Memory Operands" }, + { "kind" : "MemoryAccess", "quantifier" : "?", "name" : "Source Memory Operands" } + ] + }, { "opname" : "OpTraceRayKHR", "class" : "Reserved", @@ -5668,6 +5695,68 @@ "capabilities" : [ "QuadControlKHR" ], "version" : "None" }, + { + "opname" : "OpTypeBufferEXT", + "class" : "Type-Declaration", + "opcode" : 5115, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "StorageClass" } + ], + "capabilities": [ "DescriptorHeapEXT" ], + "version" : "None" + }, + { + "opname" : "OpBufferPointerEXT", + "class" : "Memory", + "opcode" : 5119, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "Buffer" } + ], + "capabilities": [ "DescriptorHeapEXT" ], + "version" : "None" + }, + { + "opname" : "OpUntypedImageTexelPointerEXT", + "class" : "Memory", + "opcode" : 5126, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "ImageType" }, + { "kind" : "IdRef", "name" : "Image" }, + { "kind" : "IdRef", "name" : "Coordinate" }, + { "kind" : "IdRef", "name" : "Sample" } + ], + "capabilities": [ "DescriptorHeapEXT" ], + "version": "None" + }, + { + "opname" : "OpMemberDecorateIdEXT", + "class" : "Annotation", + "opcode" : 5127, + "operands" : [ + { "kind" : "IdRef", "name" : "Structure Type" }, + { "kind" : "LiteralInteger", "name" : "Member" }, + { "kind" : "Decoration" } + ], + "capabilities": [ "DescriptorHeapEXT" ], + "version" : "None" + }, + { + "opname" : "OpConstantSizeOfEXT", + "class" : "Constant-Creation", + "opcode" : 5129, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "Type" } + ], + "capabilities": [ "DescriptorHeapEXT" ], + "version" : "None" + }, { "opname" : "OpHitObjectRecordHitMotionNV", "class" : "Reserved", @@ -6141,15 +6230,16 @@ "version" : "None" }, { - "opname" : "OpTypeCooperativeVectorNV", + "opname" : "OpTypeVectorIdEXT", "class" : "Type-Declaration", "opcode" : 5288, + "aliases" : ["OpTypeCooperativeVectorNV"], "operands" : [ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "Component Type" }, { "kind" : "IdRef", "name" : "Component Count" } ], - "capabilities" : [ "CooperativeVectorNV" ], + "capabilities" : [ "CooperativeVectorNV", "LongVectorEXT" ], "version" : "None" }, { @@ -6264,16 +6354,16 @@ "version" : "None" }, { - "opname" : "OpGroupNonUniformPartitionNV", + "opname" : "OpGroupNonUniformPartitionEXT", "class" : "Non-Uniform", + "aliases" : ["OpGroupNonUniformPartitionNV"], "opcode" : 5296, "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "Value" } ], - "capabilities" : [ "GroupNonUniformPartitionedNV" ], - "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "capabilities" : [ "GroupNonUniformPartitionedEXT" ], "version" : "None" }, { @@ -6347,6 +6437,411 @@ "capabilities" : [ "CooperativeVectorNV" ], "version" : "None" }, + { + "opname" : "OpHitObjectRecordFromQueryEXT", + "class" : "Reserved", + "opcode" : 5304, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Ray Query" }, + { "kind" : "IdRef", "name" : "SBT Record Index" }, + { "kind" : "IdRef", "name" : "Hit Object Attributes" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordMissEXT", + "class" : "Reserved", + "opcode" : 5305, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Ray Flags" }, + { "kind" : "IdRef", "name" : "Miss Index" }, + { "kind" : "IdRef", "name" : "Ray Origin" }, + { "kind" : "IdRef", "name" : "Ray Tmin" }, + { "kind" : "IdRef", "name" : "Ray Direction" }, + { "kind" : "IdRef", "name" : "Ray Tmax" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordMissMotionEXT", + "class" : "Reserved", + "opcode" : 5306, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Ray Flags" }, + { "kind" : "IdRef", "name" : "Miss Index" }, + { "kind" : "IdRef", "name" : "Ray Origin" }, + { "kind" : "IdRef", "name" : "Ray Tmin" }, + { "kind" : "IdRef", "name" : "Ray Direction" }, + { "kind" : "IdRef", "name" : "Ray Tmax" }, + { "kind" : "IdRef", "name" : "Current Time" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT", "RayTracingMotionBlurNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetIntersectionTriangleVertexPositionsEXT", + "class" : "Reserved", + "opcode" : 5307, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetRayFlagsEXT", + "class" : "Reserved", + "opcode" : 5308, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectSetShaderBindingTableRecordIndexEXT", + "class" : "Reserved", + "opcode" : 5309, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "SBT Record Index" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectReorderExecuteShaderEXT", + "class" : "Reserved", + "opcode" : 5310, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Payload" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "Hint" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "Bits" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectTraceReorderExecuteEXT", + "class" : "Reserved", + "opcode" : 5311, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Acceleration Structure"}, + { "kind" : "IdRef", "name" : "Ray Flags"}, + { "kind" : "IdRef", "name" : "Cull Mask"}, + { "kind" : "IdRef", "name" : "SBT Offset"}, + { "kind" : "IdRef", "name" : "SBT Stride"}, + { "kind" : "IdRef", "name" : "Miss Index"}, + { "kind" : "IdRef", "name" : "Ray Origin"}, + { "kind" : "IdRef", "name" : "Ray Tmin"}, + { "kind" : "IdRef", "name" : "Ray Direction"}, + { "kind" : "IdRef", "name" : "Ray Tmax"}, + { "kind" : "IdRef", "name" : "Payload"}, + { "kind" : "IdRef", "quantifier" : "?", "name" : "Hint" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "Bits" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectTraceMotionReorderExecuteEXT", + "class" : "Reserved", + "opcode" : 5312, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Acceleration Structure"}, + { "kind" : "IdRef", "name" : "Ray Flags"}, + { "kind" : "IdRef", "name" : "Cull Mask"}, + { "kind" : "IdRef", "name" : "SBT Offset"}, + { "kind" : "IdRef", "name" : "SBT Stride"}, + { "kind" : "IdRef", "name" : "Miss Index"}, + { "kind" : "IdRef", "name" : "Ray Origin"}, + { "kind" : "IdRef", "name" : "Ray Tmin"}, + { "kind" : "IdRef", "name" : "Ray Direction"}, + { "kind" : "IdRef", "name" : "Ray Tmax"}, + { "kind" : "IdRef", "name" : "Current Time"}, + { "kind" : "IdRef", "name" : "Payload"}, + { "kind" : "IdRef", "quantifier" : "?", "name" : "Hint" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "Bits" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT", "RayTracingMotionBlurNV" ], + "version" : "None" + }, + { + "opname" : "OpTypeHitObjectEXT", + "class" : "Type-Declaration", + "opcode" : 5313, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpReorderThreadWithHintEXT", + "class" : "Reserved", + "opcode" : 5314, + "operands" : [ + { "kind" : "IdRef", "name" : "Hint" }, + { "kind" : "IdRef", "name" : "Bits" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpReorderThreadWithHitObjectEXT", + "class" : "Reserved", + "opcode" : 5315, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "Hint" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "Bits" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectTraceRayEXT", + "class" : "Reserved", + "opcode" : 5316, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Acceleration Structure"}, + { "kind" : "IdRef", "name" : "Ray Flags"}, + { "kind" : "IdRef", "name" : "Cull Mask"}, + { "kind" : "IdRef", "name" : "SBT Offset"}, + { "kind" : "IdRef", "name" : "SBT Stride"}, + { "kind" : "IdRef", "name" : "Miss Index"}, + { "kind" : "IdRef", "name" : "Ray Origin"}, + { "kind" : "IdRef", "name" : "Ray Tmin"}, + { "kind" : "IdRef", "name" : "Ray Direction"}, + { "kind" : "IdRef", "name" : "Ray Tmax"}, + { "kind" : "IdRef", "name" : "Payload"} + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectTraceRayMotionEXT", + "class" : "Reserved", + "opcode" : 5317, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Acceleration Structure"}, + { "kind" : "IdRef", "name" : "Ray Flags"}, + { "kind" : "IdRef", "name" : "Cull Mask"}, + { "kind" : "IdRef", "name" : "SBT Offset"}, + { "kind" : "IdRef", "name" : "SBT Stride"}, + { "kind" : "IdRef", "name" : "Miss Index"}, + { "kind" : "IdRef", "name" : "Ray Origin"}, + { "kind" : "IdRef", "name" : "Ray Tmin"}, + { "kind" : "IdRef", "name" : "Ray Direction"}, + { "kind" : "IdRef", "name" : "Ray Tmax"}, + { "kind" : "IdRef", "name" : "Current Time"}, + { "kind" : "IdRef", "name" : "Payload"} + ], + "capabilities" : [ "ShaderInvocationReorderEXT", "RayTracingMotionBlurNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordEmptyEXT", + "class" : "Reserved", + "opcode" : 5318, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectExecuteShaderEXT", + "class" : "Reserved", + "opcode" : 5319, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Payload" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetCurrentTimeEXT", + "class" : "Reserved", + "opcode" : 5320, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" , "RayTracingMotionBlurNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetAttributesEXT", + "class" : "Reserved", + "opcode" : 5321, + "operands" : [ + { "kind" : "IdRef", "name" : "Hit Object" }, + { "kind" : "IdRef", "name" : "Hit Object Attribute" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetHitKindEXT", + "class" : "Reserved", + "opcode" : 5322, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetPrimitiveIndexEXT", + "class" : "Reserved", + "opcode" : 5323, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetGeometryIndexEXT", + "class" : "Reserved", + "opcode" : 5324, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetInstanceIdEXT", + "class" : "Reserved", + "opcode" : 5325, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetInstanceCustomIndexEXT", + "class" : "Reserved", + "opcode" : 5326, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetObjectRayOriginEXT", + "class" : "Reserved", + "opcode" : 5327, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetObjectRayDirectionEXT", + "class" : "Reserved", + "opcode" : 5328, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetWorldRayDirectionEXT", + "class" : "Reserved", + "opcode" : 5329, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetWorldRayOriginEXT", + "class" : "Reserved", + "opcode" : 5330, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetObjectToWorldEXT", + "class" : "Reserved", + "opcode" : 5331, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetWorldToObjectEXT", + "class" : "Reserved", + "opcode" : 5332, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetRayTMaxEXT", + "class" : "Reserved", + "opcode" : 5333, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, { "opname" : "OpReportIntersectionKHR", "class" : "Reserved", @@ -6491,8 +6986,9 @@ "version" : "None" }, { - "opname" : "OpRayQueryGetClusterIdNV", + "opname" : "OpRayQueryGetIntersectionClusterIdNV", "class" : "Reserved", + "aliases" : ["OpRayQueryGetClusterIdNV"], "opcode" : 5345, "operands" : [ { "kind" : "IdResultType" }, @@ -6521,6 +7017,78 @@ "capabilities" : [ "RayTracingClusterAccelerationStructureNV" ], "version" : "None" }, + { + "opname" : "OpHitObjectGetRayTMinEXT", + "class" : "Reserved", + "opcode" : 5347, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetShaderBindingTableRecordIndexEXT", + "class" : "Reserved", + "opcode" : 5348, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetShaderRecordBufferHandleEXT", + "class" : "Reserved", + "opcode" : 5349, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectIsEmptyEXT", + "class" : "Reserved", + "opcode" : 5350, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectIsHitEXT", + "class" : "Reserved", + "opcode" : 5351, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectIsMissEXT", + "class" : "Reserved", + "opcode" : 5352, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "Hit Object" } + ], + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, { "opname" : "OpTypeCooperativeMatrixNV", "class" : "Type-Declaration", @@ -8225,7 +8793,7 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "Fwd Ref Offset" }, { "kind" : "IdRef", "name" : "Bwd Ref Offset" }, - { "kind" : "IdRef", "name" : "id> Search Window Config" }, + { "kind" : "IdRef", "name" : "Search Window Config" }, { "kind" : "IdRef", "name" : "Payload" } ], "capabilities" : [ "SubgroupAvcMotionEstimationINTEL" ], @@ -9142,19 +9710,19 @@ }, { "opname" : "OpVariableLengthArrayINTEL", - "class" : "@exclude", + "class" : "Memory", "opcode" : 5818, "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, - { "kind" : "IdRef", "name" : "Lenght" } + { "kind" : "IdRef", "name" : "Length" } ], "capabilities" : [ "VariableLengthArrayINTEL" ], "version" : "None" }, { "opname" : "OpSaveMemoryINTEL", - "class" : "@exclude", + "class" : "Memory", "opcode" : 5819, "operands" : [ { "kind" : "IdResultType" }, @@ -9165,7 +9733,7 @@ }, { "opname" : "OpRestoreMemoryINTEL", - "class" : "@exclude", + "class" : "Memory", "opcode" : 5820, "operands" : [ { "kind" : "IdRef", "name" : "Ptr" } @@ -9174,8 +9742,9 @@ "version" : "None" }, { - "opname" : "OpArbitraryFloatSinCosPiINTEL", + "opname" : "OpArbitraryFloatSinCosPiALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatSinCosPiINTEL" ], "opcode" : 5840, "operands" : [ { "kind" : "IdResultType" }, @@ -9187,12 +9756,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "RoundingAccuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatCastINTEL", + "opname" : "OpArbitraryFloatCastALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatCastINTEL" ], "opcode" : 5841, "operands" : [ { "kind" : "IdResultType" }, @@ -9204,12 +9774,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatCastFromIntINTEL", + "opname" : "OpArbitraryFloatCastFromIntALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatCastFromIntINTEL" ], "opcode" : 5842, "operands" : [ { "kind" : "IdResultType" }, @@ -9221,12 +9792,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatCastToIntINTEL", + "opname" : "OpArbitraryFloatCastToIntALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatCastToIntINTEL" ], "opcode" : 5843, "operands" : [ { "kind" : "IdResultType" }, @@ -9238,12 +9810,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatAddINTEL", + "opname" : "OpArbitraryFloatAddALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatAddINTEL" ], "opcode" : 5846, "operands" : [ { "kind" : "IdResultType" }, @@ -9257,12 +9830,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatSubINTEL", + "opname" : "OpArbitraryFloatSubALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatSubINTEL" ], "opcode" : 5847, "operands" : [ { "kind" : "IdResultType" }, @@ -9276,12 +9850,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatMulINTEL", + "opname" : "OpArbitraryFloatMulALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatMulINTEL" ], "opcode" : 5848, "operands" : [ { "kind" : "IdResultType" }, @@ -9295,12 +9870,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatDivINTEL", + "opname" : "OpArbitraryFloatDivALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatDivINTEL" ], "opcode" : 5849, "operands" : [ { "kind" : "IdResultType" }, @@ -9314,12 +9890,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatGTINTEL", + "opname" : "OpArbitraryFloatGTALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatGTINTEL" ], "opcode" : 5850, "operands" : [ { "kind" : "IdResultType" }, @@ -9329,12 +9906,13 @@ { "kind" : "IdRef", "name" : "B" }, { "kind" : "LiteralInteger", "name" : "Mb" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatGEINTEL", + "opname" : "OpArbitraryFloatGEALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatGEINTEL" ], "opcode" : 5851, "operands" : [ { "kind" : "IdResultType" }, @@ -9344,12 +9922,13 @@ { "kind" : "IdRef", "name" : "B" }, { "kind" : "LiteralInteger", "name" : "Mb" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatLTINTEL", + "opname" : "OpArbitraryFloatLTALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatLTINTEL" ], "opcode" : 5852, "operands" : [ { "kind" : "IdResultType" }, @@ -9359,12 +9938,13 @@ { "kind" : "IdRef", "name" : "B" }, { "kind" : "LiteralInteger", "name" : "Mb" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatLEINTEL", + "opname" : "OpArbitraryFloatLEALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatLEINTEL" ], "opcode" : 5853, "operands" : [ { "kind" : "IdResultType" }, @@ -9374,12 +9954,13 @@ { "kind" : "IdRef", "name" : "B" }, { "kind" : "LiteralInteger", "name" : "Mb" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatEQINTEL", + "opname" : "OpArbitraryFloatEQALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatEQINTEL" ], "opcode" : 5854, "operands" : [ { "kind" : "IdResultType" }, @@ -9389,12 +9970,13 @@ { "kind" : "IdRef", "name" : "B" }, { "kind" : "LiteralInteger", "name" : "Mb" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatRecipINTEL", + "opname" : "OpArbitraryFloatRecipALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatRecipINTEL" ], "opcode" : 5855, "operands" : [ { "kind" : "IdResultType" }, @@ -9406,12 +9988,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatRSqrtINTEL", + "opname" : "OpArbitraryFloatRSqrtALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatRSqrtINTEL" ], "opcode" : 5856, "operands" : [ { "kind" : "IdResultType" }, @@ -9423,12 +10006,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatCbrtINTEL", + "opname" : "OpArbitraryFloatCbrtALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatCbrtINTEL" ], "opcode" : 5857, "operands" : [ { "kind" : "IdResultType" }, @@ -9440,12 +10024,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatHypotINTEL", + "opname" : "OpArbitraryFloatHypotALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatHypotINTEL" ], "opcode" : 5858, "operands" : [ { "kind" : "IdResultType" }, @@ -9459,12 +10044,13 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { - "opname" : "OpArbitraryFloatSqrtINTEL", + "opname" : "OpArbitraryFloatSqrtALTERA", "class" : "@exclude", + "aliases" : [ "OpArbitraryFloatSqrtINTEL" ], "opcode" : 5859, "operands" : [ { "kind" : "IdResultType" }, @@ -9476,7 +10062,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9493,7 +10079,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9510,7 +10096,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9527,7 +10113,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9544,7 +10130,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9561,7 +10147,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9578,7 +10164,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9595,7 +10181,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9612,7 +10198,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9629,7 +10215,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9646,7 +10232,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9663,7 +10249,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9680,7 +10266,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9697,7 +10283,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9714,7 +10300,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9731,7 +10317,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9748,7 +10334,7 @@ { "kind" : "LiteralInteger", "name" : "RoundingMode" }, { "kind" : "LiteralInteger", "name" : "RoundingAccuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9765,7 +10351,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9782,7 +10368,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9799,7 +10385,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9818,7 +10404,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9837,7 +10423,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9856,7 +10442,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9875,7 +10461,7 @@ { "kind" : "LiteralInteger", "name" : "Rounding" }, { "kind" : "LiteralInteger", "name" : "Accuracy" } ], - "capabilities" : [ "ArbitraryPrecisionFloatingPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFloatingPointALTERA" ], "version" : "None" }, { @@ -9927,8 +10513,9 @@ "version" : "None" }, { - "opname" : "OpFixedSqrtINTEL", + "opname" : "OpFixedSqrtALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedSqrtINTEL" ], "opcode" : 5923, "operands" : [ { "kind" : "IdResultType" }, @@ -9940,12 +10527,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedRecipINTEL", + "opname" : "OpFixedRecipALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedRecipINTEL" ], "opcode" : 5924, "operands" : [ { "kind" : "IdResultType" }, @@ -9957,12 +10545,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedRsqrtINTEL", + "opname" : "OpFixedRsqrtALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedRsqrtINTEL" ], "opcode" : 5925, "operands" : [ { "kind" : "IdResultType" }, @@ -9974,12 +10563,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedSinINTEL", + "opname" : "OpFixedSinALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedSinINTEL" ], "opcode" : 5926, "operands" : [ { "kind" : "IdResultType" }, @@ -9991,12 +10581,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedCosINTEL", + "opname" : "OpFixedCosALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedCosINTEL" ], "opcode" : 5927, "operands" : [ { "kind" : "IdResultType" }, @@ -10008,12 +10599,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedSinCosINTEL", + "opname" : "OpFixedSinCosALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedSinCosINTEL" ], "opcode" : 5928, "operands" : [ { "kind" : "IdResultType" }, @@ -10025,12 +10617,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedSinPiINTEL", + "opname" : "OpFixedSinPiALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedSinPiINTEL" ], "opcode" : 5929, "operands" : [ { "kind" : "IdResultType" }, @@ -10042,12 +10635,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedCosPiINTEL", + "opname" : "OpFixedCosPiALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedCosPiINTEL" ], "opcode" : 5930, "operands" : [ { "kind" : "IdResultType" }, @@ -10059,12 +10653,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedSinCosPiINTEL", + "opname" : "OpFixedSinCosPiALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedSinCosPiINTEL" ], "opcode" : 5931, "operands" : [ { "kind" : "IdResultType" }, @@ -10076,12 +10671,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedLogINTEL", + "opname" : "OpFixedLogALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedLogINTEL" ], "opcode" : 5932, "operands" : [ { "kind" : "IdResultType" }, @@ -10093,12 +10689,13 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpFixedExpINTEL", + "opname" : "OpFixedExpALTERA", "class" : "@exclude", + "aliases" : [ "OpFixedExpINTEL" ], "opcode" : 5933, "operands" : [ { "kind" : "IdResultType" }, @@ -10110,36 +10707,39 @@ { "kind" : "LiteralInteger", "name" : "Q" }, { "kind" : "LiteralInteger", "name" : "O" } ], - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL" ], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA" ], "version" : "None" }, { - "opname" : "OpPtrCastToCrossWorkgroupINTEL", + "opname" : "OpPtrCastToCrossWorkgroupALTERA", "class" : "@exclude", + "aliases" : [ "OpPtrCastToCrossWorkgroupINTEL" ], "opcode" : 5934, "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "Pointer" } ], - "capabilities" : [ "USMStorageClassesINTEL" ], + "capabilities" : [ "USMStorageClassesALTERA" ], "version" : "None" }, { - "opname" : "OpCrossWorkgroupCastToPtrINTEL", + "opname" : "OpCrossWorkgroupCastToPtrALTERA", "class" : "@exclude", + "aliases" : [ "OpCrossWorkgroupCastToPtrINTEL" ], "opcode" : 5938, "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "Pointer" } ], - "capabilities" : [ "USMStorageClassesINTEL" ], + "capabilities" : [ "USMStorageClassesALTERA" ], "version" : "None" }, { - "opname" : "OpReadPipeBlockingINTEL", - "class" : "Pipe", + "opname" : "OpReadPipeBlockingALTERA", + "class" : "@exclude", + "aliases" : [ "OpReadPipeBlockingINTEL" ], "opcode" : 5946, "operands" : [ { "kind" : "IdResultType" }, @@ -10147,13 +10747,13 @@ { "kind" : "IdRef", "name" : "Packet Size" }, { "kind" : "IdRef", "name" : "Packet Alignment" } ], - "capabilities" : [ "BlockingPipesINTEL" ], - "extensions" : [ "SPV_INTEL_blocking_pipes" ], + "capabilities" : [ "BlockingPipesALTERA" ], "version" : "None" }, { - "opname" : "OpWritePipeBlockingINTEL", - "class" : "Pipe", + "opname" : "OpWritePipeBlockingALTERA", + "class" : "@exclude", + "aliases" : [ "OpWritePipeBlockingINTEL" ], "opcode" : 5947, "operands" : [ { "kind" : "IdResultType" }, @@ -10161,21 +10761,20 @@ { "kind" : "IdRef", "name" : "Packet Size" }, { "kind" : "IdRef", "name" : "Packet Alignment" } ], - "capabilities" : [ "BlockingPipesINTEL" ], - "extensions" : [ "SPV_INTEL_blocking_pipes" ], + "capabilities" : [ "BlockingPipesALTERA" ], "version" : "None" }, { - "opname" : "OpFPGARegINTEL", - "class" : "Reserved", + "opname" : "OpFPGARegALTERA", + "class" : "@exclude", + "aliases" : [ "OpFPGARegINTEL" ], "opcode" : 5949, "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "Input" } ], - "capabilities" : [ "FPGARegINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_reg" ], + "capabilities" : [ "FPGARegALTERA" ], "version" : "None" }, { @@ -10631,8 +11230,9 @@ "version" : "None" }, { - "opname" : "OpTaskSequenceCreateINTEL", - "class" : "Reserved", + "opname" : "OpTaskSequenceCreateALTERA", + "class" : "@exclude", + "aliases" : [ "OpTaskSequenceCreateINTEL" ], "opcode" : 6163, "operands" : [ { "kind" : "IdResultType" }, @@ -10643,50 +11243,54 @@ { "kind" : "LiteralInteger", "name" : "GetCapacity" }, { "kind" : "LiteralInteger", "name" : "AsyncCapacity" } ], - "capabilities" : [ "TaskSequenceINTEL" ], + "capabilities" : [ "TaskSequenceALTERA" ], "version" : "None" }, { - "opname" : "OpTaskSequenceAsyncINTEL", - "class" : "Reserved", + "opname" : "OpTaskSequenceAsyncALTERA", + "class" : "@exclude", + "aliases" : [ "OpTaskSequenceAsyncINTEL" ], "opcode" : 6164, "operands" : [ { "kind" : "IdRef", "name" : "Sequence" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "Arguments" } ], - "capabilities" : [ "TaskSequenceINTEL" ], + "capabilities" : [ "TaskSequenceALTERA" ], "version" : "None" }, { - "opname" : "OpTaskSequenceGetINTEL", - "class" : "Reserved", + "opname" : "OpTaskSequenceGetALTERA", + "class" : "@exclude", + "aliases" : [ "OpTaskSequenceGetINTEL" ], "opcode" : 6165, "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "Sequence" } ], - "capabilities" : [ "TaskSequenceINTEL" ], + "capabilities" : [ "TaskSequenceALTERA" ], "version" : "None" }, { - "opname" : "OpTaskSequenceReleaseINTEL", - "class" : "Reserved", + "opname" : "OpTaskSequenceReleaseALTERA", + "class" : "@exclude", + "aliases" : [ "OpTaskSequenceReleaseINTEL" ], "opcode" : 6166, "operands" : [ { "kind" : "IdRef", "name" : "Sequence" } ], - "capabilities" : [ "TaskSequenceINTEL" ], + "capabilities" : [ "TaskSequenceALTERA" ], "version" : "None" }, { - "opname" : "OpTypeTaskSequenceINTEL", - "class" : "Type-Declaration", + "opname" : "OpTypeTaskSequenceALTERA", + "class" : "@exclude", + "aliases" : [ "OpTypeTaskSequenceINTEL" ], "opcode" : 6199, "operands" : [ { "kind" : "IdResult" } ], - "capabilities" : [ "TaskSequenceINTEL" ], + "capabilities" : [ "TaskSequenceALTERA" ], "version": "None" }, { @@ -10826,6 +11430,19 @@ "capabilities" : [ "TernaryBitwiseFunctionINTEL" ], "version" : "None" }, + { + "opname" : "OpUntypedVariableLengthArrayINTEL", + "class" : "Memory", + "opcode" : 6244, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "Element Type" }, + { "kind" : "IdRef", "name" : "Length" } + ], + "capabilities" : [ "UntypedVariableLengthArrayINTEL" ], + "version" : "None" + }, { "opname" : "OpConditionalExtensionINTEL", "class" : "Extension", @@ -11404,90 +12021,100 @@ "version" : "1.4" }, { - "enumerant" : "InitiationIntervalINTEL", + "enumerant" : "InitiationIntervalALTERA", + "aliases" : [ "InitiationIntervalINTEL" ], "value" : "0x10000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "MaxConcurrencyINTEL", + "enumerant" : "MaxConcurrencyALTERA", + "aliases" : [ "MaxConcurrencyINTEL" ], "value" : "0x20000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "DependencyArrayINTEL", + "enumerant" : "DependencyArrayALTERA", + "aliases" : [ "DependencyArrayINTEL" ], "value" : "0x40000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "PipelineEnableINTEL", + "enumerant" : "PipelineEnableALTERA", + "aliases" : [ "PipelineEnableINTEL" ], "value" : "0x80000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "LoopCoalesceINTEL", + "enumerant" : "LoopCoalesceALTERA", + "aliases" : [ "LoopCoalesceINTEL" ], "value" : "0x100000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "MaxInterleavingINTEL", + "enumerant" : "MaxInterleavingALTERA", + "aliases" : [ "MaxInterleavingINTEL" ], "value" : "0x200000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "SpeculatedIterationsINTEL", + "enumerant" : "SpeculatedIterationsALTERA", + "aliases" : [ "SpeculatedIterationsINTEL" ], "value" : "0x400000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "NoFusionINTEL", + "enumerant" : "NoFusionALTERA", + "aliases" : [ "NoFusionINTEL" ], "value" : "0x800000", - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "LoopCountINTEL", + "enumerant" : "LoopCountALTERA", + "aliases" : [ "LoopCountINTEL" ], "value" : "0x1000000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" }, { - "enumerant" : "MaxReinvocationDelayINTEL", + "enumerant" : "MaxReinvocationDelayALTERA", + "aliases" : [ "MaxReinvocationDelayINTEL" ], "value" : "0x2000000", "parameters" : [ { "kind" : "LiteralInteger" } ], - "capabilities" : [ "FPGALoopControlsINTEL" ], + "capabilities" : [ "FPGALoopControlsALTERA" ], "version" : "None" } ] @@ -12635,7 +13262,7 @@ "enumerant" : "DerivativeGroupQuadsKHR", "aliases" : ["DerivativeGroupQuadsNV"], "value" : 5289, - "capabilities" : [ "ComputeDerivativeGroupQuadsNV", "ComputeDerivativeGroupQuadsKHR" ], + "capabilities" : [ "ComputeDerivativeGroupQuadsKHR" ], "extensions" : [ "SPV_NV_compute_shader_derivatives", "SPV_KHR_compute_shader_derivatives" ], "version" : "None" }, @@ -12643,7 +13270,7 @@ "enumerant" : "DerivativeGroupLinearKHR", "aliases" : ["DerivativeGroupLinearNV"], "value" : 5290, - "capabilities" : [ "ComputeDerivativeGroupLinearNV", "ComputeDerivativeGroupLinearKHR" ], + "capabilities" : [ "ComputeDerivativeGroupLinearKHR" ], "extensions" : [ "SPV_NV_compute_shader_derivatives", "SPV_KHR_compute_shader_derivatives" ], "version" : "None" }, @@ -12697,6 +13324,12 @@ "extensions" : [ "SPV_EXT_fragment_shader_interlock" ], "version" : "None" }, + { + "enumerant" : "Shader64BitIndexingEXT", + "value" : 5427, + "capabilities" : [ "Shader64BitIndexingEXT" ], + "version" : "None" + }, { "enumerant" : "SharedLocalMemorySizeINTEL", "value" : 5618, @@ -13031,6 +13664,12 @@ "capabilities" : [ "MeshShadingEXT" ], "version" : "1.4" }, + { + "enumerant" : "HitObjectAttributeEXT", + "value" : 5411, + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, { "enumerant" : "CodeSectionINTEL", "value" : 5605, @@ -13039,21 +13678,17 @@ "version" : "None" }, { - "enumerant" : "DeviceOnlyINTEL", + "enumerant" : "DeviceOnlyALTERA", + "aliases" : [ "DeviceOnlyINTEL" ], "value" : 5936, - "extensions" : [ - "SPV_INTEL_usm_storage_classes" - ], - "capabilities" : [ "USMStorageClassesINTEL" ], + "capabilities" : [ "USMStorageClassesALTERA" ], "version" : "None" }, { - "enumerant" : "HostOnlyINTEL", + "enumerant" : "HostOnlyALTERA", + "aliases" : [ "HostOnlyINTEL" ], "value" : 5937, - "extensions" : [ - "SPV_INTEL_usm_storage_classes" - ], - "capabilities" : [ "USMStorageClassesINTEL" ], + "capabilities" : [ "USMStorageClassesALTERA" ], "version" : "None" } ] @@ -13707,49 +14342,49 @@ { "enumerant" : "TRN", "value" : 0, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "TRN_ZERO", "value" : 1, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "RND", "value" : 2, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "RND_ZERO", "value" : 3, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "RND_INF", "value" : 4, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "RND_MIN_INF", "value" : 5, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "RND_CONV", "value" : 6, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "RND_CONV_ODD", "value" : 7, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" } ] @@ -13779,25 +14414,25 @@ { "enumerant" : "WRAP", "value" : 0, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "SAT", "value" : 1, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "SAT_ZERO", "value" : 2, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" }, { "enumerant" : "SAT_SYM", "value" : 3, - "capabilities" : [ "ArbitraryPrecisionFixedPointINTEL"], + "capabilities" : [ "ArbitraryPrecisionFixedPointALTERA"], "version" : "None" } ] @@ -13934,9 +14569,10 @@ "version": "1.0" }, { - "enumerant" : "RuntimeAlignedINTEL", + "enumerant" : "RuntimeAlignedALTERA", + "aliases" : [ "RuntimeAlignedINTEL" ], "value" : 5940, - "capabilities" : [ "RuntimeAlignedAttributeINTEL" ], + "capabilities" : [ "RuntimeAlignedAttributeALTERA" ], "version": "1.0" } ] @@ -14403,6 +15039,24 @@ "provisional" : true, "version" : "None" }, + { + "enumerant" : "ArrayStrideIdEXT", + "value" : 5124, + "capabilities": [ "DescriptorHeapEXT" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "Array Stride" } + ], + "version" : "None" + }, + { + "enumerant" : "OffsetIdEXT", + "value" : 5125, + "capabilities": [ "DescriptorHeapEXT" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "Byte Offset" } + ], + "version" : "None" + }, { "enumerant" : "OverrideCoverageNV", "value" : 5248, @@ -14487,12 +15141,36 @@ "extensions" : [ "SPV_EXT_physical_storage_buffer", "SPV_KHR_physical_storage_buffer" ], "version" : "1.5" }, + { + "enumerant": "MemberOffsetNV", + "value": 5358, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "memberOffset" } + ], + "capabilities": [ "PushConstantBanksNV" ], + "version": "None" + }, { "enumerant" : "HitObjectShaderRecordBufferNV", "value" : 5386, "capabilities" : [ "ShaderInvocationReorderNV" ], "version" : "None" }, + { + "enumerant" : "HitObjectShaderRecordBufferEXT", + "value" : 5389, + "capabilities" : [ "ShaderInvocationReorderEXT" ], + "version" : "None" + }, + { + "enumerant" : "BankNV", + "value" : 5397, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "Bank" } + ], + "capabilities" : [ "PushConstantBanksNV" ], + "version" : "None" + }, { "enumerant" : "BindlessSamplerNV", "value" : 5398, @@ -14634,188 +15312,198 @@ "version" : "None" }, { - "enumerant" : "RegisterINTEL", + "enumerant" : "RegisterALTERA", + "aliases" : [ "RegisterINTEL" ], "value" : 5825, - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "MemoryINTEL", + "enumerant" : "MemoryALTERA", + "aliases" : [ "MemoryINTEL" ], "value" : 5826, "parameters" : [ { "kind" : "LiteralString", "name" : "Memory Type" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "NumbanksINTEL", + "enumerant" : "NumbanksALTERA", + "aliases" : [ "NumbanksINTEL" ], "value" : 5827, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Banks" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "BankwidthINTEL", + "enumerant" : "BankwidthALTERA", + "aliases" : [ "BankwidthINTEL" ], "value" : 5828, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Bank Width" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "MaxPrivateCopiesINTEL", + "enumerant" : "MaxPrivateCopiesALTERA", + "aliases" : [ "MaxPrivateCopiesINTEL" ], "value" : 5829, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Maximum Copies" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "SinglepumpINTEL", + "enumerant" : "SinglepumpALTERA", + "aliases" : [ "SinglepumpINTEL" ], "value" : 5830, - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "DoublepumpINTEL", + "enumerant" : "DoublepumpALTERA", + "aliases" : [ "DoublepumpINTEL" ], "value" : 5831, - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "MaxReplicatesINTEL", + "enumerant" : "MaxReplicatesALTERA", + "aliases" : [ "MaxReplicatesINTEL" ], "value" : 5832, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Maximum Replicates" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "SimpleDualPortINTEL", + "enumerant" : "SimpleDualPortALTERA", + "aliases" : [ "SimpleDualPortINTEL" ], "value" : 5833, - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "MergeINTEL", + "enumerant" : "MergeALTERA", + "aliases" : [ "MergeINTEL" ], "value" : 5834, "parameters" : [ { "kind" : "LiteralString", "name" : "Merge Key" }, { "kind" : "LiteralString", "name" : "Merge Type" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "BankBitsINTEL", + "enumerant" : "BankBitsALTERA", + "aliases" : [ "BankBitsINTEL" ], "value" : 5835, "parameters" : [ { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "Bank Bits" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "ForcePow2DepthINTEL", + "enumerant" : "ForcePow2DepthALTERA", + "aliases" : [ "ForcePow2DepthINTEL" ], "value" : 5836, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Force Key" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "StridesizeINTEL", + "enumerant" : "StridesizeALTERA", + "aliases" : [ "StridesizeINTEL" ], "value" : 5883, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Stride Size" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "WordsizeINTEL", + "enumerant" : "WordsizeALTERA", + "aliases" : [ "WordsizeINTEL" ], "value" : 5884, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Word Size" } ], - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "TrueDualPortINTEL", + "enumerant" : "TrueDualPortALTERA", + "aliases" : [ "TrueDualPortINTEL" ], "value" : 5885, - "capabilities" : [ "FPGAMemoryAttributesINTEL" ], + "capabilities" : [ "FPGAMemoryAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "BurstCoalesceINTEL", + "enumerant" : "BurstCoalesceALTERA", + "aliases" : [ "BurstCoalesceINTEL" ], "value" : 5899, - "capabilities" : [ "FPGAMemoryAccessesINTEL" ], + "capabilities" : [ "FPGAMemoryAccessesALTERA" ], "version" : "None" }, { - "enumerant" : "CacheSizeINTEL", + "enumerant" : "CacheSizeALTERA", + "aliases" : [ "CacheSizeINTEL" ], "value" : 5900, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Cache Size in bytes" } ], - "capabilities" : [ "FPGAMemoryAccessesINTEL" ], + "capabilities" : [ "FPGAMemoryAccessesALTERA" ], "version" : "None" }, { - "enumerant" : "DontStaticallyCoalesceINTEL", + "enumerant" : "DontStaticallyCoalesceALTERA", + "aliases" : [ "DontStaticallyCoalesceINTEL" ], "value" : 5901, - "capabilities" : [ "FPGAMemoryAccessesINTEL" ], + "capabilities" : [ "FPGAMemoryAccessesALTERA" ], "version" : "None" }, { - "enumerant" : "PrefetchINTEL", + "enumerant" : "PrefetchALTERA", + "aliases" : [ "PrefetchINTEL" ], "value" : 5902, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Prefetcher Size in bytes" } ], - "capabilities" : [ "FPGAMemoryAccessesINTEL" ], + "capabilities" : [ "FPGAMemoryAccessesALTERA" ], "version" : "None" }, { - "enumerant" : "StallEnableINTEL", + "enumerant" : "StallEnableALTERA", + "aliases" : [ "StallEnableINTEL" ], "value" : 5905, - "capabilities" : [ "FPGAClusterAttributesINTEL" ], + "capabilities" : [ "FPGAClusterAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "FuseLoopsInFunctionINTEL", + "enumerant" : "FuseLoopsInFunctionALTERA", + "aliases" : [ "FuseLoopsInFunctionINTEL" ], "value" : 5907, - "capabilities" : [ "LoopFuseINTEL" ], + "capabilities" : [ "LoopFuseALTERA" ], "version" : "None" }, { - "enumerant" : "MathOpDSPModeINTEL", + "enumerant" : "MathOpDSPModeALTERA", + "aliases" : [ "MathOpDSPModeINTEL" ], "value" : 5909, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Mode" }, { "kind" : "LiteralInteger", "name" : "Propagate" } ], - "capabilities" : [ "FPGADSPControlINTEL" ], + "capabilities" : [ "FPGADSPControlALTERA" ], "version" : "None" }, { @@ -14837,48 +15525,53 @@ "version" : "None" }, { - "enumerant" : "InitiationIntervalINTEL", + "enumerant" : "InitiationIntervalALTERA", + "aliases" : [ "InitiationIntervalINTEL" ], "value" : 5917, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Cycles" } ], - "capabilities" : [ "FPGAInvocationPipeliningAttributesINTEL" ], + "capabilities" : [ "FPGAInvocationPipeliningAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "MaxConcurrencyINTEL", + "enumerant" : "MaxConcurrencyALTERA", + "aliases" : [ "MaxConcurrencyINTEL" ], "value" : 5918, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Invocations" } ], - "capabilities" : [ "FPGAInvocationPipeliningAttributesINTEL" ], + "capabilities" : [ "FPGAInvocationPipeliningAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "PipelineEnableINTEL", + "enumerant" : "PipelineEnableALTERA", + "aliases" : [ "PipelineEnableINTEL" ], "value" : 5919, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Enable" } ], - "capabilities" : [ "FPGAInvocationPipeliningAttributesINTEL" ], + "capabilities" : [ "FPGAInvocationPipeliningAttributesALTERA" ], "version" : "None" }, { - "enumerant" : "BufferLocationINTEL", + "enumerant" : "BufferLocationALTERA", + "aliases" : [ "BufferLocationINTEL" ], "value" : 5921, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Buffer Location ID" } ], - "capabilities" : [ "FPGABufferLocationINTEL" ], + "capabilities" : [ "FPGABufferLocationALTERA" ], "version" : "None" }, { - "enumerant" : "IOPipeStorageINTEL", + "enumerant" : "IOPipeStorageALTERA", + "aliases" : [ "IOPipeStorageINTEL" ], "value" : 5944, "parameters" : [ { "kind" : "LiteralInteger", "name" : "IO Pipe ID" } ], - "capabilities" : [ "IOPipesINTEL" ], + "capabilities" : [ "IOPipesALTERA" ], "version" : "None" }, { @@ -14910,9 +15603,10 @@ "version" : "None" }, { - "enumerant" : "StallFreeINTEL", + "enumerant" : "StallFreeALTERA", + "aliases" : [ "StallFreeINTEL" ], "value" : 6151, - "capabilities" : [ "FPGAClusterAttributesV2INTEL" ], + "capabilities" : [ "FPGAClusterAttributesV2ALTERA" ], "version" : "None" }, { @@ -14925,95 +15619,106 @@ "version" : "None" }, { - "enumerant" : "LatencyControlLabelINTEL", + "enumerant" : "LatencyControlLabelALTERA", + "aliases" : [ "LatencyControlLabelINTEL" ], "value" : 6172, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Latency Label" } ], - "capabilities" : [ "FPGALatencyControlINTEL" ], + "capabilities" : [ "FPGALatencyControlALTERA" ], "version" : "None" }, { - "enumerant" : "LatencyControlConstraintINTEL", + "enumerant" : "LatencyControlConstraintALTERA", + "aliases" : [ "LatencyControlConstraintINTEL" ], "value" : 6173, "parameters" : [ { "kind" : "LiteralInteger", "name" : "Relative To" }, { "kind" : "LiteralInteger", "name" : "Control Type" }, { "kind" : "LiteralInteger", "name" : "Relative Cycle" } ], - "capabilities" : [ "FPGALatencyControlINTEL" ], + "capabilities" : [ "FPGALatencyControlALTERA" ], "version" : "None" }, { - "enumerant" : "ConduitKernelArgumentINTEL", + "enumerant" : "ConduitKernelArgumentALTERA", + "aliases" : [ "ConduitKernelArgumentINTEL" ], "value" : 6175, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "version" : "None" }, { - "enumerant" : "RegisterMapKernelArgumentINTEL", + "enumerant" : "RegisterMapKernelArgumentALTERA", + "aliases" : [ "RegisterMapKernelArgumentINTEL" ], "value" : 6176, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "version" : "None" }, { - "enumerant" : "MMHostInterfaceAddressWidthINTEL", + "enumerant" : "MMHostInterfaceAddressWidthALTERA", + "aliases" : [ "MMHostInterfaceAddressWidthINTEL" ], "value" : 6177, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "AddressWidth" } ], "version" : "None" }, { - "enumerant" : "MMHostInterfaceDataWidthINTEL", + "enumerant" : "MMHostInterfaceDataWidthALTERA", + "aliases" : [ "MMHostInterfaceDataWidthINTEL" ], "value" : 6178, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "DataWidth" } ], "version" : "None" }, { - "enumerant" : "MMHostInterfaceLatencyINTEL", + "enumerant" : "MMHostInterfaceLatencyALTERA", + "aliases" : [ "MMHostInterfaceLatencyINTEL" ], "value" : 6179, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "Latency" } ], "version" : "None" }, { - "enumerant" : "MMHostInterfaceReadWriteModeINTEL", + "enumerant" : "MMHostInterfaceReadWriteModeALTERA", + "aliases" : [ "MMHostInterfaceReadWriteModeINTEL" ], "value" : 6180, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "parameters" : [ { "kind" : "AccessQualifier", "name" : "ReadWriteMode" } ], "version" : "None" }, { - "enumerant" : "MMHostInterfaceMaxBurstINTEL", + "enumerant" : "MMHostInterfaceMaxBurstALTERA", + "aliases" : [ "MMHostInterfaceMaxBurstINTEL" ], "value" : 6181, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "MaxBurstCount" } ], "version" : "None" }, { - "enumerant" : "MMHostInterfaceWaitRequestINTEL", + "enumerant" : "MMHostInterfaceWaitRequestALTERA", + "aliases" : [ "MMHostInterfaceWaitRequestINTEL" ], "value" : 6182, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "Waitrequest" } ], "version" : "None" }, { - "enumerant" : "StableKernelArgumentINTEL", + "enumerant" : "StableKernelArgumentALTERA", + "aliases" : [ "StableKernelArgumentINTEL" ], "value" : 6183, - "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "capabilities" : [ "FPGAArgumentInterfacesALTERA" ], "version" : "None" }, { @@ -15027,21 +15732,23 @@ "version" : "None" }, { - "enumerant" : "InitModeINTEL", + "enumerant" : "InitModeALTERA", + "aliases" : [ "InitModeINTEL" ], "value" : 6190, "parameters": [ { "kind" : "InitializationModeQualifier", "name" : "Trigger" } ], - "capabilities" : [ "GlobalVariableFPGADecorationsINTEL" ], + "capabilities" : [ "GlobalVariableFPGADecorationsALTERA" ], "version" : "None" }, { - "enumerant" : "ImplementInRegisterMapINTEL", + "enumerant" : "ImplementInRegisterMapALTERA", + "aliases" : [ "ImplementInRegisterMapINTEL" ], "value" : 6191, "parameters": [ { "kind" : "LiteralInteger", "name" : "Value" } ], - "capabilities" : [ "GlobalVariableFPGADecorationsINTEL" ], + "capabilities" : [ "GlobalVariableFPGADecorationsALTERA" ], "version" : "None" }, { @@ -15520,6 +16227,18 @@ "provisional" : true, "version" : "None" }, + { + "enumerant" : "SamplerHeapEXT", + "value" : 5122, + "capabilities" : [ "DescriptorHeapEXT" ], + "version" : "None" + }, + { + "enumerant" : "ResourceHeapEXT", + "value" : 5123, + "capabilities" : [ "DescriptorHeapEXT" ], + "version" : "None" + }, { "enumerant" : "ViewportMaskNV", "value" : 5253, @@ -15992,24 +16711,24 @@ "version" : "1.3" }, { - "enumerant" : "PartitionedReduceNV", + "enumerant" : "PartitionedReduceEXT", + "aliases" : ["PartitionedReduceNV"], "value" : 6, - "capabilities" : [ "GroupNonUniformPartitionedNV" ], - "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "capabilities" : [ "GroupNonUniformPartitionedEXT" ], "version" : "None" }, { - "enumerant" : "PartitionedInclusiveScanNV", + "enumerant" : "PartitionedInclusiveScanEXT", + "aliases" : ["PartitionedInclusiveScanNV"], "value" : 7, - "capabilities" : [ "GroupNonUniformPartitionedNV" ], - "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "capabilities" : [ "GroupNonUniformPartitionedEXT" ], "version" : "None" }, { - "enumerant" : "PartitionedExclusiveScanNV", + "enumerant" : "PartitionedExclusiveScanEXT", + "aliases" : ["PartitionedExclusiveScanNV"], "value" : 8, - "capabilities" : [ "GroupNonUniformPartitionedNV" ], - "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "capabilities" : [ "GroupNonUniformPartitionedEXT" ], "version" : "None" } ] @@ -16695,7 +17414,6 @@ "enumerant" : "UntypedPointersKHR", "value" : 4473, "extensions" : [ "SPV_KHR_untyped_pointers" ], - "provisional" : true, "version" : "None" }, { @@ -16845,6 +17563,13 @@ "extensions" : [ "SPV_KHR_bfloat16" ], "version" : "None" }, + { + "enumerant" : "DescriptorHeapEXT", + "value": 5128, + "capabilities" : [ "UntypedPointersKHR" ], + "extensions" : [ "SPV_EXT_descriptor_heap" ], + "version" : "None" + }, { "enumerant" : "SampleMaskOverrideCoverageNV", "value" : 5249, @@ -16939,9 +17664,10 @@ "version" : "None" }, { - "enumerant" : "GroupNonUniformPartitionedNV", + "enumerant" : "GroupNonUniformPartitionedEXT", + "aliases" : ["GroupNonUniformPartitionedNV"], "value" : 5297, - "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "extensions" : [ "SPV_NV_shader_subgroup_partitioned", "SPV_EXT_shader_subgroup_partitioned" ], "version" : "None" }, { @@ -17162,6 +17888,13 @@ "extensions" : [ "SPV_NV_shader_invocation_reorder" ], "version" : "None" }, + { + "enumerant" : "ShaderInvocationReorderEXT", + "value" : 5388, + "capabilities" : [ "RayTracingKHR" ], + "extensions" : [ "SPV_EXT_shader_invocation_reorder" ], + "version" : "None" + }, { "enumerant" : "BindlessTextureNV", "value" : 5390, @@ -17212,6 +17945,25 @@ "extensions" : [ "SPV_NV_linear_swept_spheres" ], "version" : "None" }, + { + "enumerant" : "PushConstantBanksNV", + "value" : 5423, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_NV_push_constant_bank" ], + "version" : "None" + }, + { + "enumerant" : "LongVectorEXT", + "value" : 5425, + "extensions" : [ "SPV_EXT_long_vector" ], + "version" : "None" + }, + { + "enumerant" : "Shader64BitIndexingEXT", + "value" : 5426, + "extensions" : [ "SPV_EXT_shader_64bit_indexing" ], + "version" : "None" + }, { "enumerant" : "CooperativeMatrixReductionsNV", "value" : 5430, @@ -17389,9 +18141,10 @@ "version" : "None" }, { - "enumerant" : "FPGAMemoryAttributesINTEL", + "enumerant" : "FPGAMemoryAttributesALTERA", + "aliases" : [ "FPGAMemoryAttributesINTEL" ], "value" : 5824, - "extensions" : [ "SPV_INTEL_fpga_memory_attributes" ], + "extensions" : [ "SPV_ALTERA_fpga_memory_attributes", "SPV_INTEL_fpga_memory_attributes" ], "version" : "None" }, { @@ -17402,15 +18155,17 @@ "version" : "None" }, { - "enumerant" : "ArbitraryPrecisionIntegersINTEL", + "enumerant" : "ArbitraryPrecisionIntegersALTERA", + "aliases" : [ "ArbitraryPrecisionIntegersINTEL" ], "value" : 5844, - "extensions" : [ "SPV_INTEL_arbitrary_precision_integers" ], + "extensions" : [ "SPV_ALTERA_arbitrary_precision_integers", "SPV_INTEL_arbitrary_precision_integers" ], "version" : "None" }, { - "enumerant" : "ArbitraryPrecisionFloatingPointINTEL", + "enumerant" : "ArbitraryPrecisionFloatingPointALTERA", + "aliases" : [ "ArbitraryPrecisionFloatingPointINTEL" ], "value" : 5845, - "extensions" : [ "SPV_INTEL_arbitrary_precision_floating_point" ], + "extensions" : [ "SPV_ALTERA_arbitrary_precision_floating_point", "SPV_INTEL_arbitrary_precision_floating_point" ], "version" : "None" }, { @@ -17420,9 +18175,10 @@ "version" : "None" }, { - "enumerant" : "FPGALoopControlsINTEL", + "enumerant" : "FPGALoopControlsALTERA", + "aliases" : [ "FPGALoopControlsINTEL" ], "value" : 5888, - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], + "extensions" : [ "SPV_ALTERA_fpga_loop_controls", "SPV_INTEL_fpga_loop_controls" ], "version" : "None" }, { @@ -17438,27 +18194,31 @@ "version" : "None" }, { - "enumerant" : "FPGAMemoryAccessesINTEL", + "enumerant" : "FPGAMemoryAccessesALTERA", + "aliases" : [ "FPGAMemoryAccessesINTEL" ], "value" : 5898, - "extensions" : [ "SPV_INTEL_fpga_memory_accesses" ], + "extensions" : [ "SPV_ALTERA_fpga_memory_accesses", "SPV_INTEL_fpga_memory_accesses" ], "version" : "None" }, { - "enumerant" : "FPGAClusterAttributesINTEL", + "enumerant" : "FPGAClusterAttributesALTERA", + "aliases" : [ "FPGAClusterAttributesINTEL" ], "value" : 5904, - "extensions" : [ "SPV_INTEL_fpga_cluster_attributes" ], + "extensions" : [ "SPV_ALTERA_fpga_cluster_attributes", "SPV_INTEL_fpga_cluster_attributes" ], "version" : "None" }, { - "enumerant" : "LoopFuseINTEL", + "enumerant" : "LoopFuseALTERA", + "aliases" : [ "LoopFuseINTEL" ], "value" : 5906, - "extensions" : [ "SPV_INTEL_loop_fuse" ], + "extensions" : [ "SPV_ALTERA_loop_fuse", "SPV_INTEL_loop_fuse" ], "version" : "None" }, { - "enumerant" : "FPGADSPControlINTEL", + "enumerant" : "FPGADSPControlALTERA", + "aliases" : [ "FPGADSPControlINTEL" ], "value" : 5908, - "extensions" : [ "SPV_INTEL_fpga_dsp_control" ], + "extensions" : [ "SPV_ALTERA_fpga_dsp_control", "SPV_INTEL_fpga_dsp_control" ], "version" : "None" }, { @@ -17468,51 +18228,59 @@ "version" : "None" }, { - "enumerant" : "FPGAInvocationPipeliningAttributesINTEL", + "enumerant" : "FPGAInvocationPipeliningAttributesALTERA", + "aliases" : [ "FPGAInvocationPipeliningAttributesINTEL" ], "value" : 5916, - "extensions" : [ "SPV_INTEL_fpga_invocation_pipelining_attributes" ], + "extensions" : [ "SPV_ALTERA_fpga_invocation_pipelining_attributes", "SPV_INTEL_fpga_invocation_pipelining_attributes" ], "version" : "None" }, { - "enumerant" : "FPGABufferLocationINTEL", + "enumerant" : "FPGABufferLocationALTERA", + "aliases" : [ "FPGABufferLocationINTEL" ], "value" : 5920, - "extensions" : [ "SPV_INTEL_fpga_buffer_location" ], + "extensions" : [ "SPV_ALTERA_fpga_buffer_location", "SPV_INTEL_fpga_buffer_location" ], "version" : "None" }, { - "enumerant" : "ArbitraryPrecisionFixedPointINTEL", + "enumerant" : "ArbitraryPrecisionFixedPointALTERA", + "aliases" : [ "ArbitraryPrecisionFixedPointINTEL" ], "value" : 5922, - "extensions" : [ "SPV_INTEL_arbitrary_precision_fixed_point" ], + "extensions" : [ "SPV_ALTERA_arbitrary_precision_fixed_point", "SPV_INTEL_arbitrary_precision_fixed_point" ], "version" : "None" }, { - "enumerant" : "USMStorageClassesINTEL", + "enumerant" : "USMStorageClassesALTERA", + "aliases" : [ "USMStorageClassesINTEL" ], "value" : 5935, - "extensions" : [ "SPV_INTEL_usm_storage_classes" ], + "extensions" : [ "SPV_ALTERA_usm_storage_classes", "SPV_INTEL_usm_storage_classes" ], "version" : "None" }, { - "enumerant" : "RuntimeAlignedAttributeINTEL", + "enumerant" : "RuntimeAlignedAttributeALTERA", + "aliases" : [ "RuntimeAlignedAttributeINTEL" ], "value" : 5939, - "extensions" : [ "SPV_INTEL_runtime_aligned" ], + "extensions" : [ "SPV_ALTERA_runtime_aligned", "SPV_INTEL_runtime_aligned" ], "version" : "None" }, { - "enumerant" : "IOPipesINTEL", + "enumerant" : "IOPipesALTERA", + "aliases" : [ "IOPipesINTEL" ], "value" : 5943, - "extensions" : [ "SPV_INTEL_io_pipes" ], + "extensions" : [ "SPV_ALTERA_io_pipes", "SPV_INTEL_io_pipes" ], "version" : "None" }, { - "enumerant" : "BlockingPipesINTEL", + "enumerant" : "BlockingPipesALTERA", + "aliases" : [ "BlockingPipesINTEL" ], "value" : 5945, - "extensions" : [ "SPV_INTEL_blocking_pipes" ], + "extensions" : [ "SPV_ALTERA_blocking_pipes", "SPV_INTEL_blocking_pipes" ], "version" : "None" }, { - "enumerant" : "FPGARegINTEL", + "enumerant" : "FPGARegALTERA", + "aliases" : [ "FPGARegINTEL" ], "value" : 5948, - "extensions" : [ "SPV_INTEL_fpga_reg" ], + "extensions" : [ "SPV_ALTERA_fpga_reg", "SPV_INTEL_fpga_reg" ], "version" : "None" }, { @@ -17581,6 +18349,12 @@ "extensions" : [ "SPV_KHR_float_controls2" ], "version" : "None" }, + { + "enumerant" : "FMAKHR", + "value" : 6030, + "extensions" : [ "SPV_KHR_fma" ], + "version" : "None" + }, { "enumerant" : "AtomicFloat32AddEXT", "value" : 6033, @@ -17637,10 +18411,11 @@ "version" : "None" }, { - "enumerant" : "FPGAClusterAttributesV2INTEL", + "enumerant" : "FPGAClusterAttributesV2ALTERA", + "aliases" : [ "FPGAClusterAttributesV2INTEL" ], "value" : 6150, - "capabilities" : [ "FPGAClusterAttributesINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_cluster_attributes" ], + "capabilities" : [ "FPGAClusterAttributesALTERA" ], + "extensions" : [ "SPV_ALTERA_fpga_cluster_attributes", "SPV_INTEL_fpga_cluster_attributes" ], "version" : "None" }, { @@ -17651,9 +18426,10 @@ "version" : "None" }, { - "enumerant" : "TaskSequenceINTEL", + "enumerant" : "TaskSequenceALTERA", + "aliases" : [ "TaskSequenceINTEL" ], "value" : 6162, - "extensions" : [ "SPV_INTEL_task_sequence" ], + "extensions" : [ "SPV_ALTERA_task_sequence", "SPV_INTEL_task_sequence" ], "version" : "None" }, { @@ -17663,15 +18439,17 @@ "version" : "None" }, { - "enumerant" : "FPGALatencyControlINTEL", + "enumerant" : "FPGALatencyControlALTERA", + "aliases" : [ "FPGALatencyControlINTEL" ], "value" : 6171, - "extensions" : [ "SPV_INTEL_fpga_latency_control" ], + "extensions" : [ "SPV_ALTERA_fpga_latency_control", "SPV_INTEL_fpga_latency_control" ], "version" : "None" }, { - "enumerant" : "FPGAArgumentInterfacesINTEL", + "enumerant" : "FPGAArgumentInterfacesALTERA", + "aliases" : [ "FPGAArgumentInterfacesINTEL" ], "value" : 6174, - "extensions" : [ "SPV_INTEL_fpga_argument_interfaces" ], + "extensions" : [ "SPV_ALTERA_fpga_argument_interfaces", "SPV_INTEL_fpga_argument_interfaces" ], "version" : "None" }, { @@ -17681,9 +18459,10 @@ "version" : "None" }, { - "enumerant" : "GlobalVariableFPGADecorationsINTEL", + "enumerant" : "GlobalVariableFPGADecorationsALTERA", + "aliases" : [ "GlobalVariableFPGADecorationsINTEL" ], "value" : 6189, - "extensions": [ "SPV_INTEL_global_variable_fpga_decorations" ], + "extensions" : [ "SPV_ALTERA_global_variable_fpga_decorations", "SPV_INTEL_global_variable_fpga_decorations" ], "version" : "None" }, { @@ -17724,6 +18503,13 @@ "extensions" : [ "SPV_INTEL_ternary_bitwise_function"], "version" : "None" }, + { + "enumerant" : "UntypedVariableLengthArrayINTEL", + "value" : 6243, + "capabilities" : [ "VariableLengthArrayINTEL", "UntypedPointersKHR" ], + "extensions" : [ "SPV_INTEL_variable_length_array" ], + "version" : "None" + }, { "enumerant" : "SpecConditionalINTEL", "value" : 6245, @@ -17904,11 +18690,13 @@ { "enumerant" : "RowBlockedInterleavedARM", "value" : 4202, + "capabilities" : [ "CooperativeMatrixLayoutsARM" ], "version" : "None" }, { "enumerant" : "ColumnBlockedInterleavedARM", "value" : 4203, + "capabilities" : [ "CooperativeMatrixLayoutsARM" ], "version" : "None" } ] @@ -18020,15 +18808,17 @@ "kind" : "InitializationModeQualifier", "enumerants" : [ { - "enumerant" : "InitOnDeviceReprogramINTEL", + "enumerant" : "InitOnDeviceReprogramALTERA", + "aliases" : [ "InitOnDeviceReprogramINTEL" ], "value" : 0, - "capabilities" : [ "GlobalVariableFPGADecorationsINTEL" ], + "capabilities" : [ "GlobalVariableFPGADecorationsALTERA" ], "version" : "None" }, { - "enumerant" : "InitOnDeviceResetINTEL", + "enumerant" : "InitOnDeviceResetALTERA", + "aliases" : [ "InitOnDeviceResetINTEL" ], "value" : 1, - "capabilities" : [ "GlobalVariableFPGADecorationsINTEL" ], + "capabilities" : [ "GlobalVariableFPGADecorationsALTERA" ], "version" : "None" } ] diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.cs b/third_party/spirv-headers/include/spirv/unified1/spirv.cs index 607663378a..c4a0fcd515 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.cs +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.cs @@ -191,6 +191,7 @@ namespace Spv SampleInterlockUnorderedEXT = 5369, ShadingRateInterlockOrderedEXT = 5370, ShadingRateInterlockUnorderedEXT = 5371, + Shader64BitIndexingEXT = 5427, SharedLocalMemorySizeINTEL = 5618, RoundingModeRTPINTEL = 5620, RoundingModeRTNINTEL = 5621, @@ -246,8 +247,11 @@ namespace Spv PhysicalStorageBufferEXT = 5349, HitObjectAttributeNV = 5385, TaskPayloadWorkgroupEXT = 5402, + HitObjectAttributeEXT = 5411, CodeSectionINTEL = 5605, + DeviceOnlyALTERA = 5936, DeviceOnlyINTEL = 5936, + HostOnlyALTERA = 5937, HostOnlyINTEL = 5937, Max = 0x7fffffff, } @@ -500,6 +504,7 @@ namespace Spv NoCapture = 5, NoWrite = 6, NoReadWrite = 7, + RuntimeAlignedALTERA = 5940, RuntimeAlignedINTEL = 5940, Max = 0x7fffffff, } @@ -568,6 +573,8 @@ namespace Spv PayloadNodeSparseArrayAMDX = 5099, PayloadNodeArraySizeAMDX = 5100, PayloadDispatchIndirectAMDX = 5105, + ArrayStrideIdEXT = 5124, + OffsetIdEXT = 5125, OverrideCoverageNV = 5248, PassthroughNV = 5250, ViewportRelativeNV = 5252, @@ -584,7 +591,10 @@ namespace Spv RestrictPointerEXT = 5355, AliasedPointer = 5356, AliasedPointerEXT = 5356, + MemberOffsetNV = 5358, HitObjectShaderRecordBufferNV = 5386, + HitObjectShaderRecordBufferEXT = 5389, + BankNV = 5397, BindlessSamplerNV = 5398, BindlessImageNV = 5399, BoundSamplerNV = 5400, @@ -605,54 +615,95 @@ namespace Spv UserTypeGOOGLE = 5636, FunctionRoundingModeINTEL = 5822, FunctionDenormModeINTEL = 5823, + RegisterALTERA = 5825, RegisterINTEL = 5825, + MemoryALTERA = 5826, MemoryINTEL = 5826, + NumbanksALTERA = 5827, NumbanksINTEL = 5827, + BankwidthALTERA = 5828, BankwidthINTEL = 5828, + MaxPrivateCopiesALTERA = 5829, MaxPrivateCopiesINTEL = 5829, + SinglepumpALTERA = 5830, SinglepumpINTEL = 5830, + DoublepumpALTERA = 5831, DoublepumpINTEL = 5831, + MaxReplicatesALTERA = 5832, MaxReplicatesINTEL = 5832, + SimpleDualPortALTERA = 5833, SimpleDualPortINTEL = 5833, + MergeALTERA = 5834, MergeINTEL = 5834, + BankBitsALTERA = 5835, BankBitsINTEL = 5835, + ForcePow2DepthALTERA = 5836, ForcePow2DepthINTEL = 5836, + StridesizeALTERA = 5883, StridesizeINTEL = 5883, + WordsizeALTERA = 5884, WordsizeINTEL = 5884, + TrueDualPortALTERA = 5885, TrueDualPortINTEL = 5885, + BurstCoalesceALTERA = 5899, BurstCoalesceINTEL = 5899, + CacheSizeALTERA = 5900, CacheSizeINTEL = 5900, + DontStaticallyCoalesceALTERA = 5901, DontStaticallyCoalesceINTEL = 5901, + PrefetchALTERA = 5902, PrefetchINTEL = 5902, + StallEnableALTERA = 5905, StallEnableINTEL = 5905, + FuseLoopsInFunctionALTERA = 5907, FuseLoopsInFunctionINTEL = 5907, + MathOpDSPModeALTERA = 5909, MathOpDSPModeINTEL = 5909, AliasScopeINTEL = 5914, NoAliasINTEL = 5915, + InitiationIntervalALTERA = 5917, InitiationIntervalINTEL = 5917, + MaxConcurrencyALTERA = 5918, MaxConcurrencyINTEL = 5918, + PipelineEnableALTERA = 5919, PipelineEnableINTEL = 5919, + BufferLocationALTERA = 5921, BufferLocationINTEL = 5921, + IOPipeStorageALTERA = 5944, IOPipeStorageINTEL = 5944, FunctionFloatingPointModeINTEL = 6080, SingleElementVectorINTEL = 6085, VectorComputeCallableFunctionINTEL = 6087, MediaBlockIOINTEL = 6140, + StallFreeALTERA = 6151, StallFreeINTEL = 6151, FPMaxErrorDecorationINTEL = 6170, + LatencyControlLabelALTERA = 6172, LatencyControlLabelINTEL = 6172, + LatencyControlConstraintALTERA = 6173, LatencyControlConstraintINTEL = 6173, + ConduitKernelArgumentALTERA = 6175, ConduitKernelArgumentINTEL = 6175, + RegisterMapKernelArgumentALTERA = 6176, RegisterMapKernelArgumentINTEL = 6176, + MMHostInterfaceAddressWidthALTERA = 6177, MMHostInterfaceAddressWidthINTEL = 6177, + MMHostInterfaceDataWidthALTERA = 6178, MMHostInterfaceDataWidthINTEL = 6178, + MMHostInterfaceLatencyALTERA = 6179, MMHostInterfaceLatencyINTEL = 6179, + MMHostInterfaceReadWriteModeALTERA = 6180, MMHostInterfaceReadWriteModeINTEL = 6180, + MMHostInterfaceMaxBurstALTERA = 6181, MMHostInterfaceMaxBurstINTEL = 6181, + MMHostInterfaceWaitRequestALTERA = 6182, MMHostInterfaceWaitRequestINTEL = 6182, + StableKernelArgumentALTERA = 6183, StableKernelArgumentINTEL = 6183, HostAccessINTEL = 6188, + InitModeALTERA = 6190, InitModeINTEL = 6190, + ImplementInRegisterMapALTERA = 6191, ImplementInRegisterMapINTEL = 6191, ConditionalINTEL = 6247, CacheControlLoadINTEL = 6442, @@ -738,6 +789,8 @@ namespace Spv FragStencilRefEXT = 5014, RemainingRecursionLevelsAMDX = 5021, ShaderIndexAMDX = 5073, + SamplerHeapEXT = 5122, + ResourceHeapEXT = 5123, ViewportMaskNV = 5253, SecondaryPositionNV = 5257, SecondaryViewportMaskNV = 5258, @@ -838,15 +891,25 @@ namespace Spv IterationMultiple = 6, PeelCount = 7, PartialCount = 8, + InitiationIntervalALTERA = 16, InitiationIntervalINTEL = 16, + MaxConcurrencyALTERA = 17, MaxConcurrencyINTEL = 17, + DependencyArrayALTERA = 18, DependencyArrayINTEL = 18, + PipelineEnableALTERA = 19, PipelineEnableINTEL = 19, + LoopCoalesceALTERA = 20, LoopCoalesceINTEL = 20, + MaxInterleavingALTERA = 21, MaxInterleavingINTEL = 21, + SpeculatedIterationsALTERA = 22, SpeculatedIterationsINTEL = 22, + NoFusionALTERA = 23, NoFusionINTEL = 23, + LoopCountALTERA = 24, LoopCountINTEL = 24, + MaxReinvocationDelayALTERA = 25, MaxReinvocationDelayINTEL = 25, Max = 0x7fffffff, } @@ -863,15 +926,25 @@ namespace Spv IterationMultiple = 0x00000040, PeelCount = 0x00000080, PartialCount = 0x00000100, + InitiationIntervalALTERA = 0x00010000, InitiationIntervalINTEL = 0x00010000, + MaxConcurrencyALTERA = 0x00020000, MaxConcurrencyINTEL = 0x00020000, + DependencyArrayALTERA = 0x00040000, DependencyArrayINTEL = 0x00040000, + PipelineEnableALTERA = 0x00080000, PipelineEnableINTEL = 0x00080000, + LoopCoalesceALTERA = 0x00100000, LoopCoalesceINTEL = 0x00100000, + MaxInterleavingALTERA = 0x00200000, MaxInterleavingINTEL = 0x00200000, + SpeculatedIterationsALTERA = 0x00400000, SpeculatedIterationsINTEL = 0x00400000, + NoFusionALTERA = 0x00800000, NoFusionINTEL = 0x00800000, + LoopCountALTERA = 0x01000000, LoopCountINTEL = 0x01000000, + MaxReinvocationDelayALTERA = 0x02000000, MaxReinvocationDelayINTEL = 0x02000000, } @@ -992,8 +1065,11 @@ namespace Spv InclusiveScan = 1, ExclusiveScan = 2, ClusteredReduce = 3, + PartitionedReduceEXT = 6, PartitionedReduceNV = 6, + PartitionedInclusiveScanEXT = 7, PartitionedInclusiveScanNV = 7, + PartitionedExclusiveScanEXT = 8, PartitionedExclusiveScanNV = 8, Max = 0x7fffffff, } @@ -1153,6 +1229,7 @@ namespace Spv BFloat16TypeKHR = 5116, BFloat16DotProductKHR = 5117, BFloat16CooperativeMatrixKHR = 5118, + DescriptorHeapEXT = 5128, SampleMaskOverrideCoverageNV = 5249, GeometryShaderPassthroughNV = 5251, ShaderViewportIndexLayerEXT = 5254, @@ -1170,6 +1247,7 @@ namespace Spv ComputeDerivativeGroupQuadsNV = 5288, FragmentDensityEXT = 5291, ShadingRateNV = 5291, + GroupNonUniformPartitionedEXT = 5297, GroupNonUniformPartitionedNV = 5297, ShaderNonUniform = 5301, ShaderNonUniformEXT = 5301, @@ -1217,6 +1295,7 @@ namespace Spv DisplacementMicromapNV = 5380, RayTracingOpacityMicromapEXT = 5381, ShaderInvocationReorderNV = 5383, + ShaderInvocationReorderEXT = 5388, BindlessTextureNV = 5390, RayQueryPositionFetchKHR = 5391, CooperativeVectorNV = 5394, @@ -1225,6 +1304,9 @@ namespace Spv RawAccessChainsNV = 5414, RayTracingSpheresGeometryNV = 5418, RayTracingLinearSweptSpheresGeometryNV = 5419, + PushConstantBanksNV = 5423, + LongVectorEXT = 5425, + Shader64BitIndexingEXT = 5426, CooperativeMatrixReductionsNV = 5430, CooperativeMatrixConversionsNV = 5431, CooperativeMatrixPerElementOperationsNV = 5432, @@ -1254,26 +1336,42 @@ namespace Spv SubgroupAvcMotionEstimationChromaINTEL = 5698, VariableLengthArrayINTEL = 5817, FunctionFloatControlINTEL = 5821, + FPGAMemoryAttributesALTERA = 5824, FPGAMemoryAttributesINTEL = 5824, FPFastMathModeINTEL = 5837, + ArbitraryPrecisionIntegersALTERA = 5844, ArbitraryPrecisionIntegersINTEL = 5844, + ArbitraryPrecisionFloatingPointALTERA = 5845, ArbitraryPrecisionFloatingPointINTEL = 5845, UnstructuredLoopControlsINTEL = 5886, + FPGALoopControlsALTERA = 5888, FPGALoopControlsINTEL = 5888, KernelAttributesINTEL = 5892, FPGAKernelAttributesINTEL = 5897, + FPGAMemoryAccessesALTERA = 5898, FPGAMemoryAccessesINTEL = 5898, + FPGAClusterAttributesALTERA = 5904, FPGAClusterAttributesINTEL = 5904, + LoopFuseALTERA = 5906, LoopFuseINTEL = 5906, + FPGADSPControlALTERA = 5908, FPGADSPControlINTEL = 5908, MemoryAccessAliasingINTEL = 5910, + FPGAInvocationPipeliningAttributesALTERA = 5916, FPGAInvocationPipeliningAttributesINTEL = 5916, + FPGABufferLocationALTERA = 5920, FPGABufferLocationINTEL = 5920, + ArbitraryPrecisionFixedPointALTERA = 5922, ArbitraryPrecisionFixedPointINTEL = 5922, + USMStorageClassesALTERA = 5935, USMStorageClassesINTEL = 5935, + RuntimeAlignedAttributeALTERA = 5939, RuntimeAlignedAttributeINTEL = 5939, + IOPipesALTERA = 5943, IOPipesINTEL = 5943, + BlockingPipesALTERA = 5945, BlockingPipesINTEL = 5945, + FPGARegALTERA = 5948, FPGARegINTEL = 5948, DotProductInputAll = 6016, DotProductInputAllKHR = 6016, @@ -1289,6 +1387,7 @@ namespace Spv BitInstructions = 6025, GroupNonUniformRotateKHR = 6026, FloatControls2 = 6029, + FMAKHR = 6030, AtomicFloat32AddEXT = 6033, AtomicFloat64AddEXT = 6034, LongCompositesINTEL = 6089, @@ -1299,13 +1398,18 @@ namespace Spv BFloat16ConversionINTEL = 6115, SplitBarrierINTEL = 6141, ArithmeticFenceEXT = 6144, + FPGAClusterAttributesV2ALTERA = 6150, FPGAClusterAttributesV2INTEL = 6150, FPGAKernelAttributesv2INTEL = 6161, + TaskSequenceALTERA = 6162, TaskSequenceINTEL = 6162, FPMaxErrorINTEL = 6169, + FPGALatencyControlALTERA = 6171, FPGALatencyControlINTEL = 6171, + FPGAArgumentInterfacesALTERA = 6174, FPGAArgumentInterfacesINTEL = 6174, GlobalVariableHostAccessINTEL = 6187, + GlobalVariableFPGADecorationsALTERA = 6189, GlobalVariableFPGADecorationsINTEL = 6189, SubgroupBufferPrefetchINTEL = 6220, Subgroup2DBlockIOINTEL = 6228, @@ -1313,6 +1417,7 @@ namespace Spv Subgroup2DBlockTransposeINTEL = 6230, SubgroupMatrixMultiplyAccumulateINTEL = 6236, TernaryBitwiseFunctionINTEL = 6241, + UntypedVariableLengthArrayINTEL = 6243, SpecConditionalINTEL = 6245, FunctionVariantsINTEL = 6246, GroupUniformArithmeticKHR = 6400, @@ -1540,7 +1645,9 @@ namespace Spv public enum InitializationModeQualifier { + InitOnDeviceReprogramALTERA = 0, InitOnDeviceReprogramINTEL = 0, + InitOnDeviceResetALTERA = 1, InitOnDeviceResetINTEL = 1, Max = 0x7fffffff, } @@ -2039,12 +2146,14 @@ namespace Spv OpUntypedInBoundsPtrAccessChainKHR = 4424, OpUntypedArrayLengthKHR = 4425, OpUntypedPrefetchKHR = 4426, + OpFmaKHR = 4427, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, OpGroupNonUniformRotateKHR = 4431, OpSubgroupReadInvocationKHR = 4432, OpExtInstWithForwardRefsKHR = 4433, + OpUntypedGroupAsyncCopyKHR = 4434, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, OpConvertUToAccelerationStructureKHR = 4447, @@ -2110,6 +2219,11 @@ namespace Spv OpSpecConstantStringAMDX = 5104, OpGroupNonUniformQuadAllKHR = 5110, OpGroupNonUniformQuadAnyKHR = 5111, + OpTypeBufferEXT = 5115, + OpBufferPointerEXT = 5119, + OpUntypedImageTexelPointerEXT = 5126, + OpMemberDecorateIdEXT = 5127, + OpConstantSizeOfEXT = 5129, OpHitObjectRecordHitMotionNV = 5249, OpHitObjectRecordHitWithIndexMotionNV = 5250, OpHitObjectRecordMissMotionNV = 5251, @@ -2145,6 +2259,7 @@ namespace Spv OpTypeHitObjectNV = 5281, OpImageSampleFootprintNV = 5283, OpTypeCooperativeVectorNV = 5288, + OpTypeVectorIdEXT = 5288, OpCooperativeVectorMatrixMulNV = 5289, OpCooperativeVectorOuterProductAccumulateNV = 5290, OpCooperativeVectorReduceSumAccumulateNV = 5291, @@ -2152,12 +2267,43 @@ namespace Spv OpCooperativeMatrixConvertNV = 5293, OpEmitMeshTasksEXT = 5294, OpSetMeshOutputsEXT = 5295, + OpGroupNonUniformPartitionEXT = 5296, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, OpFetchMicroTriangleVertexPositionNV = 5300, OpFetchMicroTriangleVertexBarycentricNV = 5301, OpCooperativeVectorLoadNV = 5302, OpCooperativeVectorStoreNV = 5303, + OpHitObjectRecordFromQueryEXT = 5304, + OpHitObjectRecordMissEXT = 5305, + OpHitObjectRecordMissMotionEXT = 5306, + OpHitObjectGetIntersectionTriangleVertexPositionsEXT = 5307, + OpHitObjectGetRayFlagsEXT = 5308, + OpHitObjectSetShaderBindingTableRecordIndexEXT = 5309, + OpHitObjectReorderExecuteShaderEXT = 5310, + OpHitObjectTraceReorderExecuteEXT = 5311, + OpHitObjectTraceMotionReorderExecuteEXT = 5312, + OpTypeHitObjectEXT = 5313, + OpReorderThreadWithHintEXT = 5314, + OpReorderThreadWithHitObjectEXT = 5315, + OpHitObjectTraceRayEXT = 5316, + OpHitObjectTraceRayMotionEXT = 5317, + OpHitObjectRecordEmptyEXT = 5318, + OpHitObjectExecuteShaderEXT = 5319, + OpHitObjectGetCurrentTimeEXT = 5320, + OpHitObjectGetAttributesEXT = 5321, + OpHitObjectGetHitKindEXT = 5322, + OpHitObjectGetPrimitiveIndexEXT = 5323, + OpHitObjectGetGeometryIndexEXT = 5324, + OpHitObjectGetInstanceIdEXT = 5325, + OpHitObjectGetInstanceCustomIndexEXT = 5326, + OpHitObjectGetObjectRayOriginEXT = 5327, + OpHitObjectGetObjectRayDirectionEXT = 5328, + OpHitObjectGetWorldRayDirectionEXT = 5329, + OpHitObjectGetWorldRayOriginEXT = 5330, + OpHitObjectGetObjectToWorldEXT = 5331, + OpHitObjectGetWorldToObjectEXT = 5332, + OpHitObjectGetRayTMaxEXT = 5333, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, @@ -2170,7 +2316,14 @@ namespace Spv OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, OpRayQueryGetClusterIdNV = 5345, + OpRayQueryGetIntersectionClusterIdNV = 5345, OpHitObjectGetClusterIdNV = 5346, + OpHitObjectGetRayTMinEXT = 5347, + OpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, + OpHitObjectGetShaderRecordBufferHandleEXT = 5349, + OpHitObjectIsEmptyEXT = 5350, + OpHitObjectIsHitEXT = 5351, + OpHitObjectIsMissEXT = 5352, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixStoreNV = 5360, @@ -2377,23 +2530,41 @@ namespace Spv OpVariableLengthArrayINTEL = 5818, OpSaveMemoryINTEL = 5819, OpRestoreMemoryINTEL = 5820, + OpArbitraryFloatSinCosPiALTERA = 5840, OpArbitraryFloatSinCosPiINTEL = 5840, + OpArbitraryFloatCastALTERA = 5841, OpArbitraryFloatCastINTEL = 5841, + OpArbitraryFloatCastFromIntALTERA = 5842, OpArbitraryFloatCastFromIntINTEL = 5842, + OpArbitraryFloatCastToIntALTERA = 5843, OpArbitraryFloatCastToIntINTEL = 5843, + OpArbitraryFloatAddALTERA = 5846, OpArbitraryFloatAddINTEL = 5846, + OpArbitraryFloatSubALTERA = 5847, OpArbitraryFloatSubINTEL = 5847, + OpArbitraryFloatMulALTERA = 5848, OpArbitraryFloatMulINTEL = 5848, + OpArbitraryFloatDivALTERA = 5849, OpArbitraryFloatDivINTEL = 5849, + OpArbitraryFloatGTALTERA = 5850, OpArbitraryFloatGTINTEL = 5850, + OpArbitraryFloatGEALTERA = 5851, OpArbitraryFloatGEINTEL = 5851, + OpArbitraryFloatLTALTERA = 5852, OpArbitraryFloatLTINTEL = 5852, + OpArbitraryFloatLEALTERA = 5853, OpArbitraryFloatLEINTEL = 5853, + OpArbitraryFloatEQALTERA = 5854, OpArbitraryFloatEQINTEL = 5854, + OpArbitraryFloatRecipALTERA = 5855, OpArbitraryFloatRecipINTEL = 5855, + OpArbitraryFloatRSqrtALTERA = 5856, OpArbitraryFloatRSqrtINTEL = 5856, + OpArbitraryFloatCbrtALTERA = 5857, OpArbitraryFloatCbrtINTEL = 5857, + OpArbitraryFloatHypotALTERA = 5858, OpArbitraryFloatHypotINTEL = 5858, + OpArbitraryFloatSqrtALTERA = 5859, OpArbitraryFloatSqrtINTEL = 5859, OpArbitraryFloatLogINTEL = 5860, OpArbitraryFloatLog2INTEL = 5861, @@ -2422,21 +2593,37 @@ namespace Spv OpAliasDomainDeclINTEL = 5911, OpAliasScopeDeclINTEL = 5912, OpAliasScopeListDeclINTEL = 5913, + OpFixedSqrtALTERA = 5923, OpFixedSqrtINTEL = 5923, + OpFixedRecipALTERA = 5924, OpFixedRecipINTEL = 5924, + OpFixedRsqrtALTERA = 5925, OpFixedRsqrtINTEL = 5925, + OpFixedSinALTERA = 5926, OpFixedSinINTEL = 5926, + OpFixedCosALTERA = 5927, OpFixedCosINTEL = 5927, + OpFixedSinCosALTERA = 5928, OpFixedSinCosINTEL = 5928, + OpFixedSinPiALTERA = 5929, OpFixedSinPiINTEL = 5929, + OpFixedCosPiALTERA = 5930, OpFixedCosPiINTEL = 5930, + OpFixedSinCosPiALTERA = 5931, OpFixedSinCosPiINTEL = 5931, + OpFixedLogALTERA = 5932, OpFixedLogINTEL = 5932, + OpFixedExpALTERA = 5933, OpFixedExpINTEL = 5933, + OpPtrCastToCrossWorkgroupALTERA = 5934, OpPtrCastToCrossWorkgroupINTEL = 5934, + OpCrossWorkgroupCastToPtrALTERA = 5938, OpCrossWorkgroupCastToPtrINTEL = 5938, + OpReadPipeBlockingALTERA = 5946, OpReadPipeBlockingINTEL = 5946, + OpWritePipeBlockingALTERA = 5947, OpWritePipeBlockingINTEL = 5947, + OpFPGARegALTERA = 5949, OpFPGARegINTEL = 5949, OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayFlagsKHR = 6017, @@ -2466,10 +2653,15 @@ namespace Spv OpControlBarrierArriveINTEL = 6142, OpControlBarrierWaitINTEL = 6143, OpArithmeticFenceEXT = 6145, + OpTaskSequenceCreateALTERA = 6163, OpTaskSequenceCreateINTEL = 6163, + OpTaskSequenceAsyncALTERA = 6164, OpTaskSequenceAsyncINTEL = 6164, + OpTaskSequenceGetALTERA = 6165, OpTaskSequenceGetINTEL = 6165, + OpTaskSequenceReleaseALTERA = 6166, OpTaskSequenceReleaseINTEL = 6166, + OpTypeTaskSequenceALTERA = 6199, OpTypeTaskSequenceINTEL = 6199, OpSubgroupBlockPrefetchINTEL = 6221, OpSubgroup2DBlockLoadINTEL = 6231, @@ -2479,6 +2671,7 @@ namespace Spv OpSubgroup2DBlockStoreINTEL = 6235, OpSubgroupMatrixMultiplyAccumulateINTEL = 6237, OpBitwiseFunctionINTEL = 6242, + OpUntypedVariableLengthArrayINTEL = 6244, OpConditionalExtensionINTEL = 6248, OpConditionalEntryPointINTEL = 6249, OpConditionalCapabilityINTEL = 6250, diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.h b/third_party/spirv-headers/include/spirv/unified1/spirv.h index 2bd9daff80..2fbcfe0f78 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.h +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.h @@ -195,6 +195,7 @@ typedef enum SpvExecutionMode_ { SpvExecutionModeSampleInterlockUnorderedEXT = 5369, SpvExecutionModeShadingRateInterlockOrderedEXT = 5370, SpvExecutionModeShadingRateInterlockUnorderedEXT = 5371, + SpvExecutionModeShader64BitIndexingEXT = 5427, SpvExecutionModeSharedLocalMemorySizeINTEL = 5618, SpvExecutionModeRoundingModeRTPINTEL = 5620, SpvExecutionModeRoundingModeRTNINTEL = 5621, @@ -249,8 +250,11 @@ typedef enum SpvStorageClass_ { SpvStorageClassPhysicalStorageBufferEXT = 5349, SpvStorageClassHitObjectAttributeNV = 5385, SpvStorageClassTaskPayloadWorkgroupEXT = 5402, + SpvStorageClassHitObjectAttributeEXT = 5411, SpvStorageClassCodeSectionINTEL = 5605, + SpvStorageClassDeviceOnlyALTERA = 5936, SpvStorageClassDeviceOnlyINTEL = 5936, + SpvStorageClassHostOnlyALTERA = 5937, SpvStorageClassHostOnlyINTEL = 5937, SpvStorageClassMax = 0x7fffffff, } SpvStorageClass; @@ -489,6 +493,7 @@ typedef enum SpvFunctionParameterAttribute_ { SpvFunctionParameterAttributeNoCapture = 5, SpvFunctionParameterAttributeNoWrite = 6, SpvFunctionParameterAttributeNoReadWrite = 7, + SpvFunctionParameterAttributeRuntimeAlignedALTERA = 5940, SpvFunctionParameterAttributeRuntimeAlignedINTEL = 5940, SpvFunctionParameterAttributeMax = 0x7fffffff, } SpvFunctionParameterAttribute; @@ -556,6 +561,8 @@ typedef enum SpvDecoration_ { SpvDecorationPayloadNodeSparseArrayAMDX = 5099, SpvDecorationPayloadNodeArraySizeAMDX = 5100, SpvDecorationPayloadDispatchIndirectAMDX = 5105, + SpvDecorationArrayStrideIdEXT = 5124, + SpvDecorationOffsetIdEXT = 5125, SpvDecorationOverrideCoverageNV = 5248, SpvDecorationPassthroughNV = 5250, SpvDecorationViewportRelativeNV = 5252, @@ -572,7 +579,10 @@ typedef enum SpvDecoration_ { SpvDecorationRestrictPointerEXT = 5355, SpvDecorationAliasedPointer = 5356, SpvDecorationAliasedPointerEXT = 5356, + SpvDecorationMemberOffsetNV = 5358, SpvDecorationHitObjectShaderRecordBufferNV = 5386, + SpvDecorationHitObjectShaderRecordBufferEXT = 5389, + SpvDecorationBankNV = 5397, SpvDecorationBindlessSamplerNV = 5398, SpvDecorationBindlessImageNV = 5399, SpvDecorationBoundSamplerNV = 5400, @@ -593,54 +603,95 @@ typedef enum SpvDecoration_ { SpvDecorationUserTypeGOOGLE = 5636, SpvDecorationFunctionRoundingModeINTEL = 5822, SpvDecorationFunctionDenormModeINTEL = 5823, + SpvDecorationRegisterALTERA = 5825, SpvDecorationRegisterINTEL = 5825, + SpvDecorationMemoryALTERA = 5826, SpvDecorationMemoryINTEL = 5826, + SpvDecorationNumbanksALTERA = 5827, SpvDecorationNumbanksINTEL = 5827, + SpvDecorationBankwidthALTERA = 5828, SpvDecorationBankwidthINTEL = 5828, + SpvDecorationMaxPrivateCopiesALTERA = 5829, SpvDecorationMaxPrivateCopiesINTEL = 5829, + SpvDecorationSinglepumpALTERA = 5830, SpvDecorationSinglepumpINTEL = 5830, + SpvDecorationDoublepumpALTERA = 5831, SpvDecorationDoublepumpINTEL = 5831, + SpvDecorationMaxReplicatesALTERA = 5832, SpvDecorationMaxReplicatesINTEL = 5832, + SpvDecorationSimpleDualPortALTERA = 5833, SpvDecorationSimpleDualPortINTEL = 5833, + SpvDecorationMergeALTERA = 5834, SpvDecorationMergeINTEL = 5834, + SpvDecorationBankBitsALTERA = 5835, SpvDecorationBankBitsINTEL = 5835, + SpvDecorationForcePow2DepthALTERA = 5836, SpvDecorationForcePow2DepthINTEL = 5836, + SpvDecorationStridesizeALTERA = 5883, SpvDecorationStridesizeINTEL = 5883, + SpvDecorationWordsizeALTERA = 5884, SpvDecorationWordsizeINTEL = 5884, + SpvDecorationTrueDualPortALTERA = 5885, SpvDecorationTrueDualPortINTEL = 5885, + SpvDecorationBurstCoalesceALTERA = 5899, SpvDecorationBurstCoalesceINTEL = 5899, + SpvDecorationCacheSizeALTERA = 5900, SpvDecorationCacheSizeINTEL = 5900, + SpvDecorationDontStaticallyCoalesceALTERA = 5901, SpvDecorationDontStaticallyCoalesceINTEL = 5901, + SpvDecorationPrefetchALTERA = 5902, SpvDecorationPrefetchINTEL = 5902, + SpvDecorationStallEnableALTERA = 5905, SpvDecorationStallEnableINTEL = 5905, + SpvDecorationFuseLoopsInFunctionALTERA = 5907, SpvDecorationFuseLoopsInFunctionINTEL = 5907, + SpvDecorationMathOpDSPModeALTERA = 5909, SpvDecorationMathOpDSPModeINTEL = 5909, SpvDecorationAliasScopeINTEL = 5914, SpvDecorationNoAliasINTEL = 5915, + SpvDecorationInitiationIntervalALTERA = 5917, SpvDecorationInitiationIntervalINTEL = 5917, + SpvDecorationMaxConcurrencyALTERA = 5918, SpvDecorationMaxConcurrencyINTEL = 5918, + SpvDecorationPipelineEnableALTERA = 5919, SpvDecorationPipelineEnableINTEL = 5919, + SpvDecorationBufferLocationALTERA = 5921, SpvDecorationBufferLocationINTEL = 5921, + SpvDecorationIOPipeStorageALTERA = 5944, SpvDecorationIOPipeStorageINTEL = 5944, SpvDecorationFunctionFloatingPointModeINTEL = 6080, SpvDecorationSingleElementVectorINTEL = 6085, SpvDecorationVectorComputeCallableFunctionINTEL = 6087, SpvDecorationMediaBlockIOINTEL = 6140, + SpvDecorationStallFreeALTERA = 6151, SpvDecorationStallFreeINTEL = 6151, SpvDecorationFPMaxErrorDecorationINTEL = 6170, + SpvDecorationLatencyControlLabelALTERA = 6172, SpvDecorationLatencyControlLabelINTEL = 6172, + SpvDecorationLatencyControlConstraintALTERA = 6173, SpvDecorationLatencyControlConstraintINTEL = 6173, + SpvDecorationConduitKernelArgumentALTERA = 6175, SpvDecorationConduitKernelArgumentINTEL = 6175, + SpvDecorationRegisterMapKernelArgumentALTERA = 6176, SpvDecorationRegisterMapKernelArgumentINTEL = 6176, + SpvDecorationMMHostInterfaceAddressWidthALTERA = 6177, SpvDecorationMMHostInterfaceAddressWidthINTEL = 6177, + SpvDecorationMMHostInterfaceDataWidthALTERA = 6178, SpvDecorationMMHostInterfaceDataWidthINTEL = 6178, + SpvDecorationMMHostInterfaceLatencyALTERA = 6179, SpvDecorationMMHostInterfaceLatencyINTEL = 6179, + SpvDecorationMMHostInterfaceReadWriteModeALTERA = 6180, SpvDecorationMMHostInterfaceReadWriteModeINTEL = 6180, + SpvDecorationMMHostInterfaceMaxBurstALTERA = 6181, SpvDecorationMMHostInterfaceMaxBurstINTEL = 6181, + SpvDecorationMMHostInterfaceWaitRequestALTERA = 6182, SpvDecorationMMHostInterfaceWaitRequestINTEL = 6182, + SpvDecorationStableKernelArgumentALTERA = 6183, SpvDecorationStableKernelArgumentINTEL = 6183, SpvDecorationHostAccessINTEL = 6188, + SpvDecorationInitModeALTERA = 6190, SpvDecorationInitModeINTEL = 6190, + SpvDecorationImplementInRegisterMapALTERA = 6191, SpvDecorationImplementInRegisterMapINTEL = 6191, SpvDecorationConditionalINTEL = 6247, SpvDecorationCacheControlLoadINTEL = 6442, @@ -725,6 +776,8 @@ typedef enum SpvBuiltIn_ { SpvBuiltInFragStencilRefEXT = 5014, SpvBuiltInRemainingRecursionLevelsAMDX = 5021, SpvBuiltInShaderIndexAMDX = 5073, + SpvBuiltInSamplerHeapEXT = 5122, + SpvBuiltInResourceHeapEXT = 5123, SpvBuiltInViewportMaskNV = 5253, SpvBuiltInSecondaryPositionNV = 5257, SpvBuiltInSecondaryViewportMaskNV = 5258, @@ -822,15 +875,25 @@ typedef enum SpvLoopControlShift_ { SpvLoopControlIterationMultipleShift = 6, SpvLoopControlPeelCountShift = 7, SpvLoopControlPartialCountShift = 8, + SpvLoopControlInitiationIntervalALTERAShift = 16, SpvLoopControlInitiationIntervalINTELShift = 16, + SpvLoopControlMaxConcurrencyALTERAShift = 17, SpvLoopControlMaxConcurrencyINTELShift = 17, + SpvLoopControlDependencyArrayALTERAShift = 18, SpvLoopControlDependencyArrayINTELShift = 18, + SpvLoopControlPipelineEnableALTERAShift = 19, SpvLoopControlPipelineEnableINTELShift = 19, + SpvLoopControlLoopCoalesceALTERAShift = 20, SpvLoopControlLoopCoalesceINTELShift = 20, + SpvLoopControlMaxInterleavingALTERAShift = 21, SpvLoopControlMaxInterleavingINTELShift = 21, + SpvLoopControlSpeculatedIterationsALTERAShift = 22, SpvLoopControlSpeculatedIterationsINTELShift = 22, + SpvLoopControlNoFusionALTERAShift = 23, SpvLoopControlNoFusionINTELShift = 23, + SpvLoopControlLoopCountALTERAShift = 24, SpvLoopControlLoopCountINTELShift = 24, + SpvLoopControlMaxReinvocationDelayALTERAShift = 25, SpvLoopControlMaxReinvocationDelayINTELShift = 25, SpvLoopControlMax = 0x7fffffff, } SpvLoopControlShift; @@ -846,15 +909,25 @@ typedef enum SpvLoopControlMask_ { SpvLoopControlIterationMultipleMask = 0x00000040, SpvLoopControlPeelCountMask = 0x00000080, SpvLoopControlPartialCountMask = 0x00000100, + SpvLoopControlInitiationIntervalALTERAMask = 0x00010000, SpvLoopControlInitiationIntervalINTELMask = 0x00010000, + SpvLoopControlMaxConcurrencyALTERAMask = 0x00020000, SpvLoopControlMaxConcurrencyINTELMask = 0x00020000, + SpvLoopControlDependencyArrayALTERAMask = 0x00040000, SpvLoopControlDependencyArrayINTELMask = 0x00040000, + SpvLoopControlPipelineEnableALTERAMask = 0x00080000, SpvLoopControlPipelineEnableINTELMask = 0x00080000, + SpvLoopControlLoopCoalesceALTERAMask = 0x00100000, SpvLoopControlLoopCoalesceINTELMask = 0x00100000, + SpvLoopControlMaxInterleavingALTERAMask = 0x00200000, SpvLoopControlMaxInterleavingINTELMask = 0x00200000, + SpvLoopControlSpeculatedIterationsALTERAMask = 0x00400000, SpvLoopControlSpeculatedIterationsINTELMask = 0x00400000, + SpvLoopControlNoFusionALTERAMask = 0x00800000, SpvLoopControlNoFusionINTELMask = 0x00800000, + SpvLoopControlLoopCountALTERAMask = 0x01000000, SpvLoopControlLoopCountINTELMask = 0x01000000, + SpvLoopControlMaxReinvocationDelayALTERAMask = 0x02000000, SpvLoopControlMaxReinvocationDelayINTELMask = 0x02000000, } SpvLoopControlMask; @@ -967,8 +1040,11 @@ typedef enum SpvGroupOperation_ { SpvGroupOperationInclusiveScan = 1, SpvGroupOperationExclusiveScan = 2, SpvGroupOperationClusteredReduce = 3, + SpvGroupOperationPartitionedReduceEXT = 6, SpvGroupOperationPartitionedReduceNV = 6, + SpvGroupOperationPartitionedInclusiveScanEXT = 7, SpvGroupOperationPartitionedInclusiveScanNV = 7, + SpvGroupOperationPartitionedExclusiveScanEXT = 8, SpvGroupOperationPartitionedExclusiveScanNV = 8, SpvGroupOperationMax = 0x7fffffff, } SpvGroupOperation; @@ -1124,6 +1200,7 @@ typedef enum SpvCapability_ { SpvCapabilityBFloat16TypeKHR = 5116, SpvCapabilityBFloat16DotProductKHR = 5117, SpvCapabilityBFloat16CooperativeMatrixKHR = 5118, + SpvCapabilityDescriptorHeapEXT = 5128, SpvCapabilitySampleMaskOverrideCoverageNV = 5249, SpvCapabilityGeometryShaderPassthroughNV = 5251, SpvCapabilityShaderViewportIndexLayerEXT = 5254, @@ -1141,6 +1218,7 @@ typedef enum SpvCapability_ { SpvCapabilityComputeDerivativeGroupQuadsNV = 5288, SpvCapabilityFragmentDensityEXT = 5291, SpvCapabilityShadingRateNV = 5291, + SpvCapabilityGroupNonUniformPartitionedEXT = 5297, SpvCapabilityGroupNonUniformPartitionedNV = 5297, SpvCapabilityShaderNonUniform = 5301, SpvCapabilityShaderNonUniformEXT = 5301, @@ -1188,6 +1266,7 @@ typedef enum SpvCapability_ { SpvCapabilityDisplacementMicromapNV = 5380, SpvCapabilityRayTracingOpacityMicromapEXT = 5381, SpvCapabilityShaderInvocationReorderNV = 5383, + SpvCapabilityShaderInvocationReorderEXT = 5388, SpvCapabilityBindlessTextureNV = 5390, SpvCapabilityRayQueryPositionFetchKHR = 5391, SpvCapabilityCooperativeVectorNV = 5394, @@ -1196,6 +1275,9 @@ typedef enum SpvCapability_ { SpvCapabilityRawAccessChainsNV = 5414, SpvCapabilityRayTracingSpheresGeometryNV = 5418, SpvCapabilityRayTracingLinearSweptSpheresGeometryNV = 5419, + SpvCapabilityPushConstantBanksNV = 5423, + SpvCapabilityLongVectorEXT = 5425, + SpvCapabilityShader64BitIndexingEXT = 5426, SpvCapabilityCooperativeMatrixReductionsNV = 5430, SpvCapabilityCooperativeMatrixConversionsNV = 5431, SpvCapabilityCooperativeMatrixPerElementOperationsNV = 5432, @@ -1225,26 +1307,42 @@ typedef enum SpvCapability_ { SpvCapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698, SpvCapabilityVariableLengthArrayINTEL = 5817, SpvCapabilityFunctionFloatControlINTEL = 5821, + SpvCapabilityFPGAMemoryAttributesALTERA = 5824, SpvCapabilityFPGAMemoryAttributesINTEL = 5824, SpvCapabilityFPFastMathModeINTEL = 5837, + SpvCapabilityArbitraryPrecisionIntegersALTERA = 5844, SpvCapabilityArbitraryPrecisionIntegersINTEL = 5844, + SpvCapabilityArbitraryPrecisionFloatingPointALTERA = 5845, SpvCapabilityArbitraryPrecisionFloatingPointINTEL = 5845, SpvCapabilityUnstructuredLoopControlsINTEL = 5886, + SpvCapabilityFPGALoopControlsALTERA = 5888, SpvCapabilityFPGALoopControlsINTEL = 5888, SpvCapabilityKernelAttributesINTEL = 5892, SpvCapabilityFPGAKernelAttributesINTEL = 5897, + SpvCapabilityFPGAMemoryAccessesALTERA = 5898, SpvCapabilityFPGAMemoryAccessesINTEL = 5898, + SpvCapabilityFPGAClusterAttributesALTERA = 5904, SpvCapabilityFPGAClusterAttributesINTEL = 5904, + SpvCapabilityLoopFuseALTERA = 5906, SpvCapabilityLoopFuseINTEL = 5906, + SpvCapabilityFPGADSPControlALTERA = 5908, SpvCapabilityFPGADSPControlINTEL = 5908, SpvCapabilityMemoryAccessAliasingINTEL = 5910, + SpvCapabilityFPGAInvocationPipeliningAttributesALTERA = 5916, SpvCapabilityFPGAInvocationPipeliningAttributesINTEL = 5916, + SpvCapabilityFPGABufferLocationALTERA = 5920, SpvCapabilityFPGABufferLocationINTEL = 5920, + SpvCapabilityArbitraryPrecisionFixedPointALTERA = 5922, SpvCapabilityArbitraryPrecisionFixedPointINTEL = 5922, + SpvCapabilityUSMStorageClassesALTERA = 5935, SpvCapabilityUSMStorageClassesINTEL = 5935, + SpvCapabilityRuntimeAlignedAttributeALTERA = 5939, SpvCapabilityRuntimeAlignedAttributeINTEL = 5939, + SpvCapabilityIOPipesALTERA = 5943, SpvCapabilityIOPipesINTEL = 5943, + SpvCapabilityBlockingPipesALTERA = 5945, SpvCapabilityBlockingPipesINTEL = 5945, + SpvCapabilityFPGARegALTERA = 5948, SpvCapabilityFPGARegINTEL = 5948, SpvCapabilityDotProductInputAll = 6016, SpvCapabilityDotProductInputAllKHR = 6016, @@ -1260,6 +1358,7 @@ typedef enum SpvCapability_ { SpvCapabilityBitInstructions = 6025, SpvCapabilityGroupNonUniformRotateKHR = 6026, SpvCapabilityFloatControls2 = 6029, + SpvCapabilityFMAKHR = 6030, SpvCapabilityAtomicFloat32AddEXT = 6033, SpvCapabilityAtomicFloat64AddEXT = 6034, SpvCapabilityLongCompositesINTEL = 6089, @@ -1270,13 +1369,18 @@ typedef enum SpvCapability_ { SpvCapabilityBFloat16ConversionINTEL = 6115, SpvCapabilitySplitBarrierINTEL = 6141, SpvCapabilityArithmeticFenceEXT = 6144, + SpvCapabilityFPGAClusterAttributesV2ALTERA = 6150, SpvCapabilityFPGAClusterAttributesV2INTEL = 6150, SpvCapabilityFPGAKernelAttributesv2INTEL = 6161, + SpvCapabilityTaskSequenceALTERA = 6162, SpvCapabilityTaskSequenceINTEL = 6162, SpvCapabilityFPMaxErrorINTEL = 6169, + SpvCapabilityFPGALatencyControlALTERA = 6171, SpvCapabilityFPGALatencyControlINTEL = 6171, + SpvCapabilityFPGAArgumentInterfacesALTERA = 6174, SpvCapabilityFPGAArgumentInterfacesINTEL = 6174, SpvCapabilityGlobalVariableHostAccessINTEL = 6187, + SpvCapabilityGlobalVariableFPGADecorationsALTERA = 6189, SpvCapabilityGlobalVariableFPGADecorationsINTEL = 6189, SpvCapabilitySubgroupBufferPrefetchINTEL = 6220, SpvCapabilitySubgroup2DBlockIOINTEL = 6228, @@ -1284,6 +1388,7 @@ typedef enum SpvCapability_ { SpvCapabilitySubgroup2DBlockTransposeINTEL = 6230, SpvCapabilitySubgroupMatrixMultiplyAccumulateINTEL = 6236, SpvCapabilityTernaryBitwiseFunctionINTEL = 6241, + SpvCapabilityUntypedVariableLengthArrayINTEL = 6243, SpvCapabilitySpecConditionalINTEL = 6245, SpvCapabilityFunctionVariantsINTEL = 6246, SpvCapabilityGroupUniformArithmeticKHR = 6400, @@ -1487,7 +1592,9 @@ typedef enum SpvTensorOperandsMask_ { } SpvTensorOperandsMask; typedef enum SpvInitializationModeQualifier_ { + SpvInitializationModeQualifierInitOnDeviceReprogramALTERA = 0, SpvInitializationModeQualifierInitOnDeviceReprogramINTEL = 0, + SpvInitializationModeQualifierInitOnDeviceResetALTERA = 1, SpvInitializationModeQualifierInitOnDeviceResetINTEL = 1, SpvInitializationModeQualifierMax = 0x7fffffff, } SpvInitializationModeQualifier; @@ -1974,12 +2081,14 @@ typedef enum SpvOp_ { SpvOpUntypedInBoundsPtrAccessChainKHR = 4424, SpvOpUntypedArrayLengthKHR = 4425, SpvOpUntypedPrefetchKHR = 4426, + SpvOpFmaKHR = 4427, SpvOpSubgroupAllKHR = 4428, SpvOpSubgroupAnyKHR = 4429, SpvOpSubgroupAllEqualKHR = 4430, SpvOpGroupNonUniformRotateKHR = 4431, SpvOpSubgroupReadInvocationKHR = 4432, SpvOpExtInstWithForwardRefsKHR = 4433, + SpvOpUntypedGroupAsyncCopyKHR = 4434, SpvOpTraceRayKHR = 4445, SpvOpExecuteCallableKHR = 4446, SpvOpConvertUToAccelerationStructureKHR = 4447, @@ -2045,6 +2154,11 @@ typedef enum SpvOp_ { SpvOpSpecConstantStringAMDX = 5104, SpvOpGroupNonUniformQuadAllKHR = 5110, SpvOpGroupNonUniformQuadAnyKHR = 5111, + SpvOpTypeBufferEXT = 5115, + SpvOpBufferPointerEXT = 5119, + SpvOpUntypedImageTexelPointerEXT = 5126, + SpvOpMemberDecorateIdEXT = 5127, + SpvOpConstantSizeOfEXT = 5129, SpvOpHitObjectRecordHitMotionNV = 5249, SpvOpHitObjectRecordHitWithIndexMotionNV = 5250, SpvOpHitObjectRecordMissMotionNV = 5251, @@ -2080,6 +2194,7 @@ typedef enum SpvOp_ { SpvOpTypeHitObjectNV = 5281, SpvOpImageSampleFootprintNV = 5283, SpvOpTypeCooperativeVectorNV = 5288, + SpvOpTypeVectorIdEXT = 5288, SpvOpCooperativeVectorMatrixMulNV = 5289, SpvOpCooperativeVectorOuterProductAccumulateNV = 5290, SpvOpCooperativeVectorReduceSumAccumulateNV = 5291, @@ -2087,12 +2202,43 @@ typedef enum SpvOp_ { SpvOpCooperativeMatrixConvertNV = 5293, SpvOpEmitMeshTasksEXT = 5294, SpvOpSetMeshOutputsEXT = 5295, + SpvOpGroupNonUniformPartitionEXT = 5296, SpvOpGroupNonUniformPartitionNV = 5296, SpvOpWritePackedPrimitiveIndices4x8NV = 5299, SpvOpFetchMicroTriangleVertexPositionNV = 5300, SpvOpFetchMicroTriangleVertexBarycentricNV = 5301, SpvOpCooperativeVectorLoadNV = 5302, SpvOpCooperativeVectorStoreNV = 5303, + SpvOpHitObjectRecordFromQueryEXT = 5304, + SpvOpHitObjectRecordMissEXT = 5305, + SpvOpHitObjectRecordMissMotionEXT = 5306, + SpvOpHitObjectGetIntersectionTriangleVertexPositionsEXT = 5307, + SpvOpHitObjectGetRayFlagsEXT = 5308, + SpvOpHitObjectSetShaderBindingTableRecordIndexEXT = 5309, + SpvOpHitObjectReorderExecuteShaderEXT = 5310, + SpvOpHitObjectTraceReorderExecuteEXT = 5311, + SpvOpHitObjectTraceMotionReorderExecuteEXT = 5312, + SpvOpTypeHitObjectEXT = 5313, + SpvOpReorderThreadWithHintEXT = 5314, + SpvOpReorderThreadWithHitObjectEXT = 5315, + SpvOpHitObjectTraceRayEXT = 5316, + SpvOpHitObjectTraceRayMotionEXT = 5317, + SpvOpHitObjectRecordEmptyEXT = 5318, + SpvOpHitObjectExecuteShaderEXT = 5319, + SpvOpHitObjectGetCurrentTimeEXT = 5320, + SpvOpHitObjectGetAttributesEXT = 5321, + SpvOpHitObjectGetHitKindEXT = 5322, + SpvOpHitObjectGetPrimitiveIndexEXT = 5323, + SpvOpHitObjectGetGeometryIndexEXT = 5324, + SpvOpHitObjectGetInstanceIdEXT = 5325, + SpvOpHitObjectGetInstanceCustomIndexEXT = 5326, + SpvOpHitObjectGetObjectRayOriginEXT = 5327, + SpvOpHitObjectGetObjectRayDirectionEXT = 5328, + SpvOpHitObjectGetWorldRayDirectionEXT = 5329, + SpvOpHitObjectGetWorldRayOriginEXT = 5330, + SpvOpHitObjectGetObjectToWorldEXT = 5331, + SpvOpHitObjectGetWorldToObjectEXT = 5332, + SpvOpHitObjectGetRayTMaxEXT = 5333, SpvOpReportIntersectionKHR = 5334, SpvOpReportIntersectionNV = 5334, SpvOpIgnoreIntersectionNV = 5335, @@ -2105,7 +2251,14 @@ typedef enum SpvOp_ { SpvOpTypeAccelerationStructureNV = 5341, SpvOpExecuteCallableNV = 5344, SpvOpRayQueryGetClusterIdNV = 5345, + SpvOpRayQueryGetIntersectionClusterIdNV = 5345, SpvOpHitObjectGetClusterIdNV = 5346, + SpvOpHitObjectGetRayTMinEXT = 5347, + SpvOpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, + SpvOpHitObjectGetShaderRecordBufferHandleEXT = 5349, + SpvOpHitObjectIsEmptyEXT = 5350, + SpvOpHitObjectIsHitEXT = 5351, + SpvOpHitObjectIsMissEXT = 5352, SpvOpTypeCooperativeMatrixNV = 5358, SpvOpCooperativeMatrixLoadNV = 5359, SpvOpCooperativeMatrixStoreNV = 5360, @@ -2312,23 +2465,41 @@ typedef enum SpvOp_ { SpvOpVariableLengthArrayINTEL = 5818, SpvOpSaveMemoryINTEL = 5819, SpvOpRestoreMemoryINTEL = 5820, + SpvOpArbitraryFloatSinCosPiALTERA = 5840, SpvOpArbitraryFloatSinCosPiINTEL = 5840, + SpvOpArbitraryFloatCastALTERA = 5841, SpvOpArbitraryFloatCastINTEL = 5841, + SpvOpArbitraryFloatCastFromIntALTERA = 5842, SpvOpArbitraryFloatCastFromIntINTEL = 5842, + SpvOpArbitraryFloatCastToIntALTERA = 5843, SpvOpArbitraryFloatCastToIntINTEL = 5843, + SpvOpArbitraryFloatAddALTERA = 5846, SpvOpArbitraryFloatAddINTEL = 5846, + SpvOpArbitraryFloatSubALTERA = 5847, SpvOpArbitraryFloatSubINTEL = 5847, + SpvOpArbitraryFloatMulALTERA = 5848, SpvOpArbitraryFloatMulINTEL = 5848, + SpvOpArbitraryFloatDivALTERA = 5849, SpvOpArbitraryFloatDivINTEL = 5849, + SpvOpArbitraryFloatGTALTERA = 5850, SpvOpArbitraryFloatGTINTEL = 5850, + SpvOpArbitraryFloatGEALTERA = 5851, SpvOpArbitraryFloatGEINTEL = 5851, + SpvOpArbitraryFloatLTALTERA = 5852, SpvOpArbitraryFloatLTINTEL = 5852, + SpvOpArbitraryFloatLEALTERA = 5853, SpvOpArbitraryFloatLEINTEL = 5853, + SpvOpArbitraryFloatEQALTERA = 5854, SpvOpArbitraryFloatEQINTEL = 5854, + SpvOpArbitraryFloatRecipALTERA = 5855, SpvOpArbitraryFloatRecipINTEL = 5855, + SpvOpArbitraryFloatRSqrtALTERA = 5856, SpvOpArbitraryFloatRSqrtINTEL = 5856, + SpvOpArbitraryFloatCbrtALTERA = 5857, SpvOpArbitraryFloatCbrtINTEL = 5857, + SpvOpArbitraryFloatHypotALTERA = 5858, SpvOpArbitraryFloatHypotINTEL = 5858, + SpvOpArbitraryFloatSqrtALTERA = 5859, SpvOpArbitraryFloatSqrtINTEL = 5859, SpvOpArbitraryFloatLogINTEL = 5860, SpvOpArbitraryFloatLog2INTEL = 5861, @@ -2357,21 +2528,37 @@ typedef enum SpvOp_ { SpvOpAliasDomainDeclINTEL = 5911, SpvOpAliasScopeDeclINTEL = 5912, SpvOpAliasScopeListDeclINTEL = 5913, + SpvOpFixedSqrtALTERA = 5923, SpvOpFixedSqrtINTEL = 5923, + SpvOpFixedRecipALTERA = 5924, SpvOpFixedRecipINTEL = 5924, + SpvOpFixedRsqrtALTERA = 5925, SpvOpFixedRsqrtINTEL = 5925, + SpvOpFixedSinALTERA = 5926, SpvOpFixedSinINTEL = 5926, + SpvOpFixedCosALTERA = 5927, SpvOpFixedCosINTEL = 5927, + SpvOpFixedSinCosALTERA = 5928, SpvOpFixedSinCosINTEL = 5928, + SpvOpFixedSinPiALTERA = 5929, SpvOpFixedSinPiINTEL = 5929, + SpvOpFixedCosPiALTERA = 5930, SpvOpFixedCosPiINTEL = 5930, + SpvOpFixedSinCosPiALTERA = 5931, SpvOpFixedSinCosPiINTEL = 5931, + SpvOpFixedLogALTERA = 5932, SpvOpFixedLogINTEL = 5932, + SpvOpFixedExpALTERA = 5933, SpvOpFixedExpINTEL = 5933, + SpvOpPtrCastToCrossWorkgroupALTERA = 5934, SpvOpPtrCastToCrossWorkgroupINTEL = 5934, + SpvOpCrossWorkgroupCastToPtrALTERA = 5938, SpvOpCrossWorkgroupCastToPtrINTEL = 5938, + SpvOpReadPipeBlockingALTERA = 5946, SpvOpReadPipeBlockingINTEL = 5946, + SpvOpWritePipeBlockingALTERA = 5947, SpvOpWritePipeBlockingINTEL = 5947, + SpvOpFPGARegALTERA = 5949, SpvOpFPGARegINTEL = 5949, SpvOpRayQueryGetRayTMinKHR = 6016, SpvOpRayQueryGetRayFlagsKHR = 6017, @@ -2401,10 +2588,15 @@ typedef enum SpvOp_ { SpvOpControlBarrierArriveINTEL = 6142, SpvOpControlBarrierWaitINTEL = 6143, SpvOpArithmeticFenceEXT = 6145, + SpvOpTaskSequenceCreateALTERA = 6163, SpvOpTaskSequenceCreateINTEL = 6163, + SpvOpTaskSequenceAsyncALTERA = 6164, SpvOpTaskSequenceAsyncINTEL = 6164, + SpvOpTaskSequenceGetALTERA = 6165, SpvOpTaskSequenceGetINTEL = 6165, + SpvOpTaskSequenceReleaseALTERA = 6166, SpvOpTaskSequenceReleaseINTEL = 6166, + SpvOpTypeTaskSequenceALTERA = 6199, SpvOpTypeTaskSequenceINTEL = 6199, SpvOpSubgroupBlockPrefetchINTEL = 6221, SpvOpSubgroup2DBlockLoadINTEL = 6231, @@ -2414,6 +2606,7 @@ typedef enum SpvOp_ { SpvOpSubgroup2DBlockStoreINTEL = 6235, SpvOpSubgroupMatrixMultiplyAccumulateINTEL = 6237, SpvOpBitwiseFunctionINTEL = 6242, + SpvOpUntypedVariableLengthArrayINTEL = 6244, SpvOpConditionalExtensionINTEL = 6248, SpvOpConditionalEntryPointINTEL = 6249, SpvOpConditionalCapabilityINTEL = 6250, @@ -2815,12 +3008,14 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpUntypedInBoundsPtrAccessChainKHR: *hasResult = true; *hasResultType = true; break; case SpvOpUntypedArrayLengthKHR: *hasResult = true; *hasResultType = true; break; case SpvOpUntypedPrefetchKHR: *hasResult = false; *hasResultType = false; break; + case SpvOpFmaKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; case SpvOpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; case SpvOpExtInstWithForwardRefsKHR: *hasResult = true; *hasResultType = true; break; + case SpvOpUntypedGroupAsyncCopyKHR: *hasResult = true; *hasResultType = true; break; case SpvOpTraceRayKHR: *hasResult = false; *hasResultType = false; break; case SpvOpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; case SpvOpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break; @@ -2880,6 +3075,11 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpSpecConstantStringAMDX: *hasResult = true; *hasResultType = false; break; case SpvOpGroupNonUniformQuadAllKHR: *hasResult = true; *hasResultType = true; break; case SpvOpGroupNonUniformQuadAnyKHR: *hasResult = true; *hasResultType = true; break; + case SpvOpTypeBufferEXT: *hasResult = true; *hasResultType = false; break; + case SpvOpBufferPointerEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpUntypedImageTexelPointerEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpMemberDecorateIdEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpConstantSizeOfEXT: *hasResult = true; *hasResultType = true; break; case SpvOpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break; case SpvOpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break; case SpvOpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break; @@ -2914,7 +3114,7 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break; case SpvOpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break; case SpvOpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; - case SpvOpTypeCooperativeVectorNV: *hasResult = true; *hasResultType = false; break; + case SpvOpTypeVectorIdEXT: *hasResult = true; *hasResultType = false; break; case SpvOpCooperativeVectorMatrixMulNV: *hasResult = true; *hasResultType = true; break; case SpvOpCooperativeVectorOuterProductAccumulateNV: *hasResult = false; *hasResultType = false; break; case SpvOpCooperativeVectorReduceSumAccumulateNV: *hasResult = false; *hasResultType = false; break; @@ -2922,12 +3122,42 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpCooperativeMatrixConvertNV: *hasResult = true; *hasResultType = true; break; case SpvOpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break; case SpvOpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break; - case SpvOpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; + case SpvOpGroupNonUniformPartitionEXT: *hasResult = true; *hasResultType = true; break; case SpvOpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break; case SpvOpFetchMicroTriangleVertexPositionNV: *hasResult = true; *hasResultType = true; break; case SpvOpFetchMicroTriangleVertexBarycentricNV: *hasResult = true; *hasResultType = true; break; case SpvOpCooperativeVectorLoadNV: *hasResult = true; *hasResultType = true; break; case SpvOpCooperativeVectorStoreNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordFromQueryEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordMissEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordMissMotionEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectGetIntersectionTriangleVertexPositionsEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetRayFlagsEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectSetShaderBindingTableRecordIndexEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectReorderExecuteShaderEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectTraceReorderExecuteEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectTraceMotionReorderExecuteEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpTypeHitObjectEXT: *hasResult = true; *hasResultType = false; break; + case SpvOpReorderThreadWithHintEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpReorderThreadWithHitObjectEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectTraceRayEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectTraceRayMotionEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordEmptyEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectExecuteShaderEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectGetCurrentTimeEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetAttributesEXT: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectGetHitKindEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetPrimitiveIndexEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetGeometryIndexEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetInstanceIdEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetInstanceCustomIndexEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetObjectRayOriginEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetObjectRayDirectionEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetWorldRayDirectionEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetWorldRayOriginEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetObjectToWorldEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetWorldToObjectEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetRayTMaxEXT: *hasResult = true; *hasResultType = true; break; case SpvOpReportIntersectionKHR: *hasResult = true; *hasResultType = true; break; case SpvOpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break; case SpvOpTerminateRayNV: *hasResult = false; *hasResultType = false; break; @@ -2937,8 +3167,14 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; case SpvOpTypeAccelerationStructureKHR: *hasResult = true; *hasResultType = false; break; case SpvOpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; - case SpvOpRayQueryGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case SpvOpRayQueryGetIntersectionClusterIdNV: *hasResult = true; *hasResultType = true; break; case SpvOpHitObjectGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetRayTMinEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetShaderBindingTableRecordIndexEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetShaderRecordBufferHandleEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectIsEmptyEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectIsHitEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectIsMissEXT: *hasResult = true; *hasResultType = true; break; case SpvOpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; case SpvOpCooperativeMatrixLoadNV: *hasResult = true; *hasResultType = true; break; case SpvOpCooperativeMatrixStoreNV: *hasResult = false; *hasResultType = false; break; @@ -3142,24 +3378,24 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; case SpvOpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break; case SpvOpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break; - case SpvOpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatSinCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatCastALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatCastFromIntALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatCastToIntALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatAddALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatSubALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatMulALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatDivALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatGTALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatGEALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatLTALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatLEALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatEQALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatRecipALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatRSqrtALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatCbrtALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatHypotALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpArbitraryFloatSqrtALTERA: *hasResult = true; *hasResultType = true; break; case SpvOpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break; case SpvOpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break; case SpvOpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break; @@ -3187,22 +3423,22 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpAliasDomainDeclINTEL: *hasResult = true; *hasResultType = false; break; case SpvOpAliasScopeDeclINTEL: *hasResult = true; *hasResultType = false; break; case SpvOpAliasScopeListDeclINTEL: *hasResult = true; *hasResultType = false; break; - case SpvOpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedSinINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedCosINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedLogINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFixedExpINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpWritePipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpFPGARegINTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedSqrtALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedRecipALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedRsqrtALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedSinALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedCosALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedSinCosALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedSinPiALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedSinCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedLogALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFixedExpALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpPtrCastToCrossWorkgroupALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpCrossWorkgroupCastToPtrALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpReadPipeBlockingALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpWritePipeBlockingALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpFPGARegALTERA: *hasResult = true; *hasResultType = true; break; case SpvOpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break; case SpvOpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break; case SpvOpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break; @@ -3231,11 +3467,11 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpArithmeticFenceEXT: *hasResult = true; *hasResultType = true; break; - case SpvOpTaskSequenceCreateINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpTaskSequenceAsyncINTEL: *hasResult = false; *hasResultType = false; break; - case SpvOpTaskSequenceGetINTEL: *hasResult = true; *hasResultType = true; break; - case SpvOpTaskSequenceReleaseINTEL: *hasResult = false; *hasResultType = false; break; - case SpvOpTypeTaskSequenceINTEL: *hasResult = true; *hasResultType = false; break; + case SpvOpTaskSequenceCreateALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpTaskSequenceAsyncALTERA: *hasResult = false; *hasResultType = false; break; + case SpvOpTaskSequenceGetALTERA: *hasResult = true; *hasResultType = true; break; + case SpvOpTaskSequenceReleaseALTERA: *hasResult = false; *hasResultType = false; break; + case SpvOpTypeTaskSequenceALTERA: *hasResult = true; *hasResultType = false; break; case SpvOpSubgroupBlockPrefetchINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpSubgroup2DBlockLoadINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpSubgroup2DBlockLoadTransformINTEL: *hasResult = false; *hasResultType = false; break; @@ -3244,6 +3480,7 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpSubgroup2DBlockStoreINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpSubgroupMatrixMultiplyAccumulateINTEL: *hasResult = true; *hasResultType = true; break; case SpvOpBitwiseFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpUntypedVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; case SpvOpConditionalExtensionINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpConditionalEntryPointINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpConditionalCapabilityINTEL: *hasResult = false; *hasResultType = false; break; @@ -3410,6 +3647,7 @@ inline const char* SpvExecutionModeToString(SpvExecutionMode value) { case SpvExecutionModeSampleInterlockUnorderedEXT: return "SampleInterlockUnorderedEXT"; case SpvExecutionModeShadingRateInterlockOrderedEXT: return "ShadingRateInterlockOrderedEXT"; case SpvExecutionModeShadingRateInterlockUnorderedEXT: return "ShadingRateInterlockUnorderedEXT"; + case SpvExecutionModeShader64BitIndexingEXT: return "Shader64BitIndexingEXT"; case SpvExecutionModeSharedLocalMemorySizeINTEL: return "SharedLocalMemorySizeINTEL"; case SpvExecutionModeRoundingModeRTPINTEL: return "RoundingModeRTPINTEL"; case SpvExecutionModeRoundingModeRTNINTEL: return "RoundingModeRTNINTEL"; @@ -3459,9 +3697,10 @@ inline const char* SpvStorageClassToString(SpvStorageClass value) { case SpvStorageClassPhysicalStorageBuffer: return "PhysicalStorageBuffer"; case SpvStorageClassHitObjectAttributeNV: return "HitObjectAttributeNV"; case SpvStorageClassTaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT"; + case SpvStorageClassHitObjectAttributeEXT: return "HitObjectAttributeEXT"; case SpvStorageClassCodeSectionINTEL: return "CodeSectionINTEL"; - case SpvStorageClassDeviceOnlyINTEL: return "DeviceOnlyINTEL"; - case SpvStorageClassHostOnlyINTEL: return "HostOnlyINTEL"; + case SpvStorageClassDeviceOnlyALTERA: return "DeviceOnlyALTERA"; + case SpvStorageClassHostOnlyALTERA: return "HostOnlyALTERA"; default: return "Unknown"; } } @@ -3643,7 +3882,7 @@ inline const char* SpvFunctionParameterAttributeToString(SpvFunctionParameterAtt case SpvFunctionParameterAttributeNoCapture: return "NoCapture"; case SpvFunctionParameterAttributeNoWrite: return "NoWrite"; case SpvFunctionParameterAttributeNoReadWrite: return "NoReadWrite"; - case SpvFunctionParameterAttributeRuntimeAlignedINTEL: return "RuntimeAlignedINTEL"; + case SpvFunctionParameterAttributeRuntimeAlignedALTERA: return "RuntimeAlignedALTERA"; default: return "Unknown"; } } @@ -3712,6 +3951,8 @@ inline const char* SpvDecorationToString(SpvDecoration value) { case SpvDecorationPayloadNodeSparseArrayAMDX: return "PayloadNodeSparseArrayAMDX"; case SpvDecorationPayloadNodeArraySizeAMDX: return "PayloadNodeArraySizeAMDX"; case SpvDecorationPayloadDispatchIndirectAMDX: return "PayloadDispatchIndirectAMDX"; + case SpvDecorationArrayStrideIdEXT: return "ArrayStrideIdEXT"; + case SpvDecorationOffsetIdEXT: return "OffsetIdEXT"; case SpvDecorationOverrideCoverageNV: return "OverrideCoverageNV"; case SpvDecorationPassthroughNV: return "PassthroughNV"; case SpvDecorationViewportRelativeNV: return "ViewportRelativeNV"; @@ -3723,7 +3964,10 @@ inline const char* SpvDecorationToString(SpvDecoration value) { case SpvDecorationNonUniform: return "NonUniform"; case SpvDecorationRestrictPointer: return "RestrictPointer"; case SpvDecorationAliasedPointer: return "AliasedPointer"; + case SpvDecorationMemberOffsetNV: return "MemberOffsetNV"; case SpvDecorationHitObjectShaderRecordBufferNV: return "HitObjectShaderRecordBufferNV"; + case SpvDecorationHitObjectShaderRecordBufferEXT: return "HitObjectShaderRecordBufferEXT"; + case SpvDecorationBankNV: return "BankNV"; case SpvDecorationBindlessSamplerNV: return "BindlessSamplerNV"; case SpvDecorationBindlessImageNV: return "BindlessImageNV"; case SpvDecorationBoundSamplerNV: return "BoundSamplerNV"; @@ -3742,55 +3986,55 @@ inline const char* SpvDecorationToString(SpvDecoration value) { case SpvDecorationUserTypeGOOGLE: return "UserTypeGOOGLE"; case SpvDecorationFunctionRoundingModeINTEL: return "FunctionRoundingModeINTEL"; case SpvDecorationFunctionDenormModeINTEL: return "FunctionDenormModeINTEL"; - case SpvDecorationRegisterINTEL: return "RegisterINTEL"; - case SpvDecorationMemoryINTEL: return "MemoryINTEL"; - case SpvDecorationNumbanksINTEL: return "NumbanksINTEL"; - case SpvDecorationBankwidthINTEL: return "BankwidthINTEL"; - case SpvDecorationMaxPrivateCopiesINTEL: return "MaxPrivateCopiesINTEL"; - case SpvDecorationSinglepumpINTEL: return "SinglepumpINTEL"; - case SpvDecorationDoublepumpINTEL: return "DoublepumpINTEL"; - case SpvDecorationMaxReplicatesINTEL: return "MaxReplicatesINTEL"; - case SpvDecorationSimpleDualPortINTEL: return "SimpleDualPortINTEL"; - case SpvDecorationMergeINTEL: return "MergeINTEL"; - case SpvDecorationBankBitsINTEL: return "BankBitsINTEL"; - case SpvDecorationForcePow2DepthINTEL: return "ForcePow2DepthINTEL"; - case SpvDecorationStridesizeINTEL: return "StridesizeINTEL"; - case SpvDecorationWordsizeINTEL: return "WordsizeINTEL"; - case SpvDecorationTrueDualPortINTEL: return "TrueDualPortINTEL"; - case SpvDecorationBurstCoalesceINTEL: return "BurstCoalesceINTEL"; - case SpvDecorationCacheSizeINTEL: return "CacheSizeINTEL"; - case SpvDecorationDontStaticallyCoalesceINTEL: return "DontStaticallyCoalesceINTEL"; - case SpvDecorationPrefetchINTEL: return "PrefetchINTEL"; - case SpvDecorationStallEnableINTEL: return "StallEnableINTEL"; - case SpvDecorationFuseLoopsInFunctionINTEL: return "FuseLoopsInFunctionINTEL"; - case SpvDecorationMathOpDSPModeINTEL: return "MathOpDSPModeINTEL"; + case SpvDecorationRegisterALTERA: return "RegisterALTERA"; + case SpvDecorationMemoryALTERA: return "MemoryALTERA"; + case SpvDecorationNumbanksALTERA: return "NumbanksALTERA"; + case SpvDecorationBankwidthALTERA: return "BankwidthALTERA"; + case SpvDecorationMaxPrivateCopiesALTERA: return "MaxPrivateCopiesALTERA"; + case SpvDecorationSinglepumpALTERA: return "SinglepumpALTERA"; + case SpvDecorationDoublepumpALTERA: return "DoublepumpALTERA"; + case SpvDecorationMaxReplicatesALTERA: return "MaxReplicatesALTERA"; + case SpvDecorationSimpleDualPortALTERA: return "SimpleDualPortALTERA"; + case SpvDecorationMergeALTERA: return "MergeALTERA"; + case SpvDecorationBankBitsALTERA: return "BankBitsALTERA"; + case SpvDecorationForcePow2DepthALTERA: return "ForcePow2DepthALTERA"; + case SpvDecorationStridesizeALTERA: return "StridesizeALTERA"; + case SpvDecorationWordsizeALTERA: return "WordsizeALTERA"; + case SpvDecorationTrueDualPortALTERA: return "TrueDualPortALTERA"; + case SpvDecorationBurstCoalesceALTERA: return "BurstCoalesceALTERA"; + case SpvDecorationCacheSizeALTERA: return "CacheSizeALTERA"; + case SpvDecorationDontStaticallyCoalesceALTERA: return "DontStaticallyCoalesceALTERA"; + case SpvDecorationPrefetchALTERA: return "PrefetchALTERA"; + case SpvDecorationStallEnableALTERA: return "StallEnableALTERA"; + case SpvDecorationFuseLoopsInFunctionALTERA: return "FuseLoopsInFunctionALTERA"; + case SpvDecorationMathOpDSPModeALTERA: return "MathOpDSPModeALTERA"; case SpvDecorationAliasScopeINTEL: return "AliasScopeINTEL"; case SpvDecorationNoAliasINTEL: return "NoAliasINTEL"; - case SpvDecorationInitiationIntervalINTEL: return "InitiationIntervalINTEL"; - case SpvDecorationMaxConcurrencyINTEL: return "MaxConcurrencyINTEL"; - case SpvDecorationPipelineEnableINTEL: return "PipelineEnableINTEL"; - case SpvDecorationBufferLocationINTEL: return "BufferLocationINTEL"; - case SpvDecorationIOPipeStorageINTEL: return "IOPipeStorageINTEL"; + case SpvDecorationInitiationIntervalALTERA: return "InitiationIntervalALTERA"; + case SpvDecorationMaxConcurrencyALTERA: return "MaxConcurrencyALTERA"; + case SpvDecorationPipelineEnableALTERA: return "PipelineEnableALTERA"; + case SpvDecorationBufferLocationALTERA: return "BufferLocationALTERA"; + case SpvDecorationIOPipeStorageALTERA: return "IOPipeStorageALTERA"; case SpvDecorationFunctionFloatingPointModeINTEL: return "FunctionFloatingPointModeINTEL"; case SpvDecorationSingleElementVectorINTEL: return "SingleElementVectorINTEL"; case SpvDecorationVectorComputeCallableFunctionINTEL: return "VectorComputeCallableFunctionINTEL"; case SpvDecorationMediaBlockIOINTEL: return "MediaBlockIOINTEL"; - case SpvDecorationStallFreeINTEL: return "StallFreeINTEL"; + case SpvDecorationStallFreeALTERA: return "StallFreeALTERA"; case SpvDecorationFPMaxErrorDecorationINTEL: return "FPMaxErrorDecorationINTEL"; - case SpvDecorationLatencyControlLabelINTEL: return "LatencyControlLabelINTEL"; - case SpvDecorationLatencyControlConstraintINTEL: return "LatencyControlConstraintINTEL"; - case SpvDecorationConduitKernelArgumentINTEL: return "ConduitKernelArgumentINTEL"; - case SpvDecorationRegisterMapKernelArgumentINTEL: return "RegisterMapKernelArgumentINTEL"; - case SpvDecorationMMHostInterfaceAddressWidthINTEL: return "MMHostInterfaceAddressWidthINTEL"; - case SpvDecorationMMHostInterfaceDataWidthINTEL: return "MMHostInterfaceDataWidthINTEL"; - case SpvDecorationMMHostInterfaceLatencyINTEL: return "MMHostInterfaceLatencyINTEL"; - case SpvDecorationMMHostInterfaceReadWriteModeINTEL: return "MMHostInterfaceReadWriteModeINTEL"; - case SpvDecorationMMHostInterfaceMaxBurstINTEL: return "MMHostInterfaceMaxBurstINTEL"; - case SpvDecorationMMHostInterfaceWaitRequestINTEL: return "MMHostInterfaceWaitRequestINTEL"; - case SpvDecorationStableKernelArgumentINTEL: return "StableKernelArgumentINTEL"; + case SpvDecorationLatencyControlLabelALTERA: return "LatencyControlLabelALTERA"; + case SpvDecorationLatencyControlConstraintALTERA: return "LatencyControlConstraintALTERA"; + case SpvDecorationConduitKernelArgumentALTERA: return "ConduitKernelArgumentALTERA"; + case SpvDecorationRegisterMapKernelArgumentALTERA: return "RegisterMapKernelArgumentALTERA"; + case SpvDecorationMMHostInterfaceAddressWidthALTERA: return "MMHostInterfaceAddressWidthALTERA"; + case SpvDecorationMMHostInterfaceDataWidthALTERA: return "MMHostInterfaceDataWidthALTERA"; + case SpvDecorationMMHostInterfaceLatencyALTERA: return "MMHostInterfaceLatencyALTERA"; + case SpvDecorationMMHostInterfaceReadWriteModeALTERA: return "MMHostInterfaceReadWriteModeALTERA"; + case SpvDecorationMMHostInterfaceMaxBurstALTERA: return "MMHostInterfaceMaxBurstALTERA"; + case SpvDecorationMMHostInterfaceWaitRequestALTERA: return "MMHostInterfaceWaitRequestALTERA"; + case SpvDecorationStableKernelArgumentALTERA: return "StableKernelArgumentALTERA"; case SpvDecorationHostAccessINTEL: return "HostAccessINTEL"; - case SpvDecorationInitModeINTEL: return "InitModeINTEL"; - case SpvDecorationImplementInRegisterMapINTEL: return "ImplementInRegisterMapINTEL"; + case SpvDecorationInitModeALTERA: return "InitModeALTERA"; + case SpvDecorationImplementInRegisterMapALTERA: return "ImplementInRegisterMapALTERA"; case SpvDecorationConditionalINTEL: return "ConditionalINTEL"; case SpvDecorationCacheControlLoadINTEL: return "CacheControlLoadINTEL"; case SpvDecorationCacheControlStoreINTEL: return "CacheControlStoreINTEL"; @@ -3871,6 +4115,8 @@ inline const char* SpvBuiltInToString(SpvBuiltIn value) { case SpvBuiltInFragStencilRefEXT: return "FragStencilRefEXT"; case SpvBuiltInRemainingRecursionLevelsAMDX: return "RemainingRecursionLevelsAMDX"; case SpvBuiltInShaderIndexAMDX: return "ShaderIndexAMDX"; + case SpvBuiltInSamplerHeapEXT: return "SamplerHeapEXT"; + case SpvBuiltInResourceHeapEXT: return "ResourceHeapEXT"; case SpvBuiltInViewportMaskNV: return "ViewportMaskNV"; case SpvBuiltInSecondaryPositionNV: return "SecondaryPositionNV"; case SpvBuiltInSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; @@ -3949,9 +4195,9 @@ inline const char* SpvGroupOperationToString(SpvGroupOperation value) { case SpvGroupOperationInclusiveScan: return "InclusiveScan"; case SpvGroupOperationExclusiveScan: return "ExclusiveScan"; case SpvGroupOperationClusteredReduce: return "ClusteredReduce"; - case SpvGroupOperationPartitionedReduceNV: return "PartitionedReduceNV"; - case SpvGroupOperationPartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV"; - case SpvGroupOperationPartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV"; + case SpvGroupOperationPartitionedReduceEXT: return "PartitionedReduceEXT"; + case SpvGroupOperationPartitionedInclusiveScanEXT: return "PartitionedInclusiveScanEXT"; + case SpvGroupOperationPartitionedExclusiveScanEXT: return "PartitionedExclusiveScanEXT"; default: return "Unknown"; } } @@ -4098,6 +4344,7 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilityBFloat16TypeKHR: return "BFloat16TypeKHR"; case SpvCapabilityBFloat16DotProductKHR: return "BFloat16DotProductKHR"; case SpvCapabilityBFloat16CooperativeMatrixKHR: return "BFloat16CooperativeMatrixKHR"; + case SpvCapabilityDescriptorHeapEXT: return "DescriptorHeapEXT"; case SpvCapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV"; case SpvCapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV"; case SpvCapabilityShaderViewportIndexLayerEXT: return "ShaderViewportIndexLayerEXT"; @@ -4111,7 +4358,7 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR"; case SpvCapabilityComputeDerivativeGroupQuadsKHR: return "ComputeDerivativeGroupQuadsKHR"; case SpvCapabilityFragmentDensityEXT: return "FragmentDensityEXT"; - case SpvCapabilityGroupNonUniformPartitionedNV: return "GroupNonUniformPartitionedNV"; + case SpvCapabilityGroupNonUniformPartitionedEXT: return "GroupNonUniformPartitionedEXT"; case SpvCapabilityShaderNonUniform: return "ShaderNonUniform"; case SpvCapabilityRuntimeDescriptorArray: return "RuntimeDescriptorArray"; case SpvCapabilityInputAttachmentArrayDynamicIndexing: return "InputAttachmentArrayDynamicIndexing"; @@ -4141,6 +4388,7 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilityDisplacementMicromapNV: return "DisplacementMicromapNV"; case SpvCapabilityRayTracingOpacityMicromapEXT: return "RayTracingOpacityMicromapEXT"; case SpvCapabilityShaderInvocationReorderNV: return "ShaderInvocationReorderNV"; + case SpvCapabilityShaderInvocationReorderEXT: return "ShaderInvocationReorderEXT"; case SpvCapabilityBindlessTextureNV: return "BindlessTextureNV"; case SpvCapabilityRayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR"; case SpvCapabilityCooperativeVectorNV: return "CooperativeVectorNV"; @@ -4149,6 +4397,9 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilityRawAccessChainsNV: return "RawAccessChainsNV"; case SpvCapabilityRayTracingSpheresGeometryNV: return "RayTracingSpheresGeometryNV"; case SpvCapabilityRayTracingLinearSweptSpheresGeometryNV: return "RayTracingLinearSweptSpheresGeometryNV"; + case SpvCapabilityPushConstantBanksNV: return "PushConstantBanksNV"; + case SpvCapabilityLongVectorEXT: return "LongVectorEXT"; + case SpvCapabilityShader64BitIndexingEXT: return "Shader64BitIndexingEXT"; case SpvCapabilityCooperativeMatrixReductionsNV: return "CooperativeMatrixReductionsNV"; case SpvCapabilityCooperativeMatrixConversionsNV: return "CooperativeMatrixConversionsNV"; case SpvCapabilityCooperativeMatrixPerElementOperationsNV: return "CooperativeMatrixPerElementOperationsNV"; @@ -4178,27 +4429,27 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilitySubgroupAvcMotionEstimationChromaINTEL: return "SubgroupAvcMotionEstimationChromaINTEL"; case SpvCapabilityVariableLengthArrayINTEL: return "VariableLengthArrayINTEL"; case SpvCapabilityFunctionFloatControlINTEL: return "FunctionFloatControlINTEL"; - case SpvCapabilityFPGAMemoryAttributesINTEL: return "FPGAMemoryAttributesINTEL"; + case SpvCapabilityFPGAMemoryAttributesALTERA: return "FPGAMemoryAttributesALTERA"; case SpvCapabilityFPFastMathModeINTEL: return "FPFastMathModeINTEL"; - case SpvCapabilityArbitraryPrecisionIntegersINTEL: return "ArbitraryPrecisionIntegersINTEL"; - case SpvCapabilityArbitraryPrecisionFloatingPointINTEL: return "ArbitraryPrecisionFloatingPointINTEL"; + case SpvCapabilityArbitraryPrecisionIntegersALTERA: return "ArbitraryPrecisionIntegersALTERA"; + case SpvCapabilityArbitraryPrecisionFloatingPointALTERA: return "ArbitraryPrecisionFloatingPointALTERA"; case SpvCapabilityUnstructuredLoopControlsINTEL: return "UnstructuredLoopControlsINTEL"; - case SpvCapabilityFPGALoopControlsINTEL: return "FPGALoopControlsINTEL"; + case SpvCapabilityFPGALoopControlsALTERA: return "FPGALoopControlsALTERA"; case SpvCapabilityKernelAttributesINTEL: return "KernelAttributesINTEL"; case SpvCapabilityFPGAKernelAttributesINTEL: return "FPGAKernelAttributesINTEL"; - case SpvCapabilityFPGAMemoryAccessesINTEL: return "FPGAMemoryAccessesINTEL"; - case SpvCapabilityFPGAClusterAttributesINTEL: return "FPGAClusterAttributesINTEL"; - case SpvCapabilityLoopFuseINTEL: return "LoopFuseINTEL"; - case SpvCapabilityFPGADSPControlINTEL: return "FPGADSPControlINTEL"; + case SpvCapabilityFPGAMemoryAccessesALTERA: return "FPGAMemoryAccessesALTERA"; + case SpvCapabilityFPGAClusterAttributesALTERA: return "FPGAClusterAttributesALTERA"; + case SpvCapabilityLoopFuseALTERA: return "LoopFuseALTERA"; + case SpvCapabilityFPGADSPControlALTERA: return "FPGADSPControlALTERA"; case SpvCapabilityMemoryAccessAliasingINTEL: return "MemoryAccessAliasingINTEL"; - case SpvCapabilityFPGAInvocationPipeliningAttributesINTEL: return "FPGAInvocationPipeliningAttributesINTEL"; - case SpvCapabilityFPGABufferLocationINTEL: return "FPGABufferLocationINTEL"; - case SpvCapabilityArbitraryPrecisionFixedPointINTEL: return "ArbitraryPrecisionFixedPointINTEL"; - case SpvCapabilityUSMStorageClassesINTEL: return "USMStorageClassesINTEL"; - case SpvCapabilityRuntimeAlignedAttributeINTEL: return "RuntimeAlignedAttributeINTEL"; - case SpvCapabilityIOPipesINTEL: return "IOPipesINTEL"; - case SpvCapabilityBlockingPipesINTEL: return "BlockingPipesINTEL"; - case SpvCapabilityFPGARegINTEL: return "FPGARegINTEL"; + case SpvCapabilityFPGAInvocationPipeliningAttributesALTERA: return "FPGAInvocationPipeliningAttributesALTERA"; + case SpvCapabilityFPGABufferLocationALTERA: return "FPGABufferLocationALTERA"; + case SpvCapabilityArbitraryPrecisionFixedPointALTERA: return "ArbitraryPrecisionFixedPointALTERA"; + case SpvCapabilityUSMStorageClassesALTERA: return "USMStorageClassesALTERA"; + case SpvCapabilityRuntimeAlignedAttributeALTERA: return "RuntimeAlignedAttributeALTERA"; + case SpvCapabilityIOPipesALTERA: return "IOPipesALTERA"; + case SpvCapabilityBlockingPipesALTERA: return "BlockingPipesALTERA"; + case SpvCapabilityFPGARegALTERA: return "FPGARegALTERA"; case SpvCapabilityDotProductInputAll: return "DotProductInputAll"; case SpvCapabilityDotProductInput4x8Bit: return "DotProductInput4x8Bit"; case SpvCapabilityDotProductInput4x8BitPacked: return "DotProductInput4x8BitPacked"; @@ -4209,6 +4460,7 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilityBitInstructions: return "BitInstructions"; case SpvCapabilityGroupNonUniformRotateKHR: return "GroupNonUniformRotateKHR"; case SpvCapabilityFloatControls2: return "FloatControls2"; + case SpvCapabilityFMAKHR: return "FMAKHR"; case SpvCapabilityAtomicFloat32AddEXT: return "AtomicFloat32AddEXT"; case SpvCapabilityAtomicFloat64AddEXT: return "AtomicFloat64AddEXT"; case SpvCapabilityLongCompositesINTEL: return "LongCompositesINTEL"; @@ -4218,20 +4470,21 @@ inline const char* SpvCapabilityToString(SpvCapability value) { case SpvCapabilityBFloat16ConversionINTEL: return "BFloat16ConversionINTEL"; case SpvCapabilitySplitBarrierINTEL: return "SplitBarrierINTEL"; case SpvCapabilityArithmeticFenceEXT: return "ArithmeticFenceEXT"; - case SpvCapabilityFPGAClusterAttributesV2INTEL: return "FPGAClusterAttributesV2INTEL"; + case SpvCapabilityFPGAClusterAttributesV2ALTERA: return "FPGAClusterAttributesV2ALTERA"; case SpvCapabilityFPGAKernelAttributesv2INTEL: return "FPGAKernelAttributesv2INTEL"; - case SpvCapabilityTaskSequenceINTEL: return "TaskSequenceINTEL"; + case SpvCapabilityTaskSequenceALTERA: return "TaskSequenceALTERA"; case SpvCapabilityFPMaxErrorINTEL: return "FPMaxErrorINTEL"; - case SpvCapabilityFPGALatencyControlINTEL: return "FPGALatencyControlINTEL"; - case SpvCapabilityFPGAArgumentInterfacesINTEL: return "FPGAArgumentInterfacesINTEL"; + case SpvCapabilityFPGALatencyControlALTERA: return "FPGALatencyControlALTERA"; + case SpvCapabilityFPGAArgumentInterfacesALTERA: return "FPGAArgumentInterfacesALTERA"; case SpvCapabilityGlobalVariableHostAccessINTEL: return "GlobalVariableHostAccessINTEL"; - case SpvCapabilityGlobalVariableFPGADecorationsINTEL: return "GlobalVariableFPGADecorationsINTEL"; + case SpvCapabilityGlobalVariableFPGADecorationsALTERA: return "GlobalVariableFPGADecorationsALTERA"; case SpvCapabilitySubgroupBufferPrefetchINTEL: return "SubgroupBufferPrefetchINTEL"; case SpvCapabilitySubgroup2DBlockIOINTEL: return "Subgroup2DBlockIOINTEL"; case SpvCapabilitySubgroup2DBlockTransformINTEL: return "Subgroup2DBlockTransformINTEL"; case SpvCapabilitySubgroup2DBlockTransposeINTEL: return "Subgroup2DBlockTransposeINTEL"; case SpvCapabilitySubgroupMatrixMultiplyAccumulateINTEL: return "SubgroupMatrixMultiplyAccumulateINTEL"; case SpvCapabilityTernaryBitwiseFunctionINTEL: return "TernaryBitwiseFunctionINTEL"; + case SpvCapabilityUntypedVariableLengthArrayINTEL: return "UntypedVariableLengthArrayINTEL"; case SpvCapabilitySpecConditionalINTEL: return "SpecConditionalINTEL"; case SpvCapabilityFunctionVariantsINTEL: return "FunctionVariantsINTEL"; case SpvCapabilityGroupUniformArithmeticKHR: return "GroupUniformArithmeticKHR"; @@ -4348,8 +4601,8 @@ inline const char* SpvTensorClampModeToString(SpvTensorClampMode value) { inline const char* SpvInitializationModeQualifierToString(SpvInitializationModeQualifier value) { switch (value) { - case SpvInitializationModeQualifierInitOnDeviceReprogramINTEL: return "InitOnDeviceReprogramINTEL"; - case SpvInitializationModeQualifierInitOnDeviceResetINTEL: return "InitOnDeviceResetINTEL"; + case SpvInitializationModeQualifierInitOnDeviceReprogramALTERA: return "InitOnDeviceReprogramALTERA"; + case SpvInitializationModeQualifierInitOnDeviceResetALTERA: return "InitOnDeviceResetALTERA"; default: return "Unknown"; } } @@ -4803,12 +5056,14 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpUntypedInBoundsPtrAccessChainKHR: return "OpUntypedInBoundsPtrAccessChainKHR"; case SpvOpUntypedArrayLengthKHR: return "OpUntypedArrayLengthKHR"; case SpvOpUntypedPrefetchKHR: return "OpUntypedPrefetchKHR"; + case SpvOpFmaKHR: return "OpFmaKHR"; case SpvOpSubgroupAllKHR: return "OpSubgroupAllKHR"; case SpvOpSubgroupAnyKHR: return "OpSubgroupAnyKHR"; case SpvOpSubgroupAllEqualKHR: return "OpSubgroupAllEqualKHR"; case SpvOpGroupNonUniformRotateKHR: return "OpGroupNonUniformRotateKHR"; case SpvOpSubgroupReadInvocationKHR: return "OpSubgroupReadInvocationKHR"; case SpvOpExtInstWithForwardRefsKHR: return "OpExtInstWithForwardRefsKHR"; + case SpvOpUntypedGroupAsyncCopyKHR: return "OpUntypedGroupAsyncCopyKHR"; case SpvOpTraceRayKHR: return "OpTraceRayKHR"; case SpvOpExecuteCallableKHR: return "OpExecuteCallableKHR"; case SpvOpConvertUToAccelerationStructureKHR: return "OpConvertUToAccelerationStructureKHR"; @@ -4868,6 +5123,11 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpSpecConstantStringAMDX: return "OpSpecConstantStringAMDX"; case SpvOpGroupNonUniformQuadAllKHR: return "OpGroupNonUniformQuadAllKHR"; case SpvOpGroupNonUniformQuadAnyKHR: return "OpGroupNonUniformQuadAnyKHR"; + case SpvOpTypeBufferEXT: return "OpTypeBufferEXT"; + case SpvOpBufferPointerEXT: return "OpBufferPointerEXT"; + case SpvOpUntypedImageTexelPointerEXT: return "OpUntypedImageTexelPointerEXT"; + case SpvOpMemberDecorateIdEXT: return "OpMemberDecorateIdEXT"; + case SpvOpConstantSizeOfEXT: return "OpConstantSizeOfEXT"; case SpvOpHitObjectRecordHitMotionNV: return "OpHitObjectRecordHitMotionNV"; case SpvOpHitObjectRecordHitWithIndexMotionNV: return "OpHitObjectRecordHitWithIndexMotionNV"; case SpvOpHitObjectRecordMissMotionNV: return "OpHitObjectRecordMissMotionNV"; @@ -4910,12 +5170,42 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpCooperativeMatrixConvertNV: return "OpCooperativeMatrixConvertNV"; case SpvOpEmitMeshTasksEXT: return "OpEmitMeshTasksEXT"; case SpvOpSetMeshOutputsEXT: return "OpSetMeshOutputsEXT"; - case SpvOpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV"; + case SpvOpGroupNonUniformPartitionEXT: return "OpGroupNonUniformPartitionEXT"; case SpvOpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV"; case SpvOpFetchMicroTriangleVertexPositionNV: return "OpFetchMicroTriangleVertexPositionNV"; case SpvOpFetchMicroTriangleVertexBarycentricNV: return "OpFetchMicroTriangleVertexBarycentricNV"; case SpvOpCooperativeVectorLoadNV: return "OpCooperativeVectorLoadNV"; case SpvOpCooperativeVectorStoreNV: return "OpCooperativeVectorStoreNV"; + case SpvOpHitObjectRecordFromQueryEXT: return "OpHitObjectRecordFromQueryEXT"; + case SpvOpHitObjectRecordMissEXT: return "OpHitObjectRecordMissEXT"; + case SpvOpHitObjectRecordMissMotionEXT: return "OpHitObjectRecordMissMotionEXT"; + case SpvOpHitObjectGetIntersectionTriangleVertexPositionsEXT: return "OpHitObjectGetIntersectionTriangleVertexPositionsEXT"; + case SpvOpHitObjectGetRayFlagsEXT: return "OpHitObjectGetRayFlagsEXT"; + case SpvOpHitObjectSetShaderBindingTableRecordIndexEXT: return "OpHitObjectSetShaderBindingTableRecordIndexEXT"; + case SpvOpHitObjectReorderExecuteShaderEXT: return "OpHitObjectReorderExecuteShaderEXT"; + case SpvOpHitObjectTraceReorderExecuteEXT: return "OpHitObjectTraceReorderExecuteEXT"; + case SpvOpHitObjectTraceMotionReorderExecuteEXT: return "OpHitObjectTraceMotionReorderExecuteEXT"; + case SpvOpTypeHitObjectEXT: return "OpTypeHitObjectEXT"; + case SpvOpReorderThreadWithHintEXT: return "OpReorderThreadWithHintEXT"; + case SpvOpReorderThreadWithHitObjectEXT: return "OpReorderThreadWithHitObjectEXT"; + case SpvOpHitObjectTraceRayEXT: return "OpHitObjectTraceRayEXT"; + case SpvOpHitObjectTraceRayMotionEXT: return "OpHitObjectTraceRayMotionEXT"; + case SpvOpHitObjectRecordEmptyEXT: return "OpHitObjectRecordEmptyEXT"; + case SpvOpHitObjectExecuteShaderEXT: return "OpHitObjectExecuteShaderEXT"; + case SpvOpHitObjectGetCurrentTimeEXT: return "OpHitObjectGetCurrentTimeEXT"; + case SpvOpHitObjectGetAttributesEXT: return "OpHitObjectGetAttributesEXT"; + case SpvOpHitObjectGetHitKindEXT: return "OpHitObjectGetHitKindEXT"; + case SpvOpHitObjectGetPrimitiveIndexEXT: return "OpHitObjectGetPrimitiveIndexEXT"; + case SpvOpHitObjectGetGeometryIndexEXT: return "OpHitObjectGetGeometryIndexEXT"; + case SpvOpHitObjectGetInstanceIdEXT: return "OpHitObjectGetInstanceIdEXT"; + case SpvOpHitObjectGetInstanceCustomIndexEXT: return "OpHitObjectGetInstanceCustomIndexEXT"; + case SpvOpHitObjectGetObjectRayOriginEXT: return "OpHitObjectGetObjectRayOriginEXT"; + case SpvOpHitObjectGetObjectRayDirectionEXT: return "OpHitObjectGetObjectRayDirectionEXT"; + case SpvOpHitObjectGetWorldRayDirectionEXT: return "OpHitObjectGetWorldRayDirectionEXT"; + case SpvOpHitObjectGetWorldRayOriginEXT: return "OpHitObjectGetWorldRayOriginEXT"; + case SpvOpHitObjectGetObjectToWorldEXT: return "OpHitObjectGetObjectToWorldEXT"; + case SpvOpHitObjectGetWorldToObjectEXT: return "OpHitObjectGetWorldToObjectEXT"; + case SpvOpHitObjectGetRayTMaxEXT: return "OpHitObjectGetRayTMaxEXT"; case SpvOpReportIntersectionKHR: return "OpReportIntersectionKHR"; case SpvOpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV"; case SpvOpTerminateRayNV: return "OpTerminateRayNV"; @@ -4927,6 +5217,12 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpExecuteCallableNV: return "OpExecuteCallableNV"; case SpvOpRayQueryGetClusterIdNV: return "OpRayQueryGetClusterIdNV"; case SpvOpHitObjectGetClusterIdNV: return "OpHitObjectGetClusterIdNV"; + case SpvOpHitObjectGetRayTMinEXT: return "OpHitObjectGetRayTMinEXT"; + case SpvOpHitObjectGetShaderBindingTableRecordIndexEXT: return "OpHitObjectGetShaderBindingTableRecordIndexEXT"; + case SpvOpHitObjectGetShaderRecordBufferHandleEXT: return "OpHitObjectGetShaderRecordBufferHandleEXT"; + case SpvOpHitObjectIsEmptyEXT: return "OpHitObjectIsEmptyEXT"; + case SpvOpHitObjectIsHitEXT: return "OpHitObjectIsHitEXT"; + case SpvOpHitObjectIsMissEXT: return "OpHitObjectIsMissEXT"; case SpvOpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV"; case SpvOpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV"; case SpvOpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV"; @@ -5130,24 +5426,24 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpVariableLengthArrayINTEL: return "OpVariableLengthArrayINTEL"; case SpvOpSaveMemoryINTEL: return "OpSaveMemoryINTEL"; case SpvOpRestoreMemoryINTEL: return "OpRestoreMemoryINTEL"; - case SpvOpArbitraryFloatSinCosPiINTEL: return "OpArbitraryFloatSinCosPiINTEL"; - case SpvOpArbitraryFloatCastINTEL: return "OpArbitraryFloatCastINTEL"; - case SpvOpArbitraryFloatCastFromIntINTEL: return "OpArbitraryFloatCastFromIntINTEL"; - case SpvOpArbitraryFloatCastToIntINTEL: return "OpArbitraryFloatCastToIntINTEL"; - case SpvOpArbitraryFloatAddINTEL: return "OpArbitraryFloatAddINTEL"; - case SpvOpArbitraryFloatSubINTEL: return "OpArbitraryFloatSubINTEL"; - case SpvOpArbitraryFloatMulINTEL: return "OpArbitraryFloatMulINTEL"; - case SpvOpArbitraryFloatDivINTEL: return "OpArbitraryFloatDivINTEL"; - case SpvOpArbitraryFloatGTINTEL: return "OpArbitraryFloatGTINTEL"; - case SpvOpArbitraryFloatGEINTEL: return "OpArbitraryFloatGEINTEL"; - case SpvOpArbitraryFloatLTINTEL: return "OpArbitraryFloatLTINTEL"; - case SpvOpArbitraryFloatLEINTEL: return "OpArbitraryFloatLEINTEL"; - case SpvOpArbitraryFloatEQINTEL: return "OpArbitraryFloatEQINTEL"; - case SpvOpArbitraryFloatRecipINTEL: return "OpArbitraryFloatRecipINTEL"; - case SpvOpArbitraryFloatRSqrtINTEL: return "OpArbitraryFloatRSqrtINTEL"; - case SpvOpArbitraryFloatCbrtINTEL: return "OpArbitraryFloatCbrtINTEL"; - case SpvOpArbitraryFloatHypotINTEL: return "OpArbitraryFloatHypotINTEL"; - case SpvOpArbitraryFloatSqrtINTEL: return "OpArbitraryFloatSqrtINTEL"; + case SpvOpArbitraryFloatSinCosPiALTERA: return "OpArbitraryFloatSinCosPiALTERA"; + case SpvOpArbitraryFloatCastALTERA: return "OpArbitraryFloatCastALTERA"; + case SpvOpArbitraryFloatCastFromIntALTERA: return "OpArbitraryFloatCastFromIntALTERA"; + case SpvOpArbitraryFloatCastToIntALTERA: return "OpArbitraryFloatCastToIntALTERA"; + case SpvOpArbitraryFloatAddALTERA: return "OpArbitraryFloatAddALTERA"; + case SpvOpArbitraryFloatSubALTERA: return "OpArbitraryFloatSubALTERA"; + case SpvOpArbitraryFloatMulALTERA: return "OpArbitraryFloatMulALTERA"; + case SpvOpArbitraryFloatDivALTERA: return "OpArbitraryFloatDivALTERA"; + case SpvOpArbitraryFloatGTALTERA: return "OpArbitraryFloatGTALTERA"; + case SpvOpArbitraryFloatGEALTERA: return "OpArbitraryFloatGEALTERA"; + case SpvOpArbitraryFloatLTALTERA: return "OpArbitraryFloatLTALTERA"; + case SpvOpArbitraryFloatLEALTERA: return "OpArbitraryFloatLEALTERA"; + case SpvOpArbitraryFloatEQALTERA: return "OpArbitraryFloatEQALTERA"; + case SpvOpArbitraryFloatRecipALTERA: return "OpArbitraryFloatRecipALTERA"; + case SpvOpArbitraryFloatRSqrtALTERA: return "OpArbitraryFloatRSqrtALTERA"; + case SpvOpArbitraryFloatCbrtALTERA: return "OpArbitraryFloatCbrtALTERA"; + case SpvOpArbitraryFloatHypotALTERA: return "OpArbitraryFloatHypotALTERA"; + case SpvOpArbitraryFloatSqrtALTERA: return "OpArbitraryFloatSqrtALTERA"; case SpvOpArbitraryFloatLogINTEL: return "OpArbitraryFloatLogINTEL"; case SpvOpArbitraryFloatLog2INTEL: return "OpArbitraryFloatLog2INTEL"; case SpvOpArbitraryFloatLog10INTEL: return "OpArbitraryFloatLog10INTEL"; @@ -5175,22 +5471,22 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpAliasDomainDeclINTEL: return "OpAliasDomainDeclINTEL"; case SpvOpAliasScopeDeclINTEL: return "OpAliasScopeDeclINTEL"; case SpvOpAliasScopeListDeclINTEL: return "OpAliasScopeListDeclINTEL"; - case SpvOpFixedSqrtINTEL: return "OpFixedSqrtINTEL"; - case SpvOpFixedRecipINTEL: return "OpFixedRecipINTEL"; - case SpvOpFixedRsqrtINTEL: return "OpFixedRsqrtINTEL"; - case SpvOpFixedSinINTEL: return "OpFixedSinINTEL"; - case SpvOpFixedCosINTEL: return "OpFixedCosINTEL"; - case SpvOpFixedSinCosINTEL: return "OpFixedSinCosINTEL"; - case SpvOpFixedSinPiINTEL: return "OpFixedSinPiINTEL"; - case SpvOpFixedCosPiINTEL: return "OpFixedCosPiINTEL"; - case SpvOpFixedSinCosPiINTEL: return "OpFixedSinCosPiINTEL"; - case SpvOpFixedLogINTEL: return "OpFixedLogINTEL"; - case SpvOpFixedExpINTEL: return "OpFixedExpINTEL"; - case SpvOpPtrCastToCrossWorkgroupINTEL: return "OpPtrCastToCrossWorkgroupINTEL"; - case SpvOpCrossWorkgroupCastToPtrINTEL: return "OpCrossWorkgroupCastToPtrINTEL"; - case SpvOpReadPipeBlockingINTEL: return "OpReadPipeBlockingINTEL"; - case SpvOpWritePipeBlockingINTEL: return "OpWritePipeBlockingINTEL"; - case SpvOpFPGARegINTEL: return "OpFPGARegINTEL"; + case SpvOpFixedSqrtALTERA: return "OpFixedSqrtALTERA"; + case SpvOpFixedRecipALTERA: return "OpFixedRecipALTERA"; + case SpvOpFixedRsqrtALTERA: return "OpFixedRsqrtALTERA"; + case SpvOpFixedSinALTERA: return "OpFixedSinALTERA"; + case SpvOpFixedCosALTERA: return "OpFixedCosALTERA"; + case SpvOpFixedSinCosALTERA: return "OpFixedSinCosALTERA"; + case SpvOpFixedSinPiALTERA: return "OpFixedSinPiALTERA"; + case SpvOpFixedCosPiALTERA: return "OpFixedCosPiALTERA"; + case SpvOpFixedSinCosPiALTERA: return "OpFixedSinCosPiALTERA"; + case SpvOpFixedLogALTERA: return "OpFixedLogALTERA"; + case SpvOpFixedExpALTERA: return "OpFixedExpALTERA"; + case SpvOpPtrCastToCrossWorkgroupALTERA: return "OpPtrCastToCrossWorkgroupALTERA"; + case SpvOpCrossWorkgroupCastToPtrALTERA: return "OpCrossWorkgroupCastToPtrALTERA"; + case SpvOpReadPipeBlockingALTERA: return "OpReadPipeBlockingALTERA"; + case SpvOpWritePipeBlockingALTERA: return "OpWritePipeBlockingALTERA"; + case SpvOpFPGARegALTERA: return "OpFPGARegALTERA"; case SpvOpRayQueryGetRayTMinKHR: return "OpRayQueryGetRayTMinKHR"; case SpvOpRayQueryGetRayFlagsKHR: return "OpRayQueryGetRayFlagsKHR"; case SpvOpRayQueryGetIntersectionTKHR: return "OpRayQueryGetIntersectionTKHR"; @@ -5219,11 +5515,11 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpControlBarrierArriveINTEL: return "OpControlBarrierArriveINTEL"; case SpvOpControlBarrierWaitINTEL: return "OpControlBarrierWaitINTEL"; case SpvOpArithmeticFenceEXT: return "OpArithmeticFenceEXT"; - case SpvOpTaskSequenceCreateINTEL: return "OpTaskSequenceCreateINTEL"; - case SpvOpTaskSequenceAsyncINTEL: return "OpTaskSequenceAsyncINTEL"; - case SpvOpTaskSequenceGetINTEL: return "OpTaskSequenceGetINTEL"; - case SpvOpTaskSequenceReleaseINTEL: return "OpTaskSequenceReleaseINTEL"; - case SpvOpTypeTaskSequenceINTEL: return "OpTypeTaskSequenceINTEL"; + case SpvOpTaskSequenceCreateALTERA: return "OpTaskSequenceCreateALTERA"; + case SpvOpTaskSequenceAsyncALTERA: return "OpTaskSequenceAsyncALTERA"; + case SpvOpTaskSequenceGetALTERA: return "OpTaskSequenceGetALTERA"; + case SpvOpTaskSequenceReleaseALTERA: return "OpTaskSequenceReleaseALTERA"; + case SpvOpTypeTaskSequenceALTERA: return "OpTypeTaskSequenceALTERA"; case SpvOpSubgroupBlockPrefetchINTEL: return "OpSubgroupBlockPrefetchINTEL"; case SpvOpSubgroup2DBlockLoadINTEL: return "OpSubgroup2DBlockLoadINTEL"; case SpvOpSubgroup2DBlockLoadTransformINTEL: return "OpSubgroup2DBlockLoadTransformINTEL"; @@ -5232,6 +5528,7 @@ inline const char* SpvOpToString(SpvOp value) { case SpvOpSubgroup2DBlockStoreINTEL: return "OpSubgroup2DBlockStoreINTEL"; case SpvOpSubgroupMatrixMultiplyAccumulateINTEL: return "OpSubgroupMatrixMultiplyAccumulateINTEL"; case SpvOpBitwiseFunctionINTEL: return "OpBitwiseFunctionINTEL"; + case SpvOpUntypedVariableLengthArrayINTEL: return "OpUntypedVariableLengthArrayINTEL"; case SpvOpConditionalExtensionINTEL: return "OpConditionalExtensionINTEL"; case SpvOpConditionalEntryPointINTEL: return "OpConditionalEntryPointINTEL"; case SpvOpConditionalCapabilityINTEL: return "OpConditionalCapabilityINTEL"; diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.hpp b/third_party/spirv-headers/include/spirv/unified1/spirv.hpp index 33ff9253dd..7d30407e97 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.hpp +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.hpp @@ -191,6 +191,7 @@ enum ExecutionMode { ExecutionModeSampleInterlockUnorderedEXT = 5369, ExecutionModeShadingRateInterlockOrderedEXT = 5370, ExecutionModeShadingRateInterlockUnorderedEXT = 5371, + ExecutionModeShader64BitIndexingEXT = 5427, ExecutionModeSharedLocalMemorySizeINTEL = 5618, ExecutionModeRoundingModeRTPINTEL = 5620, ExecutionModeRoundingModeRTNINTEL = 5621, @@ -245,8 +246,11 @@ enum StorageClass { StorageClassPhysicalStorageBufferEXT = 5349, StorageClassHitObjectAttributeNV = 5385, StorageClassTaskPayloadWorkgroupEXT = 5402, + StorageClassHitObjectAttributeEXT = 5411, StorageClassCodeSectionINTEL = 5605, + StorageClassDeviceOnlyALTERA = 5936, StorageClassDeviceOnlyINTEL = 5936, + StorageClassHostOnlyALTERA = 5937, StorageClassHostOnlyINTEL = 5937, StorageClassMax = 0x7fffffff, }; @@ -485,6 +489,7 @@ enum FunctionParameterAttribute { FunctionParameterAttributeNoCapture = 5, FunctionParameterAttributeNoWrite = 6, FunctionParameterAttributeNoReadWrite = 7, + FunctionParameterAttributeRuntimeAlignedALTERA = 5940, FunctionParameterAttributeRuntimeAlignedINTEL = 5940, FunctionParameterAttributeMax = 0x7fffffff, }; @@ -552,6 +557,8 @@ enum Decoration { DecorationPayloadNodeSparseArrayAMDX = 5099, DecorationPayloadNodeArraySizeAMDX = 5100, DecorationPayloadDispatchIndirectAMDX = 5105, + DecorationArrayStrideIdEXT = 5124, + DecorationOffsetIdEXT = 5125, DecorationOverrideCoverageNV = 5248, DecorationPassthroughNV = 5250, DecorationViewportRelativeNV = 5252, @@ -568,7 +575,10 @@ enum Decoration { DecorationRestrictPointerEXT = 5355, DecorationAliasedPointer = 5356, DecorationAliasedPointerEXT = 5356, + DecorationMemberOffsetNV = 5358, DecorationHitObjectShaderRecordBufferNV = 5386, + DecorationHitObjectShaderRecordBufferEXT = 5389, + DecorationBankNV = 5397, DecorationBindlessSamplerNV = 5398, DecorationBindlessImageNV = 5399, DecorationBoundSamplerNV = 5400, @@ -589,54 +599,95 @@ enum Decoration { DecorationUserTypeGOOGLE = 5636, DecorationFunctionRoundingModeINTEL = 5822, DecorationFunctionDenormModeINTEL = 5823, + DecorationRegisterALTERA = 5825, DecorationRegisterINTEL = 5825, + DecorationMemoryALTERA = 5826, DecorationMemoryINTEL = 5826, + DecorationNumbanksALTERA = 5827, DecorationNumbanksINTEL = 5827, + DecorationBankwidthALTERA = 5828, DecorationBankwidthINTEL = 5828, + DecorationMaxPrivateCopiesALTERA = 5829, DecorationMaxPrivateCopiesINTEL = 5829, + DecorationSinglepumpALTERA = 5830, DecorationSinglepumpINTEL = 5830, + DecorationDoublepumpALTERA = 5831, DecorationDoublepumpINTEL = 5831, + DecorationMaxReplicatesALTERA = 5832, DecorationMaxReplicatesINTEL = 5832, + DecorationSimpleDualPortALTERA = 5833, DecorationSimpleDualPortINTEL = 5833, + DecorationMergeALTERA = 5834, DecorationMergeINTEL = 5834, + DecorationBankBitsALTERA = 5835, DecorationBankBitsINTEL = 5835, + DecorationForcePow2DepthALTERA = 5836, DecorationForcePow2DepthINTEL = 5836, + DecorationStridesizeALTERA = 5883, DecorationStridesizeINTEL = 5883, + DecorationWordsizeALTERA = 5884, DecorationWordsizeINTEL = 5884, + DecorationTrueDualPortALTERA = 5885, DecorationTrueDualPortINTEL = 5885, + DecorationBurstCoalesceALTERA = 5899, DecorationBurstCoalesceINTEL = 5899, + DecorationCacheSizeALTERA = 5900, DecorationCacheSizeINTEL = 5900, + DecorationDontStaticallyCoalesceALTERA = 5901, DecorationDontStaticallyCoalesceINTEL = 5901, + DecorationPrefetchALTERA = 5902, DecorationPrefetchINTEL = 5902, + DecorationStallEnableALTERA = 5905, DecorationStallEnableINTEL = 5905, + DecorationFuseLoopsInFunctionALTERA = 5907, DecorationFuseLoopsInFunctionINTEL = 5907, + DecorationMathOpDSPModeALTERA = 5909, DecorationMathOpDSPModeINTEL = 5909, DecorationAliasScopeINTEL = 5914, DecorationNoAliasINTEL = 5915, + DecorationInitiationIntervalALTERA = 5917, DecorationInitiationIntervalINTEL = 5917, + DecorationMaxConcurrencyALTERA = 5918, DecorationMaxConcurrencyINTEL = 5918, + DecorationPipelineEnableALTERA = 5919, DecorationPipelineEnableINTEL = 5919, + DecorationBufferLocationALTERA = 5921, DecorationBufferLocationINTEL = 5921, + DecorationIOPipeStorageALTERA = 5944, DecorationIOPipeStorageINTEL = 5944, DecorationFunctionFloatingPointModeINTEL = 6080, DecorationSingleElementVectorINTEL = 6085, DecorationVectorComputeCallableFunctionINTEL = 6087, DecorationMediaBlockIOINTEL = 6140, + DecorationStallFreeALTERA = 6151, DecorationStallFreeINTEL = 6151, DecorationFPMaxErrorDecorationINTEL = 6170, + DecorationLatencyControlLabelALTERA = 6172, DecorationLatencyControlLabelINTEL = 6172, + DecorationLatencyControlConstraintALTERA = 6173, DecorationLatencyControlConstraintINTEL = 6173, + DecorationConduitKernelArgumentALTERA = 6175, DecorationConduitKernelArgumentINTEL = 6175, + DecorationRegisterMapKernelArgumentALTERA = 6176, DecorationRegisterMapKernelArgumentINTEL = 6176, + DecorationMMHostInterfaceAddressWidthALTERA = 6177, DecorationMMHostInterfaceAddressWidthINTEL = 6177, + DecorationMMHostInterfaceDataWidthALTERA = 6178, DecorationMMHostInterfaceDataWidthINTEL = 6178, + DecorationMMHostInterfaceLatencyALTERA = 6179, DecorationMMHostInterfaceLatencyINTEL = 6179, + DecorationMMHostInterfaceReadWriteModeALTERA = 6180, DecorationMMHostInterfaceReadWriteModeINTEL = 6180, + DecorationMMHostInterfaceMaxBurstALTERA = 6181, DecorationMMHostInterfaceMaxBurstINTEL = 6181, + DecorationMMHostInterfaceWaitRequestALTERA = 6182, DecorationMMHostInterfaceWaitRequestINTEL = 6182, + DecorationStableKernelArgumentALTERA = 6183, DecorationStableKernelArgumentINTEL = 6183, DecorationHostAccessINTEL = 6188, + DecorationInitModeALTERA = 6190, DecorationInitModeINTEL = 6190, + DecorationImplementInRegisterMapALTERA = 6191, DecorationImplementInRegisterMapINTEL = 6191, DecorationConditionalINTEL = 6247, DecorationCacheControlLoadINTEL = 6442, @@ -721,6 +772,8 @@ enum BuiltIn { BuiltInFragStencilRefEXT = 5014, BuiltInRemainingRecursionLevelsAMDX = 5021, BuiltInShaderIndexAMDX = 5073, + BuiltInSamplerHeapEXT = 5122, + BuiltInResourceHeapEXT = 5123, BuiltInViewportMaskNV = 5253, BuiltInSecondaryPositionNV = 5257, BuiltInSecondaryViewportMaskNV = 5258, @@ -818,15 +871,25 @@ enum LoopControlShift { LoopControlIterationMultipleShift = 6, LoopControlPeelCountShift = 7, LoopControlPartialCountShift = 8, + LoopControlInitiationIntervalALTERAShift = 16, LoopControlInitiationIntervalINTELShift = 16, + LoopControlMaxConcurrencyALTERAShift = 17, LoopControlMaxConcurrencyINTELShift = 17, + LoopControlDependencyArrayALTERAShift = 18, LoopControlDependencyArrayINTELShift = 18, + LoopControlPipelineEnableALTERAShift = 19, LoopControlPipelineEnableINTELShift = 19, + LoopControlLoopCoalesceALTERAShift = 20, LoopControlLoopCoalesceINTELShift = 20, + LoopControlMaxInterleavingALTERAShift = 21, LoopControlMaxInterleavingINTELShift = 21, + LoopControlSpeculatedIterationsALTERAShift = 22, LoopControlSpeculatedIterationsINTELShift = 22, + LoopControlNoFusionALTERAShift = 23, LoopControlNoFusionINTELShift = 23, + LoopControlLoopCountALTERAShift = 24, LoopControlLoopCountINTELShift = 24, + LoopControlMaxReinvocationDelayALTERAShift = 25, LoopControlMaxReinvocationDelayINTELShift = 25, LoopControlMax = 0x7fffffff, }; @@ -842,15 +905,25 @@ enum LoopControlMask { LoopControlIterationMultipleMask = 0x00000040, LoopControlPeelCountMask = 0x00000080, LoopControlPartialCountMask = 0x00000100, + LoopControlInitiationIntervalALTERAMask = 0x00010000, LoopControlInitiationIntervalINTELMask = 0x00010000, + LoopControlMaxConcurrencyALTERAMask = 0x00020000, LoopControlMaxConcurrencyINTELMask = 0x00020000, + LoopControlDependencyArrayALTERAMask = 0x00040000, LoopControlDependencyArrayINTELMask = 0x00040000, + LoopControlPipelineEnableALTERAMask = 0x00080000, LoopControlPipelineEnableINTELMask = 0x00080000, + LoopControlLoopCoalesceALTERAMask = 0x00100000, LoopControlLoopCoalesceINTELMask = 0x00100000, + LoopControlMaxInterleavingALTERAMask = 0x00200000, LoopControlMaxInterleavingINTELMask = 0x00200000, + LoopControlSpeculatedIterationsALTERAMask = 0x00400000, LoopControlSpeculatedIterationsINTELMask = 0x00400000, + LoopControlNoFusionALTERAMask = 0x00800000, LoopControlNoFusionINTELMask = 0x00800000, + LoopControlLoopCountALTERAMask = 0x01000000, LoopControlLoopCountINTELMask = 0x01000000, + LoopControlMaxReinvocationDelayALTERAMask = 0x02000000, LoopControlMaxReinvocationDelayINTELMask = 0x02000000, }; @@ -963,8 +1036,11 @@ enum GroupOperation { GroupOperationInclusiveScan = 1, GroupOperationExclusiveScan = 2, GroupOperationClusteredReduce = 3, + GroupOperationPartitionedReduceEXT = 6, GroupOperationPartitionedReduceNV = 6, + GroupOperationPartitionedInclusiveScanEXT = 7, GroupOperationPartitionedInclusiveScanNV = 7, + GroupOperationPartitionedExclusiveScanEXT = 8, GroupOperationPartitionedExclusiveScanNV = 8, GroupOperationMax = 0x7fffffff, }; @@ -1120,6 +1196,7 @@ enum Capability { CapabilityBFloat16TypeKHR = 5116, CapabilityBFloat16DotProductKHR = 5117, CapabilityBFloat16CooperativeMatrixKHR = 5118, + CapabilityDescriptorHeapEXT = 5128, CapabilitySampleMaskOverrideCoverageNV = 5249, CapabilityGeometryShaderPassthroughNV = 5251, CapabilityShaderViewportIndexLayerEXT = 5254, @@ -1137,6 +1214,7 @@ enum Capability { CapabilityComputeDerivativeGroupQuadsNV = 5288, CapabilityFragmentDensityEXT = 5291, CapabilityShadingRateNV = 5291, + CapabilityGroupNonUniformPartitionedEXT = 5297, CapabilityGroupNonUniformPartitionedNV = 5297, CapabilityShaderNonUniform = 5301, CapabilityShaderNonUniformEXT = 5301, @@ -1184,6 +1262,7 @@ enum Capability { CapabilityDisplacementMicromapNV = 5380, CapabilityRayTracingOpacityMicromapEXT = 5381, CapabilityShaderInvocationReorderNV = 5383, + CapabilityShaderInvocationReorderEXT = 5388, CapabilityBindlessTextureNV = 5390, CapabilityRayQueryPositionFetchKHR = 5391, CapabilityCooperativeVectorNV = 5394, @@ -1192,6 +1271,9 @@ enum Capability { CapabilityRawAccessChainsNV = 5414, CapabilityRayTracingSpheresGeometryNV = 5418, CapabilityRayTracingLinearSweptSpheresGeometryNV = 5419, + CapabilityPushConstantBanksNV = 5423, + CapabilityLongVectorEXT = 5425, + CapabilityShader64BitIndexingEXT = 5426, CapabilityCooperativeMatrixReductionsNV = 5430, CapabilityCooperativeMatrixConversionsNV = 5431, CapabilityCooperativeMatrixPerElementOperationsNV = 5432, @@ -1221,26 +1303,42 @@ enum Capability { CapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698, CapabilityVariableLengthArrayINTEL = 5817, CapabilityFunctionFloatControlINTEL = 5821, + CapabilityFPGAMemoryAttributesALTERA = 5824, CapabilityFPGAMemoryAttributesINTEL = 5824, CapabilityFPFastMathModeINTEL = 5837, + CapabilityArbitraryPrecisionIntegersALTERA = 5844, CapabilityArbitraryPrecisionIntegersINTEL = 5844, + CapabilityArbitraryPrecisionFloatingPointALTERA = 5845, CapabilityArbitraryPrecisionFloatingPointINTEL = 5845, CapabilityUnstructuredLoopControlsINTEL = 5886, + CapabilityFPGALoopControlsALTERA = 5888, CapabilityFPGALoopControlsINTEL = 5888, CapabilityKernelAttributesINTEL = 5892, CapabilityFPGAKernelAttributesINTEL = 5897, + CapabilityFPGAMemoryAccessesALTERA = 5898, CapabilityFPGAMemoryAccessesINTEL = 5898, + CapabilityFPGAClusterAttributesALTERA = 5904, CapabilityFPGAClusterAttributesINTEL = 5904, + CapabilityLoopFuseALTERA = 5906, CapabilityLoopFuseINTEL = 5906, + CapabilityFPGADSPControlALTERA = 5908, CapabilityFPGADSPControlINTEL = 5908, CapabilityMemoryAccessAliasingINTEL = 5910, + CapabilityFPGAInvocationPipeliningAttributesALTERA = 5916, CapabilityFPGAInvocationPipeliningAttributesINTEL = 5916, + CapabilityFPGABufferLocationALTERA = 5920, CapabilityFPGABufferLocationINTEL = 5920, + CapabilityArbitraryPrecisionFixedPointALTERA = 5922, CapabilityArbitraryPrecisionFixedPointINTEL = 5922, + CapabilityUSMStorageClassesALTERA = 5935, CapabilityUSMStorageClassesINTEL = 5935, + CapabilityRuntimeAlignedAttributeALTERA = 5939, CapabilityRuntimeAlignedAttributeINTEL = 5939, + CapabilityIOPipesALTERA = 5943, CapabilityIOPipesINTEL = 5943, + CapabilityBlockingPipesALTERA = 5945, CapabilityBlockingPipesINTEL = 5945, + CapabilityFPGARegALTERA = 5948, CapabilityFPGARegINTEL = 5948, CapabilityDotProductInputAll = 6016, CapabilityDotProductInputAllKHR = 6016, @@ -1256,6 +1354,7 @@ enum Capability { CapabilityBitInstructions = 6025, CapabilityGroupNonUniformRotateKHR = 6026, CapabilityFloatControls2 = 6029, + CapabilityFMAKHR = 6030, CapabilityAtomicFloat32AddEXT = 6033, CapabilityAtomicFloat64AddEXT = 6034, CapabilityLongCompositesINTEL = 6089, @@ -1266,13 +1365,18 @@ enum Capability { CapabilityBFloat16ConversionINTEL = 6115, CapabilitySplitBarrierINTEL = 6141, CapabilityArithmeticFenceEXT = 6144, + CapabilityFPGAClusterAttributesV2ALTERA = 6150, CapabilityFPGAClusterAttributesV2INTEL = 6150, CapabilityFPGAKernelAttributesv2INTEL = 6161, + CapabilityTaskSequenceALTERA = 6162, CapabilityTaskSequenceINTEL = 6162, CapabilityFPMaxErrorINTEL = 6169, + CapabilityFPGALatencyControlALTERA = 6171, CapabilityFPGALatencyControlINTEL = 6171, + CapabilityFPGAArgumentInterfacesALTERA = 6174, CapabilityFPGAArgumentInterfacesINTEL = 6174, CapabilityGlobalVariableHostAccessINTEL = 6187, + CapabilityGlobalVariableFPGADecorationsALTERA = 6189, CapabilityGlobalVariableFPGADecorationsINTEL = 6189, CapabilitySubgroupBufferPrefetchINTEL = 6220, CapabilitySubgroup2DBlockIOINTEL = 6228, @@ -1280,6 +1384,7 @@ enum Capability { CapabilitySubgroup2DBlockTransposeINTEL = 6230, CapabilitySubgroupMatrixMultiplyAccumulateINTEL = 6236, CapabilityTernaryBitwiseFunctionINTEL = 6241, + CapabilityUntypedVariableLengthArrayINTEL = 6243, CapabilitySpecConditionalINTEL = 6245, CapabilityFunctionVariantsINTEL = 6246, CapabilityGroupUniformArithmeticKHR = 6400, @@ -1483,7 +1588,9 @@ enum TensorOperandsMask { }; enum InitializationModeQualifier { + InitializationModeQualifierInitOnDeviceReprogramALTERA = 0, InitializationModeQualifierInitOnDeviceReprogramINTEL = 0, + InitializationModeQualifierInitOnDeviceResetALTERA = 1, InitializationModeQualifierInitOnDeviceResetINTEL = 1, InitializationModeQualifierMax = 0x7fffffff, }; @@ -1970,12 +2077,14 @@ enum Op { OpUntypedInBoundsPtrAccessChainKHR = 4424, OpUntypedArrayLengthKHR = 4425, OpUntypedPrefetchKHR = 4426, + OpFmaKHR = 4427, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, OpGroupNonUniformRotateKHR = 4431, OpSubgroupReadInvocationKHR = 4432, OpExtInstWithForwardRefsKHR = 4433, + OpUntypedGroupAsyncCopyKHR = 4434, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, OpConvertUToAccelerationStructureKHR = 4447, @@ -2041,6 +2150,11 @@ enum Op { OpSpecConstantStringAMDX = 5104, OpGroupNonUniformQuadAllKHR = 5110, OpGroupNonUniformQuadAnyKHR = 5111, + OpTypeBufferEXT = 5115, + OpBufferPointerEXT = 5119, + OpUntypedImageTexelPointerEXT = 5126, + OpMemberDecorateIdEXT = 5127, + OpConstantSizeOfEXT = 5129, OpHitObjectRecordHitMotionNV = 5249, OpHitObjectRecordHitWithIndexMotionNV = 5250, OpHitObjectRecordMissMotionNV = 5251, @@ -2076,6 +2190,7 @@ enum Op { OpTypeHitObjectNV = 5281, OpImageSampleFootprintNV = 5283, OpTypeCooperativeVectorNV = 5288, + OpTypeVectorIdEXT = 5288, OpCooperativeVectorMatrixMulNV = 5289, OpCooperativeVectorOuterProductAccumulateNV = 5290, OpCooperativeVectorReduceSumAccumulateNV = 5291, @@ -2083,12 +2198,43 @@ enum Op { OpCooperativeMatrixConvertNV = 5293, OpEmitMeshTasksEXT = 5294, OpSetMeshOutputsEXT = 5295, + OpGroupNonUniformPartitionEXT = 5296, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, OpFetchMicroTriangleVertexPositionNV = 5300, OpFetchMicroTriangleVertexBarycentricNV = 5301, OpCooperativeVectorLoadNV = 5302, OpCooperativeVectorStoreNV = 5303, + OpHitObjectRecordFromQueryEXT = 5304, + OpHitObjectRecordMissEXT = 5305, + OpHitObjectRecordMissMotionEXT = 5306, + OpHitObjectGetIntersectionTriangleVertexPositionsEXT = 5307, + OpHitObjectGetRayFlagsEXT = 5308, + OpHitObjectSetShaderBindingTableRecordIndexEXT = 5309, + OpHitObjectReorderExecuteShaderEXT = 5310, + OpHitObjectTraceReorderExecuteEXT = 5311, + OpHitObjectTraceMotionReorderExecuteEXT = 5312, + OpTypeHitObjectEXT = 5313, + OpReorderThreadWithHintEXT = 5314, + OpReorderThreadWithHitObjectEXT = 5315, + OpHitObjectTraceRayEXT = 5316, + OpHitObjectTraceRayMotionEXT = 5317, + OpHitObjectRecordEmptyEXT = 5318, + OpHitObjectExecuteShaderEXT = 5319, + OpHitObjectGetCurrentTimeEXT = 5320, + OpHitObjectGetAttributesEXT = 5321, + OpHitObjectGetHitKindEXT = 5322, + OpHitObjectGetPrimitiveIndexEXT = 5323, + OpHitObjectGetGeometryIndexEXT = 5324, + OpHitObjectGetInstanceIdEXT = 5325, + OpHitObjectGetInstanceCustomIndexEXT = 5326, + OpHitObjectGetObjectRayOriginEXT = 5327, + OpHitObjectGetObjectRayDirectionEXT = 5328, + OpHitObjectGetWorldRayDirectionEXT = 5329, + OpHitObjectGetWorldRayOriginEXT = 5330, + OpHitObjectGetObjectToWorldEXT = 5331, + OpHitObjectGetWorldToObjectEXT = 5332, + OpHitObjectGetRayTMaxEXT = 5333, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, @@ -2101,7 +2247,14 @@ enum Op { OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, OpRayQueryGetClusterIdNV = 5345, + OpRayQueryGetIntersectionClusterIdNV = 5345, OpHitObjectGetClusterIdNV = 5346, + OpHitObjectGetRayTMinEXT = 5347, + OpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, + OpHitObjectGetShaderRecordBufferHandleEXT = 5349, + OpHitObjectIsEmptyEXT = 5350, + OpHitObjectIsHitEXT = 5351, + OpHitObjectIsMissEXT = 5352, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixStoreNV = 5360, @@ -2308,23 +2461,41 @@ enum Op { OpVariableLengthArrayINTEL = 5818, OpSaveMemoryINTEL = 5819, OpRestoreMemoryINTEL = 5820, + OpArbitraryFloatSinCosPiALTERA = 5840, OpArbitraryFloatSinCosPiINTEL = 5840, + OpArbitraryFloatCastALTERA = 5841, OpArbitraryFloatCastINTEL = 5841, + OpArbitraryFloatCastFromIntALTERA = 5842, OpArbitraryFloatCastFromIntINTEL = 5842, + OpArbitraryFloatCastToIntALTERA = 5843, OpArbitraryFloatCastToIntINTEL = 5843, + OpArbitraryFloatAddALTERA = 5846, OpArbitraryFloatAddINTEL = 5846, + OpArbitraryFloatSubALTERA = 5847, OpArbitraryFloatSubINTEL = 5847, + OpArbitraryFloatMulALTERA = 5848, OpArbitraryFloatMulINTEL = 5848, + OpArbitraryFloatDivALTERA = 5849, OpArbitraryFloatDivINTEL = 5849, + OpArbitraryFloatGTALTERA = 5850, OpArbitraryFloatGTINTEL = 5850, + OpArbitraryFloatGEALTERA = 5851, OpArbitraryFloatGEINTEL = 5851, + OpArbitraryFloatLTALTERA = 5852, OpArbitraryFloatLTINTEL = 5852, + OpArbitraryFloatLEALTERA = 5853, OpArbitraryFloatLEINTEL = 5853, + OpArbitraryFloatEQALTERA = 5854, OpArbitraryFloatEQINTEL = 5854, + OpArbitraryFloatRecipALTERA = 5855, OpArbitraryFloatRecipINTEL = 5855, + OpArbitraryFloatRSqrtALTERA = 5856, OpArbitraryFloatRSqrtINTEL = 5856, + OpArbitraryFloatCbrtALTERA = 5857, OpArbitraryFloatCbrtINTEL = 5857, + OpArbitraryFloatHypotALTERA = 5858, OpArbitraryFloatHypotINTEL = 5858, + OpArbitraryFloatSqrtALTERA = 5859, OpArbitraryFloatSqrtINTEL = 5859, OpArbitraryFloatLogINTEL = 5860, OpArbitraryFloatLog2INTEL = 5861, @@ -2353,21 +2524,37 @@ enum Op { OpAliasDomainDeclINTEL = 5911, OpAliasScopeDeclINTEL = 5912, OpAliasScopeListDeclINTEL = 5913, + OpFixedSqrtALTERA = 5923, OpFixedSqrtINTEL = 5923, + OpFixedRecipALTERA = 5924, OpFixedRecipINTEL = 5924, + OpFixedRsqrtALTERA = 5925, OpFixedRsqrtINTEL = 5925, + OpFixedSinALTERA = 5926, OpFixedSinINTEL = 5926, + OpFixedCosALTERA = 5927, OpFixedCosINTEL = 5927, + OpFixedSinCosALTERA = 5928, OpFixedSinCosINTEL = 5928, + OpFixedSinPiALTERA = 5929, OpFixedSinPiINTEL = 5929, + OpFixedCosPiALTERA = 5930, OpFixedCosPiINTEL = 5930, + OpFixedSinCosPiALTERA = 5931, OpFixedSinCosPiINTEL = 5931, + OpFixedLogALTERA = 5932, OpFixedLogINTEL = 5932, + OpFixedExpALTERA = 5933, OpFixedExpINTEL = 5933, + OpPtrCastToCrossWorkgroupALTERA = 5934, OpPtrCastToCrossWorkgroupINTEL = 5934, + OpCrossWorkgroupCastToPtrALTERA = 5938, OpCrossWorkgroupCastToPtrINTEL = 5938, + OpReadPipeBlockingALTERA = 5946, OpReadPipeBlockingINTEL = 5946, + OpWritePipeBlockingALTERA = 5947, OpWritePipeBlockingINTEL = 5947, + OpFPGARegALTERA = 5949, OpFPGARegINTEL = 5949, OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayFlagsKHR = 6017, @@ -2397,10 +2584,15 @@ enum Op { OpControlBarrierArriveINTEL = 6142, OpControlBarrierWaitINTEL = 6143, OpArithmeticFenceEXT = 6145, + OpTaskSequenceCreateALTERA = 6163, OpTaskSequenceCreateINTEL = 6163, + OpTaskSequenceAsyncALTERA = 6164, OpTaskSequenceAsyncINTEL = 6164, + OpTaskSequenceGetALTERA = 6165, OpTaskSequenceGetINTEL = 6165, + OpTaskSequenceReleaseALTERA = 6166, OpTaskSequenceReleaseINTEL = 6166, + OpTypeTaskSequenceALTERA = 6199, OpTypeTaskSequenceINTEL = 6199, OpSubgroupBlockPrefetchINTEL = 6221, OpSubgroup2DBlockLoadINTEL = 6231, @@ -2410,6 +2602,7 @@ enum Op { OpSubgroup2DBlockStoreINTEL = 6235, OpSubgroupMatrixMultiplyAccumulateINTEL = 6237, OpBitwiseFunctionINTEL = 6242, + OpUntypedVariableLengthArrayINTEL = 6244, OpConditionalExtensionINTEL = 6248, OpConditionalEntryPointINTEL = 6249, OpConditionalCapabilityINTEL = 6250, @@ -2811,12 +3004,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpUntypedInBoundsPtrAccessChainKHR: *hasResult = true; *hasResultType = true; break; case OpUntypedArrayLengthKHR: *hasResult = true; *hasResultType = true; break; case OpUntypedPrefetchKHR: *hasResult = false; *hasResultType = false; break; + case OpFmaKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; case OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; case OpExtInstWithForwardRefsKHR: *hasResult = true; *hasResultType = true; break; + case OpUntypedGroupAsyncCopyKHR: *hasResult = true; *hasResultType = true; break; case OpTraceRayKHR: *hasResult = false; *hasResultType = false; break; case OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; case OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break; @@ -2876,6 +3071,11 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpSpecConstantStringAMDX: *hasResult = true; *hasResultType = false; break; case OpGroupNonUniformQuadAllKHR: *hasResult = true; *hasResultType = true; break; case OpGroupNonUniformQuadAnyKHR: *hasResult = true; *hasResultType = true; break; + case OpTypeBufferEXT: *hasResult = true; *hasResultType = false; break; + case OpBufferPointerEXT: *hasResult = true; *hasResultType = true; break; + case OpUntypedImageTexelPointerEXT: *hasResult = true; *hasResultType = true; break; + case OpMemberDecorateIdEXT: *hasResult = false; *hasResultType = false; break; + case OpConstantSizeOfEXT: *hasResult = true; *hasResultType = true; break; case OpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break; case OpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break; case OpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break; @@ -2910,7 +3110,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break; case OpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break; case OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; - case OpTypeCooperativeVectorNV: *hasResult = true; *hasResultType = false; break; + case OpTypeVectorIdEXT: *hasResult = true; *hasResultType = false; break; case OpCooperativeVectorMatrixMulNV: *hasResult = true; *hasResultType = true; break; case OpCooperativeVectorOuterProductAccumulateNV: *hasResult = false; *hasResultType = false; break; case OpCooperativeVectorReduceSumAccumulateNV: *hasResult = false; *hasResultType = false; break; @@ -2918,12 +3118,42 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpCooperativeMatrixConvertNV: *hasResult = true; *hasResultType = true; break; case OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break; case OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break; - case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformPartitionEXT: *hasResult = true; *hasResultType = true; break; case OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break; case OpFetchMicroTriangleVertexPositionNV: *hasResult = true; *hasResultType = true; break; case OpFetchMicroTriangleVertexBarycentricNV: *hasResult = true; *hasResultType = true; break; case OpCooperativeVectorLoadNV: *hasResult = true; *hasResultType = true; break; case OpCooperativeVectorStoreNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordFromQueryEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordMissEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordMissMotionEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetIntersectionTriangleVertexPositionsEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetRayFlagsEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectSetShaderBindingTableRecordIndexEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectReorderExecuteShaderEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectTraceReorderExecuteEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectTraceMotionReorderExecuteEXT: *hasResult = false; *hasResultType = false; break; + case OpTypeHitObjectEXT: *hasResult = true; *hasResultType = false; break; + case OpReorderThreadWithHintEXT: *hasResult = false; *hasResultType = false; break; + case OpReorderThreadWithHitObjectEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectTraceRayEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectTraceRayMotionEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordEmptyEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectExecuteShaderEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetCurrentTimeEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetAttributesEXT: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetHitKindEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetPrimitiveIndexEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetGeometryIndexEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetInstanceIdEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetInstanceCustomIndexEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectRayOriginEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectRayDirectionEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetWorldRayDirectionEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetWorldRayOriginEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectToWorldEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetWorldToObjectEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetRayTMaxEXT: *hasResult = true; *hasResultType = true; break; case OpReportIntersectionKHR: *hasResult = true; *hasResultType = true; break; case OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break; case OpTerminateRayNV: *hasResult = false; *hasResultType = false; break; @@ -2933,8 +3163,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; case OpTypeAccelerationStructureKHR: *hasResult = true; *hasResultType = false; break; case OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; - case OpRayQueryGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionClusterIdNV: *hasResult = true; *hasResultType = true; break; case OpHitObjectGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetRayTMinEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetShaderBindingTableRecordIndexEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetShaderRecordBufferHandleEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsEmptyEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsHitEXT: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsMissEXT: *hasResult = true; *hasResultType = true; break; case OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; case OpCooperativeMatrixLoadNV: *hasResult = true; *hasResultType = true; break; case OpCooperativeMatrixStoreNV: *hasResult = false; *hasResultType = false; break; @@ -3138,24 +3374,24 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; case OpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break; case OpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break; - case OpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatSinCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCastALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCastFromIntALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCastToIntALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatAddALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatSubALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatMulALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatDivALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatGTALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatGEALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatLTALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatLEALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatEQALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatRecipALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatRSqrtALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCbrtALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatHypotALTERA: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatSqrtALTERA: *hasResult = true; *hasResultType = true; break; case OpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break; case OpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break; case OpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break; @@ -3183,22 +3419,22 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpAliasDomainDeclINTEL: *hasResult = true; *hasResultType = false; break; case OpAliasScopeDeclINTEL: *hasResult = true; *hasResultType = false; break; case OpAliasScopeListDeclINTEL: *hasResult = true; *hasResultType = false; break; - case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedSinINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedCosINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedLogINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedExpINTEL: *hasResult = true; *hasResultType = true; break; - case OpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break; - case OpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break; - case OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; - case OpWritePipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; - case OpFPGARegINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedSqrtALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedRecipALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedRsqrtALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedSinALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedCosALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedSinCosALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedSinPiALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedSinCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedLogALTERA: *hasResult = true; *hasResultType = true; break; + case OpFixedExpALTERA: *hasResult = true; *hasResultType = true; break; + case OpPtrCastToCrossWorkgroupALTERA: *hasResult = true; *hasResultType = true; break; + case OpCrossWorkgroupCastToPtrALTERA: *hasResult = true; *hasResultType = true; break; + case OpReadPipeBlockingALTERA: *hasResult = true; *hasResultType = true; break; + case OpWritePipeBlockingALTERA: *hasResult = true; *hasResultType = true; break; + case OpFPGARegALTERA: *hasResult = true; *hasResultType = true; break; case OpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break; case OpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break; case OpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break; @@ -3227,11 +3463,11 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break; case OpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break; case OpArithmeticFenceEXT: *hasResult = true; *hasResultType = true; break; - case OpTaskSequenceCreateINTEL: *hasResult = true; *hasResultType = true; break; - case OpTaskSequenceAsyncINTEL: *hasResult = false; *hasResultType = false; break; - case OpTaskSequenceGetINTEL: *hasResult = true; *hasResultType = true; break; - case OpTaskSequenceReleaseINTEL: *hasResult = false; *hasResultType = false; break; - case OpTypeTaskSequenceINTEL: *hasResult = true; *hasResultType = false; break; + case OpTaskSequenceCreateALTERA: *hasResult = true; *hasResultType = true; break; + case OpTaskSequenceAsyncALTERA: *hasResult = false; *hasResultType = false; break; + case OpTaskSequenceGetALTERA: *hasResult = true; *hasResultType = true; break; + case OpTaskSequenceReleaseALTERA: *hasResult = false; *hasResultType = false; break; + case OpTypeTaskSequenceALTERA: *hasResult = true; *hasResultType = false; break; case OpSubgroupBlockPrefetchINTEL: *hasResult = false; *hasResultType = false; break; case OpSubgroup2DBlockLoadINTEL: *hasResult = false; *hasResultType = false; break; case OpSubgroup2DBlockLoadTransformINTEL: *hasResult = false; *hasResultType = false; break; @@ -3240,6 +3476,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpSubgroup2DBlockStoreINTEL: *hasResult = false; *hasResultType = false; break; case OpSubgroupMatrixMultiplyAccumulateINTEL: *hasResult = true; *hasResultType = true; break; case OpBitwiseFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case OpUntypedVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; case OpConditionalExtensionINTEL: *hasResult = false; *hasResultType = false; break; case OpConditionalEntryPointINTEL: *hasResult = false; *hasResultType = false; break; case OpConditionalCapabilityINTEL: *hasResult = false; *hasResultType = false; break; @@ -3406,6 +3643,7 @@ inline const char* ExecutionModeToString(ExecutionMode value) { case ExecutionModeSampleInterlockUnorderedEXT: return "SampleInterlockUnorderedEXT"; case ExecutionModeShadingRateInterlockOrderedEXT: return "ShadingRateInterlockOrderedEXT"; case ExecutionModeShadingRateInterlockUnorderedEXT: return "ShadingRateInterlockUnorderedEXT"; + case ExecutionModeShader64BitIndexingEXT: return "Shader64BitIndexingEXT"; case ExecutionModeSharedLocalMemorySizeINTEL: return "SharedLocalMemorySizeINTEL"; case ExecutionModeRoundingModeRTPINTEL: return "RoundingModeRTPINTEL"; case ExecutionModeRoundingModeRTNINTEL: return "RoundingModeRTNINTEL"; @@ -3455,9 +3693,10 @@ inline const char* StorageClassToString(StorageClass value) { case StorageClassPhysicalStorageBuffer: return "PhysicalStorageBuffer"; case StorageClassHitObjectAttributeNV: return "HitObjectAttributeNV"; case StorageClassTaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT"; + case StorageClassHitObjectAttributeEXT: return "HitObjectAttributeEXT"; case StorageClassCodeSectionINTEL: return "CodeSectionINTEL"; - case StorageClassDeviceOnlyINTEL: return "DeviceOnlyINTEL"; - case StorageClassHostOnlyINTEL: return "HostOnlyINTEL"; + case StorageClassDeviceOnlyALTERA: return "DeviceOnlyALTERA"; + case StorageClassHostOnlyALTERA: return "HostOnlyALTERA"; default: return "Unknown"; } } @@ -3639,7 +3878,7 @@ inline const char* FunctionParameterAttributeToString(FunctionParameterAttribute case FunctionParameterAttributeNoCapture: return "NoCapture"; case FunctionParameterAttributeNoWrite: return "NoWrite"; case FunctionParameterAttributeNoReadWrite: return "NoReadWrite"; - case FunctionParameterAttributeRuntimeAlignedINTEL: return "RuntimeAlignedINTEL"; + case FunctionParameterAttributeRuntimeAlignedALTERA: return "RuntimeAlignedALTERA"; default: return "Unknown"; } } @@ -3708,6 +3947,8 @@ inline const char* DecorationToString(Decoration value) { case DecorationPayloadNodeSparseArrayAMDX: return "PayloadNodeSparseArrayAMDX"; case DecorationPayloadNodeArraySizeAMDX: return "PayloadNodeArraySizeAMDX"; case DecorationPayloadDispatchIndirectAMDX: return "PayloadDispatchIndirectAMDX"; + case DecorationArrayStrideIdEXT: return "ArrayStrideIdEXT"; + case DecorationOffsetIdEXT: return "OffsetIdEXT"; case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; case DecorationPassthroughNV: return "PassthroughNV"; case DecorationViewportRelativeNV: return "ViewportRelativeNV"; @@ -3719,7 +3960,10 @@ inline const char* DecorationToString(Decoration value) { case DecorationNonUniform: return "NonUniform"; case DecorationRestrictPointer: return "RestrictPointer"; case DecorationAliasedPointer: return "AliasedPointer"; + case DecorationMemberOffsetNV: return "MemberOffsetNV"; case DecorationHitObjectShaderRecordBufferNV: return "HitObjectShaderRecordBufferNV"; + case DecorationHitObjectShaderRecordBufferEXT: return "HitObjectShaderRecordBufferEXT"; + case DecorationBankNV: return "BankNV"; case DecorationBindlessSamplerNV: return "BindlessSamplerNV"; case DecorationBindlessImageNV: return "BindlessImageNV"; case DecorationBoundSamplerNV: return "BoundSamplerNV"; @@ -3738,55 +3982,55 @@ inline const char* DecorationToString(Decoration value) { case DecorationUserTypeGOOGLE: return "UserTypeGOOGLE"; case DecorationFunctionRoundingModeINTEL: return "FunctionRoundingModeINTEL"; case DecorationFunctionDenormModeINTEL: return "FunctionDenormModeINTEL"; - case DecorationRegisterINTEL: return "RegisterINTEL"; - case DecorationMemoryINTEL: return "MemoryINTEL"; - case DecorationNumbanksINTEL: return "NumbanksINTEL"; - case DecorationBankwidthINTEL: return "BankwidthINTEL"; - case DecorationMaxPrivateCopiesINTEL: return "MaxPrivateCopiesINTEL"; - case DecorationSinglepumpINTEL: return "SinglepumpINTEL"; - case DecorationDoublepumpINTEL: return "DoublepumpINTEL"; - case DecorationMaxReplicatesINTEL: return "MaxReplicatesINTEL"; - case DecorationSimpleDualPortINTEL: return "SimpleDualPortINTEL"; - case DecorationMergeINTEL: return "MergeINTEL"; - case DecorationBankBitsINTEL: return "BankBitsINTEL"; - case DecorationForcePow2DepthINTEL: return "ForcePow2DepthINTEL"; - case DecorationStridesizeINTEL: return "StridesizeINTEL"; - case DecorationWordsizeINTEL: return "WordsizeINTEL"; - case DecorationTrueDualPortINTEL: return "TrueDualPortINTEL"; - case DecorationBurstCoalesceINTEL: return "BurstCoalesceINTEL"; - case DecorationCacheSizeINTEL: return "CacheSizeINTEL"; - case DecorationDontStaticallyCoalesceINTEL: return "DontStaticallyCoalesceINTEL"; - case DecorationPrefetchINTEL: return "PrefetchINTEL"; - case DecorationStallEnableINTEL: return "StallEnableINTEL"; - case DecorationFuseLoopsInFunctionINTEL: return "FuseLoopsInFunctionINTEL"; - case DecorationMathOpDSPModeINTEL: return "MathOpDSPModeINTEL"; + case DecorationRegisterALTERA: return "RegisterALTERA"; + case DecorationMemoryALTERA: return "MemoryALTERA"; + case DecorationNumbanksALTERA: return "NumbanksALTERA"; + case DecorationBankwidthALTERA: return "BankwidthALTERA"; + case DecorationMaxPrivateCopiesALTERA: return "MaxPrivateCopiesALTERA"; + case DecorationSinglepumpALTERA: return "SinglepumpALTERA"; + case DecorationDoublepumpALTERA: return "DoublepumpALTERA"; + case DecorationMaxReplicatesALTERA: return "MaxReplicatesALTERA"; + case DecorationSimpleDualPortALTERA: return "SimpleDualPortALTERA"; + case DecorationMergeALTERA: return "MergeALTERA"; + case DecorationBankBitsALTERA: return "BankBitsALTERA"; + case DecorationForcePow2DepthALTERA: return "ForcePow2DepthALTERA"; + case DecorationStridesizeALTERA: return "StridesizeALTERA"; + case DecorationWordsizeALTERA: return "WordsizeALTERA"; + case DecorationTrueDualPortALTERA: return "TrueDualPortALTERA"; + case DecorationBurstCoalesceALTERA: return "BurstCoalesceALTERA"; + case DecorationCacheSizeALTERA: return "CacheSizeALTERA"; + case DecorationDontStaticallyCoalesceALTERA: return "DontStaticallyCoalesceALTERA"; + case DecorationPrefetchALTERA: return "PrefetchALTERA"; + case DecorationStallEnableALTERA: return "StallEnableALTERA"; + case DecorationFuseLoopsInFunctionALTERA: return "FuseLoopsInFunctionALTERA"; + case DecorationMathOpDSPModeALTERA: return "MathOpDSPModeALTERA"; case DecorationAliasScopeINTEL: return "AliasScopeINTEL"; case DecorationNoAliasINTEL: return "NoAliasINTEL"; - case DecorationInitiationIntervalINTEL: return "InitiationIntervalINTEL"; - case DecorationMaxConcurrencyINTEL: return "MaxConcurrencyINTEL"; - case DecorationPipelineEnableINTEL: return "PipelineEnableINTEL"; - case DecorationBufferLocationINTEL: return "BufferLocationINTEL"; - case DecorationIOPipeStorageINTEL: return "IOPipeStorageINTEL"; + case DecorationInitiationIntervalALTERA: return "InitiationIntervalALTERA"; + case DecorationMaxConcurrencyALTERA: return "MaxConcurrencyALTERA"; + case DecorationPipelineEnableALTERA: return "PipelineEnableALTERA"; + case DecorationBufferLocationALTERA: return "BufferLocationALTERA"; + case DecorationIOPipeStorageALTERA: return "IOPipeStorageALTERA"; case DecorationFunctionFloatingPointModeINTEL: return "FunctionFloatingPointModeINTEL"; case DecorationSingleElementVectorINTEL: return "SingleElementVectorINTEL"; case DecorationVectorComputeCallableFunctionINTEL: return "VectorComputeCallableFunctionINTEL"; case DecorationMediaBlockIOINTEL: return "MediaBlockIOINTEL"; - case DecorationStallFreeINTEL: return "StallFreeINTEL"; + case DecorationStallFreeALTERA: return "StallFreeALTERA"; case DecorationFPMaxErrorDecorationINTEL: return "FPMaxErrorDecorationINTEL"; - case DecorationLatencyControlLabelINTEL: return "LatencyControlLabelINTEL"; - case DecorationLatencyControlConstraintINTEL: return "LatencyControlConstraintINTEL"; - case DecorationConduitKernelArgumentINTEL: return "ConduitKernelArgumentINTEL"; - case DecorationRegisterMapKernelArgumentINTEL: return "RegisterMapKernelArgumentINTEL"; - case DecorationMMHostInterfaceAddressWidthINTEL: return "MMHostInterfaceAddressWidthINTEL"; - case DecorationMMHostInterfaceDataWidthINTEL: return "MMHostInterfaceDataWidthINTEL"; - case DecorationMMHostInterfaceLatencyINTEL: return "MMHostInterfaceLatencyINTEL"; - case DecorationMMHostInterfaceReadWriteModeINTEL: return "MMHostInterfaceReadWriteModeINTEL"; - case DecorationMMHostInterfaceMaxBurstINTEL: return "MMHostInterfaceMaxBurstINTEL"; - case DecorationMMHostInterfaceWaitRequestINTEL: return "MMHostInterfaceWaitRequestINTEL"; - case DecorationStableKernelArgumentINTEL: return "StableKernelArgumentINTEL"; + case DecorationLatencyControlLabelALTERA: return "LatencyControlLabelALTERA"; + case DecorationLatencyControlConstraintALTERA: return "LatencyControlConstraintALTERA"; + case DecorationConduitKernelArgumentALTERA: return "ConduitKernelArgumentALTERA"; + case DecorationRegisterMapKernelArgumentALTERA: return "RegisterMapKernelArgumentALTERA"; + case DecorationMMHostInterfaceAddressWidthALTERA: return "MMHostInterfaceAddressWidthALTERA"; + case DecorationMMHostInterfaceDataWidthALTERA: return "MMHostInterfaceDataWidthALTERA"; + case DecorationMMHostInterfaceLatencyALTERA: return "MMHostInterfaceLatencyALTERA"; + case DecorationMMHostInterfaceReadWriteModeALTERA: return "MMHostInterfaceReadWriteModeALTERA"; + case DecorationMMHostInterfaceMaxBurstALTERA: return "MMHostInterfaceMaxBurstALTERA"; + case DecorationMMHostInterfaceWaitRequestALTERA: return "MMHostInterfaceWaitRequestALTERA"; + case DecorationStableKernelArgumentALTERA: return "StableKernelArgumentALTERA"; case DecorationHostAccessINTEL: return "HostAccessINTEL"; - case DecorationInitModeINTEL: return "InitModeINTEL"; - case DecorationImplementInRegisterMapINTEL: return "ImplementInRegisterMapINTEL"; + case DecorationInitModeALTERA: return "InitModeALTERA"; + case DecorationImplementInRegisterMapALTERA: return "ImplementInRegisterMapALTERA"; case DecorationConditionalINTEL: return "ConditionalINTEL"; case DecorationCacheControlLoadINTEL: return "CacheControlLoadINTEL"; case DecorationCacheControlStoreINTEL: return "CacheControlStoreINTEL"; @@ -3867,6 +4111,8 @@ inline const char* BuiltInToString(BuiltIn value) { case BuiltInFragStencilRefEXT: return "FragStencilRefEXT"; case BuiltInRemainingRecursionLevelsAMDX: return "RemainingRecursionLevelsAMDX"; case BuiltInShaderIndexAMDX: return "ShaderIndexAMDX"; + case BuiltInSamplerHeapEXT: return "SamplerHeapEXT"; + case BuiltInResourceHeapEXT: return "ResourceHeapEXT"; case BuiltInViewportMaskNV: return "ViewportMaskNV"; case BuiltInSecondaryPositionNV: return "SecondaryPositionNV"; case BuiltInSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; @@ -3945,9 +4191,9 @@ inline const char* GroupOperationToString(GroupOperation value) { case GroupOperationInclusiveScan: return "InclusiveScan"; case GroupOperationExclusiveScan: return "ExclusiveScan"; case GroupOperationClusteredReduce: return "ClusteredReduce"; - case GroupOperationPartitionedReduceNV: return "PartitionedReduceNV"; - case GroupOperationPartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV"; - case GroupOperationPartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV"; + case GroupOperationPartitionedReduceEXT: return "PartitionedReduceEXT"; + case GroupOperationPartitionedInclusiveScanEXT: return "PartitionedInclusiveScanEXT"; + case GroupOperationPartitionedExclusiveScanEXT: return "PartitionedExclusiveScanEXT"; default: return "Unknown"; } } @@ -4094,6 +4340,7 @@ inline const char* CapabilityToString(Capability value) { case CapabilityBFloat16TypeKHR: return "BFloat16TypeKHR"; case CapabilityBFloat16DotProductKHR: return "BFloat16DotProductKHR"; case CapabilityBFloat16CooperativeMatrixKHR: return "BFloat16CooperativeMatrixKHR"; + case CapabilityDescriptorHeapEXT: return "DescriptorHeapEXT"; case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV"; case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV"; case CapabilityShaderViewportIndexLayerEXT: return "ShaderViewportIndexLayerEXT"; @@ -4107,7 +4354,7 @@ inline const char* CapabilityToString(Capability value) { case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR"; case CapabilityComputeDerivativeGroupQuadsKHR: return "ComputeDerivativeGroupQuadsKHR"; case CapabilityFragmentDensityEXT: return "FragmentDensityEXT"; - case CapabilityGroupNonUniformPartitionedNV: return "GroupNonUniformPartitionedNV"; + case CapabilityGroupNonUniformPartitionedEXT: return "GroupNonUniformPartitionedEXT"; case CapabilityShaderNonUniform: return "ShaderNonUniform"; case CapabilityRuntimeDescriptorArray: return "RuntimeDescriptorArray"; case CapabilityInputAttachmentArrayDynamicIndexing: return "InputAttachmentArrayDynamicIndexing"; @@ -4137,6 +4384,7 @@ inline const char* CapabilityToString(Capability value) { case CapabilityDisplacementMicromapNV: return "DisplacementMicromapNV"; case CapabilityRayTracingOpacityMicromapEXT: return "RayTracingOpacityMicromapEXT"; case CapabilityShaderInvocationReorderNV: return "ShaderInvocationReorderNV"; + case CapabilityShaderInvocationReorderEXT: return "ShaderInvocationReorderEXT"; case CapabilityBindlessTextureNV: return "BindlessTextureNV"; case CapabilityRayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR"; case CapabilityCooperativeVectorNV: return "CooperativeVectorNV"; @@ -4145,6 +4393,9 @@ inline const char* CapabilityToString(Capability value) { case CapabilityRawAccessChainsNV: return "RawAccessChainsNV"; case CapabilityRayTracingSpheresGeometryNV: return "RayTracingSpheresGeometryNV"; case CapabilityRayTracingLinearSweptSpheresGeometryNV: return "RayTracingLinearSweptSpheresGeometryNV"; + case CapabilityPushConstantBanksNV: return "PushConstantBanksNV"; + case CapabilityLongVectorEXT: return "LongVectorEXT"; + case CapabilityShader64BitIndexingEXT: return "Shader64BitIndexingEXT"; case CapabilityCooperativeMatrixReductionsNV: return "CooperativeMatrixReductionsNV"; case CapabilityCooperativeMatrixConversionsNV: return "CooperativeMatrixConversionsNV"; case CapabilityCooperativeMatrixPerElementOperationsNV: return "CooperativeMatrixPerElementOperationsNV"; @@ -4174,27 +4425,27 @@ inline const char* CapabilityToString(Capability value) { case CapabilitySubgroupAvcMotionEstimationChromaINTEL: return "SubgroupAvcMotionEstimationChromaINTEL"; case CapabilityVariableLengthArrayINTEL: return "VariableLengthArrayINTEL"; case CapabilityFunctionFloatControlINTEL: return "FunctionFloatControlINTEL"; - case CapabilityFPGAMemoryAttributesINTEL: return "FPGAMemoryAttributesINTEL"; + case CapabilityFPGAMemoryAttributesALTERA: return "FPGAMemoryAttributesALTERA"; case CapabilityFPFastMathModeINTEL: return "FPFastMathModeINTEL"; - case CapabilityArbitraryPrecisionIntegersINTEL: return "ArbitraryPrecisionIntegersINTEL"; - case CapabilityArbitraryPrecisionFloatingPointINTEL: return "ArbitraryPrecisionFloatingPointINTEL"; + case CapabilityArbitraryPrecisionIntegersALTERA: return "ArbitraryPrecisionIntegersALTERA"; + case CapabilityArbitraryPrecisionFloatingPointALTERA: return "ArbitraryPrecisionFloatingPointALTERA"; case CapabilityUnstructuredLoopControlsINTEL: return "UnstructuredLoopControlsINTEL"; - case CapabilityFPGALoopControlsINTEL: return "FPGALoopControlsINTEL"; + case CapabilityFPGALoopControlsALTERA: return "FPGALoopControlsALTERA"; case CapabilityKernelAttributesINTEL: return "KernelAttributesINTEL"; case CapabilityFPGAKernelAttributesINTEL: return "FPGAKernelAttributesINTEL"; - case CapabilityFPGAMemoryAccessesINTEL: return "FPGAMemoryAccessesINTEL"; - case CapabilityFPGAClusterAttributesINTEL: return "FPGAClusterAttributesINTEL"; - case CapabilityLoopFuseINTEL: return "LoopFuseINTEL"; - case CapabilityFPGADSPControlINTEL: return "FPGADSPControlINTEL"; + case CapabilityFPGAMemoryAccessesALTERA: return "FPGAMemoryAccessesALTERA"; + case CapabilityFPGAClusterAttributesALTERA: return "FPGAClusterAttributesALTERA"; + case CapabilityLoopFuseALTERA: return "LoopFuseALTERA"; + case CapabilityFPGADSPControlALTERA: return "FPGADSPControlALTERA"; case CapabilityMemoryAccessAliasingINTEL: return "MemoryAccessAliasingINTEL"; - case CapabilityFPGAInvocationPipeliningAttributesINTEL: return "FPGAInvocationPipeliningAttributesINTEL"; - case CapabilityFPGABufferLocationINTEL: return "FPGABufferLocationINTEL"; - case CapabilityArbitraryPrecisionFixedPointINTEL: return "ArbitraryPrecisionFixedPointINTEL"; - case CapabilityUSMStorageClassesINTEL: return "USMStorageClassesINTEL"; - case CapabilityRuntimeAlignedAttributeINTEL: return "RuntimeAlignedAttributeINTEL"; - case CapabilityIOPipesINTEL: return "IOPipesINTEL"; - case CapabilityBlockingPipesINTEL: return "BlockingPipesINTEL"; - case CapabilityFPGARegINTEL: return "FPGARegINTEL"; + case CapabilityFPGAInvocationPipeliningAttributesALTERA: return "FPGAInvocationPipeliningAttributesALTERA"; + case CapabilityFPGABufferLocationALTERA: return "FPGABufferLocationALTERA"; + case CapabilityArbitraryPrecisionFixedPointALTERA: return "ArbitraryPrecisionFixedPointALTERA"; + case CapabilityUSMStorageClassesALTERA: return "USMStorageClassesALTERA"; + case CapabilityRuntimeAlignedAttributeALTERA: return "RuntimeAlignedAttributeALTERA"; + case CapabilityIOPipesALTERA: return "IOPipesALTERA"; + case CapabilityBlockingPipesALTERA: return "BlockingPipesALTERA"; + case CapabilityFPGARegALTERA: return "FPGARegALTERA"; case CapabilityDotProductInputAll: return "DotProductInputAll"; case CapabilityDotProductInput4x8Bit: return "DotProductInput4x8Bit"; case CapabilityDotProductInput4x8BitPacked: return "DotProductInput4x8BitPacked"; @@ -4205,6 +4456,7 @@ inline const char* CapabilityToString(Capability value) { case CapabilityBitInstructions: return "BitInstructions"; case CapabilityGroupNonUniformRotateKHR: return "GroupNonUniformRotateKHR"; case CapabilityFloatControls2: return "FloatControls2"; + case CapabilityFMAKHR: return "FMAKHR"; case CapabilityAtomicFloat32AddEXT: return "AtomicFloat32AddEXT"; case CapabilityAtomicFloat64AddEXT: return "AtomicFloat64AddEXT"; case CapabilityLongCompositesINTEL: return "LongCompositesINTEL"; @@ -4214,20 +4466,21 @@ inline const char* CapabilityToString(Capability value) { case CapabilityBFloat16ConversionINTEL: return "BFloat16ConversionINTEL"; case CapabilitySplitBarrierINTEL: return "SplitBarrierINTEL"; case CapabilityArithmeticFenceEXT: return "ArithmeticFenceEXT"; - case CapabilityFPGAClusterAttributesV2INTEL: return "FPGAClusterAttributesV2INTEL"; + case CapabilityFPGAClusterAttributesV2ALTERA: return "FPGAClusterAttributesV2ALTERA"; case CapabilityFPGAKernelAttributesv2INTEL: return "FPGAKernelAttributesv2INTEL"; - case CapabilityTaskSequenceINTEL: return "TaskSequenceINTEL"; + case CapabilityTaskSequenceALTERA: return "TaskSequenceALTERA"; case CapabilityFPMaxErrorINTEL: return "FPMaxErrorINTEL"; - case CapabilityFPGALatencyControlINTEL: return "FPGALatencyControlINTEL"; - case CapabilityFPGAArgumentInterfacesINTEL: return "FPGAArgumentInterfacesINTEL"; + case CapabilityFPGALatencyControlALTERA: return "FPGALatencyControlALTERA"; + case CapabilityFPGAArgumentInterfacesALTERA: return "FPGAArgumentInterfacesALTERA"; case CapabilityGlobalVariableHostAccessINTEL: return "GlobalVariableHostAccessINTEL"; - case CapabilityGlobalVariableFPGADecorationsINTEL: return "GlobalVariableFPGADecorationsINTEL"; + case CapabilityGlobalVariableFPGADecorationsALTERA: return "GlobalVariableFPGADecorationsALTERA"; case CapabilitySubgroupBufferPrefetchINTEL: return "SubgroupBufferPrefetchINTEL"; case CapabilitySubgroup2DBlockIOINTEL: return "Subgroup2DBlockIOINTEL"; case CapabilitySubgroup2DBlockTransformINTEL: return "Subgroup2DBlockTransformINTEL"; case CapabilitySubgroup2DBlockTransposeINTEL: return "Subgroup2DBlockTransposeINTEL"; case CapabilitySubgroupMatrixMultiplyAccumulateINTEL: return "SubgroupMatrixMultiplyAccumulateINTEL"; case CapabilityTernaryBitwiseFunctionINTEL: return "TernaryBitwiseFunctionINTEL"; + case CapabilityUntypedVariableLengthArrayINTEL: return "UntypedVariableLengthArrayINTEL"; case CapabilitySpecConditionalINTEL: return "SpecConditionalINTEL"; case CapabilityFunctionVariantsINTEL: return "FunctionVariantsINTEL"; case CapabilityGroupUniformArithmeticKHR: return "GroupUniformArithmeticKHR"; @@ -4344,8 +4597,8 @@ inline const char* TensorClampModeToString(TensorClampMode value) { inline const char* InitializationModeQualifierToString(InitializationModeQualifier value) { switch (value) { - case InitializationModeQualifierInitOnDeviceReprogramINTEL: return "InitOnDeviceReprogramINTEL"; - case InitializationModeQualifierInitOnDeviceResetINTEL: return "InitOnDeviceResetINTEL"; + case InitializationModeQualifierInitOnDeviceReprogramALTERA: return "InitOnDeviceReprogramALTERA"; + case InitializationModeQualifierInitOnDeviceResetALTERA: return "InitOnDeviceResetALTERA"; default: return "Unknown"; } } @@ -4799,12 +5052,14 @@ inline const char* OpToString(Op value) { case OpUntypedInBoundsPtrAccessChainKHR: return "OpUntypedInBoundsPtrAccessChainKHR"; case OpUntypedArrayLengthKHR: return "OpUntypedArrayLengthKHR"; case OpUntypedPrefetchKHR: return "OpUntypedPrefetchKHR"; + case OpFmaKHR: return "OpFmaKHR"; case OpSubgroupAllKHR: return "OpSubgroupAllKHR"; case OpSubgroupAnyKHR: return "OpSubgroupAnyKHR"; case OpSubgroupAllEqualKHR: return "OpSubgroupAllEqualKHR"; case OpGroupNonUniformRotateKHR: return "OpGroupNonUniformRotateKHR"; case OpSubgroupReadInvocationKHR: return "OpSubgroupReadInvocationKHR"; case OpExtInstWithForwardRefsKHR: return "OpExtInstWithForwardRefsKHR"; + case OpUntypedGroupAsyncCopyKHR: return "OpUntypedGroupAsyncCopyKHR"; case OpTraceRayKHR: return "OpTraceRayKHR"; case OpExecuteCallableKHR: return "OpExecuteCallableKHR"; case OpConvertUToAccelerationStructureKHR: return "OpConvertUToAccelerationStructureKHR"; @@ -4864,6 +5119,11 @@ inline const char* OpToString(Op value) { case OpSpecConstantStringAMDX: return "OpSpecConstantStringAMDX"; case OpGroupNonUniformQuadAllKHR: return "OpGroupNonUniformQuadAllKHR"; case OpGroupNonUniformQuadAnyKHR: return "OpGroupNonUniformQuadAnyKHR"; + case OpTypeBufferEXT: return "OpTypeBufferEXT"; + case OpBufferPointerEXT: return "OpBufferPointerEXT"; + case OpUntypedImageTexelPointerEXT: return "OpUntypedImageTexelPointerEXT"; + case OpMemberDecorateIdEXT: return "OpMemberDecorateIdEXT"; + case OpConstantSizeOfEXT: return "OpConstantSizeOfEXT"; case OpHitObjectRecordHitMotionNV: return "OpHitObjectRecordHitMotionNV"; case OpHitObjectRecordHitWithIndexMotionNV: return "OpHitObjectRecordHitWithIndexMotionNV"; case OpHitObjectRecordMissMotionNV: return "OpHitObjectRecordMissMotionNV"; @@ -4906,12 +5166,42 @@ inline const char* OpToString(Op value) { case OpCooperativeMatrixConvertNV: return "OpCooperativeMatrixConvertNV"; case OpEmitMeshTasksEXT: return "OpEmitMeshTasksEXT"; case OpSetMeshOutputsEXT: return "OpSetMeshOutputsEXT"; - case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV"; + case OpGroupNonUniformPartitionEXT: return "OpGroupNonUniformPartitionEXT"; case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV"; case OpFetchMicroTriangleVertexPositionNV: return "OpFetchMicroTriangleVertexPositionNV"; case OpFetchMicroTriangleVertexBarycentricNV: return "OpFetchMicroTriangleVertexBarycentricNV"; case OpCooperativeVectorLoadNV: return "OpCooperativeVectorLoadNV"; case OpCooperativeVectorStoreNV: return "OpCooperativeVectorStoreNV"; + case OpHitObjectRecordFromQueryEXT: return "OpHitObjectRecordFromQueryEXT"; + case OpHitObjectRecordMissEXT: return "OpHitObjectRecordMissEXT"; + case OpHitObjectRecordMissMotionEXT: return "OpHitObjectRecordMissMotionEXT"; + case OpHitObjectGetIntersectionTriangleVertexPositionsEXT: return "OpHitObjectGetIntersectionTriangleVertexPositionsEXT"; + case OpHitObjectGetRayFlagsEXT: return "OpHitObjectGetRayFlagsEXT"; + case OpHitObjectSetShaderBindingTableRecordIndexEXT: return "OpHitObjectSetShaderBindingTableRecordIndexEXT"; + case OpHitObjectReorderExecuteShaderEXT: return "OpHitObjectReorderExecuteShaderEXT"; + case OpHitObjectTraceReorderExecuteEXT: return "OpHitObjectTraceReorderExecuteEXT"; + case OpHitObjectTraceMotionReorderExecuteEXT: return "OpHitObjectTraceMotionReorderExecuteEXT"; + case OpTypeHitObjectEXT: return "OpTypeHitObjectEXT"; + case OpReorderThreadWithHintEXT: return "OpReorderThreadWithHintEXT"; + case OpReorderThreadWithHitObjectEXT: return "OpReorderThreadWithHitObjectEXT"; + case OpHitObjectTraceRayEXT: return "OpHitObjectTraceRayEXT"; + case OpHitObjectTraceRayMotionEXT: return "OpHitObjectTraceRayMotionEXT"; + case OpHitObjectRecordEmptyEXT: return "OpHitObjectRecordEmptyEXT"; + case OpHitObjectExecuteShaderEXT: return "OpHitObjectExecuteShaderEXT"; + case OpHitObjectGetCurrentTimeEXT: return "OpHitObjectGetCurrentTimeEXT"; + case OpHitObjectGetAttributesEXT: return "OpHitObjectGetAttributesEXT"; + case OpHitObjectGetHitKindEXT: return "OpHitObjectGetHitKindEXT"; + case OpHitObjectGetPrimitiveIndexEXT: return "OpHitObjectGetPrimitiveIndexEXT"; + case OpHitObjectGetGeometryIndexEXT: return "OpHitObjectGetGeometryIndexEXT"; + case OpHitObjectGetInstanceIdEXT: return "OpHitObjectGetInstanceIdEXT"; + case OpHitObjectGetInstanceCustomIndexEXT: return "OpHitObjectGetInstanceCustomIndexEXT"; + case OpHitObjectGetObjectRayOriginEXT: return "OpHitObjectGetObjectRayOriginEXT"; + case OpHitObjectGetObjectRayDirectionEXT: return "OpHitObjectGetObjectRayDirectionEXT"; + case OpHitObjectGetWorldRayDirectionEXT: return "OpHitObjectGetWorldRayDirectionEXT"; + case OpHitObjectGetWorldRayOriginEXT: return "OpHitObjectGetWorldRayOriginEXT"; + case OpHitObjectGetObjectToWorldEXT: return "OpHitObjectGetObjectToWorldEXT"; + case OpHitObjectGetWorldToObjectEXT: return "OpHitObjectGetWorldToObjectEXT"; + case OpHitObjectGetRayTMaxEXT: return "OpHitObjectGetRayTMaxEXT"; case OpReportIntersectionKHR: return "OpReportIntersectionKHR"; case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV"; case OpTerminateRayNV: return "OpTerminateRayNV"; @@ -4923,6 +5213,12 @@ inline const char* OpToString(Op value) { case OpExecuteCallableNV: return "OpExecuteCallableNV"; case OpRayQueryGetClusterIdNV: return "OpRayQueryGetClusterIdNV"; case OpHitObjectGetClusterIdNV: return "OpHitObjectGetClusterIdNV"; + case OpHitObjectGetRayTMinEXT: return "OpHitObjectGetRayTMinEXT"; + case OpHitObjectGetShaderBindingTableRecordIndexEXT: return "OpHitObjectGetShaderBindingTableRecordIndexEXT"; + case OpHitObjectGetShaderRecordBufferHandleEXT: return "OpHitObjectGetShaderRecordBufferHandleEXT"; + case OpHitObjectIsEmptyEXT: return "OpHitObjectIsEmptyEXT"; + case OpHitObjectIsHitEXT: return "OpHitObjectIsHitEXT"; + case OpHitObjectIsMissEXT: return "OpHitObjectIsMissEXT"; case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV"; case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV"; case OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV"; @@ -5126,24 +5422,24 @@ inline const char* OpToString(Op value) { case OpVariableLengthArrayINTEL: return "OpVariableLengthArrayINTEL"; case OpSaveMemoryINTEL: return "OpSaveMemoryINTEL"; case OpRestoreMemoryINTEL: return "OpRestoreMemoryINTEL"; - case OpArbitraryFloatSinCosPiINTEL: return "OpArbitraryFloatSinCosPiINTEL"; - case OpArbitraryFloatCastINTEL: return "OpArbitraryFloatCastINTEL"; - case OpArbitraryFloatCastFromIntINTEL: return "OpArbitraryFloatCastFromIntINTEL"; - case OpArbitraryFloatCastToIntINTEL: return "OpArbitraryFloatCastToIntINTEL"; - case OpArbitraryFloatAddINTEL: return "OpArbitraryFloatAddINTEL"; - case OpArbitraryFloatSubINTEL: return "OpArbitraryFloatSubINTEL"; - case OpArbitraryFloatMulINTEL: return "OpArbitraryFloatMulINTEL"; - case OpArbitraryFloatDivINTEL: return "OpArbitraryFloatDivINTEL"; - case OpArbitraryFloatGTINTEL: return "OpArbitraryFloatGTINTEL"; - case OpArbitraryFloatGEINTEL: return "OpArbitraryFloatGEINTEL"; - case OpArbitraryFloatLTINTEL: return "OpArbitraryFloatLTINTEL"; - case OpArbitraryFloatLEINTEL: return "OpArbitraryFloatLEINTEL"; - case OpArbitraryFloatEQINTEL: return "OpArbitraryFloatEQINTEL"; - case OpArbitraryFloatRecipINTEL: return "OpArbitraryFloatRecipINTEL"; - case OpArbitraryFloatRSqrtINTEL: return "OpArbitraryFloatRSqrtINTEL"; - case OpArbitraryFloatCbrtINTEL: return "OpArbitraryFloatCbrtINTEL"; - case OpArbitraryFloatHypotINTEL: return "OpArbitraryFloatHypotINTEL"; - case OpArbitraryFloatSqrtINTEL: return "OpArbitraryFloatSqrtINTEL"; + case OpArbitraryFloatSinCosPiALTERA: return "OpArbitraryFloatSinCosPiALTERA"; + case OpArbitraryFloatCastALTERA: return "OpArbitraryFloatCastALTERA"; + case OpArbitraryFloatCastFromIntALTERA: return "OpArbitraryFloatCastFromIntALTERA"; + case OpArbitraryFloatCastToIntALTERA: return "OpArbitraryFloatCastToIntALTERA"; + case OpArbitraryFloatAddALTERA: return "OpArbitraryFloatAddALTERA"; + case OpArbitraryFloatSubALTERA: return "OpArbitraryFloatSubALTERA"; + case OpArbitraryFloatMulALTERA: return "OpArbitraryFloatMulALTERA"; + case OpArbitraryFloatDivALTERA: return "OpArbitraryFloatDivALTERA"; + case OpArbitraryFloatGTALTERA: return "OpArbitraryFloatGTALTERA"; + case OpArbitraryFloatGEALTERA: return "OpArbitraryFloatGEALTERA"; + case OpArbitraryFloatLTALTERA: return "OpArbitraryFloatLTALTERA"; + case OpArbitraryFloatLEALTERA: return "OpArbitraryFloatLEALTERA"; + case OpArbitraryFloatEQALTERA: return "OpArbitraryFloatEQALTERA"; + case OpArbitraryFloatRecipALTERA: return "OpArbitraryFloatRecipALTERA"; + case OpArbitraryFloatRSqrtALTERA: return "OpArbitraryFloatRSqrtALTERA"; + case OpArbitraryFloatCbrtALTERA: return "OpArbitraryFloatCbrtALTERA"; + case OpArbitraryFloatHypotALTERA: return "OpArbitraryFloatHypotALTERA"; + case OpArbitraryFloatSqrtALTERA: return "OpArbitraryFloatSqrtALTERA"; case OpArbitraryFloatLogINTEL: return "OpArbitraryFloatLogINTEL"; case OpArbitraryFloatLog2INTEL: return "OpArbitraryFloatLog2INTEL"; case OpArbitraryFloatLog10INTEL: return "OpArbitraryFloatLog10INTEL"; @@ -5171,22 +5467,22 @@ inline const char* OpToString(Op value) { case OpAliasDomainDeclINTEL: return "OpAliasDomainDeclINTEL"; case OpAliasScopeDeclINTEL: return "OpAliasScopeDeclINTEL"; case OpAliasScopeListDeclINTEL: return "OpAliasScopeListDeclINTEL"; - case OpFixedSqrtINTEL: return "OpFixedSqrtINTEL"; - case OpFixedRecipINTEL: return "OpFixedRecipINTEL"; - case OpFixedRsqrtINTEL: return "OpFixedRsqrtINTEL"; - case OpFixedSinINTEL: return "OpFixedSinINTEL"; - case OpFixedCosINTEL: return "OpFixedCosINTEL"; - case OpFixedSinCosINTEL: return "OpFixedSinCosINTEL"; - case OpFixedSinPiINTEL: return "OpFixedSinPiINTEL"; - case OpFixedCosPiINTEL: return "OpFixedCosPiINTEL"; - case OpFixedSinCosPiINTEL: return "OpFixedSinCosPiINTEL"; - case OpFixedLogINTEL: return "OpFixedLogINTEL"; - case OpFixedExpINTEL: return "OpFixedExpINTEL"; - case OpPtrCastToCrossWorkgroupINTEL: return "OpPtrCastToCrossWorkgroupINTEL"; - case OpCrossWorkgroupCastToPtrINTEL: return "OpCrossWorkgroupCastToPtrINTEL"; - case OpReadPipeBlockingINTEL: return "OpReadPipeBlockingINTEL"; - case OpWritePipeBlockingINTEL: return "OpWritePipeBlockingINTEL"; - case OpFPGARegINTEL: return "OpFPGARegINTEL"; + case OpFixedSqrtALTERA: return "OpFixedSqrtALTERA"; + case OpFixedRecipALTERA: return "OpFixedRecipALTERA"; + case OpFixedRsqrtALTERA: return "OpFixedRsqrtALTERA"; + case OpFixedSinALTERA: return "OpFixedSinALTERA"; + case OpFixedCosALTERA: return "OpFixedCosALTERA"; + case OpFixedSinCosALTERA: return "OpFixedSinCosALTERA"; + case OpFixedSinPiALTERA: return "OpFixedSinPiALTERA"; + case OpFixedCosPiALTERA: return "OpFixedCosPiALTERA"; + case OpFixedSinCosPiALTERA: return "OpFixedSinCosPiALTERA"; + case OpFixedLogALTERA: return "OpFixedLogALTERA"; + case OpFixedExpALTERA: return "OpFixedExpALTERA"; + case OpPtrCastToCrossWorkgroupALTERA: return "OpPtrCastToCrossWorkgroupALTERA"; + case OpCrossWorkgroupCastToPtrALTERA: return "OpCrossWorkgroupCastToPtrALTERA"; + case OpReadPipeBlockingALTERA: return "OpReadPipeBlockingALTERA"; + case OpWritePipeBlockingALTERA: return "OpWritePipeBlockingALTERA"; + case OpFPGARegALTERA: return "OpFPGARegALTERA"; case OpRayQueryGetRayTMinKHR: return "OpRayQueryGetRayTMinKHR"; case OpRayQueryGetRayFlagsKHR: return "OpRayQueryGetRayFlagsKHR"; case OpRayQueryGetIntersectionTKHR: return "OpRayQueryGetIntersectionTKHR"; @@ -5215,11 +5511,11 @@ inline const char* OpToString(Op value) { case OpControlBarrierArriveINTEL: return "OpControlBarrierArriveINTEL"; case OpControlBarrierWaitINTEL: return "OpControlBarrierWaitINTEL"; case OpArithmeticFenceEXT: return "OpArithmeticFenceEXT"; - case OpTaskSequenceCreateINTEL: return "OpTaskSequenceCreateINTEL"; - case OpTaskSequenceAsyncINTEL: return "OpTaskSequenceAsyncINTEL"; - case OpTaskSequenceGetINTEL: return "OpTaskSequenceGetINTEL"; - case OpTaskSequenceReleaseINTEL: return "OpTaskSequenceReleaseINTEL"; - case OpTypeTaskSequenceINTEL: return "OpTypeTaskSequenceINTEL"; + case OpTaskSequenceCreateALTERA: return "OpTaskSequenceCreateALTERA"; + case OpTaskSequenceAsyncALTERA: return "OpTaskSequenceAsyncALTERA"; + case OpTaskSequenceGetALTERA: return "OpTaskSequenceGetALTERA"; + case OpTaskSequenceReleaseALTERA: return "OpTaskSequenceReleaseALTERA"; + case OpTypeTaskSequenceALTERA: return "OpTypeTaskSequenceALTERA"; case OpSubgroupBlockPrefetchINTEL: return "OpSubgroupBlockPrefetchINTEL"; case OpSubgroup2DBlockLoadINTEL: return "OpSubgroup2DBlockLoadINTEL"; case OpSubgroup2DBlockLoadTransformINTEL: return "OpSubgroup2DBlockLoadTransformINTEL"; @@ -5228,6 +5524,7 @@ inline const char* OpToString(Op value) { case OpSubgroup2DBlockStoreINTEL: return "OpSubgroup2DBlockStoreINTEL"; case OpSubgroupMatrixMultiplyAccumulateINTEL: return "OpSubgroupMatrixMultiplyAccumulateINTEL"; case OpBitwiseFunctionINTEL: return "OpBitwiseFunctionINTEL"; + case OpUntypedVariableLengthArrayINTEL: return "OpUntypedVariableLengthArrayINTEL"; case OpConditionalExtensionINTEL: return "OpConditionalExtensionINTEL"; case OpConditionalEntryPointINTEL: return "OpConditionalEntryPointINTEL"; case OpConditionalCapabilityINTEL: return "OpConditionalCapabilityINTEL"; diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.hpp11 b/third_party/spirv-headers/include/spirv/unified1/spirv.hpp11 index e806cf66b3..261e19453f 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.hpp11 +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.hpp11 @@ -191,6 +191,7 @@ enum class ExecutionMode : unsigned { SampleInterlockUnorderedEXT = 5369, ShadingRateInterlockOrderedEXT = 5370, ShadingRateInterlockUnorderedEXT = 5371, + Shader64BitIndexingEXT = 5427, SharedLocalMemorySizeINTEL = 5618, RoundingModeRTPINTEL = 5620, RoundingModeRTNINTEL = 5621, @@ -245,8 +246,11 @@ enum class StorageClass : unsigned { PhysicalStorageBufferEXT = 5349, HitObjectAttributeNV = 5385, TaskPayloadWorkgroupEXT = 5402, + HitObjectAttributeEXT = 5411, CodeSectionINTEL = 5605, + DeviceOnlyALTERA = 5936, DeviceOnlyINTEL = 5936, + HostOnlyALTERA = 5937, HostOnlyINTEL = 5937, Max = 0x7fffffff, }; @@ -485,6 +489,7 @@ enum class FunctionParameterAttribute : unsigned { NoCapture = 5, NoWrite = 6, NoReadWrite = 7, + RuntimeAlignedALTERA = 5940, RuntimeAlignedINTEL = 5940, Max = 0x7fffffff, }; @@ -552,6 +557,8 @@ enum class Decoration : unsigned { PayloadNodeSparseArrayAMDX = 5099, PayloadNodeArraySizeAMDX = 5100, PayloadDispatchIndirectAMDX = 5105, + ArrayStrideIdEXT = 5124, + OffsetIdEXT = 5125, OverrideCoverageNV = 5248, PassthroughNV = 5250, ViewportRelativeNV = 5252, @@ -568,7 +575,10 @@ enum class Decoration : unsigned { RestrictPointerEXT = 5355, AliasedPointer = 5356, AliasedPointerEXT = 5356, + MemberOffsetNV = 5358, HitObjectShaderRecordBufferNV = 5386, + HitObjectShaderRecordBufferEXT = 5389, + BankNV = 5397, BindlessSamplerNV = 5398, BindlessImageNV = 5399, BoundSamplerNV = 5400, @@ -589,54 +599,95 @@ enum class Decoration : unsigned { UserTypeGOOGLE = 5636, FunctionRoundingModeINTEL = 5822, FunctionDenormModeINTEL = 5823, + RegisterALTERA = 5825, RegisterINTEL = 5825, + MemoryALTERA = 5826, MemoryINTEL = 5826, + NumbanksALTERA = 5827, NumbanksINTEL = 5827, + BankwidthALTERA = 5828, BankwidthINTEL = 5828, + MaxPrivateCopiesALTERA = 5829, MaxPrivateCopiesINTEL = 5829, + SinglepumpALTERA = 5830, SinglepumpINTEL = 5830, + DoublepumpALTERA = 5831, DoublepumpINTEL = 5831, + MaxReplicatesALTERA = 5832, MaxReplicatesINTEL = 5832, + SimpleDualPortALTERA = 5833, SimpleDualPortINTEL = 5833, + MergeALTERA = 5834, MergeINTEL = 5834, + BankBitsALTERA = 5835, BankBitsINTEL = 5835, + ForcePow2DepthALTERA = 5836, ForcePow2DepthINTEL = 5836, + StridesizeALTERA = 5883, StridesizeINTEL = 5883, + WordsizeALTERA = 5884, WordsizeINTEL = 5884, + TrueDualPortALTERA = 5885, TrueDualPortINTEL = 5885, + BurstCoalesceALTERA = 5899, BurstCoalesceINTEL = 5899, + CacheSizeALTERA = 5900, CacheSizeINTEL = 5900, + DontStaticallyCoalesceALTERA = 5901, DontStaticallyCoalesceINTEL = 5901, + PrefetchALTERA = 5902, PrefetchINTEL = 5902, + StallEnableALTERA = 5905, StallEnableINTEL = 5905, + FuseLoopsInFunctionALTERA = 5907, FuseLoopsInFunctionINTEL = 5907, + MathOpDSPModeALTERA = 5909, MathOpDSPModeINTEL = 5909, AliasScopeINTEL = 5914, NoAliasINTEL = 5915, + InitiationIntervalALTERA = 5917, InitiationIntervalINTEL = 5917, + MaxConcurrencyALTERA = 5918, MaxConcurrencyINTEL = 5918, + PipelineEnableALTERA = 5919, PipelineEnableINTEL = 5919, + BufferLocationALTERA = 5921, BufferLocationINTEL = 5921, + IOPipeStorageALTERA = 5944, IOPipeStorageINTEL = 5944, FunctionFloatingPointModeINTEL = 6080, SingleElementVectorINTEL = 6085, VectorComputeCallableFunctionINTEL = 6087, MediaBlockIOINTEL = 6140, + StallFreeALTERA = 6151, StallFreeINTEL = 6151, FPMaxErrorDecorationINTEL = 6170, + LatencyControlLabelALTERA = 6172, LatencyControlLabelINTEL = 6172, + LatencyControlConstraintALTERA = 6173, LatencyControlConstraintINTEL = 6173, + ConduitKernelArgumentALTERA = 6175, ConduitKernelArgumentINTEL = 6175, + RegisterMapKernelArgumentALTERA = 6176, RegisterMapKernelArgumentINTEL = 6176, + MMHostInterfaceAddressWidthALTERA = 6177, MMHostInterfaceAddressWidthINTEL = 6177, + MMHostInterfaceDataWidthALTERA = 6178, MMHostInterfaceDataWidthINTEL = 6178, + MMHostInterfaceLatencyALTERA = 6179, MMHostInterfaceLatencyINTEL = 6179, + MMHostInterfaceReadWriteModeALTERA = 6180, MMHostInterfaceReadWriteModeINTEL = 6180, + MMHostInterfaceMaxBurstALTERA = 6181, MMHostInterfaceMaxBurstINTEL = 6181, + MMHostInterfaceWaitRequestALTERA = 6182, MMHostInterfaceWaitRequestINTEL = 6182, + StableKernelArgumentALTERA = 6183, StableKernelArgumentINTEL = 6183, HostAccessINTEL = 6188, + InitModeALTERA = 6190, InitModeINTEL = 6190, + ImplementInRegisterMapALTERA = 6191, ImplementInRegisterMapINTEL = 6191, ConditionalINTEL = 6247, CacheControlLoadINTEL = 6442, @@ -721,6 +772,8 @@ enum class BuiltIn : unsigned { FragStencilRefEXT = 5014, RemainingRecursionLevelsAMDX = 5021, ShaderIndexAMDX = 5073, + SamplerHeapEXT = 5122, + ResourceHeapEXT = 5123, ViewportMaskNV = 5253, SecondaryPositionNV = 5257, SecondaryViewportMaskNV = 5258, @@ -818,15 +871,25 @@ enum class LoopControlShift : unsigned { IterationMultiple = 6, PeelCount = 7, PartialCount = 8, + InitiationIntervalALTERA = 16, InitiationIntervalINTEL = 16, + MaxConcurrencyALTERA = 17, MaxConcurrencyINTEL = 17, + DependencyArrayALTERA = 18, DependencyArrayINTEL = 18, + PipelineEnableALTERA = 19, PipelineEnableINTEL = 19, + LoopCoalesceALTERA = 20, LoopCoalesceINTEL = 20, + MaxInterleavingALTERA = 21, MaxInterleavingINTEL = 21, + SpeculatedIterationsALTERA = 22, SpeculatedIterationsINTEL = 22, + NoFusionALTERA = 23, NoFusionINTEL = 23, + LoopCountALTERA = 24, LoopCountINTEL = 24, + MaxReinvocationDelayALTERA = 25, MaxReinvocationDelayINTEL = 25, Max = 0x7fffffff, }; @@ -842,15 +905,25 @@ enum class LoopControlMask : unsigned { IterationMultiple = 0x00000040, PeelCount = 0x00000080, PartialCount = 0x00000100, + InitiationIntervalALTERA = 0x00010000, InitiationIntervalINTEL = 0x00010000, + MaxConcurrencyALTERA = 0x00020000, MaxConcurrencyINTEL = 0x00020000, + DependencyArrayALTERA = 0x00040000, DependencyArrayINTEL = 0x00040000, + PipelineEnableALTERA = 0x00080000, PipelineEnableINTEL = 0x00080000, + LoopCoalesceALTERA = 0x00100000, LoopCoalesceINTEL = 0x00100000, + MaxInterleavingALTERA = 0x00200000, MaxInterleavingINTEL = 0x00200000, + SpeculatedIterationsALTERA = 0x00400000, SpeculatedIterationsINTEL = 0x00400000, + NoFusionALTERA = 0x00800000, NoFusionINTEL = 0x00800000, + LoopCountALTERA = 0x01000000, LoopCountINTEL = 0x01000000, + MaxReinvocationDelayALTERA = 0x02000000, MaxReinvocationDelayINTEL = 0x02000000, }; @@ -963,8 +1036,11 @@ enum class GroupOperation : unsigned { InclusiveScan = 1, ExclusiveScan = 2, ClusteredReduce = 3, + PartitionedReduceEXT = 6, PartitionedReduceNV = 6, + PartitionedInclusiveScanEXT = 7, PartitionedInclusiveScanNV = 7, + PartitionedExclusiveScanEXT = 8, PartitionedExclusiveScanNV = 8, Max = 0x7fffffff, }; @@ -1120,6 +1196,7 @@ enum class Capability : unsigned { BFloat16TypeKHR = 5116, BFloat16DotProductKHR = 5117, BFloat16CooperativeMatrixKHR = 5118, + DescriptorHeapEXT = 5128, SampleMaskOverrideCoverageNV = 5249, GeometryShaderPassthroughNV = 5251, ShaderViewportIndexLayerEXT = 5254, @@ -1137,6 +1214,7 @@ enum class Capability : unsigned { ComputeDerivativeGroupQuadsNV = 5288, FragmentDensityEXT = 5291, ShadingRateNV = 5291, + GroupNonUniformPartitionedEXT = 5297, GroupNonUniformPartitionedNV = 5297, ShaderNonUniform = 5301, ShaderNonUniformEXT = 5301, @@ -1184,6 +1262,7 @@ enum class Capability : unsigned { DisplacementMicromapNV = 5380, RayTracingOpacityMicromapEXT = 5381, ShaderInvocationReorderNV = 5383, + ShaderInvocationReorderEXT = 5388, BindlessTextureNV = 5390, RayQueryPositionFetchKHR = 5391, CooperativeVectorNV = 5394, @@ -1192,6 +1271,9 @@ enum class Capability : unsigned { RawAccessChainsNV = 5414, RayTracingSpheresGeometryNV = 5418, RayTracingLinearSweptSpheresGeometryNV = 5419, + PushConstantBanksNV = 5423, + LongVectorEXT = 5425, + Shader64BitIndexingEXT = 5426, CooperativeMatrixReductionsNV = 5430, CooperativeMatrixConversionsNV = 5431, CooperativeMatrixPerElementOperationsNV = 5432, @@ -1221,26 +1303,42 @@ enum class Capability : unsigned { SubgroupAvcMotionEstimationChromaINTEL = 5698, VariableLengthArrayINTEL = 5817, FunctionFloatControlINTEL = 5821, + FPGAMemoryAttributesALTERA = 5824, FPGAMemoryAttributesINTEL = 5824, FPFastMathModeINTEL = 5837, + ArbitraryPrecisionIntegersALTERA = 5844, ArbitraryPrecisionIntegersINTEL = 5844, + ArbitraryPrecisionFloatingPointALTERA = 5845, ArbitraryPrecisionFloatingPointINTEL = 5845, UnstructuredLoopControlsINTEL = 5886, + FPGALoopControlsALTERA = 5888, FPGALoopControlsINTEL = 5888, KernelAttributesINTEL = 5892, FPGAKernelAttributesINTEL = 5897, + FPGAMemoryAccessesALTERA = 5898, FPGAMemoryAccessesINTEL = 5898, + FPGAClusterAttributesALTERA = 5904, FPGAClusterAttributesINTEL = 5904, + LoopFuseALTERA = 5906, LoopFuseINTEL = 5906, + FPGADSPControlALTERA = 5908, FPGADSPControlINTEL = 5908, MemoryAccessAliasingINTEL = 5910, + FPGAInvocationPipeliningAttributesALTERA = 5916, FPGAInvocationPipeliningAttributesINTEL = 5916, + FPGABufferLocationALTERA = 5920, FPGABufferLocationINTEL = 5920, + ArbitraryPrecisionFixedPointALTERA = 5922, ArbitraryPrecisionFixedPointINTEL = 5922, + USMStorageClassesALTERA = 5935, USMStorageClassesINTEL = 5935, + RuntimeAlignedAttributeALTERA = 5939, RuntimeAlignedAttributeINTEL = 5939, + IOPipesALTERA = 5943, IOPipesINTEL = 5943, + BlockingPipesALTERA = 5945, BlockingPipesINTEL = 5945, + FPGARegALTERA = 5948, FPGARegINTEL = 5948, DotProductInputAll = 6016, DotProductInputAllKHR = 6016, @@ -1256,6 +1354,7 @@ enum class Capability : unsigned { BitInstructions = 6025, GroupNonUniformRotateKHR = 6026, FloatControls2 = 6029, + FMAKHR = 6030, AtomicFloat32AddEXT = 6033, AtomicFloat64AddEXT = 6034, LongCompositesINTEL = 6089, @@ -1266,13 +1365,18 @@ enum class Capability : unsigned { BFloat16ConversionINTEL = 6115, SplitBarrierINTEL = 6141, ArithmeticFenceEXT = 6144, + FPGAClusterAttributesV2ALTERA = 6150, FPGAClusterAttributesV2INTEL = 6150, FPGAKernelAttributesv2INTEL = 6161, + TaskSequenceALTERA = 6162, TaskSequenceINTEL = 6162, FPMaxErrorINTEL = 6169, + FPGALatencyControlALTERA = 6171, FPGALatencyControlINTEL = 6171, + FPGAArgumentInterfacesALTERA = 6174, FPGAArgumentInterfacesINTEL = 6174, GlobalVariableHostAccessINTEL = 6187, + GlobalVariableFPGADecorationsALTERA = 6189, GlobalVariableFPGADecorationsINTEL = 6189, SubgroupBufferPrefetchINTEL = 6220, Subgroup2DBlockIOINTEL = 6228, @@ -1280,6 +1384,7 @@ enum class Capability : unsigned { Subgroup2DBlockTransposeINTEL = 6230, SubgroupMatrixMultiplyAccumulateINTEL = 6236, TernaryBitwiseFunctionINTEL = 6241, + UntypedVariableLengthArrayINTEL = 6243, SpecConditionalINTEL = 6245, FunctionVariantsINTEL = 6246, GroupUniformArithmeticKHR = 6400, @@ -1483,7 +1588,9 @@ enum class TensorOperandsMask : unsigned { }; enum class InitializationModeQualifier : unsigned { + InitOnDeviceReprogramALTERA = 0, InitOnDeviceReprogramINTEL = 0, + InitOnDeviceResetALTERA = 1, InitOnDeviceResetINTEL = 1, Max = 0x7fffffff, }; @@ -1970,12 +2077,14 @@ enum class Op : unsigned { OpUntypedInBoundsPtrAccessChainKHR = 4424, OpUntypedArrayLengthKHR = 4425, OpUntypedPrefetchKHR = 4426, + OpFmaKHR = 4427, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, OpGroupNonUniformRotateKHR = 4431, OpSubgroupReadInvocationKHR = 4432, OpExtInstWithForwardRefsKHR = 4433, + OpUntypedGroupAsyncCopyKHR = 4434, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, OpConvertUToAccelerationStructureKHR = 4447, @@ -2041,6 +2150,11 @@ enum class Op : unsigned { OpSpecConstantStringAMDX = 5104, OpGroupNonUniformQuadAllKHR = 5110, OpGroupNonUniformQuadAnyKHR = 5111, + OpTypeBufferEXT = 5115, + OpBufferPointerEXT = 5119, + OpUntypedImageTexelPointerEXT = 5126, + OpMemberDecorateIdEXT = 5127, + OpConstantSizeOfEXT = 5129, OpHitObjectRecordHitMotionNV = 5249, OpHitObjectRecordHitWithIndexMotionNV = 5250, OpHitObjectRecordMissMotionNV = 5251, @@ -2076,6 +2190,7 @@ enum class Op : unsigned { OpTypeHitObjectNV = 5281, OpImageSampleFootprintNV = 5283, OpTypeCooperativeVectorNV = 5288, + OpTypeVectorIdEXT = 5288, OpCooperativeVectorMatrixMulNV = 5289, OpCooperativeVectorOuterProductAccumulateNV = 5290, OpCooperativeVectorReduceSumAccumulateNV = 5291, @@ -2083,12 +2198,43 @@ enum class Op : unsigned { OpCooperativeMatrixConvertNV = 5293, OpEmitMeshTasksEXT = 5294, OpSetMeshOutputsEXT = 5295, + OpGroupNonUniformPartitionEXT = 5296, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, OpFetchMicroTriangleVertexPositionNV = 5300, OpFetchMicroTriangleVertexBarycentricNV = 5301, OpCooperativeVectorLoadNV = 5302, OpCooperativeVectorStoreNV = 5303, + OpHitObjectRecordFromQueryEXT = 5304, + OpHitObjectRecordMissEXT = 5305, + OpHitObjectRecordMissMotionEXT = 5306, + OpHitObjectGetIntersectionTriangleVertexPositionsEXT = 5307, + OpHitObjectGetRayFlagsEXT = 5308, + OpHitObjectSetShaderBindingTableRecordIndexEXT = 5309, + OpHitObjectReorderExecuteShaderEXT = 5310, + OpHitObjectTraceReorderExecuteEXT = 5311, + OpHitObjectTraceMotionReorderExecuteEXT = 5312, + OpTypeHitObjectEXT = 5313, + OpReorderThreadWithHintEXT = 5314, + OpReorderThreadWithHitObjectEXT = 5315, + OpHitObjectTraceRayEXT = 5316, + OpHitObjectTraceRayMotionEXT = 5317, + OpHitObjectRecordEmptyEXT = 5318, + OpHitObjectExecuteShaderEXT = 5319, + OpHitObjectGetCurrentTimeEXT = 5320, + OpHitObjectGetAttributesEXT = 5321, + OpHitObjectGetHitKindEXT = 5322, + OpHitObjectGetPrimitiveIndexEXT = 5323, + OpHitObjectGetGeometryIndexEXT = 5324, + OpHitObjectGetInstanceIdEXT = 5325, + OpHitObjectGetInstanceCustomIndexEXT = 5326, + OpHitObjectGetObjectRayOriginEXT = 5327, + OpHitObjectGetObjectRayDirectionEXT = 5328, + OpHitObjectGetWorldRayDirectionEXT = 5329, + OpHitObjectGetWorldRayOriginEXT = 5330, + OpHitObjectGetObjectToWorldEXT = 5331, + OpHitObjectGetWorldToObjectEXT = 5332, + OpHitObjectGetRayTMaxEXT = 5333, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, @@ -2101,7 +2247,14 @@ enum class Op : unsigned { OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, OpRayQueryGetClusterIdNV = 5345, + OpRayQueryGetIntersectionClusterIdNV = 5345, OpHitObjectGetClusterIdNV = 5346, + OpHitObjectGetRayTMinEXT = 5347, + OpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, + OpHitObjectGetShaderRecordBufferHandleEXT = 5349, + OpHitObjectIsEmptyEXT = 5350, + OpHitObjectIsHitEXT = 5351, + OpHitObjectIsMissEXT = 5352, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixStoreNV = 5360, @@ -2308,23 +2461,41 @@ enum class Op : unsigned { OpVariableLengthArrayINTEL = 5818, OpSaveMemoryINTEL = 5819, OpRestoreMemoryINTEL = 5820, + OpArbitraryFloatSinCosPiALTERA = 5840, OpArbitraryFloatSinCosPiINTEL = 5840, + OpArbitraryFloatCastALTERA = 5841, OpArbitraryFloatCastINTEL = 5841, + OpArbitraryFloatCastFromIntALTERA = 5842, OpArbitraryFloatCastFromIntINTEL = 5842, + OpArbitraryFloatCastToIntALTERA = 5843, OpArbitraryFloatCastToIntINTEL = 5843, + OpArbitraryFloatAddALTERA = 5846, OpArbitraryFloatAddINTEL = 5846, + OpArbitraryFloatSubALTERA = 5847, OpArbitraryFloatSubINTEL = 5847, + OpArbitraryFloatMulALTERA = 5848, OpArbitraryFloatMulINTEL = 5848, + OpArbitraryFloatDivALTERA = 5849, OpArbitraryFloatDivINTEL = 5849, + OpArbitraryFloatGTALTERA = 5850, OpArbitraryFloatGTINTEL = 5850, + OpArbitraryFloatGEALTERA = 5851, OpArbitraryFloatGEINTEL = 5851, + OpArbitraryFloatLTALTERA = 5852, OpArbitraryFloatLTINTEL = 5852, + OpArbitraryFloatLEALTERA = 5853, OpArbitraryFloatLEINTEL = 5853, + OpArbitraryFloatEQALTERA = 5854, OpArbitraryFloatEQINTEL = 5854, + OpArbitraryFloatRecipALTERA = 5855, OpArbitraryFloatRecipINTEL = 5855, + OpArbitraryFloatRSqrtALTERA = 5856, OpArbitraryFloatRSqrtINTEL = 5856, + OpArbitraryFloatCbrtALTERA = 5857, OpArbitraryFloatCbrtINTEL = 5857, + OpArbitraryFloatHypotALTERA = 5858, OpArbitraryFloatHypotINTEL = 5858, + OpArbitraryFloatSqrtALTERA = 5859, OpArbitraryFloatSqrtINTEL = 5859, OpArbitraryFloatLogINTEL = 5860, OpArbitraryFloatLog2INTEL = 5861, @@ -2353,21 +2524,37 @@ enum class Op : unsigned { OpAliasDomainDeclINTEL = 5911, OpAliasScopeDeclINTEL = 5912, OpAliasScopeListDeclINTEL = 5913, + OpFixedSqrtALTERA = 5923, OpFixedSqrtINTEL = 5923, + OpFixedRecipALTERA = 5924, OpFixedRecipINTEL = 5924, + OpFixedRsqrtALTERA = 5925, OpFixedRsqrtINTEL = 5925, + OpFixedSinALTERA = 5926, OpFixedSinINTEL = 5926, + OpFixedCosALTERA = 5927, OpFixedCosINTEL = 5927, + OpFixedSinCosALTERA = 5928, OpFixedSinCosINTEL = 5928, + OpFixedSinPiALTERA = 5929, OpFixedSinPiINTEL = 5929, + OpFixedCosPiALTERA = 5930, OpFixedCosPiINTEL = 5930, + OpFixedSinCosPiALTERA = 5931, OpFixedSinCosPiINTEL = 5931, + OpFixedLogALTERA = 5932, OpFixedLogINTEL = 5932, + OpFixedExpALTERA = 5933, OpFixedExpINTEL = 5933, + OpPtrCastToCrossWorkgroupALTERA = 5934, OpPtrCastToCrossWorkgroupINTEL = 5934, + OpCrossWorkgroupCastToPtrALTERA = 5938, OpCrossWorkgroupCastToPtrINTEL = 5938, + OpReadPipeBlockingALTERA = 5946, OpReadPipeBlockingINTEL = 5946, + OpWritePipeBlockingALTERA = 5947, OpWritePipeBlockingINTEL = 5947, + OpFPGARegALTERA = 5949, OpFPGARegINTEL = 5949, OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayFlagsKHR = 6017, @@ -2397,10 +2584,15 @@ enum class Op : unsigned { OpControlBarrierArriveINTEL = 6142, OpControlBarrierWaitINTEL = 6143, OpArithmeticFenceEXT = 6145, + OpTaskSequenceCreateALTERA = 6163, OpTaskSequenceCreateINTEL = 6163, + OpTaskSequenceAsyncALTERA = 6164, OpTaskSequenceAsyncINTEL = 6164, + OpTaskSequenceGetALTERA = 6165, OpTaskSequenceGetINTEL = 6165, + OpTaskSequenceReleaseALTERA = 6166, OpTaskSequenceReleaseINTEL = 6166, + OpTypeTaskSequenceALTERA = 6199, OpTypeTaskSequenceINTEL = 6199, OpSubgroupBlockPrefetchINTEL = 6221, OpSubgroup2DBlockLoadINTEL = 6231, @@ -2410,6 +2602,7 @@ enum class Op : unsigned { OpSubgroup2DBlockStoreINTEL = 6235, OpSubgroupMatrixMultiplyAccumulateINTEL = 6237, OpBitwiseFunctionINTEL = 6242, + OpUntypedVariableLengthArrayINTEL = 6244, OpConditionalExtensionINTEL = 6248, OpConditionalEntryPointINTEL = 6249, OpConditionalCapabilityINTEL = 6250, @@ -2811,12 +3004,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpUntypedInBoundsPtrAccessChainKHR: *hasResult = true; *hasResultType = true; break; case Op::OpUntypedArrayLengthKHR: *hasResult = true; *hasResultType = true; break; case Op::OpUntypedPrefetchKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpFmaKHR: *hasResult = true; *hasResultType = true; break; case Op::OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; case Op::OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; case Op::OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; case Op::OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; case Op::OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; case Op::OpExtInstWithForwardRefsKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpUntypedGroupAsyncCopyKHR: *hasResult = true; *hasResultType = true; break; case Op::OpTraceRayKHR: *hasResult = false; *hasResultType = false; break; case Op::OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; case Op::OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break; @@ -2876,6 +3071,11 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpSpecConstantStringAMDX: *hasResult = true; *hasResultType = false; break; case Op::OpGroupNonUniformQuadAllKHR: *hasResult = true; *hasResultType = true; break; case Op::OpGroupNonUniformQuadAnyKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpTypeBufferEXT: *hasResult = true; *hasResultType = false; break; + case Op::OpBufferPointerEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpUntypedImageTexelPointerEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpMemberDecorateIdEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpConstantSizeOfEXT: *hasResult = true; *hasResultType = true; break; case Op::OpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break; case Op::OpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break; case Op::OpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break; @@ -2910,7 +3110,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break; case Op::OpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break; case Op::OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; - case Op::OpTypeCooperativeVectorNV: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeVectorIdEXT: *hasResult = true; *hasResultType = false; break; case Op::OpCooperativeVectorMatrixMulNV: *hasResult = true; *hasResultType = true; break; case Op::OpCooperativeVectorOuterProductAccumulateNV: *hasResult = false; *hasResultType = false; break; case Op::OpCooperativeVectorReduceSumAccumulateNV: *hasResult = false; *hasResultType = false; break; @@ -2918,12 +3118,42 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpCooperativeMatrixConvertNV: *hasResult = true; *hasResultType = true; break; case Op::OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break; case Op::OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break; - case Op::OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformPartitionEXT: *hasResult = true; *hasResultType = true; break; case Op::OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break; case Op::OpFetchMicroTriangleVertexPositionNV: *hasResult = true; *hasResultType = true; break; case Op::OpFetchMicroTriangleVertexBarycentricNV: *hasResult = true; *hasResultType = true; break; case Op::OpCooperativeVectorLoadNV: *hasResult = true; *hasResultType = true; break; case Op::OpCooperativeVectorStoreNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordFromQueryEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordMissEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordMissMotionEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetRayFlagsEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectSetShaderBindingTableRecordIndexEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectReorderExecuteShaderEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceReorderExecuteEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceMotionReorderExecuteEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpTypeHitObjectEXT: *hasResult = true; *hasResultType = false; break; + case Op::OpReorderThreadWithHintEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpReorderThreadWithHitObjectEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceRayEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceRayMotionEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordEmptyEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectExecuteShaderEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetCurrentTimeEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetAttributesEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetHitKindEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetPrimitiveIndexEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetGeometryIndexEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetInstanceIdEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetInstanceCustomIndexEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectRayOriginEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectRayDirectionEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetWorldRayDirectionEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetWorldRayOriginEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectToWorldEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetWorldToObjectEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetRayTMaxEXT: *hasResult = true; *hasResultType = true; break; case Op::OpReportIntersectionKHR: *hasResult = true; *hasResultType = true; break; case Op::OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break; case Op::OpTerminateRayNV: *hasResult = false; *hasResultType = false; break; @@ -2933,8 +3163,14 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; case Op::OpTypeAccelerationStructureKHR: *hasResult = true; *hasResultType = false; break; case Op::OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; - case Op::OpRayQueryGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionClusterIdNV: *hasResult = true; *hasResultType = true; break; case Op::OpHitObjectGetClusterIdNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetRayTMinEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetShaderBindingTableRecordIndexEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetShaderRecordBufferHandleEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsEmptyEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsHitEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsMissEXT: *hasResult = true; *hasResultType = true; break; case Op::OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; case Op::OpCooperativeMatrixLoadNV: *hasResult = true; *hasResultType = true; break; case Op::OpCooperativeMatrixStoreNV: *hasResult = false; *hasResultType = false; break; @@ -3138,24 +3374,24 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; case Op::OpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break; case Op::OpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break; - case Op::OpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatSinCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCastALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCastFromIntALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCastToIntALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatAddALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatSubALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatMulALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatDivALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatGTALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatGEALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatLTALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatLEALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatEQALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatRecipALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatRSqrtALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCbrtALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatHypotALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatSqrtALTERA: *hasResult = true; *hasResultType = true; break; case Op::OpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break; case Op::OpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break; case Op::OpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break; @@ -3183,22 +3419,22 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpAliasDomainDeclINTEL: *hasResult = true; *hasResultType = false; break; case Op::OpAliasScopeDeclINTEL: *hasResult = true; *hasResultType = false; break; case Op::OpAliasScopeListDeclINTEL: *hasResult = true; *hasResultType = false; break; - case Op::OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedSinINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedCosINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedLogINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFixedExpINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpWritePipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpFPGARegINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSqrtALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedRecipALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedRsqrtALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSinALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedCosALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSinCosALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSinPiALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSinCosPiALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedLogALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedExpALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpPtrCastToCrossWorkgroupALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpCrossWorkgroupCastToPtrALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpReadPipeBlockingALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpWritePipeBlockingALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpFPGARegALTERA: *hasResult = true; *hasResultType = true; break; case Op::OpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break; case Op::OpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break; case Op::OpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break; @@ -3227,11 +3463,11 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break; case Op::OpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break; case Op::OpArithmeticFenceEXT: *hasResult = true; *hasResultType = true; break; - case Op::OpTaskSequenceCreateINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpTaskSequenceAsyncINTEL: *hasResult = false; *hasResultType = false; break; - case Op::OpTaskSequenceGetINTEL: *hasResult = true; *hasResultType = true; break; - case Op::OpTaskSequenceReleaseINTEL: *hasResult = false; *hasResultType = false; break; - case Op::OpTypeTaskSequenceINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTaskSequenceCreateALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpTaskSequenceAsyncALTERA: *hasResult = false; *hasResultType = false; break; + case Op::OpTaskSequenceGetALTERA: *hasResult = true; *hasResultType = true; break; + case Op::OpTaskSequenceReleaseALTERA: *hasResult = false; *hasResultType = false; break; + case Op::OpTypeTaskSequenceALTERA: *hasResult = true; *hasResultType = false; break; case Op::OpSubgroupBlockPrefetchINTEL: *hasResult = false; *hasResultType = false; break; case Op::OpSubgroup2DBlockLoadINTEL: *hasResult = false; *hasResultType = false; break; case Op::OpSubgroup2DBlockLoadTransformINTEL: *hasResult = false; *hasResultType = false; break; @@ -3240,6 +3476,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case Op::OpSubgroup2DBlockStoreINTEL: *hasResult = false; *hasResultType = false; break; case Op::OpSubgroupMatrixMultiplyAccumulateINTEL: *hasResult = true; *hasResultType = true; break; case Op::OpBitwiseFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpUntypedVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; case Op::OpConditionalExtensionINTEL: *hasResult = false; *hasResultType = false; break; case Op::OpConditionalEntryPointINTEL: *hasResult = false; *hasResultType = false; break; case Op::OpConditionalCapabilityINTEL: *hasResult = false; *hasResultType = false; break; @@ -3406,6 +3643,7 @@ inline const char* ExecutionModeToString(ExecutionMode value) { case ExecutionMode::SampleInterlockUnorderedEXT: return "SampleInterlockUnorderedEXT"; case ExecutionMode::ShadingRateInterlockOrderedEXT: return "ShadingRateInterlockOrderedEXT"; case ExecutionMode::ShadingRateInterlockUnorderedEXT: return "ShadingRateInterlockUnorderedEXT"; + case ExecutionMode::Shader64BitIndexingEXT: return "Shader64BitIndexingEXT"; case ExecutionMode::SharedLocalMemorySizeINTEL: return "SharedLocalMemorySizeINTEL"; case ExecutionMode::RoundingModeRTPINTEL: return "RoundingModeRTPINTEL"; case ExecutionMode::RoundingModeRTNINTEL: return "RoundingModeRTNINTEL"; @@ -3455,9 +3693,10 @@ inline const char* StorageClassToString(StorageClass value) { case StorageClass::PhysicalStorageBuffer: return "PhysicalStorageBuffer"; case StorageClass::HitObjectAttributeNV: return "HitObjectAttributeNV"; case StorageClass::TaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT"; + case StorageClass::HitObjectAttributeEXT: return "HitObjectAttributeEXT"; case StorageClass::CodeSectionINTEL: return "CodeSectionINTEL"; - case StorageClass::DeviceOnlyINTEL: return "DeviceOnlyINTEL"; - case StorageClass::HostOnlyINTEL: return "HostOnlyINTEL"; + case StorageClass::DeviceOnlyALTERA: return "DeviceOnlyALTERA"; + case StorageClass::HostOnlyALTERA: return "HostOnlyALTERA"; default: return "Unknown"; } } @@ -3639,7 +3878,7 @@ inline const char* FunctionParameterAttributeToString(FunctionParameterAttribute case FunctionParameterAttribute::NoCapture: return "NoCapture"; case FunctionParameterAttribute::NoWrite: return "NoWrite"; case FunctionParameterAttribute::NoReadWrite: return "NoReadWrite"; - case FunctionParameterAttribute::RuntimeAlignedINTEL: return "RuntimeAlignedINTEL"; + case FunctionParameterAttribute::RuntimeAlignedALTERA: return "RuntimeAlignedALTERA"; default: return "Unknown"; } } @@ -3708,6 +3947,8 @@ inline const char* DecorationToString(Decoration value) { case Decoration::PayloadNodeSparseArrayAMDX: return "PayloadNodeSparseArrayAMDX"; case Decoration::PayloadNodeArraySizeAMDX: return "PayloadNodeArraySizeAMDX"; case Decoration::PayloadDispatchIndirectAMDX: return "PayloadDispatchIndirectAMDX"; + case Decoration::ArrayStrideIdEXT: return "ArrayStrideIdEXT"; + case Decoration::OffsetIdEXT: return "OffsetIdEXT"; case Decoration::OverrideCoverageNV: return "OverrideCoverageNV"; case Decoration::PassthroughNV: return "PassthroughNV"; case Decoration::ViewportRelativeNV: return "ViewportRelativeNV"; @@ -3719,7 +3960,10 @@ inline const char* DecorationToString(Decoration value) { case Decoration::NonUniform: return "NonUniform"; case Decoration::RestrictPointer: return "RestrictPointer"; case Decoration::AliasedPointer: return "AliasedPointer"; + case Decoration::MemberOffsetNV: return "MemberOffsetNV"; case Decoration::HitObjectShaderRecordBufferNV: return "HitObjectShaderRecordBufferNV"; + case Decoration::HitObjectShaderRecordBufferEXT: return "HitObjectShaderRecordBufferEXT"; + case Decoration::BankNV: return "BankNV"; case Decoration::BindlessSamplerNV: return "BindlessSamplerNV"; case Decoration::BindlessImageNV: return "BindlessImageNV"; case Decoration::BoundSamplerNV: return "BoundSamplerNV"; @@ -3738,55 +3982,55 @@ inline const char* DecorationToString(Decoration value) { case Decoration::UserTypeGOOGLE: return "UserTypeGOOGLE"; case Decoration::FunctionRoundingModeINTEL: return "FunctionRoundingModeINTEL"; case Decoration::FunctionDenormModeINTEL: return "FunctionDenormModeINTEL"; - case Decoration::RegisterINTEL: return "RegisterINTEL"; - case Decoration::MemoryINTEL: return "MemoryINTEL"; - case Decoration::NumbanksINTEL: return "NumbanksINTEL"; - case Decoration::BankwidthINTEL: return "BankwidthINTEL"; - case Decoration::MaxPrivateCopiesINTEL: return "MaxPrivateCopiesINTEL"; - case Decoration::SinglepumpINTEL: return "SinglepumpINTEL"; - case Decoration::DoublepumpINTEL: return "DoublepumpINTEL"; - case Decoration::MaxReplicatesINTEL: return "MaxReplicatesINTEL"; - case Decoration::SimpleDualPortINTEL: return "SimpleDualPortINTEL"; - case Decoration::MergeINTEL: return "MergeINTEL"; - case Decoration::BankBitsINTEL: return "BankBitsINTEL"; - case Decoration::ForcePow2DepthINTEL: return "ForcePow2DepthINTEL"; - case Decoration::StridesizeINTEL: return "StridesizeINTEL"; - case Decoration::WordsizeINTEL: return "WordsizeINTEL"; - case Decoration::TrueDualPortINTEL: return "TrueDualPortINTEL"; - case Decoration::BurstCoalesceINTEL: return "BurstCoalesceINTEL"; - case Decoration::CacheSizeINTEL: return "CacheSizeINTEL"; - case Decoration::DontStaticallyCoalesceINTEL: return "DontStaticallyCoalesceINTEL"; - case Decoration::PrefetchINTEL: return "PrefetchINTEL"; - case Decoration::StallEnableINTEL: return "StallEnableINTEL"; - case Decoration::FuseLoopsInFunctionINTEL: return "FuseLoopsInFunctionINTEL"; - case Decoration::MathOpDSPModeINTEL: return "MathOpDSPModeINTEL"; + case Decoration::RegisterALTERA: return "RegisterALTERA"; + case Decoration::MemoryALTERA: return "MemoryALTERA"; + case Decoration::NumbanksALTERA: return "NumbanksALTERA"; + case Decoration::BankwidthALTERA: return "BankwidthALTERA"; + case Decoration::MaxPrivateCopiesALTERA: return "MaxPrivateCopiesALTERA"; + case Decoration::SinglepumpALTERA: return "SinglepumpALTERA"; + case Decoration::DoublepumpALTERA: return "DoublepumpALTERA"; + case Decoration::MaxReplicatesALTERA: return "MaxReplicatesALTERA"; + case Decoration::SimpleDualPortALTERA: return "SimpleDualPortALTERA"; + case Decoration::MergeALTERA: return "MergeALTERA"; + case Decoration::BankBitsALTERA: return "BankBitsALTERA"; + case Decoration::ForcePow2DepthALTERA: return "ForcePow2DepthALTERA"; + case Decoration::StridesizeALTERA: return "StridesizeALTERA"; + case Decoration::WordsizeALTERA: return "WordsizeALTERA"; + case Decoration::TrueDualPortALTERA: return "TrueDualPortALTERA"; + case Decoration::BurstCoalesceALTERA: return "BurstCoalesceALTERA"; + case Decoration::CacheSizeALTERA: return "CacheSizeALTERA"; + case Decoration::DontStaticallyCoalesceALTERA: return "DontStaticallyCoalesceALTERA"; + case Decoration::PrefetchALTERA: return "PrefetchALTERA"; + case Decoration::StallEnableALTERA: return "StallEnableALTERA"; + case Decoration::FuseLoopsInFunctionALTERA: return "FuseLoopsInFunctionALTERA"; + case Decoration::MathOpDSPModeALTERA: return "MathOpDSPModeALTERA"; case Decoration::AliasScopeINTEL: return "AliasScopeINTEL"; case Decoration::NoAliasINTEL: return "NoAliasINTEL"; - case Decoration::InitiationIntervalINTEL: return "InitiationIntervalINTEL"; - case Decoration::MaxConcurrencyINTEL: return "MaxConcurrencyINTEL"; - case Decoration::PipelineEnableINTEL: return "PipelineEnableINTEL"; - case Decoration::BufferLocationINTEL: return "BufferLocationINTEL"; - case Decoration::IOPipeStorageINTEL: return "IOPipeStorageINTEL"; + case Decoration::InitiationIntervalALTERA: return "InitiationIntervalALTERA"; + case Decoration::MaxConcurrencyALTERA: return "MaxConcurrencyALTERA"; + case Decoration::PipelineEnableALTERA: return "PipelineEnableALTERA"; + case Decoration::BufferLocationALTERA: return "BufferLocationALTERA"; + case Decoration::IOPipeStorageALTERA: return "IOPipeStorageALTERA"; case Decoration::FunctionFloatingPointModeINTEL: return "FunctionFloatingPointModeINTEL"; case Decoration::SingleElementVectorINTEL: return "SingleElementVectorINTEL"; case Decoration::VectorComputeCallableFunctionINTEL: return "VectorComputeCallableFunctionINTEL"; case Decoration::MediaBlockIOINTEL: return "MediaBlockIOINTEL"; - case Decoration::StallFreeINTEL: return "StallFreeINTEL"; + case Decoration::StallFreeALTERA: return "StallFreeALTERA"; case Decoration::FPMaxErrorDecorationINTEL: return "FPMaxErrorDecorationINTEL"; - case Decoration::LatencyControlLabelINTEL: return "LatencyControlLabelINTEL"; - case Decoration::LatencyControlConstraintINTEL: return "LatencyControlConstraintINTEL"; - case Decoration::ConduitKernelArgumentINTEL: return "ConduitKernelArgumentINTEL"; - case Decoration::RegisterMapKernelArgumentINTEL: return "RegisterMapKernelArgumentINTEL"; - case Decoration::MMHostInterfaceAddressWidthINTEL: return "MMHostInterfaceAddressWidthINTEL"; - case Decoration::MMHostInterfaceDataWidthINTEL: return "MMHostInterfaceDataWidthINTEL"; - case Decoration::MMHostInterfaceLatencyINTEL: return "MMHostInterfaceLatencyINTEL"; - case Decoration::MMHostInterfaceReadWriteModeINTEL: return "MMHostInterfaceReadWriteModeINTEL"; - case Decoration::MMHostInterfaceMaxBurstINTEL: return "MMHostInterfaceMaxBurstINTEL"; - case Decoration::MMHostInterfaceWaitRequestINTEL: return "MMHostInterfaceWaitRequestINTEL"; - case Decoration::StableKernelArgumentINTEL: return "StableKernelArgumentINTEL"; + case Decoration::LatencyControlLabelALTERA: return "LatencyControlLabelALTERA"; + case Decoration::LatencyControlConstraintALTERA: return "LatencyControlConstraintALTERA"; + case Decoration::ConduitKernelArgumentALTERA: return "ConduitKernelArgumentALTERA"; + case Decoration::RegisterMapKernelArgumentALTERA: return "RegisterMapKernelArgumentALTERA"; + case Decoration::MMHostInterfaceAddressWidthALTERA: return "MMHostInterfaceAddressWidthALTERA"; + case Decoration::MMHostInterfaceDataWidthALTERA: return "MMHostInterfaceDataWidthALTERA"; + case Decoration::MMHostInterfaceLatencyALTERA: return "MMHostInterfaceLatencyALTERA"; + case Decoration::MMHostInterfaceReadWriteModeALTERA: return "MMHostInterfaceReadWriteModeALTERA"; + case Decoration::MMHostInterfaceMaxBurstALTERA: return "MMHostInterfaceMaxBurstALTERA"; + case Decoration::MMHostInterfaceWaitRequestALTERA: return "MMHostInterfaceWaitRequestALTERA"; + case Decoration::StableKernelArgumentALTERA: return "StableKernelArgumentALTERA"; case Decoration::HostAccessINTEL: return "HostAccessINTEL"; - case Decoration::InitModeINTEL: return "InitModeINTEL"; - case Decoration::ImplementInRegisterMapINTEL: return "ImplementInRegisterMapINTEL"; + case Decoration::InitModeALTERA: return "InitModeALTERA"; + case Decoration::ImplementInRegisterMapALTERA: return "ImplementInRegisterMapALTERA"; case Decoration::ConditionalINTEL: return "ConditionalINTEL"; case Decoration::CacheControlLoadINTEL: return "CacheControlLoadINTEL"; case Decoration::CacheControlStoreINTEL: return "CacheControlStoreINTEL"; @@ -3867,6 +4111,8 @@ inline const char* BuiltInToString(BuiltIn value) { case BuiltIn::FragStencilRefEXT: return "FragStencilRefEXT"; case BuiltIn::RemainingRecursionLevelsAMDX: return "RemainingRecursionLevelsAMDX"; case BuiltIn::ShaderIndexAMDX: return "ShaderIndexAMDX"; + case BuiltIn::SamplerHeapEXT: return "SamplerHeapEXT"; + case BuiltIn::ResourceHeapEXT: return "ResourceHeapEXT"; case BuiltIn::ViewportMaskNV: return "ViewportMaskNV"; case BuiltIn::SecondaryPositionNV: return "SecondaryPositionNV"; case BuiltIn::SecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; @@ -3945,9 +4191,9 @@ inline const char* GroupOperationToString(GroupOperation value) { case GroupOperation::InclusiveScan: return "InclusiveScan"; case GroupOperation::ExclusiveScan: return "ExclusiveScan"; case GroupOperation::ClusteredReduce: return "ClusteredReduce"; - case GroupOperation::PartitionedReduceNV: return "PartitionedReduceNV"; - case GroupOperation::PartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV"; - case GroupOperation::PartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV"; + case GroupOperation::PartitionedReduceEXT: return "PartitionedReduceEXT"; + case GroupOperation::PartitionedInclusiveScanEXT: return "PartitionedInclusiveScanEXT"; + case GroupOperation::PartitionedExclusiveScanEXT: return "PartitionedExclusiveScanEXT"; default: return "Unknown"; } } @@ -4094,6 +4340,7 @@ inline const char* CapabilityToString(Capability value) { case Capability::BFloat16TypeKHR: return "BFloat16TypeKHR"; case Capability::BFloat16DotProductKHR: return "BFloat16DotProductKHR"; case Capability::BFloat16CooperativeMatrixKHR: return "BFloat16CooperativeMatrixKHR"; + case Capability::DescriptorHeapEXT: return "DescriptorHeapEXT"; case Capability::SampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV"; case Capability::GeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV"; case Capability::ShaderViewportIndexLayerEXT: return "ShaderViewportIndexLayerEXT"; @@ -4107,7 +4354,7 @@ inline const char* CapabilityToString(Capability value) { case Capability::FragmentBarycentricKHR: return "FragmentBarycentricKHR"; case Capability::ComputeDerivativeGroupQuadsKHR: return "ComputeDerivativeGroupQuadsKHR"; case Capability::FragmentDensityEXT: return "FragmentDensityEXT"; - case Capability::GroupNonUniformPartitionedNV: return "GroupNonUniformPartitionedNV"; + case Capability::GroupNonUniformPartitionedEXT: return "GroupNonUniformPartitionedEXT"; case Capability::ShaderNonUniform: return "ShaderNonUniform"; case Capability::RuntimeDescriptorArray: return "RuntimeDescriptorArray"; case Capability::InputAttachmentArrayDynamicIndexing: return "InputAttachmentArrayDynamicIndexing"; @@ -4137,6 +4384,7 @@ inline const char* CapabilityToString(Capability value) { case Capability::DisplacementMicromapNV: return "DisplacementMicromapNV"; case Capability::RayTracingOpacityMicromapEXT: return "RayTracingOpacityMicromapEXT"; case Capability::ShaderInvocationReorderNV: return "ShaderInvocationReorderNV"; + case Capability::ShaderInvocationReorderEXT: return "ShaderInvocationReorderEXT"; case Capability::BindlessTextureNV: return "BindlessTextureNV"; case Capability::RayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR"; case Capability::CooperativeVectorNV: return "CooperativeVectorNV"; @@ -4145,6 +4393,9 @@ inline const char* CapabilityToString(Capability value) { case Capability::RawAccessChainsNV: return "RawAccessChainsNV"; case Capability::RayTracingSpheresGeometryNV: return "RayTracingSpheresGeometryNV"; case Capability::RayTracingLinearSweptSpheresGeometryNV: return "RayTracingLinearSweptSpheresGeometryNV"; + case Capability::PushConstantBanksNV: return "PushConstantBanksNV"; + case Capability::LongVectorEXT: return "LongVectorEXT"; + case Capability::Shader64BitIndexingEXT: return "Shader64BitIndexingEXT"; case Capability::CooperativeMatrixReductionsNV: return "CooperativeMatrixReductionsNV"; case Capability::CooperativeMatrixConversionsNV: return "CooperativeMatrixConversionsNV"; case Capability::CooperativeMatrixPerElementOperationsNV: return "CooperativeMatrixPerElementOperationsNV"; @@ -4174,27 +4425,27 @@ inline const char* CapabilityToString(Capability value) { case Capability::SubgroupAvcMotionEstimationChromaINTEL: return "SubgroupAvcMotionEstimationChromaINTEL"; case Capability::VariableLengthArrayINTEL: return "VariableLengthArrayINTEL"; case Capability::FunctionFloatControlINTEL: return "FunctionFloatControlINTEL"; - case Capability::FPGAMemoryAttributesINTEL: return "FPGAMemoryAttributesINTEL"; + case Capability::FPGAMemoryAttributesALTERA: return "FPGAMemoryAttributesALTERA"; case Capability::FPFastMathModeINTEL: return "FPFastMathModeINTEL"; - case Capability::ArbitraryPrecisionIntegersINTEL: return "ArbitraryPrecisionIntegersINTEL"; - case Capability::ArbitraryPrecisionFloatingPointINTEL: return "ArbitraryPrecisionFloatingPointINTEL"; + case Capability::ArbitraryPrecisionIntegersALTERA: return "ArbitraryPrecisionIntegersALTERA"; + case Capability::ArbitraryPrecisionFloatingPointALTERA: return "ArbitraryPrecisionFloatingPointALTERA"; case Capability::UnstructuredLoopControlsINTEL: return "UnstructuredLoopControlsINTEL"; - case Capability::FPGALoopControlsINTEL: return "FPGALoopControlsINTEL"; + case Capability::FPGALoopControlsALTERA: return "FPGALoopControlsALTERA"; case Capability::KernelAttributesINTEL: return "KernelAttributesINTEL"; case Capability::FPGAKernelAttributesINTEL: return "FPGAKernelAttributesINTEL"; - case Capability::FPGAMemoryAccessesINTEL: return "FPGAMemoryAccessesINTEL"; - case Capability::FPGAClusterAttributesINTEL: return "FPGAClusterAttributesINTEL"; - case Capability::LoopFuseINTEL: return "LoopFuseINTEL"; - case Capability::FPGADSPControlINTEL: return "FPGADSPControlINTEL"; + case Capability::FPGAMemoryAccessesALTERA: return "FPGAMemoryAccessesALTERA"; + case Capability::FPGAClusterAttributesALTERA: return "FPGAClusterAttributesALTERA"; + case Capability::LoopFuseALTERA: return "LoopFuseALTERA"; + case Capability::FPGADSPControlALTERA: return "FPGADSPControlALTERA"; case Capability::MemoryAccessAliasingINTEL: return "MemoryAccessAliasingINTEL"; - case Capability::FPGAInvocationPipeliningAttributesINTEL: return "FPGAInvocationPipeliningAttributesINTEL"; - case Capability::FPGABufferLocationINTEL: return "FPGABufferLocationINTEL"; - case Capability::ArbitraryPrecisionFixedPointINTEL: return "ArbitraryPrecisionFixedPointINTEL"; - case Capability::USMStorageClassesINTEL: return "USMStorageClassesINTEL"; - case Capability::RuntimeAlignedAttributeINTEL: return "RuntimeAlignedAttributeINTEL"; - case Capability::IOPipesINTEL: return "IOPipesINTEL"; - case Capability::BlockingPipesINTEL: return "BlockingPipesINTEL"; - case Capability::FPGARegINTEL: return "FPGARegINTEL"; + case Capability::FPGAInvocationPipeliningAttributesALTERA: return "FPGAInvocationPipeliningAttributesALTERA"; + case Capability::FPGABufferLocationALTERA: return "FPGABufferLocationALTERA"; + case Capability::ArbitraryPrecisionFixedPointALTERA: return "ArbitraryPrecisionFixedPointALTERA"; + case Capability::USMStorageClassesALTERA: return "USMStorageClassesALTERA"; + case Capability::RuntimeAlignedAttributeALTERA: return "RuntimeAlignedAttributeALTERA"; + case Capability::IOPipesALTERA: return "IOPipesALTERA"; + case Capability::BlockingPipesALTERA: return "BlockingPipesALTERA"; + case Capability::FPGARegALTERA: return "FPGARegALTERA"; case Capability::DotProductInputAll: return "DotProductInputAll"; case Capability::DotProductInput4x8Bit: return "DotProductInput4x8Bit"; case Capability::DotProductInput4x8BitPacked: return "DotProductInput4x8BitPacked"; @@ -4205,6 +4456,7 @@ inline const char* CapabilityToString(Capability value) { case Capability::BitInstructions: return "BitInstructions"; case Capability::GroupNonUniformRotateKHR: return "GroupNonUniformRotateKHR"; case Capability::FloatControls2: return "FloatControls2"; + case Capability::FMAKHR: return "FMAKHR"; case Capability::AtomicFloat32AddEXT: return "AtomicFloat32AddEXT"; case Capability::AtomicFloat64AddEXT: return "AtomicFloat64AddEXT"; case Capability::LongCompositesINTEL: return "LongCompositesINTEL"; @@ -4214,20 +4466,21 @@ inline const char* CapabilityToString(Capability value) { case Capability::BFloat16ConversionINTEL: return "BFloat16ConversionINTEL"; case Capability::SplitBarrierINTEL: return "SplitBarrierINTEL"; case Capability::ArithmeticFenceEXT: return "ArithmeticFenceEXT"; - case Capability::FPGAClusterAttributesV2INTEL: return "FPGAClusterAttributesV2INTEL"; + case Capability::FPGAClusterAttributesV2ALTERA: return "FPGAClusterAttributesV2ALTERA"; case Capability::FPGAKernelAttributesv2INTEL: return "FPGAKernelAttributesv2INTEL"; - case Capability::TaskSequenceINTEL: return "TaskSequenceINTEL"; + case Capability::TaskSequenceALTERA: return "TaskSequenceALTERA"; case Capability::FPMaxErrorINTEL: return "FPMaxErrorINTEL"; - case Capability::FPGALatencyControlINTEL: return "FPGALatencyControlINTEL"; - case Capability::FPGAArgumentInterfacesINTEL: return "FPGAArgumentInterfacesINTEL"; + case Capability::FPGALatencyControlALTERA: return "FPGALatencyControlALTERA"; + case Capability::FPGAArgumentInterfacesALTERA: return "FPGAArgumentInterfacesALTERA"; case Capability::GlobalVariableHostAccessINTEL: return "GlobalVariableHostAccessINTEL"; - case Capability::GlobalVariableFPGADecorationsINTEL: return "GlobalVariableFPGADecorationsINTEL"; + case Capability::GlobalVariableFPGADecorationsALTERA: return "GlobalVariableFPGADecorationsALTERA"; case Capability::SubgroupBufferPrefetchINTEL: return "SubgroupBufferPrefetchINTEL"; case Capability::Subgroup2DBlockIOINTEL: return "Subgroup2DBlockIOINTEL"; case Capability::Subgroup2DBlockTransformINTEL: return "Subgroup2DBlockTransformINTEL"; case Capability::Subgroup2DBlockTransposeINTEL: return "Subgroup2DBlockTransposeINTEL"; case Capability::SubgroupMatrixMultiplyAccumulateINTEL: return "SubgroupMatrixMultiplyAccumulateINTEL"; case Capability::TernaryBitwiseFunctionINTEL: return "TernaryBitwiseFunctionINTEL"; + case Capability::UntypedVariableLengthArrayINTEL: return "UntypedVariableLengthArrayINTEL"; case Capability::SpecConditionalINTEL: return "SpecConditionalINTEL"; case Capability::FunctionVariantsINTEL: return "FunctionVariantsINTEL"; case Capability::GroupUniformArithmeticKHR: return "GroupUniformArithmeticKHR"; @@ -4344,8 +4597,8 @@ inline const char* TensorClampModeToString(TensorClampMode value) { inline const char* InitializationModeQualifierToString(InitializationModeQualifier value) { switch (value) { - case InitializationModeQualifier::InitOnDeviceReprogramINTEL: return "InitOnDeviceReprogramINTEL"; - case InitializationModeQualifier::InitOnDeviceResetINTEL: return "InitOnDeviceResetINTEL"; + case InitializationModeQualifier::InitOnDeviceReprogramALTERA: return "InitOnDeviceReprogramALTERA"; + case InitializationModeQualifier::InitOnDeviceResetALTERA: return "InitOnDeviceResetALTERA"; default: return "Unknown"; } } @@ -4799,12 +5052,14 @@ inline const char* OpToString(Op value) { case Op::OpUntypedInBoundsPtrAccessChainKHR: return "OpUntypedInBoundsPtrAccessChainKHR"; case Op::OpUntypedArrayLengthKHR: return "OpUntypedArrayLengthKHR"; case Op::OpUntypedPrefetchKHR: return "OpUntypedPrefetchKHR"; + case Op::OpFmaKHR: return "OpFmaKHR"; case Op::OpSubgroupAllKHR: return "OpSubgroupAllKHR"; case Op::OpSubgroupAnyKHR: return "OpSubgroupAnyKHR"; case Op::OpSubgroupAllEqualKHR: return "OpSubgroupAllEqualKHR"; case Op::OpGroupNonUniformRotateKHR: return "OpGroupNonUniformRotateKHR"; case Op::OpSubgroupReadInvocationKHR: return "OpSubgroupReadInvocationKHR"; case Op::OpExtInstWithForwardRefsKHR: return "OpExtInstWithForwardRefsKHR"; + case Op::OpUntypedGroupAsyncCopyKHR: return "OpUntypedGroupAsyncCopyKHR"; case Op::OpTraceRayKHR: return "OpTraceRayKHR"; case Op::OpExecuteCallableKHR: return "OpExecuteCallableKHR"; case Op::OpConvertUToAccelerationStructureKHR: return "OpConvertUToAccelerationStructureKHR"; @@ -4864,6 +5119,11 @@ inline const char* OpToString(Op value) { case Op::OpSpecConstantStringAMDX: return "OpSpecConstantStringAMDX"; case Op::OpGroupNonUniformQuadAllKHR: return "OpGroupNonUniformQuadAllKHR"; case Op::OpGroupNonUniformQuadAnyKHR: return "OpGroupNonUniformQuadAnyKHR"; + case Op::OpTypeBufferEXT: return "OpTypeBufferEXT"; + case Op::OpBufferPointerEXT: return "OpBufferPointerEXT"; + case Op::OpUntypedImageTexelPointerEXT: return "OpUntypedImageTexelPointerEXT"; + case Op::OpMemberDecorateIdEXT: return "OpMemberDecorateIdEXT"; + case Op::OpConstantSizeOfEXT: return "OpConstantSizeOfEXT"; case Op::OpHitObjectRecordHitMotionNV: return "OpHitObjectRecordHitMotionNV"; case Op::OpHitObjectRecordHitWithIndexMotionNV: return "OpHitObjectRecordHitWithIndexMotionNV"; case Op::OpHitObjectRecordMissMotionNV: return "OpHitObjectRecordMissMotionNV"; @@ -4906,12 +5166,42 @@ inline const char* OpToString(Op value) { case Op::OpCooperativeMatrixConvertNV: return "OpCooperativeMatrixConvertNV"; case Op::OpEmitMeshTasksEXT: return "OpEmitMeshTasksEXT"; case Op::OpSetMeshOutputsEXT: return "OpSetMeshOutputsEXT"; - case Op::OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV"; + case Op::OpGroupNonUniformPartitionEXT: return "OpGroupNonUniformPartitionEXT"; case Op::OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV"; case Op::OpFetchMicroTriangleVertexPositionNV: return "OpFetchMicroTriangleVertexPositionNV"; case Op::OpFetchMicroTriangleVertexBarycentricNV: return "OpFetchMicroTriangleVertexBarycentricNV"; case Op::OpCooperativeVectorLoadNV: return "OpCooperativeVectorLoadNV"; case Op::OpCooperativeVectorStoreNV: return "OpCooperativeVectorStoreNV"; + case Op::OpHitObjectRecordFromQueryEXT: return "OpHitObjectRecordFromQueryEXT"; + case Op::OpHitObjectRecordMissEXT: return "OpHitObjectRecordMissEXT"; + case Op::OpHitObjectRecordMissMotionEXT: return "OpHitObjectRecordMissMotionEXT"; + case Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT: return "OpHitObjectGetIntersectionTriangleVertexPositionsEXT"; + case Op::OpHitObjectGetRayFlagsEXT: return "OpHitObjectGetRayFlagsEXT"; + case Op::OpHitObjectSetShaderBindingTableRecordIndexEXT: return "OpHitObjectSetShaderBindingTableRecordIndexEXT"; + case Op::OpHitObjectReorderExecuteShaderEXT: return "OpHitObjectReorderExecuteShaderEXT"; + case Op::OpHitObjectTraceReorderExecuteEXT: return "OpHitObjectTraceReorderExecuteEXT"; + case Op::OpHitObjectTraceMotionReorderExecuteEXT: return "OpHitObjectTraceMotionReorderExecuteEXT"; + case Op::OpTypeHitObjectEXT: return "OpTypeHitObjectEXT"; + case Op::OpReorderThreadWithHintEXT: return "OpReorderThreadWithHintEXT"; + case Op::OpReorderThreadWithHitObjectEXT: return "OpReorderThreadWithHitObjectEXT"; + case Op::OpHitObjectTraceRayEXT: return "OpHitObjectTraceRayEXT"; + case Op::OpHitObjectTraceRayMotionEXT: return "OpHitObjectTraceRayMotionEXT"; + case Op::OpHitObjectRecordEmptyEXT: return "OpHitObjectRecordEmptyEXT"; + case Op::OpHitObjectExecuteShaderEXT: return "OpHitObjectExecuteShaderEXT"; + case Op::OpHitObjectGetCurrentTimeEXT: return "OpHitObjectGetCurrentTimeEXT"; + case Op::OpHitObjectGetAttributesEXT: return "OpHitObjectGetAttributesEXT"; + case Op::OpHitObjectGetHitKindEXT: return "OpHitObjectGetHitKindEXT"; + case Op::OpHitObjectGetPrimitiveIndexEXT: return "OpHitObjectGetPrimitiveIndexEXT"; + case Op::OpHitObjectGetGeometryIndexEXT: return "OpHitObjectGetGeometryIndexEXT"; + case Op::OpHitObjectGetInstanceIdEXT: return "OpHitObjectGetInstanceIdEXT"; + case Op::OpHitObjectGetInstanceCustomIndexEXT: return "OpHitObjectGetInstanceCustomIndexEXT"; + case Op::OpHitObjectGetObjectRayOriginEXT: return "OpHitObjectGetObjectRayOriginEXT"; + case Op::OpHitObjectGetObjectRayDirectionEXT: return "OpHitObjectGetObjectRayDirectionEXT"; + case Op::OpHitObjectGetWorldRayDirectionEXT: return "OpHitObjectGetWorldRayDirectionEXT"; + case Op::OpHitObjectGetWorldRayOriginEXT: return "OpHitObjectGetWorldRayOriginEXT"; + case Op::OpHitObjectGetObjectToWorldEXT: return "OpHitObjectGetObjectToWorldEXT"; + case Op::OpHitObjectGetWorldToObjectEXT: return "OpHitObjectGetWorldToObjectEXT"; + case Op::OpHitObjectGetRayTMaxEXT: return "OpHitObjectGetRayTMaxEXT"; case Op::OpReportIntersectionKHR: return "OpReportIntersectionKHR"; case Op::OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV"; case Op::OpTerminateRayNV: return "OpTerminateRayNV"; @@ -4923,6 +5213,12 @@ inline const char* OpToString(Op value) { case Op::OpExecuteCallableNV: return "OpExecuteCallableNV"; case Op::OpRayQueryGetClusterIdNV: return "OpRayQueryGetClusterIdNV"; case Op::OpHitObjectGetClusterIdNV: return "OpHitObjectGetClusterIdNV"; + case Op::OpHitObjectGetRayTMinEXT: return "OpHitObjectGetRayTMinEXT"; + case Op::OpHitObjectGetShaderBindingTableRecordIndexEXT: return "OpHitObjectGetShaderBindingTableRecordIndexEXT"; + case Op::OpHitObjectGetShaderRecordBufferHandleEXT: return "OpHitObjectGetShaderRecordBufferHandleEXT"; + case Op::OpHitObjectIsEmptyEXT: return "OpHitObjectIsEmptyEXT"; + case Op::OpHitObjectIsHitEXT: return "OpHitObjectIsHitEXT"; + case Op::OpHitObjectIsMissEXT: return "OpHitObjectIsMissEXT"; case Op::OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV"; case Op::OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV"; case Op::OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV"; @@ -5126,24 +5422,24 @@ inline const char* OpToString(Op value) { case Op::OpVariableLengthArrayINTEL: return "OpVariableLengthArrayINTEL"; case Op::OpSaveMemoryINTEL: return "OpSaveMemoryINTEL"; case Op::OpRestoreMemoryINTEL: return "OpRestoreMemoryINTEL"; - case Op::OpArbitraryFloatSinCosPiINTEL: return "OpArbitraryFloatSinCosPiINTEL"; - case Op::OpArbitraryFloatCastINTEL: return "OpArbitraryFloatCastINTEL"; - case Op::OpArbitraryFloatCastFromIntINTEL: return "OpArbitraryFloatCastFromIntINTEL"; - case Op::OpArbitraryFloatCastToIntINTEL: return "OpArbitraryFloatCastToIntINTEL"; - case Op::OpArbitraryFloatAddINTEL: return "OpArbitraryFloatAddINTEL"; - case Op::OpArbitraryFloatSubINTEL: return "OpArbitraryFloatSubINTEL"; - case Op::OpArbitraryFloatMulINTEL: return "OpArbitraryFloatMulINTEL"; - case Op::OpArbitraryFloatDivINTEL: return "OpArbitraryFloatDivINTEL"; - case Op::OpArbitraryFloatGTINTEL: return "OpArbitraryFloatGTINTEL"; - case Op::OpArbitraryFloatGEINTEL: return "OpArbitraryFloatGEINTEL"; - case Op::OpArbitraryFloatLTINTEL: return "OpArbitraryFloatLTINTEL"; - case Op::OpArbitraryFloatLEINTEL: return "OpArbitraryFloatLEINTEL"; - case Op::OpArbitraryFloatEQINTEL: return "OpArbitraryFloatEQINTEL"; - case Op::OpArbitraryFloatRecipINTEL: return "OpArbitraryFloatRecipINTEL"; - case Op::OpArbitraryFloatRSqrtINTEL: return "OpArbitraryFloatRSqrtINTEL"; - case Op::OpArbitraryFloatCbrtINTEL: return "OpArbitraryFloatCbrtINTEL"; - case Op::OpArbitraryFloatHypotINTEL: return "OpArbitraryFloatHypotINTEL"; - case Op::OpArbitraryFloatSqrtINTEL: return "OpArbitraryFloatSqrtINTEL"; + case Op::OpArbitraryFloatSinCosPiALTERA: return "OpArbitraryFloatSinCosPiALTERA"; + case Op::OpArbitraryFloatCastALTERA: return "OpArbitraryFloatCastALTERA"; + case Op::OpArbitraryFloatCastFromIntALTERA: return "OpArbitraryFloatCastFromIntALTERA"; + case Op::OpArbitraryFloatCastToIntALTERA: return "OpArbitraryFloatCastToIntALTERA"; + case Op::OpArbitraryFloatAddALTERA: return "OpArbitraryFloatAddALTERA"; + case Op::OpArbitraryFloatSubALTERA: return "OpArbitraryFloatSubALTERA"; + case Op::OpArbitraryFloatMulALTERA: return "OpArbitraryFloatMulALTERA"; + case Op::OpArbitraryFloatDivALTERA: return "OpArbitraryFloatDivALTERA"; + case Op::OpArbitraryFloatGTALTERA: return "OpArbitraryFloatGTALTERA"; + case Op::OpArbitraryFloatGEALTERA: return "OpArbitraryFloatGEALTERA"; + case Op::OpArbitraryFloatLTALTERA: return "OpArbitraryFloatLTALTERA"; + case Op::OpArbitraryFloatLEALTERA: return "OpArbitraryFloatLEALTERA"; + case Op::OpArbitraryFloatEQALTERA: return "OpArbitraryFloatEQALTERA"; + case Op::OpArbitraryFloatRecipALTERA: return "OpArbitraryFloatRecipALTERA"; + case Op::OpArbitraryFloatRSqrtALTERA: return "OpArbitraryFloatRSqrtALTERA"; + case Op::OpArbitraryFloatCbrtALTERA: return "OpArbitraryFloatCbrtALTERA"; + case Op::OpArbitraryFloatHypotALTERA: return "OpArbitraryFloatHypotALTERA"; + case Op::OpArbitraryFloatSqrtALTERA: return "OpArbitraryFloatSqrtALTERA"; case Op::OpArbitraryFloatLogINTEL: return "OpArbitraryFloatLogINTEL"; case Op::OpArbitraryFloatLog2INTEL: return "OpArbitraryFloatLog2INTEL"; case Op::OpArbitraryFloatLog10INTEL: return "OpArbitraryFloatLog10INTEL"; @@ -5171,22 +5467,22 @@ inline const char* OpToString(Op value) { case Op::OpAliasDomainDeclINTEL: return "OpAliasDomainDeclINTEL"; case Op::OpAliasScopeDeclINTEL: return "OpAliasScopeDeclINTEL"; case Op::OpAliasScopeListDeclINTEL: return "OpAliasScopeListDeclINTEL"; - case Op::OpFixedSqrtINTEL: return "OpFixedSqrtINTEL"; - case Op::OpFixedRecipINTEL: return "OpFixedRecipINTEL"; - case Op::OpFixedRsqrtINTEL: return "OpFixedRsqrtINTEL"; - case Op::OpFixedSinINTEL: return "OpFixedSinINTEL"; - case Op::OpFixedCosINTEL: return "OpFixedCosINTEL"; - case Op::OpFixedSinCosINTEL: return "OpFixedSinCosINTEL"; - case Op::OpFixedSinPiINTEL: return "OpFixedSinPiINTEL"; - case Op::OpFixedCosPiINTEL: return "OpFixedCosPiINTEL"; - case Op::OpFixedSinCosPiINTEL: return "OpFixedSinCosPiINTEL"; - case Op::OpFixedLogINTEL: return "OpFixedLogINTEL"; - case Op::OpFixedExpINTEL: return "OpFixedExpINTEL"; - case Op::OpPtrCastToCrossWorkgroupINTEL: return "OpPtrCastToCrossWorkgroupINTEL"; - case Op::OpCrossWorkgroupCastToPtrINTEL: return "OpCrossWorkgroupCastToPtrINTEL"; - case Op::OpReadPipeBlockingINTEL: return "OpReadPipeBlockingINTEL"; - case Op::OpWritePipeBlockingINTEL: return "OpWritePipeBlockingINTEL"; - case Op::OpFPGARegINTEL: return "OpFPGARegINTEL"; + case Op::OpFixedSqrtALTERA: return "OpFixedSqrtALTERA"; + case Op::OpFixedRecipALTERA: return "OpFixedRecipALTERA"; + case Op::OpFixedRsqrtALTERA: return "OpFixedRsqrtALTERA"; + case Op::OpFixedSinALTERA: return "OpFixedSinALTERA"; + case Op::OpFixedCosALTERA: return "OpFixedCosALTERA"; + case Op::OpFixedSinCosALTERA: return "OpFixedSinCosALTERA"; + case Op::OpFixedSinPiALTERA: return "OpFixedSinPiALTERA"; + case Op::OpFixedCosPiALTERA: return "OpFixedCosPiALTERA"; + case Op::OpFixedSinCosPiALTERA: return "OpFixedSinCosPiALTERA"; + case Op::OpFixedLogALTERA: return "OpFixedLogALTERA"; + case Op::OpFixedExpALTERA: return "OpFixedExpALTERA"; + case Op::OpPtrCastToCrossWorkgroupALTERA: return "OpPtrCastToCrossWorkgroupALTERA"; + case Op::OpCrossWorkgroupCastToPtrALTERA: return "OpCrossWorkgroupCastToPtrALTERA"; + case Op::OpReadPipeBlockingALTERA: return "OpReadPipeBlockingALTERA"; + case Op::OpWritePipeBlockingALTERA: return "OpWritePipeBlockingALTERA"; + case Op::OpFPGARegALTERA: return "OpFPGARegALTERA"; case Op::OpRayQueryGetRayTMinKHR: return "OpRayQueryGetRayTMinKHR"; case Op::OpRayQueryGetRayFlagsKHR: return "OpRayQueryGetRayFlagsKHR"; case Op::OpRayQueryGetIntersectionTKHR: return "OpRayQueryGetIntersectionTKHR"; @@ -5215,11 +5511,11 @@ inline const char* OpToString(Op value) { case Op::OpControlBarrierArriveINTEL: return "OpControlBarrierArriveINTEL"; case Op::OpControlBarrierWaitINTEL: return "OpControlBarrierWaitINTEL"; case Op::OpArithmeticFenceEXT: return "OpArithmeticFenceEXT"; - case Op::OpTaskSequenceCreateINTEL: return "OpTaskSequenceCreateINTEL"; - case Op::OpTaskSequenceAsyncINTEL: return "OpTaskSequenceAsyncINTEL"; - case Op::OpTaskSequenceGetINTEL: return "OpTaskSequenceGetINTEL"; - case Op::OpTaskSequenceReleaseINTEL: return "OpTaskSequenceReleaseINTEL"; - case Op::OpTypeTaskSequenceINTEL: return "OpTypeTaskSequenceINTEL"; + case Op::OpTaskSequenceCreateALTERA: return "OpTaskSequenceCreateALTERA"; + case Op::OpTaskSequenceAsyncALTERA: return "OpTaskSequenceAsyncALTERA"; + case Op::OpTaskSequenceGetALTERA: return "OpTaskSequenceGetALTERA"; + case Op::OpTaskSequenceReleaseALTERA: return "OpTaskSequenceReleaseALTERA"; + case Op::OpTypeTaskSequenceALTERA: return "OpTypeTaskSequenceALTERA"; case Op::OpSubgroupBlockPrefetchINTEL: return "OpSubgroupBlockPrefetchINTEL"; case Op::OpSubgroup2DBlockLoadINTEL: return "OpSubgroup2DBlockLoadINTEL"; case Op::OpSubgroup2DBlockLoadTransformINTEL: return "OpSubgroup2DBlockLoadTransformINTEL"; @@ -5228,6 +5524,7 @@ inline const char* OpToString(Op value) { case Op::OpSubgroup2DBlockStoreINTEL: return "OpSubgroup2DBlockStoreINTEL"; case Op::OpSubgroupMatrixMultiplyAccumulateINTEL: return "OpSubgroupMatrixMultiplyAccumulateINTEL"; case Op::OpBitwiseFunctionINTEL: return "OpBitwiseFunctionINTEL"; + case Op::OpUntypedVariableLengthArrayINTEL: return "OpUntypedVariableLengthArrayINTEL"; case Op::OpConditionalExtensionINTEL: return "OpConditionalExtensionINTEL"; case Op::OpConditionalEntryPointINTEL: return "OpConditionalEntryPointINTEL"; case Op::OpConditionalCapabilityINTEL: return "OpConditionalCapabilityINTEL"; diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.json b/third_party/spirv-headers/include/spirv/unified1/spirv.json index 776bbd78dd..4facadf13f 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.json +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.json @@ -210,6 +210,7 @@ "SampleInterlockUnorderedEXT": 5369, "ShadingRateInterlockOrderedEXT": 5370, "ShadingRateInterlockUnorderedEXT": 5371, + "Shader64BitIndexingEXT": 5427, "SharedLocalMemorySizeINTEL": 5618, "RoundingModeRTPINTEL": 5620, "RoundingModeRTNINTEL": 5621, @@ -267,8 +268,11 @@ "PhysicalStorageBufferEXT": 5349, "HitObjectAttributeNV": 5385, "TaskPayloadWorkgroupEXT": 5402, + "HitObjectAttributeEXT": 5411, "CodeSectionINTEL": 5605, + "DeviceOnlyALTERA": 5936, "DeviceOnlyINTEL": 5936, + "HostOnlyALTERA": 5937, "HostOnlyINTEL": 5937 } }, @@ -505,6 +509,7 @@ "NoCapture": 5, "NoWrite": 6, "NoReadWrite": 7, + "RuntimeAlignedALTERA": 5940, "RuntimeAlignedINTEL": 5940 } }, @@ -575,6 +580,8 @@ "PayloadNodeSparseArrayAMDX": 5099, "PayloadNodeArraySizeAMDX": 5100, "PayloadDispatchIndirectAMDX": 5105, + "ArrayStrideIdEXT": 5124, + "OffsetIdEXT": 5125, "OverrideCoverageNV": 5248, "PassthroughNV": 5250, "ViewportRelativeNV": 5252, @@ -591,7 +598,10 @@ "RestrictPointerEXT": 5355, "AliasedPointer": 5356, "AliasedPointerEXT": 5356, + "MemberOffsetNV": 5358, "HitObjectShaderRecordBufferNV": 5386, + "HitObjectShaderRecordBufferEXT": 5389, + "BankNV": 5397, "BindlessSamplerNV": 5398, "BindlessImageNV": 5399, "BoundSamplerNV": 5400, @@ -612,54 +622,95 @@ "UserTypeGOOGLE": 5636, "FunctionRoundingModeINTEL": 5822, "FunctionDenormModeINTEL": 5823, + "RegisterALTERA": 5825, "RegisterINTEL": 5825, + "MemoryALTERA": 5826, "MemoryINTEL": 5826, + "NumbanksALTERA": 5827, "NumbanksINTEL": 5827, + "BankwidthALTERA": 5828, "BankwidthINTEL": 5828, + "MaxPrivateCopiesALTERA": 5829, "MaxPrivateCopiesINTEL": 5829, + "SinglepumpALTERA": 5830, "SinglepumpINTEL": 5830, + "DoublepumpALTERA": 5831, "DoublepumpINTEL": 5831, + "MaxReplicatesALTERA": 5832, "MaxReplicatesINTEL": 5832, + "SimpleDualPortALTERA": 5833, "SimpleDualPortINTEL": 5833, + "MergeALTERA": 5834, "MergeINTEL": 5834, + "BankBitsALTERA": 5835, "BankBitsINTEL": 5835, + "ForcePow2DepthALTERA": 5836, "ForcePow2DepthINTEL": 5836, + "StridesizeALTERA": 5883, "StridesizeINTEL": 5883, + "WordsizeALTERA": 5884, "WordsizeINTEL": 5884, + "TrueDualPortALTERA": 5885, "TrueDualPortINTEL": 5885, + "BurstCoalesceALTERA": 5899, "BurstCoalesceINTEL": 5899, + "CacheSizeALTERA": 5900, "CacheSizeINTEL": 5900, + "DontStaticallyCoalesceALTERA": 5901, "DontStaticallyCoalesceINTEL": 5901, + "PrefetchALTERA": 5902, "PrefetchINTEL": 5902, + "StallEnableALTERA": 5905, "StallEnableINTEL": 5905, + "FuseLoopsInFunctionALTERA": 5907, "FuseLoopsInFunctionINTEL": 5907, + "MathOpDSPModeALTERA": 5909, "MathOpDSPModeINTEL": 5909, "AliasScopeINTEL": 5914, "NoAliasINTEL": 5915, + "InitiationIntervalALTERA": 5917, "InitiationIntervalINTEL": 5917, + "MaxConcurrencyALTERA": 5918, "MaxConcurrencyINTEL": 5918, + "PipelineEnableALTERA": 5919, "PipelineEnableINTEL": 5919, + "BufferLocationALTERA": 5921, "BufferLocationINTEL": 5921, + "IOPipeStorageALTERA": 5944, "IOPipeStorageINTEL": 5944, "FunctionFloatingPointModeINTEL": 6080, "SingleElementVectorINTEL": 6085, "VectorComputeCallableFunctionINTEL": 6087, "MediaBlockIOINTEL": 6140, + "StallFreeALTERA": 6151, "StallFreeINTEL": 6151, "FPMaxErrorDecorationINTEL": 6170, + "LatencyControlLabelALTERA": 6172, "LatencyControlLabelINTEL": 6172, + "LatencyControlConstraintALTERA": 6173, "LatencyControlConstraintINTEL": 6173, + "ConduitKernelArgumentALTERA": 6175, "ConduitKernelArgumentINTEL": 6175, + "RegisterMapKernelArgumentALTERA": 6176, "RegisterMapKernelArgumentINTEL": 6176, + "MMHostInterfaceAddressWidthALTERA": 6177, "MMHostInterfaceAddressWidthINTEL": 6177, + "MMHostInterfaceDataWidthALTERA": 6178, "MMHostInterfaceDataWidthINTEL": 6178, + "MMHostInterfaceLatencyALTERA": 6179, "MMHostInterfaceLatencyINTEL": 6179, + "MMHostInterfaceReadWriteModeALTERA": 6180, "MMHostInterfaceReadWriteModeINTEL": 6180, + "MMHostInterfaceMaxBurstALTERA": 6181, "MMHostInterfaceMaxBurstINTEL": 6181, + "MMHostInterfaceWaitRequestALTERA": 6182, "MMHostInterfaceWaitRequestINTEL": 6182, + "StableKernelArgumentALTERA": 6183, "StableKernelArgumentINTEL": 6183, "HostAccessINTEL": 6188, + "InitModeALTERA": 6190, "InitModeINTEL": 6190, + "ImplementInRegisterMapALTERA": 6191, "ImplementInRegisterMapINTEL": 6191, "ConditionalINTEL": 6247, "CacheControlLoadINTEL": 6442, @@ -747,6 +798,8 @@ "FragStencilRefEXT": 5014, "RemainingRecursionLevelsAMDX": 5021, "ShaderIndexAMDX": 5073, + "SamplerHeapEXT": 5122, + "ResourceHeapEXT": 5123, "ViewportMaskNV": 5253, "SecondaryPositionNV": 5257, "SecondaryViewportMaskNV": 5258, @@ -844,15 +897,25 @@ "IterationMultiple": 6, "PeelCount": 7, "PartialCount": 8, + "InitiationIntervalALTERA": 16, "InitiationIntervalINTEL": 16, + "MaxConcurrencyALTERA": 17, "MaxConcurrencyINTEL": 17, + "DependencyArrayALTERA": 18, "DependencyArrayINTEL": 18, + "PipelineEnableALTERA": 19, "PipelineEnableINTEL": 19, + "LoopCoalesceALTERA": 20, "LoopCoalesceINTEL": 20, + "MaxInterleavingALTERA": 21, "MaxInterleavingINTEL": 21, + "SpeculatedIterationsALTERA": 22, "SpeculatedIterationsINTEL": 22, + "NoFusionALTERA": 23, "NoFusionINTEL": 23, + "LoopCountALTERA": 24, "LoopCountINTEL": 24, + "MaxReinvocationDelayALTERA": 25, "MaxReinvocationDelayINTEL": 25 } }, @@ -935,8 +998,11 @@ "InclusiveScan": 1, "ExclusiveScan": 2, "ClusteredReduce": 3, + "PartitionedReduceEXT": 6, "PartitionedReduceNV": 6, + "PartitionedInclusiveScanEXT": 7, "PartitionedInclusiveScanNV": 7, + "PartitionedExclusiveScanEXT": 8, "PartitionedExclusiveScanNV": 8 } }, @@ -1096,6 +1162,7 @@ "BFloat16TypeKHR": 5116, "BFloat16DotProductKHR": 5117, "BFloat16CooperativeMatrixKHR": 5118, + "DescriptorHeapEXT": 5128, "SampleMaskOverrideCoverageNV": 5249, "GeometryShaderPassthroughNV": 5251, "ShaderViewportIndexLayerEXT": 5254, @@ -1113,6 +1180,7 @@ "ComputeDerivativeGroupQuadsNV": 5288, "FragmentDensityEXT": 5291, "ShadingRateNV": 5291, + "GroupNonUniformPartitionedEXT": 5297, "GroupNonUniformPartitionedNV": 5297, "ShaderNonUniform": 5301, "ShaderNonUniformEXT": 5301, @@ -1160,6 +1228,7 @@ "DisplacementMicromapNV": 5380, "RayTracingOpacityMicromapEXT": 5381, "ShaderInvocationReorderNV": 5383, + "ShaderInvocationReorderEXT": 5388, "BindlessTextureNV": 5390, "RayQueryPositionFetchKHR": 5391, "CooperativeVectorNV": 5394, @@ -1168,6 +1237,9 @@ "RawAccessChainsNV": 5414, "RayTracingSpheresGeometryNV": 5418, "RayTracingLinearSweptSpheresGeometryNV": 5419, + "PushConstantBanksNV": 5423, + "LongVectorEXT": 5425, + "Shader64BitIndexingEXT": 5426, "CooperativeMatrixReductionsNV": 5430, "CooperativeMatrixConversionsNV": 5431, "CooperativeMatrixPerElementOperationsNV": 5432, @@ -1197,26 +1269,42 @@ "SubgroupAvcMotionEstimationChromaINTEL": 5698, "VariableLengthArrayINTEL": 5817, "FunctionFloatControlINTEL": 5821, + "FPGAMemoryAttributesALTERA": 5824, "FPGAMemoryAttributesINTEL": 5824, "FPFastMathModeINTEL": 5837, + "ArbitraryPrecisionIntegersALTERA": 5844, "ArbitraryPrecisionIntegersINTEL": 5844, + "ArbitraryPrecisionFloatingPointALTERA": 5845, "ArbitraryPrecisionFloatingPointINTEL": 5845, "UnstructuredLoopControlsINTEL": 5886, + "FPGALoopControlsALTERA": 5888, "FPGALoopControlsINTEL": 5888, "KernelAttributesINTEL": 5892, "FPGAKernelAttributesINTEL": 5897, + "FPGAMemoryAccessesALTERA": 5898, "FPGAMemoryAccessesINTEL": 5898, + "FPGAClusterAttributesALTERA": 5904, "FPGAClusterAttributesINTEL": 5904, + "LoopFuseALTERA": 5906, "LoopFuseINTEL": 5906, + "FPGADSPControlALTERA": 5908, "FPGADSPControlINTEL": 5908, "MemoryAccessAliasingINTEL": 5910, + "FPGAInvocationPipeliningAttributesALTERA": 5916, "FPGAInvocationPipeliningAttributesINTEL": 5916, + "FPGABufferLocationALTERA": 5920, "FPGABufferLocationINTEL": 5920, + "ArbitraryPrecisionFixedPointALTERA": 5922, "ArbitraryPrecisionFixedPointINTEL": 5922, + "USMStorageClassesALTERA": 5935, "USMStorageClassesINTEL": 5935, + "RuntimeAlignedAttributeALTERA": 5939, "RuntimeAlignedAttributeINTEL": 5939, + "IOPipesALTERA": 5943, "IOPipesINTEL": 5943, + "BlockingPipesALTERA": 5945, "BlockingPipesINTEL": 5945, + "FPGARegALTERA": 5948, "FPGARegINTEL": 5948, "DotProductInputAll": 6016, "DotProductInputAllKHR": 6016, @@ -1232,6 +1320,7 @@ "BitInstructions": 6025, "GroupNonUniformRotateKHR": 6026, "FloatControls2": 6029, + "FMAKHR": 6030, "AtomicFloat32AddEXT": 6033, "AtomicFloat64AddEXT": 6034, "LongCompositesINTEL": 6089, @@ -1242,13 +1331,18 @@ "BFloat16ConversionINTEL": 6115, "SplitBarrierINTEL": 6141, "ArithmeticFenceEXT": 6144, + "FPGAClusterAttributesV2ALTERA": 6150, "FPGAClusterAttributesV2INTEL": 6150, "FPGAKernelAttributesv2INTEL": 6161, + "TaskSequenceALTERA": 6162, "TaskSequenceINTEL": 6162, "FPMaxErrorINTEL": 6169, + "FPGALatencyControlALTERA": 6171, "FPGALatencyControlINTEL": 6171, + "FPGAArgumentInterfacesALTERA": 6174, "FPGAArgumentInterfacesINTEL": 6174, "GlobalVariableHostAccessINTEL": 6187, + "GlobalVariableFPGADecorationsALTERA": 6189, "GlobalVariableFPGADecorationsINTEL": 6189, "SubgroupBufferPrefetchINTEL": 6220, "Subgroup2DBlockIOINTEL": 6228, @@ -1256,6 +1350,7 @@ "Subgroup2DBlockTransposeINTEL": 6230, "SubgroupMatrixMultiplyAccumulateINTEL": 6236, "TernaryBitwiseFunctionINTEL": 6241, + "UntypedVariableLengthArrayINTEL": 6243, "SpecConditionalINTEL": 6245, "FunctionVariantsINTEL": 6246, "GroupUniformArithmeticKHR": 6400, @@ -1458,7 +1553,9 @@ "Type": "Value", "Values": { + "InitOnDeviceReprogramALTERA": 0, "InitOnDeviceReprogramINTEL": 0, + "InitOnDeviceResetALTERA": 1, "InitOnDeviceResetINTEL": 1 } }, @@ -1951,12 +2048,14 @@ "OpUntypedInBoundsPtrAccessChainKHR": 4424, "OpUntypedArrayLengthKHR": 4425, "OpUntypedPrefetchKHR": 4426, + "OpFmaKHR": 4427, "OpSubgroupAllKHR": 4428, "OpSubgroupAnyKHR": 4429, "OpSubgroupAllEqualKHR": 4430, "OpGroupNonUniformRotateKHR": 4431, "OpSubgroupReadInvocationKHR": 4432, "OpExtInstWithForwardRefsKHR": 4433, + "OpUntypedGroupAsyncCopyKHR": 4434, "OpTraceRayKHR": 4445, "OpExecuteCallableKHR": 4446, "OpConvertUToAccelerationStructureKHR": 4447, @@ -2022,6 +2121,11 @@ "OpSpecConstantStringAMDX": 5104, "OpGroupNonUniformQuadAllKHR": 5110, "OpGroupNonUniformQuadAnyKHR": 5111, + "OpTypeBufferEXT": 5115, + "OpBufferPointerEXT": 5119, + "OpUntypedImageTexelPointerEXT": 5126, + "OpMemberDecorateIdEXT": 5127, + "OpConstantSizeOfEXT": 5129, "OpHitObjectRecordHitMotionNV": 5249, "OpHitObjectRecordHitWithIndexMotionNV": 5250, "OpHitObjectRecordMissMotionNV": 5251, @@ -2057,6 +2161,7 @@ "OpTypeHitObjectNV": 5281, "OpImageSampleFootprintNV": 5283, "OpTypeCooperativeVectorNV": 5288, + "OpTypeVectorIdEXT": 5288, "OpCooperativeVectorMatrixMulNV": 5289, "OpCooperativeVectorOuterProductAccumulateNV": 5290, "OpCooperativeVectorReduceSumAccumulateNV": 5291, @@ -2064,12 +2169,43 @@ "OpCooperativeMatrixConvertNV": 5293, "OpEmitMeshTasksEXT": 5294, "OpSetMeshOutputsEXT": 5295, + "OpGroupNonUniformPartitionEXT": 5296, "OpGroupNonUniformPartitionNV": 5296, "OpWritePackedPrimitiveIndices4x8NV": 5299, "OpFetchMicroTriangleVertexPositionNV": 5300, "OpFetchMicroTriangleVertexBarycentricNV": 5301, "OpCooperativeVectorLoadNV": 5302, "OpCooperativeVectorStoreNV": 5303, + "OpHitObjectRecordFromQueryEXT": 5304, + "OpHitObjectRecordMissEXT": 5305, + "OpHitObjectRecordMissMotionEXT": 5306, + "OpHitObjectGetIntersectionTriangleVertexPositionsEXT": 5307, + "OpHitObjectGetRayFlagsEXT": 5308, + "OpHitObjectSetShaderBindingTableRecordIndexEXT": 5309, + "OpHitObjectReorderExecuteShaderEXT": 5310, + "OpHitObjectTraceReorderExecuteEXT": 5311, + "OpHitObjectTraceMotionReorderExecuteEXT": 5312, + "OpTypeHitObjectEXT": 5313, + "OpReorderThreadWithHintEXT": 5314, + "OpReorderThreadWithHitObjectEXT": 5315, + "OpHitObjectTraceRayEXT": 5316, + "OpHitObjectTraceRayMotionEXT": 5317, + "OpHitObjectRecordEmptyEXT": 5318, + "OpHitObjectExecuteShaderEXT": 5319, + "OpHitObjectGetCurrentTimeEXT": 5320, + "OpHitObjectGetAttributesEXT": 5321, + "OpHitObjectGetHitKindEXT": 5322, + "OpHitObjectGetPrimitiveIndexEXT": 5323, + "OpHitObjectGetGeometryIndexEXT": 5324, + "OpHitObjectGetInstanceIdEXT": 5325, + "OpHitObjectGetInstanceCustomIndexEXT": 5326, + "OpHitObjectGetObjectRayOriginEXT": 5327, + "OpHitObjectGetObjectRayDirectionEXT": 5328, + "OpHitObjectGetWorldRayDirectionEXT": 5329, + "OpHitObjectGetWorldRayOriginEXT": 5330, + "OpHitObjectGetObjectToWorldEXT": 5331, + "OpHitObjectGetWorldToObjectEXT": 5332, + "OpHitObjectGetRayTMaxEXT": 5333, "OpReportIntersectionKHR": 5334, "OpReportIntersectionNV": 5334, "OpIgnoreIntersectionNV": 5335, @@ -2082,7 +2218,14 @@ "OpTypeAccelerationStructureNV": 5341, "OpExecuteCallableNV": 5344, "OpRayQueryGetClusterIdNV": 5345, + "OpRayQueryGetIntersectionClusterIdNV": 5345, "OpHitObjectGetClusterIdNV": 5346, + "OpHitObjectGetRayTMinEXT": 5347, + "OpHitObjectGetShaderBindingTableRecordIndexEXT": 5348, + "OpHitObjectGetShaderRecordBufferHandleEXT": 5349, + "OpHitObjectIsEmptyEXT": 5350, + "OpHitObjectIsHitEXT": 5351, + "OpHitObjectIsMissEXT": 5352, "OpTypeCooperativeMatrixNV": 5358, "OpCooperativeMatrixLoadNV": 5359, "OpCooperativeMatrixStoreNV": 5360, @@ -2289,23 +2432,41 @@ "OpVariableLengthArrayINTEL": 5818, "OpSaveMemoryINTEL": 5819, "OpRestoreMemoryINTEL": 5820, + "OpArbitraryFloatSinCosPiALTERA": 5840, "OpArbitraryFloatSinCosPiINTEL": 5840, + "OpArbitraryFloatCastALTERA": 5841, "OpArbitraryFloatCastINTEL": 5841, + "OpArbitraryFloatCastFromIntALTERA": 5842, "OpArbitraryFloatCastFromIntINTEL": 5842, + "OpArbitraryFloatCastToIntALTERA": 5843, "OpArbitraryFloatCastToIntINTEL": 5843, + "OpArbitraryFloatAddALTERA": 5846, "OpArbitraryFloatAddINTEL": 5846, + "OpArbitraryFloatSubALTERA": 5847, "OpArbitraryFloatSubINTEL": 5847, + "OpArbitraryFloatMulALTERA": 5848, "OpArbitraryFloatMulINTEL": 5848, + "OpArbitraryFloatDivALTERA": 5849, "OpArbitraryFloatDivINTEL": 5849, + "OpArbitraryFloatGTALTERA": 5850, "OpArbitraryFloatGTINTEL": 5850, + "OpArbitraryFloatGEALTERA": 5851, "OpArbitraryFloatGEINTEL": 5851, + "OpArbitraryFloatLTALTERA": 5852, "OpArbitraryFloatLTINTEL": 5852, + "OpArbitraryFloatLEALTERA": 5853, "OpArbitraryFloatLEINTEL": 5853, + "OpArbitraryFloatEQALTERA": 5854, "OpArbitraryFloatEQINTEL": 5854, + "OpArbitraryFloatRecipALTERA": 5855, "OpArbitraryFloatRecipINTEL": 5855, + "OpArbitraryFloatRSqrtALTERA": 5856, "OpArbitraryFloatRSqrtINTEL": 5856, + "OpArbitraryFloatCbrtALTERA": 5857, "OpArbitraryFloatCbrtINTEL": 5857, + "OpArbitraryFloatHypotALTERA": 5858, "OpArbitraryFloatHypotINTEL": 5858, + "OpArbitraryFloatSqrtALTERA": 5859, "OpArbitraryFloatSqrtINTEL": 5859, "OpArbitraryFloatLogINTEL": 5860, "OpArbitraryFloatLog2INTEL": 5861, @@ -2334,21 +2495,37 @@ "OpAliasDomainDeclINTEL": 5911, "OpAliasScopeDeclINTEL": 5912, "OpAliasScopeListDeclINTEL": 5913, + "OpFixedSqrtALTERA": 5923, "OpFixedSqrtINTEL": 5923, + "OpFixedRecipALTERA": 5924, "OpFixedRecipINTEL": 5924, + "OpFixedRsqrtALTERA": 5925, "OpFixedRsqrtINTEL": 5925, + "OpFixedSinALTERA": 5926, "OpFixedSinINTEL": 5926, + "OpFixedCosALTERA": 5927, "OpFixedCosINTEL": 5927, + "OpFixedSinCosALTERA": 5928, "OpFixedSinCosINTEL": 5928, + "OpFixedSinPiALTERA": 5929, "OpFixedSinPiINTEL": 5929, + "OpFixedCosPiALTERA": 5930, "OpFixedCosPiINTEL": 5930, + "OpFixedSinCosPiALTERA": 5931, "OpFixedSinCosPiINTEL": 5931, + "OpFixedLogALTERA": 5932, "OpFixedLogINTEL": 5932, + "OpFixedExpALTERA": 5933, "OpFixedExpINTEL": 5933, + "OpPtrCastToCrossWorkgroupALTERA": 5934, "OpPtrCastToCrossWorkgroupINTEL": 5934, + "OpCrossWorkgroupCastToPtrALTERA": 5938, "OpCrossWorkgroupCastToPtrINTEL": 5938, + "OpReadPipeBlockingALTERA": 5946, "OpReadPipeBlockingINTEL": 5946, + "OpWritePipeBlockingALTERA": 5947, "OpWritePipeBlockingINTEL": 5947, + "OpFPGARegALTERA": 5949, "OpFPGARegINTEL": 5949, "OpRayQueryGetRayTMinKHR": 6016, "OpRayQueryGetRayFlagsKHR": 6017, @@ -2378,10 +2555,15 @@ "OpControlBarrierArriveINTEL": 6142, "OpControlBarrierWaitINTEL": 6143, "OpArithmeticFenceEXT": 6145, + "OpTaskSequenceCreateALTERA": 6163, "OpTaskSequenceCreateINTEL": 6163, + "OpTaskSequenceAsyncALTERA": 6164, "OpTaskSequenceAsyncINTEL": 6164, + "OpTaskSequenceGetALTERA": 6165, "OpTaskSequenceGetINTEL": 6165, + "OpTaskSequenceReleaseALTERA": 6166, "OpTaskSequenceReleaseINTEL": 6166, + "OpTypeTaskSequenceALTERA": 6199, "OpTypeTaskSequenceINTEL": 6199, "OpSubgroupBlockPrefetchINTEL": 6221, "OpSubgroup2DBlockLoadINTEL": 6231, @@ -2391,6 +2573,7 @@ "OpSubgroup2DBlockStoreINTEL": 6235, "OpSubgroupMatrixMultiplyAccumulateINTEL": 6237, "OpBitwiseFunctionINTEL": 6242, + "OpUntypedVariableLengthArrayINTEL": 6244, "OpConditionalExtensionINTEL": 6248, "OpConditionalEntryPointINTEL": 6249, "OpConditionalCapabilityINTEL": 6250, diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.lua b/third_party/spirv-headers/include/spirv/unified1/spirv.lua index 180cfac853..02ba4cc591 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.lua +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.lua @@ -182,6 +182,7 @@ spv = { SampleInterlockUnorderedEXT = 5369, ShadingRateInterlockOrderedEXT = 5370, ShadingRateInterlockUnorderedEXT = 5371, + Shader64BitIndexingEXT = 5427, SharedLocalMemorySizeINTEL = 5618, RoundingModeRTPINTEL = 5620, RoundingModeRTNINTEL = 5621, @@ -236,8 +237,11 @@ spv = { PhysicalStorageBufferEXT = 5349, HitObjectAttributeNV = 5385, TaskPayloadWorkgroupEXT = 5402, + HitObjectAttributeEXT = 5411, CodeSectionINTEL = 5605, + DeviceOnlyALTERA = 5936, DeviceOnlyINTEL = 5936, + HostOnlyALTERA = 5937, HostOnlyINTEL = 5937, Max = 0x7fffffff, }, @@ -476,6 +480,7 @@ spv = { NoCapture = 5, NoWrite = 6, NoReadWrite = 7, + RuntimeAlignedALTERA = 5940, RuntimeAlignedINTEL = 5940, Max = 0x7fffffff, }, @@ -543,6 +548,8 @@ spv = { PayloadNodeSparseArrayAMDX = 5099, PayloadNodeArraySizeAMDX = 5100, PayloadDispatchIndirectAMDX = 5105, + ArrayStrideIdEXT = 5124, + OffsetIdEXT = 5125, OverrideCoverageNV = 5248, PassthroughNV = 5250, ViewportRelativeNV = 5252, @@ -559,7 +566,10 @@ spv = { RestrictPointerEXT = 5355, AliasedPointer = 5356, AliasedPointerEXT = 5356, + MemberOffsetNV = 5358, HitObjectShaderRecordBufferNV = 5386, + HitObjectShaderRecordBufferEXT = 5389, + BankNV = 5397, BindlessSamplerNV = 5398, BindlessImageNV = 5399, BoundSamplerNV = 5400, @@ -580,54 +590,95 @@ spv = { UserTypeGOOGLE = 5636, FunctionRoundingModeINTEL = 5822, FunctionDenormModeINTEL = 5823, + RegisterALTERA = 5825, RegisterINTEL = 5825, + MemoryALTERA = 5826, MemoryINTEL = 5826, + NumbanksALTERA = 5827, NumbanksINTEL = 5827, + BankwidthALTERA = 5828, BankwidthINTEL = 5828, + MaxPrivateCopiesALTERA = 5829, MaxPrivateCopiesINTEL = 5829, + SinglepumpALTERA = 5830, SinglepumpINTEL = 5830, + DoublepumpALTERA = 5831, DoublepumpINTEL = 5831, + MaxReplicatesALTERA = 5832, MaxReplicatesINTEL = 5832, + SimpleDualPortALTERA = 5833, SimpleDualPortINTEL = 5833, + MergeALTERA = 5834, MergeINTEL = 5834, + BankBitsALTERA = 5835, BankBitsINTEL = 5835, + ForcePow2DepthALTERA = 5836, ForcePow2DepthINTEL = 5836, + StridesizeALTERA = 5883, StridesizeINTEL = 5883, + WordsizeALTERA = 5884, WordsizeINTEL = 5884, + TrueDualPortALTERA = 5885, TrueDualPortINTEL = 5885, + BurstCoalesceALTERA = 5899, BurstCoalesceINTEL = 5899, + CacheSizeALTERA = 5900, CacheSizeINTEL = 5900, + DontStaticallyCoalesceALTERA = 5901, DontStaticallyCoalesceINTEL = 5901, + PrefetchALTERA = 5902, PrefetchINTEL = 5902, + StallEnableALTERA = 5905, StallEnableINTEL = 5905, + FuseLoopsInFunctionALTERA = 5907, FuseLoopsInFunctionINTEL = 5907, + MathOpDSPModeALTERA = 5909, MathOpDSPModeINTEL = 5909, AliasScopeINTEL = 5914, NoAliasINTEL = 5915, + InitiationIntervalALTERA = 5917, InitiationIntervalINTEL = 5917, + MaxConcurrencyALTERA = 5918, MaxConcurrencyINTEL = 5918, + PipelineEnableALTERA = 5919, PipelineEnableINTEL = 5919, + BufferLocationALTERA = 5921, BufferLocationINTEL = 5921, + IOPipeStorageALTERA = 5944, IOPipeStorageINTEL = 5944, FunctionFloatingPointModeINTEL = 6080, SingleElementVectorINTEL = 6085, VectorComputeCallableFunctionINTEL = 6087, MediaBlockIOINTEL = 6140, + StallFreeALTERA = 6151, StallFreeINTEL = 6151, FPMaxErrorDecorationINTEL = 6170, + LatencyControlLabelALTERA = 6172, LatencyControlLabelINTEL = 6172, + LatencyControlConstraintALTERA = 6173, LatencyControlConstraintINTEL = 6173, + ConduitKernelArgumentALTERA = 6175, ConduitKernelArgumentINTEL = 6175, + RegisterMapKernelArgumentALTERA = 6176, RegisterMapKernelArgumentINTEL = 6176, + MMHostInterfaceAddressWidthALTERA = 6177, MMHostInterfaceAddressWidthINTEL = 6177, + MMHostInterfaceDataWidthALTERA = 6178, MMHostInterfaceDataWidthINTEL = 6178, + MMHostInterfaceLatencyALTERA = 6179, MMHostInterfaceLatencyINTEL = 6179, + MMHostInterfaceReadWriteModeALTERA = 6180, MMHostInterfaceReadWriteModeINTEL = 6180, + MMHostInterfaceMaxBurstALTERA = 6181, MMHostInterfaceMaxBurstINTEL = 6181, + MMHostInterfaceWaitRequestALTERA = 6182, MMHostInterfaceWaitRequestINTEL = 6182, + StableKernelArgumentALTERA = 6183, StableKernelArgumentINTEL = 6183, HostAccessINTEL = 6188, + InitModeALTERA = 6190, InitModeINTEL = 6190, + ImplementInRegisterMapALTERA = 6191, ImplementInRegisterMapINTEL = 6191, ConditionalINTEL = 6247, CacheControlLoadINTEL = 6442, @@ -712,6 +763,8 @@ spv = { FragStencilRefEXT = 5014, RemainingRecursionLevelsAMDX = 5021, ShaderIndexAMDX = 5073, + SamplerHeapEXT = 5122, + ResourceHeapEXT = 5123, ViewportMaskNV = 5253, SecondaryPositionNV = 5257, SecondaryViewportMaskNV = 5258, @@ -809,15 +862,25 @@ spv = { IterationMultiple = 6, PeelCount = 7, PartialCount = 8, + InitiationIntervalALTERA = 16, InitiationIntervalINTEL = 16, + MaxConcurrencyALTERA = 17, MaxConcurrencyINTEL = 17, + DependencyArrayALTERA = 18, DependencyArrayINTEL = 18, + PipelineEnableALTERA = 19, PipelineEnableINTEL = 19, + LoopCoalesceALTERA = 20, LoopCoalesceINTEL = 20, + MaxInterleavingALTERA = 21, MaxInterleavingINTEL = 21, + SpeculatedIterationsALTERA = 22, SpeculatedIterationsINTEL = 22, + NoFusionALTERA = 23, NoFusionINTEL = 23, + LoopCountALTERA = 24, LoopCountINTEL = 24, + MaxReinvocationDelayALTERA = 25, MaxReinvocationDelayINTEL = 25, Max = 0x7fffffff, }, @@ -833,15 +896,25 @@ spv = { IterationMultiple = 0x00000040, PeelCount = 0x00000080, PartialCount = 0x00000100, + InitiationIntervalALTERA = 0x00010000, InitiationIntervalINTEL = 0x00010000, + MaxConcurrencyALTERA = 0x00020000, MaxConcurrencyINTEL = 0x00020000, + DependencyArrayALTERA = 0x00040000, DependencyArrayINTEL = 0x00040000, + PipelineEnableALTERA = 0x00080000, PipelineEnableINTEL = 0x00080000, + LoopCoalesceALTERA = 0x00100000, LoopCoalesceINTEL = 0x00100000, + MaxInterleavingALTERA = 0x00200000, MaxInterleavingINTEL = 0x00200000, + SpeculatedIterationsALTERA = 0x00400000, SpeculatedIterationsINTEL = 0x00400000, + NoFusionALTERA = 0x00800000, NoFusionINTEL = 0x00800000, + LoopCountALTERA = 0x01000000, LoopCountINTEL = 0x01000000, + MaxReinvocationDelayALTERA = 0x02000000, MaxReinvocationDelayINTEL = 0x02000000, }, @@ -954,8 +1027,11 @@ spv = { InclusiveScan = 1, ExclusiveScan = 2, ClusteredReduce = 3, + PartitionedReduceEXT = 6, PartitionedReduceNV = 6, + PartitionedInclusiveScanEXT = 7, PartitionedInclusiveScanNV = 7, + PartitionedExclusiveScanEXT = 8, PartitionedExclusiveScanNV = 8, Max = 0x7fffffff, }, @@ -1111,6 +1187,7 @@ spv = { BFloat16TypeKHR = 5116, BFloat16DotProductKHR = 5117, BFloat16CooperativeMatrixKHR = 5118, + DescriptorHeapEXT = 5128, SampleMaskOverrideCoverageNV = 5249, GeometryShaderPassthroughNV = 5251, ShaderViewportIndexLayerEXT = 5254, @@ -1128,6 +1205,7 @@ spv = { ComputeDerivativeGroupQuadsNV = 5288, FragmentDensityEXT = 5291, ShadingRateNV = 5291, + GroupNonUniformPartitionedEXT = 5297, GroupNonUniformPartitionedNV = 5297, ShaderNonUniform = 5301, ShaderNonUniformEXT = 5301, @@ -1175,6 +1253,7 @@ spv = { DisplacementMicromapNV = 5380, RayTracingOpacityMicromapEXT = 5381, ShaderInvocationReorderNV = 5383, + ShaderInvocationReorderEXT = 5388, BindlessTextureNV = 5390, RayQueryPositionFetchKHR = 5391, CooperativeVectorNV = 5394, @@ -1183,6 +1262,9 @@ spv = { RawAccessChainsNV = 5414, RayTracingSpheresGeometryNV = 5418, RayTracingLinearSweptSpheresGeometryNV = 5419, + PushConstantBanksNV = 5423, + LongVectorEXT = 5425, + Shader64BitIndexingEXT = 5426, CooperativeMatrixReductionsNV = 5430, CooperativeMatrixConversionsNV = 5431, CooperativeMatrixPerElementOperationsNV = 5432, @@ -1212,26 +1294,42 @@ spv = { SubgroupAvcMotionEstimationChromaINTEL = 5698, VariableLengthArrayINTEL = 5817, FunctionFloatControlINTEL = 5821, + FPGAMemoryAttributesALTERA = 5824, FPGAMemoryAttributesINTEL = 5824, FPFastMathModeINTEL = 5837, + ArbitraryPrecisionIntegersALTERA = 5844, ArbitraryPrecisionIntegersINTEL = 5844, + ArbitraryPrecisionFloatingPointALTERA = 5845, ArbitraryPrecisionFloatingPointINTEL = 5845, UnstructuredLoopControlsINTEL = 5886, + FPGALoopControlsALTERA = 5888, FPGALoopControlsINTEL = 5888, KernelAttributesINTEL = 5892, FPGAKernelAttributesINTEL = 5897, + FPGAMemoryAccessesALTERA = 5898, FPGAMemoryAccessesINTEL = 5898, + FPGAClusterAttributesALTERA = 5904, FPGAClusterAttributesINTEL = 5904, + LoopFuseALTERA = 5906, LoopFuseINTEL = 5906, + FPGADSPControlALTERA = 5908, FPGADSPControlINTEL = 5908, MemoryAccessAliasingINTEL = 5910, + FPGAInvocationPipeliningAttributesALTERA = 5916, FPGAInvocationPipeliningAttributesINTEL = 5916, + FPGABufferLocationALTERA = 5920, FPGABufferLocationINTEL = 5920, + ArbitraryPrecisionFixedPointALTERA = 5922, ArbitraryPrecisionFixedPointINTEL = 5922, + USMStorageClassesALTERA = 5935, USMStorageClassesINTEL = 5935, + RuntimeAlignedAttributeALTERA = 5939, RuntimeAlignedAttributeINTEL = 5939, + IOPipesALTERA = 5943, IOPipesINTEL = 5943, + BlockingPipesALTERA = 5945, BlockingPipesINTEL = 5945, + FPGARegALTERA = 5948, FPGARegINTEL = 5948, DotProductInputAll = 6016, DotProductInputAllKHR = 6016, @@ -1247,6 +1345,7 @@ spv = { BitInstructions = 6025, GroupNonUniformRotateKHR = 6026, FloatControls2 = 6029, + FMAKHR = 6030, AtomicFloat32AddEXT = 6033, AtomicFloat64AddEXT = 6034, LongCompositesINTEL = 6089, @@ -1257,13 +1356,18 @@ spv = { BFloat16ConversionINTEL = 6115, SplitBarrierINTEL = 6141, ArithmeticFenceEXT = 6144, + FPGAClusterAttributesV2ALTERA = 6150, FPGAClusterAttributesV2INTEL = 6150, FPGAKernelAttributesv2INTEL = 6161, + TaskSequenceALTERA = 6162, TaskSequenceINTEL = 6162, FPMaxErrorINTEL = 6169, + FPGALatencyControlALTERA = 6171, FPGALatencyControlINTEL = 6171, + FPGAArgumentInterfacesALTERA = 6174, FPGAArgumentInterfacesINTEL = 6174, GlobalVariableHostAccessINTEL = 6187, + GlobalVariableFPGADecorationsALTERA = 6189, GlobalVariableFPGADecorationsINTEL = 6189, SubgroupBufferPrefetchINTEL = 6220, Subgroup2DBlockIOINTEL = 6228, @@ -1271,6 +1375,7 @@ spv = { Subgroup2DBlockTransposeINTEL = 6230, SubgroupMatrixMultiplyAccumulateINTEL = 6236, TernaryBitwiseFunctionINTEL = 6241, + UntypedVariableLengthArrayINTEL = 6243, SpecConditionalINTEL = 6245, FunctionVariantsINTEL = 6246, GroupUniformArithmeticKHR = 6400, @@ -1474,7 +1579,9 @@ spv = { }, InitializationModeQualifier = { + InitOnDeviceReprogramALTERA = 0, InitOnDeviceReprogramINTEL = 0, + InitOnDeviceResetALTERA = 1, InitOnDeviceResetINTEL = 1, Max = 0x7fffffff, }, @@ -1961,12 +2068,14 @@ spv = { OpUntypedInBoundsPtrAccessChainKHR = 4424, OpUntypedArrayLengthKHR = 4425, OpUntypedPrefetchKHR = 4426, + OpFmaKHR = 4427, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, OpGroupNonUniformRotateKHR = 4431, OpSubgroupReadInvocationKHR = 4432, OpExtInstWithForwardRefsKHR = 4433, + OpUntypedGroupAsyncCopyKHR = 4434, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, OpConvertUToAccelerationStructureKHR = 4447, @@ -2032,6 +2141,11 @@ spv = { OpSpecConstantStringAMDX = 5104, OpGroupNonUniformQuadAllKHR = 5110, OpGroupNonUniformQuadAnyKHR = 5111, + OpTypeBufferEXT = 5115, + OpBufferPointerEXT = 5119, + OpUntypedImageTexelPointerEXT = 5126, + OpMemberDecorateIdEXT = 5127, + OpConstantSizeOfEXT = 5129, OpHitObjectRecordHitMotionNV = 5249, OpHitObjectRecordHitWithIndexMotionNV = 5250, OpHitObjectRecordMissMotionNV = 5251, @@ -2067,6 +2181,7 @@ spv = { OpTypeHitObjectNV = 5281, OpImageSampleFootprintNV = 5283, OpTypeCooperativeVectorNV = 5288, + OpTypeVectorIdEXT = 5288, OpCooperativeVectorMatrixMulNV = 5289, OpCooperativeVectorOuterProductAccumulateNV = 5290, OpCooperativeVectorReduceSumAccumulateNV = 5291, @@ -2074,12 +2189,43 @@ spv = { OpCooperativeMatrixConvertNV = 5293, OpEmitMeshTasksEXT = 5294, OpSetMeshOutputsEXT = 5295, + OpGroupNonUniformPartitionEXT = 5296, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, OpFetchMicroTriangleVertexPositionNV = 5300, OpFetchMicroTriangleVertexBarycentricNV = 5301, OpCooperativeVectorLoadNV = 5302, OpCooperativeVectorStoreNV = 5303, + OpHitObjectRecordFromQueryEXT = 5304, + OpHitObjectRecordMissEXT = 5305, + OpHitObjectRecordMissMotionEXT = 5306, + OpHitObjectGetIntersectionTriangleVertexPositionsEXT = 5307, + OpHitObjectGetRayFlagsEXT = 5308, + OpHitObjectSetShaderBindingTableRecordIndexEXT = 5309, + OpHitObjectReorderExecuteShaderEXT = 5310, + OpHitObjectTraceReorderExecuteEXT = 5311, + OpHitObjectTraceMotionReorderExecuteEXT = 5312, + OpTypeHitObjectEXT = 5313, + OpReorderThreadWithHintEXT = 5314, + OpReorderThreadWithHitObjectEXT = 5315, + OpHitObjectTraceRayEXT = 5316, + OpHitObjectTraceRayMotionEXT = 5317, + OpHitObjectRecordEmptyEXT = 5318, + OpHitObjectExecuteShaderEXT = 5319, + OpHitObjectGetCurrentTimeEXT = 5320, + OpHitObjectGetAttributesEXT = 5321, + OpHitObjectGetHitKindEXT = 5322, + OpHitObjectGetPrimitiveIndexEXT = 5323, + OpHitObjectGetGeometryIndexEXT = 5324, + OpHitObjectGetInstanceIdEXT = 5325, + OpHitObjectGetInstanceCustomIndexEXT = 5326, + OpHitObjectGetObjectRayOriginEXT = 5327, + OpHitObjectGetObjectRayDirectionEXT = 5328, + OpHitObjectGetWorldRayDirectionEXT = 5329, + OpHitObjectGetWorldRayOriginEXT = 5330, + OpHitObjectGetObjectToWorldEXT = 5331, + OpHitObjectGetWorldToObjectEXT = 5332, + OpHitObjectGetRayTMaxEXT = 5333, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, @@ -2092,7 +2238,14 @@ spv = { OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, OpRayQueryGetClusterIdNV = 5345, + OpRayQueryGetIntersectionClusterIdNV = 5345, OpHitObjectGetClusterIdNV = 5346, + OpHitObjectGetRayTMinEXT = 5347, + OpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, + OpHitObjectGetShaderRecordBufferHandleEXT = 5349, + OpHitObjectIsEmptyEXT = 5350, + OpHitObjectIsHitEXT = 5351, + OpHitObjectIsMissEXT = 5352, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixStoreNV = 5360, @@ -2299,23 +2452,41 @@ spv = { OpVariableLengthArrayINTEL = 5818, OpSaveMemoryINTEL = 5819, OpRestoreMemoryINTEL = 5820, + OpArbitraryFloatSinCosPiALTERA = 5840, OpArbitraryFloatSinCosPiINTEL = 5840, + OpArbitraryFloatCastALTERA = 5841, OpArbitraryFloatCastINTEL = 5841, + OpArbitraryFloatCastFromIntALTERA = 5842, OpArbitraryFloatCastFromIntINTEL = 5842, + OpArbitraryFloatCastToIntALTERA = 5843, OpArbitraryFloatCastToIntINTEL = 5843, + OpArbitraryFloatAddALTERA = 5846, OpArbitraryFloatAddINTEL = 5846, + OpArbitraryFloatSubALTERA = 5847, OpArbitraryFloatSubINTEL = 5847, + OpArbitraryFloatMulALTERA = 5848, OpArbitraryFloatMulINTEL = 5848, + OpArbitraryFloatDivALTERA = 5849, OpArbitraryFloatDivINTEL = 5849, + OpArbitraryFloatGTALTERA = 5850, OpArbitraryFloatGTINTEL = 5850, + OpArbitraryFloatGEALTERA = 5851, OpArbitraryFloatGEINTEL = 5851, + OpArbitraryFloatLTALTERA = 5852, OpArbitraryFloatLTINTEL = 5852, + OpArbitraryFloatLEALTERA = 5853, OpArbitraryFloatLEINTEL = 5853, + OpArbitraryFloatEQALTERA = 5854, OpArbitraryFloatEQINTEL = 5854, + OpArbitraryFloatRecipALTERA = 5855, OpArbitraryFloatRecipINTEL = 5855, + OpArbitraryFloatRSqrtALTERA = 5856, OpArbitraryFloatRSqrtINTEL = 5856, + OpArbitraryFloatCbrtALTERA = 5857, OpArbitraryFloatCbrtINTEL = 5857, + OpArbitraryFloatHypotALTERA = 5858, OpArbitraryFloatHypotINTEL = 5858, + OpArbitraryFloatSqrtALTERA = 5859, OpArbitraryFloatSqrtINTEL = 5859, OpArbitraryFloatLogINTEL = 5860, OpArbitraryFloatLog2INTEL = 5861, @@ -2344,21 +2515,37 @@ spv = { OpAliasDomainDeclINTEL = 5911, OpAliasScopeDeclINTEL = 5912, OpAliasScopeListDeclINTEL = 5913, + OpFixedSqrtALTERA = 5923, OpFixedSqrtINTEL = 5923, + OpFixedRecipALTERA = 5924, OpFixedRecipINTEL = 5924, + OpFixedRsqrtALTERA = 5925, OpFixedRsqrtINTEL = 5925, + OpFixedSinALTERA = 5926, OpFixedSinINTEL = 5926, + OpFixedCosALTERA = 5927, OpFixedCosINTEL = 5927, + OpFixedSinCosALTERA = 5928, OpFixedSinCosINTEL = 5928, + OpFixedSinPiALTERA = 5929, OpFixedSinPiINTEL = 5929, + OpFixedCosPiALTERA = 5930, OpFixedCosPiINTEL = 5930, + OpFixedSinCosPiALTERA = 5931, OpFixedSinCosPiINTEL = 5931, + OpFixedLogALTERA = 5932, OpFixedLogINTEL = 5932, + OpFixedExpALTERA = 5933, OpFixedExpINTEL = 5933, + OpPtrCastToCrossWorkgroupALTERA = 5934, OpPtrCastToCrossWorkgroupINTEL = 5934, + OpCrossWorkgroupCastToPtrALTERA = 5938, OpCrossWorkgroupCastToPtrINTEL = 5938, + OpReadPipeBlockingALTERA = 5946, OpReadPipeBlockingINTEL = 5946, + OpWritePipeBlockingALTERA = 5947, OpWritePipeBlockingINTEL = 5947, + OpFPGARegALTERA = 5949, OpFPGARegINTEL = 5949, OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayFlagsKHR = 6017, @@ -2388,10 +2575,15 @@ spv = { OpControlBarrierArriveINTEL = 6142, OpControlBarrierWaitINTEL = 6143, OpArithmeticFenceEXT = 6145, + OpTaskSequenceCreateALTERA = 6163, OpTaskSequenceCreateINTEL = 6163, + OpTaskSequenceAsyncALTERA = 6164, OpTaskSequenceAsyncINTEL = 6164, + OpTaskSequenceGetALTERA = 6165, OpTaskSequenceGetINTEL = 6165, + OpTaskSequenceReleaseALTERA = 6166, OpTaskSequenceReleaseINTEL = 6166, + OpTypeTaskSequenceALTERA = 6199, OpTypeTaskSequenceINTEL = 6199, OpSubgroupBlockPrefetchINTEL = 6221, OpSubgroup2DBlockLoadINTEL = 6231, @@ -2401,6 +2593,7 @@ spv = { OpSubgroup2DBlockStoreINTEL = 6235, OpSubgroupMatrixMultiplyAccumulateINTEL = 6237, OpBitwiseFunctionINTEL = 6242, + OpUntypedVariableLengthArrayINTEL = 6244, OpConditionalExtensionINTEL = 6248, OpConditionalEntryPointINTEL = 6249, OpConditionalCapabilityINTEL = 6250, diff --git a/third_party/spirv-headers/include/spirv/unified1/spirv.py b/third_party/spirv-headers/include/spirv/unified1/spirv.py index 963df996e8..be46401d61 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spirv.py +++ b/third_party/spirv-headers/include/spirv/unified1/spirv.py @@ -178,6 +178,7 @@ spv = { 'SampleInterlockUnorderedEXT' : 5369, 'ShadingRateInterlockOrderedEXT' : 5370, 'ShadingRateInterlockUnorderedEXT' : 5371, + 'Shader64BitIndexingEXT' : 5427, 'SharedLocalMemorySizeINTEL' : 5618, 'RoundingModeRTPINTEL' : 5620, 'RoundingModeRTNINTEL' : 5621, @@ -231,8 +232,11 @@ spv = { 'PhysicalStorageBufferEXT' : 5349, 'HitObjectAttributeNV' : 5385, 'TaskPayloadWorkgroupEXT' : 5402, + 'HitObjectAttributeEXT' : 5411, 'CodeSectionINTEL' : 5605, + 'DeviceOnlyALTERA' : 5936, 'DeviceOnlyINTEL' : 5936, + 'HostOnlyALTERA' : 5937, 'HostOnlyINTEL' : 5937, }, @@ -459,6 +463,7 @@ spv = { 'NoCapture' : 5, 'NoWrite' : 6, 'NoReadWrite' : 7, + 'RuntimeAlignedALTERA' : 5940, 'RuntimeAlignedINTEL' : 5940, }, @@ -525,6 +530,8 @@ spv = { 'PayloadNodeSparseArrayAMDX' : 5099, 'PayloadNodeArraySizeAMDX' : 5100, 'PayloadDispatchIndirectAMDX' : 5105, + 'ArrayStrideIdEXT' : 5124, + 'OffsetIdEXT' : 5125, 'OverrideCoverageNV' : 5248, 'PassthroughNV' : 5250, 'ViewportRelativeNV' : 5252, @@ -541,7 +548,10 @@ spv = { 'RestrictPointerEXT' : 5355, 'AliasedPointer' : 5356, 'AliasedPointerEXT' : 5356, + 'MemberOffsetNV' : 5358, 'HitObjectShaderRecordBufferNV' : 5386, + 'HitObjectShaderRecordBufferEXT' : 5389, + 'BankNV' : 5397, 'BindlessSamplerNV' : 5398, 'BindlessImageNV' : 5399, 'BoundSamplerNV' : 5400, @@ -562,54 +572,95 @@ spv = { 'UserTypeGOOGLE' : 5636, 'FunctionRoundingModeINTEL' : 5822, 'FunctionDenormModeINTEL' : 5823, + 'RegisterALTERA' : 5825, 'RegisterINTEL' : 5825, + 'MemoryALTERA' : 5826, 'MemoryINTEL' : 5826, + 'NumbanksALTERA' : 5827, 'NumbanksINTEL' : 5827, + 'BankwidthALTERA' : 5828, 'BankwidthINTEL' : 5828, + 'MaxPrivateCopiesALTERA' : 5829, 'MaxPrivateCopiesINTEL' : 5829, + 'SinglepumpALTERA' : 5830, 'SinglepumpINTEL' : 5830, + 'DoublepumpALTERA' : 5831, 'DoublepumpINTEL' : 5831, + 'MaxReplicatesALTERA' : 5832, 'MaxReplicatesINTEL' : 5832, + 'SimpleDualPortALTERA' : 5833, 'SimpleDualPortINTEL' : 5833, + 'MergeALTERA' : 5834, 'MergeINTEL' : 5834, + 'BankBitsALTERA' : 5835, 'BankBitsINTEL' : 5835, + 'ForcePow2DepthALTERA' : 5836, 'ForcePow2DepthINTEL' : 5836, + 'StridesizeALTERA' : 5883, 'StridesizeINTEL' : 5883, + 'WordsizeALTERA' : 5884, 'WordsizeINTEL' : 5884, + 'TrueDualPortALTERA' : 5885, 'TrueDualPortINTEL' : 5885, + 'BurstCoalesceALTERA' : 5899, 'BurstCoalesceINTEL' : 5899, + 'CacheSizeALTERA' : 5900, 'CacheSizeINTEL' : 5900, + 'DontStaticallyCoalesceALTERA' : 5901, 'DontStaticallyCoalesceINTEL' : 5901, + 'PrefetchALTERA' : 5902, 'PrefetchINTEL' : 5902, + 'StallEnableALTERA' : 5905, 'StallEnableINTEL' : 5905, + 'FuseLoopsInFunctionALTERA' : 5907, 'FuseLoopsInFunctionINTEL' : 5907, + 'MathOpDSPModeALTERA' : 5909, 'MathOpDSPModeINTEL' : 5909, 'AliasScopeINTEL' : 5914, 'NoAliasINTEL' : 5915, + 'InitiationIntervalALTERA' : 5917, 'InitiationIntervalINTEL' : 5917, + 'MaxConcurrencyALTERA' : 5918, 'MaxConcurrencyINTEL' : 5918, + 'PipelineEnableALTERA' : 5919, 'PipelineEnableINTEL' : 5919, + 'BufferLocationALTERA' : 5921, 'BufferLocationINTEL' : 5921, + 'IOPipeStorageALTERA' : 5944, 'IOPipeStorageINTEL' : 5944, 'FunctionFloatingPointModeINTEL' : 6080, 'SingleElementVectorINTEL' : 6085, 'VectorComputeCallableFunctionINTEL' : 6087, 'MediaBlockIOINTEL' : 6140, + 'StallFreeALTERA' : 6151, 'StallFreeINTEL' : 6151, 'FPMaxErrorDecorationINTEL' : 6170, + 'LatencyControlLabelALTERA' : 6172, 'LatencyControlLabelINTEL' : 6172, + 'LatencyControlConstraintALTERA' : 6173, 'LatencyControlConstraintINTEL' : 6173, + 'ConduitKernelArgumentALTERA' : 6175, 'ConduitKernelArgumentINTEL' : 6175, + 'RegisterMapKernelArgumentALTERA' : 6176, 'RegisterMapKernelArgumentINTEL' : 6176, + 'MMHostInterfaceAddressWidthALTERA' : 6177, 'MMHostInterfaceAddressWidthINTEL' : 6177, + 'MMHostInterfaceDataWidthALTERA' : 6178, 'MMHostInterfaceDataWidthINTEL' : 6178, + 'MMHostInterfaceLatencyALTERA' : 6179, 'MMHostInterfaceLatencyINTEL' : 6179, + 'MMHostInterfaceReadWriteModeALTERA' : 6180, 'MMHostInterfaceReadWriteModeINTEL' : 6180, + 'MMHostInterfaceMaxBurstALTERA' : 6181, 'MMHostInterfaceMaxBurstINTEL' : 6181, + 'MMHostInterfaceWaitRequestALTERA' : 6182, 'MMHostInterfaceWaitRequestINTEL' : 6182, + 'StableKernelArgumentALTERA' : 6183, 'StableKernelArgumentINTEL' : 6183, 'HostAccessINTEL' : 6188, + 'InitModeALTERA' : 6190, 'InitModeINTEL' : 6190, + 'ImplementInRegisterMapALTERA' : 6191, 'ImplementInRegisterMapINTEL' : 6191, 'ConditionalINTEL' : 6247, 'CacheControlLoadINTEL' : 6442, @@ -693,6 +744,8 @@ spv = { 'FragStencilRefEXT' : 5014, 'RemainingRecursionLevelsAMDX' : 5021, 'ShaderIndexAMDX' : 5073, + 'SamplerHeapEXT' : 5122, + 'ResourceHeapEXT' : 5123, 'ViewportMaskNV' : 5253, 'SecondaryPositionNV' : 5257, 'SecondaryViewportMaskNV' : 5258, @@ -788,15 +841,25 @@ spv = { 'IterationMultiple' : 6, 'PeelCount' : 7, 'PartialCount' : 8, + 'InitiationIntervalALTERA' : 16, 'InitiationIntervalINTEL' : 16, + 'MaxConcurrencyALTERA' : 17, 'MaxConcurrencyINTEL' : 17, + 'DependencyArrayALTERA' : 18, 'DependencyArrayINTEL' : 18, + 'PipelineEnableALTERA' : 19, 'PipelineEnableINTEL' : 19, + 'LoopCoalesceALTERA' : 20, 'LoopCoalesceINTEL' : 20, + 'MaxInterleavingALTERA' : 21, 'MaxInterleavingINTEL' : 21, + 'SpeculatedIterationsALTERA' : 22, 'SpeculatedIterationsINTEL' : 22, + 'NoFusionALTERA' : 23, 'NoFusionINTEL' : 23, + 'LoopCountALTERA' : 24, 'LoopCountINTEL' : 24, + 'MaxReinvocationDelayALTERA' : 25, 'MaxReinvocationDelayINTEL' : 25, }, @@ -811,15 +874,25 @@ spv = { 'IterationMultiple' : 0x00000040, 'PeelCount' : 0x00000080, 'PartialCount' : 0x00000100, + 'InitiationIntervalALTERA' : 0x00010000, 'InitiationIntervalINTEL' : 0x00010000, + 'MaxConcurrencyALTERA' : 0x00020000, 'MaxConcurrencyINTEL' : 0x00020000, + 'DependencyArrayALTERA' : 0x00040000, 'DependencyArrayINTEL' : 0x00040000, + 'PipelineEnableALTERA' : 0x00080000, 'PipelineEnableINTEL' : 0x00080000, + 'LoopCoalesceALTERA' : 0x00100000, 'LoopCoalesceINTEL' : 0x00100000, + 'MaxInterleavingALTERA' : 0x00200000, 'MaxInterleavingINTEL' : 0x00200000, + 'SpeculatedIterationsALTERA' : 0x00400000, 'SpeculatedIterationsINTEL' : 0x00400000, + 'NoFusionALTERA' : 0x00800000, 'NoFusionINTEL' : 0x00800000, + 'LoopCountALTERA' : 0x01000000, 'LoopCountINTEL' : 0x01000000, + 'MaxReinvocationDelayALTERA' : 0x02000000, 'MaxReinvocationDelayINTEL' : 0x02000000, }, @@ -928,8 +1001,11 @@ spv = { 'InclusiveScan' : 1, 'ExclusiveScan' : 2, 'ClusteredReduce' : 3, + 'PartitionedReduceEXT' : 6, 'PartitionedReduceNV' : 6, + 'PartitionedInclusiveScanEXT' : 7, 'PartitionedInclusiveScanNV' : 7, + 'PartitionedExclusiveScanEXT' : 8, 'PartitionedExclusiveScanNV' : 8, }, @@ -1082,6 +1158,7 @@ spv = { 'BFloat16TypeKHR' : 5116, 'BFloat16DotProductKHR' : 5117, 'BFloat16CooperativeMatrixKHR' : 5118, + 'DescriptorHeapEXT' : 5128, 'SampleMaskOverrideCoverageNV' : 5249, 'GeometryShaderPassthroughNV' : 5251, 'ShaderViewportIndexLayerEXT' : 5254, @@ -1099,6 +1176,7 @@ spv = { 'ComputeDerivativeGroupQuadsNV' : 5288, 'FragmentDensityEXT' : 5291, 'ShadingRateNV' : 5291, + 'GroupNonUniformPartitionedEXT' : 5297, 'GroupNonUniformPartitionedNV' : 5297, 'ShaderNonUniform' : 5301, 'ShaderNonUniformEXT' : 5301, @@ -1146,6 +1224,7 @@ spv = { 'DisplacementMicromapNV' : 5380, 'RayTracingOpacityMicromapEXT' : 5381, 'ShaderInvocationReorderNV' : 5383, + 'ShaderInvocationReorderEXT' : 5388, 'BindlessTextureNV' : 5390, 'RayQueryPositionFetchKHR' : 5391, 'CooperativeVectorNV' : 5394, @@ -1154,6 +1233,9 @@ spv = { 'RawAccessChainsNV' : 5414, 'RayTracingSpheresGeometryNV' : 5418, 'RayTracingLinearSweptSpheresGeometryNV' : 5419, + 'PushConstantBanksNV' : 5423, + 'LongVectorEXT' : 5425, + 'Shader64BitIndexingEXT' : 5426, 'CooperativeMatrixReductionsNV' : 5430, 'CooperativeMatrixConversionsNV' : 5431, 'CooperativeMatrixPerElementOperationsNV' : 5432, @@ -1183,26 +1265,42 @@ spv = { 'SubgroupAvcMotionEstimationChromaINTEL' : 5698, 'VariableLengthArrayINTEL' : 5817, 'FunctionFloatControlINTEL' : 5821, + 'FPGAMemoryAttributesALTERA' : 5824, 'FPGAMemoryAttributesINTEL' : 5824, 'FPFastMathModeINTEL' : 5837, + 'ArbitraryPrecisionIntegersALTERA' : 5844, 'ArbitraryPrecisionIntegersINTEL' : 5844, + 'ArbitraryPrecisionFloatingPointALTERA' : 5845, 'ArbitraryPrecisionFloatingPointINTEL' : 5845, 'UnstructuredLoopControlsINTEL' : 5886, + 'FPGALoopControlsALTERA' : 5888, 'FPGALoopControlsINTEL' : 5888, 'KernelAttributesINTEL' : 5892, 'FPGAKernelAttributesINTEL' : 5897, + 'FPGAMemoryAccessesALTERA' : 5898, 'FPGAMemoryAccessesINTEL' : 5898, + 'FPGAClusterAttributesALTERA' : 5904, 'FPGAClusterAttributesINTEL' : 5904, + 'LoopFuseALTERA' : 5906, 'LoopFuseINTEL' : 5906, + 'FPGADSPControlALTERA' : 5908, 'FPGADSPControlINTEL' : 5908, 'MemoryAccessAliasingINTEL' : 5910, + 'FPGAInvocationPipeliningAttributesALTERA' : 5916, 'FPGAInvocationPipeliningAttributesINTEL' : 5916, + 'FPGABufferLocationALTERA' : 5920, 'FPGABufferLocationINTEL' : 5920, + 'ArbitraryPrecisionFixedPointALTERA' : 5922, 'ArbitraryPrecisionFixedPointINTEL' : 5922, + 'USMStorageClassesALTERA' : 5935, 'USMStorageClassesINTEL' : 5935, + 'RuntimeAlignedAttributeALTERA' : 5939, 'RuntimeAlignedAttributeINTEL' : 5939, + 'IOPipesALTERA' : 5943, 'IOPipesINTEL' : 5943, + 'BlockingPipesALTERA' : 5945, 'BlockingPipesINTEL' : 5945, + 'FPGARegALTERA' : 5948, 'FPGARegINTEL' : 5948, 'DotProductInputAll' : 6016, 'DotProductInputAllKHR' : 6016, @@ -1218,6 +1316,7 @@ spv = { 'BitInstructions' : 6025, 'GroupNonUniformRotateKHR' : 6026, 'FloatControls2' : 6029, + 'FMAKHR' : 6030, 'AtomicFloat32AddEXT' : 6033, 'AtomicFloat64AddEXT' : 6034, 'LongCompositesINTEL' : 6089, @@ -1228,13 +1327,18 @@ spv = { 'BFloat16ConversionINTEL' : 6115, 'SplitBarrierINTEL' : 6141, 'ArithmeticFenceEXT' : 6144, + 'FPGAClusterAttributesV2ALTERA' : 6150, 'FPGAClusterAttributesV2INTEL' : 6150, 'FPGAKernelAttributesv2INTEL' : 6161, + 'TaskSequenceALTERA' : 6162, 'TaskSequenceINTEL' : 6162, 'FPMaxErrorINTEL' : 6169, + 'FPGALatencyControlALTERA' : 6171, 'FPGALatencyControlINTEL' : 6171, + 'FPGAArgumentInterfacesALTERA' : 6174, 'FPGAArgumentInterfacesINTEL' : 6174, 'GlobalVariableHostAccessINTEL' : 6187, + 'GlobalVariableFPGADecorationsALTERA' : 6189, 'GlobalVariableFPGADecorationsINTEL' : 6189, 'SubgroupBufferPrefetchINTEL' : 6220, 'Subgroup2DBlockIOINTEL' : 6228, @@ -1242,6 +1346,7 @@ spv = { 'Subgroup2DBlockTransposeINTEL' : 6230, 'SubgroupMatrixMultiplyAccumulateINTEL' : 6236, 'TernaryBitwiseFunctionINTEL' : 6241, + 'UntypedVariableLengthArrayINTEL' : 6243, 'SpecConditionalINTEL' : 6245, 'FunctionVariantsINTEL' : 6246, 'GroupUniformArithmeticKHR' : 6400, @@ -1427,7 +1532,9 @@ spv = { }, 'InitializationModeQualifier' : { + 'InitOnDeviceReprogramALTERA' : 0, 'InitOnDeviceReprogramINTEL' : 0, + 'InitOnDeviceResetALTERA' : 1, 'InitOnDeviceResetINTEL' : 1, }, @@ -1904,12 +2011,14 @@ spv = { 'OpUntypedInBoundsPtrAccessChainKHR' : 4424, 'OpUntypedArrayLengthKHR' : 4425, 'OpUntypedPrefetchKHR' : 4426, + 'OpFmaKHR' : 4427, 'OpSubgroupAllKHR' : 4428, 'OpSubgroupAnyKHR' : 4429, 'OpSubgroupAllEqualKHR' : 4430, 'OpGroupNonUniformRotateKHR' : 4431, 'OpSubgroupReadInvocationKHR' : 4432, 'OpExtInstWithForwardRefsKHR' : 4433, + 'OpUntypedGroupAsyncCopyKHR' : 4434, 'OpTraceRayKHR' : 4445, 'OpExecuteCallableKHR' : 4446, 'OpConvertUToAccelerationStructureKHR' : 4447, @@ -1975,6 +2084,11 @@ spv = { 'OpSpecConstantStringAMDX' : 5104, 'OpGroupNonUniformQuadAllKHR' : 5110, 'OpGroupNonUniformQuadAnyKHR' : 5111, + 'OpTypeBufferEXT' : 5115, + 'OpBufferPointerEXT' : 5119, + 'OpUntypedImageTexelPointerEXT' : 5126, + 'OpMemberDecorateIdEXT' : 5127, + 'OpConstantSizeOfEXT' : 5129, 'OpHitObjectRecordHitMotionNV' : 5249, 'OpHitObjectRecordHitWithIndexMotionNV' : 5250, 'OpHitObjectRecordMissMotionNV' : 5251, @@ -2010,6 +2124,7 @@ spv = { 'OpTypeHitObjectNV' : 5281, 'OpImageSampleFootprintNV' : 5283, 'OpTypeCooperativeVectorNV' : 5288, + 'OpTypeVectorIdEXT' : 5288, 'OpCooperativeVectorMatrixMulNV' : 5289, 'OpCooperativeVectorOuterProductAccumulateNV' : 5290, 'OpCooperativeVectorReduceSumAccumulateNV' : 5291, @@ -2017,12 +2132,43 @@ spv = { 'OpCooperativeMatrixConvertNV' : 5293, 'OpEmitMeshTasksEXT' : 5294, 'OpSetMeshOutputsEXT' : 5295, + 'OpGroupNonUniformPartitionEXT' : 5296, 'OpGroupNonUniformPartitionNV' : 5296, 'OpWritePackedPrimitiveIndices4x8NV' : 5299, 'OpFetchMicroTriangleVertexPositionNV' : 5300, 'OpFetchMicroTriangleVertexBarycentricNV' : 5301, 'OpCooperativeVectorLoadNV' : 5302, 'OpCooperativeVectorStoreNV' : 5303, + 'OpHitObjectRecordFromQueryEXT' : 5304, + 'OpHitObjectRecordMissEXT' : 5305, + 'OpHitObjectRecordMissMotionEXT' : 5306, + 'OpHitObjectGetIntersectionTriangleVertexPositionsEXT' : 5307, + 'OpHitObjectGetRayFlagsEXT' : 5308, + 'OpHitObjectSetShaderBindingTableRecordIndexEXT' : 5309, + 'OpHitObjectReorderExecuteShaderEXT' : 5310, + 'OpHitObjectTraceReorderExecuteEXT' : 5311, + 'OpHitObjectTraceMotionReorderExecuteEXT' : 5312, + 'OpTypeHitObjectEXT' : 5313, + 'OpReorderThreadWithHintEXT' : 5314, + 'OpReorderThreadWithHitObjectEXT' : 5315, + 'OpHitObjectTraceRayEXT' : 5316, + 'OpHitObjectTraceRayMotionEXT' : 5317, + 'OpHitObjectRecordEmptyEXT' : 5318, + 'OpHitObjectExecuteShaderEXT' : 5319, + 'OpHitObjectGetCurrentTimeEXT' : 5320, + 'OpHitObjectGetAttributesEXT' : 5321, + 'OpHitObjectGetHitKindEXT' : 5322, + 'OpHitObjectGetPrimitiveIndexEXT' : 5323, + 'OpHitObjectGetGeometryIndexEXT' : 5324, + 'OpHitObjectGetInstanceIdEXT' : 5325, + 'OpHitObjectGetInstanceCustomIndexEXT' : 5326, + 'OpHitObjectGetObjectRayOriginEXT' : 5327, + 'OpHitObjectGetObjectRayDirectionEXT' : 5328, + 'OpHitObjectGetWorldRayDirectionEXT' : 5329, + 'OpHitObjectGetWorldRayOriginEXT' : 5330, + 'OpHitObjectGetObjectToWorldEXT' : 5331, + 'OpHitObjectGetWorldToObjectEXT' : 5332, + 'OpHitObjectGetRayTMaxEXT' : 5333, 'OpReportIntersectionKHR' : 5334, 'OpReportIntersectionNV' : 5334, 'OpIgnoreIntersectionNV' : 5335, @@ -2035,7 +2181,14 @@ spv = { 'OpTypeAccelerationStructureNV' : 5341, 'OpExecuteCallableNV' : 5344, 'OpRayQueryGetClusterIdNV' : 5345, + 'OpRayQueryGetIntersectionClusterIdNV' : 5345, 'OpHitObjectGetClusterIdNV' : 5346, + 'OpHitObjectGetRayTMinEXT' : 5347, + 'OpHitObjectGetShaderBindingTableRecordIndexEXT' : 5348, + 'OpHitObjectGetShaderRecordBufferHandleEXT' : 5349, + 'OpHitObjectIsEmptyEXT' : 5350, + 'OpHitObjectIsHitEXT' : 5351, + 'OpHitObjectIsMissEXT' : 5352, 'OpTypeCooperativeMatrixNV' : 5358, 'OpCooperativeMatrixLoadNV' : 5359, 'OpCooperativeMatrixStoreNV' : 5360, @@ -2242,23 +2395,41 @@ spv = { 'OpVariableLengthArrayINTEL' : 5818, 'OpSaveMemoryINTEL' : 5819, 'OpRestoreMemoryINTEL' : 5820, + 'OpArbitraryFloatSinCosPiALTERA' : 5840, 'OpArbitraryFloatSinCosPiINTEL' : 5840, + 'OpArbitraryFloatCastALTERA' : 5841, 'OpArbitraryFloatCastINTEL' : 5841, + 'OpArbitraryFloatCastFromIntALTERA' : 5842, 'OpArbitraryFloatCastFromIntINTEL' : 5842, + 'OpArbitraryFloatCastToIntALTERA' : 5843, 'OpArbitraryFloatCastToIntINTEL' : 5843, + 'OpArbitraryFloatAddALTERA' : 5846, 'OpArbitraryFloatAddINTEL' : 5846, + 'OpArbitraryFloatSubALTERA' : 5847, 'OpArbitraryFloatSubINTEL' : 5847, + 'OpArbitraryFloatMulALTERA' : 5848, 'OpArbitraryFloatMulINTEL' : 5848, + 'OpArbitraryFloatDivALTERA' : 5849, 'OpArbitraryFloatDivINTEL' : 5849, + 'OpArbitraryFloatGTALTERA' : 5850, 'OpArbitraryFloatGTINTEL' : 5850, + 'OpArbitraryFloatGEALTERA' : 5851, 'OpArbitraryFloatGEINTEL' : 5851, + 'OpArbitraryFloatLTALTERA' : 5852, 'OpArbitraryFloatLTINTEL' : 5852, + 'OpArbitraryFloatLEALTERA' : 5853, 'OpArbitraryFloatLEINTEL' : 5853, + 'OpArbitraryFloatEQALTERA' : 5854, 'OpArbitraryFloatEQINTEL' : 5854, + 'OpArbitraryFloatRecipALTERA' : 5855, 'OpArbitraryFloatRecipINTEL' : 5855, + 'OpArbitraryFloatRSqrtALTERA' : 5856, 'OpArbitraryFloatRSqrtINTEL' : 5856, + 'OpArbitraryFloatCbrtALTERA' : 5857, 'OpArbitraryFloatCbrtINTEL' : 5857, + 'OpArbitraryFloatHypotALTERA' : 5858, 'OpArbitraryFloatHypotINTEL' : 5858, + 'OpArbitraryFloatSqrtALTERA' : 5859, 'OpArbitraryFloatSqrtINTEL' : 5859, 'OpArbitraryFloatLogINTEL' : 5860, 'OpArbitraryFloatLog2INTEL' : 5861, @@ -2287,21 +2458,37 @@ spv = { 'OpAliasDomainDeclINTEL' : 5911, 'OpAliasScopeDeclINTEL' : 5912, 'OpAliasScopeListDeclINTEL' : 5913, + 'OpFixedSqrtALTERA' : 5923, 'OpFixedSqrtINTEL' : 5923, + 'OpFixedRecipALTERA' : 5924, 'OpFixedRecipINTEL' : 5924, + 'OpFixedRsqrtALTERA' : 5925, 'OpFixedRsqrtINTEL' : 5925, + 'OpFixedSinALTERA' : 5926, 'OpFixedSinINTEL' : 5926, + 'OpFixedCosALTERA' : 5927, 'OpFixedCosINTEL' : 5927, + 'OpFixedSinCosALTERA' : 5928, 'OpFixedSinCosINTEL' : 5928, + 'OpFixedSinPiALTERA' : 5929, 'OpFixedSinPiINTEL' : 5929, + 'OpFixedCosPiALTERA' : 5930, 'OpFixedCosPiINTEL' : 5930, + 'OpFixedSinCosPiALTERA' : 5931, 'OpFixedSinCosPiINTEL' : 5931, + 'OpFixedLogALTERA' : 5932, 'OpFixedLogINTEL' : 5932, + 'OpFixedExpALTERA' : 5933, 'OpFixedExpINTEL' : 5933, + 'OpPtrCastToCrossWorkgroupALTERA' : 5934, 'OpPtrCastToCrossWorkgroupINTEL' : 5934, + 'OpCrossWorkgroupCastToPtrALTERA' : 5938, 'OpCrossWorkgroupCastToPtrINTEL' : 5938, + 'OpReadPipeBlockingALTERA' : 5946, 'OpReadPipeBlockingINTEL' : 5946, + 'OpWritePipeBlockingALTERA' : 5947, 'OpWritePipeBlockingINTEL' : 5947, + 'OpFPGARegALTERA' : 5949, 'OpFPGARegINTEL' : 5949, 'OpRayQueryGetRayTMinKHR' : 6016, 'OpRayQueryGetRayFlagsKHR' : 6017, @@ -2331,10 +2518,15 @@ spv = { 'OpControlBarrierArriveINTEL' : 6142, 'OpControlBarrierWaitINTEL' : 6143, 'OpArithmeticFenceEXT' : 6145, + 'OpTaskSequenceCreateALTERA' : 6163, 'OpTaskSequenceCreateINTEL' : 6163, + 'OpTaskSequenceAsyncALTERA' : 6164, 'OpTaskSequenceAsyncINTEL' : 6164, + 'OpTaskSequenceGetALTERA' : 6165, 'OpTaskSequenceGetINTEL' : 6165, + 'OpTaskSequenceReleaseALTERA' : 6166, 'OpTaskSequenceReleaseINTEL' : 6166, + 'OpTypeTaskSequenceALTERA' : 6199, 'OpTypeTaskSequenceINTEL' : 6199, 'OpSubgroupBlockPrefetchINTEL' : 6221, 'OpSubgroup2DBlockLoadINTEL' : 6231, @@ -2344,6 +2536,7 @@ spv = { 'OpSubgroup2DBlockStoreINTEL' : 6235, 'OpSubgroupMatrixMultiplyAccumulateINTEL' : 6237, 'OpBitwiseFunctionINTEL' : 6242, + 'OpUntypedVariableLengthArrayINTEL' : 6244, 'OpConditionalExtensionINTEL' : 6248, 'OpConditionalEntryPointINTEL' : 6249, 'OpConditionalCapabilityINTEL' : 6250, diff --git a/third_party/spirv-headers/include/spirv/unified1/spv.d b/third_party/spirv-headers/include/spirv/unified1/spv.d index 6346bcb0eb..6b9c238d5a 100644 --- a/third_party/spirv-headers/include/spirv/unified1/spv.d +++ b/third_party/spirv-headers/include/spirv/unified1/spv.d @@ -194,6 +194,7 @@ enum ExecutionMode : uint SampleInterlockUnorderedEXT = 5369, ShadingRateInterlockOrderedEXT = 5370, ShadingRateInterlockUnorderedEXT = 5371, + Shader64BitIndexingEXT = 5427, SharedLocalMemorySizeINTEL = 5618, RoundingModeRTPINTEL = 5620, RoundingModeRTNINTEL = 5621, @@ -249,8 +250,11 @@ enum StorageClass : uint PhysicalStorageBufferEXT = 5349, HitObjectAttributeNV = 5385, TaskPayloadWorkgroupEXT = 5402, + HitObjectAttributeEXT = 5411, CodeSectionINTEL = 5605, + DeviceOnlyALTERA = 5936, DeviceOnlyINTEL = 5936, + HostOnlyALTERA = 5937, HostOnlyINTEL = 5937, Max = 0x7fffffff, } @@ -503,6 +507,7 @@ enum FunctionParameterAttribute : uint NoCapture = 5, NoWrite = 6, NoReadWrite = 7, + RuntimeAlignedALTERA = 5940, RuntimeAlignedINTEL = 5940, Max = 0x7fffffff, } @@ -571,6 +576,8 @@ enum Decoration : uint PayloadNodeSparseArrayAMDX = 5099, PayloadNodeArraySizeAMDX = 5100, PayloadDispatchIndirectAMDX = 5105, + ArrayStrideIdEXT = 5124, + OffsetIdEXT = 5125, OverrideCoverageNV = 5248, PassthroughNV = 5250, ViewportRelativeNV = 5252, @@ -587,7 +594,10 @@ enum Decoration : uint RestrictPointerEXT = 5355, AliasedPointer = 5356, AliasedPointerEXT = 5356, + MemberOffsetNV = 5358, HitObjectShaderRecordBufferNV = 5386, + HitObjectShaderRecordBufferEXT = 5389, + BankNV = 5397, BindlessSamplerNV = 5398, BindlessImageNV = 5399, BoundSamplerNV = 5400, @@ -608,54 +618,95 @@ enum Decoration : uint UserTypeGOOGLE = 5636, FunctionRoundingModeINTEL = 5822, FunctionDenormModeINTEL = 5823, + RegisterALTERA = 5825, RegisterINTEL = 5825, + MemoryALTERA = 5826, MemoryINTEL = 5826, + NumbanksALTERA = 5827, NumbanksINTEL = 5827, + BankwidthALTERA = 5828, BankwidthINTEL = 5828, + MaxPrivateCopiesALTERA = 5829, MaxPrivateCopiesINTEL = 5829, + SinglepumpALTERA = 5830, SinglepumpINTEL = 5830, + DoublepumpALTERA = 5831, DoublepumpINTEL = 5831, + MaxReplicatesALTERA = 5832, MaxReplicatesINTEL = 5832, + SimpleDualPortALTERA = 5833, SimpleDualPortINTEL = 5833, + MergeALTERA = 5834, MergeINTEL = 5834, + BankBitsALTERA = 5835, BankBitsINTEL = 5835, + ForcePow2DepthALTERA = 5836, ForcePow2DepthINTEL = 5836, + StridesizeALTERA = 5883, StridesizeINTEL = 5883, + WordsizeALTERA = 5884, WordsizeINTEL = 5884, + TrueDualPortALTERA = 5885, TrueDualPortINTEL = 5885, + BurstCoalesceALTERA = 5899, BurstCoalesceINTEL = 5899, + CacheSizeALTERA = 5900, CacheSizeINTEL = 5900, + DontStaticallyCoalesceALTERA = 5901, DontStaticallyCoalesceINTEL = 5901, + PrefetchALTERA = 5902, PrefetchINTEL = 5902, + StallEnableALTERA = 5905, StallEnableINTEL = 5905, + FuseLoopsInFunctionALTERA = 5907, FuseLoopsInFunctionINTEL = 5907, + MathOpDSPModeALTERA = 5909, MathOpDSPModeINTEL = 5909, AliasScopeINTEL = 5914, NoAliasINTEL = 5915, + InitiationIntervalALTERA = 5917, InitiationIntervalINTEL = 5917, + MaxConcurrencyALTERA = 5918, MaxConcurrencyINTEL = 5918, + PipelineEnableALTERA = 5919, PipelineEnableINTEL = 5919, + BufferLocationALTERA = 5921, BufferLocationINTEL = 5921, + IOPipeStorageALTERA = 5944, IOPipeStorageINTEL = 5944, FunctionFloatingPointModeINTEL = 6080, SingleElementVectorINTEL = 6085, VectorComputeCallableFunctionINTEL = 6087, MediaBlockIOINTEL = 6140, + StallFreeALTERA = 6151, StallFreeINTEL = 6151, FPMaxErrorDecorationINTEL = 6170, + LatencyControlLabelALTERA = 6172, LatencyControlLabelINTEL = 6172, + LatencyControlConstraintALTERA = 6173, LatencyControlConstraintINTEL = 6173, + ConduitKernelArgumentALTERA = 6175, ConduitKernelArgumentINTEL = 6175, + RegisterMapKernelArgumentALTERA = 6176, RegisterMapKernelArgumentINTEL = 6176, + MMHostInterfaceAddressWidthALTERA = 6177, MMHostInterfaceAddressWidthINTEL = 6177, + MMHostInterfaceDataWidthALTERA = 6178, MMHostInterfaceDataWidthINTEL = 6178, + MMHostInterfaceLatencyALTERA = 6179, MMHostInterfaceLatencyINTEL = 6179, + MMHostInterfaceReadWriteModeALTERA = 6180, MMHostInterfaceReadWriteModeINTEL = 6180, + MMHostInterfaceMaxBurstALTERA = 6181, MMHostInterfaceMaxBurstINTEL = 6181, + MMHostInterfaceWaitRequestALTERA = 6182, MMHostInterfaceWaitRequestINTEL = 6182, + StableKernelArgumentALTERA = 6183, StableKernelArgumentINTEL = 6183, HostAccessINTEL = 6188, + InitModeALTERA = 6190, InitModeINTEL = 6190, + ImplementInRegisterMapALTERA = 6191, ImplementInRegisterMapINTEL = 6191, ConditionalINTEL = 6247, CacheControlLoadINTEL = 6442, @@ -741,6 +792,8 @@ enum BuiltIn : uint FragStencilRefEXT = 5014, RemainingRecursionLevelsAMDX = 5021, ShaderIndexAMDX = 5073, + SamplerHeapEXT = 5122, + ResourceHeapEXT = 5123, ViewportMaskNV = 5253, SecondaryPositionNV = 5257, SecondaryViewportMaskNV = 5258, @@ -841,15 +894,25 @@ enum LoopControlShift : uint IterationMultiple = 6, PeelCount = 7, PartialCount = 8, + InitiationIntervalALTERA = 16, InitiationIntervalINTEL = 16, + MaxConcurrencyALTERA = 17, MaxConcurrencyINTEL = 17, + DependencyArrayALTERA = 18, DependencyArrayINTEL = 18, + PipelineEnableALTERA = 19, PipelineEnableINTEL = 19, + LoopCoalesceALTERA = 20, LoopCoalesceINTEL = 20, + MaxInterleavingALTERA = 21, MaxInterleavingINTEL = 21, + SpeculatedIterationsALTERA = 22, SpeculatedIterationsINTEL = 22, + NoFusionALTERA = 23, NoFusionINTEL = 23, + LoopCountALTERA = 24, LoopCountINTEL = 24, + MaxReinvocationDelayALTERA = 25, MaxReinvocationDelayINTEL = 25, Max = 0x7fffffff, } @@ -866,15 +929,25 @@ enum LoopControlMask : uint IterationMultiple = 0x00000040, PeelCount = 0x00000080, PartialCount = 0x00000100, + InitiationIntervalALTERA = 0x00010000, InitiationIntervalINTEL = 0x00010000, + MaxConcurrencyALTERA = 0x00020000, MaxConcurrencyINTEL = 0x00020000, + DependencyArrayALTERA = 0x00040000, DependencyArrayINTEL = 0x00040000, + PipelineEnableALTERA = 0x00080000, PipelineEnableINTEL = 0x00080000, + LoopCoalesceALTERA = 0x00100000, LoopCoalesceINTEL = 0x00100000, + MaxInterleavingALTERA = 0x00200000, MaxInterleavingINTEL = 0x00200000, + SpeculatedIterationsALTERA = 0x00400000, SpeculatedIterationsINTEL = 0x00400000, + NoFusionALTERA = 0x00800000, NoFusionINTEL = 0x00800000, + LoopCountALTERA = 0x01000000, LoopCountINTEL = 0x01000000, + MaxReinvocationDelayALTERA = 0x02000000, MaxReinvocationDelayINTEL = 0x02000000, } @@ -995,8 +1068,11 @@ enum GroupOperation : uint InclusiveScan = 1, ExclusiveScan = 2, ClusteredReduce = 3, + PartitionedReduceEXT = 6, PartitionedReduceNV = 6, + PartitionedInclusiveScanEXT = 7, PartitionedInclusiveScanNV = 7, + PartitionedExclusiveScanEXT = 8, PartitionedExclusiveScanNV = 8, Max = 0x7fffffff, } @@ -1156,6 +1232,7 @@ enum Capability : uint BFloat16TypeKHR = 5116, BFloat16DotProductKHR = 5117, BFloat16CooperativeMatrixKHR = 5118, + DescriptorHeapEXT = 5128, SampleMaskOverrideCoverageNV = 5249, GeometryShaderPassthroughNV = 5251, ShaderViewportIndexLayerEXT = 5254, @@ -1173,6 +1250,7 @@ enum Capability : uint ComputeDerivativeGroupQuadsNV = 5288, FragmentDensityEXT = 5291, ShadingRateNV = 5291, + GroupNonUniformPartitionedEXT = 5297, GroupNonUniformPartitionedNV = 5297, ShaderNonUniform = 5301, ShaderNonUniformEXT = 5301, @@ -1220,6 +1298,7 @@ enum Capability : uint DisplacementMicromapNV = 5380, RayTracingOpacityMicromapEXT = 5381, ShaderInvocationReorderNV = 5383, + ShaderInvocationReorderEXT = 5388, BindlessTextureNV = 5390, RayQueryPositionFetchKHR = 5391, CooperativeVectorNV = 5394, @@ -1228,6 +1307,9 @@ enum Capability : uint RawAccessChainsNV = 5414, RayTracingSpheresGeometryNV = 5418, RayTracingLinearSweptSpheresGeometryNV = 5419, + PushConstantBanksNV = 5423, + LongVectorEXT = 5425, + Shader64BitIndexingEXT = 5426, CooperativeMatrixReductionsNV = 5430, CooperativeMatrixConversionsNV = 5431, CooperativeMatrixPerElementOperationsNV = 5432, @@ -1257,26 +1339,42 @@ enum Capability : uint SubgroupAvcMotionEstimationChromaINTEL = 5698, VariableLengthArrayINTEL = 5817, FunctionFloatControlINTEL = 5821, + FPGAMemoryAttributesALTERA = 5824, FPGAMemoryAttributesINTEL = 5824, FPFastMathModeINTEL = 5837, + ArbitraryPrecisionIntegersALTERA = 5844, ArbitraryPrecisionIntegersINTEL = 5844, + ArbitraryPrecisionFloatingPointALTERA = 5845, ArbitraryPrecisionFloatingPointINTEL = 5845, UnstructuredLoopControlsINTEL = 5886, + FPGALoopControlsALTERA = 5888, FPGALoopControlsINTEL = 5888, KernelAttributesINTEL = 5892, FPGAKernelAttributesINTEL = 5897, + FPGAMemoryAccessesALTERA = 5898, FPGAMemoryAccessesINTEL = 5898, + FPGAClusterAttributesALTERA = 5904, FPGAClusterAttributesINTEL = 5904, + LoopFuseALTERA = 5906, LoopFuseINTEL = 5906, + FPGADSPControlALTERA = 5908, FPGADSPControlINTEL = 5908, MemoryAccessAliasingINTEL = 5910, + FPGAInvocationPipeliningAttributesALTERA = 5916, FPGAInvocationPipeliningAttributesINTEL = 5916, + FPGABufferLocationALTERA = 5920, FPGABufferLocationINTEL = 5920, + ArbitraryPrecisionFixedPointALTERA = 5922, ArbitraryPrecisionFixedPointINTEL = 5922, + USMStorageClassesALTERA = 5935, USMStorageClassesINTEL = 5935, + RuntimeAlignedAttributeALTERA = 5939, RuntimeAlignedAttributeINTEL = 5939, + IOPipesALTERA = 5943, IOPipesINTEL = 5943, + BlockingPipesALTERA = 5945, BlockingPipesINTEL = 5945, + FPGARegALTERA = 5948, FPGARegINTEL = 5948, DotProductInputAll = 6016, DotProductInputAllKHR = 6016, @@ -1292,6 +1390,7 @@ enum Capability : uint BitInstructions = 6025, GroupNonUniformRotateKHR = 6026, FloatControls2 = 6029, + FMAKHR = 6030, AtomicFloat32AddEXT = 6033, AtomicFloat64AddEXT = 6034, LongCompositesINTEL = 6089, @@ -1302,13 +1401,18 @@ enum Capability : uint BFloat16ConversionINTEL = 6115, SplitBarrierINTEL = 6141, ArithmeticFenceEXT = 6144, + FPGAClusterAttributesV2ALTERA = 6150, FPGAClusterAttributesV2INTEL = 6150, FPGAKernelAttributesv2INTEL = 6161, + TaskSequenceALTERA = 6162, TaskSequenceINTEL = 6162, FPMaxErrorINTEL = 6169, + FPGALatencyControlALTERA = 6171, FPGALatencyControlINTEL = 6171, + FPGAArgumentInterfacesALTERA = 6174, FPGAArgumentInterfacesINTEL = 6174, GlobalVariableHostAccessINTEL = 6187, + GlobalVariableFPGADecorationsALTERA = 6189, GlobalVariableFPGADecorationsINTEL = 6189, SubgroupBufferPrefetchINTEL = 6220, Subgroup2DBlockIOINTEL = 6228, @@ -1316,6 +1420,7 @@ enum Capability : uint Subgroup2DBlockTransposeINTEL = 6230, SubgroupMatrixMultiplyAccumulateINTEL = 6236, TernaryBitwiseFunctionINTEL = 6241, + UntypedVariableLengthArrayINTEL = 6243, SpecConditionalINTEL = 6245, FunctionVariantsINTEL = 6246, GroupUniformArithmeticKHR = 6400, @@ -1543,7 +1648,9 @@ enum TensorOperandsMask : uint enum InitializationModeQualifier : uint { + InitOnDeviceReprogramALTERA = 0, InitOnDeviceReprogramINTEL = 0, + InitOnDeviceResetALTERA = 1, InitOnDeviceResetINTEL = 1, Max = 0x7fffffff, } @@ -2042,12 +2149,14 @@ enum Op : uint OpUntypedInBoundsPtrAccessChainKHR = 4424, OpUntypedArrayLengthKHR = 4425, OpUntypedPrefetchKHR = 4426, + OpFmaKHR = 4427, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, OpGroupNonUniformRotateKHR = 4431, OpSubgroupReadInvocationKHR = 4432, OpExtInstWithForwardRefsKHR = 4433, + OpUntypedGroupAsyncCopyKHR = 4434, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, OpConvertUToAccelerationStructureKHR = 4447, @@ -2113,6 +2222,11 @@ enum Op : uint OpSpecConstantStringAMDX = 5104, OpGroupNonUniformQuadAllKHR = 5110, OpGroupNonUniformQuadAnyKHR = 5111, + OpTypeBufferEXT = 5115, + OpBufferPointerEXT = 5119, + OpUntypedImageTexelPointerEXT = 5126, + OpMemberDecorateIdEXT = 5127, + OpConstantSizeOfEXT = 5129, OpHitObjectRecordHitMotionNV = 5249, OpHitObjectRecordHitWithIndexMotionNV = 5250, OpHitObjectRecordMissMotionNV = 5251, @@ -2148,6 +2262,7 @@ enum Op : uint OpTypeHitObjectNV = 5281, OpImageSampleFootprintNV = 5283, OpTypeCooperativeVectorNV = 5288, + OpTypeVectorIdEXT = 5288, OpCooperativeVectorMatrixMulNV = 5289, OpCooperativeVectorOuterProductAccumulateNV = 5290, OpCooperativeVectorReduceSumAccumulateNV = 5291, @@ -2155,12 +2270,43 @@ enum Op : uint OpCooperativeMatrixConvertNV = 5293, OpEmitMeshTasksEXT = 5294, OpSetMeshOutputsEXT = 5295, + OpGroupNonUniformPartitionEXT = 5296, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, OpFetchMicroTriangleVertexPositionNV = 5300, OpFetchMicroTriangleVertexBarycentricNV = 5301, OpCooperativeVectorLoadNV = 5302, OpCooperativeVectorStoreNV = 5303, + OpHitObjectRecordFromQueryEXT = 5304, + OpHitObjectRecordMissEXT = 5305, + OpHitObjectRecordMissMotionEXT = 5306, + OpHitObjectGetIntersectionTriangleVertexPositionsEXT = 5307, + OpHitObjectGetRayFlagsEXT = 5308, + OpHitObjectSetShaderBindingTableRecordIndexEXT = 5309, + OpHitObjectReorderExecuteShaderEXT = 5310, + OpHitObjectTraceReorderExecuteEXT = 5311, + OpHitObjectTraceMotionReorderExecuteEXT = 5312, + OpTypeHitObjectEXT = 5313, + OpReorderThreadWithHintEXT = 5314, + OpReorderThreadWithHitObjectEXT = 5315, + OpHitObjectTraceRayEXT = 5316, + OpHitObjectTraceRayMotionEXT = 5317, + OpHitObjectRecordEmptyEXT = 5318, + OpHitObjectExecuteShaderEXT = 5319, + OpHitObjectGetCurrentTimeEXT = 5320, + OpHitObjectGetAttributesEXT = 5321, + OpHitObjectGetHitKindEXT = 5322, + OpHitObjectGetPrimitiveIndexEXT = 5323, + OpHitObjectGetGeometryIndexEXT = 5324, + OpHitObjectGetInstanceIdEXT = 5325, + OpHitObjectGetInstanceCustomIndexEXT = 5326, + OpHitObjectGetObjectRayOriginEXT = 5327, + OpHitObjectGetObjectRayDirectionEXT = 5328, + OpHitObjectGetWorldRayDirectionEXT = 5329, + OpHitObjectGetWorldRayOriginEXT = 5330, + OpHitObjectGetObjectToWorldEXT = 5331, + OpHitObjectGetWorldToObjectEXT = 5332, + OpHitObjectGetRayTMaxEXT = 5333, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, @@ -2173,7 +2319,14 @@ enum Op : uint OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, OpRayQueryGetClusterIdNV = 5345, + OpRayQueryGetIntersectionClusterIdNV = 5345, OpHitObjectGetClusterIdNV = 5346, + OpHitObjectGetRayTMinEXT = 5347, + OpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, + OpHitObjectGetShaderRecordBufferHandleEXT = 5349, + OpHitObjectIsEmptyEXT = 5350, + OpHitObjectIsHitEXT = 5351, + OpHitObjectIsMissEXT = 5352, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixStoreNV = 5360, @@ -2380,23 +2533,41 @@ enum Op : uint OpVariableLengthArrayINTEL = 5818, OpSaveMemoryINTEL = 5819, OpRestoreMemoryINTEL = 5820, + OpArbitraryFloatSinCosPiALTERA = 5840, OpArbitraryFloatSinCosPiINTEL = 5840, + OpArbitraryFloatCastALTERA = 5841, OpArbitraryFloatCastINTEL = 5841, + OpArbitraryFloatCastFromIntALTERA = 5842, OpArbitraryFloatCastFromIntINTEL = 5842, + OpArbitraryFloatCastToIntALTERA = 5843, OpArbitraryFloatCastToIntINTEL = 5843, + OpArbitraryFloatAddALTERA = 5846, OpArbitraryFloatAddINTEL = 5846, + OpArbitraryFloatSubALTERA = 5847, OpArbitraryFloatSubINTEL = 5847, + OpArbitraryFloatMulALTERA = 5848, OpArbitraryFloatMulINTEL = 5848, + OpArbitraryFloatDivALTERA = 5849, OpArbitraryFloatDivINTEL = 5849, + OpArbitraryFloatGTALTERA = 5850, OpArbitraryFloatGTINTEL = 5850, + OpArbitraryFloatGEALTERA = 5851, OpArbitraryFloatGEINTEL = 5851, + OpArbitraryFloatLTALTERA = 5852, OpArbitraryFloatLTINTEL = 5852, + OpArbitraryFloatLEALTERA = 5853, OpArbitraryFloatLEINTEL = 5853, + OpArbitraryFloatEQALTERA = 5854, OpArbitraryFloatEQINTEL = 5854, + OpArbitraryFloatRecipALTERA = 5855, OpArbitraryFloatRecipINTEL = 5855, + OpArbitraryFloatRSqrtALTERA = 5856, OpArbitraryFloatRSqrtINTEL = 5856, + OpArbitraryFloatCbrtALTERA = 5857, OpArbitraryFloatCbrtINTEL = 5857, + OpArbitraryFloatHypotALTERA = 5858, OpArbitraryFloatHypotINTEL = 5858, + OpArbitraryFloatSqrtALTERA = 5859, OpArbitraryFloatSqrtINTEL = 5859, OpArbitraryFloatLogINTEL = 5860, OpArbitraryFloatLog2INTEL = 5861, @@ -2425,21 +2596,37 @@ enum Op : uint OpAliasDomainDeclINTEL = 5911, OpAliasScopeDeclINTEL = 5912, OpAliasScopeListDeclINTEL = 5913, + OpFixedSqrtALTERA = 5923, OpFixedSqrtINTEL = 5923, + OpFixedRecipALTERA = 5924, OpFixedRecipINTEL = 5924, + OpFixedRsqrtALTERA = 5925, OpFixedRsqrtINTEL = 5925, + OpFixedSinALTERA = 5926, OpFixedSinINTEL = 5926, + OpFixedCosALTERA = 5927, OpFixedCosINTEL = 5927, + OpFixedSinCosALTERA = 5928, OpFixedSinCosINTEL = 5928, + OpFixedSinPiALTERA = 5929, OpFixedSinPiINTEL = 5929, + OpFixedCosPiALTERA = 5930, OpFixedCosPiINTEL = 5930, + OpFixedSinCosPiALTERA = 5931, OpFixedSinCosPiINTEL = 5931, + OpFixedLogALTERA = 5932, OpFixedLogINTEL = 5932, + OpFixedExpALTERA = 5933, OpFixedExpINTEL = 5933, + OpPtrCastToCrossWorkgroupALTERA = 5934, OpPtrCastToCrossWorkgroupINTEL = 5934, + OpCrossWorkgroupCastToPtrALTERA = 5938, OpCrossWorkgroupCastToPtrINTEL = 5938, + OpReadPipeBlockingALTERA = 5946, OpReadPipeBlockingINTEL = 5946, + OpWritePipeBlockingALTERA = 5947, OpWritePipeBlockingINTEL = 5947, + OpFPGARegALTERA = 5949, OpFPGARegINTEL = 5949, OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayFlagsKHR = 6017, @@ -2469,10 +2656,15 @@ enum Op : uint OpControlBarrierArriveINTEL = 6142, OpControlBarrierWaitINTEL = 6143, OpArithmeticFenceEXT = 6145, + OpTaskSequenceCreateALTERA = 6163, OpTaskSequenceCreateINTEL = 6163, + OpTaskSequenceAsyncALTERA = 6164, OpTaskSequenceAsyncINTEL = 6164, + OpTaskSequenceGetALTERA = 6165, OpTaskSequenceGetINTEL = 6165, + OpTaskSequenceReleaseALTERA = 6166, OpTaskSequenceReleaseINTEL = 6166, + OpTypeTaskSequenceALTERA = 6199, OpTypeTaskSequenceINTEL = 6199, OpSubgroupBlockPrefetchINTEL = 6221, OpSubgroup2DBlockLoadINTEL = 6231, @@ -2482,6 +2674,7 @@ enum Op : uint OpSubgroup2DBlockStoreINTEL = 6235, OpSubgroupMatrixMultiplyAccumulateINTEL = 6237, OpBitwiseFunctionINTEL = 6242, + OpUntypedVariableLengthArrayINTEL = 6244, OpConditionalExtensionINTEL = 6248, OpConditionalEntryPointINTEL = 6249, OpConditionalCapabilityINTEL = 6250, diff --git a/third_party/spirv-headers/tools/buildHeaders/bin/makeExtinstHeaders.py b/third_party/spirv-headers/tools/buildHeaders/bin/makeExtinstHeaders.py index 6a3e3f8f48..e5fd640e4e 100755 --- a/third_party/spirv-headers/tools/buildHeaders/bin/makeExtinstHeaders.py +++ b/third_party/spirv-headers/tools/buildHeaders/bin/makeExtinstHeaders.py @@ -30,3 +30,4 @@ mk_extinst('NonSemanticClspvReflection', 'extinst.nonsemantic.clspvreflection.gr mk_extinst('NonSemanticDebugBreak', 'extinst.nonsemantic.debugbreak.grammar.json') mk_extinst('NonSemanticVkspReflection', 'extinst.nonsemantic.vkspreflection.grammar.json') mk_extinst('TOSA', 'extinst.tosa.001000.1.grammar.json', 'TOSA.001000.1') +mk_extinst('ArmMotionEngine', 'extinst.arm.motion-engine.100.grammar.json', 'ArmMotionEngine.100') diff --git a/third_party/spirv-headers/tools/buildHeaders/jsonToSpirv.cpp b/third_party/spirv-headers/tools/buildHeaders/jsonToSpirv.cpp index cc55723e09..e7d69b664b 100644 --- a/third_party/spirv-headers/tools/buildHeaders/jsonToSpirv.cpp +++ b/third_party/spirv-headers/tools/buildHeaders/jsonToSpirv.cpp @@ -99,9 +99,6 @@ bool IsLegacyDoublyEnabledInstruction(const std::string& instruction) { "OpAliasDomainDeclINTEL", "OpAliasScopeDeclINTEL", "OpAliasScopeListDeclINTEL", - "OpReadPipeBlockingINTEL", - "OpWritePipeBlockingINTEL", - "OpFPGARegINTEL", "OpRayQueryGetRayTMinKHR", "OpRayQueryGetRayFlagsKHR", "OpRayQueryGetIntersectionTKHR", diff --git a/third_party/spirv-headers/tools/check_grammar/check_grammar.py b/third_party/spirv-headers/tools/check_grammar/check_grammar.py new file mode 100755 index 0000000000..7d7cd41e7d --- /dev/null +++ b/third_party/spirv-headers/tools/check_grammar/check_grammar.py @@ -0,0 +1,185 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2025 The Khronos Group Inc. +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and/or associated documentation files (the "Materials"), +# to deal in the Materials without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Materials, and to permit persons to whom the +# Materials are furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Materials. +# +# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +# STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +# HEADER INFORMATION ARE LOCATED AT https:#www.khronos.org/registry/ +# +# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +# IN THE MATERIALS. +""" +Enforce conventions of a SPIR-V JSON grammar file +""" + +import json +import sys +from collections import OrderedDict + + +class Checker: + + def __init__(self, file_name, capabilities): + self._file_name = file_name + self._capabilities = capabilities + + def print_err(self, msg): + print(self._file_name + ": " + msg) + + def check_capabilities(self, entry, kind=None): + """ + Check the capabilities of an instruction or enum are declared. + """ + if not "capabilities" in entry: + return False + error = False + for cap in entry["capabilities"]: + if not cap in self._capabilities: + error = True + if kind is not None: + self.print_err( + "For operand kind {}, enumerant {}, non existing capability {}" + .format(kind["kind"], entry["enumerant"], cap)) + else: + self.print_err( + "Instruction {}, non existing capability {}".format( + entry["opname"], cap)) + return error + + def check_instructions(self, insn_list): + """ + Check conventions for instructions: + - Must be ordered + - No duplicated instructions + """ + seen_insn = {} + prev_ops = -1 + error = False + for insn in insn_list: + opcode = insn["opcode"] + error = self.check_capabilities(insn) or error + if opcode in seen_insn: + self.print_err( + "Duplicated opcode: instruction {} and {}".format( + insn["opname"], seen_insn[opcode]["opname"])) + error = True + continue + if insn["opname"] in seen_insn: + self.print_err( + "Duplicated instruction name {}: opcode {} and {}".format( + opcode, seen_insn[opcode]["opcode"])) + error = True + continue + seen_insn[opcode] = insn + seen_insn[insn["opname"]] = insn + if (prev_ops >= opcode): + self.print_err("Out of order instruction {}".format( + insn["opname"])) + error = True + prev_ops = opcode + return error + + # TODO: check for duplicated names + def check_operand_values(self, kind, enumerants): + """ + Check conventions for enumerants: + - Enums must be ordered + """ + seen_values = {} + error = False + prev_ops = -1 + for enum in enumerants: + v = enum["value"] + v = v if isinstance(v, int) else int(v, base=16) + error = self.check_capabilities(enum, kind) or error + if not v in seen_values: + seen_values[v] = enum + else: + self.print_err( + "For operand kind {}, duplicated enumerant {}".format( + kind["kind"], enum["enumerant"])) + error = True + if (prev_ops >= v): + self.print_err( + "For operand kind {}, out of order enumerant {}".format( + kind["kind"], enum["enumerant"])) + error = True + prev_ops = v + return error + + def check_operand_kind(self, kind_list): + """ + For each enumerant kind, ensure all enum values are valid + """ + error = False + for kind in kind_list: + if "enumerants" in kind: + error = self.check_operand_values(kind, + kind["enumerants"]) or error + return error + + def check(self, grammar): + error = False + + if "operand_kinds" in grammar: + error = self.check_operand_kind(grammar["operand_kinds"]) or error + if "instructions" in grammar: + error = self.check_instructions(grammar["instructions"]) or error + return error + + +def main(): + import argparse + parser = argparse.ArgumentParser( + description= + 'Check JSON grammars are well formed. The capabilities are aggregated from all files before performing checks.' + ) + + parser.add_argument('grammars', + metavar='', + nargs='*', + help='Path to the grammar file.') + args = parser.parse_args() + + error = False + capabilities = {} + + def load_json_and_register_capabilities(grammar_file): + with open(grammar_file) as json_fd: + grammar_json = json.loads(json_fd.read(), + object_pairs_hook=OrderedDict) + if "operand_kinds" in grammar_json: + for kind in grammar_json["operand_kinds"]: + if kind["kind"] == "Capability": + for enum in kind["enumerants"]: + capabilities[enum["enumerant"]] = kind + return grammar_json + + grammar_list = list([(grammar_file, + load_json_and_register_capabilities(grammar_file)) + for grammar_file in args.grammars]) + + for grammar_file, grammar_json in grammar_list: + checker = Checker(grammar_file, capabilities) + error = checker.check(grammar_json) or error + + return error + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/third_party/spirv-tools/.bazelversion b/third_party/spirv-tools/.bazelversion index a8907c025d..ba7f754d0c 100644 --- a/third_party/spirv-tools/.bazelversion +++ b/third_party/spirv-tools/.bazelversion @@ -1 +1 @@ -7.0.2 +7.4.0 diff --git a/third_party/spirv-tools/.github/workflows/autoroll.yml b/third_party/spirv-tools/.github/workflows/autoroll.yml index eb0b0feaa7..49fd79e1d2 100644 --- a/third_party/spirv-tools/.github/workflows/autoroll.yml +++ b/third_party/spirv-tools/.github/workflows/autoroll.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 # Checkout the depot tools they are needed by roll_deps.sh - name: Checkout depot tools diff --git a/third_party/spirv-tools/.github/workflows/bazel.yml b/third_party/spirv-tools/.github/workflows/bazel.yml index 22cfef1f56..910df0c3c1 100644 --- a/third_party/spirv-tools/.github/workflows/bazel.yml +++ b/third_party/spirv-tools/.github/workflows/bazel.yml @@ -7,9 +7,11 @@ on: branches: - 'main' pull_request: + types: [opened, synchronize, reopened, unlabeled] jobs: build: + if: github.event.action != 'unlabeled' || github.event.label.name == 'kokoro:run' timeout-minutes: 120 strategy: matrix: @@ -18,13 +20,13 @@ jobs: runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: fetch-depth: '0' - name: Download dependencies run: python3 utils/git-sync-deps - name: Mount Bazel cache - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 with: path: ~/.bazel/cache key: bazel-cache-${{ runner.os }} @@ -41,13 +43,13 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: fetch-depth: '0' - name: Download dependencies run: python3 utils/git-sync-deps - name: Mount Bazel cache - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 with: path: ~/.bazel/cache key: bazel-cache-${{ runner.os }} diff --git a/third_party/spirv-tools/.github/workflows/ios.yml b/third_party/spirv-tools/.github/workflows/ios.yml index aece8de231..2d1506cc3d 100644 --- a/third_party/spirv-tools/.github/workflows/ios.yml +++ b/third_party/spirv-tools/.github/workflows/ios.yml @@ -14,8 +14,8 @@ jobs: runs-on: macos-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.02 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: lukka/get-cmake@9e07ecdcee1b12e5037e42f410b67f03e2f626e1 # v4.02 - name: Download dependencies run: python3 utils/git-sync-deps # NOTE: The MacOS SDK ships universal binaries. CI should reflect this. diff --git a/third_party/spirv-tools/.github/workflows/release.yml b/third_party/spirv-tools/.github/workflows/release.yml index 1e0d865a8e..c8e5e940c0 100644 --- a/third_party/spirv-tools/.github/workflows/release.yml +++ b/third_party/spirv-tools/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: prepare-release-job: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Prepare CHANGELOG for version run: | python utils/generate_changelog.py CHANGES "${{ github.ref_name }}" VERSION_CHANGELOG diff --git a/third_party/spirv-tools/.github/workflows/scorecard.yml b/third_party/spirv-tools/.github/workflows/scorecard.yml index d2e0eb6b62..c8b692fb55 100644 --- a/third_party/spirv-tools/.github/workflows/scorecard.yml +++ b/third_party/spirv-tools/.github/workflows/scorecard.yml @@ -23,12 +23,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 with: results_file: results.sarif results_format: sarif @@ -40,7 +40,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: SARIF file path: results.sarif @@ -48,6 +48,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 + uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 with: sarif_file: results.sarif diff --git a/third_party/spirv-tools/.github/workflows/wasm.yml b/third_party/spirv-tools/.github/workflows/wasm.yml index cbe21435a0..40b9de893b 100644 --- a/third_party/spirv-tools/.github/workflows/wasm.yml +++ b/third_party/spirv-tools/.github/workflows/wasm.yml @@ -2,14 +2,20 @@ name: Wasm Build permissions: contents: read -on: [push, pull_request] +on: + push: + branches: + - 'main' + pull_request: + types: [opened, synchronize, reopened, unlabeled] jobs: build: + if: github.event.action != 'unlabeled' || github.event.label.name == 'kokoro:run' runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: fetch-depth: '0' - name: Build web diff --git a/third_party/spirv-tools/Android.mk b/third_party/spirv-tools/Android.mk index 95353ff224..67962f0f50 100644 --- a/third_party/spirv-tools/Android.mk +++ b/third_party/spirv-tools/Android.mk @@ -56,6 +56,7 @@ SPVTOOLS_SRC_FILES := \ source/val/validate_extensions.cpp \ source/val/validate_execution_limitations.cpp \ source/val/validate_function.cpp \ + source/val/validate_graph.cpp \ source/val/validate_id.cpp \ source/val/validate_image.cpp \ source/val/validate_interfaces.cpp \ @@ -67,6 +68,7 @@ SPVTOOLS_SRC_FILES := \ source/val/validate_mode_setting.cpp \ source/val/validate_layout.cpp \ source/val/validate_literals.cpp \ + source/val/validate_logical_pointers.cpp \ source/val/validate_logicals.cpp \ source/val/validate_non_uniform.cpp \ source/val/validate_primitives.cpp \ @@ -127,6 +129,7 @@ SPVTOOLS_OPT_SRC_FILES := \ source/opt/fold_spec_constant_op_and_composite_pass.cpp \ source/opt/freeze_spec_constant_value_pass.cpp \ source/opt/function.cpp \ + source/opt/graph.cpp \ source/opt/graphics_robust_access_pass.cpp \ source/opt/if_conversion.cpp \ source/opt/inline_pass.cpp \ diff --git a/third_party/spirv-tools/BUILD.bazel b/third_party/spirv-tools/BUILD.bazel index 979c2333af..280d2873ed 100644 --- a/third_party/spirv-tools/BUILD.bazel +++ b/third_party/spirv-tools/BUILD.bazel @@ -53,6 +53,7 @@ create_grammar_tables_target( ExtInst("opencl.debuginfo.100", prefix="CLDEBUG100_"), ExtInst("nonsemantic.shader.debuginfo.100", prefix="SHDEBUG100_"), ExtInst("tosa.001000.1", target="spirv_ext_inst_tosa_001000_1", prefix="TOSA_"), + ExtInst("arm.motion-engine.100", target="spirv_ext_inst_arm_motion_engine_100"), ] + [ExtInst(e) for e in [ "spv-amd-shader-explicit-vertex-parameter", "spv-amd-shader-trinary-minmax", @@ -202,7 +203,7 @@ cc_library( cc_library( name = "spirv_tools_link", srcs = glob(["source/link/*.cpp"]), - hdrs = ["include/spirv-tools/linker.hpp"], + hdrs = ["include/spirv-tools/linker.hpp", "source/link/fnvar.h"], copts = COMMON_COPTS, linkstatic = 1, visibility = ["//visibility:public"], diff --git a/third_party/spirv-tools/BUILD.gn b/third_party/spirv-tools/BUILD.gn index 7cf3394274..b4956c2f80 100644 --- a/third_party/spirv-tools/BUILD.gn +++ b/third_party/spirv-tools/BUILD.gn @@ -300,6 +300,7 @@ static_library("spvtools") { "source/util/parse_number.h", "source/util/small_vector.h", "source/util/span.h", + "source/util/status.h", "source/util/string_utils.cpp", "source/util/string_utils.h", "source/util/timer.cpp", @@ -348,12 +349,14 @@ static_library("spvtools_val") { "source/val/validate_execution_limitations.cpp", "source/val/validate_extensions.cpp", "source/val/validate_function.cpp", + "source/val/validate_graph.cpp", "source/val/validate_id.cpp", "source/val/validate_image.cpp", "source/val/validate_instruction.cpp", "source/val/validate_interfaces.cpp", "source/val/validate_layout.cpp", "source/val/validate_literals.cpp", + "source/val/validate_logical_pointers.cpp", "source/val/validate_logicals.cpp", "source/val/validate_memory.cpp", "source/val/validate_memory_semantics.cpp", @@ -487,6 +490,8 @@ static_library("spvtools_opt") { "source/opt/freeze_spec_constant_value_pass.h", "source/opt/function.cpp", "source/opt/function.h", + "source/opt/graph.cpp", + "source/opt/graph.h", "source/opt/graphics_robust_access_pass.cpp", "source/opt/graphics_robust_access_pass.h", "source/opt/if_conversion.cpp", @@ -656,7 +661,11 @@ static_library("spvtools_opt") { } static_library("spvtools_link") { - sources = [ "source/link/linker.cpp" ] + sources = [ + "source/link/linker.cpp", + "source/link/fnvar.cpp", + "source/link/fnvar.h" + ] deps = [ ":spvtools", ":spvtools_opt", diff --git a/third_party/spirv-tools/CHANGES b/third_party/spirv-tools/CHANGES index 9d14bf9e8c..9c4d8ccaef 100644 --- a/third_party/spirv-tools/CHANGES +++ b/third_party/spirv-tools/CHANGES @@ -1,5 +1,134 @@ Revision history for SPIRV-Tools +v2026.1 2026-02-03 + - General + - spirv-tools: Fix infinite recursion in SmallVector::operator== on MSVC (#6470) + - Add support for SPV_NV_push_constant_bank (#6507) + - Enable UseMultiToolTask for msbuild performance (#6472) + - Fix asan error in stack usage (#6434) + - Fix crash in array length validation (#6500) + - Fix infinite loop in logical pointer validation (#6450) + - Implement SPV_EXT_descriptor_heap (#6503) + - Optimizer + - Adding constant folding for NMin, NMax and NClamp (#6433) + - Also remap DebugScope instructions (#6501) + - Change ValueNumber to use spivOpcodeIsCommutativeBinaryOperator (#6431) + - Extending factoring folding rules to support subtraction (#6432) + - Extending negation folding rules (#6444) + - Folding Rules For Common Comparisons (#6437) + - Folding rules for negation and cancellation (#6452) + - Harden CFGCleanupPass against ID overflow (#6439) + - Harden CombineAccessChainsPass against ID overflow (#6440) + - Harden CopyPropagateArraysPass against ID overflow (#6441) + - Remove lingering debug-scopes. (#6416) + - add adce test for debug declare (#6462) + - fix adce when ns debug info present (#6217) (#6420) + - Validator + - Handle OpTypeVectorIdEXT in validate_interfaces.cpp (#6492) + - Validate SPV_EXT_long_vector (#6471) + - Validate floats/int Image Operands are 32-bit (#6477) + - Add Mesh Shading Read Output check (#6426) + - Add Mesh/Task to check for LocalSize (#6459) + - Add missing LOD non-zero MS (#6496) + - Add width to IsFloatScalarType (#6489) + - Better atomic storage class message (#6425) + - Better error message when types are the same (#6427) + - Check Mesh Topology builtin by entry point (#6457) + - Check for CoopMat scope (#6442) + - Combine Image Coordinate checks (#6494) + - Fix crash with bad OpUntypedArrayLengthKHR (#6493) + - Label VUID 10823 (#6488) + - Provide RuntimeDescriptorArray hint in message (#6448) + - Use new StorageClassToString util (#6460) + - Use validation_state.cpp helpers (#6478) + - Validate ImageQuerySizeLod is 32-bit (#6479) + - Validate Mesh Shader output are an array (#6449) + - add missing relational ops to InvalidTypePass (#6495) + - Diff + - diff: Match OpExtInst in debug and types/values sections (#6430) + +v2025.5 2025-11-18 + - General + - Validator + - Optimizer + - spirv-opt: Add a folding rule for `OpBitReverse` and fix `OpBitCast` to support lower to higher bit conversions. (#6321) + - spirv-opt: Add basic support for graphs (#6351) + - spirv-opt: Adding folding rules for bitwise and (#6361) + - spirv-opt: Adding normal form to ValueNumber calculation (#6371) + - spirv-opt: Cache IsReadOnlyLoad in ValueNumberTable (#6385) + - spirv-opt: Clone decorations when unrolling loops (#6373) + - spirv-opt: Correct ADCE bug keeping dead DebugValue Value operands (#6368) + - spirv-opt: Fix constant folding for `OpBitcast` on signed integers. (#6378) + - spirv-opt: Fix id overflow in ConvertToSampledImage (#6339) + - spirv-opt: Handle ID overflow in AggressiveDCEPass (#6366) + - spirv-opt: Handle ID overflow in SplitCombinedImageSamplerPass (#6406) + - spirv-opt: Handle id overflow in CCP and constant folding (#6367) + - spirv-opt: Handle id overflow in MergeReturnPass (#6340) + - spirv-opt: Handle id overflow in amd_ext_to_khr (#6403) + - Add `SPV_KHR_maximal_reconvergence` to the allowlist (#6372) + - Adding folding rules for commutive bitwise operations (xor/or/and). (#6358) + - [OPT] Move definition of Pass::Status to Utils (#6402) + - Validator: + - spirv-val: Add LocalInvocationIndex checks (#6395) + - spirv-val: Add validation for SPV_KHR_fma (#6388) + - spirv-val: Break up the 3000 line ValidateExtInst function (#6364) + - spirv-val: Fix VUID churn for 10685 (#6389) + - spirv-val: Improve Explicit Layout message (#6331) + - spirv-val: Use spvOpcodeString consistently (#6393) + - Relax validation rule for DebugGlobalVariable variable (#6382) + - Validate SPV_EXT_shader_64bit_indexing (#6376) + - Validate logical pointer restrictions (#6240) + - [tools/val] fix u8str for real this time (#6341) + - Add VK_EXT_shader_uniform_buffer_unsized_array (#6386) + - Assembler + - Add as/dis support for Arm.MotionEngine.100 extended instruction set (#6284) + - spirv-as: fix command line for stdin as input (#6398) + +v2025.4 2025-09-22 + - General + - Add support for SPV_INTEL_function_variants (#6211, #6195) + - Add support for SPV_ARM_graph (#6177) + - Add support for SPV_INTEL_inline_assembly (#6210) + - Add support for SPV_QCOM_cooperative_matrix_conversion (#6252) + - Add BFloat16 encoding support (#6222) + - Allow mimalloc in static builds (#6267) + - Allow processing of directories in spirv-val (#6292) + - Optimizer + - Handle ID overflow in many passes (#6310, #6325, #6302, #6309, #6306, #6305, #6304, #6299, #6301, #6312) + - Add support for OpTypeGraphARM and tensors to type manager (#6247, #6202) + - Add Geometry capability to the trim pass (#6278) + - Support CCP for 16bit integer min and max operations. (#6280, #6287) + - Fix ADCE DebugDeclare DebugValue treatment (#6179) + - Fix lerp and fmix folding with half types (#6293, #6297) + - Fix trimming pass with OpNop (#6314) + - Support OpSpecConstantCompositeReplicateEXT in FoldSpecConstantOpAndCompositePass (#6315) + - Fix OpUndef placement in ADCE (#6154) + - Add null checks for MakeSClampInst and GetValueForType (#6324) + - Fix crash if shader uses linkage decoration (#6191) + - Validator + - Update memory semantics rules to match the specification (#6096) + - Validate PhysicalStorageBuffer alignment (#6266) + - Validate DescriptorSet and Binding decorations for all relevant variables (#6242) + - Validate that OpDecorateId IDs are well-ordered (#6227) + - Add validation for SPV_QCOM_image_processing (#6268) + - Add validation for Patch Decoration (#6219) + - Add validation for PrimitiveID (#6209) + - Add Workgroup Size check for Compute Derivatives (#6294) + - Allow compare-exchange semantics equal=Release and unequal=Acquire (#6286) + - Accept graphs with no inputs and/or no body (#6291) + - Fix GetLargestScalarType with untyped PSB (#6327) + - Fix Mesh Builtin checking for signed int and multi-entrypoint shaders (#6238, #6313) + - Fix OpTensor{Read,Write}ARM for tensors with a spec constant rank (#6206) + - Accept NonReadable/NonWritable on tensor variables in UniformConstant (#6184) + - Fix location of DebugFunctionDefinition instruction (#6198) + - Print SPIR-V version info in error message (#6283) + - Assembler + - Fix docs: need '-' arg to specify stdin (#6194) + - Disassembler + - Fix missing color on result ID (#6272) + - Diff + - Add spirv-diff to list of install targets (#6258) + v2025.3 2025-06-23 - General - Add mimalloc to improve multithreaded performance (#6188) diff --git a/third_party/spirv-tools/CMakeLists.txt b/third_party/spirv-tools/CMakeLists.txt index affc49ed8e..fa07e3bc9a 100644 --- a/third_party/spirv-tools/CMakeLists.txt +++ b/third_party/spirv-tools/CMakeLists.txt @@ -119,13 +119,19 @@ if(${COMPILER_IS_LIKE_GNU}) set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Werror) endif() elseif(MSVC) - set(SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /wd4800 /wd4819) + set(SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /wd4800 /wd4819 /wd4251 /W2 /WX) if(${SPIRV_WERROR}) set(SPIRV_WARNINGS ${SPIRV_WARNINGS} /WX) endif() endif() +if (PROJECT_IS_TOP_LEVEL) + # enable parallel builds for msbuild + list(APPEND CMAKE_VS_GLOBALS UseMultiToolTask=true) + list(APPEND CMAKE_VS_GLOBALS EnforceProcessCountAcrossBuilds=true) +endif() + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) option(SPIRV_COLOR_TERMINAL "Enable color terminal output" ON) diff --git a/third_party/spirv-tools/CMakeLists.txt.bak b/third_party/spirv-tools/CMakeLists.txt.bak new file mode 100644 index 0000000000..b69ec9fb54 --- /dev/null +++ b/third_party/spirv-tools/CMakeLists.txt.bak @@ -0,0 +1,421 @@ +# Copyright (c) 2015-2023 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.22.1) + +project(spirv-tools) + +# Avoid a bug in CMake 3.22.1. By default it will set -std=c++11 for +# targets in test/*, when those tests need -std=c++17. +# https://github.com/KhronosGroup/SPIRV-Tools/issues/5340 +# The bug is fixed in CMake 3.22.2 +if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.22.1") + if (${CMAKE_VERSION} VERSION_LESS "3.22.2") + cmake_policy(SET CMP0128 NEW) + endif() +endif() + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +enable_testing() +set(SPIRV_TOOLS "SPIRV-Tools") + +include(GNUInstallDirs) + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# Require at least C++17 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) +endif() +if(${CMAKE_CXX_STANDARD} LESS 17) + message(FATAL_ERROR "SPIRV-Tools requires C++17 or later, but is configured for C++${CMAKE_CXX_STANDARD})") +endif() +set(CMAKE_CXX_EXTENSIONS OFF) + + +option(ENABLE_RTTI "Enables RTTI" OFF) +option(SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms" ON) + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS}) +elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Windows") + add_definitions(-DSPIRV_WINDOWS) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") + add_definitions(-DSPIRV_WINDOWS) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Android") + set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS}) +endif() + +if (${SPIRV_TIMER_ENABLED}) + add_definitions(-DSPIRV_TIMER_ENABLED) +endif() + +if ("${CMAKE_BUILD_TYPE}" STREQUAL "") + message(STATUS "No build type selected, default to Debug") + set(CMAKE_BUILD_TYPE "Debug") +endif() + +option(SKIP_SPIRV_TOOLS_INSTALL "Skip installation" ${SKIP_SPIRV_TOOLS_INSTALL}) +if(NOT ${SKIP_SPIRV_TOOLS_INSTALL}) + set(ENABLE_SPIRV_TOOLS_INSTALL ON) +endif() + +option(SPIRV_BUILD_COMPRESSION "Build SPIR-V compressing codec" OFF) +if(SPIRV_BUILD_COMPRESSION) + message(FATAL_ERROR "SPIR-V compression codec has been removed from SPIR-V tools. " + "Please remove SPIRV_BUILD_COMPRESSION from your build options.") +endif(SPIRV_BUILD_COMPRESSION) + +option(SPIRV_BUILD_FUZZER "Build spirv-fuzz" OFF) + +set(SPIRV_LIB_FUZZING_ENGINE_LINK_OPTIONS "" CACHE STRING "Used by OSS-Fuzz to control, via link options, which fuzzing engine should be used") + +option(SPIRV_BUILD_LIBFUZZER_TARGETS "Build libFuzzer targets" OFF) + +option(SPIRV_WERROR "Enable error on warning" ON) +if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") AND (NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))) + set(COMPILER_IS_LIKE_GNU TRUE) +endif() +if(${COMPILER_IS_LIKE_GNU}) + set(SPIRV_WARNINGS -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers) + + if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Wno-self-assign) + endif() + + option(SPIRV_WARN_EVERYTHING "Enable -Weverything" ${SPIRV_WARN_EVERYTHING}) + if(${SPIRV_WARN_EVERYTHING}) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} + -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded) + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Wpedantic -pedantic-errors) + else() + message(STATUS "Unknown compiler ${CMAKE_CXX_COMPILER_ID}, " + "so SPIRV_WARN_EVERYTHING has no effect") + endif() + endif() + + if(${SPIRV_WERROR}) + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Werror) + endif() +elseif(MSVC) + set(SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /wd4800 /wd4819 /wd4251 /W2 /WX) + + if(${SPIRV_WERROR}) + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} /WX) + endif() +endif() + +if (PROJECT_IS_TOP_LEVEL) + # enable parallel builds for msbuild + list(APPEND CMAKE_VS_GLOBALS UseMultiToolTask=true) + list(APPEND CMAKE_VS_GLOBALS EnforceProcessCountAcrossBuilds=true) +endif() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) + +option(SPIRV_COLOR_TERMINAL "Enable color terminal output" ON) +if(${SPIRV_COLOR_TERMINAL}) + add_definitions(-DSPIRV_COLOR_TERMINAL) +endif() + +option(SPIRV_LOG_DEBUG "Enable excessive debug output" OFF) +if(${SPIRV_LOG_DEBUG}) + add_definitions(-DSPIRV_LOG_DEBUG) +endif() + +if (DEFINED SPIRV_TOOLS_EXTRA_DEFINITIONS) + add_definitions(${SPIRV_TOOLS_EXTRA_DEFINITIONS}) +endif() + +# Library build setting definitions: +# +# * SPIRV_TOOLS_BUILD_STATIC - ON or OFF - Defaults to ON. +# If enabled the following targets will be created: +# ${SPIRV_TOOLS}-static - STATIC library. +# Has full public symbol visibility. +# ${SPIRV_TOOLS}-shared - SHARED library. +# Has default-hidden symbol visibility. +# ${SPIRV_TOOLS} - will alias to one of above, based on BUILD_SHARED_LIBS. +# If disabled the following targets will be created: +# ${SPIRV_TOOLS} - either STATIC or SHARED based on SPIRV_TOOLS_LIBRARY_TYPE. +# Has full public symbol visibility. +# ${SPIRV_TOOLS}-shared - SHARED library. +# Has default-hidden symbol visibility. +# +# * SPIRV_TOOLS_LIBRARY_TYPE - SHARED or STATIC. +# Specifies the library type used for building SPIRV-Tools libraries. +# Defaults to SHARED when BUILD_SHARED_LIBS=1, otherwise STATIC. +# +# * SPIRV_TOOLS_FULL_VISIBILITY - "${SPIRV_TOOLS}-static" or "${SPIRV_TOOLS}" +# Evaluates to the SPIRV_TOOLS target library name that has no hidden symbols. +# This is used by internal targets for accessing symbols that are non-public. +# Note this target provides no API stability guarantees. +# +# Ideally, all of these will go away - see https://github.com/KhronosGroup/SPIRV-Tools/issues/3909. +option(ENABLE_EXCEPTIONS_ON_MSVC "Build SPIRV-TOOLS with c++ exceptions enabled in MSVC" ON) +option(SPIRV_TOOLS_BUILD_STATIC "Build ${SPIRV_TOOLS}-static target. ${SPIRV_TOOLS} will alias to ${SPIRV_TOOLS}-static or ${SPIRV_TOOLS}-shared based on BUILD_SHARED_LIBS" ON) +if(SPIRV_TOOLS_BUILD_STATIC) + set(SPIRV_TOOLS_FULL_VISIBILITY ${SPIRV_TOOLS}-static) + set(SPIRV_TOOLS_LIBRARY_TYPE "STATIC") +else(SPIRV_TOOLS_BUILD_STATIC) + set(SPIRV_TOOLS_FULL_VISIBILITY ${SPIRV_TOOLS}) + if (NOT DEFINED SPIRV_TOOLS_LIBRARY_TYPE) + if(BUILD_SHARED_LIBS) + set(SPIRV_TOOLS_LIBRARY_TYPE "SHARED") + else() + set(SPIRV_TOOLS_LIBRARY_TYPE "STATIC") + endif() + endif() +endif(SPIRV_TOOLS_BUILD_STATIC) + +function(spvtools_default_compile_options TARGET) + target_compile_options(${TARGET} PRIVATE ${SPIRV_WARNINGS}) + + if (${COMPILER_IS_LIKE_GNU}) + target_compile_options(${TARGET} PRIVATE + -Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion + -Wno-sign-conversion -fno-exceptions) + + if(NOT ENABLE_RTTI) + add_compile_options(-fno-rtti) + endif() + # For good call stacks in profiles, keep the frame pointers. + if(NOT "${SPIRV_PERF}" STREQUAL "") + target_compile_options(${TARGET} PRIVATE -fno-omit-frame-pointer) + endif() + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") + set(SPIRV_USE_SANITIZER "" CACHE STRING + "Use the clang sanitizer [address|memory|thread|...]") + if(NOT "${SPIRV_USE_SANITIZER}" STREQUAL "") + target_compile_options(${TARGET} PRIVATE + -fsanitize=${SPIRV_USE_SANITIZER}) + set_target_properties(${TARGET} PROPERTIES + LINK_FLAGS -fsanitize=${SPIRV_USE_SANITIZER}) + endif() + target_compile_options(${TARGET} PRIVATE + -ftemplate-depth=1024) + else() + target_compile_options(${TARGET} PRIVATE + -Wno-missing-field-initializers) + endif() + endif() + + if (MSVC) + # Specify /EHs for exception handling. This makes using SPIRV-Tools as + # dependencies in other projects easier. + if(ENABLE_EXCEPTIONS_ON_MSVC) + target_compile_options(${TARGET} PRIVATE /EHs) + endif() + endif() + + # For MinGW cross compile, statically link to the C++ runtime. + # But it still depends on MSVCRT.dll. + if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + if (NOT MSVC) + set_target_properties(${TARGET} PROPERTIES + LINK_FLAGS -static -static-libgcc -static-libstdc++) + endif() + endif() +endfunction() + +if(NOT COMMAND find_host_package) + macro(find_host_package) + find_package(${ARGN}) + endmacro() +endif() +if(NOT COMMAND find_host_program) + macro(find_host_program) + find_program(${ARGN}) + endmacro() +endif() + +# Tests require Python3 +find_host_package(Python3 REQUIRED) + +# Check type annotations in Perl code. Assumes mypy. +add_custom_target(spirv-tools-check-python-types + COMMAND mypy Table + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/utils +) +set_target_properties(spirv-tools-check-python-types + PROPERTIES EXCLUDE_FROM_ALL ON) + +# Run Python unit tests +add_custom_target(spirv-tools-check-python-tests + COMMAND Python3::Interpreter -m unittest discover -v -p "*test.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/utils +) + +# Check for symbol exports on Linux. +# At the moment, this check will fail on the OSX build machines for the Android NDK. +# It appears they don't have objdump. +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + macro(spvtools_check_symbol_exports TARGET) + if (NOT "${SPIRV_SKIP_TESTS}") + add_test(NAME spirv-tools-symbol-exports-${TARGET} + COMMAND Python3::Interpreter + ${spirv-tools_SOURCE_DIR}/utils/check_symbol_exports.py "$") + endif() + endmacro() +else() + macro(spvtools_check_symbol_exports TARGET) + if (NOT "${SPIRV_SKIP_TESTS}") + message("Skipping symbol exports test for ${TARGET}") + endif() + endmacro() +endif() + +if(ENABLE_SPIRV_TOOLS_INSTALL) + if(WIN32 AND NOT MINGW) + macro(spvtools_config_package_dir TARGET PATH) + set(${PATH} ${TARGET}/cmake) + endmacro() + else() + macro(spvtools_config_package_dir TARGET PATH) + set(${PATH} ${CMAKE_INSTALL_LIBDIR}/cmake/${TARGET}) + endmacro() + endif() + + macro(spvtools_generate_config_file TARGET) + file(WRITE ${CMAKE_BINARY_DIR}/${TARGET}Config.cmake + "include(CMakeFindDependencyMacro)\n" + "find_dependency(${SPIRV_TOOLS})\n" + "include(\${CMAKE_CURRENT_LIST_DIR}/${TARGET}Targets.cmake)\n" + "set(${TARGET}_LIBRARIES ${TARGET})\n" + "get_target_property(${TARGET}_INCLUDE_DIRS ${TARGET} INTERFACE_INCLUDE_DIRECTORIES)\n") + endmacro() +endif() + +# Currently iOS and Android are very similar. +# They both have their own packaging (APP/APK). +# Which makes regular executables/testing problematic. +# +# Currently the only deliverables for these platforms are +# libraries (either STATIC or SHARED). +# +# Furthermore testing is equally problematic. +if (IOS OR ANDROID) + set(SPIRV_SKIP_EXECUTABLES ON) +endif() + +option(SPIRV_SKIP_EXECUTABLES "Skip building the executable and tests along with the library") +if (SPIRV_SKIP_EXECUTABLES) + set(SPIRV_SKIP_TESTS ON) +endif() +option(SPIRV_SKIP_TESTS "Skip building tests along with the library") + +# Defaults to ON. The checks can be time consuming. +# Turn off if they take too long. +option(SPIRV_CHECK_CONTEXT "In a debug build, check if the IR context is in a valid state." ON) +if (${SPIRV_CHECK_CONTEXT}) + add_compile_options($<$:-DSPIRV_CHECK_CONTEXT>) +endif() + +# Precompiled header macro. Parameters are source file list and filename for pch cpp file. +macro(spvtools_pch SRCS PCHPREFIX) + if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(PCH_NAME "$(IntDir)\\${PCHPREFIX}.pch") + # make source files use/depend on PCH_NAME + set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yu${PCHPREFIX}.h /FI${PCHPREFIX}.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}") + # make PCHPREFIX.cpp file compile and generate PCH_NAME + set_source_files_properties("${PCHPREFIX}.cpp" PROPERTIES COMPILE_FLAGS "/Yc${PCHPREFIX}.h /Fp${PCH_NAME} /Zm300" OBJECT_OUTPUTS "${PCH_NAME}") + list(APPEND ${SRCS} "${PCHPREFIX}.cpp") + endif() +endmacro(spvtools_pch) + +add_subdirectory(external) + +# Warning about extra semi-colons. +# +# This is not supported on all compilers/versions. so enabling only +# for clang, since that works for all versions that our bots run. +# +# This is intentionally done after adding the external subdirectory, +# so we don't enforce this flag on our dependencies, some of which do +# not pass it. +# +# If the minimum version of CMake supported is updated to 3.0 or +# later, then check_cxx_compiler_flag could be used instead. +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + add_compile_options("-Wextra-semi") +endif() + +add_subdirectory(source) +add_subdirectory(tools) + +add_subdirectory(test) +add_subdirectory(examples) + +if(ENABLE_SPIRV_TOOLS_INSTALL) + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/optimizer.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/linker.hpp + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/spirv-tools/) +endif(ENABLE_SPIRV_TOOLS_INSTALL) + +if (NOT "${SPIRV_SKIP_TESTS}") + add_test(NAME spirv-tools-copyrights + COMMAND Python3::Interpreter utils/check_copyright.py + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endif() + +set(SPIRV_LIBRARIES "-lSPIRV-Tools-opt -lSPIRV-Tools -lSPIRV-Tools-link") +set(SPIRV_SHARED_LIBRARIES "-lSPIRV-Tools-shared") + +# Build pkg-config file +# Use a first-class target so it's regenerated when relevant files are updated. +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc + COMMAND ${CMAKE_COMMAND} + -DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES + -DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools.pc.in + -DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} + -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} + -DSPIRV_LIBRARIES=${SPIRV_LIBRARIES} + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake + DEPENDS "CHANGES" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools.pc.in" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake") +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc + COMMAND ${CMAKE_COMMAND} + -DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES + -DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools-shared.pc.in + -DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} + -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} + -DSPIRV_SHARED_LIBRARIES=${SPIRV_SHARED_LIBRARIES} + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake + DEPENDS "CHANGES" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools-shared.pc.in" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake") +add_custom_target(spirv-tools-pkg-config + ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc) + +# Install pkg-config file +if (ENABLE_SPIRV_TOOLS_INSTALL) + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc + ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc + DESTINATION + ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +endif() diff --git a/third_party/spirv-tools/DEPS b/third_party/spirv-tools/DEPS index 7adadc959e..4bd4a8b849 100644 --- a/third_party/spirv-tools/DEPS +++ b/third_party/spirv-tools/DEPS @@ -3,20 +3,20 @@ use_relative_paths = True vars = { 'github': 'https://github.com', - 'abseil_revision': '6cd1763d9fea309e83fe8bc20f997208d57cd476', + 'abseil_revision': '889ddc99e10c02c7110223e6d0dc41d83f0c0b60', - 'effcee_revision': '8ce15c424e61a94ee27b5be0ec0ed036b158e6e3', + 'effcee_revision': '514b52ec61609744d7e587d93a7ef9b60407ab45', - 'googletest_revision': '3983f67e32fb3e9294487b9d4f9586efa6e5d088', + 'googletest_revision': '85087857ad10bd407cd6ed2f52f7ea9752db621f', # Use protobufs before they gained the dependency on abseil 'protobuf_revision': 'v21.12', - 're2_revision': '8ea5841693c6c0b837c6ed2189217e8f8d6fee9c', + 're2_revision': 'e7aec5985072c1dbe735add802653ef4b36c231a', - 'spirv_headers_revision': 'c8ad050fcb29e42a2f57d9f59e97488f465c436d', + 'spirv_headers_revision': '04f10f650d514df88b76d25e83db360142c7b174', - 'mimalloc_revision': '09a27098aa6e9286518bd9c74e6ffa7199c3f04e', + 'mimalloc_revision': 'b69f9cb39f22b95971a4b9196a9c265a7b474718', } deps = { diff --git a/third_party/spirv-tools/MODULE.bazel b/third_party/spirv-tools/MODULE.bazel index 979541e542..1641063219 100644 --- a/third_party/spirv-tools/MODULE.bazel +++ b/third_party/spirv-tools/MODULE.bazel @@ -19,7 +19,7 @@ local_path_override( ) bazel_dep(name = "rules_python", - version = "0.34.0") + version = "1.5.1") # https://rules-python.readthedocs.io/en/stable/toolchains.html#library-modules-with-dev-only-python-usage python = use_extension( diff --git a/third_party/spirv-tools/README.md b/third_party/spirv-tools/README.md index 248191bcdc..699e32f0b1 100644 --- a/third_party/spirv-tools/README.md +++ b/third_party/spirv-tools/README.md @@ -317,9 +317,7 @@ Effcee itself depends on [RE2][re2], and RE2 depends on [Abseil][abseil-cpp]. #### Dependency on mimalloc SPIRV-Tools may be configured to use the [mimalloc][mimalloc] library to improve memory -allocation performance. In order to avoid unexpectedly changing allocation behavior of -applications that link SPIRV-Tools libraries statically, this option has no effect on -the static libraries. +allocation performance. In the CMake build, usage of mimalloc is controlled by the `SPIRV_TOOLS_USE_MIMALLOC` option. This variable defaults on `ON` when building for Windows and `OFF` when building @@ -328,6 +326,11 @@ expected to work normally, but this has not been tested as thoroughly and extens the Windows version. In the future, the `SPIRV_TOOLS_USE_MIMALLOC` option may default to `ON` for non-Windows platforms as well. +In order to avoid unexpectedly changing allocation behavior of applications that link +SPIRV-Tools libraries statically, mimalloc is disabled by default on static libraries. +The option 'SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD' can be used to force the usage of +mimalloc on static libraries. + *Note*: mimalloc is currently only supported when building with CMake. When using Bazel, mimalloc is not used. @@ -452,7 +455,7 @@ targets, you need to install CMake Version 2.8.12 or later. - [Python 3](http://www.python.org/): for utility scripts and running the test suite. - [Bazel](https://bazel.build/) (optional): if building the source with Bazel, -you need to install Bazel Version 7.0.2 on your machine. Other versions may +you need to install Bazel Version 7.4.0 on your machine. Other versions may also work, but are not verified. - [Emscripten SDK](https://emscripten.org) (optional): if building the WebAssembly module. @@ -467,7 +470,6 @@ On MacOS - AppleClang 15.0 On Windows -- Visual Studio 2019 - Visual Studio 2022 Note: Other compilers or later versions may work, but they are not tested. diff --git a/third_party/spirv-tools/build_defs.bzl b/third_party/spirv-tools/build_defs.bzl index 1f7cacded7..c18768fe89 100644 --- a/third_party/spirv-tools/build_defs.bzl +++ b/third_party/spirv-tools/build_defs.bzl @@ -38,6 +38,8 @@ TEST_COPTS = COMMON_COPTS + [ "-Wno-self-assign", "-Wno-shadow", "-Wno-unused-parameter", + # Work around looseness in protobuf parse table generated code + "-Wno-implicit-int-conversion", ], }) @@ -58,8 +60,7 @@ def _merge_dicts(dicts): merged.update(d) return merged - -def ExtInst(name, target = "", prefix =""): +def ExtInst(name, target = "", prefix = ""): """ Returns a dictionary specifying the info needed to process an extended instruction set. @@ -74,22 +75,20 @@ def ExtInst(name, target = "", prefix =""): Returns a dictionary with keys 'name', 'target', 'prefix' and the corresponding values. """ - return {'name':name, 'target':target, 'prefix':prefix} - + return {"name": name, "target": target, "prefix": prefix} def _extinst_grammar_target(e): """ Args: e, as returned from extinst Returns the SPIRV-Headers target for the given extended instruction set spec. """ - target = e['target'] - name = e['name'] + target = e["target"] + name = e["name"] if len(target) > 0: return "@spirv_headers//:{}".format(target) name_part = name.replace("-", "_").replace(".", "_") return "@spirv_headers//:spirv_ext_inst_{}_grammar_unified1".format(name_part) - def create_grammar_tables_target(name, extinsts): """ Creates a ":gen_compressed_tables" target for SPIR-V instruction @@ -109,7 +108,7 @@ def create_grammar_tables_target(name, extinsts): ) extinst_args = [] for e in extinsts: - extinst_args.append('--extinst={},$(location {})'.format(e['prefix'],_extinst_grammar_target(e))) + extinst_args.append("--extinst={},$(location {})".format(e["prefix"], _extinst_grammar_target(e))) cmd = ( "$(location :ggt)" + diff --git a/third_party/spirv-tools/external/CMakeLists.txt b/third_party/spirv-tools/external/CMakeLists.txt index d8c7266500..eb4e69e58c 100644 --- a/third_party/spirv-tools/external/CMakeLists.txt +++ b/third_party/spirv-tools/external/CMakeLists.txt @@ -38,17 +38,23 @@ endif() # Used on Windows by default, but allow opt-in on other platforms if (WIN32) set(SPIRV_TOOLS_USE_MIMALLOC_DEFAULT_VALUE ON) + set(SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD_DEFAULT_VALUE OFF) else() set(SPIRV_TOOLS_USE_MIMALLOC_DEFAULT_VALUE OFF) + set(SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD_DEFAULT_VALUE OFF) endif() # To avoid unexpected side effects on users of the static library, mimalloc -# may only be used when building executables and shared libraries. +# must be explicitly enabled when building static libraries. include(CMakeDependentOption) cmake_dependent_option(SPIRV_TOOLS_USE_MIMALLOC "Executables and shared libraries use mimalloc instead of the default allocator" ${SPIRV_TOOLS_USE_MIMALLOC_DEFAULT_VALUE} "MIMALLOC_DIR" OFF) +cmake_dependent_option(SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD + "Static libraries use mimalloc instead of the default allocator" + ${SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD_DEFAULT_VALUE} SPIRV_TOOLS_USE_MIMALLOC OFF) + if (SPIRV_TOOLS_USE_MIMALLOC) if (NOT WIN32) push_variable(MI_OVERRIDE 0) diff --git a/third_party/spirv-tools/include/spirv-tools/libspirv.h b/third_party/spirv-tools/include/spirv-tools/libspirv.h index 2a604e94d9..9ee86ea7b9 100644 --- a/third_party/spirv-tools/include/spirv-tools/libspirv.h +++ b/third_party/spirv-tools/include/spirv-tools/libspirv.h @@ -80,6 +80,8 @@ typedef enum spv_result_t { SPV_ERROR_INVALID_DATA = -14, // Indicates data rules validation failure. SPV_ERROR_MISSING_EXTENSION = -15, SPV_ERROR_WRONG_VERSION = -16, // Indicates wrong SPIR-V version + SPV_ERROR_FNVAR = + -17, // Error related to SPV_INTEL_function_variants extension SPV_FORCE_32_BIT_ENUM(spv_result_t) } spv_result_t; @@ -362,6 +364,7 @@ typedef enum spv_ext_inst_type_t { SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100, SPV_EXT_INST_TYPE_NONSEMANTIC_VKSPREFLECTION, SPV_EXT_INST_TYPE_TOSA_001000_1, + SPV_EXT_INST_TYPE_ARM_MOTION_ENGINE_100, // Multiple distinct extended instruction set types could return this // value, if they are prefixed with NonSemantic. and are otherwise @@ -430,7 +433,7 @@ typedef enum spv_binary_to_text_options_t { // The default id bound is to the minimum value for the id limit // in the spir-v specification under the section "Universal Limits". -const uint32_t kDefaultMaxIdBound = 0x3FFFFF; +const static uint32_t kDefaultMaxIdBound = 0x3FFFFF; // Structures diff --git a/third_party/spirv-tools/include/spirv-tools/linker.hpp b/third_party/spirv-tools/include/spirv-tools/linker.hpp index 9037b94889..99527ed6d6 100644 --- a/third_party/spirv-tools/include/spirv-tools/linker.hpp +++ b/third_party/spirv-tools/include/spirv-tools/linker.hpp @@ -67,12 +67,36 @@ class SPIRV_TOOLS_EXPORT LinkerOptions { allow_ptr_type_mismatch_ = allow_ptr_type_mismatch; } + std::string GetFnVarTargetsCsv() const { return fnvar_targets_csv_; } + void SetFnVarTargetsCsv(std::string fnvar_targets_csv) { + fnvar_targets_csv_ = fnvar_targets_csv; + } + + std::string GetFnVarArchitecturesCsv() const { + return fnvar_architectures_csv_; + } + void SetFnVarArchitecturesCsv(std::string fnvar_architectures_csv) { + fnvar_architectures_csv_ = fnvar_architectures_csv; + } + + bool GetHasFnVarCapabilities() const { return has_fnvar_capabilities_; } + void SetHasFnVarCapabilities(bool fnvar_capabilities) { + has_fnvar_capabilities_ = fnvar_capabilities; + } + + std::vector GetInFiles() const { return in_files_; } + void SetInFiles(std::vector in_files) { in_files_ = in_files; } + private: bool create_library_{false}; bool verify_ids_{false}; bool allow_partial_linkage_{false}; bool use_highest_version_{false}; bool allow_ptr_type_mismatch_{false}; + std::string fnvar_targets_csv_{""}; + std::string fnvar_architectures_csv_{""}; + bool has_fnvar_capabilities_ = false; + std::vector in_files_{{}}; }; // Links one or more SPIR-V modules into a new SPIR-V module. That is, combine diff --git a/third_party/spirv-tools/kokoro/macos-clang-release-bazel/build.sh b/third_party/spirv-tools/kokoro/macos-clang-release-bazel/build.sh index 4bb889ad09..862b5af913 100644 --- a/third_party/spirv-tools/kokoro/macos-clang-release-bazel/build.sh +++ b/third_party/spirv-tools/kokoro/macos-clang-release-bazel/build.sh @@ -32,14 +32,14 @@ git config --global --add safe.directory $SRC cd $SRC /usr/bin/python3 utils/git-sync-deps --treeless -# Get bazel 7.0.2 -gsutil cp gs://bazel/7.0.2/release/bazel-7.0.2-darwin-x86_64 . -chmod +x bazel-7.0.2-darwin-x86_64 +# Get bazel 7.4.0 +gsutil cp gs://bazel/7.4.0/release/bazel-7.4.0-darwin-x86_64 . +chmod +x bazel-7.4.0-darwin-x86_64 echo $(date): Build everything... -./bazel-7.0.2-darwin-x86_64 build --cxxopt=-std=c++17 :all +./bazel-7.4.0-darwin-x86_64 build --cxxopt=-std=c++17 :all echo $(date): Build completed. echo $(date): Starting bazel test... -./bazel-7.0.2-darwin-x86_64 test --cxxopt=-std=c++17 :all +./bazel-7.4.0-darwin-x86_64 test --cxxopt=-std=c++17 :all echo $(date): Bazel test completed. diff --git a/third_party/spirv-tools/kokoro/scripts/linux/build-docker.sh b/third_party/spirv-tools/kokoro/scripts/linux/build-docker.sh index b81c8de3de..5988cf24f4 100755 --- a/third_party/spirv-tools/kokoro/scripts/linux/build-docker.sh +++ b/third_party/spirv-tools/kokoro/scripts/linux/build-docker.sh @@ -230,7 +230,7 @@ elif [ $TOOL = "android-ndk-build" ]; then echo $(date): ndk-build completed. elif [ $TOOL = "bazel" ]; then - using bazel-7.0.2 + using bazel-7.4.0 echo $(date): Build everything... bazel build --cxxopt=-std=c++17 :all diff --git a/third_party/spirv-tools/kokoro/scripts/windows/build.bat b/third_party/spirv-tools/kokoro/scripts/windows/build.bat index 6e6c1577e4..fbd5f9713c 100644 --- a/third_party/spirv-tools/kokoro/scripts/windows/build.bat +++ b/third_party/spirv-tools/kokoro/scripts/windows/build.bat @@ -27,10 +27,7 @@ set PATH=C:\python312;c:\cmake-3.31.2\bin;%PATH% :: ######################################### :: set up msvc build env :: ######################################### -if %VS_VERSION% == 2019 ( - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 - echo "Using VS 2019..." -) else if %VS_VERSION% == 2022 ( +if %VS_VERSION% == 2022 ( call "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64 echo "Using VS 2022..." ) diff --git a/third_party/spirv-tools/kokoro/windows-msvc-2019-release/build.bat b/third_party/spirv-tools/kokoro/windows-msvc-2019-release/build.bat deleted file mode 100644 index 8212924549..0000000000 --- a/third_party/spirv-tools/kokoro/windows-msvc-2019-release/build.bat +++ /dev/null @@ -1,24 +0,0 @@ -:: Copyright (c) 2023 Google LLC -:: -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -:: -:: Windows Build Script. - -@echo on - -:: Find out the directory of the common build script. -set SCRIPT_DIR=%~dp0 - -:: Call with correct parameter -call %SCRIPT_DIR%\..\scripts\windows\build.bat RelWithDebInfo 2019 - diff --git a/third_party/spirv-tools/kokoro/windows-msvc-2019-release/continuous.cfg b/third_party/spirv-tools/kokoro/windows-msvc-2019-release/continuous.cfg deleted file mode 100644 index 624ccbde6e..0000000000 --- a/third_party/spirv-tools/kokoro/windows-msvc-2019-release/continuous.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2023 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Continuous build configuration. -build_file: "SPIRV-Tools/kokoro/windows-msvc-2019-release/build.bat" - -action { - define_artifacts { - regex: "install.zip" - } -} diff --git a/third_party/spirv-tools/kokoro/windows-msvc-2019-release/presubmit.cfg b/third_party/spirv-tools/kokoro/windows-msvc-2019-release/presubmit.cfg deleted file mode 100644 index 4c578e0069..0000000000 --- a/third_party/spirv-tools/kokoro/windows-msvc-2019-release/presubmit.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2023 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Presubmit build configuration. -build_file: "SPIRV-Tools/kokoro/windows-msvc-2019-release/build.bat" diff --git a/third_party/spirv-tools/kokoro/windows-msvc-2022-debug/build.bat b/third_party/spirv-tools/kokoro/windows-msvc-2022-debug/build.bat index 7ad94c19f5..cac551c3cd 100644 --- a/third_party/spirv-tools/kokoro/windows-msvc-2022-debug/build.bat +++ b/third_party/spirv-tools/kokoro/windows-msvc-2022-debug/build.bat @@ -20,4 +20,4 @@ set SCRIPT_DIR=%~dp0 :: Call with correct parameter -call %SCRIPT_DIR%\..\scripts\windows\build.bat Debug 2019 +call %SCRIPT_DIR%\..\scripts\windows\build.bat Debug 2022 diff --git a/third_party/spirv-tools/source/CMakeLists.txt b/third_party/spirv-tools/source/CMakeLists.txt index 20635ab598..bc9cb0558c 100644 --- a/third_party/spirv-tools/source/CMakeLists.txt +++ b/third_party/spirv-tools/source/CMakeLists.txt @@ -32,6 +32,7 @@ set(EI_ns_debuginfo "${GRAMMAR_DIR}/extinst.nonsemantic.shader.debuginfo.100.gra set(EI_ns_clspvreflect "${GRAMMAR_DIR}/extinst.nonsemantic.clspvreflection.grammar.json") set(EI_ns_vkspreflect "${GRAMMAR_DIR}/extinst.nonsemantic.vkspreflection.grammar.json") set(EI_tosa_001000_1 "${GRAMMAR_DIR}/extinst.tosa.001000.1.grammar.json") +set(EI_arm_motion_engine_100 "${GRAMMAR_DIR}/extinst.arm.motion-engine.100.grammar.json") set(CORE_TABLES_BODY_INC_FILE ${spirv-tools_BINARY_DIR}/core_tables_body.inc) set(CORE_TABLES_HEADER_INC_FILE ${spirv-tools_BINARY_DIR}/core_tables_header.inc) @@ -52,6 +53,7 @@ add_custom_command(OUTPUT ${CORE_TABLES_BODY_INC_FILE} ${CORE_TABLES_HEADER_INC_ --extinst=,${EI_ns_clspvreflect} --extinst=,${EI_ns_vkspreflect} --extinst=TOSA_,${EI_tosa_001000_1} + --extinst=,${EI_arm_motion_engine_100} DEPENDS ${GGT_SCRIPT} ${SPIRV_CORE_GRAMMAR_JSON_FILE} ${EI_glsl} @@ -65,7 +67,8 @@ add_custom_command(OUTPUT ${CORE_TABLES_BODY_INC_FILE} ${CORE_TABLES_HEADER_INC_ ${EI_debuginfo} ${EI_ns_clspvreflect} ${EI_ns_vkspreflect} - ${EI_tosa_001000_1} + ${EI_tosa_001000_1} + ${EI_arm_motion_engine_100} COMMENT "Generate grammar tables") add_custom_target(spirv-tools-tables DEPENDS ${CORE_TABLES_BODY_INC_FILE} ${CORE_TABLES_HEADER_INC_FILE}) @@ -124,9 +127,8 @@ list(APPEND OPCODE_CPP_DEPENDS ${GENERATOR_INC_FILE}) # We need to wrap the .inc files with a custom target to avoid problems when # multiple targets depend on the same custom command. add_custom_target(core_tables - DEPENDS ${OPCODE_CPP_DEPENDS} - ${CORE_TABLES_BODY_INC_FILE} - ${CORE_TABLES_HEADER_INC_FILE}) + DEPENDS ${OPCODE_CPP_DEPENDS} + spirv-tools-tables) add_custom_target(extinst_tables DEPENDS ${EXTINST_CPP_DEPENDS}) @@ -261,6 +263,7 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_extensions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_execution_limitations.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_function.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_graph.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_id.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_image.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_interfaces.cpp @@ -268,6 +271,7 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_layout.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_literals.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_logicals.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_logical_pointers.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_memory.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_memory_semantics.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_mesh_shading.cpp @@ -342,6 +346,9 @@ endfunction() if(SPIRV_TOOLS_BUILD_STATIC) add_library(${SPIRV_TOOLS}-static STATIC ${SPIRV_SOURCES}) + if (SPIRV_TOOLS_USE_MIMALLOC AND SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD) + target_link_libraries(${SPIRV_TOOLS}-shared PRIVATE mimalloc-static) + endif() spirv_tools_default_target_options(${SPIRV_TOOLS}-static) # The static target does not have the '-static' suffix. set_target_properties(${SPIRV_TOOLS}-static PROPERTIES OUTPUT_NAME "${SPIRV_TOOLS}") @@ -374,7 +381,7 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") endif() if(ENABLE_SPIRV_TOOLS_INSTALL) - if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) + if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) list(APPEND SPIRV_TOOLS_TARGETS mimalloc-static) endif() install(TARGETS ${SPIRV_TOOLS_TARGETS} EXPORT ${SPIRV_TOOLS}Targets) @@ -392,8 +399,3 @@ if(ENABLE_SPIRV_TOOLS_INSTALL) "endif()\n") install(FILES ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake DESTINATION ${PACKAGE_DIR}) endif(ENABLE_SPIRV_TOOLS_INSTALL) - -if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))) - # Enable parallel builds across four cores for this lib - add_definitions(/MP4) -endif() diff --git a/third_party/spirv-tools/source/CMakeLists.txt.bak b/third_party/spirv-tools/source/CMakeLists.txt.bak new file mode 100644 index 0000000000..6f16933995 --- /dev/null +++ b/third_party/spirv-tools/source/CMakeLists.txt.bak @@ -0,0 +1,410 @@ +# Copyright (c) 2015-2016 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set(VIMSYNTAX_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/vim/generate_syntax.py") +set(XML_REGISTRY_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_registry_tables.py") +set(LANG_HEADER_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_language_headers.py") +set(GGT_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/ggt.py") + +# Pull in grammar files that have migrated to SPIRV-Headers +set(GRAMMAR_DIR "${SPIRV_HEADER_INCLUDE_DIR}/spirv/unified1") +set(SPIRV_CORE_GRAMMAR_JSON_FILE "${GRAMMAR_DIR}/spirv.core.grammar.json") +set(EI_debuginfo "${GRAMMAR_DIR}/extinst.debuginfo.grammar.json") +set(EI_cldebuginfo "${GRAMMAR_DIR}/extinst.opencl.debuginfo.100.grammar.json") +set(EI_glsl "${GRAMMAR_DIR}/extinst.glsl.std.450.grammar.json") +set(EI_opencl "${GRAMMAR_DIR}/extinst.opencl.std.100.grammar.json") +set(EI_amd_evp "${GRAMMAR_DIR}/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json") +set(EI_amd_trimm "${GRAMMAR_DIR}/extinst.spv-amd-shader-trinary-minmax.grammar.json") +set(EI_amd_gcn "${GRAMMAR_DIR}/extinst.spv-amd-gcn-shader.grammar.json") +set(EI_amd_ballot "${GRAMMAR_DIR}/extinst.spv-amd-shader-ballot.grammar.json") +set(EI_ns_debuginfo "${GRAMMAR_DIR}/extinst.nonsemantic.shader.debuginfo.100.grammar.json") +set(EI_ns_clspvreflect "${GRAMMAR_DIR}/extinst.nonsemantic.clspvreflection.grammar.json") +set(EI_ns_vkspreflect "${GRAMMAR_DIR}/extinst.nonsemantic.vkspreflection.grammar.json") +set(EI_tosa_001000_1 "${GRAMMAR_DIR}/extinst.tosa.001000.1.grammar.json") +set(EI_arm_motion_engine_100 "${GRAMMAR_DIR}/extinst.arm.motion-engine.100.grammar.json") + +set(CORE_TABLES_BODY_INC_FILE ${spirv-tools_BINARY_DIR}/core_tables_body.inc) +set(CORE_TABLES_HEADER_INC_FILE ${spirv-tools_BINARY_DIR}/core_tables_header.inc) +add_custom_command(OUTPUT ${CORE_TABLES_BODY_INC_FILE} ${CORE_TABLES_HEADER_INC_FILE} + COMMAND Python3::Interpreter ${GGT_SCRIPT} + --core-tables-body-output=${CORE_TABLES_BODY_INC_FILE} + --core-tables-header-output=${CORE_TABLES_HEADER_INC_FILE} + --spirv-core-grammar=${SPIRV_CORE_GRAMMAR_JSON_FILE} + --extinst=,${EI_glsl} + --extinst=,${EI_opencl} + --extinst=CLDEBUG100_,${EI_cldebuginfo} + --extinst=SHDEBUG100_,${EI_ns_debuginfo} + --extinst=,${EI_amd_evp} + --extinst=,${EI_amd_trimm} + --extinst=,${EI_amd_gcn} + --extinst=,${EI_amd_ballot} + --extinst=,${EI_debuginfo} + --extinst=,${EI_ns_clspvreflect} + --extinst=,${EI_ns_vkspreflect} + --extinst=TOSA_,${EI_tosa_001000_1} + --extinst=,${EI_arm_motion_engine_100} + DEPENDS ${GGT_SCRIPT} + ${SPIRV_CORE_GRAMMAR_JSON_FILE} + ${EI_glsl} + ${EI_opencl} + ${EI_cldebuginfo} + ${EI_ns_debuginfo} + ${EI_amd_evp} + ${EI_amd_trimm} + ${EI_amd_gcn} + ${EI_amd_ballot} + ${EI_debuginfo} + ${EI_ns_clspvreflect} + ${EI_ns_vkspreflect} + ${EI_tosa_001000_1} + ${EI_arm_motion_engine_100} + COMMENT "Generate grammar tables") +add_custom_target(spirv-tools-tables DEPENDS ${CORE_TABLES_BODY_INC_FILE} ${CORE_TABLES_HEADER_INC_FILE}) + +macro(spvtools_vimsyntax CONFIG_VERSION CLVERSION) + set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/spirv.core.grammar.json") + set(GLSL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/extinst.glsl.std.450.grammar.json") + set(OPENCL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/extinst.opencl.std.100.grammar.json") + set(VIMSYNTAX_FILE "${spirv-tools_BINARY_DIR}/spvasm.vim") + add_custom_command(OUTPUT ${VIMSYNTAX_FILE} + COMMAND Python3::Interpreter ${VIMSYNTAX_PROCESSING_SCRIPT} + --spirv-core-grammar=${GRAMMAR_JSON_FILE} + --extinst-debuginfo-grammar=${EI_debuginfo} + --extinst-glsl-grammar=${GLSL_GRAMMAR_JSON_FILE} + --extinst-opencl-grammar=${OPENCL_GRAMMAR_JSON_FILE} + >${VIMSYNTAX_FILE} + DEPENDS ${VIMSYNTAX_PROCESSING_SCRIPT} ${GRAMMAR_JSON_FILE} + ${GLSL_GRAMMAR_JSON_FILE} ${OPENCL_GRAMMAR_JSON_FILE} ${EI_debuinfo} + COMMENT "Generate spvasm.vim: Vim syntax file for SPIR-V assembly.") +endmacro(spvtools_vimsyntax) + +macro(spvtools_extinst_lang_headers NAME GRAMMAR_FILE) + set(OUT_H ${spirv-tools_BINARY_DIR}/${NAME}.h) + add_custom_command(OUTPUT ${OUT_H} + COMMAND Python3::Interpreter ${LANG_HEADER_PROCESSING_SCRIPT} + --extinst-grammar=${GRAMMAR_FILE} + --extinst-output-path=${OUT_H} + DEPENDS ${LANG_HEADER_PROCESSING_SCRIPT} ${GRAMMAR_FILE} + COMMENT "Generate language specific header for ${NAME}.") + add_custom_target(spirv-tools-header-${NAME} DEPENDS ${OUT_H}) + set_property(TARGET spirv-tools-header-${NAME} PROPERTY FOLDER "SPIRV-Tools build") + list(APPEND EXTINST_CPP_DEPENDS spirv-tools-header-${NAME}) +endmacro(spvtools_extinst_lang_headers) + +spvtools_extinst_lang_headers("DebugInfo" ${EI_debuginfo}) +spvtools_extinst_lang_headers("OpenCLDebugInfo100" ${EI_cldebuginfo}) +spvtools_extinst_lang_headers("NonSemanticShaderDebugInfo100" ${EI_ns_debuginfo}) + +spvtools_vimsyntax("unified1" "1.0") +add_custom_target(spirv-tools-vimsyntax DEPENDS ${VIMSYNTAX_FILE}) +set_property(TARGET spirv-tools-vimsyntax PROPERTY FOLDER "SPIRV-Tools utilities") + +# Extract the list of known generators from the SPIR-V XML registry file. +set(GENERATOR_INC_FILE ${spirv-tools_BINARY_DIR}/generators.inc) +set(SPIRV_XML_REGISTRY_FILE ${SPIRV_HEADER_INCLUDE_DIR}/spirv/spir-v.xml) +add_custom_command(OUTPUT ${GENERATOR_INC_FILE} + COMMAND Python3::Interpreter ${XML_REGISTRY_PROCESSING_SCRIPT} + --xml=${SPIRV_XML_REGISTRY_FILE} + --generator-output=${GENERATOR_INC_FILE} + DEPENDS ${XML_REGISTRY_PROCESSING_SCRIPT} ${SPIRV_XML_REGISTRY_FILE} + COMMENT "Generate tables based on the SPIR-V XML registry.") +list(APPEND OPCODE_CPP_DEPENDS ${GENERATOR_INC_FILE}) + +# The following .cpp files include the above generated .inc files. +# Add those .inc files as their dependencies. +# +# We need to wrap the .inc files with a custom target to avoid problems when +# multiple targets depend on the same custom command. +add_custom_target(core_tables + DEPENDS ${OPCODE_CPP_DEPENDS} + spirv-tools-tables) +add_custom_target(extinst_tables + DEPENDS ${EXTINST_CPP_DEPENDS}) + +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/extensions.h + PROPERTIES HEADER_FILE_ONLY TRUE) + +set(SPIRV_TOOLS_BUILD_VERSION_INC + ${spirv-tools_BINARY_DIR}/build-version.inc) +set(SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR + ${spirv-tools_SOURCE_DIR}/utils/update_build_version.py) +set(SPIRV_TOOLS_CHANGES_FILE + ${spirv-tools_SOURCE_DIR}/CHANGES) +add_custom_command(OUTPUT ${SPIRV_TOOLS_BUILD_VERSION_INC} + COMMAND Python3::Interpreter + ${SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR} + ${SPIRV_TOOLS_CHANGES_FILE} ${SPIRV_TOOLS_BUILD_VERSION_INC} + DEPENDS ${SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR} + ${SPIRV_TOOLS_CHANGES_FILE} + COMMENT "Update build-version.inc in the SPIRV-Tools build directory (if necessary).") +# Convenience target for standalone generation of the build-version.inc file. +# This is not required for any dependence chain. +add_custom_target(spirv-tools-build-version + DEPENDS ${SPIRV_TOOLS_BUILD_VERSION_INC}) +set_property(TARGET spirv-tools-build-version PROPERTY FOLDER "SPIRV-Tools build") + +list(APPEND PCH_DEPENDS + ${CORE_TABLES_HEADER_INC_FILE} + ${OPCODE_CPP_DEPENDS} + ${EXTINST_CPP_DEPENDS} + ${SPIRV_TOOLS_BUILD_VERSION_INC}) +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/pch_source.cpp + PROPERTIES OBJECT_DEPENDS "${PCH_DEPENDS}") + +add_subdirectory(opt) +add_subdirectory(reduce) +add_subdirectory(fuzz) +add_subdirectory(link) +add_subdirectory(lint) +add_subdirectory(diff) + +set(SPIRV_SOURCES + ${spirv-tools_SOURCE_DIR}/include/spirv-tools/libspirv.h + + ${CMAKE_CURRENT_SOURCE_DIR}/util/bitutils.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_vector.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/hash_combine.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/hex_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/make_unique.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/parse_number.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/small_vector.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/string_utils.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/timer.h + ${CMAKE_CURRENT_SOURCE_DIR}/assembly_grammar.h + ${CMAKE_CURRENT_SOURCE_DIR}/binary.h + ${CMAKE_CURRENT_SOURCE_DIR}/cfa.h + ${CMAKE_CURRENT_SOURCE_DIR}/common_debug_info.h + ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.h + ${CMAKE_CURRENT_SOURCE_DIR}/disassemble.h + ${CMAKE_CURRENT_SOURCE_DIR}/enum_set.h + ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.h + ${CMAKE_CURRENT_SOURCE_DIR}/extensions.h + ${CMAKE_CURRENT_SOURCE_DIR}/instruction.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_glsl_std_450_header.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_opencl_std_header.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_spirv_header.h + ${CMAKE_CURRENT_SOURCE_DIR}/macro.h + ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.h + ${CMAKE_CURRENT_SOURCE_DIR}/opcode.h + ${CMAKE_CURRENT_SOURCE_DIR}/operand.h + ${CMAKE_CURRENT_SOURCE_DIR}/parsed_operand.h + ${CMAKE_CURRENT_SOURCE_DIR}/print.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_constant.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_definition.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_fuzzer_options.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_optimizer_options.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_reducer_options.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_target_env.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_validator_options.h + ${CMAKE_CURRENT_SOURCE_DIR}/table.h + ${CMAKE_CURRENT_SOURCE_DIR}/table2.h + ${CMAKE_CURRENT_SOURCE_DIR}/text.h + ${CMAKE_CURRENT_SOURCE_DIR}/text_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/to_string.h + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate.h + + ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_vector.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/parse_number.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/string_utils.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/assembly_grammar.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/binary.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/disassemble.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/extensions.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/libspirv.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/opcode.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/operand.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/parsed_operand.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/print.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/software_version.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_fuzzer_options.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_optimizer_options.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_reducer_options.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_target_env.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_validator_options.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/table.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/table2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/text.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/text_handler.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/to_string.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_adjacency.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_annotation.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_arithmetics.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_atomics.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_barriers.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_bitwise.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_builtins.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_capability.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_cfg.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_composites.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_constants.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_conversion.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_debug.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_decorations.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_derivatives.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_extensions.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_execution_limitations.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_function.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_graph.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_id.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_image.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_interfaces.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_instruction.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_layout.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_literals.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_logicals.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_logical_pointers.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_memory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_memory_semantics.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_mesh_shading.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_misc.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_mode_setting.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_non_uniform.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_primitives.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_ray_query.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_ray_tracing.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_ray_tracing_reorder.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_scopes.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_small_type_uses.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_tensor_layout.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_tensor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_type.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_invalid_type.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/decoration.h + ${CMAKE_CURRENT_SOURCE_DIR}/val/basic_block.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/construct.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/function.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/instruction.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validation_state.cpp) + +if (${SPIRV_TIMER_ENABLED}) + set(SPIRV_SOURCES + ${SPIRV_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/util/timer.cpp) +endif() + +if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) + set(SPIRV_SOURCES + ${SPIRV_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/mimalloc.cpp) +endif() + +# The software_version.cpp file includes build-version.inc. +# Rebuild the software_version.cpp object file if it is older than +# build-version.inc or whenever build-version.inc itself is out of +# date. In the latter case, rebuild build-version.inc first. +# CMake is not smart enough to detect this dependency automatically. +# Without this, the dependency detection system for #included files +# does not kick in on a clean build for the following reason: The +# build will fail early because it doesn't know how to build the +# missing source file build-version.inc. That occurs before the +# preprocessor is run on software_version.cpp to detect the +# #include dependency. +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/software_version.cpp + PROPERTIES OBJECT_DEPENDS "${SPIRV_TOOLS_BUILD_VERSION_INC}") + +spvtools_pch(SPIRV_SOURCES pch_source) + +# spirv_tools_default_target_options() sets the target options that are common +# for all ${SPIRV_TOOLS} targets. +function(spirv_tools_default_target_options target) + spvtools_default_compile_options(${target}) + target_include_directories(${target} + PUBLIC + $ + $ + PRIVATE ${spirv-tools_BINARY_DIR} + PRIVATE ${SPIRV_HEADER_INCLUDE_DIR} + ) + set_property(TARGET ${target} PROPERTY FOLDER "SPIRV-Tools libraries") + spvtools_check_symbol_exports(${target}) + add_dependencies(${target} spirv-tools-build-version core_tables extinst_tables) +endfunction() + +# Always build ${SPIRV_TOOLS}-shared. This is expected distro packages, and +# unlike the other SPIRV_TOOLS target, defaults to hidden symbol visibility. +add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES}) +if (SPIRV_TOOLS_USE_MIMALLOC) + target_link_libraries(${SPIRV_TOOLS}-shared PRIVATE mimalloc-static) +endif() +spirv_tools_default_target_options(${SPIRV_TOOLS}-shared) +set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden) +target_compile_definitions(${SPIRV_TOOLS}-shared + PRIVATE SPIRV_TOOLS_IMPLEMENTATION + PUBLIC SPIRV_TOOLS_SHAREDLIB +) + +if(SPIRV_TOOLS_BUILD_STATIC) + add_library(${SPIRV_TOOLS}-static STATIC ${SPIRV_SOURCES}) + if (SPIRV_TOOLS_USE_MIMALLOC AND SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD) + target_link_libraries(${SPIRV_TOOLS}-shared PRIVATE mimalloc-static) + endif() + spirv_tools_default_target_options(${SPIRV_TOOLS}-static) + # The static target does not have the '-static' suffix. + set_target_properties(${SPIRV_TOOLS}-static PROPERTIES OUTPUT_NAME "${SPIRV_TOOLS}") + + # Create the "${SPIRV_TOOLS}" target as an alias to either "${SPIRV_TOOLS}-static" + # or "${SPIRV_TOOLS}-shared" depending on the value of BUILD_SHARED_LIBS. + if(BUILD_SHARED_LIBS) + add_library(${SPIRV_TOOLS} ALIAS ${SPIRV_TOOLS}-shared) + else() + add_library(${SPIRV_TOOLS} ALIAS ${SPIRV_TOOLS}-static) + endif() + + set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS}-static ${SPIRV_TOOLS}-shared) +else() + add_library(${SPIRV_TOOLS} ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_SOURCES}) + if (SPIRV_TOOLS_USE_MIMALLOC) + target_link_libraries(${SPIRV_TOOLS} PRIVATE mimalloc-static) + endif() + spirv_tools_default_target_options(${SPIRV_TOOLS}) + set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared) +endif() + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + find_library(LIBRT rt) + if(LIBRT) + foreach(target ${SPIRV_TOOLS_TARGETS}) + target_link_libraries(${target} PUBLIC rt) + endforeach() + endif() +endif() + +if(ENABLE_SPIRV_TOOLS_INSTALL) + if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) + list(APPEND SPIRV_TOOLS_TARGETS mimalloc-static) + endif() + install(TARGETS ${SPIRV_TOOLS_TARGETS} EXPORT ${SPIRV_TOOLS}Targets) + export(EXPORT ${SPIRV_TOOLS}Targets FILE ${SPIRV_TOOLS}Target.cmake) + + spvtools_config_package_dir(${SPIRV_TOOLS} PACKAGE_DIR) + install(EXPORT ${SPIRV_TOOLS}Targets FILE ${SPIRV_TOOLS}Target.cmake DESTINATION ${PACKAGE_DIR}) + + # Special config file for root library compared to other libs. + file(WRITE ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake + "include(\${CMAKE_CURRENT_LIST_DIR}/${SPIRV_TOOLS}Target.cmake)\n" + "if(TARGET ${SPIRV_TOOLS})\n" + " set(${SPIRV_TOOLS}_LIBRARIES ${SPIRV_TOOLS})\n" + " get_target_property(${SPIRV_TOOLS}_INCLUDE_DIRS ${SPIRV_TOOLS} INTERFACE_INCLUDE_DIRECTORIES)\n" + "endif()\n") + install(FILES ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake DESTINATION ${PACKAGE_DIR}) +endif(ENABLE_SPIRV_TOOLS_INSTALL) diff --git a/third_party/spirv-tools/source/binary.cpp b/third_party/spirv-tools/source/binary.cpp index 8e4d899f7d..997a30c61b 100644 --- a/third_party/spirv-tools/source/binary.cpp +++ b/third_party/spirv-tools/source/binary.cpp @@ -856,7 +856,7 @@ void Parser::recordNumberType(size_t inst_offset, info.type = SPV_NUMBER_FLOATING; info.bit_width = peekAt(inst_offset + 2); if (inst->num_words >= 4) { - const spvtools::OperandDesc* desc; + const spvtools::OperandDesc* desc = nullptr; spv_result_t status = spvtools::LookupOperand( SPV_OPERAND_TYPE_FPENCODING, peekAt(inst_offset + 3), &desc); if (status == SPV_SUCCESS) { diff --git a/third_party/spirv-tools/source/diff/CMakeLists.txt b/third_party/spirv-tools/source/diff/CMakeLists.txt index d288261658..2bd6106048 100644 --- a/third_party/spirv-tools/source/diff/CMakeLists.txt +++ b/third_party/spirv-tools/source/diff/CMakeLists.txt @@ -18,13 +18,13 @@ set(SPIRV_TOOLS_DIFF_SOURCES diff.cpp ) -if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) +if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) list(APPEND SPIRV_TOOLS_DIFF_SOURCES ${spirv-tools_SOURCE_DIR}/source/mimalloc.cpp) endif() add_library(SPIRV-Tools-diff ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_DIFF_SOURCES}) -if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) +if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) target_link_libraries(SPIRV-Tools-diff PRIVATE mimalloc-static) endif() @@ -49,7 +49,7 @@ spvtools_check_symbol_exports(SPIRV-Tools-diff) if(ENABLE_SPIRV_TOOLS_INSTALL) set(SPIRV-Tools-diff-InstallTargets SPIRV-Tools-diff) - if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) + if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) list(APPEND SPIRV-Tools-diff-InstallTargets mimalloc-static) endif() diff --git a/third_party/spirv-tools/source/diff/diff.cpp b/third_party/spirv-tools/source/diff/diff.cpp index 7fd21f3524..d548aeada3 100644 --- a/third_party/spirv-tools/source/diff/diff.cpp +++ b/third_party/spirv-tools/source/diff/diff.cpp @@ -1219,6 +1219,7 @@ bool Differ::DoDebugAndAnnotationInstructionsMatch( case spv::Op::OpMemberDecorate: return DoOperandsMatch(src_inst, dst_inst, 0, 3); case spv::Op::OpExtInst: + return DoOperandsMatch(src_inst, dst_inst, 0, 2); case spv::Op::OpDecorationGroup: case spv::Op::OpGroupDecorate: case spv::Op::OpGroupMemberDecorate: @@ -2612,6 +2613,9 @@ void Differ::MatchExtInstDebugInfo() { // This section includes OpExtInst for DebugInfo extension MatchDebugAndAnnotationInstructions(src_->ext_inst_debuginfo(), dst_->ext_inst_debuginfo()); + // OpExtInst can exist in other sections too, such as with non-semantic info. + MatchDebugAndAnnotationInstructions(src_->types_values(), + dst_->types_values()); } void Differ::MatchAnnotations() { diff --git a/third_party/spirv-tools/source/disassemble.cpp b/third_party/spirv-tools/source/disassemble.cpp index 4267333a00..43db1daa29 100644 --- a/third_party/spirv-tools/source/disassemble.cpp +++ b/third_party/spirv-tools/source/disassemble.cpp @@ -694,12 +694,12 @@ void InstructionDisassembler::EmitInstructionImpl( } if (inst.result_id) { - SetBlue(); + SetBlue(line); const std::string id_name = name_mapper_(inst.result_id); if (indent_) line << std::setw(std::max(0, indent_ - 3 - int(id_name.size()))); line << "%" << id_name; - ResetColor(); + ResetColor(line); line << " = "; } else { line << std::string(indent_, ' '); diff --git a/third_party/spirv-tools/source/ext_inst.cpp b/third_party/spirv-tools/source/ext_inst.cpp index 761b8d2f2a..a616a1e1df 100644 --- a/third_party/spirv-tools/source/ext_inst.cpp +++ b/third_party/spirv-tools/source/ext_inst.cpp @@ -58,6 +58,9 @@ spv_ext_inst_type_t spvExtInstImportTypeGet(const char* name) { if (!strcmp("TOSA.001000.1", name)) { return SPV_EXT_INST_TYPE_TOSA_001000_1; } + if (!strcmp("Arm.MotionEngine.100", name)) { + return SPV_EXT_INST_TYPE_ARM_MOTION_ENGINE_100; + } // ensure to add any known non-semantic extended instruction sets // above this point, and update spvExtInstIsNonSemantic() if (!strncmp("NonSemantic.", name, 12)) { diff --git a/third_party/spirv-tools/source/extensions.cpp b/third_party/spirv-tools/source/extensions.cpp index 91136e6a78..ab4caa0005 100644 --- a/third_party/spirv-tools/source/extensions.cpp +++ b/third_party/spirv-tools/source/extensions.cpp @@ -24,18 +24,24 @@ namespace spvtools { std::string GetExtensionString(const spv_parsed_instruction_t* inst) { - if (inst->opcode != static_cast(spv::Op::OpExtension)) { + if ((inst->opcode != static_cast(spv::Op::OpExtension)) && + (inst->opcode != + static_cast(spv::Op::OpConditionalExtensionINTEL))) { return "ERROR_not_op_extension"; } - assert(inst->num_operands == 1); + const bool is_conditional = + inst->opcode == + static_cast(spv::Op::OpConditionalExtensionINTEL); + assert(inst->num_operands == (is_conditional ? 2 : 1)); + const uint16_t op_i = is_conditional ? 1 : 0; - const auto& operand = inst->operands[0]; + const auto& operand = inst->operands[op_i]; assert(operand.type == SPV_OPERAND_TYPE_LITERAL_STRING); assert(inst->num_words > operand.offset); (void)operand; /* No unused variables in release builds. */ - return spvDecodeLiteralStringOperand(*inst, 0); + return spvDecodeLiteralStringOperand(*inst, op_i); } std::string ExtensionSetToString(const ExtensionSet& extensions) { diff --git a/third_party/spirv-tools/source/fuzz/CMakeLists.txt b/third_party/spirv-tools/source/fuzz/CMakeLists.txt index d067bd48bf..a3e0395740 100644 --- a/third_party/spirv-tools/source/fuzz/CMakeLists.txt +++ b/third_party/spirv-tools/source/fuzz/CMakeLists.txt @@ -431,20 +431,15 @@ if(SPIRV_BUILD_FUZZER) ${CMAKE_CURRENT_BINARY_DIR}/protobufs/spvtoolsfuzz.pb.cc ) - if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))) - # Enable parallel builds across four cores for this lib - add_definitions(/MP4) - endif() - spvtools_pch(SPIRV_TOOLS_FUZZ_SOURCES pch_source_fuzz) - if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) + if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) list(APPEND SPIRV_TOOLS_DIFF_SOURCES ${spirv-tools_SOURCE_DIR}/source/mimalloc.cpp) endif() add_library(SPIRV-Tools-fuzz ${SPIRV_TOOLS_FUZZ_SOURCES}) - if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) + if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) target_link_libraries(SPIRV-Tools-fuzz PRIVATE mimalloc-static) endif() @@ -480,7 +475,7 @@ if(SPIRV_BUILD_FUZZER) if(ENABLE_SPIRV_TOOLS_INSTALL) set(SPIRV-Tools-fuzz-InstallTargets SPIRV-Tools-fuzz) - if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) + if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) list(APPEND SPIRV-Tools-fuzz-InstallTargets mimalloc-static) endif() diff --git a/third_party/spirv-tools/source/fuzz/force_render_red.cpp b/third_party/spirv-tools/source/fuzz/force_render_red.cpp index 191fd716b5..2425ec685d 100644 --- a/third_party/spirv-tools/source/fuzz/force_render_red.cpp +++ b/third_party/spirv-tools/source/fuzz/force_render_red.cpp @@ -36,8 +36,11 @@ opt::Function* FindFragmentShaderEntryPoint(opt::IRContext* ir_context, // Check that this is a fragment shader bool found_capability_shader = false; for (auto& capability : ir_context->capabilities()) { - assert(capability.opcode() == spv::Op::OpCapability); - if (spv::Capability(capability.GetSingleWordInOperand(0)) == + assert(capability.opcode() == spv::Op::OpCapability || + capability.opcode() == spv::Op::OpConditionalCapabilityINTEL); + const uint32_t i_cap = + capability.opcode() == spv::Op::OpConditionalCapabilityINTEL ? 1 : 0; + if (spv::Capability(capability.GetSingleWordInOperand(i_cap)) == spv::Capability::Shader) { found_capability_shader = true; break; diff --git a/third_party/spirv-tools/source/fuzz/transformation_inline_function.cpp b/third_party/spirv-tools/source/fuzz/transformation_inline_function.cpp index 69e88fd508..f4f373ffca 100644 --- a/third_party/spirv-tools/source/fuzz/transformation_inline_function.cpp +++ b/third_party/spirv-tools/source/fuzz/transformation_inline_function.cpp @@ -182,6 +182,8 @@ void TransformationInlineFunction::Apply( } auto* cloned_block = block.Clone(ir_context); + // TODO: Handle the nullptr. + assert(cloned_block); cloned_block = caller_function->InsertBasicBlockBefore( std::unique_ptr(cloned_block), successor_block); cloned_block->GetLabel()->SetResultId(result_id_map.at(cloned_block->id())); diff --git a/third_party/spirv-tools/source/fuzz/transformation_outline_function.cpp b/third_party/spirv-tools/source/fuzz/transformation_outline_function.cpp index 4ab68d078c..0271166d56 100644 --- a/third_party/spirv-tools/source/fuzz/transformation_outline_function.cpp +++ b/third_party/spirv-tools/source/fuzz/transformation_outline_function.cpp @@ -819,6 +819,8 @@ void TransformationOutlineFunction::PopulateOutlinedFunction( // Clone the block so that it can be added to the new function. auto cloned_block = std::unique_ptr(block_it->Clone(ir_context)); + // TODO: Handle a nullptr. + assert(cloned_block); // If this is the region's exit block, then the cloned block is the outlined // region's exit block. diff --git a/third_party/spirv-tools/source/link/CMakeLists.txt b/third_party/spirv-tools/source/link/CMakeLists.txt index a35b9a58fd..5fd89c3844 100644 --- a/third_party/spirv-tools/source/link/CMakeLists.txt +++ b/third_party/spirv-tools/source/link/CMakeLists.txt @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. add_library(SPIRV-Tools-link ${SPIRV_TOOLS_LIBRARY_TYPE} + fnvar.cpp linker.cpp ) diff --git a/third_party/spirv-tools/source/link/fnvar.cpp b/third_party/spirv-tools/source/link/fnvar.cpp new file mode 100644 index 0000000000..352e7ea339 --- /dev/null +++ b/third_party/spirv-tools/source/link/fnvar.cpp @@ -0,0 +1,1011 @@ +// Copyright 2025 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "fnvar.h" + +#include +#include +#include + +#include "source/opt/instruction.h" + +namespace spvtools { + +using opt::Function; +using opt::Instruction; +using opt::analysis::Type; + +namespace { +// Helper functions + +// Parses a CSV source string for the purpose of this extension. +// +// Required columns must be known in advance and supplied as the required_cols +// argument -- this is used for error checking. Values are assumed to be +// separated by CSV_SEP. The input source string is assumed to be the output of +// io::ReadTextFile and no other validation, apart from the CSV parsing, is +// performed. +// +// Returns true on success, false on error (with error message stored in +// err_msg). +bool ParseCsv(const std::string& source, + const std::vector& required_cols, + std::stringstream& err_msg, + std::vector>& result) { + std::stringstream fn_variants_csv_stream(source); + std::string line; + std::vector columns; + constexpr char CSV_SEP = ','; + bool first_line = true; + + while (std::getline(fn_variants_csv_stream, line, '\n')) { + if (line.empty()) { + continue; + } + + std::vector vals; + std::string val; + std::stringstream line_stream(line); + auto* vec = first_line ? &columns : &vals; + + while (std::getline(line_stream, val, CSV_SEP)) { + vec->push_back(val); + } + + if (!line_stream && val.empty()) { + vec->push_back(""); + } + + if (!first_line) { + if (vals.size() != columns.size()) { + err_msg << "Number of values does not match the number of columns. " + "Offending line:\n" + << line; + return false; + } + result.push_back(vals); + } + + first_line = false; + } + + // check if required columns match actual columns (ordering matters) + + if (columns.size() != required_cols.size()) { + err_msg << "Invalid number of CSV columns: " << columns.size() + << ", expected " << required_cols.size() << "."; + return false; + } + + for (size_t i = 0; i < columns.size(); ++i) { + if (columns[i] != required_cols[i]) { + err_msg << "Invalid name of column " << i + 1 << ". Expected '" + << required_cols[i] << "', got '" << columns[i] << "'."; + return false; + } + } + + return true; +} + +// Annotate ID with ConditionalINTEL decoration +void DecorateConditional(IRContext* context, uint32_t id_to_decorate, + uint32_t spec_const_id) { + auto decor_instr = + std::make_unique(context, spv::Op::OpDecorate); + decor_instr->AddOperand({SPV_OPERAND_TYPE_ID, {id_to_decorate}}); + decor_instr->AddOperand({SPV_OPERAND_TYPE_DECORATION, + {uint32_t(spv::Decoration::ConditionalINTEL)}}); + decor_instr->AddOperand({SPV_OPERAND_TYPE_ID, {spec_const_id}}); + context->module()->AddAnnotationInst(std::move(decor_instr)); +} + +// Finds entry point corresponding to a function +// +// Returns null if not found, otherwise returns pointer to the EP Instruction. +Instruction* FindEntryPoint(const Instruction& fn_inst) { + auto* mod = fn_inst.context()->module(); + for (auto& entry_point : mod->entry_points()) { + const int ep_i = + entry_point.opcode() == spv::Op::OpConditionalEntryPointINTEL ? 2 : 1; + if (entry_point.GetOperand(ep_i).AsId() == fn_inst.result_id()) { + return &entry_point; + } + } + return nullptr; +} + +// If the function has an entry point, converts it to a conditional one +void ConvertEPToConditional(Module* module, const Function& fn, + uint32_t spec_const_id) { + for (const auto& ep_inst : module->entry_points()) { + if (ep_inst.opcode() == spv::Op::OpEntryPoint) { + auto* entry_point = FindEntryPoint(fn.DefInst()); + if (entry_point != nullptr) { + std::vector old_operands; + for (auto operand : *entry_point) { + old_operands.push_back(operand); + } + entry_point->ToNop(); + entry_point->SetOpcode(spv::Op::OpConditionalEntryPointINTEL); + entry_point->AddOperand({SPV_OPERAND_TYPE_ID, {spec_const_id}}); + for (auto old_operand : old_operands) { + entry_point->AddOperand(old_operand); + } + } + } + } +} + +// Finds ID of a bool type (returns 0 if not found) +uint32_t FindIdOfBoolType(const Module* const mod) { + return mod->context()->get_type_mgr()->GetBoolTypeId(); +} + +// Combines IDs using OpSpecConstantOp with the operation defined by cmp_op. +// +// Returns the ID of the final result. If there are no IDs, returns 0. If there +// is one ID, does not generate any instructions and returns the ID. +uint32_t CombineIds(IRContext* const context, const std::vector& ids, + spv::Op cmp_op) { + if (ids.empty()) { + return 0; + } else if (ids.size() == 1) { + return ids[0]; + } else { + uint32_t bool_id = FindIdOfBoolType(context->module()); + assert(bool_id != 0); + + uint32_t prev_spec_const_id = ids[0]; + + for (size_t i = 1; i < ids.size(); ++i) { + const uint32_t id = ids[i]; + const uint32_t spec_const_op_id = context->TakeNextId(); + + auto inst = std::make_unique( + context, spv::Op::OpSpecConstantOp, bool_id, spec_const_op_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER, {(uint32_t)(cmp_op)}}, + {SPV_OPERAND_TYPE_ID, {prev_spec_const_id}}, + {SPV_OPERAND_TYPE_ID, {id}}}); + context->module()->AddType(std::move(inst)); + + prev_spec_const_id = spec_const_op_id; + } + + return prev_spec_const_id; + } +} + +// Returns whether instruction can be shared between variant modules and +// combined using spec constants (such as conditional capabilities). +bool CanBeFnVarCombined(const Instruction* inst) { + const spv::Op opcode = inst->opcode(); + + if ((opcode != spv::Op::OpExtInstImport) && + (opcode != spv::Op::OpCapability) && (opcode != spv::Op::OpExtension) && + !spvOpcodeGeneratesType(opcode)) { + return false; + } + + if ((opcode == spv::Op::OpCapability) && + ((inst->GetSingleWordOperand(0) == + static_cast(spv::Capability::FunctionVariantsINTEL)) || + (inst->GetSingleWordOperand(0) == + static_cast(spv::Capability::SpecConditionalINTEL)))) { + // Always enabled + return false; + } + + if ((opcode == spv::Op::OpExtension) && + (inst->GetOperand(0).AsString() == FNVAR_EXT_NAME)) { + // Always enabled + return false; + } + + return true; +} + +// Calculates hash of an instruction. +// +// Applicable only to instructions that can be combined (ie. with +// CanBeFnVarCombined being true) and from those, hash can be only computed for +// selected instructions. Computing hash from other instruction is unsupported. +size_t HashInst(const Instruction* inst) { + if (CanBeFnVarCombined(inst)) { + if (spvOpcodeGeneratesType(inst->opcode())) { + const Type* t = + inst->context()->get_type_mgr()->GetType(inst->result_id()); + assert(t != nullptr); + return t->HashValue(); + } + + if (inst->opcode() == spv::Op::OpExtension) { + const auto name = inst->GetOperand(0).AsString(); + return std::hash()(name); + } + + if (inst->opcode() == spv::Op::OpCapability) { + const auto cap = inst->GetSingleWordOperand(0); + return std::hash()(cap); + } + + if (inst->opcode() == spv::Op::OpExtInstImport) { + const auto name = inst->GetOperand(1).AsString(); + return std::hash()(name); + } + } + + assert(false && "Unsupported instruction hash"); + return std::hash()(inst); +} + +std::string GetFnName(const Instruction& fn_inst) { + // Check entry point + const auto* ep_inst = FindEntryPoint(fn_inst); + if (ep_inst != nullptr) { + const int name_i = + ep_inst->opcode() == spv::Op::OpConditionalEntryPointINTEL ? 3 : 2; + return ep_inst->GetOperand(name_i).AsString(); + } + + // Check name of export linkage attribute decoration + const auto* decor_mgr = fn_inst.context()->get_decoration_mgr(); + for (const auto* inst : + decor_mgr->GetDecorationsFor(fn_inst.result_id(), true)) { + const auto decoration = inst->GetOperand(1); + if ((decoration.type == SPV_OPERAND_TYPE_DECORATION) && + (decoration.words.size() == 1) && + (decoration.words[0] == + static_cast(spv::Decoration::LinkageAttributes))) { + const auto linkage = inst->GetOperand(3); + if ((linkage.type == SPV_OPERAND_TYPE_LINKAGE_TYPE) && + (linkage.words.size() == 1) && + (linkage.words[0] == + static_cast(spv::LinkageType::Export))) { + // decorates fn with LinkageAttribute and Export linkage type -> get the + // name + return inst->GetOperand(2).AsString(); + } + } + } + + return ""; +} + +uint32_t FindSpecConstByName(const Module* mod, std::string name) { + for (const auto* const_inst : mod->context()->GetConstants()) { + if (opt::IsSpecConstantInst(const_inst->opcode())) { + const auto id = const_inst->result_id(); + for (const auto& name_inst : mod->debugs2()) { + if ((name_inst.opcode() == spv::Op::OpName) && + (name_inst.GetOperand(0).AsId() == id) && + (name_inst.GetOperand(1).AsString() == name)) { + return id; + } + } + } + } + return 0; +} + +uint32_t CombineVariantDefs(const std::vector& variant_defs, + const std::vector var_ids, + IRContext* context, + std::map, uint32_t>& cache) { + assert(var_ids.size() <= variant_defs.size()); + uint32_t spec_const_comb_id = 0; + if (var_ids.size() != variant_defs.size()) { + // if not used by all variants + if (cache.find(var_ids) == cache.end()) { + // cache variant combinations + std::vector spec_const_ids; + for (const auto& var_id : var_ids) { + const auto var_name = variant_defs[var_id].GetName(); + const auto var_spec_id = + FindSpecConstByName(context->module(), var_name); + spec_const_ids.push_back(var_spec_id); + } + spec_const_comb_id = + CombineIds(context, spec_const_ids, spv::Op::OpLogicalOr); + assert(spec_const_comb_id != 0); + cache.insert({var_ids, spec_const_comb_id}); + } else { + spec_const_comb_id = cache[var_ids]; + } + } + return spec_const_comb_id; +} + +bool strToInt(std::string s, uint32_t* x) { + for (const char& c : s) { + if (c < '0' || c > '9') { + return false; + } + } + if (!(std::stringstream(s) >> *x)) { + return false; + } + return true; +} + +} // anonymous namespace + +bool VariantDefs::ProcessFnVar(const LinkerOptions& options, + const std::vector& modules) { + assert(variant_defs_.empty()); + assert(modules.size() == options.GetInFiles().size()); + + for (size_t i = 0; i < modules.size(); ++i) { + const auto* feat_mgr = modules[i]->context()->get_feature_mgr(); + if ((feat_mgr->HasCapability(spv::Capability::FunctionVariantsINTEL)) || + (feat_mgr->HasCapability(spv::Capability::SpecConditionalINTEL)) || + (feat_mgr->HasExtension(kSPV_INTEL_function_variants))) { + // In principle, it can be done but it's complicated due to having to + // combine the existing conditionals with the new ones. For example, + // conditional capabilities would need to become "doubly-conditional". + err_ << "Creating multitarget modules from multitarget modules is not " + "supported. Offending file: " + << options.GetInFiles()[i]; + return false; + } + } + + std::vector> target_rows; + std::vector> architecture_rows; + + if (!options.GetFnVarTargetsCsv().empty()) { + const std::vector tgt_cols = {"module", "target", "features"}; + if (!ParseCsv(options.GetFnVarTargetsCsv(), tgt_cols, err_, target_rows)) { + return false; + } + } + + if (!options.GetFnVarArchitecturesCsv().empty()) { + const std::vector arch_cols = {"module", "category", "family", + "op", "architecture"}; + if (!ParseCsv(options.GetFnVarArchitecturesCsv(), arch_cols, err_, + architecture_rows)) { + return false; + } + } + + // check that all modules defined in the CSV exist + + for (const auto& tgt_vals : target_rows) { + bool found = false; + for (const auto& in_file : options.GetInFiles()) { + if (tgt_vals[0] == in_file) { + found = true; + } + } + if (!found) { + err_ << "Module '" << tgt_vals[0] + << "' found in targets CSV not passed to the CLI."; + return false; + } + } + + for (const auto& arch_vals : architecture_rows) { + bool found = false; + for (const auto& in_file : options.GetInFiles()) { + if (arch_vals[0] == in_file) { + found = true; + } + } + if (!found) { + err_ << "Module '" << arch_vals[0] + << "' found in architectures CSV not passed to the CLI."; + return false; + } + } + + // create per-module variant defs + + for (size_t i = 0; i < modules.size(); ++i) { + // first module passed to the CLI is considered the base module + bool is_base = i == 0; + const auto name = options.GetInFiles()[i]; + auto variant_def = VariantDef(is_base, name, modules[i]); + + for (const auto& arch_row : architecture_rows) { + const auto row_name = arch_row[0]; + if (row_name == name) { + uint32_t category, family, op, architecture; + + if (!strToInt(arch_row[1], &category)) { + err_ << "Error converting " << arch_row[1] + << " to architecture category."; + return false; + } + if (!strToInt(arch_row[2], &family)) { + err_ << "Error converting " << arch_row[2] + << " to architecture family."; + return false; + } + if (!strToInt(arch_row[3], &op)) { + err_ << "Error converting " << arch_row[3] << " to architecture op."; + return false; + } + if (!strToInt(arch_row[4], &architecture)) { + err_ << "Error converting " << arch_row[4] << " to architecture."; + return false; + } + + variant_def.AddArchDef(category, family, op, architecture); + } + } + + for (const auto& tgt_row : target_rows) { + const auto row_name = tgt_row[0]; + if (row_name == name) { + uint32_t target; + std::vector features; + + if (!strToInt(tgt_row[1], &target)) { + err_ << "Error converting " << tgt_row[1] << " to target."; + return false; + } + + // get features as FEAT_SEP-delimited integers + + std::stringstream feat_stream(tgt_row[2]); + std::string feat; + while (std::getline(feat_stream, feat, FEAT_SEP)) { + uint32_t ufeat; + // if (!(std::stringstream(feat) >> ufeat)) { + if (!strToInt(feat, &ufeat)) { + err_ << "Error converting " << feat << " in " << tgt_row[2] + << " to target feature."; + return false; + } + features.push_back(ufeat); + } + + variant_def.AddTgtDef(target, features); + } + } + + if (options.GetHasFnVarCapabilities()) { + variant_def.InferCapabilities(); + } + + variant_defs_.push_back(variant_def); + } + + return true; +} + +bool VariantDefs::ProcessVariantDefs() { + EnsureBoolType(); + CollectVarInsts(); + if (!GenerateFnVarConstants()) { + return false; + } + CollectBaseFnCalls(); + return true; +} + +void VariantDefs::GenerateHeader(IRContext* linked_context) { + linked_context->AddCapability(spv::Capability::SpecConditionalINTEL); + linked_context->AddCapability(spv::Capability::FunctionVariantsINTEL); + linked_context->AddExtension(std::string(FNVAR_EXT_NAME)); + + // Specifies used registry version + auto inst = + std::make_unique(linked_context, spv::Op::OpModuleProcessed); + std::stringstream line; + line << "SPV_INTEL_function_variants registry version " + << FNVAR_REGISTRY_VERSION; + inst->AddOperand( + {SPV_OPERAND_TYPE_LITERAL_STRING, utils::MakeVector(line.str())}); + linked_context->AddDebug3Inst(std::move(inst)); +} + +void VariantDefs::CombineVariantInstructions(IRContext* linked_context) { + CombineBaseFnCalls(linked_context); + CombineInstructions(linked_context); +} + +void VariantDefs::EnsureBoolType() { + for (auto& variant_def : variant_defs_) { + Module* module = variant_def.GetModule(); + IRContext* context = module->context(); + + uint32_t bool_id = FindIdOfBoolType(module); + if (bool_id == 0) { + bool_id = context->TakeNextId(); + auto variant_bool = std::make_unique( + context, spv::Op::OpTypeBool, 0, bool_id, + std::initializer_list{}); + module->AddType(std::move(variant_bool)); + } + } +} + +void VariantDefs::CollectVarInsts() { + for (size_t i = 0; i < variant_defs_.size(); ++i) { + const auto variant_def = variant_defs_[i]; + const auto* var_mod = variant_def.GetModule(); + + var_mod->ForEachInst([this, &i](const Instruction* inst) { + if (CanBeFnVarCombined(inst)) { + const size_t inst_hash = HashInst(inst); + if (fnvar_usage_.find(inst_hash) == fnvar_usage_.end()) { + fnvar_usage_.insert({inst_hash, {i}}); + } else { + assert(fnvar_usage_[inst_hash].size() < variant_defs_.size()); + fnvar_usage_[inst_hash].push_back(i); + } + } + }); + } +} + +bool VariantDefs::GenerateFnVarConstants() { + assert(variant_defs_.size() > 0); + assert(variant_defs_[0].IsBase()); + + if (variant_defs_.size() == 1) { + return true; + } + + for (auto& variant_def : variant_defs_) { + Module* module = variant_def.GetModule(); + IRContext* context = module->context(); + + uint32_t bool_id = FindIdOfBoolType(module); + if (bool_id == 0) { + // add a bool type if not present already + bool_id = context->TakeNextId(); + auto variant_bool = std::make_unique( + context, spv::Op::OpTypeBool, 0, bool_id, + std::initializer_list{}); + module->AddType(std::move(variant_bool)); + } + + // Spec constant architecture and target + + std::vector spec_const_arch_ids; + for (const auto& arch_def : variant_def.GetArchDefs()) { + const uint32_t spec_const_arch_id = context->TakeNextId(); + spec_const_arch_ids.push_back(spec_const_arch_id); + + auto inst = std::make_unique( + context, spv::Op::OpSpecConstantArchitectureINTEL, bool_id, + spec_const_arch_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {arch_def.category}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {arch_def.family}}, + // Using spec op opcode here expects then next operand to be + // a type: + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {arch_def.op}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {arch_def.architecture}}, + }); + module->AddType(std::move(inst)); + } + + std::vector spec_const_tgt_ids; + for (const auto& tgt_def : variant_def.GetTgtDefs()) { + const uint32_t spec_const_tgt_id = context->TakeNextId(); + spec_const_tgt_ids.push_back(spec_const_tgt_id); + + auto inst = std::make_unique( + context, spv::Op::OpSpecConstantTargetINTEL, bool_id, + spec_const_tgt_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {tgt_def.target}}, + }); + for (const auto& feat : tgt_def.features) { + inst->AddOperand({SPV_OPERAND_TYPE_LITERAL_INTEGER, {feat}}); + } + module->AddType(std::move(inst)); + } + + std::vector spec_const_ids; + + // Spec constant capabilities + + const auto variant_capabilities = variant_def.GetCapabilities(); + if (!variant_capabilities.empty()) { + const uint32_t spec_const_cap_id = context->TakeNextId(); + auto inst = std::make_unique( + context, spv::Op::OpSpecConstantCapabilitiesINTEL, bool_id, + spec_const_cap_id, std::initializer_list{}); + for (const auto& cap : variant_capabilities) { + inst->AddOperand({SPV_OPERAND_TYPE_CAPABILITY, {uint32_t(cap)}}); + } + module->AddType(std::move(inst)); + spec_const_ids.push_back(spec_const_cap_id); + } + + // Combine architectures such that, for the same module, those with the same + // category and family are combined with AND and different cat/fam are + // combined with OR. + // This lets you create combinations like "architecture between X and Y". + + // map (category, family) -> IDs + std::map, std::vector> arch_map_and; + + for (size_t i = 0; i < spec_const_arch_ids.size(); ++i) { + const auto& arch_def = variant_def.GetArchDefs()[i]; + const auto id = spec_const_arch_ids[i]; + const auto key = std::make_pair(arch_def.category, arch_def.family); + if (arch_map_and.find(key) == arch_map_and.end()) { + arch_map_and[key] = {id}; + } else { + arch_map_and[key].push_back(id); + } + } + + std::vector arch_ids_or; + for (const auto& it : arch_map_and) { + const auto id = CombineIds(context, it.second, spv::Op::OpLogicalAnd); + if (id > 0) { + arch_ids_or.push_back(id); + } + } + + const uint32_t spec_const_arch_id = + CombineIds(context, arch_ids_or, spv::Op::OpLogicalOr); + if (spec_const_arch_id > 0) { + spec_const_ids.push_back(spec_const_arch_id); + } + + const uint32_t spec_const_tgt_id = + CombineIds(context, spec_const_tgt_ids, spv::Op::OpLogicalOr); + if (spec_const_tgt_id > 0) { + spec_const_ids.push_back(spec_const_tgt_id); + } + + uint32_t combined_spec_const_id = + CombineIds(context, spec_const_ids, spv::Op::OpLogicalAnd); + if (combined_spec_const_id == 0) { + // If the variant module has no constraints, use SpecConstantTrue + combined_spec_const_id = context->TakeNextId(); + auto inst = std::make_unique( + context, spv::Op::OpSpecConstantTrue, bool_id, combined_spec_const_id, + std::initializer_list{}); + context->module()->AddType(std::move(inst)); + } + assert(combined_spec_const_id != 0); + + // Add a name the combined boolean ID so we can look it up after the IDs are + // shifted + auto inst = std::make_unique(context, spv::Op::OpName); + inst->AddOperand({SPV_OPERAND_TYPE_ID, {combined_spec_const_id}}); + std::vector str_words; + utils::AppendToVector(variant_def.GetName(), &str_words); + inst->AddOperand({SPV_OPERAND_TYPE_LITERAL_STRING, {str_words}}); + module->AddDebug2Inst(std::move(inst)); + + // Annotate all instructions in the types section (eg. constants) with + // ConditionalINTEL, unless they can be shared between variant_defs_ (eg. + // types). Spec constants are excluded because they might have been + // generated by this extension. + for (const auto& type_inst : module->types_values()) { + if (!CanBeFnVarCombined(&type_inst) && + !spvOpcodeIsSpecConstant(type_inst.opcode())) { + DecorateConditional(context, type_inst.result_id(), + combined_spec_const_id); + } + } + } + + // Annotate functions with ConditionalINTEL + + for (const auto& base_fn : *variant_defs_[0].GetModule()) { + // For each function of the base module, find matching variant functions in + // other modules + + auto base_fn_name = GetFnName(base_fn.DefInst()); + if (base_fn_name.empty()) { + err_ << "Could not find name of a function " << base_fn.result_id() + << " in a base module " << variant_defs_[0].GetName() + << ". To be usable by SPV_INTEL_function_variants, a function " + "must either have an entry point or an export " + "LinkAttribute decoration."; + return false; + } + + bool base_fn_needs_conditional = false; + for (size_t i = 1; i < variant_defs_.size(); ++i) { + const auto& variant_def = variant_defs_[i]; + auto* variant_module = variant_def.GetModule(); + auto* variant_context = variant_module->context(); + + for (const auto& var_fn : *variant_module) { + auto var_fn_name = GetFnName(var_fn.DefInst()); + if (var_fn_name.empty()) { + err_ << "Could not find name of a function " << var_fn.result_id() + << " in a base module " << variant_def.GetName() + << ". To be usable by SPV_INTEL_function_variants, a function " + "must either have an entry point or an export " + "LinkAttribute decoration."; + return false; + } + + if (base_fn_name == var_fn_name) { + base_fn_needs_conditional = true; + } + + // each function in a variant module gets a ConditionalINTEL decoration + + uint32_t spec_const_id = + FindSpecConstByName(variant_module, variant_def.GetName()); + assert(spec_const_id != 0); + DecorateConditional(variant_context, var_fn.result_id(), spec_const_id); + ConvertEPToConditional(variant_module, var_fn, spec_const_id); + } + } + + if (base_fn_needs_conditional) { + // only a base function that has a variant in another module gets a + // ConditionalINTEL decoration, the others are common for all + // variant_defs_ + auto* base_module = variant_defs_[0].GetModule(); + auto* base_context = base_module->context(); + uint32_t spec_const_id = + FindSpecConstByName(base_module, variant_defs_[0].GetName()); + assert(spec_const_id != 0); + DecorateConditional(base_context, base_fn.result_id(), spec_const_id); + ConvertEPToConditional(base_module, base_fn, spec_const_id); + } + } + + return true; +} + +void VariantDefs::CollectBaseFnCalls() { + auto* base_mod = variant_defs_[0].GetModule(); + assert(variant_defs_[0].IsBase()); + const auto* base_def_use_mgr = base_mod->context()->get_def_use_mgr(); + + base_mod->ForEachInst([this, &base_def_use_mgr](const Instruction* inst) { + if (inst->opcode() == spv::Op::OpFunctionCall) { + // For each function call in base module, get the function name + const auto fn_id = inst->GetOperand(2).AsId(); + const auto* called_fn_inst = base_def_use_mgr->GetDef(fn_id); + assert(called_fn_inst != nullptr); + const auto called_fn_name = GetFnName(*called_fn_inst); + assert(!called_fn_name.empty()); + + std::vector> called_fns; + for (size_t i = 1; i < variant_defs_.size(); ++i) { + // ... then see in which variant the called function was defined + const auto& variant_def = variant_defs_[i]; + assert(!variant_def.IsBase()); + + for (const auto& fn : *variant_def.GetModule()) { + const auto fn_name = GetFnName(fn.DefInst()); + if (fn_name == called_fn_name) { + called_fns.push_back(std::make_pair(variant_def.GetName(), &fn)); + } + } + } + + if (!called_fns.empty()) { + base_fn_calls_[inst->result_id()] = called_fns; + } + } + }); +} + +void VariantDefs::CombineBaseFnCalls(IRContext* linked_context) { + for (auto kv : base_fn_calls_) { + const uint32_t call_id = kv.first; + const auto called_fns = kv.second; + + if (called_fns.empty()) { + return; + } + + opt::BasicBlock* fn_call_bb = linked_context->get_instr_block(call_id); + + Instruction* found_call_inst = nullptr; + auto bb_iter = fn_call_bb->begin(); + while (bb_iter != fn_call_bb->end() && found_call_inst == nullptr) { + if (bb_iter->HasResultId() && bb_iter->result_id() == call_id) { + found_call_inst = &*bb_iter; + } + ++bb_iter; + } + + if (found_call_inst == nullptr) { + return; + } + + const auto base_spec_const_id = FindSpecConstByName( + variant_defs_[0].GetModule(), variant_defs_[0].GetName()); + const auto base_type_op = found_call_inst->context() + ->get_def_use_mgr() + ->GetDef(found_call_inst->type_id()) + ->opcode(); + const auto base_call_id = found_call_inst->result_id(); + + // decorate the base call with ConditionalINTEL + DecorateConditional(linked_context, base_call_id, base_spec_const_id); + + // Add OpFunctionCall for each variant + Instruction* last_inst = found_call_inst; + std::vector> var_call_ids; + for (const auto& kv2 : called_fns) { + const std::string var_name = kv2.first; + const opt::Function* fn = kv2.second; + const uint32_t spec_const_id = + FindSpecConstByName(linked_context->module(), var_name); + assert(spec_const_id != 0); + const uint32_t var_call_id = linked_context->TakeNextId(); + var_call_ids.push_back(std::make_pair(spec_const_id, var_call_id)); + + auto* var_call_inst = found_call_inst->Clone(linked_context); + var_call_inst->SetResultId(var_call_id); + var_call_inst->SetOperand(2, {fn->result_id()}); + var_call_inst->InsertAfter(last_inst); + linked_context->set_instr_block(var_call_inst, fn_call_bb); + last_inst = var_call_inst; + + // decorate the variant call with ConditionalINTEL + DecorateConditional(linked_context, var_call_id, spec_const_id); + } + + if (base_type_op != spv::Op::OpTypeVoid) { + // Add OpConditionalCopyObjectINTEL combining the function calls + const uint32_t result_id = linked_context->TakeNextId(); + auto conditional_copy_inst = new Instruction( + linked_context, spv::Op::OpConditionalCopyObjectINTEL, + found_call_inst->type_id(), result_id, + {{SPV_OPERAND_TYPE_ID, {base_spec_const_id}}, + {SPV_OPERAND_TYPE_ID, {found_call_inst->result_id()}}}); + + for (const auto& kv3 : var_call_ids) { + const auto spec_const_id = kv3.first; + const auto var_call_id = kv3.second; + conditional_copy_inst->AddOperand( + {SPV_OPERAND_TYPE_ID, {spec_const_id}}); + conditional_copy_inst->AddOperand({SPV_OPERAND_TYPE_ID, {var_call_id}}); + } + conditional_copy_inst->InsertAfter(last_inst); + linked_context->set_instr_block(conditional_copy_inst, fn_call_bb); + last_inst = conditional_copy_inst; + + // In all remaining instructions within the basic block, replace all + // usages of the base call ID with the result of + // OpConditionalCopyObjectINTEL + do { + last_inst = last_inst->NextNode(); + last_inst->ForEachInId([base_call_id, result_id](uint32_t* id) { + if (*id == base_call_id) { + *id = result_id; + } + }); + } while (last_inst != nullptr && *last_inst != *fn_call_bb->tail()); + } + } + + // Combine spec consts for the base module (base module is activated if all + // variant defs are inactive AND the base module constraints are satisfied) + + std::vector var_spec_const_ids; + for (const auto& variant_def : variant_defs_) { + if (variant_def.IsBase()) { + continue; + } + + const auto id = + FindSpecConstByName(linked_context->module(), variant_def.GetName()); + assert(id != 0); + var_spec_const_ids.push_back(id); + } + const uint32_t base_or_id = + CombineIds(linked_context, var_spec_const_ids, spv::Op::OpLogicalOr); + + if (base_or_id != 0) { + const uint32_t bool_id = FindIdOfBoolType(linked_context->module()); + assert(bool_id != 0); + + const uint32_t base_not_id = linked_context->TakeNextId(); + auto spec_const_op_inst = std::make_unique( + linked_context, spv::Op::OpSpecConstantOp, bool_id, base_not_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER, + {(uint32_t)(spv::Op::OpLogicalNot)}}, + {SPV_OPERAND_TYPE_ID, {base_or_id}}}); + linked_context->module()->AddType(std::move(spec_const_op_inst)); + + // Update any ConditionalINTEL annotations, names and entry points + // referencing the old spec const ID to use the new one + + const uint32_t old_base_spec_const_id = FindSpecConstByName( + linked_context->module(), variant_defs_[0].GetName()); + assert(old_base_spec_const_id != 0); + const uint32_t base_spec_const_id = + CombineIds(linked_context, {old_base_spec_const_id, base_not_id}, + spv::Op::OpLogicalAnd); + + for (auto& annot_inst : linked_context->module()->annotations()) { + if ((annot_inst.GetSingleWordOperand(1) == + uint32_t(spv::Decoration::ConditionalINTEL)) && + (annot_inst.GetOperand(2).AsId() == old_base_spec_const_id)) { + annot_inst.SetOperand(2, {base_spec_const_id}); + } + } + + for (auto& name_inst : linked_context->module()->debugs2()) { + if ((name_inst.opcode() == spv::Op::OpName) && + (name_inst.GetOperand(0).AsId() == old_base_spec_const_id)) { + name_inst.SetOperand(0, {base_spec_const_id}); + } + } + + for (auto& ep_inst : linked_context->module()->entry_points()) { + if ((ep_inst.opcode() == spv::Op::OpConditionalEntryPointINTEL) && + (ep_inst.GetOperand(0).AsId() == old_base_spec_const_id)) { + ep_inst.SetOperand(0, {base_spec_const_id}); + } + } + + linked_context->module()->ForEachInst( + [old_base_spec_const_id, base_spec_const_id](Instruction* inst) { + if (inst->opcode() == spv::Op::OpConditionalCopyObjectINTEL) { + inst->ForEachInId( + [old_base_spec_const_id, base_spec_const_id](uint32_t* id) { + if (*id == old_base_spec_const_id) { + *id = base_spec_const_id; + } + }); + } + }); + } +} + +void VariantDefs::CombineInstructions(IRContext* linked_context) { + // cache for existing variant ID combinations + std::map, uint32_t> spec_const_comb_ids; + + linked_context->module()->ForEachInst( + [this, &linked_context, &spec_const_comb_ids](Instruction* inst) { + if (!CanBeFnVarCombined(inst)) { + return; + } + + const size_t inst_hash = HashInst(inst); + if (fnvar_usage_.find(inst_hash) != fnvar_usage_.end()) { + const std::vector var_ids = fnvar_usage_[inst_hash]; + const uint32_t spec_const_comb_id = CombineVariantDefs( + variant_defs_, var_ids, linked_context, spec_const_comb_ids); + if (spec_const_comb_id != 0) { + if (inst->HasResultId()) { + DecorateConditional(linked_context, inst->result_id(), + spec_const_comb_id); + } else if (inst->opcode() == spv::Op::OpCapability) { + const uint32_t cap = inst->GetSingleWordOperand(0); + inst->SetOpcode(spv::Op::OpConditionalCapabilityINTEL); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {spec_const_comb_id}}, + {SPV_OPERAND_TYPE_CAPABILITY, {cap}}}); + } else if (inst->opcode() == spv::Op::OpExtension) { + const std::string ext_name = inst->GetOperand(0).AsString(); + inst->SetOpcode(spv::Op::OpConditionalExtensionINTEL); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {spec_const_comb_id}}, + {SPV_OPERAND_TYPE_LITERAL_STRING, + {utils::MakeVector(ext_name)}}}); + } else { + assert(false && "Unsupported"); + } + } + } + }); +} + +} // namespace spvtools diff --git a/third_party/spirv-tools/source/link/fnvar.h b/third_party/spirv-tools/source/link/fnvar.h new file mode 100644 index 0000000000..49db030b1b --- /dev/null +++ b/third_party/spirv-tools/source/link/fnvar.h @@ -0,0 +1,244 @@ +// Copyright 2025 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Implementation of generating multitarget modules according to the +// *SPV_INTEL_function_variants* extension +// +// Multitarget module is generated by linking separate modules: a base module +// and variant modules containing device-specific variants of the functions in +// the base module. The behavior is controlled by Comma-Separated Values (CSV) +// files passed to the following flags: +// --fnvar-targets: Required columns: +// module - module file name +// target - device target ISA value +// features - feature values for the target separated by '/' (FEAT_SEP) +// --fnvar-architectures: Required columns: +// module - module file name +// category - device category value +// family - device family value +// op - opcode of the comparison instruction +// architecture - device architecture +// The values (except module) are decimal strings with their meaning defined in +// the 'targets registry' as described in the extension spec. The decimal +// strings may only encode unsigned 32-bit integers (characters 0-9), possibly +// with leading zeros. +// +// In addition, --fnvar-capabilities generates OpSpecConstantCapabilitiesINTEL +// for each module with operands corresponding to the module's capabilities. +// +// Each line in the targets/architectures CSV file defines one +// OpSpecConstantINTEL instruction, the columns correspond +// to the operands of these instructions. One module can have multiple lines, in +// which case they are combined into a single boolean spec constant using +// OpSpecConstantOp and OpLogicalOr (except when category and family in the +// architectures CSV are the same, then the lines are combined with +// OpLogicalAnd). For example, the following architectures CSV +// +// module,category,family,op,architecture +// foo.spv,1,7,174,1 +// foo.spv,1,7,178,3 +// foo.spv,1,8,170,1 +// +// is combined as follows: +// +// %53 = OpSpecConstantArchitectureINTEL %bool 1 7 174 1 +// %54 = OpSpecConstantArchitectureINTEL %bool 1 7 178 3 +// %55 = OpSpecConstantArchitectureINTEL %bool 1 8 170 1 +// %56 = OpSpecConstantOp %bool LogicalAnd %53 %54 +// %foo_spv = OpSpecConstantOp %bool LogicalOr %55 %56 +// +// The %foo_spv is annotated with OpName "foo.spv" (the module's name) which +// serves as an identifier to find the constant later. We cannot use IDs for it +// because the IDs get shifted during linking. +// +// The first module passed to `spirv-link` is considered the 'base' module. For +// example, if base module defines functions 'foo' and 'bar' and the other +// modules define only 'foo', only the 'foo' is treated as a function variant +// guarded by spec constants. The 'bar' function will be untouched and therefore +// present for all variants. The function variants are matched by name, and +// therefore they must either have an entry point, or an Export linkage +// attribute. + +#ifndef FNVAR_H +#define FNVAR_H + +#include +#include +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "spirv-tools/linker.hpp" + +namespace spvtools { + +using opt::IRContext; +using opt::Module; + +// Map of instruction hash -> which variants are using the instruction (denoted +// by the index to the variants vector) +using FnVarUsage = std::unordered_map>; + +// Map of base function call ID -> variant functions corresponding to the +// called function (along with the variant name) +using BaseFnCalls = + std::map>>; + +constexpr char FNVAR_EXT_NAME[] = "SPV_INTEL_function_variants"; +constexpr uint32_t FNVAR_REGISTRY_VERSION = 0; +constexpr char FEAT_SEP = '/'; + +struct FnVarArchDef { + uint32_t category; + uint32_t family; + uint32_t op; + uint32_t architecture; +}; + +struct FnVarTargetDef { + uint32_t target; + std::vector features; +}; + +// Definition of a variant +// +// Stores architecture and target definitions inferred from lines in the CSV +// files for a single module (as well as a pointer to the Module). +class VariantDef { + public: + VariantDef(bool isbase, std::string nm, Module* mod) + : is_base(isbase), name(nm), module(mod) {} + + bool IsBase() const { return this->is_base; } + std::string GetName() const { return this->name; } + Module* GetModule() const { return this->module; } + + void AddArchDef(uint32_t category, uint32_t family, uint32_t op, + uint32_t architecture) { + FnVarArchDef arch_def; + arch_def.category = category; + arch_def.family = family; + arch_def.op = op; + arch_def.architecture = architecture; + this->arch_defs.push_back(arch_def); + } + const std::vector& GetArchDefs() const { + return this->arch_defs; + } + + void AddTgtDef(uint32_t target, std::vector features) { + FnVarTargetDef tgt_def; + tgt_def.target = target; + tgt_def.features = features; + this->tgt_defs.push_back(tgt_def); + } + const std::vector& GetTgtDefs() const { + return this->tgt_defs; + } + + void InferCapabilities() { + for (const auto& cap_inst : module->capabilities()) { + capabilities.insert(spv::Capability(cap_inst.GetOperand(0).words[0])); + } + } + const std::set& GetCapabilities() const { + return this->capabilities; + } + + private: + bool is_base; + std::string name; + Module* module; + std::vector tgt_defs; + std::vector arch_defs; + std::set capabilities; +}; + +// Collection of VariantDef instances +// +// Apart from being a wrapper around a vector of VariantDef instances, it +// defines the main API for generating SPV_INTEL_function_variants instructions +// based on the CSV files. +class VariantDefs { + public: + // Returns last error message. + std::string GetErr() { return err_.str(); } + + // Processes CSV files passed to the CLI and populate _variants. + // + // Returns true on success, false on error. + bool ProcessFnVar(const LinkerOptions& options, + const std::vector& modules); + + // Analyses each variant def module and generates those instructions that are + // module-specific, ie., not requiring knowledge from other modules. + // + // Returns true on success, false on error. + bool ProcessVariantDefs(); + + // Generates basic instructions required for this extension to work. + void GenerateHeader(IRContext* linked_context); + + // Generates instructions from this extension that result from combining + // several variant def modules. + void CombineVariantInstructions(IRContext* linked_context); + + private: + // Adds a boolean type to every module if there is none. + // + // These are necessary for spec constants. + void EnsureBoolType(); + + // Collects which combinable instructions are defined in which modules + void CollectVarInsts(); + + // Generates OpSpecConstantINTEL and + // combines them as necessary. Also converts entry points to conditional ones + // and decorates module-specific instructions with ConditionalINTEL. + // + // Returns true on success, false on error. + bool GenerateFnVarConstants(); + + // Determines which functions in the base module are called by which function + // variants. + void CollectBaseFnCalls(); + + // Combines OpFunctionCall instructions collected with CollectBaseFnCalls() + // using conditional copy. + void CombineBaseFnCalls(IRContext* linked_context); + + // Decorates instructions shared between modules with ConditionalINTEL or + // generates conditional capabilities and extensions, depending on which + // variants are used by each. + void CombineInstructions(IRContext* linked_context); + + // Accumulates all errors encountered during processing. + std::stringstream err_; + + // Collection of VariantDef instances + std::vector variant_defs_; + + // Used for combining OpFunctionCall instructions + BaseFnCalls base_fn_calls_; + + // Used for determining which function variant uses which (applicable) + // instruction + FnVarUsage fnvar_usage_; +}; + +} // namespace spvtools + +#endif // FNVAR_H diff --git a/third_party/spirv-tools/source/link/linker.cpp b/third_party/spirv-tools/source/link/linker.cpp index 5fb4478f43..002cc41f18 100644 --- a/third_party/spirv-tools/source/link/linker.cpp +++ b/third_party/spirv-tools/source/link/linker.cpp @@ -15,9 +15,10 @@ #include "spirv-tools/linker.hpp" #include +#include #include #include -#include +#include #include #include #include @@ -26,18 +27,17 @@ #include #include +#include "fnvar.h" #include "source/diagnostic.h" #include "source/opt/build_module.h" #include "source/opt/compact_ids_pass.h" #include "source/opt/decoration_manager.h" #include "source/opt/ir_builder.h" -#include "source/opt/ir_loader.h" #include "source/opt/pass_manager.h" #include "source/opt/remove_duplicates_pass.h" #include "source/opt/remove_unused_interface_variables_pass.h" #include "source/opt/type_manager.h" #include "source/spirv_constant.h" -#include "source/spirv_target_env.h" #include "source/table2.h" #include "source/util/make_unique.h" #include "source/util/string_utils.h" @@ -328,7 +328,10 @@ spv_result_t MergeModules(const MessageConsumer& consumer, for (const auto& module : input_modules) for (const auto& inst : module->entry_points()) { const uint32_t model = inst.GetSingleWordInOperand(0); - const std::string name = inst.GetInOperand(2).AsString(); + const std::string name = + inst.opcode() == spv::Op::OpConditionalEntryPointINTEL + ? inst.GetOperand(3).AsString() + : inst.GetOperand(2).AsString(); const auto i = std::find_if( entry_points.begin(), entry_points.end(), [model, name](const std::pair& v) { @@ -728,8 +731,7 @@ spv_result_t VerifyLimits(const MessageConsumer& consumer, if (max_id_bound >= SPV_LIMIT_RESULT_ID_BOUND) DiagnosticStream({0u, 0u, 4u}, consumer, "", SPV_WARNING) << "The minimum limit of IDs, " << (SPV_LIMIT_RESULT_ID_BOUND - 1) - << ", was exceeded:" - << " " << max_id_bound << " is the current ID bound.\n" + << ", was exceeded: " << max_id_bound << " is the current ID bound.\n" << "The resulting module might not be supported by all " "implementations."; @@ -740,8 +742,8 @@ spv_result_t VerifyLimits(const MessageConsumer& consumer, if (num_global_values >= SPV_LIMIT_GLOBAL_VARIABLES_MAX) DiagnosticStream(position, consumer, "", SPV_WARNING) << "The minimum limit of global values, " - << (SPV_LIMIT_GLOBAL_VARIABLES_MAX - 1) << ", was exceeded;" - << " " << num_global_values << " global values were found.\n" + << (SPV_LIMIT_GLOBAL_VARIABLES_MAX - 1) << ", was exceeded; " + << num_global_values << " global values were found.\n" << "The resulting module might not be supported by all " "implementations."; @@ -853,6 +855,22 @@ spv_result_t Link(const Context& context, const uint32_t* const* binaries, ir_contexts.push_back(std::move(ir_context)); } + const bool make_multitarget = !options.GetFnVarArchitecturesCsv().empty() || + !options.GetFnVarTargetsCsv().empty(); + + VariantDefs variant_defs; + + if (make_multitarget) { + if (!variant_defs.ProcessFnVar(options, modules)) { + return DiagnosticStream(position, consumer, "", SPV_ERROR_FNVAR) + << variant_defs.GetErr(); + } + if (!variant_defs.ProcessVariantDefs()) { + return DiagnosticStream(position, consumer, "", SPV_ERROR_FNVAR) + << variant_defs.GetErr(); + } + } + // Phase 1: Shift the IDs used in each binary so that they occupy a disjoint // range from the other binaries, and compute the new ID bound. uint32_t max_id_bound = 0u; @@ -866,6 +884,10 @@ spv_result_t Link(const Context& context, const uint32_t* const* binaries, IRContext linked_context(c_context->target_env, consumer); linked_context.module()->SetHeader(header); + if (make_multitarget) { + variant_defs.GenerateHeader(&linked_context); + } + // Phase 3: Merge all the binaries into a single one. res = MergeModules(consumer, modules, &linked_context); if (res != SPV_SUCCESS) return res; @@ -882,6 +904,10 @@ spv_result_t Link(const Context& context, const uint32_t* const* binaries, opt::Pass::Status pass_res = manager.Run(&linked_context); if (pass_res == opt::Pass::Status::Failure) return SPV_ERROR_INVALID_DATA; + if (make_multitarget) { + variant_defs.CombineVariantInstructions(&linked_context); + } + // Phase 5: Find the import/export pairs LinkageTable linkings_to_do; res = GetImportExportPairs(consumer, linked_context, diff --git a/third_party/spirv-tools/source/lint/CMakeLists.txt b/third_party/spirv-tools/source/lint/CMakeLists.txt index 4704beb1fc..c2636ae55c 100644 --- a/third_party/spirv-tools/source/lint/CMakeLists.txt +++ b/third_party/spirv-tools/source/lint/CMakeLists.txt @@ -20,11 +20,6 @@ set(SPIRV_TOOLS_LINT_SOURCES lint_divergent_derivatives.cpp ) -if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))) - # Enable parallel builds across four cores for this lib. - add_definitions(/MP4) -endif() - add_library(SPIRV-Tools-lint ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_LINT_SOURCES}) spvtools_default_compile_options(SPIRV-Tools-lint) diff --git a/third_party/spirv-tools/source/opcode.cpp b/third_party/spirv-tools/source/opcode.cpp index 665574aa1d..c69f7e49ec 100644 --- a/third_party/spirv-tools/source/opcode.cpp +++ b/third_party/spirv-tools/source/opcode.cpp @@ -120,6 +120,9 @@ int32_t spvOpcodeIsSpecConstant(const spv::Op opcode) { case spv::Op::OpSpecConstantComposite: case spv::Op::OpSpecConstantCompositeReplicateEXT: case spv::Op::OpSpecConstantOp: + case spv::Op::OpSpecConstantArchitectureINTEL: + case spv::Op::OpSpecConstantTargetINTEL: + case spv::Op::OpSpecConstantCapabilitiesINTEL: return true; default: return false; @@ -144,6 +147,13 @@ int32_t spvOpcodeIsConstant(const spv::Op opcode) { case spv::Op::OpSpecConstantCompositeReplicateEXT: case spv::Op::OpSpecConstantOp: case spv::Op::OpSpecConstantStringAMDX: + case spv::Op::OpGraphConstantARM: + case spv::Op::OpAsmTargetINTEL: + case spv::Op::OpAsmINTEL: + case spv::Op::OpSpecConstantArchitectureINTEL: + case spv::Op::OpSpecConstantTargetINTEL: + case spv::Op::OpSpecConstantCapabilitiesINTEL: + case spv::Op::OpConstantSizeOfEXT: return true; default: return false; @@ -174,7 +184,7 @@ int32_t spvOpcodeIsComposite(const spv::Op opcode) { case spv::Op::OpTypeRuntimeArray: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: return true; default: return false; @@ -189,8 +199,10 @@ bool spvOpcodeReturnsLogicalVariablePointer(const spv::Op opcode) { case spv::Op::OpInBoundsAccessChain: case spv::Op::OpUntypedAccessChainKHR: case spv::Op::OpUntypedInBoundsAccessChainKHR: + case spv::Op::OpBufferPointerEXT: case spv::Op::OpFunctionParameter: case spv::Op::OpImageTexelPointer: + case spv::Op::OpUntypedImageTexelPointerEXT: case spv::Op::OpCopyObject: case spv::Op::OpAllocateNodePayloadsAMDX: case spv::Op::OpSelect: @@ -215,8 +227,10 @@ int32_t spvOpcodeReturnsLogicalPointer(const spv::Op opcode) { case spv::Op::OpInBoundsAccessChain: case spv::Op::OpUntypedAccessChainKHR: case spv::Op::OpUntypedInBoundsAccessChainKHR: + case spv::Op::OpBufferPointerEXT: case spv::Op::OpFunctionParameter: case spv::Op::OpImageTexelPointer: + case spv::Op::OpUntypedImageTexelPointerEXT: case spv::Op::OpCopyObject: case spv::Op::OpRawAccessChainNV: case spv::Op::OpAllocateNodePayloadsAMDX: @@ -253,17 +267,20 @@ int32_t spvOpcodeGeneratesType(spv::Op op) { case spv::Op::OpTypeAccelerationStructureNV: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: // case spv::Op::OpTypeAccelerationStructureKHR: covered by // spv::Op::OpTypeAccelerationStructureNV case spv::Op::OpTypeRayQueryKHR: case spv::Op::OpTypeHitObjectNV: + case spv::Op::OpTypeHitObjectEXT: case spv::Op::OpTypeUntypedPointerKHR: case spv::Op::OpTypeNodePayloadArrayAMDX: case spv::Op::OpTypeTensorLayoutNV: case spv::Op::OpTypeTensorViewNV: case spv::Op::OpTypeTensorARM: case spv::Op::OpTypeTaskSequenceINTEL: + case spv::Op::OpTypeGraphARM: + case spv::Op::OpTypeBufferEXT: return true; default: // In particular, OpTypeForwardPointer does not generate a type, @@ -279,6 +296,7 @@ bool spvOpcodeIsDecoration(const spv::Op opcode) { case spv::Op::OpDecorate: case spv::Op::OpDecorateId: case spv::Op::OpMemberDecorate: + case spv::Op::OpMemberDecorateIdEXT: case spv::Op::OpGroupDecorate: case spv::Op::OpGroupMemberDecorate: case spv::Op::OpDecorateStringGOOGLE: diff --git a/third_party/spirv-tools/source/operand.cpp b/third_party/spirv-tools/source/operand.cpp index d7fc535ce2..1b43733c3b 100644 --- a/third_party/spirv-tools/source/operand.cpp +++ b/third_party/spirv-tools/source/operand.cpp @@ -523,11 +523,15 @@ std::function spvOperandCanBeForwardDeclaredFunction( case spv::Op::OpSelectionMerge: case spv::Op::OpDecorate: case spv::Op::OpMemberDecorate: + case spv::Op::OpMemberDecorateIdEXT: case spv::Op::OpDecorateId: case spv::Op::OpDecorateStringGOOGLE: case spv::Op::OpMemberDecorateStringGOOGLE: case spv::Op::OpBranch: case spv::Op::OpLoopMerge: + case spv::Op::OpConditionalEntryPointINTEL: + case spv::Op::OpConditionalCapabilityINTEL: + case spv::Op::OpConditionalExtensionINTEL: out = [](unsigned) { return true; }; break; case spv::Op::OpGroupDecorate: @@ -578,6 +582,9 @@ std::function spvOperandCanBeForwardDeclaredFunction( // approximate, due to variable operands out = [](unsigned index) { return index > 6; }; break; + case spv::Op::OpGraphEntryPointARM: + out = [](unsigned index) { return index == 0; }; + break; default: out = [](unsigned) { return false; }; break; diff --git a/third_party/spirv-tools/source/opt/CMakeLists.txt b/third_party/spirv-tools/source/opt/CMakeLists.txt index 7cba4a03da..ff32dfaaa5 100644 --- a/third_party/spirv-tools/source/opt/CMakeLists.txt +++ b/third_party/spirv-tools/source/opt/CMakeLists.txt @@ -59,6 +59,7 @@ set(SPIRV_TOOLS_OPT_SOURCES fold_spec_constant_op_and_composite_pass.h freeze_spec_constant_value_pass.h function.h + graph.h graphics_robust_access_pass.h if_conversion.h inline_exhaustive_pass.h @@ -181,6 +182,7 @@ set(SPIRV_TOOLS_OPT_SOURCES fold_spec_constant_op_and_composite_pass.cpp freeze_spec_constant_value_pass.cpp function.cpp + graph.cpp graphics_robust_access_pass.cpp if_conversion.cpp inline_exhaustive_pass.cpp @@ -255,20 +257,15 @@ set(SPIRV_TOOLS_OPT_SOURCES wrap_opkill.cpp ) -if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))) - # Enable parallel builds across four cores for this lib - add_definitions(/MP4) -endif() - spvtools_pch(SPIRV_TOOLS_OPT_SOURCES pch_source_opt) -if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) +if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) list(APPEND SPIRV_TOOLS_OPT_SOURCES ${spirv-tools_SOURCE_DIR}/source/mimalloc.cpp) endif() add_library(SPIRV-Tools-opt ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_OPT_SOURCES}) -if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) +if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) target_link_libraries(SPIRV-Tools-opt PRIVATE mimalloc-static) endif() @@ -290,7 +287,7 @@ spvtools_check_symbol_exports(SPIRV-Tools-opt) if(ENABLE_SPIRV_TOOLS_INSTALL) set(SPIRV-Tools-opt-InstallTargets SPIRV-Tools-opt) - if (SPIRV_TOOLS_USE_MIMALLOC AND NOT SPIRV_TOOLS_BUILD_STATIC) + if (SPIRV_TOOLS_USE_MIMALLOC AND (NOT SPIRV_TOOLS_BUILD_STATIC OR SPIRV_TOOLS_USE_MIMALLOC_IN_STATIC_BUILD)) list(APPEND SPIRV-Tools-opt-InstallTargets mimalloc-static) endif() diff --git a/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp b/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp index acd8fe2e2c..09234963b9 100644 --- a/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp @@ -44,6 +44,8 @@ constexpr uint32_t kExtInstSetInIdx = 0; constexpr uint32_t kExtInstOpInIdx = 1; constexpr uint32_t kInterpolantInIdx = 2; constexpr uint32_t kCooperativeMatrixLoadSourceAddrInIdx = 0; +constexpr uint32_t kDebugDeclareVariableInIdx = 3; +constexpr uint32_t kDebugValueValueInIdx = 3; // Sorting functor to present annotation instructions in an easy-to-process // order. The functor orders by opcode first and falls back on unique id @@ -270,17 +272,93 @@ void AggressiveDCEPass::AddBreaksAndContinuesToWorklist( }); } -bool AggressiveDCEPass::AggressiveDCE(Function* func) { - if (func->IsDeclaration()) return false; +Pass::Status AggressiveDCEPass::AggressiveDCE(Function* func) { + if (func->IsDeclaration()) return Pass::Status::SuccessWithoutChange; std::list structured_order; cfg()->ComputeStructuredOrder(func, &*func->begin(), &structured_order); live_local_vars_.clear(); InitializeWorkList(func, structured_order); ProcessWorkList(func); + if (ProcessDebugInformation(structured_order) == Pass::Status::Failure) + return Pass::Status::Failure; + ProcessWorkList(func); return KillDeadInstructions(func, structured_order); } -bool AggressiveDCEPass::KillDeadInstructions( +Pass::Status AggressiveDCEPass::ProcessDebugInformation( + std::list& structured_order) { + for (auto bi = structured_order.begin(); bi != structured_order.end(); bi++) { + bool succeeded = (*bi)->WhileEachInst([this](Instruction* inst) { + if (!inst->IsNonSemanticInstruction()) return true; + + if (inst->GetShader100DebugOpcode() == + NonSemanticShaderDebugInfo100DebugDeclare) { + if (IsLive(inst)) return true; + + uint32_t var_id = + inst->GetSingleWordInOperand(kDebugDeclareVariableInIdx); + auto var_def = get_def_use_mgr()->GetDef(var_id); + + if (IsLive(var_def)) { + AddToWorklist(inst); + return true; + } + + // DebugDeclare Variable is not live. Find the value that was being + // stored to this variable. If it's live then create a new DebugValue + // with this value. Otherwise let it die in peace. + get_def_use_mgr()->ForEachUser(var_id, [this, + var_id](Instruction* user) { + if (user->opcode() == spv::Op::OpStore) { + uint32_t stored_value_id = 0; + const uint32_t kStoreValueInIdx = 1; + stored_value_id = user->GetSingleWordInOperand(kStoreValueInIdx); + if (!IsLive(get_def_use_mgr()->GetDef(stored_value_id))) { + return true; + } + + // value being stored is still live + Instruction* next_inst = user->NextNode(); + bool added = + context()->get_debug_info_mgr()->AddDebugValueForVariable( + user, var_id, stored_value_id, user); + if (added && next_inst) { + auto new_debug_value = next_inst->PreviousNode(); + AddToWorklist(new_debug_value); + } + } + return true; + }); + } else if (inst->GetShader100DebugOpcode() == + NonSemanticShaderDebugInfo100DebugValue) { + uint32_t var_operand_idx = kDebugValueValueInIdx; + uint32_t id = inst->GetSingleWordInOperand(var_operand_idx); + auto def = get_def_use_mgr()->GetDef(id); + + if (IsLive(def)) { + AddToWorklist(inst); + return true; + } + + // Value operand of DebugValue is not live + // Set Value to Undef of appropriate type + uint32_t type_id = def->type_id(); + uint32_t undef_id = Type2Undef(type_id); + if (undef_id == 0) return false; + + inst->SetInOperand(var_operand_idx, {undef_id}); + context()->get_def_use_mgr()->AnalyzeInstUse(inst); + AddToWorklist(inst); + } + return true; + }); + + if (!succeeded) return Pass::Status::Failure; + } + return Pass::Status::SuccessWithoutChange; +} + +Pass::Status AggressiveDCEPass::KillDeadInstructions( const Function* func, std::list& structured_order) { bool modified = false; for (auto bi = structured_order.begin(); bi != structured_order.end();) { @@ -315,6 +393,9 @@ bool AggressiveDCEPass::KillDeadInstructions( // Find an undef for the return value and make sure it gets kept by // the pass. auto undef_id = Type2Undef(func->type_id()); + if (undef_id == 0) { + return Pass::Status::Failure; + } auto undef = get_def_use_mgr()->GetDef(undef_id); live_insts_.Set(undef->unique_id()); merge_terminator->SetOpcode(spv::Op::OpReturnValue); @@ -333,7 +414,8 @@ bool AggressiveDCEPass::KillDeadInstructions( ++bi; } } - return modified; + return modified ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; } void AggressiveDCEPass::ProcessWorkList(Function* func) { @@ -593,7 +675,7 @@ void AggressiveDCEPass::InitializeWorkList( } } -void AggressiveDCEPass::InitializeModuleScopeLiveInstructions() { +Pass::Status AggressiveDCEPass::InitializeModuleScopeLiveInstructions() { // Keep all execution modes. for (auto& exec : get_module()->execution_modes()) { AddToWorklist(&exec); @@ -668,19 +750,26 @@ void AggressiveDCEPass::InitializeModuleScopeLiveInstructions() { } if (debug_global_seen) { auto dbg_none = context()->get_debug_info_mgr()->GetDebugInfoNone(); + if (dbg_none == nullptr) { + return Pass::Status::Failure; + } AddToWorklist(dbg_none); } - // Add top level DebugInfo to worklist + // Add DebugInfo which should never be eliminated to worklist for (auto& dbg : get_module()->ext_inst_debuginfo()) { auto op = dbg.GetShader100DebugOpcode(); if (op == NonSemanticShaderDebugInfo100DebugCompilationUnit || op == NonSemanticShaderDebugInfo100DebugEntryPoint || op == NonSemanticShaderDebugInfo100DebugSource || - op == NonSemanticShaderDebugInfo100DebugSourceContinued) { + op == NonSemanticShaderDebugInfo100DebugSourceContinued || + op == NonSemanticShaderDebugInfo100DebugLocalVariable || + op == NonSemanticShaderDebugInfo100DebugExpression || + op == NonSemanticShaderDebugInfo100DebugOperation) { AddToWorklist(&dbg); } } + return Pass::Status::SuccessWithoutChange; } Pass::Status AggressiveDCEPass::ProcessImpl() { @@ -708,7 +797,9 @@ Pass::Status AggressiveDCEPass::ProcessImpl() { // Eliminate Dead functions. bool modified = EliminateDeadFunctions(); - InitializeModuleScopeLiveInstructions(); + if (InitializeModuleScopeLiveInstructions() == Pass::Status::Failure) { + return Pass::Status::Failure; + } // Run |AggressiveDCE| on the remaining functions. The order does not matter, // since |AggressiveDCE| is intra-procedural. This can mean that function @@ -716,7 +807,13 @@ Pass::Status AggressiveDCEPass::ProcessImpl() { // function will still be in the module after this pass. We expect this to be // rare. for (Function& fp : *context()->module()) { - modified |= AggressiveDCE(&fp); + Pass::Status function_status = AggressiveDCE(&fp); + if (function_status == Pass::Status::Failure) { + return Pass::Status::Failure; + } + if (function_status == Pass::Status::SuccessWithChange) { + modified = true; + } } // If the decoration manager is kept live then the context will try to keep it @@ -744,7 +841,9 @@ Pass::Status AggressiveDCEPass::ProcessImpl() { // Cleanup all CFG including all unreachable blocks. for (Function& fp : *context()->module()) { - modified |= CFGCleanup(&fp); + auto status = CFGCleanup(&fp); + if (status == Status::Failure) return Status::Failure; + if (status == Status::SuccessWithChange) modified = true; } return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; @@ -1021,6 +1120,7 @@ void AggressiveDCEPass::InitExtensions() { "SPV_NV_shader_subgroup_partitioned", "SPV_EXT_demote_to_helper_invocation", "SPV_EXT_descriptor_indexing", + "SPV_EXT_descriptor_heap", "SPV_NV_fragment_shader_barycentric", "SPV_NV_compute_shader_derivatives", "SPV_NV_shader_image_footprint", @@ -1054,6 +1154,7 @@ void AggressiveDCEPass::InitExtensions() { "SPV_NV_shader_invocation_reorder", "SPV_NV_cluster_acceleration_structure", "SPV_NV_linear_swept_spheres", + "SPV_KHR_maximal_reconvergence", }); } diff --git a/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h b/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h index fbe08ad03d..12a5ff7328 100644 --- a/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h +++ b/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h @@ -85,8 +85,10 @@ class AggressiveDCEPass : public MemPass { } // Adds entry points, execution modes and workgroup size decorations to the - // worklist for processing with the first function. - void InitializeModuleScopeLiveInstructions(); + // worklist for processing with the first function. Returns + // Pass::Status::Failure if it could not create a required debug instruction. + // Returns Pass::Status::SuccessWithoutChange otherwise. + Pass::Status InitializeModuleScopeLiveInstructions(); // Add |inst| to worklist_ and live_insts_. void AddToWorklist(Instruction* inst) { @@ -136,7 +138,7 @@ class AggressiveDCEPass : public MemPass { // existing control structures will remain. This can leave not-insignificant // sequences of ultimately useless code. // TODO(): Remove useless control constructs. - bool AggressiveDCE(Function* func); + Pass::Status AggressiveDCE(Function* func); Pass::Status ProcessImpl(); @@ -150,9 +152,21 @@ class AggressiveDCEPass : public MemPass { // will be empty at the end. void ProcessWorkList(Function* func); + // Process each DebugDeclare and DebugValue in |func| that has not been + // marked as live in the work list. DebugDeclare's are marked live now, and + // DebugValue Value operands are set to OpUndef. The work list will be empty + // at the end. + // Returns Pass::Status::Failure if it could not create an OpUndef. + // Otherwise, returns Pass::Status::SuccessWithChange if it made changes, + Pass::Status ProcessDebugInformation( + std::list& structured_order); + // Kills any instructions in |func| that have not been marked as live. - bool KillDeadInstructions(const Function* func, - std::list& structured_order); + // Returns Pass::Status::Failure if it could not create an OpUndef. + // Otherwise, returns Pass::Status::SuccessWithChange if it made changes, + // and Pass::Status::SuccessWithoutChange otherwise. + Pass::Status KillDeadInstructions(const Function* func, + std::list& structured_order); // Adds the instructions that define the operands of |inst| to the work list. void AddOperandsToWorkList(const Instruction* inst); diff --git a/third_party/spirv-tools/source/opt/amd_ext_to_khr.cpp b/third_party/spirv-tools/source/opt/amd_ext_to_khr.cpp index 085751b883..7ad2f986b6 100644 --- a/third_party/spirv-tools/source/opt/amd_ext_to_khr.cpp +++ b/third_party/spirv-tools/source/opt/amd_ext_to_khr.cpp @@ -76,6 +76,7 @@ bool ReplaceTrinaryMinMax(IRContext* ctx, Instruction* inst, Instruction* temp = ir_builder.AddNaryExtendedInstruction( inst->type_id(), glsl405_ext_inst_id, opcode, {op1, op2}); + if (temp == nullptr) return false; Instruction::OperandList new_operands; new_operands.push_back({SPV_OPERAND_TYPE_ID, {glsl405_ext_inst_id}}); @@ -114,9 +115,12 @@ bool ReplaceTrinaryMid(IRContext* ctx, Instruction* inst, Instruction* min = ir_builder.AddNaryExtendedInstruction( inst->type_id(), glsl405_ext_inst_id, static_cast(min_opcode), {op2, op3}); + if (min == nullptr) return false; + Instruction* max = ir_builder.AddNaryExtendedInstruction( inst->type_id(), glsl405_ext_inst_id, static_cast(max_opcode), {op2, op3}); + if (max == nullptr) return false; Instruction::OperandList new_operands; new_operands.push_back({SPV_OPERAND_TYPE_ID, {glsl405_ext_inst_id}}); @@ -226,55 +230,81 @@ bool ReplaceSwizzleInvocations(IRContext* ctx, Instruction* inst, // Get the subgroup invocation id. uint32_t var_id = ctx->GetBuiltinInputVarId( uint32_t(spv::BuiltIn::SubgroupLocalInvocationId)); - assert(var_id != 0 && "Could not get SubgroupLocalInvocationId variable."); + if (var_id == 0) return false; Instruction* var_inst = ctx->get_def_use_mgr()->GetDef(var_id); + if (var_inst == nullptr) return false; Instruction* var_ptr_type = ctx->get_def_use_mgr()->GetDef(var_inst->type_id()); + if (var_ptr_type == nullptr) return false; uint32_t uint_type_id = var_ptr_type->GetSingleWordInOperand(1); + if (uint_type_id == 0) return false; Instruction* id = ir_builder.AddLoad(uint_type_id, var_id); + if (id == nullptr) return false; uint32_t quad_mask = ir_builder.GetUintConstantId(3); + if (quad_mask == 0) return false; // This gives the offset in the group of 4 of this invocation. Instruction* quad_idx = ir_builder.AddBinaryOp( uint_type_id, spv::Op::OpBitwiseAnd, id->result_id(), quad_mask); + if (quad_idx == nullptr) return false; // Get the invocation id of the first invocation in the group of 4. Instruction* quad_ldr = ir_builder.AddBinaryOp(uint_type_id, spv::Op::OpBitwiseXor, id->result_id(), quad_idx->result_id()); + if (quad_ldr == nullptr) return false; // Get the offset of the target invocation from the offset vector. Instruction* my_offset = ir_builder.AddBinaryOp(uint_type_id, spv::Op::OpVectorExtractDynamic, offset_id, quad_idx->result_id()); + if (my_offset == nullptr) return false; // Determine the index of the invocation to read from. Instruction* target_inv = ir_builder.AddBinaryOp(uint_type_id, spv::Op::OpIAdd, quad_ldr->result_id(), my_offset->result_id()); + if (target_inv == nullptr) return false; // Do the group operations uint32_t uint_max_id = ir_builder.GetUintConstantId(0xFFFFFFFF); + if (uint_max_id == 0) return false; uint32_t subgroup_scope = ir_builder.GetUintConstantId(uint32_t(spv::Scope::Subgroup)); + if (subgroup_scope == 0) return false; + const auto* vec_type = type_mgr->GetUIntVectorType(4); + if (vec_type == nullptr) return false; const auto* ballot_value_const = const_mgr->GetConstant( - type_mgr->GetUIntVectorType(4), - {uint_max_id, uint_max_id, uint_max_id, uint_max_id}); + vec_type, {uint_max_id, uint_max_id, uint_max_id, uint_max_id}); + if (ballot_value_const == nullptr) return false; Instruction* ballot_value = const_mgr->GetDefiningInstruction(ballot_value_const); + if (ballot_value == nullptr) return false; + uint32_t bool_type_id = type_mgr->GetBoolTypeId(); + if (bool_type_id == 0) return false; Instruction* is_active = ir_builder.AddNaryOp( - type_mgr->GetBoolTypeId(), spv::Op::OpGroupNonUniformBallotBitExtract, + bool_type_id, spv::Op::OpGroupNonUniformBallotBitExtract, {subgroup_scope, ballot_value->result_id(), target_inv->result_id()}); + if (is_active == nullptr) return false; Instruction* shuffle = ir_builder.AddNaryOp(inst->type_id(), spv::Op::OpGroupNonUniformShuffle, {subgroup_scope, data_id, target_inv->result_id()}); + if (shuffle == nullptr) return false; // Create the null constant to use in the select. - const auto* null = const_mgr->GetConstant(type_mgr->GetType(inst->type_id()), - std::vector()); + const auto* result_type = type_mgr->GetType(inst->type_id()); + if (result_type == nullptr) return false; + const auto* null = + const_mgr->GetConstant(result_type, std::vector()); + if (null == nullptr) { + return false; + } Instruction* null_inst = const_mgr->GetDefiningInstruction(null); + if (null_inst == nullptr) { + return false; + } // Build the select. inst->SetOpcode(spv::Op::OpSelect); @@ -339,59 +369,85 @@ bool ReplaceSwizzleInvocationsMasked( uint32_t data_id = inst->GetSingleWordInOperand(2); Instruction* mask_inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(3)); + if (mask_inst == nullptr) return false; assert(mask_inst->opcode() == spv::Op::OpConstantComposite && "The mask is suppose to be a vector constant."); assert(mask_inst->NumInOperands() == 3 && "The mask is suppose to have 3 components."); uint32_t uint_x = mask_inst->GetSingleWordInOperand(0); + if (uint_x == 0) return false; uint32_t uint_y = mask_inst->GetSingleWordInOperand(1); + if (uint_y == 0) return false; uint32_t uint_z = mask_inst->GetSingleWordInOperand(2); + if (uint_z == 0) return false; // Get the subgroup invocation id. uint32_t var_id = ctx->GetBuiltinInputVarId( uint32_t(spv::BuiltIn::SubgroupLocalInvocationId)); + if (var_id == 0) return false; ctx->AddExtension("SPV_KHR_shader_ballot"); - assert(var_id != 0 && "Could not get SubgroupLocalInvocationId variable."); Instruction* var_inst = ctx->get_def_use_mgr()->GetDef(var_id); + if (var_inst == nullptr) return false; Instruction* var_ptr_type = ctx->get_def_use_mgr()->GetDef(var_inst->type_id()); + if (var_ptr_type == nullptr) return false; uint32_t uint_type_id = var_ptr_type->GetSingleWordInOperand(1); + if (uint_type_id == 0) return false; Instruction* id = ir_builder.AddLoad(uint_type_id, var_id); + if (id == nullptr) return false; // Do the bitwise operations. uint32_t mask_extended = ir_builder.GetUintConstantId(0xFFFFFFE0); + if (mask_extended == 0) return false; Instruction* and_mask = ir_builder.AddBinaryOp( uint_type_id, spv::Op::OpBitwiseOr, uint_x, mask_extended); + if (and_mask == nullptr) return false; Instruction* and_result = ir_builder.AddBinaryOp(uint_type_id, spv::Op::OpBitwiseAnd, id->result_id(), and_mask->result_id()); + if (and_result == nullptr) return false; Instruction* or_result = ir_builder.AddBinaryOp( uint_type_id, spv::Op::OpBitwiseOr, and_result->result_id(), uint_y); + if (or_result == nullptr) return false; Instruction* target_inv = ir_builder.AddBinaryOp( uint_type_id, spv::Op::OpBitwiseXor, or_result->result_id(), uint_z); + if (target_inv == nullptr) return false; // Do the group operations uint32_t uint_max_id = ir_builder.GetUintConstantId(0xFFFFFFFF); + if (uint_max_id == 0) return false; uint32_t subgroup_scope = ir_builder.GetUintConstantId(uint32_t(spv::Scope::Subgroup)); + if (subgroup_scope == 0) return false; + const auto* vec_type = type_mgr->GetUIntVectorType(4); + if (vec_type == nullptr) return false; const auto* ballot_value_const = const_mgr->GetConstant( - type_mgr->GetUIntVectorType(4), - {uint_max_id, uint_max_id, uint_max_id, uint_max_id}); + vec_type, {uint_max_id, uint_max_id, uint_max_id, uint_max_id}); + if (ballot_value_const == nullptr) return false; Instruction* ballot_value = const_mgr->GetDefiningInstruction(ballot_value_const); + if (ballot_value == nullptr) return false; + uint32_t bool_type_id = type_mgr->GetBoolTypeId(); + if (bool_type_id == 0) return false; Instruction* is_active = ir_builder.AddNaryOp( - type_mgr->GetBoolTypeId(), spv::Op::OpGroupNonUniformBallotBitExtract, + bool_type_id, spv::Op::OpGroupNonUniformBallotBitExtract, {subgroup_scope, ballot_value->result_id(), target_inv->result_id()}); + if (is_active == nullptr) return false; Instruction* shuffle = ir_builder.AddNaryOp(inst->type_id(), spv::Op::OpGroupNonUniformShuffle, {subgroup_scope, data_id, target_inv->result_id()}); + if (shuffle == nullptr) return false; // Create the null constant to use in the select. - const auto* null = const_mgr->GetConstant(type_mgr->GetType(inst->type_id()), - std::vector()); + const auto* result_type = type_mgr->GetType(inst->type_id()); + if (result_type == nullptr) return false; + const auto* null = + const_mgr->GetConstant(result_type, std::vector()); + if (null == nullptr) return false; Instruction* null_inst = const_mgr->GetDefiningInstruction(null); + if (null_inst == nullptr) return false; // Build the select. inst->SetOpcode(spv::Op::OpSelect); @@ -425,23 +481,28 @@ bool ReplaceWriteInvocation(IRContext* ctx, Instruction* inst, const std::vector&) { uint32_t var_id = ctx->GetBuiltinInputVarId( uint32_t(spv::BuiltIn::SubgroupLocalInvocationId)); - ctx->AddCapability(spv::Capability::SubgroupBallotKHR); - ctx->AddExtension("SPV_KHR_shader_ballot"); - assert(var_id != 0 && "Could not get SubgroupLocalInvocationId variable."); + if (var_id == 0) return false; Instruction* var_inst = ctx->get_def_use_mgr()->GetDef(var_id); + if (var_inst == nullptr) return false; Instruction* var_ptr_type = ctx->get_def_use_mgr()->GetDef(var_inst->type_id()); + if (var_ptr_type == nullptr) return false; + ctx->AddCapability(spv::Capability::SubgroupBallotKHR); + ctx->AddExtension("SPV_KHR_shader_ballot"); InstructionBuilder ir_builder( ctx, inst, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); Instruction* t = ir_builder.AddLoad(var_ptr_type->GetSingleWordInOperand(1), var_id); + if (t == nullptr) return false; analysis::Bool bool_type; uint32_t bool_type_id = ctx->get_type_mgr()->GetTypeInstruction(&bool_type); + if (bool_type_id == 0) return false; Instruction* cmp = ir_builder.AddBinaryOp(bool_type_id, spv::Op::OpIEqual, t->result_id(), inst->GetSingleWordInOperand(4)); + if (cmp == nullptr) return false; // Build a select. inst->SetOpcode(spv::Op::OpSelect); @@ -484,7 +545,8 @@ bool ReplaceMbcnt(IRContext* context, Instruction* inst, uint32_t var_id = context->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::SubgroupLtMask)); - assert(var_id != 0 && "Could not get SubgroupLtMask variable."); + if (var_id == 0) return false; + context->AddCapability(spv::Capability::GroupNonUniformBallot); Instruction* var_inst = def_use_mgr->GetDef(var_id); Instruction* var_ptr_type = def_use_mgr->GetDef(var_inst->type_id()); @@ -497,6 +559,7 @@ bool ReplaceMbcnt(IRContext* context, Instruction* inst, analysis::Vector temp_type(GetUIntType(context), 2); const analysis::Type* shuffle_type = context->get_type_mgr()->GetRegisteredType(&temp_type); + if (shuffle_type == nullptr) return false; uint32_t shuffle_type_id = type_mgr->GetTypeInstruction(shuffle_type); uint32_t mask_id = inst->GetSingleWordInOperand(2); @@ -510,13 +573,17 @@ bool ReplaceMbcnt(IRContext* context, Instruction* inst, context, inst, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); Instruction* load = ir_builder.AddLoad(var_type->result_id(), var_id); + if (load == nullptr) return false; Instruction* shuffle = ir_builder.AddVectorShuffle( shuffle_type_id, load->result_id(), load->result_id(), {0, 1}); + if (shuffle == nullptr) return false; Instruction* bitcast = ir_builder.AddUnaryOp( mask_inst->type_id(), spv::Op::OpBitcast, shuffle->result_id()); + if (bitcast == nullptr) return false; Instruction* t = ir_builder.AddBinaryOp(mask_inst->type_id(), spv::Op::OpBitwiseAnd, bitcast->result_id(), mask_id); + if (t == nullptr) return false; inst->SetOpcode(spv::Op::OpBitCount); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {t->result_id()}}}); @@ -571,9 +638,13 @@ bool ReplaceCubeFaceCoord(IRContext* ctx, Instruction* inst, analysis::ConstantManager* const_mgr = ctx->get_constant_mgr(); uint32_t float_type_id = type_mgr->GetFloatTypeId(); + if (float_type_id == 0) return false; const analysis::Type* v2_float_type = type_mgr->GetFloatVectorType(2); + if (v2_float_type == nullptr) return false; uint32_t v2_float_type_id = type_mgr->GetId(v2_float_type); + if (v2_float_type_id == 0) return false; uint32_t bool_id = type_mgr->GetBoolTypeId(); + if (bool_id == 0) return false; InstructionBuilder ir_builder( ctx, inst, @@ -587,20 +658,29 @@ bool ReplaceCubeFaceCoord(IRContext* ctx, Instruction* inst, glsl405_ext_inst_id = ctx->get_feature_mgr()->GetExtInstImportId_GLSLstd450(); } + if (glsl405_ext_inst_id == 0) return false; // Get the constants that will be used. uint32_t f0_const_id = const_mgr->GetFloatConstId(0.0); + if (f0_const_id == 0) return false; uint32_t f2_const_id = const_mgr->GetFloatConstId(2.0); + if (f2_const_id == 0) return false; uint32_t f0_5_const_id = const_mgr->GetFloatConstId(0.5); + if (f0_5_const_id == 0) return false; const analysis::Constant* vec_const = const_mgr->GetConstant(v2_float_type, {f0_5_const_id, f0_5_const_id}); - uint32_t vec_const_id = - const_mgr->GetDefiningInstruction(vec_const)->result_id(); + if (vec_const == nullptr) return false; + Instruction* vec_const_inst = const_mgr->GetDefiningInstruction(vec_const); + if (vec_const_inst == nullptr) return false; + uint32_t vec_const_id = vec_const_inst->result_id(); // Extract the input values. Instruction* x = ir_builder.AddCompositeExtract(float_type_id, input_id, {0}); + if (x == nullptr) return false; Instruction* y = ir_builder.AddCompositeExtract(float_type_id, input_id, {1}); + if (y == nullptr) return false; Instruction* z = ir_builder.AddCompositeExtract(float_type_id, input_id, {2}); + if (z == nullptr) return false; // Negate the input values. Instruction* nx = @@ -609,72 +689,97 @@ bool ReplaceCubeFaceCoord(IRContext* ctx, Instruction* inst, ir_builder.AddUnaryOp(float_type_id, spv::Op::OpFNegate, y->result_id()); Instruction* nz = ir_builder.AddUnaryOp(float_type_id, spv::Op::OpFNegate, z->result_id()); + if (nx == nullptr) return false; + if (ny == nullptr) return false; + if (nz == nullptr) return false; // Get the abolsute values of the inputs. Instruction* ax = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FAbs, {x->result_id()}); + if (ax == nullptr) return false; Instruction* ay = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FAbs, {y->result_id()}); + if (ay == nullptr) return false; Instruction* az = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FAbs, {z->result_id()}); + if (az == nullptr) return false; // Find which values are negative. Used in later computations. Instruction* is_z_neg = ir_builder.AddBinaryOp( bool_id, spv::Op::OpFOrdLessThan, z->result_id(), f0_const_id); + if (is_z_neg == nullptr) return false; Instruction* is_y_neg = ir_builder.AddBinaryOp( bool_id, spv::Op::OpFOrdLessThan, y->result_id(), f0_const_id); + if (is_y_neg == nullptr) return false; Instruction* is_x_neg = ir_builder.AddBinaryOp( bool_id, spv::Op::OpFOrdLessThan, x->result_id(), f0_const_id); + if (is_x_neg == nullptr) return false; // Compute cubema Instruction* amax_x_y = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FMax, {ax->result_id(), ay->result_id()}); + if (amax_x_y == nullptr) return false; Instruction* amax = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FMax, {az->result_id(), amax_x_y->result_id()}); + if (amax == nullptr) return false; Instruction* cubema = ir_builder.AddBinaryOp(float_type_id, spv::Op::OpFMul, f2_const_id, amax->result_id()); + if (cubema == nullptr) return false; // Do the comparisons needed for computing cubesc and cubetc. Instruction* is_z_max = ir_builder.AddBinaryOp(bool_id, spv::Op::OpFOrdGreaterThanEqual, az->result_id(), amax_x_y->result_id()); + if (is_z_max == nullptr) return false; Instruction* not_is_z_max = ir_builder.AddUnaryOp( bool_id, spv::Op::OpLogicalNot, is_z_max->result_id()); + if (not_is_z_max == nullptr) return false; Instruction* y_gr_x = ir_builder.AddBinaryOp(bool_id, spv::Op::OpFOrdGreaterThanEqual, ay->result_id(), ax->result_id()); + if (y_gr_x == nullptr) return false; Instruction* is_y_max = ir_builder.AddBinaryOp(bool_id, spv::Op::OpLogicalAnd, not_is_z_max->result_id(), y_gr_x->result_id()); + if (is_y_max == nullptr) return false; // Select the correct value for cubesc. Instruction* cubesc_case_1 = ir_builder.AddSelect( float_type_id, is_z_neg->result_id(), nx->result_id(), x->result_id()); + if (cubesc_case_1 == nullptr) return false; Instruction* cubesc_case_2 = ir_builder.AddSelect( float_type_id, is_x_neg->result_id(), z->result_id(), nz->result_id()); + if (cubesc_case_2 == nullptr) return false; Instruction* sel = ir_builder.AddSelect(float_type_id, is_y_max->result_id(), x->result_id(), cubesc_case_2->result_id()); + if (sel == nullptr) return false; Instruction* cubesc = ir_builder.AddSelect(float_type_id, is_z_max->result_id(), cubesc_case_1->result_id(), sel->result_id()); + if (cubesc == nullptr) return false; // Select the correct value for cubetc. Instruction* cubetc_case_1 = ir_builder.AddSelect( float_type_id, is_y_neg->result_id(), nz->result_id(), z->result_id()); + if (cubetc_case_1 == nullptr) return false; Instruction* cubetc = ir_builder.AddSelect(float_type_id, is_y_max->result_id(), cubetc_case_1->result_id(), ny->result_id()); + if (cubetc == nullptr) return false; // Do the division Instruction* cube = ir_builder.AddCompositeConstruct( v2_float_type_id, {cubesc->result_id(), cubetc->result_id()}); + if (cube == nullptr) return false; Instruction* denom = ir_builder.AddCompositeConstruct( v2_float_type_id, {cubema->result_id(), cubema->result_id()}); + if (denom == nullptr) return false; Instruction* div = ir_builder.AddBinaryOp( v2_float_type_id, spv::Op::OpFDiv, cube->result_id(), denom->result_id()); + if (div == nullptr) return false; // Get the final result by adding 0.5 to |div|. inst->SetOpcode(spv::Op::OpFAdd); @@ -722,7 +827,9 @@ bool ReplaceCubeFaceIndex(IRContext* ctx, Instruction* inst, analysis::ConstantManager* const_mgr = ctx->get_constant_mgr(); uint32_t float_type_id = type_mgr->GetFloatTypeId(); + if (float_type_id == 0) return false; uint32_t bool_id = type_mgr->GetBoolTypeId(); + if (bool_id == 0) return false; InstructionBuilder ir_builder( ctx, inst, @@ -739,56 +846,79 @@ bool ReplaceCubeFaceIndex(IRContext* ctx, Instruction* inst, // Get the constants that will be used. uint32_t f0_const_id = const_mgr->GetFloatConstId(0.0); + if (f0_const_id == 0) return false; uint32_t f1_const_id = const_mgr->GetFloatConstId(1.0); + if (f1_const_id == 0) return false; uint32_t f2_const_id = const_mgr->GetFloatConstId(2.0); + if (f2_const_id == 0) return false; uint32_t f3_const_id = const_mgr->GetFloatConstId(3.0); + if (f3_const_id == 0) return false; uint32_t f4_const_id = const_mgr->GetFloatConstId(4.0); + if (f4_const_id == 0) return false; uint32_t f5_const_id = const_mgr->GetFloatConstId(5.0); + if (f5_const_id == 0) return false; // Extract the input values. Instruction* x = ir_builder.AddCompositeExtract(float_type_id, input_id, {0}); + if (x == nullptr) return false; Instruction* y = ir_builder.AddCompositeExtract(float_type_id, input_id, {1}); + if (y == nullptr) return false; + // TODO(1-841): Handle id overflow. Instruction* z = ir_builder.AddCompositeExtract(float_type_id, input_id, {2}); + if (z == nullptr) return false; // Get the absolute values of the inputs. Instruction* ax = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FAbs, {x->result_id()}); + if (ax == nullptr) return false; Instruction* ay = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FAbs, {y->result_id()}); + if (ay == nullptr) return false; Instruction* az = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FAbs, {z->result_id()}); + if (az == nullptr) return false; // Find which values are negative. Used in later computations. Instruction* is_z_neg = ir_builder.AddBinaryOp( bool_id, spv::Op::OpFOrdLessThan, z->result_id(), f0_const_id); + if (is_z_neg == nullptr) return false; Instruction* is_y_neg = ir_builder.AddBinaryOp( bool_id, spv::Op::OpFOrdLessThan, y->result_id(), f0_const_id); + if (is_y_neg == nullptr) return false; Instruction* is_x_neg = ir_builder.AddBinaryOp( bool_id, spv::Op::OpFOrdLessThan, x->result_id(), f0_const_id); + if (is_x_neg == nullptr) return false; // Find the max value. Instruction* amax_x_y = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FMax, {ax->result_id(), ay->result_id()}); + if (amax_x_y == nullptr) return false; Instruction* is_z_max = ir_builder.AddBinaryOp(bool_id, spv::Op::OpFOrdGreaterThanEqual, az->result_id(), amax_x_y->result_id()); + if (is_z_max == nullptr) return false; Instruction* y_gr_x = ir_builder.AddBinaryOp(bool_id, spv::Op::OpFOrdGreaterThanEqual, ay->result_id(), ax->result_id()); + if (y_gr_x == nullptr) return false; // Get the value for each case. Instruction* case_z = ir_builder.AddSelect( float_type_id, is_z_neg->result_id(), f5_const_id, f4_const_id); + if (case_z == nullptr) return false; Instruction* case_y = ir_builder.AddSelect( float_type_id, is_y_neg->result_id(), f3_const_id, f2_const_id); + if (case_y == nullptr) return false; Instruction* case_x = ir_builder.AddSelect( float_type_id, is_x_neg->result_id(), f1_const_id, f0_const_id); + if (case_x == nullptr) return false; // Select the correct case. Instruction* sel = ir_builder.AddSelect(float_type_id, y_gr_x->result_id(), case_y->result_id(), case_x->result_id()); + if (sel == nullptr) return false; // Get the final result by adding 0.5 to |div|. inst->SetOpcode(spv::Op::OpSelect); @@ -928,11 +1058,18 @@ Pass::Status AmdExtensionToKhrPass::Process() { std::unique_ptr(new AmdExtFoldingRules(context())), MakeUnique(context())); for (Function& func : *get_module()) { - func.ForEachInst([&changed, &folder](Instruction* inst) { - if (folder.FoldInstruction(inst)) { - changed = true; - } - }); + bool failed = + !func.WhileEachInst([&changed, &folder, this](Instruction* inst) { + if (folder.FoldInstruction(inst)) { + changed = true; + return true; + } else if (context()->id_overflow()) { + return false; + } + return true; + }); + + if (failed) return Status::Failure; } // Now that instruction that require the extensions have been removed, we can diff --git a/third_party/spirv-tools/source/opt/basic_block.cpp b/third_party/spirv-tools/source/opt/basic_block.cpp index a9fc8e2f7b..84cf488490 100644 --- a/third_party/spirv-tools/source/opt/basic_block.cpp +++ b/third_party/spirv-tools/source/opt/basic_block.cpp @@ -29,11 +29,19 @@ constexpr uint32_t kSelectionMergeMergeBlockIdInIdx = 0; } // namespace BasicBlock* BasicBlock::Clone(IRContext* context) const { - BasicBlock* clone = new BasicBlock( - std::unique_ptr(GetLabelInst()->Clone(context))); + Instruction* label_clone = GetLabelInst()->Clone(context); + if (!label_clone) { + return nullptr; + } + BasicBlock* clone = new BasicBlock(std::unique_ptr(label_clone)); for (const auto& inst : insts_) { // Use the incoming context - clone->AddInstruction(std::unique_ptr(inst.Clone(context))); + Instruction* inst_clone = inst.Clone(context); + if (!inst_clone) { + delete clone; + return nullptr; + } + clone->AddInstruction(std::unique_ptr(inst_clone)); } if (context->AreAnalysesValid( diff --git a/third_party/spirv-tools/source/opt/canonicalize_ids_pass.cpp b/third_party/spirv-tools/source/opt/canonicalize_ids_pass.cpp index 658dec5210..22b76e4798 100644 --- a/third_party/spirv-tools/source/opt/canonicalize_ids_pass.cpp +++ b/third_party/spirv-tools/source/opt/canonicalize_ids_pass.cpp @@ -223,7 +223,7 @@ spv::Id CanonicalizeIdsPass::HashTypeAndConst(spv::Id const id) const { // remapper. Support should be added as necessary. case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: case spv::Op::OpTypeHitObjectNV: case spv::Op::OpTypeUntypedPointerKHR: case spv::Op::OpTypeNodePayloadArrayAMDX: @@ -428,6 +428,21 @@ bool CanonicalizeIdsPass::ApplyMap() { } } } + const auto& debug_scope = inst->GetDebugScope(); + if (debug_scope.GetLexicalScope() != kNoDebugScope) { + uint32_t old_scope = debug_scope.GetLexicalScope(); + uint32_t new_scope = GetNewId(old_scope); + uint32_t old_inlined_at = debug_scope.GetInlinedAt(); + uint32_t new_inlined_at = old_inlined_at != kNoInlinedAt + ? GetNewId(old_inlined_at) + : old_inlined_at; + if ((new_scope != unused_ && new_scope != old_scope) || + (new_inlined_at != unused_ && new_inlined_at != old_inlined_at)) { + DebugScope new_debug_scope(new_scope, new_inlined_at); + inst->SetDebugScope(new_debug_scope); + modified = true; + } + } }, true); diff --git a/third_party/spirv-tools/source/opt/ccp_pass.cpp b/third_party/spirv-tools/source/opt/ccp_pass.cpp index 46bfc907de..c53ee1932b 100644 --- a/third_party/spirv-tools/source/opt/ccp_pass.cpp +++ b/third_party/spirv-tools/source/opt/ccp_pass.cpp @@ -165,6 +165,9 @@ SSAPropagator::PropStatus CCPPass::VisitAssignment(Instruction* instr) { context()->get_instruction_folder().FoldInstructionToConstant(instr, map_func); + if (folded_inst && context()->id_overflow()) { + return SSAPropagator::kFailed; + } if (folded_inst != nullptr) { // We do not want to change the body of the function by adding new // instructions. When folding we can only generate new constants. @@ -360,6 +363,13 @@ void CCPPass::Initialize() { } } + // Mark the extended instruction imports as `kVarying`. We know they + // will not be constants, and will be used by `OpExtInst` instructions. + // This allows those instructions to be fully processed. + for (const auto& inst : get_module()->ext_inst_imports()) { + values_[inst.result_id()] = kVaryingSSAId; + } + original_id_bound_ = context()->module()->IdBound(); } @@ -369,6 +379,7 @@ Pass::Status CCPPass::Process() { // Process all entry point functions. ProcessFunction pfn = [this](Function* fp) { return PropagateConstants(fp); }; bool modified = context()->ProcessReachableCallTree(pfn); + if (context()->id_overflow()) return Pass::Status::Failure; return modified ? Pass::Status::SuccessWithChange : Pass::Status::SuccessWithoutChange; } diff --git a/third_party/spirv-tools/source/opt/cfg.cpp b/third_party/spirv-tools/source/opt/cfg.cpp index 4c4bb25689..5f4a7d1c90 100644 --- a/third_party/spirv-tools/source/opt/cfg.cpp +++ b/third_party/spirv-tools/source/opt/cfg.cpp @@ -254,12 +254,13 @@ BasicBlock* CFG::SplitLoopHeader(BasicBlock* bb) { } // Adjust the OpPhi instructions as needed. - bb->ForEachPhiInst([latch_block, bb, new_header, context](Instruction* phi) { + bool ok = bb->WhileEachPhiInst([latch_block, bb, new_header, + context](Instruction* phi) -> bool { std::vector preheader_phi_ops; std::vector header_phi_ops; - // Identify where the original inputs to original OpPhi belong: header or - // preheader. + // Identify where the original inputs to original OpPhi belong: header + // or preheader. for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { uint32_t def_id = phi->GetSingleWordInOperand(i); uint32_t branch_id = phi->GetSingleWordInOperand(i + 1); @@ -272,21 +273,24 @@ BasicBlock* CFG::SplitLoopHeader(BasicBlock* bb) { } } - // Create a phi instruction if and only if the preheader_phi_ops has more - // than one pair. + // Create a phi instruction if and only if the preheader_phi_ops has + // more than one pair. if (preheader_phi_ops.size() > 2) { InstructionBuilder builder( context, &*bb->begin(), IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); Instruction* new_phi = builder.AddPhi(phi->type_id(), preheader_phi_ops); + if (!new_phi) { + return false; + } // Add the OpPhi to the header bb. header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {new_phi->result_id()}}); header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {bb->id()}}); } else { - // An OpPhi with a single entry is just a copy. In this case use the same - // instruction in the new header. + // An OpPhi with a single entry is just a copy. In this case use the + // same instruction in the new header. header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {preheader_phi_ops[0]}}); header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {bb->id()}}); } @@ -297,8 +301,13 @@ BasicBlock* CFG::SplitLoopHeader(BasicBlock* bb) { new_header->begin()->InsertBefore(std::move(phi_owner)); context->set_instr_block(phi, new_header); context->AnalyzeUses(phi); + return true; }); + if (!ok) { + return nullptr; + } + // Add a branch to the new header. InstructionBuilder branch_builder( context, bb, diff --git a/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp b/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp index 26fed89fb1..6cd0479615 100644 --- a/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp +++ b/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp @@ -25,8 +25,17 @@ namespace opt { Pass::Status CFGCleanupPass::Process() { // Process all entry point functions. - ProcessFunction pfn = [this](Function* fp) { return CFGCleanup(fp); }; + bool failure = false; + ProcessFunction pfn = [this, &failure](Function* fp) { + auto status = CFGCleanup(fp); + if (status == Status::Failure) { + failure = true; + return false; + } + return status == Status::SuccessWithChange; + }; bool modified = context()->ProcessReachableCallTree(pfn); + if (failure) return Pass::Status::Failure; return modified ? Pass::Status::SuccessWithChange : Pass::Status::SuccessWithoutChange; } diff --git a/third_party/spirv-tools/source/opt/combine_access_chains.cpp b/third_party/spirv-tools/source/opt/combine_access_chains.cpp index 99ec796252..ec90d97c9c 100644 --- a/third_party/spirv-tools/source/opt/combine_access_chains.cpp +++ b/third_party/spirv-tools/source/opt/combine_access_chains.cpp @@ -27,36 +27,48 @@ Pass::Status CombineAccessChains::Process() { bool modified = false; for (auto& function : *get_module()) { - modified |= ProcessFunction(function); + auto status = ProcessFunction(function); + if (status == Status::Failure) return Status::Failure; + if (status == Status::SuccessWithChange) modified = true; } return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); } -bool CombineAccessChains::ProcessFunction(Function& function) { +Pass::Status CombineAccessChains::ProcessFunction(Function& function) { if (function.IsDeclaration()) { - return false; + return Status::SuccessWithoutChange; } bool modified = false; + bool failure = false; cfg()->ForEachBlockInReversePostOrder( - function.entry().get(), [&modified, this](BasicBlock* block) { - block->ForEachInst([&modified, this](Instruction* inst) { + function.entry().get(), [&modified, &failure, this](BasicBlock* block) { + if (failure) return; + block->ForEachInst([&modified, &failure, this](Instruction* inst) { + if (failure) return; switch (inst->opcode()) { case spv::Op::OpAccessChain: case spv::Op::OpInBoundsAccessChain: case spv::Op::OpPtrAccessChain: - case spv::Op::OpInBoundsPtrAccessChain: - modified |= CombineAccessChain(inst); + case spv::Op::OpInBoundsPtrAccessChain: { + auto status = CombineAccessChain(inst); + if (status == Status::Failure) { + failure = true; + } else if (status == Status::SuccessWithChange) { + modified = true; + } break; + } default: break; } }); }); - return modified; + if (failure) return Status::Failure; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } uint32_t CombineAccessChains::GetConstantValue( @@ -121,9 +133,9 @@ const analysis::Type* CombineAccessChains::GetIndexedType(Instruction* inst) { return type; } -bool CombineAccessChains::CombineIndices(Instruction* ptr_input, - Instruction* inst, - std::vector* new_operands) { +Pass::Status CombineAccessChains::CombineIndices( + Instruction* ptr_input, Instruction* inst, + std::vector* new_operands) { analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); analysis::ConstantManager* constant_mgr = context()->get_constant_mgr(); @@ -150,8 +162,10 @@ bool CombineAccessChains::CombineIndices(Instruction* ptr_input, GetConstantValue(element_constant); const analysis::Constant* new_value_constant = constant_mgr->GetConstant(last_index_constant->type(), {new_value}); + if (!new_value_constant) return Status::Failure; Instruction* new_value_inst = constant_mgr->GetDefiningInstruction(new_value_constant); + if (!new_value_inst) return Status::Failure; new_value_id = new_value_inst->result_id(); } else if (!type->AsStruct() || combining_element_operands) { // Generate an addition of the two indices. @@ -161,16 +175,17 @@ bool CombineAccessChains::CombineIndices(Instruction* ptr_input, Instruction* addition = builder.AddIAdd(last_index_inst->type_id(), last_index_inst->result_id(), element_inst->result_id()); + if (!addition) return Status::Failure; new_value_id = addition->result_id(); } else { // Indexing into structs must be constant, so bail out here. - return false; + return Status::SuccessWithoutChange; } new_operands->push_back({SPV_OPERAND_TYPE_ID, {new_value_id}}); - return true; + return Status::SuccessWithChange; } -bool CombineAccessChains::CreateNewInputOperands( +Pass::Status CombineAccessChains::CreateNewInputOperands( Instruction* ptr_input, Instruction* inst, std::vector* new_operands) { // Start by copying all the input operands of the feeder access chain. @@ -182,7 +197,8 @@ bool CombineAccessChains::CreateNewInputOperands( if (IsPtrAccessChain(inst->opcode())) { // The last index of the feeder should be combined with the element operand // of |inst|. - if (!CombineIndices(ptr_input, inst, new_operands)) return false; + auto status = CombineIndices(ptr_input, inst, new_operands); + if (status != Status::SuccessWithChange) return status; } else { // The indices aren't being combined so now add the last index operand of // |ptr_input|. @@ -196,10 +212,10 @@ bool CombineAccessChains::CreateNewInputOperands( new_operands->push_back(inst->GetInOperand(i)); } - return true; + return Status::SuccessWithChange; } -bool CombineAccessChains::CombineAccessChain(Instruction* inst) { +Pass::Status CombineAccessChains::CombineAccessChain(Instruction* inst) { assert((inst->opcode() == spv::Op::OpPtrAccessChain || inst->opcode() == spv::Op::OpAccessChain || inst->opcode() == spv::Op::OpInBoundsAccessChain || @@ -212,10 +228,11 @@ bool CombineAccessChains::CombineAccessChain(Instruction* inst) { ptr_input->opcode() != spv::Op::OpInBoundsAccessChain && ptr_input->opcode() != spv::Op::OpPtrAccessChain && ptr_input->opcode() != spv::Op::OpInBoundsPtrAccessChain) { - return false; + return Status::SuccessWithoutChange; } - if (Has64BitIndices(inst) || Has64BitIndices(ptr_input)) return false; + if (Has64BitIndices(inst) || Has64BitIndices(ptr_input)) + return Status::SuccessWithoutChange; // Handles the following cases: // 1. |ptr_input| is an index-less access chain. Replace the pointer @@ -237,7 +254,7 @@ bool CombineAccessChains::CombineAccessChain(Instruction* inst) { // size/alignment of the type and converting the stride into an element // index. uint32_t array_stride = GetArrayStride(ptr_input); - if (array_stride != 0) return false; + if (array_stride != 0) return Status::SuccessWithoutChange; if (ptr_input->NumInOperands() == 1) { // The input is effectively a no-op. @@ -249,14 +266,15 @@ bool CombineAccessChains::CombineAccessChain(Instruction* inst) { inst->SetOpcode(spv::Op::OpCopyObject); } else { std::vector new_operands; - if (!CreateNewInputOperands(ptr_input, inst, &new_operands)) return false; + auto status = CreateNewInputOperands(ptr_input, inst, &new_operands); + if (status != Status::SuccessWithChange) return status; // Update the instruction. inst->SetOpcode(UpdateOpcode(inst->opcode(), ptr_input->opcode())); inst->SetInOperands(std::move(new_operands)); context()->AnalyzeUses(inst); } - return true; + return Status::SuccessWithChange; } spv::Op CombineAccessChains::UpdateOpcode(spv::Op base_opcode, diff --git a/third_party/spirv-tools/source/opt/combine_access_chains.h b/third_party/spirv-tools/source/opt/combine_access_chains.h index 32ee50d30d..1872720d7a 100644 --- a/third_party/spirv-tools/source/opt/combine_access_chains.h +++ b/third_party/spirv-tools/source/opt/combine_access_chains.h @@ -40,12 +40,12 @@ class CombineAccessChains : public Pass { private: // Combine access chains in |function|. Blocks are processed in reverse // post-order. Returns true if the function is modified. - bool ProcessFunction(Function& function); + Status ProcessFunction(Function& function); // Combines an access chain (normal, in bounds or pointer) |inst| if its base // pointer is another access chain. Returns true if the access chain was // modified. - bool CombineAccessChain(Instruction* inst); + Status CombineAccessChain(Instruction* inst); // Returns the value of |constant_inst| as a uint32_t. uint32_t GetConstantValue(const analysis::Constant* constant_inst); @@ -59,13 +59,13 @@ class CombineAccessChains : public Pass { // Populates |new_operands| with the operands for the combined access chain. // Returns false if the access chains cannot be combined. - bool CreateNewInputOperands(Instruction* ptr_input, Instruction* inst, - std::vector* new_operands); + Status CreateNewInputOperands(Instruction* ptr_input, Instruction* inst, + std::vector* new_operands); // Combines the last index of |ptr_input| with the element operand of |inst|. // Adds the combined operand to |new_operands|. - bool CombineIndices(Instruction* ptr_input, Instruction* inst, - std::vector* new_operands); + Status CombineIndices(Instruction* ptr_input, Instruction* inst, + std::vector* new_operands); // Returns the opcode to use for the combined access chain. spv::Op UpdateOpcode(spv::Op base_opcode, spv::Op input_opcode); diff --git a/third_party/spirv-tools/source/opt/const_folding_rules.cpp b/third_party/spirv-tools/source/opt/const_folding_rules.cpp index a5d4cbe755..b6dd6810d0 100644 --- a/third_party/spirv-tools/source/opt/const_folding_rules.cpp +++ b/third_party/spirv-tools/source/opt/const_folding_rules.cpp @@ -14,6 +14,8 @@ #include "source/opt/const_folding_rules.h" +#include + #include "source/opt/ir_context.h" namespace spvtools { @@ -829,7 +831,9 @@ const analysis::Constant* FoldFPBinaryOp( // Build the constant object and return it. std::vector ids; for (const analysis::Constant* member : results_components) { - ids.push_back(const_mgr->GetDefiningInstruction(member)->result_id()); + Instruction* def = const_mgr->GetDefiningInstruction(member); + if (!def) return nullptr; + ids.push_back(def->result_id()); } return const_mgr->GetConstant(vector_type, ids); } else { @@ -986,6 +990,32 @@ ConstantFoldingRule FoldFSub() { return FoldFPBinaryOp(FOLD_FPARITH_OP(-)); } ConstantFoldingRule FoldFAdd() { return FoldFPBinaryOp(FOLD_FPARITH_OP(+)); } ConstantFoldingRule FoldFMul() { return FoldFPBinaryOp(FOLD_FPARITH_OP(*)); } +// x - x = 0 +ConstantFoldingRule FoldRedundantSub() { + return [](IRContext* context, Instruction* inst, + const std::vector&) + -> const analysis::Constant* { + assert(inst->opcode() == spv::Op::OpFSub || + inst->opcode() == spv::Op::OpISub); + + if (inst->GetSingleWordInOperand(0) == inst->GetSingleWordInOperand(1)) { + bool use_float = inst->opcode() == spv::Op::OpFSub; + if (use_float && !inst->IsFloatingPointFoldingAllowed()) { + return nullptr; + } + analysis::TypeManager* type_mgr = context->get_type_mgr(); + const analysis::Type* type = type_mgr->GetType(inst->type_id()); + if (type->IsCooperativeMatrix()) { + return nullptr; + } + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + uint32_t null_id = const_mgr->GetNullConstId(type); + return const_mgr->FindDeclaredConstant(null_id); + } + return nullptr; + }; +} + // Returns the constant that results from evaluating |numerator| / 0.0. Returns // |nullptr| if the result could not be evaluated. const analysis::Constant* FoldFPScalarDivideByZero( @@ -1045,6 +1075,107 @@ const analysis::Constant* FoldScalarFPDivide( // Returns the constant folding rule to fold |OpFDiv| with two constants. ConstantFoldingRule FoldFDiv() { return FoldFPBinaryOp(FoldScalarFPDivide); } +// Get a singular uniform value, which is repeated when the |type| is a vector. +const analysis::Constant* GetConstantUniformValue( + analysis::ConstantManager* const_mgr, const analysis::Type* type, + std::optional f = {}, std::optional i = {}) { + const analysis::Constant* uniform = nullptr; + bool is_vector = false; + const analysis::Type* base_type = type; + + if (base_type->AsVector()) { + is_vector = true; + base_type = base_type->AsVector()->element_type(); + } + + if (f && base_type->AsFloat()) { + if (base_type->AsFloat()->width() == 32) { + uniform = const_mgr->GetConstant( + base_type, utils::FloatProxy((float)f.value()).GetWords()); + } else if (base_type->AsFloat()->width() == 64) { + uniform = const_mgr->GetConstant( + base_type, utils::FloatProxy(f.value()).GetWords()); + } + } else if (i && base_type->AsInteger()) { + uniform = + const_mgr->GenerateIntegerConstant(base_type->AsInteger(), i.value()); + } + + if (!uniform) { + return nullptr; + } + + if (is_vector) { + Instruction* uniform_inst = const_mgr->GetDefiningInstruction(uniform); + if (!uniform_inst) return nullptr; + + uint32_t uniform_id = uniform_inst->result_id(); + uniform = + const_mgr->GetConstant(type, std::vector(4, uniform_id)); + } + + return uniform; +} + +// x / x = 1 +// -x / x = -1 +// x / -x = -1 +ConstantFoldingRule FoldRedundantDiv() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + assert(inst->opcode() == spv::Op::OpFDiv || + inst->opcode() == spv::Op::OpSDiv || + inst->opcode() == spv::Op::OpUDiv); + + if (constants[0] || constants[1]) { + return nullptr; + } + + analysis::TypeManager* type_mgr = context->get_type_mgr(); + const analysis::Type* type = type_mgr->GetType(inst->type_id()); + + if (type->IsCooperativeMatrix()) { + return nullptr; + } + + bool use_float = inst->opcode() == spv::Op::OpFDiv; + if (use_float && !inst->IsFloatingPointFoldingAllowed()) { + return nullptr; + } + + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + + if (inst->GetSingleWordInOperand(0) == inst->GetSingleWordInOperand(1)) { + return GetConstantUniformValue(const_mgr, type, 1.0, 1); + } + + if (inst->opcode() == spv::Op::OpUDiv) { + return nullptr; + } + + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + + Instruction* lhs = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + if ((lhs->opcode() == spv::Op::OpSNegate || + lhs->opcode() == spv::Op::OpFNegate) && + lhs->GetSingleWordInOperand(0) == inst->GetSingleWordInOperand(1) && + (!use_float || lhs->IsFloatingPointFoldingAllowed())) { + return GetConstantUniformValue(const_mgr, type, -1.0, UINT64_MAX); + } + + Instruction* rhs = def_use_mgr->GetDef(inst->GetSingleWordInOperand(1)); + if ((rhs->opcode() == spv::Op::OpSNegate || + rhs->opcode() == spv::Op::OpFNegate) && + rhs->GetSingleWordInOperand(0) == inst->GetSingleWordInOperand(0) && + (!use_float || rhs->IsFloatingPointFoldingAllowed())) { + return GetConstantUniformValue(const_mgr, type, -1.0, UINT64_MAX); + } + + return nullptr; + }; +} + bool CompareFloatingPoint(bool op_result, bool op_unordered, bool need_ordered) { if (need_ordered) { @@ -1124,6 +1255,26 @@ ConstantFoldingRule FoldFUnordGreaterThanEqual() { return FoldFPBinaryOp(FOLD_FPCMP_OP(>=, false)); } +ConstantFoldingRule FoldInvariantSelect() { + return [](IRContext*, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + assert(inst->opcode() == spv::Op::OpSelect); + (void)inst; + + if (!constants[1] || !constants[2]) { + return nullptr; + } + if (constants[1] == constants[2]) { + return constants[1]; + } + if (constants[1]->IsZero() && constants[2]->IsZero()) { + return constants[1]; + } + return nullptr; + }; +} + // Folds an OpDot where all of the inputs are constants to a // constant. A new constant is created if necessary. ConstantFoldingRule FoldOpDotWithConstants() { @@ -1395,13 +1546,18 @@ ConstantFoldingRule FoldFMix() { if (base_type->AsFloat()->width() == 32) { one = const_mgr->GetConstant(base_type, utils::FloatProxy(1.0f).GetWords()); - } else { + } else if (base_type->AsFloat()->width() == 64) { one = const_mgr->GetConstant(base_type, utils::FloatProxy(1.0).GetWords()); + } else { + // We won't support folding half types. + return nullptr; } if (is_vector) { - uint32_t one_id = const_mgr->GetDefiningInstruction(one)->result_id(); + Instruction* one_inst = const_mgr->GetDefiningInstruction(one); + if (one_inst == nullptr) return nullptr; + uint32_t one_id = one_inst->result_id(); one = const_mgr->GetConstant(result_type, std::vector(4, one_id)); } @@ -1428,19 +1584,46 @@ ConstantFoldingRule FoldFMix() { }; } +template +static bool NegZeroAwareLessThan(FloatType a, FloatType b) { + if (a == 0.0 && b == 0.0) { + bool sba = std::signbit(a); + bool sbb = std::signbit(b); + if (sba && !sbb) { + return true; + } + } + return a < b; +} + const analysis::Constant* FoldMin(const analysis::Type* result_type, const analysis::Constant* a, const analysis::Constant* b, analysis::ConstantManager*) { if (const analysis::Integer* int_type = result_type->AsInteger()) { - if (int_type->width() == 32) { + if (int_type->width() <= 32) { + assert( + (a->AsIntConstant() != nullptr || a->AsNullConstant() != nullptr) && + "Must be an integer or null constant."); + assert( + (b->AsIntConstant() != nullptr || b->AsNullConstant() != nullptr) && + "Must be an integer or null constant."); + if (int_type->IsSigned()) { - int32_t va = a->GetS32(); - int32_t vb = b->GetS32(); + int32_t va = (a->AsIntConstant() != nullptr) + ? a->AsIntConstant()->GetS32BitValue() + : 0; + int32_t vb = (b->AsIntConstant() != nullptr) + ? b->AsIntConstant()->GetS32BitValue() + : 0; return (va < vb ? a : b); } else { - uint32_t va = a->GetU32(); - uint32_t vb = b->GetU32(); + uint32_t va = (a->AsIntConstant() != nullptr) + ? a->AsIntConstant()->GetU32BitValue() + : 0; + uint32_t vb = (b->AsIntConstant() != nullptr) + ? b->AsIntConstant()->GetU32BitValue() + : 0; return (va < vb ? a : b); } } else if (int_type->width() == 64) { @@ -1458,11 +1641,11 @@ const analysis::Constant* FoldMin(const analysis::Type* result_type, if (float_type->width() == 32) { float va = a->GetFloat(); float vb = b->GetFloat(); - return (va < vb ? a : b); + return NegZeroAwareLessThan(va, vb) ? a : b; } else if (float_type->width() == 64) { double va = a->GetDouble(); double vb = b->GetDouble(); - return (va < vb ? a : b); + return NegZeroAwareLessThan(va, vb) ? a : b; } } return nullptr; @@ -1473,14 +1656,29 @@ const analysis::Constant* FoldMax(const analysis::Type* result_type, const analysis::Constant* b, analysis::ConstantManager*) { if (const analysis::Integer* int_type = result_type->AsInteger()) { - if (int_type->width() == 32) { + if (int_type->width() <= 32) { + assert( + (a->AsIntConstant() != nullptr || a->AsNullConstant() != nullptr) && + "Must be an integer or null constant."); + assert( + (b->AsIntConstant() != nullptr || b->AsNullConstant() != nullptr) && + "Must be an integer or null constant."); + if (int_type->IsSigned()) { - int32_t va = a->GetS32(); - int32_t vb = b->GetS32(); + int32_t va = (a->AsIntConstant() != nullptr) + ? a->AsIntConstant()->GetS32BitValue() + : 0; + int32_t vb = (b->AsIntConstant() != nullptr) + ? b->AsIntConstant()->GetS32BitValue() + : 0; return (va > vb ? a : b); } else { - uint32_t va = a->GetU32(); - uint32_t vb = b->GetU32(); + uint32_t va = (a->AsIntConstant() != nullptr) + ? a->AsIntConstant()->GetU32BitValue() + : 0; + uint32_t vb = (b->AsIntConstant() != nullptr) + ? b->AsIntConstant()->GetU32BitValue() + : 0; return (va > vb ? a : b); } } else if (int_type->width() == 64) { @@ -1498,11 +1696,71 @@ const analysis::Constant* FoldMax(const analysis::Type* result_type, if (float_type->width() == 32) { float va = a->GetFloat(); float vb = b->GetFloat(); - return (va > vb ? a : b); + return NegZeroAwareLessThan(vb, va) ? a : b; } else if (float_type->width() == 64) { double va = a->GetDouble(); double vb = b->GetDouble(); - return (va > vb ? a : b); + return NegZeroAwareLessThan(vb, va) ? a : b; + } + } + return nullptr; +} + +const analysis::Constant* FoldNMin(const analysis::Type* result_type, + const analysis::Constant* a, + const analysis::Constant* b, + analysis::ConstantManager*) { + if (const analysis::Float* float_type = result_type->AsFloat()) { + if (float_type->width() == 32) { + float va = a->GetFloat(); + float vb = b->GetFloat(); + if (std::isnan(va)) { + return b; + } + if (std::isnan(vb)) { + return a; + } + return NegZeroAwareLessThan(va, vb) ? a : b; + } else if (float_type->width() == 64) { + double va = a->GetDouble(); + double vb = b->GetDouble(); + if (std::isnan(va)) { + return b; + } + if (std::isnan(vb)) { + return a; + } + return NegZeroAwareLessThan(va, vb) ? a : b; + } + } + return nullptr; +} + +const analysis::Constant* FoldNMax(const analysis::Type* result_type, + const analysis::Constant* a, + const analysis::Constant* b, + analysis::ConstantManager*) { + if (const analysis::Float* float_type = result_type->AsFloat()) { + if (float_type->width() == 32) { + float va = a->GetFloat(); + float vb = b->GetFloat(); + if (std::isnan(va)) { + return b; + } + if (std::isnan(vb)) { + return a; + } + return NegZeroAwareLessThan(vb, va) ? a : b; + } else if (float_type->width() == 64) { + double va = a->GetDouble(); + double vb = b->GetDouble(); + if (std::isnan(va)) { + return b; + } + if (std::isnan(vb)) { + return a; + } + return NegZeroAwareLessThan(vb, va) ? a : b; } } return nullptr; @@ -1590,6 +1848,88 @@ const analysis::Constant* FoldClamp3( return nullptr; } +// Fold an clamp instruction when all three operands are constant. +const analysis::Constant* FoldNClamp1( + IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpExtInst && + "Expecting an extended instruction."); + assert(inst->GetSingleWordInOperand(0) == + context->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && + "Expecting a GLSLstd450 extended instruction."); + + // Make sure all Clamp operands are constants. + for (uint32_t i = 1; i < 4; i++) { + if (constants[i] == nullptr) { + return nullptr; + } + } + + const analysis::Constant* temp = FoldFPBinaryOp( + FoldNMax, inst->type_id(), {constants[1], constants[2]}, context); + if (temp == nullptr) { + return nullptr; + } + return FoldFPBinaryOp(FoldNMin, inst->type_id(), {temp, constants[3]}, + context); +} + +// Fold a clamp instruction when |x <= min_val|. +const analysis::Constant* FoldNClamp2( + IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpExtInst && + "Expecting an extended instruction."); + assert(inst->GetSingleWordInOperand(0) == + context->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && + "Expecting a GLSLstd450 extended instruction."); + + const analysis::Constant* x = constants[1]; + const analysis::Constant* min_val = constants[2]; + + if (x == nullptr || min_val == nullptr) { + return nullptr; + } + + const analysis::Constant* temp = + FoldFPBinaryOp(FoldNMax, inst->type_id(), {x, min_val}, context); + if (temp == min_val) { + // We can assume that |min_val| is less than |max_val|. Therefore, if the + // result of the max operation is |min_val|, we know the result of the min + // operation, even if |max_val| is not a constant. + return min_val; + } + return nullptr; +} + +// Fold a clamp instruction when |x >= max_val|. +const analysis::Constant* FoldNClamp3( + IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpExtInst && + "Expecting an extended instruction."); + assert(inst->GetSingleWordInOperand(0) == + context->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && + "Expecting a GLSLstd450 extended instruction."); + + const analysis::Constant* x = constants[1]; + const analysis::Constant* max_val = constants[3]; + + if (x == nullptr || max_val == nullptr) { + return nullptr; + } + + const analysis::Constant* temp = + FoldFPBinaryOp(FoldNMin, inst->type_id(), {x, max_val}, context); + if (temp == max_val) { + // We can assume that |min_val| is less than |max_val|. Therefore, if the + // result of the max operation is |min_val|, we know the result of the min + // operation, even if |max_val| is not a constant. + return max_val; + } + return nullptr; +} + UnaryScalarFoldingRule FoldFTranscendentalUnary(double (*fp)(double)) { return [fp](const analysis::Type* result_type, const analysis::Constant* a, @@ -1734,9 +2074,16 @@ void ConstantFoldingRules::AddFoldingRules() { rules_[spv::Op::OpDot].push_back(FoldOpDotWithConstants()); rules_[spv::Op::OpFAdd].push_back(FoldFAdd()); + rules_[spv::Op::OpFDiv].push_back(FoldFDiv()); + rules_[spv::Op::OpFDiv].push_back(FoldRedundantDiv()); + rules_[spv::Op::OpFMul].push_back(FoldFMul()); + rules_[spv::Op::OpFSub].push_back(FoldFSub()); + rules_[spv::Op::OpFSub].push_back(FoldRedundantSub()); + + rules_[spv::Op::OpSelect].push_back(FoldInvariantSelect()); rules_[spv::Op::OpFOrdEqual].push_back(FoldFOrdEqual()); @@ -1792,21 +2139,29 @@ void ConstantFoldingRules::AddFoldingRules() { rules_[spv::Op::OpIAdd].push_back( FoldBinaryOp(FoldBinaryIntegerOperation( [](uint64_t a, uint64_t b) { return a + b; }))); + rules_[spv::Op::OpISub].push_back( FoldBinaryOp(FoldBinaryIntegerOperation( [](uint64_t a, uint64_t b) { return a - b; }))); + rules_[spv::Op::OpISub].push_back(FoldRedundantSub()); + rules_[spv::Op::OpIMul].push_back( FoldBinaryOp(FoldBinaryIntegerOperation( [](uint64_t a, uint64_t b) { return a * b; }))); + rules_[spv::Op::OpUDiv].push_back( FoldBinaryOp(FoldBinaryIntegerOperation( [](uint64_t a, uint64_t b) { return (b != 0 ? a / b : 0); }))); + rules_[spv::Op::OpUDiv].push_back(FoldRedundantDiv()); + rules_[spv::Op::OpSDiv].push_back(FoldBinaryOp( FoldBinaryIntegerOperation([](uint64_t a, uint64_t b) { return (b != 0 ? static_cast(static_cast(a) / static_cast(b)) : 0); }))); + rules_[spv::Op::OpSDiv].push_back(FoldRedundantDiv()); + rules_[spv::Op::OpUMod].push_back( FoldBinaryOp(FoldBinaryIntegerOperation( [](uint64_t a, uint64_t b) { return (b != 0 ? a % b : 0); }))); @@ -1841,12 +2196,16 @@ void ConstantFoldingRules::AddFoldingRules() { FoldFPBinaryOp(FoldMin)); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450FMin}].push_back( FoldFPBinaryOp(FoldMin)); + ext_rules_[{ext_inst_glslstd450_id, GLSLstd450NMin}].push_back( + FoldFPBinaryOp(FoldNMin)); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450SMax}].push_back( FoldFPBinaryOp(FoldMax)); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450UMax}].push_back( FoldFPBinaryOp(FoldMax)); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450FMax}].push_back( FoldFPBinaryOp(FoldMax)); + ext_rules_[{ext_inst_glslstd450_id, GLSLstd450NMax}].push_back( + FoldFPBinaryOp(FoldNMax)); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450UClamp}].push_back( FoldClamp1); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450UClamp}].push_back( @@ -1865,6 +2224,12 @@ void ConstantFoldingRules::AddFoldingRules() { FoldClamp2); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450FClamp}].push_back( FoldClamp3); + ext_rules_[{ext_inst_glslstd450_id, GLSLstd450NClamp}].push_back( + FoldNClamp1); + ext_rules_[{ext_inst_glslstd450_id, GLSLstd450NClamp}].push_back( + FoldNClamp2); + ext_rules_[{ext_inst_glslstd450_id, GLSLstd450NClamp}].push_back( + FoldNClamp3); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450Sin}].push_back( FoldFPUnaryOp(FoldFTranscendentalUnary(std::sin))); ext_rules_[{ext_inst_glslstd450_id, GLSLstd450Cos}].push_back( diff --git a/third_party/spirv-tools/source/opt/constants.cpp b/third_party/spirv-tools/source/opt/constants.cpp index 7dc02deaa4..e51bae1d46 100644 --- a/third_party/spirv-tools/source/opt/constants.cpp +++ b/third_party/spirv-tools/source/opt/constants.cpp @@ -315,6 +315,7 @@ const Constant* ConstantManager::GetConstantFromInst(const Instruction* inst) { case spv::Op::OpConstant: case spv::Op::OpConstantComposite: case spv::Op::OpSpecConstantComposite: + case spv::Op::OpSpecConstantCompositeReplicateEXT: break; default: return nullptr; @@ -461,7 +462,9 @@ const Constant* ConstantManager::GetNumericVectorConstantWithWords( uint32_t ConstantManager::GetFloatConstId(float val) { const Constant* c = GetFloatConst(val); - return GetDefiningInstruction(c)->result_id(); + Instruction* inst = GetDefiningInstruction(c); + if (inst == nullptr) return 0; + return inst->result_id(); } const Constant* ConstantManager::GetFloatConst(float val) { @@ -473,7 +476,9 @@ const Constant* ConstantManager::GetFloatConst(float val) { uint32_t ConstantManager::GetDoubleConstId(double val) { const Constant* c = GetDoubleConst(val); - return GetDefiningInstruction(c)->result_id(); + Instruction* inst = GetDefiningInstruction(c); + if (inst == nullptr) return 0; + return inst->result_id(); } const Constant* ConstantManager::GetDoubleConst(double val) { diff --git a/third_party/spirv-tools/source/opt/convert_to_half_pass.cpp b/third_party/spirv-tools/source/opt/convert_to_half_pass.cpp index e243bedf0c..a3527ffc25 100644 --- a/third_party/spirv-tools/source/opt/convert_to_half_pass.cpp +++ b/third_party/spirv-tools/source/opt/convert_to_half_pass.cpp @@ -22,6 +22,7 @@ namespace spvtools { namespace opt { namespace { // Indices of operands in SPIR-V instructions +constexpr int kImageSampleCoordinateIdInIdx = 1; constexpr int kImageSampleDrefIdInIdx = 2; } // namespace @@ -75,6 +76,9 @@ analysis::Type* ConvertToHalfPass::FloatScalarType(uint32_t width) { analysis::Type* ConvertToHalfPass::FloatVectorType(uint32_t v_len, uint32_t width) { analysis::Type* reg_float_ty = FloatScalarType(width); + if (reg_float_ty == nullptr) { + return nullptr; + } analysis::Vector vec_ty(reg_float_ty, v_len); return context()->get_type_mgr()->GetRegisteredType(&vec_ty); } @@ -85,6 +89,9 @@ analysis::Type* ConvertToHalfPass::FloatMatrixType(uint32_t v_cnt, Instruction* vty_inst = get_def_use_mgr()->GetDef(vty_id); uint32_t v_len = vty_inst->GetSingleWordInOperand(1); analysis::Type* reg_vec_ty = FloatVectorType(v_len, width); + if (reg_vec_ty == nullptr) { + return nullptr; + } analysis::Matrix mat_ty(reg_vec_ty, v_cnt); return context()->get_type_mgr()->GetRegisteredType(&mat_ty); } @@ -99,6 +106,9 @@ uint32_t ConvertToHalfPass::EquivFloatTypeId(uint32_t ty_id, uint32_t width) { reg_equiv_ty = FloatVectorType(ty_inst->GetSingleWordInOperand(1), width); else // spv::Op::OpTypeFloat reg_equiv_ty = FloatScalarType(width); + if (reg_equiv_ty == nullptr) { + return 0; + } return context()->get_type_mgr()->GetTypeInstruction(reg_equiv_ty); } @@ -107,6 +117,10 @@ void ConvertToHalfPass::GenConvert(uint32_t* val_idp, uint32_t width, Instruction* val_inst = get_def_use_mgr()->GetDef(*val_idp); uint32_t ty_id = val_inst->type_id(); uint32_t nty_id = EquivFloatTypeId(ty_id, width); + if (nty_id == 0) { + status_ = Status::Failure; + return; + } if (nty_id == ty_id) return; Instruction* cvt_inst; InstructionBuilder builder( @@ -116,6 +130,10 @@ void ConvertToHalfPass::GenConvert(uint32_t* val_idp, uint32_t width, cvt_inst = builder.AddNullaryOp(nty_id, spv::Op::OpUndef); else cvt_inst = builder.AddUnaryOp(nty_id, spv::Op::OpFConvert, *val_idp); + if (cvt_inst == nullptr) { + status_ = Status::Failure; + return; + } *val_idp = cvt_inst->result_id(); } @@ -137,22 +155,43 @@ bool ConvertToHalfPass::MatConvertCleanup(Instruction* inst) { uint32_t orig_width = (cty_inst->GetSingleWordInOperand(0) == 16) ? 32 : 16; uint32_t orig_mat_id = inst->GetSingleWordInOperand(0); uint32_t orig_vty_id = EquivFloatTypeId(vty_id, orig_width); + if (orig_vty_id == 0) { + status_ = Status::Failure; + return false; + } std::vector opnds = {}; for (uint32_t vidx = 0; vidx < v_cnt; ++vidx) { Instruction* ext_inst = builder.AddIdLiteralOp( orig_vty_id, spv::Op::OpCompositeExtract, orig_mat_id, vidx); + if (ext_inst == nullptr) { + status_ = Status::Failure; + return false; + } Instruction* cvt_inst = builder.AddUnaryOp(vty_id, spv::Op::OpFConvert, ext_inst->result_id()); + if (cvt_inst == nullptr) { + status_ = Status::Failure; + return false; + } opnds.push_back({SPV_OPERAND_TYPE_ID, {cvt_inst->result_id()}}); } uint32_t mat_id = TakeNextId(); + if (mat_id == 0) { + status_ = Status::Failure; + return false; + } std::unique_ptr mat_inst(new Instruction( context(), spv::Op::OpCompositeConstruct, mty_id, mat_id, opnds)); (void)builder.AddInstruction(std::move(mat_inst)); context()->ReplaceAllUsesWith(inst->result_id(), mat_id); // Turn original instruction into copy so it is valid. + uint32_t new_type_id = EquivFloatTypeId(mty_id, orig_width); + if (new_type_id == 0) { + status_ = Status::Failure; + return false; + } inst->SetOpcode(spv::Op::OpCopyObject); - inst->SetResultType(EquivFloatTypeId(mty_id, orig_width)); + inst->SetResultType(new_type_id); get_def_use_mgr()->AnalyzeInstUse(inst); return true; } @@ -187,13 +226,24 @@ bool ConvertToHalfPass::GenHalfArith(Instruction* inst) { // Convert all float32 based operands to float16 equivalent and change // instruction type to float16 equivalent. inst->ForEachInId([&inst, &modified, this](uint32_t* idp) { + if (status_ == Status::Failure) { + return; + } Instruction* op_inst = get_def_use_mgr()->GetDef(*idp); if (!IsFloat(op_inst, 32)) return; GenConvert(idp, 16, inst); modified = true; }); + if (status_ == Status::Failure) { + return false; + } if (IsFloat(inst, 32)) { - inst->SetResultType(EquivFloatTypeId(inst->type_id(), 16)); + uint32_t new_type_id = EquivFloatTypeId(inst->type_id(), 16); + if (new_type_id == 0) { + status_ = Status::Failure; + return false; + } + inst->SetResultType(new_type_id); converted_ids_.insert(inst->result_id()); modified = true; } @@ -211,6 +261,9 @@ bool ConvertToHalfPass::ProcessPhi(Instruction* inst, uint32_t from_width, bool modified = false; inst->ForEachInId([&ocnt, &prev_idp, &from_width, &to_width, &modified, this](uint32_t* idp) { + if (status_ == Status::Failure) { + return; + } if (ocnt % 2 == 0) { prev_idp = idp; } else { @@ -230,8 +283,16 @@ bool ConvertToHalfPass::ProcessPhi(Instruction* inst, uint32_t from_width, } ++ocnt; }); + if (status_ == Status::Failure) { + return false; + } if (to_width == 16u) { - inst->SetResultType(EquivFloatTypeId(inst->type_id(), 16u)); + uint32_t new_type_id = EquivFloatTypeId(inst->type_id(), 16u); + if (new_type_id == 0) { + status_ = Status::Failure; + return false; + } + inst->SetResultType(new_type_id); converted_ids_.insert(inst->result_id()); modified = true; } @@ -242,7 +303,12 @@ bool ConvertToHalfPass::ProcessPhi(Instruction* inst, uint32_t from_width, bool ConvertToHalfPass::ProcessConvert(Instruction* inst) { // If float32 and relaxed, change to float16 convert if (IsFloat(inst, 32) && IsRelaxed(inst->result_id())) { - inst->SetResultType(EquivFloatTypeId(inst->type_id(), 16)); + uint32_t new_type_id = EquivFloatTypeId(inst->type_id(), 16); + if (new_type_id == 0) { + status_ = Status::Failure; + return false; + } + inst->SetResultType(new_type_id); get_def_use_mgr()->AnalyzeInstUse(inst); converted_ids_.insert(inst->result_id()); } @@ -255,21 +321,37 @@ bool ConvertToHalfPass::ProcessConvert(Instruction* inst) { Instruction* val_inst = get_def_use_mgr()->GetDef(val_id); if (inst->type_id() == val_inst->type_id()) inst->SetOpcode(spv::Op::OpCopyObject); - return true; // modified + return true; } bool ConvertToHalfPass::ProcessImageRef(Instruction* inst) { bool modified = false; - // If image reference, only need to convert dref args back to float32 + // If image reference, some operands aren't allowed to be non-32 bit floats if (dref_image_ops_.count(inst->opcode()) != 0) { uint32_t dref_id = inst->GetSingleWordInOperand(kImageSampleDrefIdInIdx); if (converted_ids_.count(dref_id) > 0) { GenConvert(&dref_id, 32, inst); + if (status_ == Status::Failure) { + return false; + } inst->SetInOperand(kImageSampleDrefIdInIdx, {dref_id}); get_def_use_mgr()->AnalyzeInstUse(inst); modified = true; } } + if (coordinate_image_ops_.count(inst->opcode()) != 0) { + uint32_t coordinate_id = + inst->GetSingleWordInOperand(kImageSampleCoordinateIdInIdx); + if (converted_ids_.count(coordinate_id) > 0) { + GenConvert(&coordinate_id, 32, inst); + if (status_ == Status::Failure) { + return false; + } + inst->SetInOperand(kImageSampleCoordinateIdInIdx, {coordinate_id}); + get_def_use_mgr()->AnalyzeInstUse(inst); + modified = true; + } + } return modified; } @@ -279,11 +361,17 @@ bool ConvertToHalfPass::ProcessDefault(Instruction* inst) { if (inst->opcode() == spv::Op::OpPhi) return ProcessPhi(inst, 16u, 32u); bool modified = false; inst->ForEachInId([&inst, &modified, this](uint32_t* idp) { + if (status_ == Status::Failure) { + return; + } if (converted_ids_.count(*idp) == 0) return; uint32_t old_id = *idp; GenConvert(idp, 32, inst); if (*idp != old_id) modified = true; }); + if (status_ == Status::Failure) { + return false; + } if (modified) get_def_use_mgr()->AnalyzeInstUse(inst); return modified; } @@ -370,19 +458,38 @@ bool ConvertToHalfPass::ProcessFunction(Function* func) { }); // Replace invalid converts of matrix into equivalent vector extracts, // converts and finally a composite construct + bool ok = true; cfg()->ForEachBlockInReversePostOrder( - func->entry().get(), [&modified, this](BasicBlock* bb) { - for (auto ii = bb->begin(); ii != bb->end(); ++ii) - modified |= MatConvertCleanup(&*ii); + func->entry().get(), [&modified, &ok, this](BasicBlock* bb) { + if (!ok) { + return; + } + for (auto ii = bb->begin(); ii != bb->end(); ++ii) { + bool Mmodified = MatConvertCleanup(&*ii); + if (status_ == Status::Failure) { + ok = false; + break; + } + modified |= Mmodified; + } }); + + if (!ok) { + return false; + } return modified; } Pass::Status ConvertToHalfPass::ProcessImpl() { + status_ = Status::SuccessWithoutChange; Pass::ProcessFunction pfn = [this](Function* fp) { return ProcessFunction(fp); }; bool modified = context()->ProcessReachableCallTree(pfn); + if (status_ == Status::Failure) { + return status_; + } + // If modified, make sure module has Float16 capability if (modified) context()->AddCapability(spv::Capability::Float16); // Remove all RelaxedPrecision decorations from instructions and globals @@ -498,6 +605,30 @@ void ConvertToHalfPass::Initialize() { spv::Op::OpImageSparseSampleProjDrefExplicitLod, spv::Op::OpImageSparseDrefGather, }; + coordinate_image_ops_ = { + spv::Op::OpImageSampleImplicitLod, + spv::Op::OpImageSampleExplicitLod, + spv::Op::OpImageSampleDrefImplicitLod, + spv::Op::OpImageSampleDrefExplicitLod, + spv::Op::OpImageSampleProjImplicitLod, + spv::Op::OpImageSampleProjExplicitLod, + spv::Op::OpImageSampleProjDrefImplicitLod, + spv::Op::OpImageSampleProjDrefExplicitLod, + spv::Op::OpImageFetch, + spv::Op::OpImageGather, + spv::Op::OpImageDrefGather, + spv::Op::OpImageRead, + spv::Op::OpImageWrite, + spv::Op::OpImageQueryLod, + spv::Op::OpImageSparseSampleImplicitLod, + spv::Op::OpImageSparseSampleExplicitLod, + spv::Op::OpImageSparseSampleDrefImplicitLod, + spv::Op::OpImageSparseSampleDrefExplicitLod, + spv::Op::OpImageSparseFetch, + spv::Op::OpImageSparseGather, + spv::Op::OpImageSparseDrefGather, + spv::Op::OpImageSparseRead, + }; closure_ops_ = { spv::Op::OpVectorExtractDynamic, spv::Op::OpVectorInsertDynamic, @@ -514,4 +645,4 @@ void ConvertToHalfPass::Initialize() { } } // namespace opt -} // namespace spvtools +} // namespace spvtools \ No newline at end of file diff --git a/third_party/spirv-tools/source/opt/convert_to_half_pass.h b/third_party/spirv-tools/source/opt/convert_to_half_pass.h index 8e10c4fb95..c04f27a997 100644 --- a/third_party/spirv-tools/source/opt/convert_to_half_pass.h +++ b/third_party/spirv-tools/source/opt/convert_to_half_pass.h @@ -130,6 +130,9 @@ class ConvertToHalfPass : public Pass { } }; + // The status of the pass. + Pass::Status status_; + // Set of core operations to be processed std::unordered_set target_ops_core_; @@ -142,6 +145,9 @@ class ConvertToHalfPass : public Pass { // Set of only dref sample operations std::unordered_set dref_image_ops_; + // Set of only sample operations that have a Coordinate operand + std::unordered_set coordinate_image_ops_; + // Set of operations that can be marked as relaxed std::unordered_set closure_ops_; diff --git a/third_party/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp b/third_party/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp index d2da4d1e0b..e7203923e3 100644 --- a/third_party/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp +++ b/third_party/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp @@ -246,9 +246,10 @@ Instruction* ConvertToSampledImagePass::CreateImageExtraction( InstructionBuilder builder( context(), sampled_image->NextNode(), IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); - return builder.AddUnaryOp( + Instruction* result = builder.AddUnaryOp( GetImageTypeOfSampledImage(context()->get_type_mgr(), sampled_image), spv::Op::OpImage, sampled_image->result_id()); + return result; } uint32_t ConvertToSampledImagePass::GetSampledImageTypeForImage( @@ -270,6 +271,9 @@ Instruction* ConvertToSampledImagePass::UpdateImageUses( if (uses_of_load.empty()) return nullptr; auto* extracted_image = CreateImageExtraction(sampled_image_load); + if (extracted_image == nullptr) { + return nullptr; + } for (auto* user : uses_of_load) { user->SetInOperand(0, {extracted_image->result_id()}); context()->get_def_use_mgr()->AnalyzeInstUse(user); @@ -306,8 +310,12 @@ void ConvertToSampledImagePass::UpdateSampledImageUses( def_use_mgr->AnalyzeInstUse(image_load); context()->KillInst(sampled_image_inst); } else { - if (!image_extraction) + if (!image_extraction) { image_extraction = CreateImageExtraction(image_load); + if (image_extraction == nullptr) { + return; + } + } sampled_image_inst->SetInOperand(0, {image_extraction->result_id()}); def_use_mgr->AnalyzeInstUse(sampled_image_inst); } @@ -333,6 +341,9 @@ bool ConvertToSampledImagePass::ConvertImageVariableToSampledImage( // reference. uint32_t type_id = context()->get_type_mgr()->FindPointerToType( sampled_image_type_id, storage_class); + if (type_id == 0) { + return false; + } MoveInstructionNextToType(image_variable, type_id); return true; } diff --git a/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp b/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp index 3078a7c3b3..547a5e479e 100644 --- a/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp +++ b/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp @@ -104,10 +104,17 @@ Pass::Status CopyPropagateArrays::Process() { continue; } - if (CanUpdateUses(&*var_inst, source_object->GetPointerTypeId(this))) { + uint32_t pointer_type_id = source_object->GetPointerTypeId(this); + if (pointer_type_id == 0) { + return Status::Failure; + } + + if (CanUpdateUses(&*var_inst, pointer_type_id)) { modified = true; - PropagateObject(&*var_inst, source_object.get(), store_inst); + if (!PropagateObject(&*var_inst, source_object.get(), store_inst)) { + return Status::Failure; + } } } @@ -170,15 +177,16 @@ Instruction* CopyPropagateArrays::FindStoreInstruction( return store_inst; } -void CopyPropagateArrays::PropagateObject(Instruction* var_inst, +bool CopyPropagateArrays::PropagateObject(Instruction* var_inst, MemoryObject* source, Instruction* insertion_point) { assert(var_inst->opcode() == spv::Op::OpVariable && "This function propagates variables."); Instruction* new_access_chain = BuildNewAccessChain(insertion_point, source); + if (!new_access_chain) return false; context()->KillNamesAndDecorates(var_inst); - UpdateUses(var_inst, new_access_chain); + return UpdateUses(var_inst, new_access_chain); } Instruction* CopyPropagateArrays::BuildNewAccessChain( @@ -192,7 +200,7 @@ Instruction* CopyPropagateArrays::BuildNewAccessChain( return source->GetVariable(); } - source->BuildConstants(); + if (!source->BuildConstants()) return nullptr; std::vector access_ids(source->AccessChain().size()); std::transform( source->AccessChain().cbegin(), source->AccessChain().cend(), @@ -642,7 +650,7 @@ bool CopyPropagateArrays::CanUpdateUses(Instruction* original_ptr_inst, }); } -void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, +bool CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, Instruction* new_ptr_inst) { analysis::TypeManager* type_mgr = context()->get_type_mgr(); analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); @@ -699,6 +707,7 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, def_use_mgr->GetDef(use->GetSingleWordOperand(index + 1)); auto* deref_expr_instr = context()->get_debug_info_mgr()->DerefDebugExpression(dbg_expr); + if (!deref_expr_instr) return false; use->SetOperand(index + 1, {deref_expr_instr->result_id()}); context()->AnalyzeUses(deref_expr_instr); @@ -783,6 +792,8 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, uint32_t new_pointer_type_id = type_mgr->FindPointerToType(new_pointee_type_id, storage_class); + if (new_pointer_type_id == 0) return false; + if (new_pointer_type_id != use->type_id()) { use->SetResultType(new_pointer_type_id); context()->AnalyzeUses(use); @@ -829,8 +840,7 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, uint32_t pointee_type_id = pointer_type->GetSingleWordInOperand(kTypePointerPointeeInIdx); uint32_t copy = GenerateCopy(original_ptr_inst, pointee_type_id, use); - assert(copy != 0 && - "Should not be updating uses unless we know it can be done."); + if (copy == 0) return false; context()->ForgetUses(use); use->SetInOperand(index, {copy}); @@ -852,6 +862,7 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, break; } } + return true; } uint32_t CopyPropagateArrays::GetMemberTypeId( @@ -955,7 +966,7 @@ bool CopyPropagateArrays::MemoryObject::Contains( return true; } -void CopyPropagateArrays::MemoryObject::BuildConstants() { +bool CopyPropagateArrays::MemoryObject::BuildConstants() { for (auto& entry : access_chain_) { if (entry.is_result_id) { continue; @@ -968,10 +979,13 @@ void CopyPropagateArrays::MemoryObject::BuildConstants() { analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Constant* index_const = const_mgr->GetConstant(uint32_type, {entry.immediate}); - entry.result_id = - const_mgr->GetDefiningInstruction(index_const)->result_id(); + if (!index_const) return false; + Instruction* constant_inst = const_mgr->GetDefiningInstruction(index_const); + if (!constant_inst) return false; + entry.result_id = constant_inst->result_id(); entry.is_result_id = true; } + return true; } } // namespace opt diff --git a/third_party/spirv-tools/source/opt/copy_prop_arrays.h b/third_party/spirv-tools/source/opt/copy_prop_arrays.h index bf4bfb5c54..cb04a14354 100644 --- a/third_party/spirv-tools/source/opt/copy_prop_arrays.h +++ b/third_party/spirv-tools/source/opt/copy_prop_arrays.h @@ -118,7 +118,8 @@ class CopyPropagateArrays : public MemPass { // Converts all immediate values in the AccessChain their OpConstant // equivalent. - void BuildConstants(); + // Returns false if the constants could not be created. + bool BuildConstants(); // Returns the type id of the pointer type that can be used to point to this // memory object. @@ -175,7 +176,8 @@ class CopyPropagateArrays : public MemPass { // Replaces all loads of |var_inst| with a load from |source| instead. // |insertion_pos| is a position where it is possible to construct the // address of |source| and also dominates all of the loads of |var_inst|. - void PropagateObject(Instruction* var_inst, MemoryObject* source, + // Returns false if the propagation failed. + bool PropagateObject(Instruction* var_inst, MemoryObject* source, Instruction* insertion_pos); // Returns true if all of the references to |ptr_inst| can be rewritten and @@ -241,7 +243,7 @@ class CopyPropagateArrays : public MemPass { // types of other instructions as needed. This function should not be called // if |CanUpdateUses(original_ptr_inst, new_pointer_inst->type_id())| returns // false. - void UpdateUses(Instruction* original_ptr_inst, + bool UpdateUses(Instruction* original_ptr_inst, Instruction* new_pointer_inst); // Return true if |UpdateUses| is able to change all of the uses of diff --git a/third_party/spirv-tools/source/opt/debug_info_manager.cpp b/third_party/spirv-tools/source/opt/debug_info_manager.cpp index cc309da152..4570113cfa 100644 --- a/third_party/spirv-tools/source/opt/debug_info_manager.cpp +++ b/third_party/spirv-tools/source/opt/debug_info_manager.cpp @@ -331,6 +331,7 @@ Instruction* DebugInfoManager::GetDebugOperationWithDeref() { if (deref_operation_ != nullptr) return deref_operation_; uint32_t result_id = context()->TakeNextId(); + if (result_id == 0) return nullptr; std::unique_ptr deref_operation; if (context()->get_feature_mgr()->GetExtInstImportId_OpenCL100DebugInfo()) { @@ -374,10 +375,13 @@ Instruction* DebugInfoManager::GetDebugOperationWithDeref() { Instruction* DebugInfoManager::DerefDebugExpression(Instruction* dbg_expr) { assert(dbg_expr->GetCommonDebugOpcode() == CommonDebugInfoDebugExpression); std::unique_ptr deref_expr(dbg_expr->Clone(context())); - deref_expr->SetResultId(context()->TakeNextId()); - deref_expr->InsertOperand( - kDebugExpressOperandOperationIndex, - {SPV_OPERAND_TYPE_ID, {GetDebugOperationWithDeref()->result_id()}}); + uint32_t result_id = context()->TakeNextId(); + if (result_id == 0) return nullptr; + deref_expr->SetResultId(result_id); + Instruction* deref_op = GetDebugOperationWithDeref(); + if (!deref_op) return nullptr; + deref_expr->InsertOperand(kDebugExpressOperandOperationIndex, + {SPV_OPERAND_TYPE_ID, {deref_op->result_id()}}); auto* deref_expr_instr = context()->ext_inst_debuginfo_end()->InsertBefore(std::move(deref_expr)); AnalyzeDebugInst(deref_expr_instr); @@ -390,6 +394,7 @@ Instruction* DebugInfoManager::GetDebugInfoNone() { if (debug_info_none_inst_ != nullptr) return debug_info_none_inst_; uint32_t result_id = context()->TakeNextId(); + if (result_id == 0) return nullptr; std::unique_ptr dbg_info_none_inst(new Instruction( context(), spv::Op::OpExtInst, context()->get_type_mgr()->GetVoidTypeId(), result_id, diff --git a/third_party/spirv-tools/source/opt/desc_sroa.cpp b/third_party/spirv-tools/source/opt/desc_sroa.cpp index 124a3d3a8e..b2f12684c0 100644 --- a/third_party/spirv-tools/source/opt/desc_sroa.cpp +++ b/third_party/spirv-tools/source/opt/desc_sroa.cpp @@ -58,7 +58,7 @@ bool DescriptorScalarReplacement::ReplaceCandidate(Instruction* var) { std::vector access_chain_work_list; std::vector load_work_list; std::vector entry_point_work_list; - bool failed = !get_def_use_mgr()->WhileEachUser( + bool ok = get_def_use_mgr()->WhileEachUser( var->result_id(), [this, &access_chain_work_list, &load_work_list, &entry_point_work_list](Instruction* use) { if (use->opcode() == spv::Op::OpName) { @@ -88,7 +88,7 @@ bool DescriptorScalarReplacement::ReplaceCandidate(Instruction* var) { return true; }); - if (failed) { + if (!ok) { return false; } @@ -128,6 +128,9 @@ bool DescriptorScalarReplacement::ReplaceAccessChain(Instruction* var, uint32_t idx = const_index->GetU32(); uint32_t replacement_var = GetReplacementVariable(var, idx); + if (replacement_var == 0) { + return false; + } if (use->NumInOperands() == 2) { // We are not indexing into the replacement variable. We can replaces the @@ -186,8 +189,11 @@ bool DescriptorScalarReplacement::ReplaceEntryPoint(Instruction* var, uint32_t num_replacement_vars = descsroautil::GetNumberOfElementsForArrayOrStruct(context(), var); for (uint32_t i = 0; i < num_replacement_vars; i++) { - new_operands.push_back( - {SPV_OPERAND_TYPE_ID, {GetReplacementVariable(var, i)}}); + uint32_t replacement_var_id = GetReplacementVariable(var, i); + if (replacement_var_id == 0) { + return false; + } + new_operands.push_back({SPV_OPERAND_TYPE_ID, {replacement_var_id}}); } use->ReplaceOperands(new_operands); @@ -310,7 +316,10 @@ uint32_t DescriptorScalarReplacement::CreateReplacementVariable( element_type_id, storage_class); // Create the variable. - uint32_t id = TakeNextId(); + uint32_t id = context()->TakeNextId(); + if (id == 0) { + return 0; + } std::unique_ptr variable( new Instruction(context(), spv::Op::OpVariable, ptr_element_type_id, id, std::initializer_list{ @@ -444,10 +453,16 @@ bool DescriptorScalarReplacement::ReplaceCompositeExtract( uint32_t replacement_var = GetReplacementVariable(var, extract->GetSingleWordInOperand(1)); + if (replacement_var == 0) { + return false; + } // The result type of the OpLoad is the same as the result type of the // OpCompositeExtract. - uint32_t load_id = TakeNextId(); + uint32_t load_id = context()->TakeNextId(); + if (load_id == 0) { + return false; + } std::unique_ptr load( new Instruction(context(), spv::Op::OpLoad, extract->type_id(), load_id, std::initializer_list{ diff --git a/third_party/spirv-tools/source/opt/eliminate_dead_members_pass.cpp b/third_party/spirv-tools/source/opt/eliminate_dead_members_pass.cpp index 170f27068b..33c0503f8f 100644 --- a/third_party/spirv-tools/source/opt/eliminate_dead_members_pass.cpp +++ b/third_party/spirv-tools/source/opt/eliminate_dead_members_pass.cpp @@ -207,7 +207,7 @@ void EliminateDeadMembersPass::MarkMembersAsLiveForExtract( case spv::Op::OpTypeMatrix: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: type_id = type_inst->GetSingleWordInOperand(0); break; default: @@ -256,7 +256,7 @@ void EliminateDeadMembersPass::MarkMembersAsLiveForAccessChain( case spv::Op::OpTypeMatrix: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: type_id = type_inst->GetSingleWordInOperand(0); break; default: @@ -518,7 +518,7 @@ bool EliminateDeadMembersPass::UpdateAccessChain(Instruction* inst) { case spv::Op::OpTypeMatrix: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: new_operands.emplace_back(inst->GetInOperand(i)); type_id = type_inst->GetSingleWordInOperand(0); break; @@ -594,7 +594,7 @@ bool EliminateDeadMembersPass::UpdateCompsiteExtract(Instruction* inst) { case spv::Op::OpTypeMatrix: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: type_id = type_inst->GetSingleWordInOperand(0); break; default: @@ -658,7 +658,7 @@ bool EliminateDeadMembersPass::UpdateCompositeInsert(Instruction* inst) { case spv::Op::OpTypeMatrix: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: type_id = type_inst->GetSingleWordInOperand(0); break; default: diff --git a/third_party/spirv-tools/source/opt/feature_manager.cpp b/third_party/spirv-tools/source/opt/feature_manager.cpp index 2810739e26..e4d152be51 100644 --- a/third_party/spirv-tools/source/opt/feature_manager.cpp +++ b/third_party/spirv-tools/source/opt/feature_manager.cpp @@ -34,10 +34,13 @@ void FeatureManager::AddExtensions(Module* module) { } void FeatureManager::AddExtension(Instruction* ext) { - assert(ext->opcode() == spv::Op::OpExtension && + assert((ext->opcode() == spv::Op::OpExtension || + ext->opcode() == spv::Op::OpConditionalExtensionINTEL) && "Expecting an extension instruction."); - const std::string name = ext->GetInOperand(0u).AsString(); + const uint32_t name_i = + ext->opcode() == spv::Op::OpConditionalExtensionINTEL ? 1u : 0u; + const std::string name = ext->GetInOperand(name_i).AsString(); Extension extension; if (GetExtensionFromString(name.c_str(), &extension)) { extensions_.insert(extension); @@ -72,7 +75,10 @@ void FeatureManager::RemoveCapability(spv::Capability cap) { void FeatureManager::AddCapabilities(Module* module) { for (Instruction& inst : module->capabilities()) { - AddCapability(static_cast(inst.GetSingleWordInOperand(0))); + const uint32_t i_cap = + inst.opcode() == spv::Op::OpConditionalCapabilityINTEL ? 1 : 0; + AddCapability( + static_cast(inst.GetSingleWordInOperand(i_cap))); } } diff --git a/third_party/spirv-tools/source/opt/fix_func_call_arguments.cpp b/third_party/spirv-tools/source/opt/fix_func_call_arguments.cpp index f3486bed31..aa45c9fdeb 100644 --- a/third_party/spirv-tools/source/opt/fix_func_call_arguments.cpp +++ b/third_party/spirv-tools/source/opt/fix_func_call_arguments.cpp @@ -74,16 +74,19 @@ uint32_t FixFuncCallArgumentsPass::ReplaceAccessChainFuncCallArguments( op_type->result_id(), spv::StorageClass::Function); // Create new variable builder.SetInsertPoint(variable_insertion_point); + // TODO(1841): Handle id overflow. Instruction* var = builder.AddVariable(varType, uint32_t(spv::StorageClass::Function)); // Load access chain to the new variable before function call builder.SetInsertPoint(func_call_inst); uint32_t operand_id = operand_inst->result_id(); + // TODO(1841): Handle id overflow. Instruction* load = builder.AddLoad(op_type->result_id(), operand_id); builder.AddStore(var->result_id(), load->result_id()); // Load return value to the acesschain after function call builder.SetInsertPoint(next_insert_point); + // TODO(1841): Handle id overflow. load = builder.AddLoad(op_type->result_id(), var->result_id()); builder.AddStore(operand_id, load->result_id()); diff --git a/third_party/spirv-tools/source/opt/fold.cpp b/third_party/spirv-tools/source/opt/fold.cpp index cd070c7402..64c947fbf8 100644 --- a/third_party/spirv-tools/source/opt/fold.cpp +++ b/third_party/spirv-tools/source/opt/fold.cpp @@ -597,6 +597,9 @@ Instruction* InstructionFolder::FoldInstructionToConstant( const analysis::Constant* folded_const = nullptr; for (auto rule : GetConstantFoldingRules().GetRulesForInstruction(inst)) { folded_const = rule(context_, inst, constants); + if (folded_const == nullptr && inst->context()->id_overflow()) { + return nullptr; + } if (folded_const != nullptr) { Instruction* const_inst = const_mgr->GetDefiningInstruction(folded_const, inst->type_id()); diff --git a/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp b/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp index ddfe59f752..edcf55126b 100644 --- a/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp +++ b/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2016 Google Inc. +// Copyright (c) 2025 Arm Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,21 +32,20 @@ Pass::Status FoldSpecConstantOpAndCompositePass::Process() { // instructions, records their values in two internal maps: id_to_const_val_ // and const_val_to_id_ so that we can use them to infer the value of Spec // Constants later. - // For Spec Constants defined with OpSpecConstantComposite instructions, if - // all of their components are Normal Constants, they will be turned into - // Normal Constants too. For Spec Constants defined with OpSpecConstantOp - // instructions, we check if they only depends on Normal Constants and fold - // them when possible. The two maps for Normal Constants: id_to_const_val_ - // and const_val_to_id_ will be updated along the traversal so that the new - // Normal Constants generated from folding can be used to fold following Spec - // Constants. - // This algorithm depends on the SSA property of SPIR-V when - // defining constants. The dependent constants must be defined before the - // dependee constants. So a dependent Spec Constant must be defined and - // will be processed before its dependee Spec Constant. When we encounter - // the dependee Spec Constants, all its dependent constants must have been - // processed and all its dependent Spec Constants should have been folded if - // possible. + // For Spec Constants defined with OpSpecConstantComposite or + // OpSpecConstantCompositeReplicateEXT instructions, if all of their + // components are Normal Constants, they will be turned into Normal Constants + // too. For Spec Constants defined with OpSpecConstantOp instructions, we + // check if they only depends on Normal Constants and fold them when possible. + // The two maps for Normal Constants: id_to_const_val_ and const_val_to_id_ + // will be updated along the traversal so that the new Normal Constants + // generated from folding can be used to fold following Spec Constants. This + // algorithm depends on the SSA property of SPIR-V when defining constants. + // The dependent constants must be defined before the dependee constants. So a + // dependent Spec Constant must be defined and will be processed before its + // dependee Spec Constant. When we encounter the dependee Spec Constants, all + // its dependent constants must have been processed and all its dependent Spec + // Constants should have been folded if possible. Module::inst_iterator next_inst = context()->types_values_begin(); for (Module::inst_iterator inst_iter = next_inst; // Need to re-evaluate the end iterator since we may modify the list of @@ -54,8 +54,9 @@ Pass::Status FoldSpecConstantOpAndCompositePass::Process() { ++next_inst; Instruction* inst = &*inst_iter; // Collect constant values of normal constants and process the - // OpSpecConstantOp and OpSpecConstantComposite instructions if possible. - // The constant values will be stored in analysis::Constant instances. + // OpSpecConstantOp, OpSpecConstantComposite, and + // OpSpecConstantCompositeReplicateEXT instructions if possible. The + // constant values will be stored in analysis::Constant instances. // OpConstantSampler instruction is not collected here because it cannot be // used in OpSpecConstant{Composite|Op} instructions. // TODO(qining): If the constant or its type has decoration, we may need @@ -70,21 +71,29 @@ Pass::Status FoldSpecConstantOpAndCompositePass::Process() { case spv::Op::OpConstant: case spv::Op::OpConstantNull: case spv::Op::OpConstantComposite: - case spv::Op::OpSpecConstantComposite: { + case spv::Op::OpSpecConstantComposite: + case spv::Op::OpSpecConstantCompositeReplicateEXT: { // A Constant instance will be created if the given instruction is a // Normal Constant whose value(s) are fixed. Note that for a composite - // Spec Constant defined with OpSpecConstantComposite instruction, if - // all of its components are Normal Constants already, the Spec - // Constant will be turned in to a Normal Constant. In that case, a - // Constant instance should also be created successfully and recorded - // in the id_to_const_val_ and const_val_to_id_ mapps. + // Spec Constant defined with OpSpecConstantComposite or + // OpSpecConstantCompositeReplicateEXT instruction, if all of its + // components are Normal Constants already, the Spec Constant will be + // turned in to a Normal Constant. In that case, a Constant instance + // should also be created successfully and recorded in the + // id_to_const_val_ and const_val_to_id_ mapps. if (auto const_value = const_mgr->GetConstantFromInst(inst)) { - // Need to replace the OpSpecConstantComposite instruction with a - // corresponding OpConstantComposite instruction. + // Need to replace the OpSpecConstantComposite or + // OpSpecConstantCompositeReplicateEXT instruction with a + // corresponding OpConstantComposite or + // OpConstantCompositeReplicateEXT instruction. if (opcode == spv::Op::OpSpecConstantComposite) { inst->SetOpcode(spv::Op::OpConstantComposite); modified = true; } + if (opcode == spv::Op::OpSpecConstantCompositeReplicateEXT) { + inst->SetOpcode(spv::Op::OpConstantCompositeReplicateEXT); + modified = true; + } const_mgr->MapConstantToInst(const_value, inst); } break; @@ -96,9 +105,16 @@ Pass::Status FoldSpecConstantOpAndCompositePass::Process() { // Constants will be added to id_to_const_val_ and const_val_to_id_ so // that we can use the new Normal Constants when folding following Spec // Constants. - case spv::Op::OpSpecConstantOp: - modified |= ProcessOpSpecConstantOp(&inst_iter); + case spv::Op::OpSpecConstantOp: { + const auto status = ProcessOpSpecConstantOp(&inst_iter); + if (status == Status::Failure) { + return Status::Failure; + } + if (status == Status::SuccessWithChange) { + modified = true; + } break; + } default: break; } @@ -106,7 +122,7 @@ Pass::Status FoldSpecConstantOpAndCompositePass::Process() { return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } -bool FoldSpecConstantOpAndCompositePass::ProcessOpSpecConstantOp( +Pass::Status FoldSpecConstantOpAndCompositePass::ProcessOpSpecConstantOp( Module::inst_iterator* pos) { Instruction* inst = &**pos; Instruction* folded_inst = nullptr; @@ -116,10 +132,17 @@ bool FoldSpecConstantOpAndCompositePass::ProcessOpSpecConstantOp( "SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER type"); folded_inst = FoldWithInstructionFolder(pos); + if (context()->id_overflow()) { + return Status::Failure; + } + if (!folded_inst) { folded_inst = DoComponentWiseOperation(pos); + if (context()->id_overflow()) { + return Status::Failure; + } } - if (!folded_inst) return false; + if (!folded_inst) return Status::SuccessWithoutChange; // Replace the original constant with the new folded constant, kill the // original constant. @@ -127,7 +150,7 @@ bool FoldSpecConstantOpAndCompositePass::ProcessOpSpecConstantOp( uint32_t old_id = inst->result_id(); context()->ReplaceAllUsesWith(old_id, new_id); context()->KillDef(old_id); - return true; + return Status::SuccessWithChange; } Instruction* FoldSpecConstantOpAndCompositePass::FoldWithInstructionFolder( @@ -186,7 +209,11 @@ Instruction* FoldSpecConstantOpAndCompositePass::FoldWithInstructionFolder( if (need_to_clone) { new_const_inst = new_const_inst->Clone(context()); - new_const_inst->SetResultId(TakeNextId()); + uint32_t new_id = TakeNextId(); + if (new_id == 0) { + return nullptr; + } + new_const_inst->SetResultId(new_id); new_const_inst->InsertAfter(insert_pos); get_def_use_mgr()->AnalyzeInstDefUse(new_const_inst); } diff --git a/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h b/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h index 9a8fb403d7..d48809ca31 100644 --- a/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h +++ b/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h @@ -19,6 +19,7 @@ #include #include +#include "source/diagnostic.h" #include "source/opt/constants.h" #include "source/opt/def_use_manager.h" #include "source/opt/ir_context.h" @@ -45,14 +46,14 @@ class FoldSpecConstantOpAndCompositePass : public Pass { private: // Processes the OpSpecConstantOp instruction pointed by the given // instruction iterator, folds it to normal constants if possible. Returns - // true if the spec constant is folded to normal constants. New instructions - // will be inserted before the OpSpecConstantOp instruction pointed by the - // instruction iterator. The instruction iterator, which is passed by - // pointer, will still point to the original OpSpecConstantOp instruction. If - // folding is done successfully, the original OpSpecConstantOp instruction - // will be changed to Nop and new folded instruction will be inserted before - // it. - bool ProcessOpSpecConstantOp(Module::inst_iterator* pos); + // kSuccess if the spec constant is folded to normal constants. New + // instructions will be inserted before the OpSpecConstantOp instruction + // pointed by the instruction iterator. The instruction iterator, which is + // passed by pointer, will still point to the original OpSpecConstantOp + // instruction. If folding is done successfully, the original OpSpecConstantOp + // instruction will be changed to Nop and new folded instruction will be + // inserted before it. Returns kFail if an id overflow occurs. + Status ProcessOpSpecConstantOp(Module::inst_iterator* pos); // Returns the result of folding the OpSpecConstantOp instruction // |inst_iter_ptr| using the instruction folder. @@ -62,7 +63,24 @@ class FoldSpecConstantOpAndCompositePass : public Pass { // pointed by the given instruction iterator to a normal constant defining // instruction. Returns the pointer to the new constant defining instruction // if succeeded, otherwise return nullptr. + // instruction if succeeded, otherwise return nullptr. Instruction* DoComponentWiseOperation(Module::inst_iterator* inst_iter_ptr); + + // Returns the next available id, or 0 if the id overflows. + uint32_t TakeNextId() { + uint32_t next_id = context()->TakeNextId(); + if (next_id == 0) { + Fail() << "ID overflow. Try running compact-ids."; + } + return next_id; + } + + // Records failure for the current module and returns a stream for printing + // diagnostics. + spvtools::DiagnosticStream Fail() { + return spvtools::DiagnosticStream({}, context()->consumer(), "", + SPV_ERROR_INTERNAL); + } }; } // namespace opt diff --git a/third_party/spirv-tools/source/opt/folding_rules.cpp b/third_party/spirv-tools/source/opt/folding_rules.cpp index 3f5f79a22d..a20d9040d4 100644 --- a/third_party/spirv-tools/source/opt/folding_rules.cpp +++ b/third_party/spirv-tools/source/opt/folding_rules.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include "ir_builder.h" @@ -115,12 +116,6 @@ bool IsValidResult(T val) { } } -// Returns true if `type` is a cooperative matrix. -bool IsCooperativeMatrix(const analysis::Type* type) { - return type->kind() == analysis::Type::kCooperativeMatrixKHR || - type->kind() == analysis::Type::kCooperativeMatrixNV; -} - const analysis::Constant* ConstInput( const std::vector& constants) { return constants[0] ? constants[0] : constants[1]; @@ -176,12 +171,57 @@ std::vector GetWordsFromNumericScalarOrVectorConstant( return GetWordsFromScalarIntConstant(int_constant); } else if (const auto* vec_constant = c->AsVectorConstant()) { std::vector words; + // Retrieve all the components as 32bit words. for (const auto* comp : vec_constant->GetComponents()) { auto comp_in_words = GetWordsFromNumericScalarOrVectorConstant(const_mgr, comp); words.insert(words.end(), comp_in_words.begin(), comp_in_words.end()); } - return words; + + if (ElementWidth(c->type()) >= 32) { + return words; + } + // Check the element width and concactenate if the width is less than 32. + if (ElementWidth(c->type()) == 8) { + assert(words.size() <= 4); + // Each 32-bit word will comprise 4 8-bit integers. + // reverse the order when compacting. + uint32_t compacted_word = 0; + for (int32_t i = static_cast(words.size()) - 1; i >= 0; --i) { + compacted_word <<= 8; + compacted_word |= (words[i] & 0xFF); + } + return {compacted_word}; + } else if (ElementWidth(c->type()) == 16) { + assert(words.size() <= 4); + std::vector compacted_words; + // Each 32-bit word will comprise 2 16-bit integers. + // reverse the order pair-wise when compacting. + for (uint32_t i = 0; i < words.size(); i += 2) { + uint32_t word1 = words[i]; + uint32_t word2 = (i + 1 < words.size()) ? words[i + 1] : 0; + uint32_t compacted_word = (word2 << 16) | (word1 & 0xFFFF); + compacted_words.push_back(compacted_word); + } + return compacted_words; + } + assert(false && "Unhandled element width"); + } else if (c->AsNullConstant()) { + uint32_t num_elements = 1; + + if (const auto* vec_type = c->type()->AsVector()) { + num_elements = vec_type->element_count(); + } + + // We need to check the element width to determine how many 32-bit words are + // needed. + uint32_t element_width = ElementWidth(c->type()); + if (element_width < 32) { + num_elements = (num_elements + 1) / 2; + } else if (element_width == 64) { + num_elements = num_elements * 2; + } + return std::vector(num_elements, 0); } return {}; } @@ -323,7 +363,7 @@ FoldingRule ReciprocalFDiv() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -409,7 +449,7 @@ FoldingRule MergeNegateMulDivArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -476,7 +516,7 @@ FoldingRule MergeNegateAddSubArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -634,6 +674,15 @@ uint32_t PerformIntegerOperation(analysis::ConstantManager* const_mgr, case spv::Op::OpISub: FOLD_OP(-); break; + case spv::Op::OpBitwiseXor: + FOLD_OP(^); + break; + case spv::Op::OpBitwiseOr: + FOLD_OP(|); + break; + case spv::Op::OpBitwiseAnd: + FOLD_OP(&); + break; default: assert(false && "Unexpected operation"); break; @@ -712,7 +761,7 @@ FoldingRule MergeMulMulArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -771,7 +820,7 @@ FoldingRule MergeMulDivArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -849,7 +898,7 @@ FoldingRule MergeMulNegateArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -879,6 +928,46 @@ FoldingRule MergeMulNegateArithmetic() { }; } +// Returns true if |inst| is negation op and is safe to fold. +static bool IsFoldableNegation(const Instruction* inst) { + return (inst->opcode() == spv::Op::OpSNegate || + (inst->opcode() == spv::Op::OpFNegate && + inst->IsFloatingPointFoldingAllowed())); +} + +// Merges multiplies / divisions of two negations. +// Cases: +// (-x) * (-y) = x * y +// (-x) / (-y) = x / y +FoldingRule MergeDivMulDoubleNegative() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == spv::Op::OpFMul || + inst->opcode() == spv::Op::OpVectorTimesScalar || + inst->opcode() == spv::Op::OpFDiv || + inst->opcode() == spv::Op::OpIMul || + inst->opcode() == spv::Op::OpSDiv); + + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* lhs = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + Instruction* rhs = def_use_mgr->GetDef(inst->GetSingleWordInOperand(1)); + + if (IsFoldableNegation(lhs) && IsFoldableNegation(rhs)) { + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {lhs->GetSingleWordInOperand(0u)}}, + {SPV_OPERAND_TYPE_ID, {rhs->GetSingleWordInOperand(0u)}}}); + return true; + } + return false; + }; +} + // Merges consecutive divides if each instruction contains one constant operand. // Does not support integer division. // Cases: @@ -894,7 +983,7 @@ FoldingRule MergeDivDivArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -972,7 +1061,7 @@ FoldingRule MergeDivMulArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -1071,13 +1160,12 @@ FoldingRule MergeDivNegateArithmetic() { }; } -// Folds addition of a constant and a negation. -// Cases: -// (-x) + 2 = 2 - x -// 2 + (-x) = 2 - x +// Folds addition, where one side is a negation. +// (-x) + y = y - x +// y + (-x) = y - x FoldingRule MergeAddNegateArithmetic() { return [](IRContext* context, Instruction* inst, - const std::vector& constants) { + const std::vector&) { assert(inst->opcode() == spv::Op::OpFAdd || inst->opcode() == spv::Op::OpIAdd); const analysis::Type* type = @@ -1085,73 +1173,65 @@ FoldingRule MergeAddNegateArithmetic() { bool uses_float = HasFloatingPoint(type); if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; - const analysis::Constant* const_input1 = ConstInput(constants); - if (!const_input1) return false; - Instruction* other_inst = NonConstInput(context, constants[0], inst); - if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) - return false; + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* lhs = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + Instruction* rhs = def_use_mgr->GetDef(inst->GetSingleWordInOperand(1)); - if (other_inst->opcode() == spv::Op::OpSNegate || - other_inst->opcode() == spv::Op::OpFNegate) { - inst->SetOpcode(HasFloatingPoint(type) ? spv::Op::OpFSub - : spv::Op::OpISub); - uint32_t const_id = constants[0] ? inst->GetSingleWordInOperand(0u) - : inst->GetSingleWordInOperand(1u); - inst->SetInOperands( - {{SPV_OPERAND_TYPE_ID, {const_id}}, - {SPV_OPERAND_TYPE_ID, {other_inst->GetSingleWordInOperand(0u)}}}); - return true; - } - return false; + auto TrySubstitute = [inst, uses_float](Instruction* first, + Instruction* second) { + if (IsFoldableNegation(first)) { + inst->SetOpcode(uses_float ? spv::Op::OpFSub : spv::Op::OpISub); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {second->result_id()}}, + {SPV_OPERAND_TYPE_ID, {first->GetSingleWordInOperand(0u)}}}); + return true; + } + return false; + }; + + return TrySubstitute(lhs, rhs) || TrySubstitute(rhs, lhs); }; } -// Folds subtraction of a constant and a negation. +// Folds subtraction, where one side is a negation. // Cases: // (-x) - 2 = -2 - x -// 2 - (-x) = x + 2 +// y - (-x) = x + y FoldingRule MergeSubNegateArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { assert(inst->opcode() == spv::Op::OpFSub || inst->opcode() == spv::Op::OpISub); - analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { - return false; - } - bool uses_float = HasFloatingPoint(type); if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* lhs = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + Instruction* rhs = def_use_mgr->GetDef(inst->GetSingleWordInOperand(1)); + + if (IsFoldableNegation(rhs)) { + inst->SetOpcode(uses_float ? spv::Op::OpFAdd : spv::Op::OpIAdd); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {lhs->result_id()}}, + {SPV_OPERAND_TYPE_ID, {rhs->GetSingleWordInOperand(0)}}}); + return true; + } + + if (type->IsCooperativeMatrix()) { + return false; + } + uint32_t width = ElementWidth(type); if (width != 32 && width != 64) return false; - const analysis::Constant* const_input1 = ConstInput(constants); - if (!const_input1) return false; - Instruction* other_inst = NonConstInput(context, constants[0], inst); - if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) - return false; - - if (other_inst->opcode() == spv::Op::OpSNegate || - other_inst->opcode() == spv::Op::OpFNegate) { - uint32_t op1 = 0; - uint32_t op2 = 0; - spv::Op opcode = inst->opcode(); - if (constants[0] != nullptr) { - op1 = other_inst->GetSingleWordInOperand(0u); - op2 = inst->GetSingleWordInOperand(0u); - opcode = HasFloatingPoint(type) ? spv::Op::OpFAdd : spv::Op::OpIAdd; - } else { - op1 = NegateConstant(const_mgr, const_input1); - op2 = other_inst->GetSingleWordInOperand(0u); - } - - inst->SetOpcode(opcode); + if (constants[1] && IsFoldableNegation(lhs)) { inst->SetInOperands( - {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}}); + {{SPV_OPERAND_TYPE_ID, + {NegateConstant(context->get_constant_mgr(), constants[1])}}, + {SPV_OPERAND_TYPE_ID, {lhs->GetSingleWordInOperand(0)}}}); return true; } return false; @@ -1172,7 +1252,7 @@ FoldingRule MergeAddAddArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -1225,7 +1305,7 @@ FoldingRule MergeAddSubArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -1290,7 +1370,7 @@ FoldingRule MergeSubAddArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -1361,7 +1441,7 @@ FoldingRule MergeSubSubArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -1459,7 +1539,7 @@ FoldingRule MergeGenericAddSubArithmetic() { const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); - if (IsCooperativeMatrix(type)) { + if (type->IsCooperativeMatrix()) { return false; } @@ -1476,11 +1556,13 @@ FoldingRule MergeGenericAddSubArithmetic() { }; } -// Helper function for FactorAddMuls. If |factor0_0| is the same as |factor1_0|, -// generate |factor0_0| * (|factor0_1| + |factor1_1|). -bool FactorAddMulsOpnds(uint32_t factor0_0, uint32_t factor0_1, - uint32_t factor1_0, uint32_t factor1_1, - Instruction* inst) { +// Helper function for FactorAddSubMuls. +// If |factor0_0| is the same as |factor1_0|, generate: +// |factor0_0| * (|factor0_1| + |factor1_1|) +// |factor0_0| * (|factor0_1| - |factor1_1|) +bool FactorAddSubMulsOpnds(uint32_t factor0_0, uint32_t factor0_1, + uint32_t factor1_0, uint32_t factor1_1, + Instruction* inst) { IRContext* context = inst->context(); if (factor0_0 != factor1_0) return false; InstructionBuilder ir_builder( @@ -1488,8 +1570,13 @@ bool FactorAddMulsOpnds(uint32_t factor0_0, uint32_t factor0_1, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); Instruction* new_add_inst = ir_builder.AddBinaryOp( inst->type_id(), inst->opcode(), factor0_1, factor1_1); - inst->SetOpcode(inst->opcode() == spv::Op::OpFAdd ? spv::Op::OpFMul - : spv::Op::OpIMul); + if (!new_add_inst) { + return false; + } + + bool is_float = + inst->opcode() == spv::Op::OpFAdd || inst->opcode() == spv::Op::OpFSub; + inst->SetOpcode(is_float ? spv::Op::OpFMul : spv::Op::OpIMul); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {factor0_0}}, {SPV_OPERAND_TYPE_ID, {new_add_inst->result_id()}}}); context->UpdateDefUse(inst); @@ -1497,12 +1584,16 @@ bool FactorAddMulsOpnds(uint32_t factor0_0, uint32_t factor0_1, } // Perform the following factoring identity, handling all operand order -// combinations: (a * b) + (a * c) = a * (b + c) -FoldingRule FactorAddMuls() { +// combinations: +// (a * b) + (a * c) = a * (b + c) +// (a * b) - (a * c) = a * (b - c) +FoldingRule FactorAddSubMuls() { return [](IRContext* context, Instruction* inst, const std::vector&) { assert(inst->opcode() == spv::Op::OpFAdd || - inst->opcode() == spv::Op::OpIAdd); + inst->opcode() == spv::Op::OpFSub || + inst->opcode() == spv::Op::OpIAdd || + inst->opcode() == spv::Op::OpISub); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); bool uses_float = HasFloatingPoint(type); @@ -1533,11 +1624,11 @@ FoldingRule FactorAddMuls() { for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { // Check if operand i in add_op0_inst matches operand j in add_op1_inst. - if (FactorAddMulsOpnds(add_op0_inst->GetSingleWordInOperand(i), - add_op0_inst->GetSingleWordInOperand(1 - i), - add_op1_inst->GetSingleWordInOperand(j), - add_op1_inst->GetSingleWordInOperand(1 - j), - inst)) + if (FactorAddSubMulsOpnds(add_op0_inst->GetSingleWordInOperand(i), + add_op0_inst->GetSingleWordInOperand(1 - i), + add_op1_inst->GetSingleWordInOperand(j), + add_op1_inst->GetSingleWordInOperand(1 - j), + inst)) return true; } } @@ -1998,6 +2089,15 @@ FoldingRule FMixFeedingExtract() { bool use_x = false; assert(a_const->type()->AsFloat()); + + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) { + // We won't support folding half float values. + return false; + } + double element_value = a_const->GetValueAsDouble(); if (element_value == 0.0) { use_x = true; @@ -2230,6 +2330,81 @@ FoldingRule BitCastScalarOrVector() { }; } +// Remove indirect bitcasts which have no effect. +// uint32 x; asuint32(x) => x +// uint32 x; asuint32(asint32(x)) => x +// float32 x; asuint32(asint32(x)) => asuint32(x) +FoldingRule RedundantBitcast() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == spv::Op::OpBitcast); + + analysis::DefUseManager* def_mgr = context->get_def_use_mgr(); + Instruction* child = def_mgr->GetDef(inst->GetSingleWordInOperand(0)); + + if (inst->type_id() == child->type_id()) { + inst->SetOpcode(spv::Op::OpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {child->result_id()}}}); + return true; + } + + if (child->opcode() != spv::Op::OpBitcast) { + return false; + } + + if (def_mgr->GetDef(child->GetSingleWordInOperand(0))->type_id() == + inst->type_id()) { + inst->SetOpcode(spv::Op::OpCopyObject); + } + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {child->GetSingleWordInOperand(0)}}}); + + return true; + }; +} + +FoldingRule BitReverseScalarOrVector() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpBitReverse && constants.size() == 1); + if (constants[0] == nullptr) return false; + + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + assert(!HasFloatingPoint(type) && + "BitReverse cannot be applied to floating point types."); + assert((type->AsInteger() || type->AsVector()) && + "BitReverse can only be applied to integer scalars or vectors."); + assert((ElementWidth(type) == 32) && + "BitReverse can only be applied to integer types of width 32"); + + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + std::vector words = + GetWordsFromNumericScalarOrVectorConstant(const_mgr, constants[0]); + if (words.size() == 0) return false; + + for (uint32_t& word : words) { + // Reverse the bits in each word. + word = ((word & 0x55555555) << 1) | ((word >> 1) & 0x55555555); + word = ((word & 0x33333333) << 2) | ((word >> 2) & 0x33333333); + word = ((word & 0x0F0F0F0F) << 4) | ((word >> 4) & 0x0F0F0F0F); + word = ((word & 0x00FF00FF) << 8) | ((word >> 8) & 0x00FF00FF); + word = (word << 16) | (word >> 16); + } + + const analysis::Constant* bitreversed_constant = + ConvertWordsToNumericScalarOrVectorConstant(const_mgr, words, type); + if (!bitreversed_constant) return false; + + auto new_feeder_id = + const_mgr->GetDefiningInstruction(bitreversed_constant, inst->type_id()) + ->result_id(); + inst->SetOpcode(spv::Op::OpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {new_feeder_id}}}); + return true; + }; +} + FoldingRule RedundantSelect() { // An OpSelect instruction where both values are the same or the condition is // constant can be replaced by one of the values @@ -2302,6 +2477,250 @@ FoldingRule RedundantSelect() { }; } +std::optional GetBoolConstantKind(const analysis::Constant* c) { + if (!c) { + return {}; + } + if (auto composite = c->AsCompositeConstant()) { + auto& components = composite->GetComponents(); + if (components.empty()) { + return {}; + } + auto first = GetBoolConstantKind(components[0]); + if (!first) { + return {}; + } + if (std::all_of(std::begin(components) + 1, std::end(components), + [first](const analysis::Constant* c2) { + return GetBoolConstantKind(c2) == first; + })) { + return first; + } + return {}; + } else if (c->AsNullConstant()) { + return false; + } else if (c->AsBoolConstant()) { + return c->AsBoolConstant()->value(); + } + return {}; +} + +// Fold OpSelect instructions which have constant booleans as their result. +// x ? true : false = x +// x ? false : true = !x +FoldingRule FoldConstantBooleanSelect() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpSelect); + assert(inst->NumInOperands() == 3); + assert(constants.size() == 3); + + if (!constants[1] || !constants[2]) { + return false; + } + + analysis::DefUseManager* def_mgr = context->get_def_use_mgr(); + if (inst->type_id() != + def_mgr->GetDef(inst->GetSingleWordInOperand(0))->type_id()) { + return false; + } + + std::optional uniform_true = GetBoolConstantKind(constants[1]); + std::optional uniform_false = GetBoolConstantKind(constants[2]); + + if (!uniform_true || !uniform_false) { + return false; + } + + if (uniform_true.value() && !uniform_false.value()) { + inst->SetOpcode(spv::Op::OpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0)}}}); + return true; + } else if (!uniform_true.value() && uniform_false.value()) { + inst->SetOpcode(spv::Op::OpLogicalNot); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0)}}}); + return true; + } + return false; + }; +} + +// Fold OpLogicalAnd instructions which have a constant true on one side. +// x && true = x +// true && x = x +FoldingRule RedundantLogicalAnd() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpLogicalAnd); + + if (GetBoolConstantKind(ConstInput(constants)) == + std::optional(true)) { + Instruction* other_inst = NonConstInput(context, constants[0], inst); + inst->SetOpcode(spv::Op::OpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {other_inst->result_id()}}}); + return true; + } + return false; + }; +} + +// Fold OpLogicalOr instructions which have a constant false on one side. +// x || false = x +// false || x = x +FoldingRule RedundantLogicalOr() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpLogicalOr); + + if (GetBoolConstantKind(ConstInput(constants)) == + std::optional(false)) { + Instruction* other_inst = NonConstInput(context, constants[0], inst); + inst->SetOpcode(spv::Op::OpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {other_inst->result_id()}}}); + return true; + } + return false; + }; +} + +// Fold concurrent OpLogicalNot instructions: +// !!x = x +FoldingRule RedundantLogicalNot() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == spv::Op::OpLogicalNot); + Instruction* child = + context->get_def_use_mgr()->GetDef(inst->GetSingleWordInOperand(0)); + if (child->opcode() == spv::Op::OpLogicalNot) { + inst->SetOpcode(spv::Op::OpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {child->GetSingleWordInOperand(0)}}}); + return true; + } + return false; + }; +} + +// Fold OpLogicalNot instructions that follow a comparison, +// if the comparison is only used by that instruction. +// +// !(a == b) = (a != b) +// !(a != b) = (a == b) +// !(a < b) = (a >= b) +// !(a >= b) = (a < b) +// !(a > b) = (a <= b) +// !(a <= b) = (a > b) +FoldingRule FoldLogicalNotComparison() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == spv::Op::OpLogicalNot); + analysis::DefUseManager* def_mgr = context->get_def_use_mgr(); + Instruction* child = + context->get_def_use_mgr()->GetDef(inst->GetSingleWordInOperand(0)); + + if (def_mgr->NumUses(child) > 1) { + return false; + } + + spv::Op new_opcode = spv::Op::OpNop; + switch (child->opcode()) { + // (a == b) <=> (a != b) + case spv::Op::OpIEqual: + new_opcode = spv::Op::OpINotEqual; + break; + case spv::Op::OpINotEqual: + new_opcode = spv::Op::OpIEqual; + break; + case spv::Op::OpFOrdEqual: + new_opcode = spv::Op::OpFUnordNotEqual; + break; + case spv::Op::OpFOrdNotEqual: + new_opcode = spv::Op::OpFUnordEqual; + break; + case spv::Op::OpFUnordEqual: + new_opcode = spv::Op::OpFOrdNotEqual; + break; + case spv::Op::OpFUnordNotEqual: + new_opcode = spv::Op::OpFOrdEqual; + break; + case spv::Op::OpLogicalEqual: + new_opcode = spv::Op::OpLogicalNotEqual; + break; + case spv::Op::OpLogicalNotEqual: + new_opcode = spv::Op::OpLogicalEqual; + break; + + // (a > b) <=> (a <= b) + case spv::Op::OpUGreaterThan: + new_opcode = spv::Op::OpULessThanEqual; + break; + case spv::Op::OpULessThanEqual: + new_opcode = spv::Op::OpUGreaterThan; + break; + case spv::Op::OpSGreaterThan: + new_opcode = spv::Op::OpSLessThanEqual; + break; + case spv::Op::OpSLessThanEqual: + new_opcode = spv::Op::OpSGreaterThan; + break; + case spv::Op::OpFOrdGreaterThan: + new_opcode = spv::Op::OpFUnordLessThanEqual; + break; + case spv::Op::OpFOrdLessThanEqual: + new_opcode = spv::Op::OpFUnordGreaterThan; + break; + case spv::Op::OpFUnordGreaterThan: + new_opcode = spv::Op::OpFOrdLessThanEqual; + break; + case spv::Op::OpFUnordLessThanEqual: + new_opcode = spv::Op::OpFOrdGreaterThan; + break; + + // (a < b) <=> (a >= b) + case spv::Op::OpULessThan: + new_opcode = spv::Op::OpUGreaterThanEqual; + break; + case spv::Op::OpUGreaterThanEqual: + new_opcode = spv::Op::OpULessThan; + break; + case spv::Op::OpSLessThan: + new_opcode = spv::Op::OpSGreaterThanEqual; + break; + case spv::Op::OpSGreaterThanEqual: + new_opcode = spv::Op::OpSLessThan; + break; + case spv::Op::OpFOrdLessThan: + new_opcode = spv::Op::OpFUnordGreaterThanEqual; + break; + case spv::Op::OpFOrdGreaterThanEqual: + new_opcode = spv::Op::OpFUnordLessThan; + break; + case spv::Op::OpFUnordLessThan: + new_opcode = spv::Op::OpFOrdGreaterThanEqual; + break; + case spv::Op::OpFUnordGreaterThanEqual: + new_opcode = spv::Op::OpFOrdLessThan; + break; + + default: + break; + } + + if (new_opcode == spv::Op::OpNop) { + return false; + } + + inst->SetOpcode(new_opcode); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {child->GetSingleWordInOperand(0)}}, + {SPV_OPERAND_TYPE_ID, {child->GetSingleWordInOperand(1)}}}); + + return true; + }; +} + enum class FloatConstantKind { Unknown, Zero, One }; FloatConstantKind getFloatConstantKind(const analysis::Constant* constant) { @@ -2601,6 +3020,56 @@ FoldingRule RedundantBinaryLhs0To0(spv::Op op) { return RedundantBinaryOpWithZeroOperand(0, 0); } +FoldingRule ReassociateCommutiveOp() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + uint32_t width = ElementWidth(type); + if (width != 32) return false; + + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + + if (other_inst->opcode() == inst->opcode()) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + Instruction* non_const_input = + NonConstInput(context, other_constants[0], other_inst); + uint32_t merged_id = PerformOperation(const_mgr, inst->opcode(), + const_input1, const_input2); + + if (merged_id == 0) return false; + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {non_const_input->result_id()}}, + {SPV_OPERAND_TYPE_ID, {merged_id}}}); + return true; + } + + return false; + }; +} + +// A | (b | C) = b | (A | C) +// A ^ (b ^ C) = b ^ (A ^ C) +// A & (b & C) = b & (A & C) +// Where A and C are constants +static const constexpr spv::Op ReassociateCommutiveBitwiseOps[] = { + spv::Op::OpBitwiseOr, spv::Op::OpBitwiseXor, spv::Op::OpBitwiseAnd}; +FoldingRule ReassociateCommutiveBitwise(spv::Op op) { + assert(std::find(std::begin(ReassociateCommutiveBitwiseOps), + std::end(ReassociateCommutiveBitwiseOps), + op) != std::end(ReassociateCommutiveBitwiseOps) && + "Wrong opcode."); + (void)op; + return ReassociateCommutiveOp(); +} + // Returns true if all elements in |c| are 1. bool IsAllInt1(const analysis::Constant* c) { if (auto composite = c->AsCompositeConstant()) { @@ -2661,6 +3130,230 @@ FoldingRule RedundantSUMod() { }; } +// Utility function for applying |callback| to |input1| and |input2|. +// If they are vectors it applies element wise. +// The constants |input1| and |input2| must be integers or a vector of integers. +template +void ForEachIntegerConstantPair(analysis::ConstantManager* const_mgr, + const analysis::Constant* input1, + const analysis::Constant* input2, + Callback&& callback) { + assert(input1 && input2); + + auto Dispatch = [&callback](const analysis::Constant* lhs, + const analysis::Constant* rhs) { + assert(lhs->type()->AsInteger()); + const analysis::Integer* type = lhs->type()->AsInteger(); + uint32_t width = type->AsInteger()->width(); + assert(width == 32 || width == 64); + if (width == 32) { + callback(lhs->GetU32(), rhs->GetU32()); + } else { + callback(lhs->GetU64(), rhs->GetU64()); + } + }; + + const analysis::Type* type = input1->type(); + if (const analysis::Vector* vector_type = type->AsVector()) { + const analysis::Type* ele_type = vector_type->element_type(); + assert(ele_type->AsInteger()); + for (uint32_t i = 0; i != vector_type->element_count(); ++i) { + const analysis::Constant* input1_comp = nullptr; + if (const analysis::VectorConstant* input1_vector = + input1->AsVectorConstant()) { + input1_comp = input1_vector->GetComponents()[i]; + } else { + assert(input1->AsNullConstant()); + input1_comp = const_mgr->GetConstant(ele_type, {}); + } + + const analysis::Constant* input2_comp = nullptr; + if (const analysis::VectorConstant* input2_vector = + input2->AsVectorConstant()) { + input2_comp = input2_vector->GetComponents()[i]; + } else { + assert(input2->AsNullConstant()); + input2_comp = const_mgr->GetConstant(ele_type, {}); + } + + assert(ele_type->AsInteger()); + Dispatch(input1_comp, input2_comp); + } + + } else { + assert(type->AsInteger()); + Dispatch(input1, input2); + } +} + +// Folds redundant xor and or ops that are part of an and. +// Cases handled: +// 0b1110 & (a | 0b0001) = a & 0b1110 +// 0b1110 & (a ^ 0b0001) = a & 0b1110 +// 0b0110 & (a | 0b1110) = 0b0110 +FoldingRule RedundantAndOrXor() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpBitwiseAnd && "Wrong opcode."); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + uint32_t width = ElementWidth(type); + if ((width != 32) && (width != 64)) return false; + + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + + if (other_inst->opcode() == spv::Op::OpBitwiseOr || + other_inst->opcode() == spv::Op::OpBitwiseXor) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + bool can_convert_to_const = other_inst->opcode() == spv::Op::OpBitwiseOr; + bool can_remove_inner = true; + + ForEachIntegerConstantPair( + const_mgr, const_input1, const_input2, + [&can_remove_inner, &can_convert_to_const](auto lhs, auto rhs) { + // Only convert to const if 'and' is a subset of 'or' + can_convert_to_const = can_convert_to_const && ((lhs & rhs) == lhs); + // Only remove 'xor'/'or' if no bits intersect with 'and' + can_remove_inner = can_remove_inner && ((lhs & rhs) == 0); + }); + + if (can_convert_to_const) { + Instruction* const_inst = + const_mgr->GetDefiningInstruction(const_input1); + inst->SetOpcode(spv::Op::OpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {const_inst->result_id()}}}); + return true; + } else if (can_remove_inner) { + Instruction* non_const_input = + NonConstInput(context, other_constants[0], other_inst); + Instruction* const_inst = + const_mgr->GetDefiningInstruction(const_input1); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {non_const_input->result_id()}}, + {SPV_OPERAND_TYPE_ID, {const_inst->result_id()}}}); + return true; + } + } + return false; + }; +} + +// Folds redundant add and sub ops that are part of an and. +// Cases handled: +// 1 & (b + 2) = b & 1 +// 1 & (b - 2) = b & 1 +FoldingRule RedundantAndAddSub() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpBitwiseAnd && "Wrong opcode."); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + uint32_t width = ElementWidth(type); + if ((width != 32) && (width != 64)) return false; + + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + + if (other_inst->opcode() != spv::Op::OpIAdd && + other_inst->opcode() != spv::Op::OpISub) { + return false; + } + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + // Only valid for subtraction if const is on the right + if ((other_inst->opcode() == spv::Op::OpISub) && other_constants[0]) { + return false; + } + + bool can_remove_inner = true; + ForEachIntegerConstantPair(const_mgr, const_input1, const_input2, + [&can_remove_inner](auto and_op, auto add_op) { + if (can_remove_inner) { + // Only valid if no bits from the +/- could + // affect bits from the & operation. + can_remove_inner = + utils::LSB(add_op) > and_op; + } + }); + + if (can_remove_inner) { + Instruction* non_const_input = + NonConstInput(context, other_constants[0], other_inst); + Instruction* const_inst = const_mgr->GetDefiningInstruction(const_input1); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {non_const_input->result_id()}}, + {SPV_OPERAND_TYPE_ID, {const_inst->result_id()}}}); + return true; + } + return false; + }; +} + +// Folds redundant shift ops that are part of an and. +// Cases handled: +// 1 & (b << 1) = 0 +// 0x80000000 & (b >> 1) = 0 +FoldingRule RedundantAndShift() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpBitwiseAnd && "Wrong opcode."); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + uint32_t width = ElementWidth(type); + if ((width != 32) && (width != 64)) return false; + + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + + spv::Op other_op = other_inst->opcode(); + if (other_op == spv::Op::OpShiftLeftLogical || + other_op == spv::Op::OpShiftRightLogical) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + + // Only valid if const is on the right + if (other_constants[0]) { + return false; + } + const analysis::Constant* const_input2 = other_constants[1]; + if (!const_input2) return false; + + bool can_convert_to_zero = true; + ForEachIntegerConstantPair( + const_mgr, const_input1, const_input2, + [&can_convert_to_zero, other_op](auto lhs, auto rhs) { + if (other_op == spv::Op::OpShiftRightLogical) { + can_convert_to_zero = can_convert_to_zero && (lhs << rhs) == 0; + } else { + can_convert_to_zero = can_convert_to_zero && (lhs >> rhs) == 0; + } + }); + + if (can_convert_to_zero) { + auto zero_id = context->get_constant_mgr()->GetNullConstId(type); + inst->SetOpcode(spv::Op::OpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {zero_id}}}); + return true; + } + } + return false; + }; +} + // This rule look for a dot with a constant vector containing a single 1 and // the rest 0s. This is the same as doing an extract. FoldingRule DotProductDoingExtract() { @@ -3004,12 +3697,17 @@ void FoldingRules::AddFoldingRules() { rules_[op].push_back(RedundantBinaryLhs0(op)); for (auto op : RedundantBinaryLhs0To0Ops) rules_[op].push_back(RedundantBinaryLhs0To0(op)); + for (auto op : ReassociateCommutiveBitwiseOps) + rules_[op].push_back(ReassociateCommutiveBitwise(op)); rules_[spv::Op::OpSDiv].push_back(RedundantSUDiv()); rules_[spv::Op::OpUDiv].push_back(RedundantSUDiv()); rules_[spv::Op::OpSMod].push_back(RedundantSUMod()); rules_[spv::Op::OpUMod].push_back(RedundantSUMod()); rules_[spv::Op::OpBitcast].push_back(BitCastScalarOrVector()); + rules_[spv::Op::OpBitcast].push_back(RedundantBitcast()); + + rules_[spv::Op::OpBitReverse].push_back(BitReverseScalarOrVector()); rules_[spv::Op::OpCompositeConstruct].push_back( CompositeExtractFeedingConstruct); @@ -3032,13 +3730,14 @@ void FoldingRules::AddFoldingRules() { rules_[spv::Op::OpFAdd].push_back(MergeAddAddArithmetic()); rules_[spv::Op::OpFAdd].push_back(MergeAddSubArithmetic()); rules_[spv::Op::OpFAdd].push_back(MergeGenericAddSubArithmetic()); - rules_[spv::Op::OpFAdd].push_back(FactorAddMuls()); + rules_[spv::Op::OpFAdd].push_back(FactorAddSubMuls()); rules_[spv::Op::OpFDiv].push_back(RedundantFDiv()); rules_[spv::Op::OpFDiv].push_back(ReciprocalFDiv()); rules_[spv::Op::OpFDiv].push_back(MergeDivDivArithmetic()); rules_[spv::Op::OpFDiv].push_back(MergeDivMulArithmetic()); rules_[spv::Op::OpFDiv].push_back(MergeDivNegateArithmetic()); + rules_[spv::Op::OpFDiv].push_back(MergeDivMulDoubleNegative()); rules_[spv::Op::OpFMod].push_back(RedundantFMod()); @@ -3046,6 +3745,9 @@ void FoldingRules::AddFoldingRules() { rules_[spv::Op::OpFMul].push_back(MergeMulMulArithmetic()); rules_[spv::Op::OpFMul].push_back(MergeMulDivArithmetic()); rules_[spv::Op::OpFMul].push_back(MergeMulNegateArithmetic()); + rules_[spv::Op::OpFMul].push_back(MergeDivMulDoubleNegative()); + + rules_[spv::Op::OpVectorTimesScalar].push_back(MergeDivMulDoubleNegative()); rules_[spv::Op::OpFNegate].push_back(MergeNegateArithmetic()); rules_[spv::Op::OpFNegate].push_back(MergeNegateAddSubArithmetic()); @@ -3055,20 +3757,29 @@ void FoldingRules::AddFoldingRules() { rules_[spv::Op::OpFSub].push_back(MergeSubNegateArithmetic()); rules_[spv::Op::OpFSub].push_back(MergeSubAddArithmetic()); rules_[spv::Op::OpFSub].push_back(MergeSubSubArithmetic()); + rules_[spv::Op::OpFSub].push_back(FactorAddSubMuls()); rules_[spv::Op::OpIAdd].push_back(MergeAddNegateArithmetic()); rules_[spv::Op::OpIAdd].push_back(MergeAddAddArithmetic()); rules_[spv::Op::OpIAdd].push_back(MergeAddSubArithmetic()); rules_[spv::Op::OpIAdd].push_back(MergeGenericAddSubArithmetic()); - rules_[spv::Op::OpIAdd].push_back(FactorAddMuls()); + rules_[spv::Op::OpIAdd].push_back(FactorAddSubMuls()); + + rules_[spv::Op::OpSDiv].push_back(MergeDivMulDoubleNegative()); rules_[spv::Op::OpIMul].push_back(IntMultipleBy1()); rules_[spv::Op::OpIMul].push_back(MergeMulMulArithmetic()); rules_[spv::Op::OpIMul].push_back(MergeMulNegateArithmetic()); + rules_[spv::Op::OpIMul].push_back(MergeDivMulDoubleNegative()); rules_[spv::Op::OpISub].push_back(MergeSubNegateArithmetic()); rules_[spv::Op::OpISub].push_back(MergeSubAddArithmetic()); rules_[spv::Op::OpISub].push_back(MergeSubSubArithmetic()); + rules_[spv::Op::OpISub].push_back(FactorAddSubMuls()); + + rules_[spv::Op::OpBitwiseAnd].push_back(RedundantAndOrXor()); + rules_[spv::Op::OpBitwiseAnd].push_back(RedundantAndAddSub()); + rules_[spv::Op::OpBitwiseAnd].push_back(RedundantAndShift()); rules_[spv::Op::OpPhi].push_back(RedundantPhi()); @@ -3077,6 +3788,14 @@ void FoldingRules::AddFoldingRules() { rules_[spv::Op::OpSNegate].push_back(MergeNegateAddSubArithmetic()); rules_[spv::Op::OpSelect].push_back(RedundantSelect()); + rules_[spv::Op::OpSelect].push_back(FoldConstantBooleanSelect()); + + rules_[spv::Op::OpLogicalAnd].push_back(RedundantLogicalAnd()); + + rules_[spv::Op::OpLogicalOr].push_back(RedundantLogicalOr()); + + rules_[spv::Op::OpLogicalNot].push_back(RedundantLogicalNot()); + rules_[spv::Op::OpLogicalNot].push_back(FoldLogicalNotComparison()); rules_[spv::Op::OpStore].push_back(StoringUndef()); diff --git a/third_party/spirv-tools/source/opt/function.cpp b/third_party/spirv-tools/source/opt/function.cpp index 2ee88eca8e..560953b83f 100644 --- a/third_party/spirv-tools/source/opt/function.cpp +++ b/third_party/spirv-tools/source/opt/function.cpp @@ -40,6 +40,10 @@ Function* Function::Clone(IRContext* ctx) const { clone->blocks_.reserve(blocks_.size()); for (const auto& b : blocks_) { std::unique_ptr bb(b->Clone(ctx)); + if (!bb) { + delete clone; + return nullptr; + } clone->AddBasicBlock(std::move(bb)); } diff --git a/third_party/spirv-tools/source/opt/function.h b/third_party/spirv-tools/source/opt/function.h index 45a0b23ba5..39ecd5949b 100644 --- a/third_party/spirv-tools/source/opt/function.h +++ b/third_party/spirv-tools/source/opt/function.h @@ -48,7 +48,7 @@ class Function { explicit Function(const Function& f) = delete; - // Creates a clone of the instruction in the given |context| + // Creates a clone of the function in the given |context| // // The parent module will default to null and needs to be explicitly set by // the user. diff --git a/third_party/spirv-tools/source/opt/graph.cpp b/third_party/spirv-tools/source/opt/graph.cpp new file mode 100644 index 0000000000..ba1030d9d2 --- /dev/null +++ b/third_party/spirv-tools/source/opt/graph.cpp @@ -0,0 +1,90 @@ +// Copyright (c) 2022-2025 Arm Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/opt/graph.h" + +namespace spvtools { +namespace opt { + +Graph* Graph::Clone(IRContext* ctx) const { + Graph* clone = new Graph(std::unique_ptr(DefInst().Clone(ctx))); + + clone->inputs_.reserve(inputs_.size()); + for (const auto& i : inputs()) { + clone->AddInput(std::unique_ptr(i->Clone(ctx))); + } + + clone->insts_.reserve(insts_.size()); + for (const auto& i : instructions()) { + clone->AddInstruction(std::unique_ptr(i->Clone(ctx))); + } + + clone->outputs_.reserve(outputs_.size()); + for (const auto& i : outputs()) { + clone->AddOutput(std::unique_ptr(i->Clone(ctx))); + } + + clone->SetGraphEnd(std::unique_ptr(EndInst()->Clone(ctx))); + + return clone; +} + +void Graph::ForEachInst(const std::function& f, + bool run_on_debug_line_insts, + bool run_on_non_semantic_insts) { + (void)run_on_debug_line_insts; + (void)run_on_non_semantic_insts; + + f(def_inst_.get()); + + for (auto& inst : inputs_) { + f(inst.get()); + } + + for (auto& inst : insts_) { + f(inst.get()); + } + + for (auto& inst : outputs_) { + f(inst.get()); + } + + f(end_inst_.get()); +} + +void Graph::ForEachInst(const std::function& f, + bool run_on_debug_line_insts, + bool run_on_non_semantic_insts) const { + (void)run_on_debug_line_insts; + (void)run_on_non_semantic_insts; + + f(def_inst_.get()); + + for (auto& inst : inputs_) { + f(inst.get()); + } + + for (auto& inst : insts_) { + f(inst.get()); + } + + for (auto& inst : outputs_) { + f(inst.get()); + } + + f(end_inst_.get()); +} + +} // namespace opt +} // namespace spvtools diff --git a/third_party/spirv-tools/source/opt/graph.h b/third_party/spirv-tools/source/opt/graph.h new file mode 100644 index 0000000000..3b533b257a --- /dev/null +++ b/third_party/spirv-tools/source/opt/graph.h @@ -0,0 +1,124 @@ +// Copyright (c) 2022-2025 Arm Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_OPT_GRAPH_H_ +#define SOURCE_OPT_GRAPH_H_ + +#include "source/opt/instruction.h" + +namespace spvtools { +namespace opt { + +struct Graph { + // Creates a graph instance declared by the given OpGraph instruction + // |def_inst|. + inline explicit Graph(std::unique_ptr def_inst); + explicit Graph(const Graph& f) = delete; + + // Creates a clone of the graph in the given |context| + // + // The parent module will default to null and needs to be explicitly set by + // the user. + Graph* Clone(IRContext*) const; + + // The OpGraph instruction that begins the definition of this graph. + Instruction& DefInst() { return *def_inst_; } + const Instruction& DefInst() const { return *def_inst_; } + + // Appends an input to this graph. + inline void AddInput(std::unique_ptr inst); + + // Appends an instruction to this graph. + inline void AddInstruction(std::unique_ptr inst); + + // Appends an output to this graph. + inline void AddOutput(std::unique_ptr inst); + + // Saves the given graph end instruction. + void SetGraphEnd(std::unique_ptr end_inst); + + // Returns the given graph end instruction. + inline Instruction* EndInst() { return end_inst_.get(); } + inline const Instruction* EndInst() const { return end_inst_.get(); } + + // Returns graph's id + inline uint32_t result_id() const { return def_inst_->result_id(); } + + // Returns graph's return type id + inline uint32_t type_id() const { return def_inst_->type_id(); } + + // Return a read-only reference to the instructions that define the body of + // the graph. + const std::vector>& instructions() const { + return insts_; + } + + // Return a read-only reference to the instructions that define the inputs + // of the graph. + const std::vector>& inputs() const { + return inputs_; + } + + // Return a read-only reference to the instructions that define the outputs + // of the graph. + const std::vector>& outputs() const { + return outputs_; + } + + // Runs the given function |f| on instructions in this graph, in order, + // and optionally on debug line instructions that might precede them and + // non-semantic instructions that succceed the function. + void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false, + bool run_on_non_semantic_insts = false); + void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false, + bool run_on_non_semantic_insts = false) const; + + private: + // The OpGraph instruction that begins the definition of this graph. + std::unique_ptr def_inst_; + // All inputs to this graph. + std::vector> inputs_; + // All instructions describing this graph + std::vector> insts_; + // All outputs of this graph. + std::vector> outputs_; + // The OpGraphEnd instruction. + std::unique_ptr end_inst_; +}; + +inline Graph::Graph(std::unique_ptr def_inst) + : def_inst_(std::move(def_inst)) {} + +inline void Graph::AddInput(std::unique_ptr inst) { + inputs_.emplace_back(std::move(inst)); +} + +inline void Graph::AddInstruction(std::unique_ptr inst) { + insts_.emplace_back(std::move(inst)); +} + +inline void Graph::AddOutput(std::unique_ptr inst) { + outputs_.emplace_back(std::move(inst)); +} + +inline void Graph::SetGraphEnd(std::unique_ptr end_inst) { + end_inst_ = std::move(end_inst); +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_GRAPH_H_ diff --git a/third_party/spirv-tools/source/opt/graphics_robust_access_pass.cpp b/third_party/spirv-tools/source/opt/graphics_robust_access_pass.cpp index e765c39760..15076ec0ed 100644 --- a/third_party/spirv-tools/source/opt/graphics_robust_access_pass.cpp +++ b/third_party/spirv-tools/source/opt/graphics_robust_access_pass.cpp @@ -283,9 +283,14 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( // use 0 for %min_value). auto clamp_index = [&inst, type_mgr, this, &replace_index]( uint32_t operand_index, Instruction* old_value, - Instruction* min_value, Instruction* max_value) { + Instruction* min_value, + Instruction* max_value) -> spv_result_t { auto* clamp_inst = MakeSClampInst(*type_mgr, old_value, min_value, max_value, &inst); + if (clamp_inst == nullptr) { + Fail(); + return SPV_ERROR_INTERNAL; + } return replace_index(operand_index, clamp_inst); }; @@ -304,7 +309,11 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( if (count <= 1) { // Replace the index with 0. - return replace_index(operand_index, GetValueForType(0, index_type)); + Instruction* new_value = GetValueForType(0, index_type); + if (new_value == nullptr) { + return Fail(); + } + return replace_index(operand_index, new_value); } uint64_t maxval = count - 1; @@ -318,8 +327,15 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( // Determine the type for |maxval|. uint32_t next_id = context()->module()->IdBound(); analysis::Integer signed_type_for_query(maxval_width, true); - auto* maxval_type = - type_mgr->GetRegisteredType(&signed_type_for_query)->AsInteger(); + auto* maxval_type_registered = + type_mgr->GetRegisteredType(&signed_type_for_query); + if (maxval_type_registered == nullptr) { + return Fail(); + } + auto* maxval_type = maxval_type_registered->AsInteger(); + if (maxval_type == nullptr) { + return Fail(); + } if (next_id != context()->module()->IdBound()) { module_status_.modified = true; } @@ -352,15 +368,22 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( value = int_index_constant->GetS64BitValue(); } if (value < 0) { - return replace_index(operand_index, GetValueForType(0, index_type)); + Instruction* new_value = GetValueForType(0, index_type); + if (new_value == nullptr) { + return Fail(); + } + return replace_index(operand_index, new_value); } else if (uint64_t(value) <= maxval) { // Nothing to do. return SPV_SUCCESS; } else { // Replace with maxval. assert(count > 0); // Already took care of this case above. - return replace_index(operand_index, - GetValueForType(maxval, maxval_type)); + Instruction* new_value = GetValueForType(maxval, maxval_type); + if (new_value == nullptr) { + return Fail(); + } + return replace_index(operand_index, new_value); } } else { // Generate a clamp instruction. @@ -389,6 +412,9 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( } index_inst = WidenInteger(index_type->IsSigned(), maxval_width, index_inst, &inst); + if (index_inst == nullptr) { + return Fail(); + } } // Finally, clamp the index. @@ -438,28 +464,51 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( if (index_type->width() < target_width) { // Access chain indices are treated as signed integers. index_inst = WidenInteger(true, target_width, index_inst, &inst); + if (index_inst == nullptr) { + return Fail(); + } } else if (count_type->width() < target_width) { // Assume type sizes are treated as unsigned. count_inst = WidenInteger(false, target_width, count_inst, &inst); + if (count_inst == nullptr) { + return Fail(); + } } // Compute count - 1. // It doesn't matter if 1 is signed or unsigned. auto* one = GetValueForType(1, wider_type); - auto* count_minus_1 = InsertInst( - &inst, spv::Op::OpISub, type_mgr->GetId(wider_type), TakeNextId(), - {{SPV_OPERAND_TYPE_ID, {count_inst->result_id()}}, - {SPV_OPERAND_TYPE_ID, {one->result_id()}}}); + if (!one) { + return Fail(); + } + auto* count_minus_1 = + InsertInst(&inst, spv::Op::OpISub, type_mgr->GetId(wider_type), + context()->TakeNextId(), + {{SPV_OPERAND_TYPE_ID, {count_inst->result_id()}}, + {SPV_OPERAND_TYPE_ID, {one->result_id()}}}); + if (count_minus_1 == nullptr) { + return Fail(); + } auto* zero = GetValueForType(0, wider_type); + if (!zero) { + return Fail(); + } // Make sure we clamp to an upper bound that is at most the signed max // for the target type. const uint64_t max_signed_value = ((uint64_t(1) << (target_width - 1)) - 1); + Instruction* max_signed_inst = + GetValueForType(max_signed_value, wider_type); + if (!max_signed_inst) { + return Fail(); + } // Use unsigned-min to ensure that the result is always non-negative. // That ensures we satisfy the invariant for SClamp, where the "min" // argument we give it (zero), is no larger than the third argument. auto* upper_bound = - MakeUMinInst(*type_mgr, count_minus_1, - GetValueForType(max_signed_value, wider_type), &inst); + MakeUMinInst(*type_mgr, count_minus_1, max_signed_inst, &inst); + if (upper_bound == nullptr) { + return Fail(); + } // Now clamp the index to this upper bound. return clamp_index(operand_index, index_inst, zero, upper_bound); } @@ -485,7 +534,7 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( case spv::Op::OpTypeVector: // Use component count { const uint32_t count = pointee_type->GetSingleWordOperand(2); - clamp_to_literal_count(idx, count); + if (clamp_to_literal_count(idx, count) != SPV_SUCCESS) return; pointee_type = GetDef(pointee_type->GetSingleWordOperand(1)); } break; @@ -493,7 +542,7 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( // The array length can be a spec constant, so go through the general // case. Instruction* array_len = GetDef(pointee_type->GetSingleWordOperand(2)); - clamp_to_count(idx, array_len); + if (clamp_to_count(idx, array_len) != SPV_SUCCESS) return; pointee_type = GetDef(pointee_type->GetSingleWordOperand(1)); } break; @@ -537,7 +586,7 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( if (!array_len) { // We've already signaled an error. return; } - clamp_to_count(idx, array_len); + if (clamp_to_count(idx, array_len) != SPV_SUCCESS) return; if (module_status_.failed) return; pointee_type = GetDef(pointee_type->GetSingleWordOperand(1)); } break; @@ -563,7 +612,10 @@ uint32_t GraphicsRobustAccessPass::GetGlslInsts() { } if (module_status_.glsl_insts_id == 0) { // Make a new import instruction. - module_status_.glsl_insts_id = TakeNextId(); + module_status_.glsl_insts_id = context()->TakeNextId(); + if (module_status_.glsl_insts_id == 0) { + return 0; + } std::vector words = spvtools::utils::MakeVector(glsl); auto import_inst = MakeUnique( context(), spv::Op::OpExtInstImport, 0, module_status_.glsl_insts_id, @@ -602,7 +654,10 @@ opt::Instruction* opt::GraphicsRobustAccessPass::WidenInteger( auto* type_mgr = context()->get_type_mgr(); auto* unsigned_type = type_mgr->GetRegisteredType(&unsigned_type_for_query); auto type_id = context()->get_type_mgr()->GetId(unsigned_type); - auto conversion_id = TakeNextId(); + auto conversion_id = context()->TakeNextId(); + if (conversion_id == 0) { + return nullptr; + } auto* conversion = InsertInst( before_inst, (sign_extend ? spv::Op::OpSConvert : spv::Op::OpUConvert), type_id, conversion_id, {{SPV_OPERAND_TYPE_ID, {value->result_id()}}}); @@ -616,7 +671,13 @@ Instruction* GraphicsRobustAccessPass::MakeUMinInst( // the function so we force a deterministic ordering in case both of them need // to take a new ID. const uint32_t glsl_insts_id = GetGlslInsts(); - uint32_t smin_id = TakeNextId(); + if (glsl_insts_id == 0) { + return nullptr; + } + uint32_t smin_id = context()->TakeNextId(); + if (smin_id == 0) { + return nullptr; + } const auto xwidth = tm.GetType(x->type_id())->AsInteger()->width(); const auto ywidth = tm.GetType(y->type_id())->AsInteger()->width(); assert(xwidth == ywidth); @@ -640,7 +701,13 @@ Instruction* GraphicsRobustAccessPass::MakeSClampInst( // the function so we force a deterministic ordering in case both of them need // to take a new ID. const uint32_t glsl_insts_id = GetGlslInsts(); - uint32_t clamp_id = TakeNextId(); + if (glsl_insts_id == 0) { + return nullptr; + } + uint32_t clamp_id = context()->TakeNextId(); + if (clamp_id == 0) { + return nullptr; + } const auto xwidth = tm.GetType(x->type_id())->AsInteger()->width(); const auto minwidth = tm.GetType(min->type_id())->AsInteger()->width(); const auto maxwidth = tm.GetType(max->type_id())->AsInteger()->width(); @@ -755,7 +822,11 @@ Instruction* GraphicsRobustAccessPass::MakeRuntimeArrayLengthInst( base_ptr_type->storage_class()); // Create the instruction and insert it. - const auto new_access_chain_id = TakeNextId(); + const auto new_access_chain_id = context()->TakeNextId(); + if (new_access_chain_id == 0) { + Fail(); + return nullptr; + } auto* new_access_chain = InsertInst(current_access_chain, current_access_chain->opcode(), new_access_chain_type_id, new_access_chain_id, ops); @@ -784,7 +855,11 @@ Instruction* GraphicsRobustAccessPass::MakeRuntimeArrayLengthInst( uint32_t(struct_type->element_types().size() - 1); // Create the length-of-array instruction before the original access chain, // but after the generation of the pointer to the struct. - const auto array_len_id = TakeNextId(); + const auto array_len_id = context()->TakeNextId(); + if (array_len_id == 0) { + Fail(); + return nullptr; + } analysis::Integer uint_type_for_query(32, false); auto* uint_type = type_mgr->GetRegisteredType(&uint_type_for_query); auto* array_len = InsertInst( @@ -935,12 +1010,18 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( return type_mgr->GetRegisteredType(&proposed); }(); - const uint32_t image_id = TakeNextId(); + const uint32_t image_id = context()->TakeNextId(); + if (image_id == 0) { + return Fail(); + } auto* image = InsertInst(image_texel_pointer, spv::Op::OpLoad, image_type_id, image_id, {{SPV_OPERAND_TYPE_ID, {image_ptr->result_id()}}}); - const uint32_t query_size_id = TakeNextId(); + const uint32_t query_size_id = context()->TakeNextId(); + if (query_size_id == 0) { + return Fail(); + } auto* query_size = InsertInst(image_texel_pointer, spv::Op::OpImageQuerySize, type_mgr->GetTypeInstruction(query_size_type), query_size_id, @@ -968,7 +1049,10 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( query_size_type, {component_1_id, component_1_id, component_6_id}); auto* multiplicand_inst = constant_mgr->GetDefiningInstruction(multiplicand); - const auto query_size_including_faces_id = TakeNextId(); + const auto query_size_including_faces_id = context()->TakeNextId(); + if (query_size_including_faces_id == 0) { + return Fail(); + } query_size_including_faces = InsertInst( image_texel_pointer, spv::Op::OpIMul, type_mgr->GetTypeInstruction(query_size_type), @@ -992,7 +1076,10 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( query_size_type, std::vector(query_num_components, component_0_id)); - const uint32_t query_max_including_faces_id = TakeNextId(); + const uint32_t query_max_including_faces_id = context()->TakeNextId(); + if (query_max_including_faces_id == 0) { + return Fail(); + } auto* query_max_including_faces = InsertInst( image_texel_pointer, spv::Op::OpISub, type_mgr->GetTypeInstruction(query_size_type), @@ -1005,18 +1092,27 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( auto* clamp_coord = MakeSClampInst( *type_mgr, coord, constant_mgr->GetDefiningInstruction(coordinate_0), query_max_including_faces, image_texel_pointer); + if (clamp_coord == nullptr) { + return Fail(); + } image_texel_pointer->SetInOperand(1, {clamp_coord->result_id()}); // Clamp the sample index if (multisampled) { // Get the sample count via OpImageQuerySamples - const auto query_samples_id = TakeNextId(); + const auto query_samples_id = context()->TakeNextId(); + if (query_samples_id == 0) { + return Fail(); + } auto* query_samples = InsertInst( image_texel_pointer, spv::Op::OpImageQuerySamples, constant_mgr->GetDefiningInstruction(component_0)->type_id(), query_samples_id, {{SPV_OPERAND_TYPE_ID, {image->result_id()}}}); - const auto max_samples_id = TakeNextId(); + const auto max_samples_id = context()->TakeNextId(); + if (max_samples_id == 0) { + return Fail(); + } auto* max_samples = InsertInst(image_texel_pointer, spv::Op::OpImageQuerySamples, query_samples->type_id(), max_samples_id, {{SPV_OPERAND_TYPE_ID, {query_samples_id}}, @@ -1025,6 +1121,9 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( auto* clamp_samples = MakeSClampInst( *type_mgr, samples, constant_mgr->GetDefiningInstruction(coordinate_0), max_samples, image_texel_pointer); + if (clamp_samples == nullptr) { + return Fail(); + } image_texel_pointer->SetInOperand(2, {clamp_samples->result_id()}); } else { @@ -1041,6 +1140,9 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( opt::Instruction* GraphicsRobustAccessPass::InsertInst( opt::Instruction* where_inst, spv::Op opcode, uint32_t type_id, uint32_t result_id, const Instruction::OperandList& operands) { + if (result_id == 0) { + return nullptr; + } module_status_.modified = true; auto* result = where_inst->InsertBefore( MakeUnique(context(), opcode, type_id, result_id, operands)); diff --git a/third_party/spirv-tools/source/opt/if_conversion.cpp b/third_party/spirv-tools/source/opt/if_conversion.cpp index 5912cf12da..2b71626b56 100644 --- a/third_party/spirv-tools/source/opt/if_conversion.cpp +++ b/third_party/spirv-tools/source/opt/if_conversion.cpp @@ -126,6 +126,7 @@ Pass::Status IfConversion::Process() { condition = SplatCondition(vec_data_ty, condition, &builder); } + // TODO(1841): Handle id overflow. Instruction* select = builder.AddSelect(phi->type_id(), condition, true_value->result_id(), false_value->result_id()); @@ -205,6 +206,7 @@ uint32_t IfConversion::SplatCondition(analysis::Vector* vec_data_ty, uint32_t bool_vec_id = context()->get_type_mgr()->GetTypeInstruction(&bool_vec_ty); std::vector ids(vec_data_ty->element_count(), cond); + // TODO(1841): Handle id overflow. return builder->AddCompositeConstruct(bool_vec_id, ids)->result_id(); } diff --git a/third_party/spirv-tools/source/opt/instruction.cpp b/third_party/spirv-tools/source/opt/instruction.cpp index fa169654f1..05cf18f1cb 100644 --- a/third_party/spirv-tools/source/opt/instruction.cpp +++ b/third_party/spirv-tools/source/opt/instruction.cpp @@ -168,7 +168,13 @@ Instruction* Instruction::Clone(IRContext* c) const { clone->dbg_line_insts_ = dbg_line_insts_; for (auto& i : clone->dbg_line_insts_) { i.unique_id_ = c->TakeNextUniqueId(); - if (i.IsDebugLineInst()) i.SetResultId(c->TakeNextId()); + if (i.IsDebugLineInst()) { + uint32_t new_id = c->TakeNextId(); + if (new_id == 0) { + return nullptr; + } + i.SetResultId(new_id); + } } clone->dbg_scope_ = dbg_scope_; return clone; @@ -546,27 +552,37 @@ void Instruction::ClearDbgLineInsts() { clear_dbg_line_insts(); } -void Instruction::UpdateDebugInfoFrom(const Instruction* from, +bool Instruction::UpdateDebugInfoFrom(const Instruction* from, const Instruction* line) { - if (from == nullptr) return; + if (from == nullptr) return true; ClearDbgLineInsts(); const Instruction* fromLine = line != nullptr ? line : from; - if (!fromLine->dbg_line_insts().empty()) - AddDebugLine(&fromLine->dbg_line_insts().back()); + if (!fromLine->dbg_line_insts().empty()) { + if (!AddDebugLine(&fromLine->dbg_line_insts().back())) { + return false; + } + } SetDebugScope(from->GetDebugScope()); if (!IsLineInst() && context()->AreAnalysesValid(IRContext::kAnalysisDebugInfo)) { context()->get_debug_info_mgr()->AnalyzeDebugInst(this); } + return true; } -void Instruction::AddDebugLine(const Instruction* inst) { +bool Instruction::AddDebugLine(const Instruction* inst) { dbg_line_insts_.push_back(*inst); dbg_line_insts_.back().unique_id_ = context()->TakeNextUniqueId(); - if (inst->IsDebugLineInst()) - dbg_line_insts_.back().SetResultId(context_->TakeNextId()); + if (inst->IsDebugLineInst()) { + uint32_t new_id = context()->TakeNextId(); + if (new_id == 0) { + return false; + } + dbg_line_insts_.back().SetResultId(new_id); + } if (context()->AreAnalysesValid(IRContext::kAnalysisDefUse)) context()->get_def_use_mgr()->AnalyzeInstDefUse(&dbg_line_insts_.back()); + return true; } bool Instruction::IsDebugLineInst() const { @@ -770,7 +786,7 @@ bool Instruction::IsFoldableByFoldScalar() const { // Even if the type of the instruction is foldable, its operands may not be // foldable (e.g., comparisons of 64bit types). Check that all operand types // are foldable before accepting the instruction. - return WhileEachInOperand([&folder, this](const uint32_t* op_id) { + return WhileEachInId([&folder, this](const uint32_t* op_id) { Instruction* def_inst = context()->get_def_use_mgr()->GetDef(*op_id); Instruction* def_inst_type = context()->get_def_use_mgr()->GetDef(def_inst->type_id()); @@ -792,7 +808,7 @@ bool Instruction::IsFoldableByFoldVector() const { // Even if the type of the instruction is foldable, its operands may not be // foldable (e.g., comparisons of 64bit types). Check that all operand types // are foldable before accepting the instruction. - return WhileEachInOperand([&folder, this](const uint32_t* op_id) { + return WhileEachInId([&folder, this](const uint32_t* op_id) { Instruction* def_inst = context()->get_def_use_mgr()->GetDef(*op_id); Instruction* def_inst_type = context()->get_def_use_mgr()->GetDef(def_inst->type_id()); @@ -1035,6 +1051,12 @@ bool Instruction::IsOpcodeSafeToDelete() const { return true; } + if (IsNonSemanticInstruction() && + (GetShader100DebugOpcode() == NonSemanticShaderDebugInfo100DebugDeclare || + GetShader100DebugOpcode() == NonSemanticShaderDebugInfo100DebugValue)) { + return true; + } + switch (opcode()) { case spv::Op::OpDPdx: case spv::Op::OpDPdy: diff --git a/third_party/spirv-tools/source/opt/instruction.h b/third_party/spirv-tools/source/opt/instruction.h index c026b21ce1..2e1ef354f8 100644 --- a/third_party/spirv-tools/source/opt/instruction.h +++ b/third_party/spirv-tools/source/opt/instruction.h @@ -318,7 +318,7 @@ class Instruction : public utils::IntrusiveNodeBase { inline void SetDebugScope(const DebugScope& scope); inline const DebugScope& GetDebugScope() const { return dbg_scope_; } // Add debug line inst. Renew result id if Debug[No]Line - void AddDebugLine(const Instruction* inst); + bool AddDebugLine(const Instruction* inst); // Updates DebugInlinedAt of DebugScope and OpLine. void UpdateDebugInlinedAt(uint32_t new_inlined_at); // Clear line-related debug instructions attached to this instruction @@ -338,7 +338,7 @@ class Instruction : public utils::IntrusiveNodeBase { // Updates lexical scope of DebugScope and OpLine. void UpdateLexicalScope(uint32_t scope); // Updates OpLine and DebugScope based on the information of |from|. - void UpdateDebugInfoFrom(const Instruction* from, + bool UpdateDebugInfoFrom(const Instruction* from, const Instruction* line = nullptr); // Remove the |index|-th operand void RemoveOperand(uint32_t index) { diff --git a/third_party/spirv-tools/source/opt/interface_var_sroa.cpp b/third_party/spirv-tools/source/opt/interface_var_sroa.cpp index 08477cbddb..8c0b91fd90 100644 --- a/third_party/spirv-tools/source/opt/interface_var_sroa.cpp +++ b/third_party/spirv-tools/source/opt/interface_var_sroa.cpp @@ -239,28 +239,34 @@ void InterfaceVariableScalarReplacement::KillLocationAndComponentDecorations( }); } -bool InterfaceVariableScalarReplacement::ReplaceInterfaceVariableWithScalars( +Pass::Status +InterfaceVariableScalarReplacement::ReplaceInterfaceVariableWithScalars( Instruction* interface_var, Instruction* interface_var_type, uint32_t location, uint32_t component, uint32_t extra_array_length) { - NestedCompositeComponents scalar_interface_vars = + std::optional scalar_interface_vars = CreateScalarInterfaceVarsForReplacement(interface_var_type, GetStorageClass(interface_var), extra_array_length); - AddLocationAndComponentDecorations(scalar_interface_vars, &location, + if (!scalar_interface_vars) { + return Status::Failure; + } + + AddLocationAndComponentDecorations(*scalar_interface_vars, &location, component); KillLocationAndComponentDecorations(interface_var->result_id()); - if (!ReplaceInterfaceVarWith(interface_var, extra_array_length, - scalar_interface_vars)) { - return false; + Status status = ReplaceInterfaceVarWith(interface_var, extra_array_length, + *scalar_interface_vars); + if (status == Status::Failure) { + return status; } context()->KillInst(interface_var); - return true; + return status; } -bool InterfaceVariableScalarReplacement::ReplaceInterfaceVarWith( +Pass::Status InterfaceVariableScalarReplacement::ReplaceInterfaceVarWith( Instruction* interface_var, uint32_t extra_array_length, const NestedCompositeComponents& scalar_interface_vars) { std::vector users; @@ -276,21 +282,24 @@ bool InterfaceVariableScalarReplacement::ReplaceInterfaceVarWith( // interface variable. for (uint32_t index = 0; index < extra_array_length; ++index) { std::unordered_map loads_to_component_values; - if (!ReplaceComponentsOfInterfaceVarWith( - interface_var, users, scalar_interface_vars, - interface_var_component_indices, &index, - &loads_to_component_values, - &loads_for_access_chain_to_composites)) { - return false; + Status status = ReplaceComponentsOfInterfaceVarWith( + interface_var, users, scalar_interface_vars, + interface_var_component_indices, &index, &loads_to_component_values, + &loads_for_access_chain_to_composites); + if (status == Status::Failure) { + return Status::Failure; } AddComponentsToCompositesForLoads(loads_to_component_values, &loads_to_composites, 0); } - } else if (!ReplaceComponentsOfInterfaceVarWith( - interface_var, users, scalar_interface_vars, - interface_var_component_indices, nullptr, &loads_to_composites, - &loads_for_access_chain_to_composites)) { - return false; + } else { + Status status = ReplaceComponentsOfInterfaceVarWith( + interface_var, users, scalar_interface_vars, + interface_var_component_indices, nullptr, &loads_to_composites, + &loads_for_access_chain_to_composites); + if (status == Status::Failure) { + return Status::Failure; + } } ReplaceLoadWithCompositeConstruct(context(), loads_to_composites); @@ -298,7 +307,7 @@ bool InterfaceVariableScalarReplacement::ReplaceInterfaceVarWith( loads_for_access_chain_to_composites); KillInstructionsAndUsers(users); - return true; + return Status::SuccessWithChange; } void InterfaceVariableScalarReplacement::AddLocationAndComponentDecorations( @@ -318,7 +327,8 @@ void InterfaceVariableScalarReplacement::AddLocationAndComponentDecorations( } } -bool InterfaceVariableScalarReplacement::ReplaceComponentsOfInterfaceVarWith( +Pass::Status +InterfaceVariableScalarReplacement::ReplaceComponentsOfInterfaceVarWith( Instruction* interface_var, const std::vector& interface_var_users, const NestedCompositeComponents& scalar_interface_vars, @@ -329,15 +339,16 @@ bool InterfaceVariableScalarReplacement::ReplaceComponentsOfInterfaceVarWith( loads_for_access_chain_to_composites) { if (!scalar_interface_vars.HasMultipleComponents()) { for (Instruction* interface_var_user : interface_var_users) { - if (!ReplaceComponentOfInterfaceVarWith( - interface_var, interface_var_user, - scalar_interface_vars.GetComponentVariable(), - interface_var_component_indices, extra_array_index, - loads_to_composites, loads_for_access_chain_to_composites)) { - return false; + Status status = ReplaceComponentOfInterfaceVarWith( + interface_var, interface_var_user, + scalar_interface_vars.GetComponentVariable(), + interface_var_component_indices, extra_array_index, + loads_to_composites, loads_for_access_chain_to_composites); + if (status == Status::Failure) { + return Status::Failure; } } - return true; + return Status::SuccessWithChange; } return ReplaceMultipleComponentsOfInterfaceVarWith( interface_var, interface_var_users, scalar_interface_vars.GetComponents(), @@ -345,27 +356,28 @@ bool InterfaceVariableScalarReplacement::ReplaceComponentsOfInterfaceVarWith( loads_for_access_chain_to_composites); } -bool InterfaceVariableScalarReplacement:: - ReplaceMultipleComponentsOfInterfaceVarWith( - Instruction* interface_var, - const std::vector& interface_var_users, - const std::vector& components, - std::vector& interface_var_component_indices, - const uint32_t* extra_array_index, - std::unordered_map* loads_to_composites, - std::unordered_map* - loads_for_access_chain_to_composites) { +Pass::Status +InterfaceVariableScalarReplacement::ReplaceMultipleComponentsOfInterfaceVarWith( + Instruction* interface_var, + const std::vector& interface_var_users, + const std::vector& components, + std::vector& interface_var_component_indices, + const uint32_t* extra_array_index, + std::unordered_map* loads_to_composites, + std::unordered_map* + loads_for_access_chain_to_composites) { for (uint32_t i = 0; i < components.size(); ++i) { interface_var_component_indices.push_back(i); std::unordered_map loads_to_component_values; std::unordered_map loads_for_access_chain_to_component_values; - if (!ReplaceComponentsOfInterfaceVarWith( - interface_var, interface_var_users, components[i], - interface_var_component_indices, extra_array_index, - &loads_to_component_values, - &loads_for_access_chain_to_component_values)) { - return false; + Status status = ReplaceComponentsOfInterfaceVarWith( + interface_var, interface_var_users, components[i], + interface_var_component_indices, extra_array_index, + &loads_to_component_values, + &loads_for_access_chain_to_component_values); + if (status == Status::Failure) { + return Status::Failure; } interface_var_component_indices.pop_back(); @@ -378,10 +390,11 @@ bool InterfaceVariableScalarReplacement:: AddComponentsToCompositesForLoads(loads_to_component_values, loads_to_composites, depth_to_component); } - return true; + return Status::SuccessWithChange; } -bool InterfaceVariableScalarReplacement::ReplaceComponentOfInterfaceVarWith( +Pass::Status +InterfaceVariableScalarReplacement::ReplaceComponentOfInterfaceVarWith( Instruction* interface_var, Instruction* interface_var_user, Instruction* scalar_var, const std::vector& interface_var_component_indices, @@ -395,42 +408,49 @@ bool InterfaceVariableScalarReplacement::ReplaceComponentOfInterfaceVarWith( StoreComponentOfValueToScalarVar(value_id, interface_var_component_indices, scalar_var, extra_array_index, interface_var_user); - return true; + return Status::SuccessWithChange; } if (opcode == spv::Op::OpLoad) { Instruction* scalar_load = LoadScalarVar(scalar_var, extra_array_index, interface_var_user); + if (scalar_load == nullptr) { + return Status::Failure; + } loads_to_component_values->insert({interface_var_user, scalar_load}); - return true; + return Status::SuccessWithChange; } // Copy OpName and annotation instructions only once. Therefore, we create // them only for the first element of the extra array. - if (extra_array_index && *extra_array_index != 0) return true; + if (extra_array_index && *extra_array_index != 0) + return Status::SuccessWithChange; if (opcode == spv::Op::OpDecorateId || opcode == spv::Op::OpDecorateString || opcode == spv::Op::OpDecorate) { CloneAnnotationForVariable(interface_var_user, scalar_var->result_id()); - return true; + return Status::SuccessWithChange; } if (opcode == spv::Op::OpName) { std::unique_ptr new_inst(interface_var_user->Clone(context())); new_inst->SetInOperand(0, {scalar_var->result_id()}); context()->AddDebug2Inst(std::move(new_inst)); - return true; + return Status::SuccessWithChange; } if (opcode == spv::Op::OpEntryPoint) { - return ReplaceInterfaceVarInEntryPoint(interface_var, interface_var_user, - scalar_var->result_id()); + if (ReplaceInterfaceVarInEntryPoint(interface_var, interface_var_user, + scalar_var->result_id())) { + return Status::SuccessWithChange; + } + return Status::Failure; } if (opcode == spv::Op::OpAccessChain) { ReplaceAccessChainWith(interface_var_user, interface_var_component_indices, scalar_var, loads_for_access_chain_to_component_values); - return true; + return Status::SuccessWithChange; } std::string message("Unhandled instruction"); @@ -440,7 +460,7 @@ bool InterfaceVariableScalarReplacement::ReplaceComponentOfInterfaceVarWith( "\nfor interface variable scalar replacement\n " + interface_var->PrettyPrint(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); context()->consumer()(SPV_MSG_ERROR, "", {0, 0, 0}, message.c_str()); - return false; + return Status::Failure; } void InterfaceVariableScalarReplacement::UseBaseAccessChainForAccessChain( @@ -470,10 +490,14 @@ Instruction* InterfaceVariableScalarReplacement::CreateAccessChainToVar( uint32_t ptr_type_id = GetPointerType(*component_type_id, GetStorageClass(var)); - std::unique_ptr new_access_chain(new Instruction( - context(), spv::Op::OpAccessChain, ptr_type_id, TakeNextId(), - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {var->result_id()}}})); + uint32_t new_id = TakeNextId(); + if (new_id == 0) { + return nullptr; + } + std::unique_ptr new_access_chain( + new Instruction(context(), spv::Op::OpAccessChain, ptr_type_id, new_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}})); for (uint32_t index_id : index_ids) { new_access_chain->AddOperand({SPV_OPERAND_TYPE_ID, {index_id}}); } @@ -490,12 +514,16 @@ Instruction* InterfaceVariableScalarReplacement::CreateAccessChainWithIndex( uint32_t ptr_type_id = GetPointerType(component_type_id, GetStorageClass(var)); uint32_t index_id = context()->get_constant_mgr()->GetUIntConstId(index); - std::unique_ptr new_access_chain(new Instruction( - context(), spv::Op::OpAccessChain, ptr_type_id, TakeNextId(), - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {var->result_id()}}, - {SPV_OPERAND_TYPE_ID, {index_id}}, - })); + uint32_t new_id = TakeNextId(); + if (new_id == 0) { + return nullptr; + } + std::unique_ptr new_access_chain( + new Instruction(context(), spv::Op::OpAccessChain, ptr_type_id, new_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}, + {SPV_OPERAND_TYPE_ID, {index_id}}, + })); Instruction* inst = new_access_chain.get(); context()->get_def_use_mgr()->AnalyzeInstDefUse(inst); insert_before->InsertBefore(std::move(new_access_chain)); @@ -617,6 +645,9 @@ void InterfaceVariableScalarReplacement::StoreComponentOfValueToScalarVar( component_type_id = ty_mgr->GetTypeInstruction(array_type->element_type()); ptr = CreateAccessChainWithIndex(component_type_id, scalar_var, *extra_array_index, insert_before); + if (ptr == nullptr) { + return; + } } StoreComponentOfValueTo(component_type_id, value_id, component_indices, ptr, @@ -635,6 +666,9 @@ Instruction* InterfaceVariableScalarReplacement::LoadScalarVar( component_type_id = ty_mgr->GetTypeInstruction(array_type->element_type()); ptr = CreateAccessChainWithIndex(component_type_id, scalar_var, *extra_array_index, insert_before); + if (ptr == nullptr) { + return nullptr; + } } return CreateLoad(component_type_id, ptr, insert_before); @@ -642,8 +676,12 @@ Instruction* InterfaceVariableScalarReplacement::LoadScalarVar( Instruction* InterfaceVariableScalarReplacement::CreateLoad( uint32_t type_id, Instruction* ptr, Instruction* insert_before) { + uint32_t new_id = TakeNextId(); + if (new_id == 0) { + return nullptr; + } std::unique_ptr load( - new Instruction(context(), spv::Op::OpLoad, type_id, TakeNextId(), + new Instruction(context(), spv::Op::OpLoad, type_id, new_id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {ptr->result_id()}}})); Instruction* load_inst = load.get(); @@ -658,6 +696,9 @@ void InterfaceVariableScalarReplacement::StoreComponentOfValueTo( const uint32_t* extra_array_index, Instruction* insert_before) { std::unique_ptr composite_extract(CreateCompositeExtract( component_type_id, value_id, component_indices, extra_array_index)); + if (composite_extract == nullptr) { + return; + } std::unique_ptr new_store( new Instruction(context(), spv::Op::OpStore)); @@ -677,6 +718,9 @@ Instruction* InterfaceVariableScalarReplacement::CreateCompositeExtract( uint32_t type_id, uint32_t composite_id, const std::vector& indexes, const uint32_t* extra_first_index) { uint32_t component_id = TakeNextId(); + if (component_id == 0) { + return nullptr; + } Instruction* composite_extract = new Instruction( context(), spv::Op::OpCompositeExtract, type_id, component_id, std::initializer_list{{SPV_OPERAND_TYPE_ID, {composite_id}}}); @@ -716,6 +760,9 @@ Instruction* InterfaceVariableScalarReplacement::LoadAccessChainToVar( if (!indexes.empty()) { ptr = CreateAccessChainToVar(component_type_id, var, indexes, insert_before, &component_type_id); + if (ptr == nullptr) { + return nullptr; + } } return CreateLoad(component_type_id, ptr, insert_before); @@ -730,7 +777,10 @@ InterfaceVariableScalarReplacement::CreateCompositeConstructForComponentOfLoad( type_id = GetComponentTypeOfArrayMatrix(def_use_mgr, load->type_id(), depth_to_component); } - uint32_t new_id = context()->TakeNextId(); + uint32_t new_id = TakeNextId(); + if (new_id == 0) { + return nullptr; + } std::unique_ptr new_composite_construct(new Instruction( context(), spv::Op::OpCompositeConstruct, type_id, new_id, {})); Instruction* composite_construct = new_composite_construct.get(); @@ -767,6 +817,10 @@ void InterfaceVariableScalarReplacement::AddComponentsToCompositesForLoads( if (itr == loads_to_composites->end()) { composite_construct = CreateCompositeConstructForComponentOfLoad(load, depth_to_component); + if (composite_construct == nullptr) { + assert(false && "Could not create composite construct"); + return; + } loads_to_composites->insert({load, composite_construct}); } else { composite_construct = itr->second; @@ -795,7 +849,7 @@ uint32_t InterfaceVariableScalarReplacement::GetPointerType( return context()->get_type_mgr()->GetTypeInstruction(&ptr_type); } -InterfaceVariableScalarReplacement::NestedCompositeComponents +std::optional InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForArray( Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length) { @@ -807,16 +861,19 @@ InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForArray( NestedCompositeComponents scalar_vars; while (array_length > 0) { - NestedCompositeComponents scalar_vars_for_element = + std::optional scalar_vars_for_element = CreateScalarInterfaceVarsForReplacement(elem_type, storage_class, extra_array_length); - scalar_vars.AddComponent(scalar_vars_for_element); + if (!scalar_vars_for_element) { + return std::nullopt; + } + scalar_vars.AddComponent(*scalar_vars_for_element); --array_length; } return scalar_vars; } -InterfaceVariableScalarReplacement::NestedCompositeComponents +std::optional InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForMatrix( Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length) { @@ -830,16 +887,19 @@ InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForMatrix( NestedCompositeComponents scalar_vars; while (column_count > 0) { - NestedCompositeComponents scalar_vars_for_column = + std::optional scalar_vars_for_column = CreateScalarInterfaceVarsForReplacement(column_type, storage_class, extra_array_length); - scalar_vars.AddComponent(scalar_vars_for_column); + if (!scalar_vars_for_column) { + return std::nullopt; + } + scalar_vars.AddComponent(*scalar_vars_for_column); --column_count; } return scalar_vars; } -InterfaceVariableScalarReplacement::NestedCompositeComponents +std::optional InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForReplacement( Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length) { @@ -864,6 +924,9 @@ InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForReplacement( uint32_t ptr_type_id = context()->get_type_mgr()->FindPointerToType(type_id, storage_class); uint32_t id = TakeNextId(); + if (id == 0) { + return std::nullopt; + } std::unique_ptr variable( new Instruction(context(), spv::Op::OpVariable, ptr_type_id, id, std::initializer_list{ @@ -953,9 +1016,9 @@ InterfaceVariableScalarReplacement::ReplaceInterfaceVarsWithScalars( continue; } - if (!ReplaceInterfaceVariableWithScalars(interface_var, interface_var_type, - location, component, - extra_array_length)) { + if (ReplaceInterfaceVariableWithScalars( + interface_var, interface_var_type, location, component, + extra_array_length) == Pass::Status::Failure) { return Pass::Status::Failure; } status = Pass::Status::SuccessWithChange; diff --git a/third_party/spirv-tools/source/opt/interface_var_sroa.h b/third_party/spirv-tools/source/opt/interface_var_sroa.h index 45ed3717ad..743cdfbe2a 100644 --- a/third_party/spirv-tools/source/opt/interface_var_sroa.h +++ b/third_party/spirv-tools/source/opt/interface_var_sroa.h @@ -15,6 +15,7 @@ #ifndef SOURCE_OPT_INTERFACE_VAR_SROA_H_ #define SOURCE_OPT_INTERFACE_VAR_SROA_H_ +#include #include #include "source/opt/pass.h" @@ -100,25 +101,26 @@ class InterfaceVariableScalarReplacement : public Pass { // If |extra_array_length| is 0, it means |interface_var| has a Patch // decoration. Otherwise, |extra_array_length| denotes the length of the extra // array of |interface_var|. - bool ReplaceInterfaceVariableWithScalars(Instruction* interface_var, - Instruction* interface_var_type, - uint32_t location, - uint32_t component, - uint32_t extra_array_length); + Status ReplaceInterfaceVariableWithScalars(Instruction* interface_var, + Instruction* interface_var_type, + uint32_t location, + uint32_t component, + uint32_t extra_array_length); // Creates scalar variables with the storage classe |storage_class| to replace // an interface variable whose type is |interface_var_type|. If // |extra_array_length| is not zero, adds the extra arrayness to the created // scalar variables. - NestedCompositeComponents CreateScalarInterfaceVarsForReplacement( - Instruction* interface_var_type, spv::StorageClass storage_class, - uint32_t extra_array_length); + std::optional + CreateScalarInterfaceVarsForReplacement(Instruction* interface_var_type, + spv::StorageClass storage_class, + uint32_t extra_array_length); // Creates scalar variables with the storage classe |storage_class| to replace // the interface variable whose type is OpTypeArray |interface_var_type| with. // If |extra_array_length| is not zero, adds the extra arrayness to all the // scalar variables. - NestedCompositeComponents CreateScalarInterfaceVarsForArray( + std::optional CreateScalarInterfaceVarsForArray( Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length); @@ -126,7 +128,7 @@ class InterfaceVariableScalarReplacement : public Pass { // the interface variable whose type is OpTypeMatrix |interface_var_type| // with. If |extra_array_length| is not zero, adds the extra arrayness to all // the scalar variables. - NestedCompositeComponents CreateScalarInterfaceVarsForMatrix( + std::optional CreateScalarInterfaceVarsForMatrix( Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length); @@ -142,7 +144,7 @@ class InterfaceVariableScalarReplacement : public Pass { // |extra_arrayness| is the extra arrayness of the interface variable. // |scalar_interface_vars| contains the nested variables to replace the // interface variable with. - bool ReplaceInterfaceVarWith( + Status ReplaceInterfaceVarWith( Instruction* interface_var, uint32_t extra_arrayness, const NestedCompositeComponents& scalar_interface_vars); @@ -155,7 +157,7 @@ class InterfaceVariableScalarReplacement : public Pass { // construct instructions to be replaced with load instructions of access // chain instructions in |interface_var_users| via // |loads_for_access_chain_to_composites|. - bool ReplaceComponentsOfInterfaceVarWith( + Status ReplaceComponentsOfInterfaceVarWith( Instruction* interface_var, const std::vector& interface_var_users, const NestedCompositeComponents& scalar_interface_vars, @@ -174,7 +176,7 @@ class InterfaceVariableScalarReplacement : public Pass { // via |loads_to_composites|. Returns composite construct instructions to be // replaced with load instructions of access chain instructions in // |interface_var_users| via |loads_for_access_chain_to_composites|. - bool ReplaceMultipleComponentsOfInterfaceVarWith( + Status ReplaceMultipleComponentsOfInterfaceVarWith( Instruction* interface_var, const std::vector& interface_var_users, const std::vector& components, @@ -192,7 +194,7 @@ class InterfaceVariableScalarReplacement : public Pass { // |loads_to_component_values|. If |interface_var_user| is an access chain, // returns the component value for loads of |interface_var_user| via // |loads_for_access_chain_to_component_values|. - bool ReplaceComponentOfInterfaceVarWith( + Status ReplaceComponentOfInterfaceVarWith( Instruction* interface_var, Instruction* interface_var_user, Instruction* scalar_var, const std::vector& interface_var_component_indices, @@ -389,6 +391,9 @@ class InterfaceVariableScalarReplacement : public Pass { // A set of interface variables without the extra arrayness for any of the // entry points. std::unordered_set vars_without_extra_arrayness; + + // Returns the next available id, or 0 if the id overflows. + uint32_t TakeNextId() { return context()->TakeNextId(); } }; } // namespace opt diff --git a/third_party/spirv-tools/source/opt/invocation_interlock_placement_pass.cpp b/third_party/spirv-tools/source/opt/invocation_interlock_placement_pass.cpp index f25f554763..b31697cd6d 100644 --- a/third_party/spirv-tools/source/opt/invocation_interlock_placement_pass.cpp +++ b/third_party/spirv-tools/source/opt/invocation_interlock_placement_pass.cpp @@ -294,8 +294,12 @@ bool InvocationInterlockPlacementPass::removeUnneededInstructions( BasicBlock* InvocationInterlockPlacementPass::splitEdge(BasicBlock* block, uint32_t succ_id) { // Create a new block to replace the critical edge. + uint32_t new_id = context()->TakeNextId(); + if (new_id == 0) { + return nullptr; + } auto new_succ_temp = MakeUnique( - MakeUnique(context(), spv::Op::OpLabel, 0, TakeNextId(), + MakeUnique(context(), spv::Op::OpLabel, 0, new_id, std::initializer_list{})); auto* new_succ = new_succ_temp.get(); @@ -325,7 +329,7 @@ BasicBlock* InvocationInterlockPlacementPass::splitEdge(BasicBlock* block, return new_succ; } -bool InvocationInterlockPlacementPass::placeInstructionsForEdge( +Pass::Status InvocationInterlockPlacementPass::placeInstructionsForEdge( BasicBlock* block, uint32_t next_id, BlockSet& inside, BlockSet& previous_inside, spv::Op opcode, bool reverse_cfg) { bool modified = false; @@ -372,31 +376,45 @@ bool InvocationInterlockPlacementPass::placeInstructionsForEdge( new_branch = splitEdge(cfg()->block(next_id), block->id()); } + if (!new_branch) { + return Status::Failure; + } + auto inst = new Instruction(context(), opcode); inst->InsertBefore(&*new_branch->tail()); } } - return modified; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } -bool InvocationInterlockPlacementPass::placeInstructions(BasicBlock* block) { - bool modified = false; +Pass::Status InvocationInterlockPlacementPass::placeInstructions( + BasicBlock* block) { + Status status = Status::SuccessWithoutChange; - block->ForEachSuccessorLabel([this, block, &modified](uint32_t succ_id) { - modified |= placeInstructionsForEdge( + block->ForEachSuccessorLabel([this, block, &status](uint32_t succ_id) { + if (status == Status::Failure) { + return; + } + Status edge_status = placeInstructionsForEdge( block, succ_id, after_begin_, predecessors_after_begin_, spv::Op::OpBeginInvocationInterlockEXT, /* reverse_cfg= */ true); - modified |= placeInstructionsForEdge(cfg()->block(succ_id), block->id(), - before_end_, successors_before_end_, - spv::Op::OpEndInvocationInterlockEXT, - /* reverse_cfg= */ false); + status = CombineStatus(status, edge_status); + if (status == Status::Failure) { + return; + } + + edge_status = placeInstructionsForEdge(cfg()->block(succ_id), block->id(), + before_end_, successors_before_end_, + spv::Op::OpEndInvocationInterlockEXT, + /* reverse_cfg= */ false); + status = CombineStatus(status, edge_status); }); - return modified; + return status; } -bool InvocationInterlockPlacementPass::processFragmentShaderEntry( +Pass::Status InvocationInterlockPlacementPass::processFragmentShaderEntry( Function* entry_func) { bool modified = false; @@ -417,9 +435,15 @@ bool InvocationInterlockPlacementPass::processFragmentShaderEntry( for (BasicBlock* block : original_blocks) { modified |= removeUnneededInstructions(block); - modified |= placeInstructions(block); + Status place_status = placeInstructions(block); + if (place_status == Status::Failure) { + return Status::Failure; + } + if (place_status == Status::SuccessWithChange) { + modified = true; + } } - return modified; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } bool InvocationInterlockPlacementPass::isFragmentShaderInterlockEnabled() { @@ -452,7 +476,7 @@ Pass::Status InvocationInterlockPlacementPass::Process() { return Status::SuccessWithoutChange; } - bool modified = false; + Status status = Status::SuccessWithoutChange; std::unordered_set entry_points; for (Instruction& entry_inst : context()->module()->entry_points()) { @@ -466,7 +490,9 @@ Pass::Status InvocationInterlockPlacementPass::Process() { Function* func = &*fi; recordBeginOrEndInFunction(func); if (!entry_points.count(func) && extracted_functions_.count(func)) { - modified |= removeBeginAndEndInstructionsFromFunction(func); + if (removeBeginAndEndInstructionsFromFunction(func)) { + status = Status::SuccessWithChange; + } } } @@ -482,11 +508,14 @@ Pass::Status InvocationInterlockPlacementPass::Process() { continue; } - modified |= processFragmentShaderEntry(entry_func); + Status frag_status = processFragmentShaderEntry(entry_func); + if (frag_status == Status::Failure) { + return Status::Failure; + } + status = CombineStatus(status, frag_status); } - return modified ? Pass::Status::SuccessWithChange - : Pass::Status::SuccessWithoutChange; + return status; } } // namespace opt diff --git a/third_party/spirv-tools/source/opt/invocation_interlock_placement_pass.h b/third_party/spirv-tools/source/opt/invocation_interlock_placement_pass.h index 4e85be8586..497af28214 100644 --- a/third_party/spirv-tools/source/opt/invocation_interlock_placement_pass.h +++ b/third_party/spirv-tools/source/opt/invocation_interlock_placement_pass.h @@ -120,14 +120,14 @@ class InvocationInterlockPlacementPass : public Pass { // For the edge from block to next_id, places a begin or end instruction on // the edge, based on the direction we are walking the CFG, specified in // reverse_cfg. - bool placeInstructionsForEdge(BasicBlock* block, uint32_t next_id, - BlockSet& inside, BlockSet& previous_inside, - spv::Op opcode, bool reverse_cfg); + Status placeInstructionsForEdge(BasicBlock* block, uint32_t next_id, + BlockSet& inside, BlockSet& previous_inside, + spv::Op opcode, bool reverse_cfg); // Calls placeInstructionsForEdge for each edge in block. - bool placeInstructions(BasicBlock* block); + Status placeInstructions(BasicBlock* block); // Processes a single fragment shader entry function. - bool processFragmentShaderEntry(Function* entry_func); + Status processFragmentShaderEntry(Function* entry_func); // Returns whether the module has the SPV_EXT_fragment_shader_interlock // extension and one of the FragmentShader*InterlockEXT capabilities. diff --git a/third_party/spirv-tools/source/opt/ir_builder.h b/third_party/spirv-tools/source/opt/ir_builder.h index f7ac692a90..529bd8f1ea 100644 --- a/third_party/spirv-tools/source/opt/ir_builder.h +++ b/third_party/spirv-tools/source/opt/ir_builder.h @@ -166,10 +166,14 @@ class InstructionBuilder { for (size_t i = 0; i < operands.size(); i++) { ops.push_back({SPV_OPERAND_TYPE_ID, {operands[i]}}); } - // TODO(1841): Handle id overflow. - std::unique_ptr new_inst(new Instruction( - GetContext(), opcode, type_id, - result != 0 ? result : GetContext()->TakeNextId(), ops)); + if (result == 0) { + result = GetContext()->TakeNextId(); + if (result == 0) { + return nullptr; + } + } + std::unique_ptr new_inst( + new Instruction(GetContext(), opcode, type_id, result, ops)); return AddInstruction(std::move(new_inst)); } @@ -297,9 +301,12 @@ class InstructionBuilder { // The id |op1| is the left hand side of the operation. // The id |op2| is the right hand side of the operation. Instruction* AddIAdd(uint32_t type, uint32_t op1, uint32_t op2) { - // TODO(1841): Handle id overflow. + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } std::unique_ptr inst(new Instruction( - GetContext(), spv::Op::OpIAdd, type, GetContext()->TakeNextId(), + GetContext(), spv::Op::OpIAdd, type, result_id, {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); return AddInstruction(std::move(inst)); } @@ -311,9 +318,12 @@ class InstructionBuilder { Instruction* AddULessThan(uint32_t op1, uint32_t op2) { analysis::Bool bool_type; uint32_t type = GetContext()->get_type_mgr()->GetId(&bool_type); - // TODO(1841): Handle id overflow. + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } std::unique_ptr inst(new Instruction( - GetContext(), spv::Op::OpULessThan, type, GetContext()->TakeNextId(), + GetContext(), spv::Op::OpULessThan, type, result_id, {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); return AddInstruction(std::move(inst)); } @@ -325,9 +335,12 @@ class InstructionBuilder { Instruction* AddSLessThan(uint32_t op1, uint32_t op2) { analysis::Bool bool_type; uint32_t type = GetContext()->get_type_mgr()->GetId(&bool_type); - // TODO(1841): Handle id overflow. + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } std::unique_ptr inst(new Instruction( - GetContext(), spv::Op::OpSLessThan, type, GetContext()->TakeNextId(), + GetContext(), spv::Op::OpSLessThan, type, result_id, {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); return AddInstruction(std::move(inst)); } @@ -355,9 +368,12 @@ class InstructionBuilder { // bool) for |type|. Instruction* AddSelect(uint32_t type, uint32_t cond, uint32_t true_value, uint32_t false_value) { - // TODO(1841): Handle id overflow. + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } std::unique_ptr select(new Instruction( - GetContext(), spv::Op::OpSelect, type, GetContext()->TakeNextId(), + GetContext(), spv::Op::OpSelect, type, result_id, std::initializer_list{{SPV_OPERAND_TYPE_ID, {cond}}, {SPV_OPERAND_TYPE_ID, {true_value}}, {SPV_OPERAND_TYPE_ID, {false_value}}})); @@ -381,10 +397,12 @@ class InstructionBuilder { ops.emplace_back(SPV_OPERAND_TYPE_ID, std::initializer_list{id}); } - // TODO(1841): Handle id overflow. - std::unique_ptr construct( - new Instruction(GetContext(), spv::Op::OpCompositeConstruct, type, - GetContext()->TakeNextId(), ops)); + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } + std::unique_ptr construct(new Instruction( + GetContext(), spv::Op::OpCompositeConstruct, type, result_id, ops)); return AddInstruction(std::move(construct)); } @@ -466,10 +484,12 @@ class InstructionBuilder { operands.push_back({SPV_OPERAND_TYPE_LITERAL_INTEGER, {index}}); } - // TODO(1841): Handle id overflow. - std::unique_ptr new_inst( - new Instruction(GetContext(), spv::Op::OpCompositeExtract, type, - GetContext()->TakeNextId(), operands)); + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } + std::unique_ptr new_inst(new Instruction( + GetContext(), spv::Op::OpCompositeExtract, type, result_id, operands)); return AddInstruction(std::move(new_inst)); } @@ -493,9 +513,12 @@ class InstructionBuilder { operands.push_back({SPV_OPERAND_TYPE_ID, {index_id}}); } - // TODO(1841): Handle id overflow. - std::unique_ptr new_inst(new Instruction( - GetContext(), opcode, type_id, GetContext()->TakeNextId(), operands)); + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } + std::unique_ptr new_inst( + new Instruction(GetContext(), opcode, type_id, result_id, operands)); return AddInstruction(std::move(new_inst)); } @@ -521,29 +544,36 @@ class InstructionBuilder { operands.push_back({SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, {alignment}}); } - // TODO(1841): Handle id overflow. - std::unique_ptr new_inst( - new Instruction(GetContext(), spv::Op::OpLoad, type_id, - GetContext()->TakeNextId(), operands)); + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } + std::unique_ptr new_inst(new Instruction( + GetContext(), spv::Op::OpLoad, type_id, result_id, operands)); return AddInstruction(std::move(new_inst)); } Instruction* AddCopyObject(uint32_t type_id, uint32_t value_id) { std::vector operands{{SPV_OPERAND_TYPE_ID, {value_id}}}; - // TODO(1841): Handle id overflow. - std::unique_ptr new_inst( - new Instruction(GetContext(), spv::Op::OpCopyObject, type_id, - GetContext()->TakeNextId(), operands)); + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } + std::unique_ptr new_inst(new Instruction( + GetContext(), spv::Op::OpCopyObject, type_id, result_id, operands)); return AddInstruction(std::move(new_inst)); } Instruction* AddVariable(uint32_t type_id, uint32_t storage_class) { std::vector operands; operands.push_back({SPV_OPERAND_TYPE_STORAGE_CLASS, {storage_class}}); - std::unique_ptr new_inst( - new Instruction(GetContext(), spv::Op::OpVariable, type_id, - GetContext()->TakeNextId(), operands)); + uint32_t result_id = GetContext()->TakeNextId(); + if (result_id == 0) { + return nullptr; + } + std::unique_ptr new_inst(new Instruction( + GetContext(), spv::Op::OpVariable, type_id, result_id, operands)); return AddInstruction(std::move(new_inst)); } diff --git a/third_party/spirv-tools/source/opt/ir_context.cpp b/third_party/spirv-tools/source/opt/ir_context.cpp index 3f41965ea8..88b1f2ec2c 100644 --- a/third_party/spirv-tools/source/opt/ir_context.cpp +++ b/third_party/spirv-tools/source/opt/ir_context.cpp @@ -93,6 +93,9 @@ void IRContext::BuildInvalidAnalyses(IRContext::Analysis set) { if (set & kAnalysisLiveness) { BuildLivenessManager(); } + if (set & kAnalysisIdToGraphMapping) { + BuildIdToGraphMapping(); + } } void IRContext::InvalidateAnalysesExceptFor( @@ -164,6 +167,9 @@ void IRContext::InvalidateAnalyses(IRContext::Analysis analyses_to_invalidate) { if (analyses_to_invalidate & kAnalysisDebugInfo) { debug_info_mgr_.reset(nullptr); } + if (analyses_to_invalidate & kAnalysisIdToGraphMapping) { + id_to_graph_.clear(); + } valid_analyses_ = Analysis(valid_analyses_ & ~analyses_to_invalidate); } @@ -177,6 +183,8 @@ Instruction* IRContext::KillInst(Instruction* inst) { KillOperandFromDebugInstructions(inst); + KillRelatedDebugScopes(inst); + if (AreAnalysesValid(kAnalysisDefUse)) { analysis::DefUseManager* def_use_mgr = get_def_use_mgr(); def_use_mgr->ClearInst(inst); @@ -201,7 +209,9 @@ Instruction* IRContext::KillInst(Instruction* inst) { constant_mgr_->RemoveId(inst->result_id()); } if (inst->opcode() == spv::Op::OpCapability || - inst->opcode() == spv::Op::OpExtension) { + inst->opcode() == spv::Op::OpConditionalCapabilityINTEL || + inst->opcode() == spv::Op::OpExtension || + inst->opcode() == spv::Op::OpConditionalExtensionINTEL) { // We reset the feature manager, instead of updating it, because it is just // as much work. We would have to remove all capabilities implied by this // capability that are not also implied by the remaining OpCapability @@ -382,6 +392,7 @@ bool IRContext::IsConsistent() { } } + return true; if (AreAnalysesValid(kAnalysisIdToFuncMapping)) { for (auto& fn : *module_) { if (id_to_func_[fn.result_id()] != &fn) { @@ -390,6 +401,14 @@ bool IRContext::IsConsistent() { } } + if (AreAnalysesValid(kAnalysisIdToGraphMapping)) { + for (auto& g : module_->graphs()) { + if (id_to_graph_[g->DefInst().result_id()] != g.get()) { + return false; + } + } + } + if (AreAnalysesValid(kAnalysisInstrToBlockMapping)) { for (auto& func : *module()) { for (auto& block : func) { @@ -398,8 +417,9 @@ bool IRContext::IsConsistent() { return false; } return true; - })) + })) { return false; + } } } } @@ -514,6 +534,20 @@ void IRContext::KillOperandFromDebugInstructions(Instruction* inst) { } } +void IRContext::KillRelatedDebugScopes(Instruction* inst) { + // Extension has been fully unloaded, remove debug scope from every + // instruction. + if (inst->opcode() == spv::Op::OpExtInstImport) { + const std::string extension_name = inst->GetInOperand(0).AsString(); + if (extension_name == "NonSemantic.Shader.DebugInfo.100" || + extension_name == "OpenCL.DebugInfo.100") { + module()->ForEachInst([](Instruction* child) { + child->SetDebugScope(DebugScope(kNoDebugScope, kNoInlinedAt)); + }); + } + } +} + void IRContext::AddCombinatorsForCapability(uint32_t capability) { spv::Capability cap = spv::Capability(capability); if (cap == spv::Capability::Shader) { @@ -539,6 +573,7 @@ void IRContext::AddCombinatorsForCapability(uint32_t capability) { (uint32_t)spv::Op::OpTypeAccelerationStructureKHR, (uint32_t)spv::Op::OpTypeRayQueryKHR, (uint32_t)spv::Op::OpTypeHitObjectNV, + (uint32_t)spv::Op::OpTypeHitObjectEXT, (uint32_t)spv::Op::OpTypeArray, (uint32_t)spv::Op::OpTypeRuntimeArray, (uint32_t)spv::Op::OpTypeNodePayloadArrayAMDX, @@ -909,11 +944,13 @@ uint32_t IRContext::GetBuiltinInputVarId(uint32_t builtin) { return 0; } } + if (reg_type == nullptr) return 0; // Error + uint32_t type_id = type_mgr->GetTypeInstruction(reg_type); uint32_t varTyPtrId = type_mgr->FindPointerToType(type_id, spv::StorageClass::Input); - // TODO(1841): Handle id overflow. var_id = TakeNextId(); + if (var_id == 0) return 0; // Error std::unique_ptr newVarOp( new Instruction(this, spv::Op::OpVariable, varTyPtrId, var_id, {{spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, diff --git a/third_party/spirv-tools/source/opt/ir_context.h b/third_party/spirv-tools/source/opt/ir_context.h index d2b2092f76..f4a69fc4ba 100644 --- a/third_party/spirv-tools/source/opt/ir_context.h +++ b/third_party/spirv-tools/source/opt/ir_context.h @@ -84,7 +84,8 @@ class IRContext { kAnalysisTypes = 1 << 15, kAnalysisDebugInfo = 1 << 16, kAnalysisLiveness = 1 << 17, - kAnalysisEnd = 1 << 18 + kAnalysisIdToGraphMapping = 1 << 18, + kAnalysisEnd = 1 << 19 }; using ProcessFunction = std::function; @@ -109,7 +110,8 @@ class IRContext { id_to_name_(nullptr), max_id_bound_(kDefaultMaxIdBound), preserve_bindings_(false), - preserve_spec_constants_(false) { + preserve_spec_constants_(false), + id_overflow_(false) { SetContextMessageConsumer(syntax_context_, consumer_); module_->SetContext(this); } @@ -127,7 +129,8 @@ class IRContext { id_to_name_(nullptr), max_id_bound_(kDefaultMaxIdBound), preserve_bindings_(false), - preserve_spec_constants_(false) { + preserve_spec_constants_(false), + id_overflow_(false) { SetContextMessageConsumer(syntax_context_, consumer_); module_->SetContext(this); InitializeCombinators(); @@ -505,6 +508,9 @@ class IRContext { // Change operands of debug instruction to DebugInfoNone. void KillOperandFromDebugInstructions(Instruction* inst); + // Remove the debug scope from any instruction related to |inst|. + void KillRelatedDebugScopes(Instruction* inst); + // Returns the next unique id for use by an instruction. inline uint32_t TakeNextUniqueId() { assert(unique_id_ != std::numeric_limits::max()); @@ -563,6 +569,7 @@ class IRContext { inline uint32_t TakeNextId() { uint32_t next_id = module()->TakeNextIdBound(); if (next_id == 0) { + id_overflow_ = true; if (consumer()) { std::string message = "ID overflow. Try running compact-ids."; consumer()(SPV_MSG_ERROR, "", {0, 0, 0}, message.c_str()); @@ -583,6 +590,13 @@ class IRContext { return next_id; } + // Returns true if an ID overflow has occurred since the last time the flag + // was cleared. + bool id_overflow() const { return id_overflow_; } + + // Clears the ID overflow flag. + void clear_id_overflow() { id_overflow_ = false; } + FeatureManager* get_feature_mgr() { if (!feature_mgr_.get()) { AnalyzeFeatures(); @@ -641,6 +655,23 @@ class IRContext { return GetFunction(inst->result_id()); } + // Returns the graph whose id is |id|, if one exists. Returns |nullptr| + // otherwise. + Graph* GetGraph(uint32_t id) { + if (!AreAnalysesValid(kAnalysisIdToGraphMapping)) { + BuildIdToGraphMapping(); + } + auto entry = id_to_graph_.find(id); + return (entry != id_to_graph_.end()) ? entry->second : nullptr; + } + + Graph* GetGraph(Instruction* inst) { + if (inst->opcode() != spv::Op::OpGraphARM) { + return nullptr; + } + return GetGraph(inst->result_id()); + } + // Add to |todo| all ids of functions called directly from |func|. void AddCalls(const Function* func, std::queue* todo); @@ -719,6 +750,15 @@ class IRContext { valid_analyses_ = valid_analyses_ | kAnalysisIdToFuncMapping; } + // Builds the instruction-graph map for the whole module. + void BuildIdToGraphMapping() { + id_to_graph_.clear(); + for (auto& g : module_->graphs()) { + id_to_graph_[g->DefInst().result_id()] = g.get(); + } + valid_analyses_ = valid_analyses_ | kAnalysisIdToGraphMapping; + } + void BuildDecorationManager() { decoration_mgr_ = MakeUnique(module()); valid_analyses_ = valid_analyses_ | kAnalysisDecorations; @@ -872,6 +912,13 @@ class IRContext { // iterators to traverse instructions. std::unordered_map id_to_func_; + // A map from ids to the graph they define. This mapping is + // built on-demand when GetGraph() is called. + // + // NOTE: Do not traverse this map. Ever. Use the graph iterators to + // traverse instructions. + std::unordered_map id_to_graph_; + // A bitset indicating which analyzes are currently valid. Analysis valid_analyses_; @@ -930,6 +977,9 @@ class IRContext { // Whether all specialization constants within |module_| // should be preserved. bool preserve_spec_constants_; + + // Set to true if TakeNextId() fails. + bool id_overflow_; }; inline IRContext::Analysis operator|(IRContext::Analysis lhs, diff --git a/third_party/spirv-tools/source/opt/ir_loader.cpp b/third_party/spirv-tools/source/opt/ir_loader.cpp index 567b180b7c..2d52ee2b95 100644 --- a/third_party/spirv-tools/source/opt/ir_loader.cpp +++ b/third_party/spirv-tools/source/opt/ir_loader.cpp @@ -178,12 +178,48 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { last_dbg_scope_ = DebugScope(kNoDebugScope, kNoInlinedAt); last_line_inst_.reset(); dbg_line_info_.clear(); + } else if (opcode == spv::Op::OpGraphARM) { + if (graph_ != nullptr) { + Error(consumer_, src, loc, "graph inside graph"); + return false; + } + graph_ = MakeUnique(std::move(spv_inst)); + } else if (opcode == spv::Op::OpGraphEndARM) { + if (graph_ == nullptr) { + Error(consumer_, src, loc, + "OpGraphEndARM without corresponding OpGraphARM"); + return false; + } + graph_->SetGraphEnd(std::move(spv_inst)); + module_->AddGraph(std::move(graph_)); + graph_ = nullptr; + } else if (opcode == spv::Op::OpGraphConstantARM) { + module_->AddGlobalValue(std::move(spv_inst)); + } else if (graph_ != nullptr) { + if (opcode == spv::Op::OpGraphInputARM) { + graph_->AddInput(std::move(spv_inst)); + } else if (opcode == spv::Op::OpGraphSetOutputARM) { + graph_->AddOutput(std::move(spv_inst)); + } else { + switch (opcode) { + case spv::Op::OpExtInst: + case spv::Op::OpCompositeExtract: + graph_->AddInstruction(std::move(spv_inst)); + break; + default: + Errorf(consumer_, src, loc, + "unhandled instruction (opcode %d) inside graph", opcode); + return false; + } + } } else { if (function_ == nullptr) { // Outside function definition SPIRV_ASSERT(consumer_, block_ == nullptr); - if (opcode == spv::Op::OpCapability) { + if (opcode == spv::Op::OpCapability || + opcode == spv::Op::OpConditionalCapabilityINTEL) { module_->AddCapability(std::move(spv_inst)); - } else if (opcode == spv::Op::OpExtension) { + } else if (opcode == spv::Op::OpExtension || + opcode == spv::Op::OpConditionalExtensionINTEL) { module_->AddExtension(std::move(spv_inst)); } else if (opcode == spv::Op::OpExtInstImport) { module_->AddExtInstImport(std::move(spv_inst)); @@ -193,6 +229,8 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { module_->SetSampledImageAddressMode(std::move(spv_inst)); } else if (opcode == spv::Op::OpEntryPoint) { module_->AddEntryPoint(std::move(spv_inst)); + } else if (opcode == spv::Op::OpGraphEntryPointARM) { + module_->AddGraphEntryPoint(std::move(spv_inst)); } else if (opcode == spv::Op::OpExecutionMode || opcode == spv::Op::OpExecutionModeId) { module_->AddExecutionMode(std::move(spv_inst)); diff --git a/third_party/spirv-tools/source/opt/ir_loader.h b/third_party/spirv-tools/source/opt/ir_loader.h index 16bc2c7c84..a8d2119f95 100644 --- a/third_party/spirv-tools/source/opt/ir_loader.h +++ b/third_party/spirv-tools/source/opt/ir_loader.h @@ -20,6 +20,7 @@ #include #include "source/opt/basic_block.h" +#include "source/opt/graph.h" #include "source/opt/instruction.h" #include "source/opt/module.h" #include "spirv-tools/libspirv.hpp" @@ -80,6 +81,8 @@ class IrLoader { std::unique_ptr function_; // The current BasicBlock under construction. std::unique_ptr block_; + // The current Graph under construction. + std::unique_ptr graph_; // Line related debug instructions accumulated thus far. std::vector dbg_line_info_; // If doing extra line tracking, this is the line instruction that should be diff --git a/third_party/spirv-tools/source/opt/licm_pass.cpp b/third_party/spirv-tools/source/opt/licm_pass.cpp index f2a6e4df56..996762bd16 100644 --- a/third_party/spirv-tools/source/opt/licm_pass.cpp +++ b/third_party/spirv-tools/source/opt/licm_pass.cpp @@ -118,7 +118,6 @@ bool LICMPass::IsImmediatelyContainedInLoop(Loop* loop, Function* f, } bool LICMPass::HoistInstruction(Loop* loop, Instruction* inst) { - // TODO(1841): Handle failure to create pre-header. BasicBlock* pre_header_bb = loop->GetOrCreatePreHeaderBlock(); if (!pre_header_bb) { return false; diff --git a/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp b/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp index ae473ca1cd..264373308f 100644 --- a/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp +++ b/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp @@ -436,6 +436,7 @@ void LocalAccessChainConvertPass::InitExtensions() { "SPV_NV_shader_subgroup_partitioned", "SPV_EXT_demote_to_helper_invocation", "SPV_EXT_descriptor_indexing", + "SPV_EXT_descriptor_heap", "SPV_NV_fragment_shader_barycentric", "SPV_NV_compute_shader_derivatives", "SPV_NV_shader_image_footprint", @@ -467,6 +468,7 @@ void LocalAccessChainConvertPass::InitExtensions() { "SPV_NV_shader_invocation_reorder", "SPV_NV_cluster_acceleration_structure", "SPV_NV_linear_swept_spheres", + "SPV_KHR_maximal_reconvergence", }); } diff --git a/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp b/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp index 1995470392..5ba35324b8 100644 --- a/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp @@ -272,6 +272,7 @@ void LocalSingleBlockLoadStoreElimPass::InitExtensions() { "SPV_NV_shader_subgroup_partitioned", "SPV_EXT_demote_to_helper_invocation", "SPV_EXT_descriptor_indexing", + "SPV_EXT_descriptor_heap", "SPV_NV_fragment_shader_barycentric", "SPV_NV_compute_shader_derivatives", "SPV_NV_shader_image_footprint", @@ -304,6 +305,7 @@ void LocalSingleBlockLoadStoreElimPass::InitExtensions() { "SPV_NV_shader_invocation_reorder", "SPV_NV_cluster_acceleration_structure", "SPV_NV_linear_swept_spheres", + "SPV_KHR_maximal_reconvergence", }); } diff --git a/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp b/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp index 6f28e5484b..129b538402 100644 --- a/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp @@ -122,6 +122,7 @@ void LocalSingleStoreElimPass::InitExtensionAllowList() { "SPV_GOOGLE_hlsl_functionality1", "SPV_NV_shader_subgroup_partitioned", "SPV_EXT_descriptor_indexing", + "SPV_EXT_descriptor_heap", "SPV_NV_fragment_shader_barycentric", "SPV_NV_compute_shader_derivatives", "SPV_NV_shader_image_footprint", @@ -156,6 +157,7 @@ void LocalSingleStoreElimPass::InitExtensionAllowList() { "SPV_NV_shader_invocation_reorder", "SPV_NV_cluster_acceleration_structure", "SPV_NV_linear_swept_spheres", + "SPV_KHR_maximal_reconvergence", }); } bool LocalSingleStoreElimPass::ProcessVariable(Instruction* var_inst) { diff --git a/third_party/spirv-tools/source/opt/loop_descriptor.cpp b/third_party/spirv-tools/source/opt/loop_descriptor.cpp index cbfc2e7599..b0064b4f2c 100644 --- a/third_party/spirv-tools/source/opt/loop_descriptor.cpp +++ b/third_party/spirv-tools/source/opt/loop_descriptor.cpp @@ -25,6 +25,7 @@ #include "source/opt/dominator_tree.h" #include "source/opt/ir_context.h" #include "source/opt/iterator.h" +#include "source/opt/pass.h" #include "source/opt/tree_iterator.h" #include "source/util/make_unique.h" @@ -278,6 +279,9 @@ BasicBlock* Loop::GetOrCreatePreHeaderBlock() { CFG* cfg = context_->cfg(); loop_header_ = cfg->SplitLoopHeader(loop_header_); + if (loop_header_ == nullptr) { + return nullptr; + } return loop_preheader_; } @@ -920,18 +924,19 @@ Instruction* Loop::FindConditionVariable( return induction; } -bool LoopDescriptor::CreatePreHeaderBlocksIfMissing() { - auto modified = false; +LoopDescriptor::Status LoopDescriptor::CreatePreHeaderBlocksIfMissing() { + bool modified = false; for (auto& loop : *this) { if (!loop.GetPreHeaderBlock()) { + if (!loop.GetOrCreatePreHeaderBlock()) { + return Status::Failure; + } modified = true; - // TODO(1841): Handle failure to create pre-header. - loop.GetOrCreatePreHeaderBlock(); } } - return modified; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } // Add and remove loops which have been marked for addition and removal to diff --git a/third_party/spirv-tools/source/opt/loop_descriptor.h b/third_party/spirv-tools/source/opt/loop_descriptor.h index d451496e77..bd93bfa9bd 100644 --- a/third_party/spirv-tools/source/opt/loop_descriptor.h +++ b/third_party/spirv-tools/source/opt/loop_descriptor.h @@ -28,6 +28,7 @@ #include "source/opt/dominator_analysis.h" #include "source/opt/module.h" #include "source/opt/tree_iterator.h" +#include "source/util/status.h" namespace spvtools { namespace opt { @@ -425,6 +426,9 @@ class LoopDescriptor { using pre_iterator = TreeDFIterator; using const_pre_iterator = TreeDFIterator; + // The status of processing a module. + using Status = utils::Status; + // Creates a loop object for all loops found in |f|. LoopDescriptor(IRContext* context, const Function* f); @@ -506,9 +510,11 @@ class LoopDescriptor { loops_to_add_.emplace_back(std::make_pair(parent, std::move(loop_to_add))); } - // Checks all loops in |this| and will create pre-headers for all loops - // that don't have one. Returns |true| if any blocks were created. - bool CreatePreHeaderBlocksIfMissing(); + // Creates pre-header blocks for all loops in the function that do not have + // one. Returns `LoopDescriptor::Status::kSuccessWithChange` if any change is + // made, `LoopDescriptor::Status::kSuccessWithoutChange` if no change is made, + // and `LoopDescriptor::Status::kFailure` if it fails to create a pre-header. + Status CreatePreHeaderBlocksIfMissing(); // Should be called to preserve the LoopAnalysis after loops have been marked // for addition with AddLoop or MarkLoopForRemoval. diff --git a/third_party/spirv-tools/source/opt/loop_fission.cpp b/third_party/spirv-tools/source/opt/loop_fission.cpp index 1bbe4baa34..fbbee11f4c 100644 --- a/third_party/spirv-tools/source/opt/loop_fission.cpp +++ b/third_party/spirv-tools/source/opt/loop_fission.cpp @@ -362,14 +362,19 @@ Loop* LoopFissionImpl::SplitLoop() { LoopUtils util{context_, loop_}; LoopUtils::LoopCloningResult clone_results; Loop* cloned_loop = util.CloneAndAttachLoopToHeader(&clone_results); + if (!cloned_loop) { + return nullptr; + } // Update the OpLoopMerge in the cloned loop. cloned_loop->UpdateLoopMergeInst(); // Add the loop_ to the module. - // TODO(1841): Handle failure to create pre-header. - Function::iterator it = - util.GetFunction()->FindBlock(loop_->GetOrCreatePreHeaderBlock()->id()); + BasicBlock* pre_header = loop_->GetOrCreatePreHeaderBlock(); + if (!pre_header) { + return nullptr; + } + Function::iterator it = util.GetFunction()->FindBlock(pre_header->id()); util.GetFunction()->AddBasicBlocks(clone_results.cloned_bb_.begin(), clone_results.cloned_bb_.end(), ++it); loop_->SetPreHeaderBlock(cloned_loop->GetMergeBlock()); @@ -478,6 +483,9 @@ Pass::Status LoopFissionPass::Process() { if (impl.CanPerformSplit()) { Loop* second_loop = impl.SplitLoop(); + if (!second_loop) { + return Status::Failure; + } changed = true; context()->InvalidateAnalysesExceptFor( IRContext::kAnalysisLoopAnalysis); diff --git a/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp b/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp index 097430fcf1..c8e74c8d94 100644 --- a/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp +++ b/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp @@ -22,23 +22,27 @@ namespace spvtools { namespace opt { Pass::Status LoopFusionPass::Process() { - bool modified = false; + Status status = Status::SuccessWithoutChange; Module* module = context()->module(); // Process each function in the module for (Function& f : *module) { - modified |= ProcessFunction(&f); + status = CombineStatus(status, ProcessFunction(&f)); + if (status == Status::Failure) return Status::Failure; } - return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; + return status; } -bool LoopFusionPass::ProcessFunction(Function* function) { +Pass::Status LoopFusionPass::ProcessFunction(Function* function) { LoopDescriptor& ld = *context()->GetLoopDescriptor(function); // If a loop doesn't have a preheader needs then it needs to be created. Make // sure to return Status::SuccessWithChange in that case. - auto modified = ld.CreatePreHeaderBlocksIfMissing(); + bool modified = false; + auto status = ld.CreatePreHeaderBlocksIfMissing(); + if (status == LoopDescriptor::Status::Failure) return Status::Failure; + modified = status == LoopDescriptor::Status::SuccessWithChange; // TODO(tremmelg): Could the only loop that |loop| could possibly be fused be // picked out so don't have to check every loop @@ -55,13 +59,13 @@ bool LoopFusionPass::ProcessFunction(Function* function) { fusion.Fuse(); // Recurse, as the current iterators will have been invalidated. ProcessFunction(function); - return true; + return Status::SuccessWithChange; } } } } - return modified; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } } // namespace opt diff --git a/third_party/spirv-tools/source/opt/loop_fusion_pass.h b/third_party/spirv-tools/source/opt/loop_fusion_pass.h index 9d5b7ccdae..9c1f567a3d 100644 --- a/third_party/spirv-tools/source/opt/loop_fusion_pass.h +++ b/third_party/spirv-tools/source/opt/loop_fusion_pass.h @@ -39,7 +39,7 @@ class LoopFusionPass : public Pass { private: // Fuse loops in |function| if compatible, legal and the fused loop won't use // too many registers. - bool ProcessFunction(Function* function); + Status ProcessFunction(Function* function); // The maximum number of registers a fused loop is allowed to use. size_t max_registers_per_loop_; diff --git a/third_party/spirv-tools/source/opt/loop_peeling.cpp b/third_party/spirv-tools/source/opt/loop_peeling.cpp index 25c6db1207..e7f3876c57 100644 --- a/third_party/spirv-tools/source/opt/loop_peeling.cpp +++ b/third_party/spirv-tools/source/opt/loop_peeling.cpp @@ -45,7 +45,7 @@ void GetBlocksInPath(uint32_t block, uint32_t entry, size_t LoopPeelingPass::code_grow_threshold_ = 1000; -void LoopPeeling::DuplicateAndConnectLoop( +bool LoopPeeling::DuplicateAndConnectLoop( LoopUtils::LoopCloningResult* clone_results) { CFG& cfg = *context_->cfg(); analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); @@ -53,12 +53,17 @@ void LoopPeeling::DuplicateAndConnectLoop( assert(CanPeelLoop() && "Cannot peel loop!"); std::vector ordered_loop_blocks; - // TODO(1841): Handle failure to create pre-header. BasicBlock* pre_header = loop_->GetOrCreatePreHeaderBlock(); + if (!pre_header) { + return false; + } loop_->ComputeLoopStructuredOrder(&ordered_loop_blocks); cloned_loop_ = loop_utils_.CloneLoop(clone_results, ordered_loop_blocks); + if (!cloned_loop_) { + return false; + } // Add the basic block to the function. Function::iterator it = @@ -146,17 +151,21 @@ void LoopPeeling::DuplicateAndConnectLoop( // Force the creation of a new preheader for the original loop and set it as // the merge block for the cloned loop. - // TODO(1841): Handle failure to create pre-header. - cloned_loop_->SetMergeBlock(loop_->GetOrCreatePreHeaderBlock()); + BasicBlock* new_pre_header = loop_->GetOrCreatePreHeaderBlock(); + if (!new_pre_header) { + return false; + } + cloned_loop_->SetMergeBlock(new_pre_header); + return true; } -void LoopPeeling::InsertCanonicalInductionVariable( +bool LoopPeeling::InsertCanonicalInductionVariable( LoopUtils::LoopCloningResult* clone_results) { if (original_loop_canonical_induction_variable_) { canonical_induction_variable_ = context_->get_def_use_mgr()->GetDef(clone_results->value_map_.at( original_loop_canonical_induction_variable_->result_id())); - return; + return true; } BasicBlock::iterator insert_point = GetClonedLoop()->GetLatchBlock()->tail(); @@ -168,19 +177,25 @@ void LoopPeeling::InsertCanonicalInductionVariable( IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); Instruction* uint_1_cst = builder.GetIntConstant(1, int_type_->IsSigned()); + if (!uint_1_cst) return false; // Create the increment. // Note that we do "1 + 1" here, one of the operand should the phi // value but we don't have it yet. The operand will be set latter. Instruction* iv_inc = builder.AddIAdd( uint_1_cst->type_id(), uint_1_cst->result_id(), uint_1_cst->result_id()); + if (!iv_inc) return false; builder.SetInsertPoint(&*GetClonedLoop()->GetHeaderBlock()->begin()); + Instruction* initial_value = + builder.GetIntConstant(0, int_type_->IsSigned()); + if (!initial_value) return false; + canonical_induction_variable_ = builder.AddPhi( uint_1_cst->type_id(), - {builder.GetIntConstant(0, int_type_->IsSigned())->result_id(), - GetClonedLoop()->GetPreHeaderBlock()->id(), iv_inc->result_id(), - GetClonedLoop()->GetLatchBlock()->id()}); + {initial_value->result_id(), GetClonedLoop()->GetPreHeaderBlock()->id(), + iv_inc->result_id(), GetClonedLoop()->GetLatchBlock()->id()}); + if (!canonical_induction_variable_) return false; // Connect everything. iv_inc->SetInOperand(0, {canonical_induction_variable_->result_id()}); @@ -191,6 +206,7 @@ void LoopPeeling::InsertCanonicalInductionVariable( if (do_while_form_) { canonical_induction_variable_ = iv_inc; } + return true; } void LoopPeeling::GetIteratorUpdateOperations( @@ -308,7 +324,7 @@ void LoopPeeling::GetIteratingExitValues() { } } -void LoopPeeling::FixExitCondition( +bool LoopPeeling::FixExitCondition( const std::function& condition_builder) { CFG& cfg = *context_->cfg(); @@ -329,7 +345,11 @@ void LoopPeeling::FixExitCondition( --insert_point; } - exit_condition->SetInOperand(0, {condition_builder(&*insert_point)}); + uint32_t new_cond_id = condition_builder(&*insert_point); + if (new_cond_id == 0) { + return false; + } + exit_condition->SetInOperand(0, {new_cond_id}); uint32_t to_continue_block_idx = GetClonedLoop()->IsInsideLoop(exit_condition->GetSingleWordInOperand(1)) @@ -341,6 +361,7 @@ void LoopPeeling::FixExitCondition( // Update def/use manager. context_->get_def_use_mgr()->AnalyzeInstUse(exit_condition); + return true; } BasicBlock* LoopPeeling::CreateBlockBefore(BasicBlock* bb) { @@ -348,10 +369,13 @@ BasicBlock* LoopPeeling::CreateBlockBefore(BasicBlock* bb) { CFG& cfg = *context_->cfg(); assert(cfg.preds(bb->id()).size() == 1 && "More than one predecessor"); - // TODO(1841): Handle id overflow. + uint32_t new_id = context_->TakeNextId(); + if (new_id == 0) { + return nullptr; + } std::unique_ptr new_bb = - MakeUnique(std::unique_ptr(new Instruction( - context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {}))); + MakeUnique(std::unique_ptr( + new Instruction(context_, spv::Op::OpLabel, 0, new_id, {}))); // Update the loop descriptor. Loop* in_loop = (*loop_utils_.GetLoopDescriptor())[bb]; if (in_loop) { @@ -394,8 +418,10 @@ BasicBlock* LoopPeeling::CreateBlockBefore(BasicBlock* bb) { BasicBlock* LoopPeeling::ProtectLoop(Loop* loop, Instruction* condition, BasicBlock* if_merge) { - // TODO(1841): Handle failure to create pre-header. BasicBlock* if_block = loop->GetOrCreatePreHeaderBlock(); + if (!if_block) { + return nullptr; + } // Will no longer be a pre-header because of the if. loop->SetPreHeaderBlock(nullptr); // Kill the branch to the header. @@ -411,48 +437,63 @@ BasicBlock* LoopPeeling::ProtectLoop(Loop* loop, Instruction* condition, return if_block; } -void LoopPeeling::PeelBefore(uint32_t peel_factor) { +bool LoopPeeling::PeelBefore(uint32_t peel_factor) { assert(CanPeelLoop() && "Cannot peel loop"); LoopUtils::LoopCloningResult clone_results; // Clone the loop and insert the cloned one before the loop. - DuplicateAndConnectLoop(&clone_results); + if (!DuplicateAndConnectLoop(&clone_results)) { + return false; + } // Add a canonical induction variable "canonical_induction_variable_". - InsertCanonicalInductionVariable(&clone_results); + if (!InsertCanonicalInductionVariable(&clone_results)) { + return false; + } InstructionBuilder builder( context_, &*cloned_loop_->GetPreHeaderBlock()->tail(), IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); Instruction* factor = builder.GetIntConstant(peel_factor, int_type_->IsSigned()); + if (!factor) return false; Instruction* has_remaining_iteration = builder.AddLessThan( factor->result_id(), loop_iteration_count_->result_id()); + if (!has_remaining_iteration) return false; Instruction* max_iteration = builder.AddSelect( factor->type_id(), has_remaining_iteration->result_id(), factor->result_id(), loop_iteration_count_->result_id()); + if (!max_iteration) return false; // Change the exit condition of the cloned loop to be (exit when become // false): // "canonical_induction_variable_" < min("factor", "loop_iteration_count_") - FixExitCondition([max_iteration, this](Instruction* insert_before_point) { - return InstructionBuilder(context_, insert_before_point, - IRContext::kAnalysisDefUse | - IRContext::kAnalysisInstrToBlockMapping) - .AddLessThan(canonical_induction_variable_->result_id(), - max_iteration->result_id()) - ->result_id(); - }); + if (!FixExitCondition( + [max_iteration, this](Instruction* insert_before_point) { + Instruction* new_cond = + InstructionBuilder(context_, insert_before_point, + IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping) + .AddLessThan(canonical_induction_variable_->result_id(), + max_iteration->result_id()); + return new_cond ? new_cond->result_id() : 0; + })) { + return false; + } // "Protect" the second loop: the second loop can only be executed if // |has_remaining_iteration| is true (i.e. factor < loop_iteration_count_). BasicBlock* if_merge_block = loop_->GetMergeBlock(); - loop_->SetMergeBlock(CreateBlockBefore(loop_->GetMergeBlock())); + BasicBlock* new_merge_block = CreateBlockBefore(loop_->GetMergeBlock()); + if (!new_merge_block) return false; + loop_->SetMergeBlock(new_merge_block); // Prevent the second loop from being executed if we already executed all the // required iterations. BasicBlock* if_block = ProtectLoop(loop_, has_remaining_iteration, if_merge_block); + if (!if_block) return false; + // Patch the phi of the merge block. if_merge_block->ForEachPhiInst( [&clone_results, if_block, this](Instruction* phi) { @@ -471,14 +512,17 @@ void LoopPeeling::PeelBefore(uint32_t peel_factor) { context_->InvalidateAnalysesExceptFor( IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping | IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisCFG); + return true; } -void LoopPeeling::PeelAfter(uint32_t peel_factor) { +bool LoopPeeling::PeelAfter(uint32_t peel_factor) { assert(CanPeelLoop() && "Cannot peel loop"); LoopUtils::LoopCloningResult clone_results; // Clone the loop and insert the cloned one before the loop. - DuplicateAndConnectLoop(&clone_results); + if (!DuplicateAndConnectLoop(&clone_results)) { + return false; + } // Add a canonical induction variable "canonical_induction_variable_". InsertCanonicalInductionVariable(&clone_results); @@ -488,40 +532,55 @@ void LoopPeeling::PeelAfter(uint32_t peel_factor) { IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); Instruction* factor = builder.GetIntConstant(peel_factor, int_type_->IsSigned()); + if (!factor) return false; Instruction* has_remaining_iteration = builder.AddLessThan( factor->result_id(), loop_iteration_count_->result_id()); + if (!has_remaining_iteration) return false; // Change the exit condition of the cloned loop to be (exit when become // false): // "canonical_induction_variable_" + "factor" < "loop_iteration_count_" - FixExitCondition([factor, this](Instruction* insert_before_point) { - InstructionBuilder cond_builder( - context_, insert_before_point, - IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); - // Build the following check: canonical_induction_variable_ + factor < - // iteration_count - return cond_builder - .AddLessThan(cond_builder - .AddIAdd(canonical_induction_variable_->type_id(), - canonical_induction_variable_->result_id(), - factor->result_id()) - ->result_id(), - loop_iteration_count_->result_id()) - ->result_id(); - }); + if (!FixExitCondition([factor, + this](Instruction* insert_before_point) -> uint32_t { + InstructionBuilder cond_builder( + context_, insert_before_point, + IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping); + // Build the following check: canonical_induction_variable_ + factor < + // iteration_count + Instruction* add = cond_builder.AddIAdd( + canonical_induction_variable_->type_id(), + canonical_induction_variable_->result_id(), factor->result_id()); + if (!add) return 0; + Instruction* new_cond = cond_builder.AddLessThan( + add->result_id(), loop_iteration_count_->result_id()); + return new_cond ? new_cond->result_id() : 0; + })) { + return false; + } // "Protect" the first loop: the first loop can only be executed if // factor < loop_iteration_count_. // The original loop's pre-header was the cloned loop merge block. - GetClonedLoop()->SetMergeBlock( - CreateBlockBefore(GetOriginalLoop()->GetPreHeaderBlock())); + BasicBlock* pre_header = GetOriginalLoop()->GetPreHeaderBlock(); + if (!pre_header) { + return false; + } + BasicBlock* new_merge_block = CreateBlockBefore(pre_header); + if (!new_merge_block) { + return false; + } + GetClonedLoop()->SetMergeBlock(new_merge_block); // Use the second loop preheader as if merge block. // Prevent the first loop if only the peeled loop needs it. BasicBlock* if_block = ProtectLoop(cloned_loop_, has_remaining_iteration, GetOriginalLoop()->GetPreHeaderBlock()); + if (!if_block) { + return false; + } // Patch the phi of the header block. // We added an if to enclose the first loop and because the phi node are @@ -529,8 +588,10 @@ void LoopPeeling::PeelAfter(uint32_t peel_factor) { // dominate the preheader. // We had to the preheader (our if merge block) the required phi instruction // and patch the header phi. + bool ok = true; GetOriginalLoop()->GetHeaderBlock()->ForEachPhiInst( - [&clone_results, if_block, this](Instruction* phi) { + [&clone_results, if_block, &ok, this](Instruction* phi) { + if (!ok) return; analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); auto find_value_idx = [](Instruction* phi_inst, Loop* loop) { @@ -554,15 +615,21 @@ void LoopPeeling::PeelAfter(uint32_t peel_factor) { find_value_idx(phi, GetOriginalLoop())), GetClonedLoop()->GetMergeBlock()->id(), cloned_preheader_value, if_block->id()}); + if (!new_phi) { + ok = false; + return; + } phi->SetInOperand(find_value_idx(phi, GetOriginalLoop()), {new_phi->result_id()}); def_use_mgr->AnalyzeInstUse(phi); }); + if (!ok) return false; context_->InvalidateAnalysesExceptFor( IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping | IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisCFG); + return true; } Pass::Status LoopPeelingPass::Process() { @@ -571,13 +638,19 @@ Pass::Status LoopPeelingPass::Process() { // Process each function in the module for (Function& f : *module) { - modified |= ProcessFunction(&f); + Pass::Status status = ProcessFunction(&f); + if (status == Status::Failure) { + return Status::Failure; + } + if (status == Status::SuccessWithChange) { + modified = true; + } } return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } -bool LoopPeelingPass::ProcessFunction(Function* f) { +Pass::Status LoopPeelingPass::ProcessFunction(Function* f) { bool modified = false; LoopDescriptor& loop_descriptor = *context()->GetLoopDescriptor(f); @@ -593,41 +666,56 @@ bool LoopPeelingPass::ProcessFunction(Function* f) { CodeMetrics loop_size; loop_size.Analyze(*loop); - auto try_peel = [&loop_size, &modified, this](Loop* loop_to_peel) -> Loop* { + auto try_peel = [&loop_size, &modified, this]( + Loop* loop_to_peel) -> std::pair { if (!loop_to_peel->IsLCSSA()) { - LoopUtils(context(), loop_to_peel).MakeLoopClosedSSA(); + if (!LoopUtils(context(), loop_to_peel).MakeLoopClosedSSA()) { + return {Pass::Status::Failure, nullptr}; + } } - bool peeled_loop; + Pass::Status status; Loop* still_peelable_loop; - std::tie(peeled_loop, still_peelable_loop) = + std::tie(status, still_peelable_loop) = ProcessLoop(loop_to_peel, &loop_size); - if (peeled_loop) { + if (status == Pass::Status::SuccessWithChange) { modified = true; } - return still_peelable_loop; + return {status, still_peelable_loop}; }; - Loop* still_peelable_loop = try_peel(loop); + Pass::Status status; + Loop* still_peelable_loop; + std::tie(status, still_peelable_loop) = try_peel(loop); + + if (status == Pass::Status::Failure) { + return Pass::Status::Failure; + } + // The pass is working out the maximum factor by which a loop can be peeled. // If the loop can potentially be peeled again, then there is only one // possible direction, so only one call is still needed. if (still_peelable_loop) { - try_peel(loop); + std::tie(status, still_peelable_loop) = try_peel(still_peelable_loop); + if (status == Pass::Status::Failure) { + return Pass::Status::Failure; + } } } - return modified; + return modified ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; } -std::pair LoopPeelingPass::ProcessLoop(Loop* loop, - CodeMetrics* loop_size) { +std::tuple LoopPeelingPass::ProcessLoop( + Loop* loop, CodeMetrics* loop_size) { ScalarEvolutionAnalysis* scev_analysis = context()->GetScalarEvolutionAnalysis(); // Default values for bailing out. - std::pair bail_out{false, nullptr}; + std::tuple bail_out{Pass::Status::SuccessWithoutChange, + nullptr}; BasicBlock* exit_block = loop->FindConditionBlock(); if (!exit_block) { @@ -744,7 +832,9 @@ std::pair LoopPeelingPass::ProcessLoop(Loop* loop, Loop* extra_opportunity = nullptr; if (direction == PeelDirection::kBefore) { - peeler.PeelBefore(factor); + if (!peeler.PeelBefore(factor)) { + return {Pass::Status::Failure, nullptr}; + } if (stats_) { stats_->peeled_loops_.emplace_back(loop, PeelDirection::kBefore, factor); } @@ -753,7 +843,9 @@ std::pair LoopPeelingPass::ProcessLoop(Loop* loop, extra_opportunity = peeler.GetOriginalLoop(); } } else { - peeler.PeelAfter(factor); + if (!peeler.PeelAfter(factor)) { + return {Pass::Status::Failure, nullptr}; + } if (stats_) { stats_->peeled_loops_.emplace_back(loop, PeelDirection::kAfter, factor); } @@ -763,7 +855,7 @@ std::pair LoopPeelingPass::ProcessLoop(Loop* loop, } } - return {true, extra_opportunity}; + return {Pass::Status::SuccessWithChange, extra_opportunity}; } uint32_t LoopPeelingPass::LoopPeelingInfo::GetFirstLoopInvariantOperand( diff --git a/third_party/spirv-tools/source/opt/loop_peeling.h b/third_party/spirv-tools/source/opt/loop_peeling.h index 2a55fe44da..a794793d59 100644 --- a/third_party/spirv-tools/source/opt/loop_peeling.h +++ b/third_party/spirv-tools/source/opt/loop_peeling.h @@ -148,11 +148,11 @@ class LoopPeeling { // Moves the execution of the |factor| first iterations of the loop into a // dedicated loop. - void PeelBefore(uint32_t factor); + bool PeelBefore(uint32_t factor); // Moves the execution of the |factor| last iterations of the loop into a // dedicated loop. - void PeelAfter(uint32_t factor); + bool PeelAfter(uint32_t factor); // Returns the cloned loop. Loop* GetClonedLoop() { return cloned_loop_; } @@ -184,19 +184,19 @@ class LoopPeeling { // Duplicate |loop_| and place the new loop before the cloned loop. Iterating // values from the cloned loop are then connected to the original loop as // initializer. - void DuplicateAndConnectLoop(LoopUtils::LoopCloningResult* clone_results); + bool DuplicateAndConnectLoop(LoopUtils::LoopCloningResult* clone_results); // Insert the canonical induction variable into the first loop as a simplified - // counter. - void InsertCanonicalInductionVariable( + // counter. Returns true on success. + bool InsertCanonicalInductionVariable( LoopUtils::LoopCloningResult* clone_results); // Fixes the exit condition of the before loop. The function calls // |condition_builder| to get the condition to use in the conditional branch // of the loop exit. The loop will be exited if the condition evaluate to // true. |condition_builder| takes an Instruction* that represent the - // insertion point. - void FixExitCondition( + // insertion point. Returns true on success. + bool FixExitCondition( const std::function& condition_builder); // Gathers all operations involved in the update of |iterator| into @@ -321,10 +321,14 @@ class LoopPeelingPass : public Pass { ScalarEvolutionAnalysis* scev_analysis_; size_t loop_max_iterations_; }; - // Peel profitable loops in |f|. - bool ProcessFunction(Function* f); - // Peel |loop| if profitable. - std::pair ProcessLoop(Loop* loop, CodeMetrics* loop_size); + // Peel profitable loops in |f|. Returns Pass::Status::Failure if an error + // occurs. + Pass::Status ProcessFunction(Function* f); + // Peel |loop| if profitable. Returns Pass::Status::Failure if an error + // occurs. Returns {Pass::Status::SuccessWithChange, Loop*} if the loop is + // peeled and there is another peeling opportunity. + std::tuple ProcessLoop(Loop* loop, + CodeMetrics* loop_size); static size_t code_grow_threshold_; LoopPeelingStats* stats_; diff --git a/third_party/spirv-tools/source/opt/loop_unroller.cpp b/third_party/spirv-tools/source/opt/loop_unroller.cpp index 2e279a7855..8765b16f5d 100644 --- a/third_party/spirv-tools/source/opt/loop_unroller.cpp +++ b/third_party/spirv-tools/source/opt/loop_unroller.cpp @@ -178,7 +178,7 @@ class LoopUnrollerUtilsImpl { // Unroll the |loop| by given |factor| by copying the whole body |factor| // times. The resulting basicblock structure will remain a loop. - void PartiallyUnroll(Loop*, size_t factor); + bool PartiallyUnroll(Loop*, size_t factor); // If partially unrolling the |loop| would leave the loop with too many bodies // for its number of iterations then this method should be used. This method @@ -186,12 +186,12 @@ class LoopUnrollerUtilsImpl { // successor of the original's merge block. The original loop will have its // condition changed to loop over the residual part and the duplicate will be // partially unrolled. The resulting structure will be two loops. - void PartiallyUnrollResidualFactor(Loop* loop, size_t factor); + bool PartiallyUnrollResidualFactor(Loop* loop, size_t factor); // Fully unroll the |loop| by copying the full body by the total number of // loop iterations, folding all conditions, and removing the backedge from the // continue block to the header. - void FullyUnroll(Loop* loop); + bool FullyUnroll(Loop* loop); // Get the ID of the variable in the |phi| paired with |label|. uint32_t GetPhiDefID(const Instruction* phi, uint32_t label) const; @@ -203,7 +203,7 @@ class LoopUnrollerUtilsImpl { // Remove the OpConditionalBranch instruction inside |conditional_block| used // to branch to either exit or continue the loop and replace it with an // unconditional OpBranch to block |new_target|. - void FoldConditionBlock(BasicBlock* condtion_block, uint32_t new_target); + bool FoldConditionBlock(BasicBlock* condtion_block, uint32_t new_target); // Add all blocks_to_add_ to function_ at the |insert_point|. void AddBlocksToFunction(const BasicBlock* insert_point); @@ -211,7 +211,7 @@ class LoopUnrollerUtilsImpl { // Duplicates the |old_loop|, cloning each body and remapping the ids without // removing instructions or changing relative structure. Result will be stored // in |new_loop|. - void DuplicateLoop(Loop* old_loop, Loop* new_loop); + bool DuplicateLoop(Loop* old_loop, Loop* new_loop); inline size_t GetLoopIterationCount() const { return number_of_loop_iterations_; @@ -241,7 +241,7 @@ class LoopUnrollerUtilsImpl { // to old // ids. |loop| is used to identify special loop blocks (header, continue, // etc). - void AssignNewResultIds(BasicBlock* basic_block); + bool AssignNewResultIds(BasicBlock* basic_block); // Using the map built by AssignNewResultIds, replace the uses in |inst| // by the id that the use maps to. @@ -258,18 +258,18 @@ class LoopUnrollerUtilsImpl { // the old |loop| continue block and the new body will link to the |loop| // header via the new continue block. |eliminate_conditions| is used to decide // whether or not to fold all the condition blocks other than the last one. - void CopyBody(Loop* loop, bool eliminate_conditions); + bool CopyBody(Loop* loop, bool eliminate_conditions); // Copy a given |block_to_copy| in the |loop| and record the mapping of the // old/new ids. |preserve_instructions| determines whether or not the method // will modify (other than result_id) instructions which are copied. - void CopyBasicBlock(Loop* loop, const BasicBlock* block_to_copy, + bool CopyBasicBlock(Loop* loop, const BasicBlock* block_to_copy, bool preserve_instructions); // The actual implementation of the unroll step. Unrolls |loop| by given // |factor| by copying the body by |factor| times. Also propagates the // induction variable value throughout the copies. - void Unroll(Loop* loop, size_t factor); + bool Unroll(Loop* loop, size_t factor); // Fills the loop_blocks_inorder_ field with the ordered list of basic blocks // as computed by the method ComputeLoopOrderedBlocks. @@ -376,11 +376,12 @@ void LoopUnrollerUtilsImpl::Init(Loop* loop) { // loop it creates two loops and unrolls one and adjusts the condition on the // other. The end result being that the new loop pair iterates over the correct // number of bodies. -void LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, +bool LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, size_t factor) { - // TODO(1841): Handle id overflow. - std::unique_ptr new_label{new Instruction( - context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {})}; + uint32_t new_label_id = context_->TakeNextId(); + if (new_label_id == 0) return false; + std::unique_ptr new_label{ + new Instruction(context_, spv::Op::OpLabel, 0, new_label_id, {})}; std::unique_ptr new_exit_bb{new BasicBlock(std::move(new_label))}; new_exit_bb->SetParent(&function_); @@ -401,7 +402,9 @@ void LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, // Clear the basic blocks of the new loop. new_loop->ClearBlocks(); - DuplicateLoop(loop, new_loop.get()); + if (!DuplicateLoop(loop, new_loop.get())) { + return false; + } // Add the blocks to the function. AddBlocksToFunction(loop->GetMergeBlock()); @@ -416,7 +419,9 @@ void LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, loop_induction_variable_ = state_.new_phi; // Unroll the new loop by the factor with the usual -1 to account for the // existing block iteration. - Unroll(new_loop.get(), factor); + if (!Unroll(new_loop.get(), factor)) { + return false; + } LinkLastPhisToStart(new_loop.get()); AddBlocksToLoop(new_loop.get()); @@ -460,6 +465,10 @@ void LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, new_constant = builder.GetUintConstant(static_cast(remainder)); } + if (!new_constant) { + return false; + } + uint32_t constant_id = new_constant->result_id(); // Update the condition check. @@ -477,6 +486,9 @@ void LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, for (size_t index = 0; index < new_inductions.size(); ++index) { Instruction* new_induction = new_inductions[index]; Instruction* old_induction = old_inductions[index]; + if (!new_induction || !old_induction) { + return false; + } // Get the index of the loop initalizer, the value coming in from the // preheader. uint32_t initalizer_index = @@ -512,6 +524,7 @@ void LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, loop_descriptor.AddLoop(std::move(new_loop), loop->GetParent()); RemoveDeadInstructions(); + return true; } // Mark this loop as DontUnroll as it will already be unrolled and it may not @@ -528,7 +541,7 @@ void LoopUnrollerUtilsImpl::MarkLoopControlAsDontUnroll(Loop* loop) const { // Duplicate the |loop| body |factor| - 1 number of times while keeping the loop // backedge intact. This will leave the loop with |factor| number of bodies // after accounting for the initial body. -void LoopUnrollerUtilsImpl::Unroll(Loop* loop, size_t factor) { +bool LoopUnrollerUtilsImpl::Unroll(Loop* loop, size_t factor) { // If we unroll a loop partially it will not be safe to unroll it further. // This is due to the current method of calculating the number of loop // iterations. @@ -539,8 +552,11 @@ void LoopUnrollerUtilsImpl::Unroll(Loop* loop, size_t factor) { state_ = LoopUnrollState{loop_induction_variable_, loop->GetLatchBlock(), loop_condition_block_, std::move(inductions)}; for (size_t i = 0; i < factor - 1; ++i) { - CopyBody(loop, true); + if (!CopyBody(loop, true)) { + return false; + } } + return true; } void LoopUnrollerUtilsImpl::RemoveDeadInstructions() { @@ -573,12 +589,16 @@ void LoopUnrollerUtilsImpl::ReplaceInductionUseWithFinalValue(Loop* loop) { // Fully unroll the loop by partially unrolling it by the number of loop // iterations minus one for the body already accounted for. -void LoopUnrollerUtilsImpl::FullyUnroll(Loop* loop) { +bool LoopUnrollerUtilsImpl::FullyUnroll(Loop* loop) { // We unroll the loop by number of iterations in the loop. - Unroll(loop, number_of_loop_iterations_); + if (!Unroll(loop, number_of_loop_iterations_)) { + return false; + } // The first condition block is preserved until now so it can be copied. - FoldConditionBlock(loop_condition_block_, 1); + if (!FoldConditionBlock(loop_condition_block_, 1)) { + return false; + } // Delete the OpLoopMerge and remove the backedge to the header. CloseUnrolledLoop(loop); @@ -602,6 +622,7 @@ void LoopUnrollerUtilsImpl::FullyUnroll(Loop* loop) { context_->InvalidateAnalysesExceptFor( IRContext::Analysis::kAnalysisLoopAnalysis | IRContext::Analysis::kAnalysisDefUse); + return true; } void LoopUnrollerUtilsImpl::KillDebugDeclares(BasicBlock* bb) { @@ -622,10 +643,11 @@ void LoopUnrollerUtilsImpl::KillDebugDeclares(BasicBlock* bb) { // and the id mapping in the state. |preserve_instructions| is used to determine // whether or not this function should edit instructions other than the // |result_id|. -void LoopUnrollerUtilsImpl::CopyBasicBlock(Loop* loop, const BasicBlock* itr, +bool LoopUnrollerUtilsImpl::CopyBasicBlock(Loop* loop, const BasicBlock* itr, bool preserve_instructions) { // Clone the block exactly, including the IDs. BasicBlock* basic_block = itr->Clone(context_); + if (!basic_block) return false; basic_block->SetParent(itr->GetParent()); // We do not want to duplicate DebugDeclare. @@ -633,7 +655,9 @@ void LoopUnrollerUtilsImpl::CopyBasicBlock(Loop* loop, const BasicBlock* itr, // Assign each result a new unique ID and keep a mapping of the old ids to // the new ones. - AssignNewResultIds(basic_block); + if (!AssignNewResultIds(basic_block)) { + return false; + } // If this is the continue block we are copying. if (itr == loop->GetContinueBlock()) { @@ -672,13 +696,16 @@ void LoopUnrollerUtilsImpl::CopyBasicBlock(Loop* loop, const BasicBlock* itr, // Keep tracking the old block via a map. state_.new_blocks[itr->id()] = basic_block; + return true; } -void LoopUnrollerUtilsImpl::CopyBody(Loop* loop, bool eliminate_conditions) { +bool LoopUnrollerUtilsImpl::CopyBody(Loop* loop, bool eliminate_conditions) { // Copy each basic block in the loop, give them new ids, and save state // information. for (const BasicBlock* itr : loop_blocks_inorder_) { - CopyBasicBlock(loop, itr, false); + if (!CopyBasicBlock(loop, itr, false)) { + return false; + } } // Set the previous latch block to point to the new header. @@ -717,7 +744,9 @@ void LoopUnrollerUtilsImpl::CopyBody(Loop* loop, bool eliminate_conditions) { if (eliminate_conditions && state_.new_condition_block != loop_condition_block_) { - FoldConditionBlock(state_.new_condition_block, 1); + if (!FoldConditionBlock(state_.new_condition_block, 1)) { + return false; + } } // Only reference to the header block is the backedge in the latch block, @@ -733,6 +762,7 @@ void LoopUnrollerUtilsImpl::CopyBody(Loop* loop, bool eliminate_conditions) { // Swap the state so the new is now the previous. state_.NextIterationState(); + return true; } uint32_t LoopUnrollerUtilsImpl::GetPhiDefID(const Instruction* phi, @@ -746,7 +776,7 @@ uint32_t LoopUnrollerUtilsImpl::GetPhiDefID(const Instruction* phi, return 0; } -void LoopUnrollerUtilsImpl::FoldConditionBlock(BasicBlock* condition_block, +bool LoopUnrollerUtilsImpl::FoldConditionBlock(BasicBlock* condition_block, uint32_t operand_label) { // Remove the old conditional branch to the merge and continue blocks. Instruction& old_branch = *condition_block->tail(); @@ -763,8 +793,13 @@ void LoopUnrollerUtilsImpl::FoldConditionBlock(BasicBlock* condition_block, IRContext::Analysis::kAnalysisInstrToBlockMapping); Instruction* new_branch = builder.AddBranch(new_target); - if (!lines.empty()) new_branch->AddDebugLine(&lines.back()); + if (!lines.empty()) { + if (!new_branch->AddDebugLine(&lines.back())) { + return false; + } + } new_branch->SetDebugScope(scope); + return true; } void LoopUnrollerUtilsImpl::CloseUnrolledLoop(Loop* loop) { @@ -811,19 +846,24 @@ void LoopUnrollerUtilsImpl::CloseUnrolledLoop(Loop* loop) { } // Uses the first loop to create a copy of the loop with new IDs. -void LoopUnrollerUtilsImpl::DuplicateLoop(Loop* old_loop, Loop* new_loop) { +bool LoopUnrollerUtilsImpl::DuplicateLoop(Loop* old_loop, Loop* new_loop) { std::vector new_block_order; // Copy every block in the old loop. for (const BasicBlock* itr : loop_blocks_inorder_) { - CopyBasicBlock(old_loop, itr, true); + if (!CopyBasicBlock(old_loop, itr, true)) { + return false; + } new_block_order.push_back(blocks_to_add_.back().get()); } // Clone the merge block, give it a new id and record it in the state. BasicBlock* new_merge = old_loop->GetMergeBlock()->Clone(context_); + if (!new_merge) return false; new_merge->SetParent(old_loop->GetMergeBlock()->GetParent()); - AssignNewResultIds(new_merge); + if (!AssignNewResultIds(new_merge)) { + return false; + } state_.new_blocks[old_loop->GetMergeBlock()->id()] = new_merge; // Remap the operands of every instruction in the loop to point to the new @@ -840,6 +880,7 @@ void LoopUnrollerUtilsImpl::DuplicateLoop(Loop* old_loop, Loop* new_loop) { new_loop->SetContinueBlock(state_.new_continue_block); new_loop->SetLatchBlock(state_.new_latch_block); new_loop->SetMergeBlock(new_merge); + return true; } // Whenever the utility copies a block it stores it in a temporary buffer, this @@ -862,13 +903,15 @@ void LoopUnrollerUtilsImpl::AddBlocksToFunction( // Assign all result_ids in |basic_block| instructions to new IDs and preserve // the mapping of new ids to old ones. -void LoopUnrollerUtilsImpl::AssignNewResultIds(BasicBlock* basic_block) { +bool LoopUnrollerUtilsImpl::AssignNewResultIds(BasicBlock* basic_block) { analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); // Label instructions aren't covered by normal traversal of the // instructions. - // TODO(1841): Handle id overflow. uint32_t new_label_id = context_->TakeNextId(); + if (new_label_id == 0) { + return false; + } // Assign a new id to the label. state_.new_inst[basic_block->GetLabelInst()->result_id()] = new_label_id; @@ -888,10 +931,18 @@ void LoopUnrollerUtilsImpl::AssignNewResultIds(BasicBlock* basic_block) { } // Give the instruction a new id. - // TODO(1841): Handle id overflow. - inst.SetResultId(context_->TakeNextId()); + uint32_t new_id = context_->TakeNextId(); + if (new_id == 0) { + return false; + } + inst.SetResultId(new_id); def_use_mgr->AnalyzeInstDef(&inst); + // All decorations that can apply to an instruction in a function body + // modify the behaviour of the instruction, and should be on the + // new instruction to keep the same results. + context_->get_decoration_mgr()->CloneDecorations(old_id, new_id); + // Save the mapping of old_id -> new_id. state_.new_inst[old_id] = inst.result_id(); // Check if this instruction is the induction variable. @@ -901,6 +952,7 @@ void LoopUnrollerUtilsImpl::AssignNewResultIds(BasicBlock* basic_block) { } state_.ids_to_new_inst[inst.result_id()] = &inst; } + return true; } void LoopUnrollerUtilsImpl::RemapOperands(Instruction* inst) { @@ -961,12 +1013,13 @@ void LoopUnrollerUtilsImpl::LinkLastPhisToStart(Loop* loop) const { // Duplicate the |loop| body |factor| number of times while keeping the loop // backedge intact. -void LoopUnrollerUtilsImpl::PartiallyUnroll(Loop* loop, size_t factor) { - Unroll(loop, factor); +bool LoopUnrollerUtilsImpl::PartiallyUnroll(Loop* loop, size_t factor) { + if (!Unroll(loop, factor)) return false; LinkLastPhisToStart(loop); AddBlocksToLoop(loop); AddBlocksToFunction(loop->GetMergeBlock()); RemoveDeadInstructions(); + return true; } /* @@ -1071,7 +1124,9 @@ bool LoopUtils::PartiallyUnroll(size_t factor) { // If the unrolling factor is larger than or the same size as the loop just // fully unroll the loop. if (factor >= unroller.GetLoopIterationCount()) { - unroller.FullyUnroll(loop_); + if (!unroller.FullyUnroll(loop_)) { + return false; + } return true; } @@ -1080,9 +1135,13 @@ bool LoopUtils::PartiallyUnroll(size_t factor) { // remaining part. We add one when calucating the remainder to take into // account the one iteration already in the loop. if (unroller.GetLoopIterationCount() % factor != 0) { - unroller.PartiallyUnrollResidualFactor(loop_, factor); + if (!unroller.PartiallyUnrollResidualFactor(loop_, factor)) { + return false; + } } else { - unroller.PartiallyUnroll(loop_, factor); + if (!unroller.PartiallyUnroll(loop_, factor)) { + return false; + } } return true; @@ -1098,7 +1157,9 @@ bool LoopUtils::FullyUnroll() { loop_->GetHeaderBlock()->GetParent()}; unroller.Init(loop_); - unroller.FullyUnroll(loop_); + if (!unroller.FullyUnroll(loop_)) { + return false; + } return true; } @@ -1131,15 +1192,25 @@ Pass::Status LoopUnroller::Process() { } if (fully_unroll_) { - loop_utils.FullyUnroll(); + if (!loop_utils.FullyUnroll()) { + return Status::Failure; + } + changed = true; } else { - loop_utils.PartiallyUnroll(unroll_factor_); + if (!loop_utils.PartiallyUnroll(unroll_factor_)) { + return Status::Failure; + } + changed = true; } - changed = true; } LD->PostModificationCleanup(); } + if (changed) { + context()->InvalidateAnalysesExceptFor( + IRContext::Analysis::kAnalysisLoopAnalysis); + } + return changed ? Status::SuccessWithChange : Status::SuccessWithoutChange; } diff --git a/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp b/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp index 41f1a804bf..b49f243caa 100644 --- a/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp +++ b/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp @@ -92,12 +92,16 @@ class LoopUnswitch { // position |ip|. This function preserves the def/use and instr to block // managers. BasicBlock* CreateBasicBlock(Function::iterator ip) { + uint32_t new_label_id = TakeNextId(); + if (new_label_id == 0) { + return nullptr; + } + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); - // TODO(1841): Handle id overflow. BasicBlock* bb = &*ip.InsertBefore(std::unique_ptr( new BasicBlock(std::unique_ptr(new Instruction( - context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {}))))); + context_, spv::Op::OpLabel, 0, new_label_id, {}))))); bb->SetParent(function_); def_use_mgr->AnalyzeInstDef(bb->GetLabelInst()); context_->set_instr_block(bb->GetLabelInst(), bb); @@ -135,7 +139,7 @@ class LoopUnswitch { } // Unswitches |loop_|. - void PerformUnswitch() { + bool PerformUnswitch() { assert(CanUnswitchLoop() && "Cannot unswitch if there is not constant condition"); assert(loop_->GetPreHeaderBlock() && "This loop has no pre-header block"); @@ -165,6 +169,9 @@ class LoopUnswitch { if_merge_block ? CreateBasicBlock(FindBasicBlockPosition(if_merge_block)) : nullptr; + if (if_merge_block && !loop_merge_block) { + return false; + } if (loop_merge_block) { // Add the instruction and update managers. InstructionBuilder builder( @@ -174,17 +181,24 @@ class LoopUnswitch { builder.SetInsertPoint(&*loop_merge_block->begin()); cfg.RegisterBlock(loop_merge_block); def_use_mgr->AnalyzeInstDef(loop_merge_block->GetLabelInst()); - // Update CFG. + bool ok = true; if_merge_block->ForEachPhiInst( - [loop_merge_block, &builder, this](Instruction* phi) { + [loop_merge_block, &ok, &builder, this](Instruction* phi) -> bool { Instruction* cloned = phi->Clone(context_); - cloned->SetResultId(TakeNextId()); + uint32_t new_id = TakeNextId(); + if (new_id == 0) { + ok = false; + return false; + } + cloned->SetResultId(new_id); builder.AddInstruction(std::unique_ptr(cloned)); phi->SetInOperand(0, {cloned->result_id()}); phi->SetInOperand(1, {loop_merge_block->id()}); for (uint32_t j = phi->NumInOperands() - 1; j > 1; j--) phi->RemoveInOperand(j); + return true; }); + if (!ok) return false; // Copy the predecessor list (will get invalidated otherwise). std::vector preds = cfg.preds(if_merge_block->id()); for (uint32_t pid : preds) { @@ -227,6 +241,9 @@ class LoopUnswitch { // we need to create a dedicated block for the if. BasicBlock* loop_pre_header = CreateBasicBlock(++FindBasicBlockPosition(if_block)); + if (!loop_pre_header) { + return false; + } InstructionBuilder( context_, loop_pre_header, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping) @@ -308,6 +325,12 @@ class LoopUnswitch { // specific value. original_loop_constant_value = GetValueForDefaultPathForSwitch(iv_condition); + if (!original_loop_constant_value) { + return false; + } + if (!original_loop_constant_value) { + return false; + } for (uint32_t i = 2; i < iv_condition->NumInOperands(); i += 2) { constant_branch.emplace_back( @@ -341,6 +364,9 @@ class LoopUnswitch { Loop* cloned_loop = loop_utils.CloneLoop(&clone_result, ordered_loop_blocks_); + if (!cloned_loop) { + return false; + } specialisation_pair.second = cloned_loop->GetPreHeaderBlock(); //////////////////////////////////// @@ -416,6 +442,7 @@ class LoopUnswitch { context_->InvalidateAnalysesExceptFor( IRContext::Analysis::kAnalysisLoopAnalysis); + return true; } private: @@ -434,10 +461,7 @@ class LoopUnswitch { std::vector ordered_loop_blocks_; // Returns the next usable id for the context. - uint32_t TakeNextId() { - // TODO(1841): Handle id overflow. - return context_->TakeNextId(); - } + uint32_t TakeNextId() { return context_->TakeNextId(); } // Simplifies |loop| assuming the instruction |to_version_insn| takes the // value |cst_value|. |block_range| is an iterator range returning the loop @@ -573,13 +597,15 @@ Pass::Status LoopUnswitchPass::Process() { // Process each function in the module for (Function& f : *module) { - modified |= ProcessFunction(&f); + Pass::Status status = ProcessFunction(&f); + if (status == Status::Failure) return Status::Failure; + if (status == Status::SuccessWithChange) modified = true; } return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } -bool LoopUnswitchPass::ProcessFunction(Function* f) { +Pass::Status LoopUnswitchPass::ProcessFunction(Function* f) { bool modified = false; std::unordered_set processed_loop; @@ -597,17 +623,21 @@ bool LoopUnswitchPass::ProcessFunction(Function* f) { LoopUnswitch unswitcher(context(), f, &loop, &loop_descriptor); while (unswitcher.CanUnswitchLoop()) { if (!loop.IsLCSSA()) { - LoopUtils(context(), &loop).MakeLoopClosedSSA(); + if (!LoopUtils(context(), &loop).MakeLoopClosedSSA()) { + return Status::Failure; + } + } + if (!unswitcher.PerformUnswitch()) { + return Status::Failure; } modified = true; loop_changed = true; - unswitcher.PerformUnswitch(); } if (loop_changed) break; } } - return modified; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } } // namespace opt diff --git a/third_party/spirv-tools/source/opt/loop_unswitch_pass.h b/third_party/spirv-tools/source/opt/loop_unswitch_pass.h index 4f7295d437..66a757ff2f 100644 --- a/third_party/spirv-tools/source/opt/loop_unswitch_pass.h +++ b/third_party/spirv-tools/source/opt/loop_unswitch_pass.h @@ -34,7 +34,8 @@ class LoopUnswitchPass : public Pass { Pass::Status Process() override; private: - bool ProcessFunction(Function* f); + // Process the given function. + Pass::Status ProcessFunction(Function* f); }; } // namespace opt diff --git a/third_party/spirv-tools/source/opt/loop_utils.cpp b/third_party/spirv-tools/source/opt/loop_utils.cpp index 20494e12ba..ced68de718 100644 --- a/third_party/spirv-tools/source/opt/loop_utils.cpp +++ b/third_party/spirv-tools/source/opt/loop_utils.cpp @@ -68,7 +68,7 @@ class LCSSARewriter { // block. This operation does not update the def/use manager, instead it // records what needs to be updated. The actual update is performed by // UpdateManagers. - void RewriteUse(BasicBlock* bb, Instruction* user, uint32_t operand_index) { + bool RewriteUse(BasicBlock* bb, Instruction* user, uint32_t operand_index) { assert( (user->opcode() != spv::Op::OpPhi || bb != GetParent(user)) && "The root basic block must be the incoming edge if |user| is a phi " @@ -79,9 +79,13 @@ class LCSSARewriter { "phi instruction"); Instruction* new_def = GetOrBuildIncoming(bb->id()); + if (!new_def) { + return false; + } user->SetOperand(operand_index, {new_def->result_id()}); rewritten_.insert(user); + return true; } // In-place update of some managers (avoid full invalidation). @@ -120,6 +124,9 @@ class LCSSARewriter { IRContext::kAnalysisInstrToBlockMapping); Instruction* incoming_phi = builder.AddPhi(def_insn_.type_id(), incomings); + if (!incoming_phi) { + return nullptr; + } rewritten_.insert(incoming_phi); return incoming_phi; @@ -139,6 +146,9 @@ class LCSSARewriter { IRContext::kAnalysisInstrToBlockMapping); Instruction* incoming_phi = builder.AddPhi(def_insn_.type_id(), incomings); + if (!incoming_phi) { + return nullptr; + } rewritten_.insert(incoming_phi); return incoming_phi; @@ -270,7 +280,7 @@ class LCSSARewriter { // Make the set |blocks| closed SSA. The set is closed SSA if all the uses // outside the set are phi instructions in exiting basic block set (hold by // |lcssa_rewriter|). -inline void MakeSetClosedSSA(IRContext* context, Function* function, +inline bool MakeSetClosedSSA(IRContext* context, Function* function, const std::unordered_set& blocks, const std::unordered_set& exit_bb, LCSSARewriter* lcssa_rewriter) { @@ -285,18 +295,18 @@ inline void MakeSetClosedSSA(IRContext* context, Function* function, if (!DominatesAnExit(bb, exit_bb, dom_tree)) continue; for (Instruction& inst : *bb) { LCSSARewriter::UseRewriter rewriter(lcssa_rewriter, inst); - def_use_manager->ForEachUse( + bool success = def_use_manager->WhileEachUse( &inst, [&blocks, &rewriter, &exit_bb, context]( Instruction* use, uint32_t operand_index) { BasicBlock* use_parent = context->get_instr_block(use); assert(use_parent); - if (blocks.count(use_parent->id())) return; + if (blocks.count(use_parent->id())) return true; if (use->opcode() == spv::Op::OpPhi) { // If the use is a Phi instruction and the incoming block is // coming from the loop, then that's consistent with LCSSA form. if (exit_bb.count(use_parent)) { - return; + return true; } else { // That's not an exit block, but the user is a phi instruction. // Consider the incoming branch only. @@ -306,16 +316,20 @@ inline void MakeSetClosedSSA(IRContext* context, Function* function, } // Rewrite the use. Note that this call does not invalidate the // def/use manager. So this operation is safe. - rewriter.RewriteUse(use_parent, use, operand_index); + return rewriter.RewriteUse(use_parent, use, operand_index); }); + if (!success) { + return false; + } rewriter.UpdateManagers(); } } + return true; } } // namespace -void LoopUtils::CreateLoopDedicatedExits() { +bool LoopUtils::CreateLoopDedicatedExits() { Function* function = loop_->GetHeaderBlock()->GetParent(); LoopDescriptor& loop_desc = *context_->GetLoopDescriptor(function); CFG& cfg = *context_->cfg(); @@ -351,10 +365,13 @@ void LoopUtils::CreateLoopDedicatedExits() { assert(insert_pt != function->end() && "Basic Block not found"); // Create the dedicate exit basic block. - // TODO(1841): Handle id overflow. - BasicBlock& exit = *insert_pt.InsertBefore(std::unique_ptr( - new BasicBlock(std::unique_ptr(new Instruction( - context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {}))))); + uint32_t exit_id = context_->TakeNextId(); + if (exit_id == 0) { + return false; + } + BasicBlock& exit = *insert_pt.InsertBefore( + std::unique_ptr(new BasicBlock(std::unique_ptr( + new Instruction(context_, spv::Op::OpLabel, 0, exit_id, {}))))); exit.SetParent(function); // Redirect in loop predecessors to |exit| block. @@ -380,7 +397,7 @@ void LoopUtils::CreateLoopDedicatedExits() { // We also reset the insert point so all instructions are inserted before // the branch. builder.SetInsertPoint(builder.AddBranch(non_dedicate->id())); - non_dedicate->ForEachPhiInst( + bool succeeded = non_dedicate->WhileEachPhiInst( [&builder, &exit, def_use_mgr, this](Instruction* phi) { // New phi operands for this instruction. std::vector new_phi_op; @@ -400,6 +417,9 @@ void LoopUtils::CreateLoopDedicatedExits() { // Build the new phi instruction dedicated exit block. Instruction* exit_phi = builder.AddPhi(phi->type_id(), exit_phi_op); + if (!exit_phi) { + return false; + } // Build the new incoming branch. new_phi_op.push_back(exit_phi->result_id()); new_phi_op.push_back(exit.id()); @@ -412,7 +432,9 @@ void LoopUtils::CreateLoopDedicatedExits() { phi->RemoveInOperand(j); // Update the def/use manager for this |phi|. def_use_mgr->AnalyzeInstUse(phi); + return true; }); + if (!succeeded) return false; // Update the CFG. cfg.RegisterBlock(&exit); cfg.RemoveNonExistingEdges(non_dedicate->id()); @@ -431,10 +453,13 @@ void LoopUtils::CreateLoopDedicatedExits() { PreservedAnalyses | IRContext::kAnalysisCFG | IRContext::Analysis::kAnalysisLoopAnalysis); } + return true; } -void LoopUtils::MakeLoopClosedSSA() { - CreateLoopDedicatedExits(); +bool LoopUtils::MakeLoopClosedSSA() { + if (!CreateLoopDedicatedExits()) { + return false; + } Function* function = loop_->GetHeaderBlock()->GetParent(); CFG& cfg = *context_->cfg(); @@ -452,8 +477,10 @@ void LoopUtils::MakeLoopClosedSSA() { LCSSARewriter lcssa_rewriter(context_, dom_tree, exit_bb, loop_->GetMergeBlock()); - MakeSetClosedSSA(context_, function, loop_->GetBlocks(), exit_bb, - &lcssa_rewriter); + if (!MakeSetClosedSSA(context_, function, loop_->GetBlocks(), exit_bb, + &lcssa_rewriter)) { + return false; + } // Make sure all defs post-dominated by the merge block have their last use no // further than the merge block. @@ -466,14 +493,17 @@ void LoopUtils::MakeLoopClosedSSA() { exit_bb.insert(loop_->GetMergeBlock()); // LCSSARewriter is reusable here only because it forces the creation of a // phi instruction in the merge block. - MakeSetClosedSSA(context_, function, merging_bb_id, exit_bb, - &lcssa_rewriter); + if (!MakeSetClosedSSA(context_, function, merging_bb_id, exit_bb, + &lcssa_rewriter)) { + return false; + } } context_->InvalidateAnalysesExceptFor( IRContext::Analysis::kAnalysisCFG | IRContext::Analysis::kAnalysisDominatorAnalysis | IRContext::Analysis::kAnalysisLoopAnalysis); + return true; } Loop* LoopUtils::CloneLoop(LoopCloningResult* cloning_result) const { @@ -488,12 +518,18 @@ Loop* LoopUtils::CloneLoop(LoopCloningResult* cloning_result) const { Loop* LoopUtils::CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result) { // Clone the loop. - Loop* new_loop = CloneLoop(cloning_result); + Loop* cloned_loop = CloneLoop(cloning_result); + if (!cloned_loop) { + return nullptr; + } // Create a new exit block/label for the new loop. - // TODO(1841): Handle id overflow. - std::unique_ptr new_label{new Instruction( - context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {})}; + uint32_t new_label_id = context_->TakeNextId(); + if (new_label_id == 0) { + return nullptr; + } + std::unique_ptr new_label{ + new Instruction(context_, spv::Op::OpLabel, 0, new_label_id, {})}; std::unique_ptr new_exit_bb{new BasicBlock(std::move(new_label))}; new_exit_bb->SetParent(loop_->GetMergeBlock()->GetParent()); @@ -520,7 +556,7 @@ Loop* LoopUtils::CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result) { } const uint32_t old_header = loop_->GetHeaderBlock()->id(); - const uint32_t new_header = new_loop->GetHeaderBlock()->id(); + const uint32_t new_header = cloned_loop->GetHeaderBlock()->id(); analysis::DefUseManager* def_use = context_->get_def_use_mgr(); def_use->ForEachUse(old_header, @@ -529,22 +565,24 @@ Loop* LoopUtils::CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result) { inst->SetOperand(operand, {new_header}); }); - // TODO(1841): Handle failure to create pre-header. + BasicBlock* pre_header = loop_->GetOrCreatePreHeaderBlock(); + if (!pre_header) { + return nullptr; + } def_use->ForEachUse( - loop_->GetOrCreatePreHeaderBlock()->id(), + pre_header->id(), [new_merge_block, this](Instruction* inst, uint32_t operand) { if (this->loop_->IsInsideLoop(inst)) inst->SetOperand(operand, {new_merge_block}); - }); - new_loop->SetMergeBlock(new_exit_bb.get()); + cloned_loop->SetMergeBlock(new_exit_bb.get()); - new_loop->SetPreHeaderBlock(loop_->GetPreHeaderBlock()); + cloned_loop->SetPreHeaderBlock(loop_->GetPreHeaderBlock()); // Add the new block into the cloned instructions. cloning_result->cloned_bb_.push_back(std::move(new_exit_bb)); - return new_loop; + return cloned_loop; } Loop* LoopUtils::CloneLoop( @@ -561,9 +599,13 @@ Loop* LoopUtils::CloneLoop( // For each basic block in the loop, we clone it and register the mapping // between old and new ids. BasicBlock* new_bb = old_bb->Clone(context_); + if (!new_bb) return nullptr; new_bb->SetParent(&function_); - // TODO(1841): Handle id overflow. - new_bb->GetLabelInst()->SetResultId(context_->TakeNextId()); + uint32_t new_label_id = context_->TakeNextId(); + if (new_label_id == 0) { + return nullptr; + } + new_bb->GetLabelInst()->SetResultId(new_label_id); def_use_mgr->AnalyzeInstDef(new_bb->GetLabelInst()); context_->set_instr_block(new_bb->GetLabelInst(), new_bb); cloning_result->cloned_bb_.emplace_back(new_bb); @@ -578,8 +620,11 @@ Loop* LoopUtils::CloneLoop( new_inst != new_bb->end(); ++new_inst, ++old_inst) { cloning_result->ptr_map_[&*new_inst] = &*old_inst; if (new_inst->HasResultId()) { - // TODO(1841): Handle id overflow. - new_inst->SetResultId(context_->TakeNextId()); + uint32_t new_result_id = context_->TakeNextId(); + if (new_result_id == 0) { + return nullptr; + } + new_inst->SetResultId(new_result_id); cloning_result->value_map_[old_inst->result_id()] = new_inst->result_id(); diff --git a/third_party/spirv-tools/source/opt/loop_utils.h b/third_party/spirv-tools/source/opt/loop_utils.h index 70060fc4f0..2c96e9ec21 100644 --- a/third_party/spirv-tools/source/opt/loop_utils.h +++ b/third_party/spirv-tools/source/opt/loop_utils.h @@ -95,14 +95,14 @@ class LoopUtils { // // This makes some loop transformations (such as loop unswitch) simpler // (removes the needs to take care of exiting variables). - void MakeLoopClosedSSA(); + bool MakeLoopClosedSSA(); // Create dedicate exit basic block. This ensure all exit basic blocks has the // loop as sole predecessors. // By construction, structured control flow already has a dedicated exit // block. // Preserves: CFG, def/use and instruction to block mapping. - void CreateLoopDedicatedExits(); + bool CreateLoopDedicatedExits(); // Clone |loop_| and remap its instructions. Newly created blocks // will be added to the |cloning_result.cloned_bb_| list, correctly ordered to @@ -114,6 +114,7 @@ class LoopUtils { // The function preserves the def/use, cfg and instr to block analyses. // The cloned loop nest will be added to the loop descriptor and will have // ownership. + // Returns the cloned loop, or nullptr if the loop could not be cloned. Loop* CloneLoop(LoopCloningResult* cloning_result, const std::vector& ordered_loop_blocks) const; // Clone |loop_| and remap its instructions, as above. Overload to compute @@ -121,6 +122,7 @@ class LoopUtils { Loop* CloneLoop(LoopCloningResult* cloning_result) const; // Clone the |loop_| and make the new loop branch to the second loop on exit. + // Returns the cloned loop, or nullptr if the loop could not be cloned. Loop* CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result); // Perform a partial unroll of |loop| by given |factor|. This will copy the diff --git a/third_party/spirv-tools/source/opt/mem_pass.cpp b/third_party/spirv-tools/source/opt/mem_pass.cpp index e4eb751cb4..8da06683a3 100644 --- a/third_party/spirv-tools/source/opt/mem_pass.cpp +++ b/third_party/spirv-tools/source/opt/mem_pass.cpp @@ -340,7 +340,7 @@ bool MemPass::IsTargetVar(uint32_t varId) { // %50 = OpUndef %int // [ ... ] // %30 = OpPhi %int %int_42 %13 %50 %14 %50 %15 -void MemPass::RemovePhiOperands( +bool MemPass::RemovePhiOperands( Instruction* phi, const std::unordered_set& reachable_blocks) { std::vector keep_operands; uint32_t type_id = 0; @@ -382,6 +382,7 @@ void MemPass::RemovePhiOperands( if (!undef_id) { type_id = arg_def_instr->type_id(); undef_id = Type2Undef(type_id); + if (undef_id == 0) return false; } keep_operands.push_back( Operand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, {undef_id})); @@ -400,6 +401,7 @@ void MemPass::RemovePhiOperands( context()->ForgetUses(phi); phi->ReplaceOperands(keep_operands); context()->AnalyzeUses(phi); + return true; } void MemPass::RemoveBlock(Function::iterator* bi) { @@ -422,8 +424,8 @@ void MemPass::RemoveBlock(Function::iterator* bi) { *bi = bi->Erase(); } -bool MemPass::RemoveUnreachableBlocks(Function* func) { - if (func->IsDeclaration()) return false; +Pass::Status MemPass::RemoveUnreachableBlocks(Function* func) { + if (func->IsDeclaration()) return Status::SuccessWithoutChange; bool modified = false; // Mark reachable all blocks reachable from the function's entry block. @@ -469,9 +471,11 @@ bool MemPass::RemoveUnreachableBlocks(Function* func) { // If the block is reachable and has Phi instructions, remove all // operands from its Phi instructions that reference unreachable blocks. // If the block has no Phi instructions, this is a no-op. - block.ForEachPhiInst([&reachable_blocks, this](Instruction* phi) { - RemovePhiOperands(phi, reachable_blocks); - }); + bool success = + block.WhileEachPhiInst([&reachable_blocks, this](Instruction* phi) { + return RemovePhiOperands(phi, reachable_blocks); + }); + if (!success) return Status::Failure; } // Erase unreachable blocks. @@ -484,13 +488,11 @@ bool MemPass::RemoveUnreachableBlocks(Function* func) { } } - return modified; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } -bool MemPass::CFGCleanup(Function* func) { - bool modified = false; - modified |= RemoveUnreachableBlocks(func); - return modified; +Pass::Status MemPass::CFGCleanup(Function* func) { + return RemoveUnreachableBlocks(func); } void MemPass::CollectTargetVars(Function* func) { diff --git a/third_party/spirv-tools/source/opt/mem_pass.h b/third_party/spirv-tools/source/opt/mem_pass.h index aef9e5ffa7..496286b5f8 100644 --- a/third_party/spirv-tools/source/opt/mem_pass.h +++ b/third_party/spirv-tools/source/opt/mem_pass.h @@ -114,7 +114,7 @@ class MemPass : public Pass { void DCEInst(Instruction* inst, const std::function&); // Call all the cleanup helper functions on |func|. - bool CFGCleanup(Function* func); + Status CFGCleanup(Function* func); // Return true if |op| is supported decorate. inline bool IsNonTypeDecorate(spv::Op op) const { @@ -142,15 +142,15 @@ class MemPass : public Pass { bool HasOnlySupportedRefs(uint32_t varId); // Remove all the unreachable basic blocks in |func|. - bool RemoveUnreachableBlocks(Function* func); + Status RemoveUnreachableBlocks(Function* func); // Remove the block pointed by the iterator |*bi|. This also removes // all the instructions in the pointed-to block. void RemoveBlock(Function::iterator* bi); // Remove Phi operands in |phi| that are coming from blocks not in - // |reachable_blocks|. - void RemovePhiOperands( + // |reachable_blocks|. Returns false if it fails. + bool RemovePhiOperands( Instruction* phi, const std::unordered_set& reachable_blocks); diff --git a/third_party/spirv-tools/source/opt/merge_return_pass.cpp b/third_party/spirv-tools/source/opt/merge_return_pass.cpp index 41734945e6..47b0763136 100644 --- a/third_party/spirv-tools/source/opt/merge_return_pass.cpp +++ b/third_party/spirv-tools/source/opt/merge_return_pass.cpp @@ -58,7 +58,9 @@ Pass::Status MergeReturnPass::Process() { failed = true; } } else { - MergeReturnBlocks(function, return_blocks); + if (!MergeReturnBlocks(function, return_blocks)) { + failed = true; + } } return true; }; @@ -132,7 +134,9 @@ bool MergeReturnPass::ProcessStructured( state_.pop_back(); } - ProcessStructuredBlock(block); + if (!ProcessStructuredBlock(block)) { + return false; + } // Generate state for next block if warranted GenerateState(block); @@ -167,14 +171,20 @@ bool MergeReturnPass::ProcessStructured( // We have not kept the dominator tree up-to-date. // Invalidate it at this point to make sure it will be rebuilt. context()->RemoveDominatorAnalysis(function); - AddNewPhiNodes(); + if (!AddNewPhiNodes()) { + return false; + } return true; } -void MergeReturnPass::CreateReturnBlock() { +bool MergeReturnPass::CreateReturnBlock() { // Create a label for the new return block + uint32_t label_id = TakeNextId(); + if (label_id == 0) { + return false; + } std::unique_ptr return_label( - new Instruction(context(), spv::Op::OpLabel, 0u, TakeNextId(), {})); + new Instruction(context(), spv::Op::OpLabel, 0u, label_id, {})); // Create the new basic block std::unique_ptr return_block( @@ -186,14 +196,20 @@ void MergeReturnPass::CreateReturnBlock() { final_return_block_); assert(final_return_block_->GetParent() == function_ && "The function should have been set when the block was created."); + return true; } -void MergeReturnPass::CreateReturn(BasicBlock* block) { - AddReturnValue(); +bool MergeReturnPass::CreateReturn(BasicBlock* block) { + if (!AddReturnValue()) { + return false; + } if (return_value_) { // Load and return the final return value uint32_t loadId = TakeNextId(); + if (loadId == 0) { + return false; + } block->AddInstruction(MakeUnique( context(), spv::Op::OpLoad, function_->type_id(), loadId, std::initializer_list{ @@ -216,14 +232,21 @@ void MergeReturnPass::CreateReturn(BasicBlock* block) { context()->AnalyzeDefUse(block->terminator()); context()->set_instr_block(block->terminator(), block); } + return true; } -void MergeReturnPass::ProcessStructuredBlock(BasicBlock* block) { +bool MergeReturnPass::ProcessStructuredBlock(BasicBlock* block) { + if (block->tail() == block->end()) { + return true; + } + spv::Op tail_opcode = block->tail()->opcode(); if (tail_opcode == spv::Op::OpReturn || tail_opcode == spv::Op::OpReturnValue) { if (!return_flag_) { - AddReturnFlag(); + if (!AddReturnFlag()) { + return false; + } } } @@ -232,15 +255,20 @@ void MergeReturnPass::ProcessStructuredBlock(BasicBlock* block) { tail_opcode == spv::Op::OpUnreachable) { assert(CurrentState().InBreakable() && "Should be in the placeholder construct."); - BranchToBlock(block, CurrentState().BreakMergeId()); + if (!BranchToBlock(block, CurrentState().BreakMergeId())) { + return false; + } return_blocks_.insert(block->id()); } + return true; } -void MergeReturnPass::BranchToBlock(BasicBlock* block, uint32_t target) { +bool MergeReturnPass::BranchToBlock(BasicBlock* block, uint32_t target) { if (block->tail()->opcode() == spv::Op::OpReturn || block->tail()->opcode() == spv::Op::OpReturnValue) { - RecordReturned(block); + if (!RecordReturned(block)) { + return false; + } RecordReturnValue(block); } @@ -248,7 +276,9 @@ void MergeReturnPass::BranchToBlock(BasicBlock* block, uint32_t target) { if (target_block->GetLoopMergeInst()) { cfg()->SplitLoopHeader(target_block); } - UpdatePhiNodes(block, target_block); + if (!UpdatePhiNodes(block, target_block)) { + return false; + } Instruction* return_inst = block->terminator(); return_inst->SetOpcode(spv::Op::OpBranch); @@ -256,19 +286,26 @@ void MergeReturnPass::BranchToBlock(BasicBlock* block, uint32_t target) { context()->get_def_use_mgr()->AnalyzeInstDefUse(return_inst); new_edges_[target_block].insert(block->id()); cfg()->AddEdge(block->id(), target); + return true; } -void MergeReturnPass::UpdatePhiNodes(BasicBlock* new_source, +bool MergeReturnPass::UpdatePhiNodes(BasicBlock* new_source, BasicBlock* target) { - target->ForEachPhiInst([this, new_source](Instruction* inst) { + bool succeeded = true; + target->ForEachPhiInst([this, new_source, &succeeded](Instruction* inst) { uint32_t undefId = Type2Undef(inst->type_id()); + if (undefId == 0) { + succeeded = false; + return; + } inst->AddOperand({SPV_OPERAND_TYPE_ID, {undefId}}); inst->AddOperand({SPV_OPERAND_TYPE_ID, {new_source->id()}}); context()->UpdateDefUse(inst); }); + return succeeded; } -void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, +bool MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, Instruction& inst) { DominatorAnalysis* dom_tree = context()->GetDominatorAnalysis(merge_block->GetParent()); @@ -302,7 +339,7 @@ void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, }); if (users_to_update.empty()) { - return; + return true; } // There is at least one values that needs to be replaced. @@ -346,6 +383,9 @@ void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, if (regenerateInstruction) { std::unique_ptr regen_inst(inst.Clone(context())); uint32_t new_id = TakeNextId(); + if (new_id == 0) { + return false; + } regen_inst->SetResultId(new_id); Instruction* insert_pos = &*merge_block->begin(); while (insert_pos->opcode() == spv::Op::OpPhi) { @@ -355,18 +395,31 @@ void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, get_def_use_mgr()->AnalyzeInstDefUse(new_phi); context()->set_instr_block(new_phi, merge_block); - new_phi->ForEachInId([dom_tree, merge_block, this](uint32_t* use_id) { + bool succeeded = true; + new_phi->ForEachInId([dom_tree, merge_block, this, + &succeeded](uint32_t* use_id) { + if (!succeeded) { + return; + } Instruction* use = get_def_use_mgr()->GetDef(*use_id); BasicBlock* use_bb = context()->get_instr_block(use); if (use_bb != nullptr && !dom_tree->Dominates(use_bb, merge_block)) { - CreatePhiNodesForInst(merge_block, *use); + if (!CreatePhiNodesForInst(merge_block, *use)) { + succeeded = false; + } } }); + if (!succeeded) { + return false; + } } else { InstructionBuilder builder( context(), &*merge_block->begin(), IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); new_phi = builder.AddPhi(inst.type_id(), phi_operands); + if (new_phi == nullptr) { + return false; + } } uint32_t result_of_phi = new_phi->result_id(); @@ -380,6 +433,7 @@ void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, context()->AnalyzeUses(user); } } + return true; } bool MergeReturnPass::PredicateBlocks( @@ -472,6 +526,9 @@ bool MergeReturnPass::BreakFromConstruct( cfg()->RemoveSuccessorEdges(block); auto old_body_id = TakeNextId(); + if (old_body_id == 0) { + return false; + } BasicBlock* old_body = block->SplitBasicBlock(context(), old_body_id, iter); predicated->insert(old_body); @@ -508,8 +565,11 @@ bool MergeReturnPass::BreakFromConstruct( analysis::Bool bool_type; uint32_t bool_id = context()->get_type_mgr()->GetId(&bool_type); assert(bool_id != 0); - uint32_t load_id = - builder.AddLoad(bool_id, return_flag_->result_id())->result_id(); + Instruction* load_inst = builder.AddLoad(bool_id, return_flag_->result_id()); + if (load_inst == nullptr) { + return false; + } + uint32_t load_id = load_inst->result_id(); // 2. Branch to |merge_block| (true) or |old_body| (false) builder.AddConditionalBranch(load_id, merge_block->id(), old_body->id(), @@ -522,7 +582,9 @@ bool MergeReturnPass::BreakFromConstruct( } // 3. Update OpPhi instructions in |merge_block|. - UpdatePhiNodes(block, merge_block); + if (!UpdatePhiNodes(block, merge_block)) { + return false; + } // 4. Update the CFG. We do this after updating the OpPhi instructions // because |UpdatePhiNodes| assumes the edge from |block| has not been added @@ -535,10 +597,10 @@ bool MergeReturnPass::BreakFromConstruct( return true; } -void MergeReturnPass::RecordReturned(BasicBlock* block) { +bool MergeReturnPass::RecordReturned(BasicBlock* block) { if (block->tail()->opcode() != spv::Op::OpReturn && block->tail()->opcode() != spv::Op::OpReturnValue) - return; + return true; assert(return_flag_ && "Did not generate the return flag variable."); @@ -551,6 +613,9 @@ void MergeReturnPass::RecordReturned(BasicBlock* block) { const analysis::Constant* true_const = const_mgr->GetConstant(bool_type, {true}); constant_true_ = const_mgr->GetDefiningInstruction(true_const); + if (!constant_true_) { + return false; + } context()->UpdateDefUse(constant_true_); } @@ -564,6 +629,7 @@ void MergeReturnPass::RecordReturned(BasicBlock* block) { &*block->tail().InsertBefore(std::move(return_store)); context()->set_instr_block(store_inst, block); context()->AnalyzeDefUse(store_inst); + return true; } void MergeReturnPass::RecordReturnValue(BasicBlock* block) { @@ -587,18 +653,21 @@ void MergeReturnPass::RecordReturnValue(BasicBlock* block) { context()->AnalyzeDefUse(store_inst); } -void MergeReturnPass::AddReturnValue() { - if (return_value_) return; +bool MergeReturnPass::AddReturnValue() { + if (return_value_) return true; uint32_t return_type_id = function_->type_id(); if (get_def_use_mgr()->GetDef(return_type_id)->opcode() == spv::Op::OpTypeVoid) - return; + return true; uint32_t return_ptr_type = context()->get_type_mgr()->FindPointerToType( return_type_id, spv::StorageClass::Function); uint32_t var_id = TakeNextId(); + if (var_id == 0) { + return false; + } std::unique_ptr returnValue( new Instruction(context(), spv::Op::OpVariable, return_ptr_type, var_id, std::initializer_list{ @@ -614,27 +683,44 @@ void MergeReturnPass::AddReturnValue() { context()->get_decoration_mgr()->CloneDecorations( function_->result_id(), var_id, {spv::Decoration::RelaxedPrecision}); + return true; } -void MergeReturnPass::AddReturnFlag() { - if (return_flag_) return; +bool MergeReturnPass::AddReturnFlag() { + if (return_flag_) return true; analysis::TypeManager* type_mgr = context()->get_type_mgr(); analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); analysis::Bool temp; uint32_t bool_id = type_mgr->GetTypeInstruction(&temp); + if (bool_id == 0) { + return false; + } analysis::Bool* bool_type = type_mgr->GetType(bool_id)->AsBool(); const analysis::Constant* false_const = const_mgr->GetConstant(bool_type, {false}); - uint32_t const_false_id = - const_mgr->GetDefiningInstruction(false_const)->result_id(); + Instruction* false_inst = const_mgr->GetDefiningInstruction(false_const); + if (false_inst == nullptr) { + return false; + } + uint32_t const_false_id = false_inst->result_id(); uint32_t bool_ptr_id = type_mgr->FindPointerToType(bool_id, spv::StorageClass::Function); + if (bool_ptr_id == 0) { + return false; + ; + } + uint32_t var_id = TakeNextId(); + + if (var_id == 0) { + return false; + } + std::unique_ptr returnFlag(new Instruction( context(), spv::Op::OpVariable, bool_ptr_id, var_id, std::initializer_list{{SPV_OPERAND_TYPE_STORAGE_CLASS, @@ -648,6 +734,7 @@ void MergeReturnPass::AddReturnFlag() { return_flag_ = &*entry_block->begin(); context()->AnalyzeDefUse(return_flag_); context()->set_instr_block(return_flag_, entry_block); + return true; } std::vector MergeReturnPass::CollectReturnBlocks( @@ -663,14 +750,16 @@ std::vector MergeReturnPass::CollectReturnBlocks( return return_blocks; } -void MergeReturnPass::MergeReturnBlocks( +bool MergeReturnPass::MergeReturnBlocks( Function* function, const std::vector& return_blocks) { if (return_blocks.size() <= 1) { // No work to do. - return; + return true; } - CreateReturnBlock(); + if (!CreateReturnBlock()) { + return false; + } uint32_t return_id = final_return_block_->id(); auto ret_block_iter = --function->end(); // Create the PHI for the merged block (if necessary). @@ -687,6 +776,9 @@ void MergeReturnPass::MergeReturnBlocks( if (!phi_ops.empty()) { // Need a PHI node to select the correct return value. uint32_t phi_result_id = TakeNextId(); + if (phi_result_id == 0) { + return false; + } uint32_t phi_type_id = function->type_id(); std::unique_ptr phi_inst(new Instruction( context(), spv::Op::OpPhi, phi_type_id, phi_result_id, phi_ops)); @@ -718,18 +810,22 @@ void MergeReturnPass::MergeReturnBlocks( } get_def_use_mgr()->AnalyzeInstDefUse(ret_block_iter->GetLabelInst()); + return true; } -void MergeReturnPass::AddNewPhiNodes() { +bool MergeReturnPass::AddNewPhiNodes() { std::list order; cfg()->ComputeStructuredOrder(function_, &*function_->begin(), &order); for (BasicBlock* bb : order) { - AddNewPhiNodes(bb); + if (!AddNewPhiNodes(bb)) { + return false; + } } + return true; } -void MergeReturnPass::AddNewPhiNodes(BasicBlock* bb) { +bool MergeReturnPass::AddNewPhiNodes(BasicBlock* bb) { // New phi nodes are needed for any id whose definition used to dominate |bb|, // but no longer dominates |bb|. These are found by walking the dominator // tree starting at the original immediate dominator of |bb| and ending at its @@ -747,16 +843,19 @@ void MergeReturnPass::AddNewPhiNodes(BasicBlock* bb) { BasicBlock* dominator = dom_tree->ImmediateDominator(bb); if (dominator == nullptr) { - return; + return true; } BasicBlock* current_bb = context()->get_instr_block(original_dominator_[bb]); while (current_bb != nullptr && current_bb != dominator) { for (Instruction& inst : *current_bb) { - CreatePhiNodesForInst(bb, inst); + if (!CreatePhiNodesForInst(bb, inst)) { + return false; + } } current_bb = dom_tree->ImmediateDominator(current_bb); } + return true; } void MergeReturnPass::RecordImmediateDominators(Function* function) { @@ -781,8 +880,12 @@ void MergeReturnPass::InsertAfterElement(BasicBlock* element, } bool MergeReturnPass::AddSingleCaseSwitchAroundFunction() { - CreateReturnBlock(); - CreateReturn(final_return_block_); + if (!CreateReturnBlock()) { + return false; + } + if (!CreateReturn(final_return_block_)) { + return false; + } if (context()->AreAnalysesValid(IRContext::kAnalysisCFG)) { cfg()->RegisterBlock(final_return_block_); @@ -836,8 +939,12 @@ bool MergeReturnPass::CreateSingleCaseSwitch(BasicBlock* merge_target) { ++split_pos; } + uint32_t new_block_id = TakeNextId(); + if (new_block_id == 0) { + return false; + } BasicBlock* old_block = - start_block->SplitBasicBlock(context(), TakeNextId(), split_pos); + start_block->SplitBasicBlock(context(), new_block_id, split_pos); // Find DebugFunctionDefinition inst in the old block, and if we can find it, // move it to the entry block. Since DebugFunctionDefinition is not necessary diff --git a/third_party/spirv-tools/source/opt/merge_return_pass.h b/third_party/spirv-tools/source/opt/merge_return_pass.h index d15db2f671..d83ffc3595 100644 --- a/third_party/spirv-tools/source/opt/merge_return_pass.h +++ b/third_party/spirv-tools/source/opt/merge_return_pass.h @@ -149,8 +149,9 @@ class MergeReturnPass : public MemPass { // Creates a new basic block with a single return. If |function| returns a // value, a phi node is created to select the correct value to return. - // Replaces old returns with an unconditional branch to the new block. - void MergeReturnBlocks(Function* function, + // Replaces old returns with an unconditional branch to the new block. Returns + // true if successful. + bool MergeReturnBlocks(Function* function, const std::vector& returnBlocks); // Generate and push new control flow state if |block| contains a merge. @@ -172,21 +173,22 @@ class MergeReturnPass : public MemPass { // // Note this will break the semantics. To fix this, PredicateBlock will have // to be called on the merge block the branch targets. - void ProcessStructuredBlock(BasicBlock* block); + bool ProcessStructuredBlock(BasicBlock* block); // Creates a variable used to store whether or not the control flow has // traversed a block that used to have a return. A pointer to the instruction - // declaring the variable is stored in |return_flag_|. - void AddReturnFlag(); + // declaring the variable is stored in |return_flag_|. Returns true if it + // succeeds. + bool AddReturnFlag(); // Creates the variable used to store the return value when passing through - // a block that use to contain an OpReturnValue. - void AddReturnValue(); + // a block that use to contain an OpReturnValue. Returns true if it succeeds. + bool AddReturnValue(); - // Adds a store that stores true to |return_flag_| immediately before the - // terminator of |block|. It is assumed that |AddReturnFlag| has already been - // called. - void RecordReturned(BasicBlock* block); + // Records that |block| used to be a return. This is done by adding an + // instruction to store true to the |return_flag_|. Returns true if it + // succeeds. + bool RecordReturned(BasicBlock* block); // Adds an instruction that stores the value being returned in the // OpReturnValue in |block|. The value is stored to |return_value_|, and the @@ -197,10 +199,10 @@ class MergeReturnPass : public MemPass { // have already been called to create the variable to store to. void RecordReturnValue(BasicBlock* block); - // Adds an unconditional branch in |block| that branches to |target|. It also - // adds stores to |return_flag_| and |return_value_| as needed. - // |AddReturnFlag| and |AddReturnValue| must have already been called. - void BranchToBlock(BasicBlock* block, uint32_t target); + // Replaces the terminator of |block| with a branch to |target|. If the + // terminator was a return, it will first call RecordReturned and + // RecordReturnValue. Returns true if it succeeds. + bool BranchToBlock(BasicBlock* block, uint32_t target); // For every basic block that is reachable from |return_block|, extra code is // added to jump around any code that should not be executed because the @@ -231,38 +233,35 @@ class MergeReturnPass : public MemPass { // Add an |OpReturn| or |OpReturnValue| to the end of |block|. If an // |OpReturnValue| is needed, the return value is loaded from |return_value_|. - void CreateReturn(BasicBlock* block); + // Returns true if successful. + bool CreateReturn(BasicBlock* block); // Creates a block at the end of the function that will become the single // return block at the end of the pass. - void CreateReturnBlock(); + bool CreateReturnBlock(); - // Creates a Phi node in |merge_block| for the result of |inst|. - // Any uses of the result of |inst| that are no longer - // dominated by |inst|, are replaced with the result of the new |OpPhi| - // instruction. - void CreatePhiNodesForInst(BasicBlock* merge_block, Instruction& inst); + // For each use of |inst| that is no longer dominated by |inst|, a phi node + // is created in |merge_block|. The original use is replaced by the result + // of the phi node. Returns true if it succeeds. + bool CreatePhiNodesForInst(BasicBlock* merge_block, Instruction& inst); - // Add new phi nodes for any id that no longer dominate all of it uses. A phi - // node is added to a block |bb| for an id if the id is defined between the - // original immediate dominator of |bb| and its new immediate dominator. It - // is assumed that at this point there are no unreachable blocks in the - // control flow graph. - void AddNewPhiNodes(); + // Adds new phi nodes as needed to the function. This is necessary because + // adding the predication code can change the dominator tree. Returns false + // if there is a failure. + bool AddNewPhiNodes(); - // Creates any new phi nodes that are needed in |bb|. |AddNewPhiNodes| must - // have already been called on the original dominators of |bb|. - void AddNewPhiNodes(BasicBlock* bb); + // Adds new phi nodes to |bb| as needed. This is necessary because adding + // the predication code can change the dominator tree. Returns false if + // there is a failure. + bool AddNewPhiNodes(BasicBlock* bb); // Records the terminator of immediate dominator for every basic block in // |function|. void RecordImmediateDominators(Function* function); - // Modifies existing OpPhi instruction in |target| block to account for the - // new edge from |new_source|. The value for that edge will be an Undef. - // - // The CFG must not include the edge from |new_source| to |target| yet. - void UpdatePhiNodes(BasicBlock* new_source, BasicBlock* target); + // For each OpPhi instruction in |target|, this function adds an operand for + // |new_source|. The value will be OpUndef. Returns true if it succeeds. + bool UpdatePhiNodes(BasicBlock* new_source, BasicBlock* target); StructuredControlState& CurrentState() { return state_.back(); } diff --git a/third_party/spirv-tools/source/opt/module.cpp b/third_party/spirv-tools/source/opt/module.cpp index a9710c6a3c..ba0bcceeae 100644 --- a/third_party/spirv-tools/source/opt/module.cpp +++ b/third_party/spirv-tools/source/opt/module.cpp @@ -93,6 +93,7 @@ void Module::ForEachInst(const std::function& f, if (sampled_image_address_mode_) sampled_image_address_mode_->ForEachInst(f, run_on_debug_line_insts); DELEGATE(entry_points_); + DELEGATE(graph_entry_points_); DELEGATE(execution_modes_); DELEGATE(debugs1_); DELEGATE(debugs2_); @@ -104,6 +105,10 @@ void Module::ForEachInst(const std::function& f, i->ForEachInst(f, run_on_debug_line_insts, /* run_on_non_semantic_insts = */ true); } + for (auto& g : graphs_) { + g->ForEachInst(f, run_on_debug_line_insts, + /* run_on_non_semantic_insts = */ true); + } #undef DELEGATE } @@ -132,6 +137,12 @@ void Module::ForEachInst(const std::function& f, f, run_on_debug_line_insts, /* run_on_non_semantic_insts = */ true); } + for (auto& i : graph_entry_points_) DELEGATE(i); + for (auto& i : graphs_) { + static_cast(i.get())->ForEachInst( + f, run_on_debug_line_insts, + /* run_on_non_semantic_insts = */ true); + } if (run_on_debug_line_insts) { for (auto& i : trailing_dbg_line_info_) DELEGATE(i); } diff --git a/third_party/spirv-tools/source/opt/module.h b/third_party/spirv-tools/source/opt/module.h index 98c16dc4c9..1bb1c3cb69 100644 --- a/third_party/spirv-tools/source/opt/module.h +++ b/third_party/spirv-tools/source/opt/module.h @@ -23,6 +23,7 @@ #include #include "source/opt/function.h" +#include "source/opt/graph.h" #include "source/opt/instruction.h" #include "source/opt/iterator.h" @@ -48,6 +49,8 @@ class Module { using const_iterator = UptrVectorIterator; using inst_iterator = InstructionList::iterator; using const_inst_iterator = InstructionList::const_iterator; + using graph_iterator = UptrVectorIterator; + using const_graph_iterator = UptrVectorIterator; // Creates an empty module with zero'd header. Module() : header_({}), contains_debug_info_(false) {} @@ -90,6 +93,9 @@ class Module { // Appends an entry point instruction to this module. inline void AddEntryPoint(std::unique_ptr e); + // Appends a graph entry point instruction to this module. + inline void AddGraphEntryPoint(std::unique_ptr e); + // Appends an execution mode instruction to this module. inline void AddExecutionMode(std::unique_ptr e); @@ -126,6 +132,9 @@ class Module { // Appends a function to this module. inline void AddFunction(std::unique_ptr f); + // Appends a graph to this module. + inline void AddGraph(std::unique_ptr g); + // Sets |contains_debug_info_| as true. inline void SetContainsDebugInfo(); inline bool ContainsDebugInfo() { return contains_debug_info_; } @@ -220,6 +229,10 @@ class Module { inline IteratorRange entry_points(); inline IteratorRange entry_points() const; + // Iterators for graph entry point instructions contained in this module + inline IteratorRange graph_entry_points(); + inline IteratorRange graph_entry_points() const; + // Iterators for execution_modes instructions contained in this module. inline inst_iterator execution_mode_begin(); inline inst_iterator execution_mode_end(); @@ -252,6 +265,9 @@ class Module { inline const_iterator cbegin() const; inline const_iterator cend() const; + // Iterators for graphs contained in this module. + inline const std::vector>& graphs() const; + // Invokes function |f| on all instructions in this module, and optionally on // the debug line instructions that precede them. void ForEachInst(const std::function& f, @@ -306,6 +322,7 @@ class Module { // A module can only have one optional sampled image addressing mode std::unique_ptr sampled_image_address_mode_; InstructionList entry_points_; + InstructionList graph_entry_points_; InstructionList execution_modes_; InstructionList debugs1_; InstructionList debugs2_; @@ -315,6 +332,7 @@ class Module { // Type declarations, constants, and global variable declarations. InstructionList types_values_; std::vector> functions_; + std::vector> graphs_; // If the module ends with Op*Line instruction, they will not be attached to // any instruction. We record them here, so they will not be lost. @@ -351,6 +369,10 @@ inline void Module::AddEntryPoint(std::unique_ptr e) { entry_points_.push_back(std::move(e)); } +inline void Module::AddGraphEntryPoint(std::unique_ptr e) { + graph_entry_points_.push_back(std::move(e)); +} + inline void Module::AddExecutionMode(std::unique_ptr e) { execution_modes_.push_back(std::move(e)); } @@ -392,6 +414,10 @@ inline void Module::AddFunction(std::unique_ptr f) { functions_.emplace_back(std::move(f)); } +inline void Module::AddGraph(std::unique_ptr g) { + graphs_.emplace_back(std::move(g)); +} + inline void Module::SetContainsDebugInfo() { contains_debug_info_ = true; } inline Module::inst_iterator Module::capability_begin() { @@ -482,6 +508,15 @@ inline IteratorRange Module::entry_points() const { return make_range(entry_points_.begin(), entry_points_.end()); } +inline IteratorRange Module::graph_entry_points() { + return make_range(graph_entry_points_.begin(), graph_entry_points_.end()); +} + +inline IteratorRange Module::graph_entry_points() + const { + return make_range(graph_entry_points_.begin(), graph_entry_points_.end()); +} + inline Module::inst_iterator Module::execution_mode_begin() { return execution_modes_.begin(); } @@ -544,6 +579,10 @@ inline IteratorRange Module::types_values() const { return make_range(types_values_.begin(), types_values_.end()); } +inline const std::vector>& Module::graphs() const { + return graphs_; +} + inline Module::const_iterator Module::cbegin() const { return const_iterator(&functions_, functions_.cbegin()); } diff --git a/third_party/spirv-tools/source/opt/pass.cpp b/third_party/spirv-tools/source/opt/pass.cpp index 0f260e2efe..ce37f3628b 100644 --- a/third_party/spirv-tools/source/opt/pass.cpp +++ b/third_party/spirv-tools/source/opt/pass.cpp @@ -114,8 +114,12 @@ uint32_t Pass::GenerateCopy(Instruction* object_to_copy, uint32_t new_type_id, assert(length_const->AsIntConstant()); uint32_t array_length = length_const->AsIntConstant()->GetU32(); for (uint32_t i = 0; i < array_length; i++) { + // TODO(1841): Handle id overflow. Instruction* extract = ir_builder.AddCompositeExtract( original_element_type_id, object_to_copy->result_id(), {i}); + if (extract == nullptr) { + return 0; + } uint32_t new_id = GenerateCopy(extract, new_element_type_id, insertion_position); if (new_id == 0) { @@ -124,16 +128,24 @@ uint32_t Pass::GenerateCopy(Instruction* object_to_copy, uint32_t new_type_id, element_ids.push_back(new_id); } - return ir_builder.AddCompositeConstruct(new_type_id, element_ids) - ->result_id(); + Instruction* construct = + ir_builder.AddCompositeConstruct(new_type_id, element_ids); + if (construct == nullptr) { + return 0; + } + return construct->result_id(); } case spv::Op::OpTypeStruct: { std::vector element_ids; for (uint32_t i = 0; i < original_type->NumInOperands(); i++) { uint32_t orig_member_type_id = original_type->GetSingleWordInOperand(i); uint32_t new_member_type_id = new_type->GetSingleWordInOperand(i); + // TODO(1841): Handle id overflow. Instruction* extract = ir_builder.AddCompositeExtract( orig_member_type_id, object_to_copy->result_id(), {i}); + if (extract == nullptr) { + return 0; + } uint32_t new_id = GenerateCopy(extract, new_member_type_id, insertion_position); if (new_id == 0) { @@ -141,8 +153,12 @@ uint32_t Pass::GenerateCopy(Instruction* object_to_copy, uint32_t new_type_id, } element_ids.push_back(new_id); } - return ir_builder.AddCompositeConstruct(new_type_id, element_ids) - ->result_id(); + Instruction* construct = + ir_builder.AddCompositeConstruct(new_type_id, element_ids); + if (construct == nullptr) { + return 0; + } + return construct->result_id(); } default: // If we do not have an aggregate type, then we have a problem. Either we diff --git a/third_party/spirv-tools/source/opt/pass.h b/third_party/spirv-tools/source/opt/pass.h index 3e6c4d0763..73773e3f2a 100644 --- a/third_party/spirv-tools/source/opt/pass.h +++ b/third_party/spirv-tools/source/opt/pass.h @@ -25,6 +25,7 @@ #include "source/opt/def_use_manager.h" #include "source/opt/ir_context.h" #include "source/opt/module.h" +#include "source/util/status.h" #include "spirv-tools/libspirv.hpp" #include "types.h" @@ -46,11 +47,7 @@ class Pass { // // The numbers for the cases are assigned to make sure that Failure & anything // is Failure, SuccessWithChange & any success is SuccessWithChange. - enum class Status { - Failure = 0x00, - SuccessWithChange = 0x10, - SuccessWithoutChange = 0x11, - }; + using Status = utils::Status; using ProcessFunction = std::function; diff --git a/third_party/spirv-tools/source/opt/propagator.cpp b/third_party/spirv-tools/source/opt/propagator.cpp index 9cd6174cf6..67f9132acc 100644 --- a/third_party/spirv-tools/source/opt/propagator.cpp +++ b/third_party/spirv-tools/source/opt/propagator.cpp @@ -84,16 +84,19 @@ bool SSAPropagator::SetStatus(Instruction* inst, PropStatus status) { return status_changed; } -bool SSAPropagator::Simulate(Instruction* instr) { +Pass::Status SSAPropagator::Simulate(Instruction* instr) { bool changed = false; // Don't bother visiting instructions that should not be simulated again. if (!ShouldSimulateAgain(instr)) { - return changed; + return Pass::Status::SuccessWithoutChange; } BasicBlock* dest_bb = nullptr; PropStatus status = visit_fn_(instr, &dest_bb); + if (status == SSAPropagator::kFailed) { + return Pass::Status::Failure; + } bool status_changed = SetStatus(instr, status); if (status == kVarying) { @@ -112,7 +115,7 @@ bool SSAPropagator::Simulate(Instruction* instr) { AddControlEdge(e); } } - return false; + return Pass::Status::SuccessWithoutChange; } else if (status == kInteresting) { // Add the SSA edges coming out of this instruction if the propagation // status has changed. @@ -169,12 +172,13 @@ bool SSAPropagator::Simulate(Instruction* instr) { DontSimulateAgain(instr); } - return changed; + return changed ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; } -bool SSAPropagator::Simulate(BasicBlock* block) { +Pass::Status SSAPropagator::Simulate(BasicBlock* block) { if (block == ctx_->cfg()->pseudo_exit_block()) { - return false; + return Pass::Status::SuccessWithoutChange; } // Always simulate Phi instructions, even if we have simulated this block @@ -182,17 +186,29 @@ bool SSAPropagator::Simulate(BasicBlock* block) { // incoming edges. When those edges are marked executable, the corresponding // operand can be simulated. bool changed = false; - block->ForEachPhiInst( - [&changed, this](Instruction* instr) { changed |= Simulate(instr); }); + bool succeeded = + block->WhileEachPhiInst([&changed, this](Instruction* instr) { + auto Status = Simulate(instr); + if (Status == Pass::Status::Failure) return false; + changed |= Status == Pass::Status::SuccessWithChange; + return true; + }); + if (!succeeded) { + return Pass::Status::Failure; + } // If this is the first time this block is being simulated, simulate every // statement in it. if (!BlockHasBeenSimulated(block)) { - block->ForEachInst([this, &changed](Instruction* instr) { - if (instr->opcode() != spv::Op::OpPhi) { - changed |= Simulate(instr); - } + succeeded = block->WhileEachInst([&changed, this](Instruction* instr) { + auto Status = Simulate(instr); + if (Status == Pass::Status::Failure) return false; + changed |= Status == Pass::Status::SuccessWithChange; + return true; }); + if (!succeeded) { + return Pass::Status::Failure; + } MarkBlockSimulated(block); @@ -203,7 +219,8 @@ bool SSAPropagator::Simulate(BasicBlock* block) { } } - return changed; + return changed ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; } void SSAPropagator::Initialize(Function* fn) { @@ -245,7 +262,11 @@ bool SSAPropagator::Run(Function* fn) { // follow after all the blocks have been simulated. if (!blocks_.empty()) { auto block = blocks_.front(); - changed |= Simulate(block); + Pass::Status status = Simulate(block); + if (status == Pass::Status::Failure) { + return false; + } + changed |= status == Pass::Status::SuccessWithChange; blocks_.pop(); continue; } @@ -253,7 +274,11 @@ bool SSAPropagator::Run(Function* fn) { // Simulate edges from the SSA queue. if (!ssa_edge_uses_.empty()) { Instruction* instr = ssa_edge_uses_.front(); - changed |= Simulate(instr); + Pass::Status status = Simulate(instr); + if (status == Pass::Status::Failure) { + return changed; + } + changed |= status == Pass::Status::SuccessWithChange; ssa_edge_uses_.pop(); } } diff --git a/third_party/spirv-tools/source/opt/propagator.h b/third_party/spirv-tools/source/opt/propagator.h index 71212c9692..2727f2436c 100644 --- a/third_party/spirv-tools/source/opt/propagator.h +++ b/third_party/spirv-tools/source/opt/propagator.h @@ -25,6 +25,7 @@ #include "source/opt/ir_context.h" #include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -182,7 +183,7 @@ class SSAPropagator { public: // Lattice values used for propagation. See class documentation for // a description. - enum PropStatus { kNotInteresting, kInteresting, kVarying }; + enum PropStatus { kNotInteresting, kInteresting, kVarying, kFailed }; using VisitFunction = std::function; @@ -190,7 +191,9 @@ class SSAPropagator { : ctx_(context), visit_fn_(visit_fn) {} // Runs the propagator on function |fn|. Returns true if changes were made to - // the function. Otherwise, it returns false. + // the function. Otherwise, it returns false. The user should check + // IRContext::id_overflow() to see if there was an error caused by reaching + // the max id. bool Run(Function* fn); // Returns true if the |i|th argument for |phi| comes through a CFG edge that @@ -218,13 +221,13 @@ class SSAPropagator { // Simulate the execution |block| by calling |visit_fn_| on every instruction // in it. - bool Simulate(BasicBlock* block); + Pass::Status Simulate(BasicBlock* block); // Simulate the execution of |instr| by replacing all the known values in // every operand and determining whether the result is interesting for // propagation. This invokes the callback function |visit_fn_| to determine // the value computed by |instr|. - bool Simulate(Instruction* instr); + Pass::Status Simulate(Instruction* instr); // Returns true if |instr| should be simulated again. bool ShouldSimulateAgain(Instruction* instr) const { diff --git a/third_party/spirv-tools/source/opt/reduce_load_size.cpp b/third_party/spirv-tools/source/opt/reduce_load_size.cpp index 73a90f066b..3162d793df 100644 --- a/third_party/spirv-tools/source/opt/reduce_load_size.cpp +++ b/third_party/spirv-tools/source/opt/reduce_load_size.cpp @@ -108,6 +108,7 @@ bool ReduceLoadSize::ReplaceExtract(Instruction* inst) { Instruction* new_access_chain = ir_builder.AddAccessChain( pointer_to_result_type_id, composite_inst->GetSingleWordInOperand(kLoadPointerInIdx), ids); + // TODO(1841): Handle id overflow. Instruction* new_load = ir_builder.AddLoad(inst->type_id(), new_access_chain->result_id()); diff --git a/third_party/spirv-tools/source/opt/reflect.h b/third_party/spirv-tools/source/opt/reflect.h index ec7c2dd075..db43d025d4 100644 --- a/third_party/spirv-tools/source/opt/reflect.h +++ b/third_party/spirv-tools/source/opt/reflect.h @@ -44,7 +44,8 @@ inline bool IsAnnotationInst(spv::Op opcode) { opcode <= spv::Op::OpGroupMemberDecorate) || opcode == spv::Op::OpDecorateId || opcode == spv::Op::OpDecorateStringGOOGLE || - opcode == spv::Op::OpMemberDecorateStringGOOGLE; + opcode == spv::Op::OpMemberDecorateStringGOOGLE || + opcode == spv::Op::OpMemberDecorateIdEXT; } inline bool IsTypeInst(spv::Op opcode) { return spvOpcodeGeneratesType(opcode) || diff --git a/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp b/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp index 0df559b345..a388155474 100644 --- a/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp +++ b/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp @@ -29,6 +29,7 @@ namespace opt { Pass::Status RemoveDuplicatesPass::Process() { bool modified = RemoveDuplicateCapabilities(); + modified |= RemoveDuplicateExtensions(); modified |= RemoveDuplicatesExtInstImports(); modified |= RemoveDuplicateTypes(); modified |= RemoveDuplicateDecorations(); @@ -36,6 +37,41 @@ Pass::Status RemoveDuplicatesPass::Process() { return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } +bool RemoveDuplicatesPass::RemoveDuplicateExtensions() const { + bool modified = false; + + if (context()->extensions().empty()) { + return modified; + } + + // set of {condition ID, extension name} + // ID 0 means unconditional extension, ie., OpExtension, otherwise the ID is + // the condition operand of OpConditionalExtensionINTEL. + std::set> extensions; + for (auto* inst = &*context()->extension_begin(); inst;) { + uint32_t cond_id = 0; + uint32_t i_name = 0; + if (inst->opcode() == spv::Op::OpConditionalExtensionINTEL) { + cond_id = inst->GetOperand(0).AsId(); + i_name = 1; + } + + auto res = + extensions.insert({cond_id, inst->GetOperand(i_name).AsString()}); + + if (res.second) { + // Never seen before, keep it. + inst = inst->NextNode(); + } else { + // It's a duplicate, remove it. + inst = context()->KillInst(inst); + modified = true; + } + } + + return modified; +} + bool RemoveDuplicatesPass::RemoveDuplicateCapabilities() const { bool modified = false; @@ -43,16 +79,27 @@ bool RemoveDuplicatesPass::RemoveDuplicateCapabilities() const { return modified; } - std::unordered_set capabilities; - for (auto* i = &*context()->capability_begin(); i;) { - auto res = capabilities.insert(i->GetSingleWordOperand(0u)); + // set of {condition ID, capability} + // ID 0 means unconditional capability, ie., OpCapability, otherwise the ID is + // the condition operand of OpConditionalCapabilityINTEL. + std::set> capabilities; + for (auto* inst = &*context()->capability_begin(); inst;) { + uint32_t cond_id = 0; + uint32_t i_cap = 0; + if (inst->opcode() == spv::Op::OpConditionalCapabilityINTEL) { + cond_id = inst->GetOperand(0).AsId(); + i_cap = 1; + } + + auto res = + capabilities.insert({cond_id, inst->GetSingleWordOperand(i_cap)}); if (res.second) { // Never seen before, keep it. - i = i->NextNode(); + inst = inst->NextNode(); } else { // It's a duplicate, remove it. - i = context()->KillInst(i); + inst = context()->KillInst(inst); modified = true; } } diff --git a/third_party/spirv-tools/source/opt/remove_duplicates_pass.h b/third_party/spirv-tools/source/opt/remove_duplicates_pass.h index 038caa8b9f..e5b3925dd5 100644 --- a/third_party/spirv-tools/source/opt/remove_duplicates_pass.h +++ b/third_party/spirv-tools/source/opt/remove_duplicates_pass.h @@ -37,6 +37,10 @@ class RemoveDuplicatesPass : public Pass { Status Process() override; private: + // Remove duplicate extensions from the module + // + // Returns true if the module was modified, false otherwise. + bool RemoveDuplicateExtensions() const; // Remove duplicate capabilities from the module // // Returns true if the module was modified, false otherwise. diff --git a/third_party/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp b/third_party/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp index c3a4b775a1..e52f0729d0 100644 --- a/third_party/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp +++ b/third_party/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include "remove_unused_interface_variables_pass.h" + #include "source/spirv_constant.h" namespace spvtools { namespace opt { @@ -55,7 +56,9 @@ class RemoveUnusedInterfaceVariablesContext { void CollectUsedVariables() { std::queue roots; - roots.push(entry_.GetSingleWordInOperand(1)); + const int op_i = + entry_.opcode() == spv::Op::OpConditionalEntryPointINTEL ? 2 : 1; + roots.push(entry_.GetSingleWordInOperand(op_i)); parent_.context()->ProcessCallTreeFromRoots(pfn_, &roots); } @@ -73,7 +76,9 @@ class RemoveUnusedInterfaceVariablesContext { } void Modify() { - for (int i = entry_.NumInOperands() - 1; i >= 3; --i) + const int min_num_operands = + entry_.opcode() == spv::Op::OpConditionalEntryPointINTEL ? 4 : 3; + for (int i = entry_.NumInOperands() - 1; i >= min_num_operands; --i) entry_.RemoveInOperand(i); for (auto id : operands_to_add_) { entry_.AddOperand(Operand(SPV_OPERAND_TYPE_ID, {id})); diff --git a/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp b/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp index 59745e12de..619fa93708 100644 --- a/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp +++ b/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp @@ -41,14 +41,15 @@ Pass::Status ReplaceDescArrayAccessUsingVarIndex::Process() { Status status = Status::SuccessWithoutChange; for (Instruction& var : context()->types_values()) { if (descsroautil::IsDescriptorArray(context(), &var)) { - if (ReplaceVariableAccessesWithConstantElements(&var)) - status = Status::SuccessWithChange; + Status s = ReplaceVariableAccessesWithConstantElements(&var); + if (s == Status::Failure) return Status::Failure; + if (s == Status::SuccessWithChange) status = Status::SuccessWithChange; } } return status; } -bool ReplaceDescArrayAccessUsingVarIndex:: +Pass::Status ReplaceDescArrayAccessUsingVarIndex:: ReplaceVariableAccessesWithConstantElements(Instruction* var) const { std::vector work_list; get_def_use_mgr()->ForEachUser(var, [&work_list](Instruction* use) { @@ -66,16 +67,16 @@ bool ReplaceDescArrayAccessUsingVarIndex:: for (Instruction* access_chain : work_list) { if (descsroautil::GetAccessChainIndexAsConst(context(), access_chain) == nullptr) { - ReplaceAccessChain(var, access_chain); + if (!ReplaceAccessChain(var, access_chain)) return Status::Failure; updated = true; } } // Note that we do not consider OpLoad and OpCompositeExtract because // OpCompositeExtract always has constant literals for indices. - return updated; + return updated ? Status::SuccessWithChange : Status::SuccessWithoutChange; } -void ReplaceDescArrayAccessUsingVarIndex::ReplaceAccessChain( +bool ReplaceDescArrayAccessUsingVarIndex::ReplaceAccessChain( Instruction* var, Instruction* access_chain) const { uint32_t number_of_elements = descsroautil::GetNumberOfElementsForArrayOrStruct(context(), var); @@ -83,21 +84,23 @@ void ReplaceDescArrayAccessUsingVarIndex::ReplaceAccessChain( if (number_of_elements == 1) { UseConstIndexForAccessChain(access_chain, 0); get_def_use_mgr()->AnalyzeInstUse(access_chain); - return; + return true; } - ReplaceUsersOfAccessChain(access_chain, number_of_elements); + return ReplaceUsersOfAccessChain(access_chain, number_of_elements); } -void ReplaceDescArrayAccessUsingVarIndex::ReplaceUsersOfAccessChain( +bool ReplaceDescArrayAccessUsingVarIndex::ReplaceUsersOfAccessChain( Instruction* access_chain, uint32_t number_of_elements) const { std::vector final_users; CollectRecursiveUsersWithConcreteType(access_chain, &final_users); for (auto* inst : final_users) { std::deque insts_to_be_cloned = CollectRequiredImageAndAccessInsts(inst); - ReplaceNonUniformAccessWithSwitchCase( - inst, access_chain, number_of_elements, insts_to_be_cloned); + if (!ReplaceNonUniformAccessWithSwitchCase( + inst, access_chain, number_of_elements, insts_to_be_cloned)) + return false; } + return true; } void ReplaceDescArrayAccessUsingVarIndex::CollectRecursiveUsersWithConcreteType( @@ -208,17 +211,23 @@ BasicBlock* ReplaceDescArrayAccessUsingVarIndex::CreateCaseBlock( const std::deque& insts_to_be_cloned, uint32_t branch_target_id, std::unordered_map* old_ids_to_new_ids) const { - auto* case_block = CreateNewBlock(); - AddConstElementAccessToCaseBlock(case_block, access_chain, element_index, - old_ids_to_new_ids); - CloneInstsToBlock(case_block, access_chain, insts_to_be_cloned, - old_ids_to_new_ids); - AddBranchToBlock(case_block, branch_target_id); - UseNewIdsInBlock(case_block, *old_ids_to_new_ids); - return case_block; + std::unique_ptr case_block(CreateNewBlock()); + if (!case_block) return nullptr; + + if (!AddConstElementAccessToCaseBlock(case_block.get(), access_chain, + element_index, old_ids_to_new_ids)) { + return nullptr; + } + if (!CloneInstsToBlock(case_block.get(), access_chain, insts_to_be_cloned, + old_ids_to_new_ids)) { + return nullptr; + } + AddBranchToBlock(case_block.get(), branch_target_id); + UseNewIdsInBlock(case_block.get(), *old_ids_to_new_ids); + return case_block.release(); } -void ReplaceDescArrayAccessUsingVarIndex::CloneInstsToBlock( +bool ReplaceDescArrayAccessUsingVarIndex::CloneInstsToBlock( BasicBlock* block, Instruction* inst_to_skip_cloning, const std::deque& insts_to_be_cloned, std::unordered_map* old_ids_to_new_ids) const { @@ -227,6 +236,7 @@ void ReplaceDescArrayAccessUsingVarIndex::CloneInstsToBlock( std::unique_ptr clone(inst_to_be_cloned->Clone(context())); if (inst_to_be_cloned->HasResultId()) { uint32_t new_id = context()->TakeNextId(); + if (new_id == 0) return false; clone->SetResultId(new_id); (*old_ids_to_new_ids)[inst_to_be_cloned->result_id()] = new_id; } @@ -234,6 +244,7 @@ void ReplaceDescArrayAccessUsingVarIndex::CloneInstsToBlock( context()->set_instr_block(clone.get(), block); block->AddInstruction(std::move(clone)); } + return true; } void ReplaceDescArrayAccessUsingVarIndex::UseNewIdsInBlock( @@ -250,18 +261,19 @@ void ReplaceDescArrayAccessUsingVarIndex::UseNewIdsInBlock( } } -void ReplaceDescArrayAccessUsingVarIndex::ReplaceNonUniformAccessWithSwitchCase( +bool ReplaceDescArrayAccessUsingVarIndex::ReplaceNonUniformAccessWithSwitchCase( Instruction* access_chain_final_user, Instruction* access_chain, uint32_t number_of_elements, const std::deque& insts_to_be_cloned) const { auto* block = context()->get_instr_block(access_chain_final_user); // If the instruction does not belong to a block (i.e. in the case of // OpDecorate), no replacement is needed. - if (!block) return; + if (!block) return true; // Create merge block and add terminator auto* merge_block = SeparateInstructionsIntoNewBlock( block, access_chain_final_user->NextNode()); + if (!merge_block) return false; auto* function = block->GetParent(); @@ -273,6 +285,7 @@ void ReplaceDescArrayAccessUsingVarIndex::ReplaceNonUniformAccessWithSwitchCase( std::unique_ptr case_block(CreateCaseBlock( access_chain, idx, insts_to_be_cloned, merge_block->id(), &old_ids_to_new_ids_for_cloned_insts)); + if (!case_block) return false; case_block_ids.push_back(case_block->id()); function->InsertBasicBlockBefore(std::move(case_block), merge_block); @@ -288,6 +301,7 @@ void ReplaceDescArrayAccessUsingVarIndex::ReplaceNonUniformAccessWithSwitchCase( std::unique_ptr default_block( CreateDefaultBlock(access_chain_final_user->HasResultId(), &phi_operands, merge_block->id())); + if (!default_block) return false; uint32_t default_block_id = default_block->id(); function->InsertBasicBlockBefore(std::move(default_block), merge_block); @@ -301,11 +315,13 @@ void ReplaceDescArrayAccessUsingVarIndex::ReplaceNonUniformAccessWithSwitchCase( if (!phi_operands.empty()) { uint32_t phi_id = CreatePhiInstruction(merge_block, phi_operands, case_block_ids, default_block_id); + if (phi_id == 0) return false; context()->ReplaceAllUsesWith(access_chain_final_user->result_id(), phi_id); } // Replace OpPhi incoming block operand that uses |block| with |merge_block| ReplacePhiIncomingBlock(block->id(), merge_block->id()); + return true; } BasicBlock* @@ -316,13 +332,16 @@ ReplaceDescArrayAccessUsingVarIndex::SeparateInstructionsIntoNewBlock( &*separation_begin != separation_begin_inst) { ++separation_begin; } - return block->SplitBasicBlock(context(), context()->TakeNextId(), - separation_begin); + uint32_t new_id = context()->TakeNextId(); + if (new_id == 0) return nullptr; + return block->SplitBasicBlock(context(), new_id, separation_begin); } BasicBlock* ReplaceDescArrayAccessUsingVarIndex::CreateNewBlock() const { - auto* new_block = new BasicBlock(std::unique_ptr(new Instruction( - context(), spv::Op::OpLabel, 0, context()->TakeNextId(), {}))); + uint32_t new_id = context()->TakeNextId(); + if (new_id == 0) return nullptr; + auto* new_block = new BasicBlock(std::unique_ptr( + new Instruction(context(), spv::Op::OpLabel, 0, new_id, {}))); get_def_use_mgr()->AnalyzeInstDefUse(new_block->GetLabelInst()); context()->set_instr_block(new_block->GetLabelInst(), new_block); return new_block; @@ -336,7 +355,7 @@ void ReplaceDescArrayAccessUsingVarIndex::UseConstIndexForAccessChain( {const_element_idx_id}); } -void ReplaceDescArrayAccessUsingVarIndex::AddConstElementAccessToCaseBlock( +bool ReplaceDescArrayAccessUsingVarIndex::AddConstElementAccessToCaseBlock( BasicBlock* case_block, Instruction* access_chain, uint32_t const_element_idx, std::unordered_map* old_ids_to_new_ids) const { @@ -344,12 +363,14 @@ void ReplaceDescArrayAccessUsingVarIndex::AddConstElementAccessToCaseBlock( UseConstIndexForAccessChain(access_clone.get(), const_element_idx); uint32_t new_access_id = context()->TakeNextId(); + if (new_access_id == 0) return false; (*old_ids_to_new_ids)[access_clone->result_id()] = new_access_id; access_clone->SetResultId(new_access_id); get_def_use_mgr()->AnalyzeInstDefUse(access_clone.get()); context()->set_instr_block(access_clone.get(), case_block); case_block->AddInstruction(std::move(access_clone)); + return true; } void ReplaceDescArrayAccessUsingVarIndex::AddBranchToBlock( @@ -363,6 +384,7 @@ BasicBlock* ReplaceDescArrayAccessUsingVarIndex::CreateDefaultBlock( bool null_const_for_phi_is_needed, std::vector* phi_operands, uint32_t merge_block_id) const { auto* default_block = CreateNewBlock(); + if (!default_block) return nullptr; AddBranchToBlock(default_block, merge_block_id); if (!null_const_for_phi_is_needed) return default_block; @@ -413,7 +435,11 @@ uint32_t ReplaceDescArrayAccessUsingVarIndex::CreatePhiInstruction( kAnalysisDefUseAndInstrToBlockMapping}; uint32_t phi_result_type_id = context()->get_def_use_mgr()->GetDef(phi_operands[0])->type_id(); - auto* phi = builder.AddPhi(phi_result_type_id, incomings); + Instruction* phi = builder.AddPhi(phi_result_type_id, incomings); + if (!phi) { + return 0; + } + context()->get_def_use_mgr()->AnalyzeInstDefUse(phi); return phi->result_id(); } diff --git a/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.h b/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.h index 51817c15f7..b385532d08 100644 --- a/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.h +++ b/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.h @@ -49,14 +49,13 @@ class ReplaceDescArrayAccessUsingVarIndex : public Pass { private: // Replaces all accesses to |var| using variable indices with constant // elements of the array |var|. Creates switch-case statements to determine - // the value of the variable index for all the possible cases. Returns - // whether replacement is done or not. - bool ReplaceVariableAccessesWithConstantElements(Instruction* var) const; + // the value of the variable index for all the possible cases. + Status ReplaceVariableAccessesWithConstantElements(Instruction* var) const; // Replaces the OpAccessChain or OpInBoundsAccessChain instruction |use| that // uses the descriptor variable |var| with the OpAccessChain or // OpInBoundsAccessChain instruction with a constant Indexes operand. - void ReplaceAccessChain(Instruction* var, Instruction* use) const; + bool ReplaceAccessChain(Instruction* var, Instruction* use) const; // Updates the first Indexes operand of the OpAccessChain or // OpInBoundsAccessChain instruction |access_chain| to let it use a constant @@ -68,7 +67,7 @@ class ReplaceDescArrayAccessUsingVarIndex : public Pass { // |access_chain| that accesses an array descriptor variable using variable // indices with constant elements. |number_of_elements| is the number // of array elements. - void ReplaceUsersOfAccessChain(Instruction* access_chain, + bool ReplaceUsersOfAccessChain(Instruction* access_chain, uint32_t number_of_elements) const; // Puts all the recursive users of |access_chain| with concrete result types @@ -102,7 +101,7 @@ class ReplaceDescArrayAccessUsingVarIndex : public Pass { // OpInBoundsAccessChain) will have a constant index for its first index. The // OpSwitch instruction will have the cases for the variable index of // |access_chain| from 0 to |number_of_elements| - 1. - void ReplaceNonUniformAccessWithSwitchCase( + bool ReplaceNonUniformAccessWithSwitchCase( Instruction* access_chain_final_user, Instruction* access_chain, uint32_t number_of_elements, const std::deque& non_uniform_accesses_to_clone) const; @@ -124,7 +123,7 @@ class ReplaceDescArrayAccessUsingVarIndex : public Pass { // |access_chain| to |case_block|. The clone of |access_chain| will use // |const_element_idx| for its first index. |old_ids_to_new_ids| keeps the // mapping from the result id of |access_chain| to the result of its clone. - void AddConstElementAccessToCaseBlock( + bool AddConstElementAccessToCaseBlock( BasicBlock* case_block, Instruction* access_chain, uint32_t const_element_idx, std::unordered_map* old_ids_to_new_ids) const; @@ -132,7 +131,7 @@ class ReplaceDescArrayAccessUsingVarIndex : public Pass { // Clones all instructions in |insts_to_be_cloned| and put them to |block|. // |old_ids_to_new_ids| keeps the mapping from the result id of each // instruction of |insts_to_be_cloned| to the result of their clones. - void CloneInstsToBlock( + bool CloneInstsToBlock( BasicBlock* block, Instruction* inst_to_skip_cloning, const std::deque& insts_to_be_cloned, std::unordered_map* old_ids_to_new_ids) const; @@ -183,7 +182,8 @@ class ReplaceDescArrayAccessUsingVarIndex : public Pass { // |case_block_ids| and |default_block_id| as incoming blocks. The size of // |phi_operands| must be exactly 1 larger than the size of |case_block_ids|. // The last element of |phi_operands| will be used for |default_block_id|. It - // adds the phi instruction to the beginning of |parent_block|. + // adds the phi instruction to the beginning of |parent_block|. Returns 0 if + // it fails to create the Phi instruction. uint32_t CreatePhiInstruction(BasicBlock* parent_block, const std::vector& phi_operands, const std::vector& case_block_ids, diff --git a/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp b/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp index fc15b7577f..cdda3804b3 100644 --- a/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp +++ b/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp @@ -475,6 +475,7 @@ void ScalarReplacementPass::CreateVariable( if (id == 0) { replacements->push_back(nullptr); + return; } std::unique_ptr variable( @@ -488,7 +489,10 @@ void ScalarReplacementPass::CreateVariable( Instruction* inst = &*block->begin(); // If varInst was initialized, make sure to initialize its replacement. - GetOrCreateInitialValue(var_inst, index, inst); + if (!GetOrCreateInitialValue(var_inst, index, inst)) { + replacements->push_back(nullptr); + return; + } get_def_use_mgr()->AnalyzeInstDefUse(inst); context()->set_instr_block(inst, block); @@ -509,11 +513,11 @@ uint32_t ScalarReplacementPass::GetOrCreatePointerType(uint32_t id) { return ptr_type_id; } -void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, +bool ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, uint32_t index, Instruction* newVar) { assert(source->opcode() == spv::Op::OpVariable); - if (source->NumInOperands() < 2) return; + if (source->NumInOperands() < 2) return true; uint32_t initId = source->GetSingleWordInOperand(1u); uint32_t storageId = GetStorageType(newVar)->result_id(); @@ -525,6 +529,7 @@ void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, auto iter = type_to_null_.find(storageId); if (iter == type_to_null_.end()) { newInitId = TakeNextId(); + if (newInitId == 0) return false; type_to_null_[storageId] = newInitId; context()->AddGlobalValue( MakeUnique(context(), spv::Op::OpConstantNull, storageId, @@ -537,6 +542,7 @@ void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, } else if (IsSpecConstantInst(init->opcode())) { // Create a new constant extract. newInitId = TakeNextId(); + if (newInitId == 0) return false; context()->AddGlobalValue(MakeUnique( context(), spv::Op::OpSpecConstantOp, storageId, newInitId, std::initializer_list{ @@ -561,6 +567,7 @@ void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, if (newInitId != 0) { newVar->AddOperand({SPV_OPERAND_TYPE_ID, {newInitId}}); } + return true; } uint64_t ScalarReplacementPass::GetArrayLength( diff --git a/third_party/spirv-tools/source/opt/scalar_replacement_pass.h b/third_party/spirv-tools/source/opt/scalar_replacement_pass.h index 61d341e5cf..77d5bd5f1a 100644 --- a/third_party/spirv-tools/source/opt/scalar_replacement_pass.h +++ b/third_party/spirv-tools/source/opt/scalar_replacement_pass.h @@ -199,7 +199,9 @@ class ScalarReplacementPass : public MemPass { // If there is an initial value for |source| for element |index|, it is // appended as an operand on |newVar|. If the initial value is OpUndef, no // initial value is added to |newVar|. - void GetOrCreateInitialValue(Instruction* source, uint32_t index, + // + // Returns true if the value was successfully created. + bool GetOrCreateInitialValue(Instruction* source, uint32_t index, Instruction* newVar); // Replaces the load to the entire composite. diff --git a/third_party/spirv-tools/source/opt/split_combined_image_sampler_pass.cpp b/third_party/spirv-tools/source/opt/split_combined_image_sampler_pass.cpp index 0af4dba6cb..b5d3d654f3 100644 --- a/third_party/spirv-tools/source/opt/split_combined_image_sampler_pass.cpp +++ b/third_party/spirv-tools/source/opt/split_combined_image_sampler_pass.cpp @@ -142,6 +142,7 @@ Instruction* SplitCombinedImageSamplerPass::GetSamplerType() { analysis::Sampler s; uint32_t sampler_type_id = type_mgr_->GetTypeInstruction(&s); sampler_type_ = def_use_mgr_->GetDef(sampler_type_id); + if (sampler_type_ == nullptr) return nullptr; assert(first_sampled_image_type_); sampler_type_->InsertBefore(first_sampled_image_type_); RegisterNewGlobal(sampler_type_->result_id()); @@ -169,6 +170,7 @@ std::pair SplitCombinedImageSamplerPass::SplitType( auto* image_type = def_use_mgr_->GetDef(combined_kind_type.GetSingleWordInOperand(0)); auto* sampler_type = GetSamplerType(); + if (!sampler_type) return {nullptr, nullptr}; type_remap_[combined_kind_type.result_id()] = {&combined_kind_type, image_type, sampler_type}; return {image_type, sampler_type}; @@ -187,7 +189,9 @@ std::pair SplitCombinedImageSamplerPass::SplitType( // this defensively. if (image_pointee && sampler_pointee) { auto* ptr_image = MakeUniformConstantPointer(image_pointee); + if (!ptr_image) return {nullptr, nullptr}; auto* ptr_sampler = MakeUniformConstantPointer(sampler_pointee); + if (!ptr_sampler) return {nullptr, nullptr}; type_remap_[combined_kind_type.result_id()] = { &combined_kind_type, ptr_image, ptr_sampler}; return {ptr_image, ptr_sampler}; @@ -207,6 +211,7 @@ std::pair SplitCombinedImageSamplerPass::SplitType( analysis::Array array_image_ty(image_ty, array_ty->length_info()); const uint32_t array_image_ty_id = type_mgr_->GetTypeInstruction(&array_image_ty); + if (array_image_ty_id == 0) return {nullptr, nullptr}; auto* array_image_ty_inst = def_use_mgr_->GetDef(array_image_ty_id); if (!IsKnownGlobal(array_image_ty_id)) { array_image_ty_inst->InsertBefore(&combined_kind_type); @@ -214,11 +219,14 @@ std::pair SplitCombinedImageSamplerPass::SplitType( // GetTypeInstruction also updated the def-use manager. } + auto* sampler_ty_inst = GetSamplerType(); + if (!sampler_ty_inst) return {nullptr, nullptr}; analysis::Array sampler_array_ty( - type_mgr_->GetType(GetSamplerType()->result_id()), + type_mgr_->GetType(sampler_ty_inst->result_id()), array_ty->length_info()); const uint32_t array_sampler_ty_id = type_mgr_->GetTypeInstruction(&sampler_array_ty); + if (array_sampler_ty_id == 0) return {nullptr, nullptr}; auto* array_sampler_ty_inst = def_use_mgr_->GetDef(array_sampler_ty_id); if (!IsKnownGlobal(array_sampler_ty_id)) { array_sampler_ty_inst->InsertBefore(&combined_kind_type); @@ -240,6 +248,7 @@ std::pair SplitCombinedImageSamplerPass::SplitType( analysis::RuntimeArray array_image_ty(image_ty); const uint32_t array_image_ty_id = type_mgr_->GetTypeInstruction(&array_image_ty); + if (array_image_ty_id == 0) return {nullptr, nullptr}; auto* array_image_ty_inst = def_use_mgr_->GetDef(array_image_ty_id); if (!IsKnownGlobal(array_image_ty_id)) { array_image_ty_inst->InsertBefore(&combined_kind_type); @@ -247,10 +256,13 @@ std::pair SplitCombinedImageSamplerPass::SplitType( // GetTypeInstruction also updated the def-use manager. } + auto* sampler_ty_inst = GetSamplerType(); + if (!sampler_ty_inst) return {nullptr, nullptr}; analysis::RuntimeArray sampler_array_ty( - type_mgr_->GetType(GetSamplerType()->result_id())); + type_mgr_->GetType(sampler_ty_inst->result_id())); const uint32_t array_sampler_ty_id = type_mgr_->GetTypeInstruction(&sampler_array_ty); + if (array_sampler_ty_id == 0) return {nullptr, nullptr}; auto* array_sampler_ty_inst = def_use_mgr_->GetDef(array_sampler_ty_id); if (!IsKnownGlobal(array_sampler_ty_id)) { array_sampler_ty_inst->InsertBefore(&combined_kind_type); @@ -273,12 +285,14 @@ spv_result_t SplitCombinedImageSamplerPass::RemapVar( // Create an image variable, and a sampler variable. auto* combined_var_type = def_use_mgr_->GetDef(combined_var->type_id()); auto [ptr_image_ty, ptr_sampler_ty] = SplitType(*combined_var_type); - assert(ptr_image_ty); - assert(ptr_sampler_ty); + if (!ptr_image_ty || !ptr_sampler_ty) return SPV_ERROR_INTERNAL; Instruction* sampler_var = builder.AddVariable( ptr_sampler_ty->result_id(), SpvStorageClassUniformConstant); + if (sampler_var == nullptr) return SPV_ERROR_INTERNAL; Instruction* image_var = builder.AddVariable(ptr_image_ty->result_id(), SpvStorageClassUniformConstant); + if (image_var == nullptr) return SPV_ERROR_INTERNAL; + modified_ = true; return RemapUses(combined_var, image_var, sampler_var); } @@ -356,8 +370,10 @@ spv_result_t SplitCombinedImageSamplerPass::RemapUses( builder.SetInsertPoint(load); auto* image = builder.AddLoad(PointeeTypeId(use.image_part), use.image_part->result_id()); + if (!image) return SPV_ERROR_INTERNAL; auto* sampler = builder.AddLoad(PointeeTypeId(use.sampler_part), use.sampler_part->result_id()); + if (!sampler) return SPV_ERROR_INTERNAL; // Move decorations, such as RelaxedPrecision. auto* deco_mgr = context()->get_decoration_mgr(); @@ -368,6 +384,7 @@ spv_result_t SplitCombinedImageSamplerPass::RemapUses( // Create a sampled image from the loads of the two parts. auto* sampled_image = builder.AddSampledImage( load->type_id(), image->result_id(), sampler->result_id()); + if (!sampled_image) return SPV_ERROR_INTERNAL; // Replace the original sampled image value with the new one. std::unordered_set users; def_use_mgr_->ForEachUse( @@ -459,12 +476,18 @@ spv_result_t SplitCombinedImageSamplerPass::RemapUses( auto [result_image_part_ty, result_sampler_part_ty] = SplitType(*def_use_mgr_->GetDef(original_access_chain->type_id())); + if (!result_image_part_ty || !result_sampler_part_ty) + return Fail() << "failed to split type for access chain"; auto* result_image_part = builder.AddOpcodeAccessChain( use.user->opcode(), result_image_part_ty->result_id(), use.image_part->result_id(), indices); + if (!result_image_part) + return Fail() << "failed to create access chain for image part"; auto* result_sampler_part = builder.AddOpcodeAccessChain( use.user->opcode(), result_sampler_part_ty->result_id(), use.sampler_part->result_id(), indices); + if (!result_sampler_part) + return Fail() << "failed to create access chain for sampler part"; // Remap uses of the original access chain. add_remap(original_access_chain, result_image_part, @@ -515,8 +538,7 @@ spv_result_t SplitCombinedImageSamplerPass::RemapFunctions() { if (combined_types_.find(param_ty_id) != combined_types_.end()) { auto* param_type = def_use_mgr_->GetDef(param_ty_id); auto [image_type, sampler_type] = SplitType(*param_type); - assert(image_type); - assert(sampler_type); + if (!image_type || !sampler_type) return SPV_ERROR_INTERNAL; // The image and sampler types must already exist, so there is no // need to move them to the right spot. new_params.push_back(type_mgr_->GetType(image_type->result_id())); @@ -556,10 +578,14 @@ spv_result_t SplitCombinedImageSamplerPass::RemapFunctions() { Instruction* sampler; }; std::vector replacements; + bool error = false; Function::RewriteParamFn rewriter = [&](std::unique_ptr&& param, std::back_insert_iterator& appender) { + if (error) { + return; + } if (combined_types_.count(param->type_id()) == 0) { appender = std::move(param); return; @@ -569,12 +595,27 @@ spv_result_t SplitCombinedImageSamplerPass::RemapFunctions() { auto* combined_inst = param.release(); auto* combined_type = def_use_mgr_->GetDef(combined_inst->type_id()); auto [image_type, sampler_type] = SplitType(*combined_type); + if (!image_type || !sampler_type) { + error = true; + return; + } + + uint32_t image_param_id = context()->TakeNextId(); + if (image_param_id == 0) { + error = true; + return; + } auto image_param = MakeUnique( context(), spv::Op::OpFunctionParameter, image_type->result_id(), - context()->TakeNextId(), Instruction::OperandList{}); + image_param_id, Instruction::OperandList{}); + uint32_t sampler_param_id = context()->TakeNextId(); + if (sampler_param_id == 0) { + error = true; + return; + } auto sampler_param = MakeUnique( context(), spv::Op::OpFunctionParameter, - sampler_type->result_id(), context()->TakeNextId(), + sampler_type->result_id(), sampler_param_id, Instruction::OperandList{}); replacements.push_back( {combined_inst, image_param.get(), sampler_param.get()}); @@ -583,6 +624,10 @@ spv_result_t SplitCombinedImageSamplerPass::RemapFunctions() { }; fn.RewriteParams(rewriter); + if (error) { + return SPV_ERROR_INTERNAL; + } + for (auto& r : replacements) { modified_ = true; def_use_mgr_->AnalyzeInstDefUse(r.image); @@ -597,6 +642,7 @@ Instruction* SplitCombinedImageSamplerPass::MakeUniformConstantPointer( Instruction* pointee) { uint32_t ptr_id = type_mgr_->FindPointerToType( pointee->result_id(), spv::StorageClass::UniformConstant); + if (ptr_id == 0) return nullptr; auto* ptr = def_use_mgr_->GetDef(ptr_id); if (!IsKnownGlobal(ptr_id)) { // The pointer type was created at the end. Put it right after the diff --git a/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp b/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp index 3eb4ec3f8e..615b129bfa 100644 --- a/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp +++ b/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp @@ -87,13 +87,15 @@ std::string SSARewriter::PhiCandidate::PrettyPrint(const CFG* cfg) const { return str.str(); } -SSARewriter::PhiCandidate& SSARewriter::CreatePhiCandidate(uint32_t var_id, +SSARewriter::PhiCandidate* SSARewriter::CreatePhiCandidate(uint32_t var_id, BasicBlock* bb) { - // TODO(1841): Handle id overflow. uint32_t phi_result_id = pass_->context()->TakeNextId(); + if (phi_result_id == 0) { + return nullptr; + } auto result = phi_candidates_.emplace( phi_result_id, PhiCandidate(var_id, phi_result_id, bb)); - PhiCandidate& phi_candidate = result.first->second; + PhiCandidate* phi_candidate = &result.first->second; return phi_candidate; } @@ -268,11 +270,12 @@ uint32_t SSARewriter::GetReachingDef(uint32_t var_id, BasicBlock* bb) { // If there is more than one predecessor, this is a join block which may // require a Phi instruction. This will act as |var_id|'s current // definition to break potential cycles. - PhiCandidate& phi_candidate = CreatePhiCandidate(var_id, bb); + PhiCandidate* phi_candidate = CreatePhiCandidate(var_id, bb); + if (phi_candidate == nullptr) return 0; // Set the value for |bb| to avoid an infinite recursion. - WriteVariable(var_id, bb, phi_candidate.result_id()); - val_id = AddPhiOperands(&phi_candidate); + WriteVariable(var_id, bb, phi_candidate->result_id()); + val_id = AddPhiOperands(phi_candidate); } // If we could not find a store for this variable in the path from the root diff --git a/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h b/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h index 2470f85f6b..076d9e1651 100644 --- a/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h +++ b/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h @@ -232,7 +232,7 @@ class SSARewriter { // during rewriting. // // Once the candidate Phi is created, it returns its ID. - PhiCandidate& CreatePhiCandidate(uint32_t var_id, BasicBlock* bb); + PhiCandidate* CreatePhiCandidate(uint32_t var_id, BasicBlock* bb); // Attempts to remove a trivial Phi candidate |phi_cand|. Trivial Phis are // those that only reference themselves and one other value |val| any number diff --git a/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp b/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp index 16a7869ec5..b9d62650b9 100644 --- a/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp +++ b/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp @@ -53,17 +53,15 @@ bool IsPowerOf2(uint32_t val) { Pass::Status StrengthReductionPass::Process() { // Initialize the member variables on a per module basis. - bool modified = false; int32_type_id_ = 0; uint32_type_id_ = 0; std::memset(constant_ids_, 0, sizeof(constant_ids_)); FindIntTypesAndConstants(); - modified = ScanFunctions(); - return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); + return ScanFunctions(); } -bool StrengthReductionPass::ReplaceMultiplyByPowerOf2( +Pass::Status StrengthReductionPass::ReplaceMultiplyByPowerOf2( BasicBlock::iterator* inst) { assert((*inst)->opcode() == spv::Op::OpIMul && "Only works for multiplication of integers."); @@ -72,7 +70,7 @@ bool StrengthReductionPass::ReplaceMultiplyByPowerOf2( // Currently only works on 32-bit integers. if ((*inst)->type_id() != int32_type_id_ && (*inst)->type_id() != uint32_type_id_) { - return modified; + return Status::SuccessWithoutChange; } // Check the operands for a constant that is a power of 2. @@ -87,9 +85,11 @@ bool StrengthReductionPass::ReplaceMultiplyByPowerOf2( modified = true; uint32_t shiftAmount = CountTrailingZeros(constVal); uint32_t shiftConstResultId = GetConstantId(shiftAmount); + if (shiftConstResultId == 0) return Status::Failure; // Create the new instruction. uint32_t newResultId = TakeNextId(); + if (newResultId == 0) return Status::Failure; std::vector newOperands; newOperands.push_back((*inst)->GetInOperand(1 - i)); Operand shiftOperand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, @@ -117,7 +117,7 @@ bool StrengthReductionPass::ReplaceMultiplyByPowerOf2( } } - return modified; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } void StrengthReductionPass::FindIntTypesAndConstants() { @@ -152,6 +152,7 @@ uint32_t StrengthReductionPass::GetConstantId(uint32_t val) { // Construct the constant. uint32_t resultId = TakeNextId(); + if (resultId == 0) return 0; Operand constant(spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, {val}); std::unique_ptr newConstant(new Instruction( @@ -169,7 +170,7 @@ uint32_t StrengthReductionPass::GetConstantId(uint32_t val) { return constant_ids_[val]; } -bool StrengthReductionPass::ScanFunctions() { +Pass::Status StrengthReductionPass::ScanFunctions() { // I did not use |ForEachInst| in the module because the function that acts on // the instruction gets a pointer to the instruction. We cannot use that to // insert a new instruction. I want an iterator. @@ -178,16 +179,19 @@ bool StrengthReductionPass::ScanFunctions() { for (auto& bb : func) { for (auto inst = bb.begin(); inst != bb.end(); ++inst) { switch (inst->opcode()) { - case spv::Op::OpIMul: - if (ReplaceMultiplyByPowerOf2(&inst)) modified = true; + case spv::Op::OpIMul: { + Status s = ReplaceMultiplyByPowerOf2(&inst); + if (s == Status::Failure) return Status::Failure; + if (s == Status::SuccessWithChange) modified = true; break; + } default: break; } } } } - return modified; + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } } // namespace opt diff --git a/third_party/spirv-tools/source/opt/strength_reduction_pass.h b/third_party/spirv-tools/source/opt/strength_reduction_pass.h index 1cbbbcc6d0..48e72abe76 100644 --- a/third_party/spirv-tools/source/opt/strength_reduction_pass.h +++ b/third_party/spirv-tools/source/opt/strength_reduction_pass.h @@ -32,7 +32,7 @@ class StrengthReductionPass : public Pass { private: // Replaces multiple by power of 2 with an equivalent bit shift. // Returns true if something changed. - bool ReplaceMultiplyByPowerOf2(BasicBlock::iterator*); + Status ReplaceMultiplyByPowerOf2(BasicBlock::iterator*); // Scan the types and constants in the module looking for the integer // types that we are @@ -47,7 +47,7 @@ class StrengthReductionPass : public Pass { // Replaces certain instructions in function bodies with presumably cheaper // ones. Returns true if something changed. - bool ScanFunctions(); + Status ScanFunctions(); // Type ids for the types of interest, or 0 if they do not exist. uint32_t int32_type_id_; diff --git a/third_party/spirv-tools/source/opt/trim_capabilities_pass.cpp b/third_party/spirv-tools/source/opt/trim_capabilities_pass.cpp index cc0e331bb9..47f2cb2d16 100644 --- a/third_party/spirv-tools/source/opt/trim_capabilities_pass.cpp +++ b/third_party/spirv-tools/source/opt/trim_capabilities_pass.cpp @@ -427,20 +427,20 @@ Handler_OpImageSparseRead_StorageImageReadWithoutFormat( // Opcode of interest to determine capabilities requirements. constexpr std::array, 14> kOpcodeHandlers{{ // clang-format off - {spv::Op::OpImageRead, Handler_OpImageRead_StorageImageReadWithoutFormat}, - {spv::Op::OpImageWrite, Handler_OpImageWrite_StorageImageWriteWithoutFormat}, - {spv::Op::OpImageSparseRead, Handler_OpImageSparseRead_StorageImageReadWithoutFormat}, - {spv::Op::OpTypeFloat, Handler_OpTypeFloat_Float16 }, - {spv::Op::OpTypeFloat, Handler_OpTypeFloat_Float64 }, - {spv::Op::OpTypeImage, Handler_OpTypeImage_ImageMSArray}, - {spv::Op::OpTypeInt, Handler_OpTypeInt_Int16 }, - {spv::Op::OpTypeInt, Handler_OpTypeInt_Int64 }, - {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageInputOutput16}, - {spv::Op::OpTypePointer, Handler_OpTypePointer_StoragePushConstant16}, - {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageUniform16}, - {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageUniform16}, - {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageUniformBufferBlock16}, - {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageBuffer16BitAccess}, + {spv::Op::OpImageRead, Handler_OpImageRead_StorageImageReadWithoutFormat}, + {spv::Op::OpImageWrite, Handler_OpImageWrite_StorageImageWriteWithoutFormat}, + {spv::Op::OpImageSparseRead, Handler_OpImageSparseRead_StorageImageReadWithoutFormat}, + {spv::Op::OpTypeFloat, Handler_OpTypeFloat_Float16 }, + {spv::Op::OpTypeFloat, Handler_OpTypeFloat_Float64 }, + {spv::Op::OpTypeImage, Handler_OpTypeImage_ImageMSArray}, + {spv::Op::OpTypeInt, Handler_OpTypeInt_Int16 }, + {spv::Op::OpTypeInt, Handler_OpTypeInt_Int64 }, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageInputOutput16}, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StoragePushConstant16}, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageUniform16}, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageUniform16}, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageUniformBufferBlock16}, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageBuffer16BitAccess}, // clang-format on }}; @@ -612,7 +612,9 @@ void TrimCapabilitiesPass::addInstructionRequirements( ExtensionSet* extensions) const { // Ignoring OpCapability and OpExtension instructions. if (instruction->opcode() == spv::Op::OpCapability || - instruction->opcode() == spv::Op::OpExtension) { + instruction->opcode() == spv::Op::OpConditionalCapabilityINTEL || + instruction->opcode() == spv::Op::OpExtension || + instruction->opcode() == spv::Op::OpConditionalExtensionINTEL) { return; } @@ -631,7 +633,7 @@ void TrimCapabilitiesPass::addInstructionRequirements( } // Last case: some complex logic needs to be run to determine capabilities. - auto[begin, end] = opcodeHandlers_.equal_range(instruction->opcode()); + auto [begin, end] = opcodeHandlers_.equal_range(instruction->opcode()); for (auto it = begin; it != end; it++) { const OpcodeHandler handler = it->second; auto result = handler(instruction); @@ -754,7 +756,7 @@ Pass::Status TrimCapabilitiesPass::Process() { return Status::SuccessWithoutChange; } - auto[required_capabilities, required_extensions] = + auto [required_capabilities, required_extensions] = DetermineRequiredCapabilitiesAndExtensions(); Pass::Status capStatus = TrimUnrequiredCapabilities(required_capabilities); diff --git a/third_party/spirv-tools/source/opt/trim_capabilities_pass.h b/third_party/spirv-tools/source/opt/trim_capabilities_pass.h index d2369b15eb..06e989b914 100644 --- a/third_party/spirv-tools/source/opt/trim_capabilities_pass.h +++ b/third_party/spirv-tools/source/opt/trim_capabilities_pass.h @@ -82,6 +82,7 @@ class TrimCapabilitiesPass : public Pass { spv::Capability::FragmentShaderPixelInterlockEXT, spv::Capability::FragmentShaderSampleInterlockEXT, spv::Capability::FragmentShaderShadingRateInterlockEXT, + spv::Capability::Geometry, spv::Capability::GroupNonUniform, spv::Capability::GroupNonUniformArithmetic, spv::Capability::GroupNonUniformClustered, diff --git a/third_party/spirv-tools/source/opt/type_manager.cpp b/third_party/spirv-tools/source/opt/type_manager.cpp index 7eec9f337c..6f9ef0e15a 100644 --- a/third_party/spirv-tools/source/opt/type_manager.cpp +++ b/third_party/spirv-tools/source/opt/type_manager.cpp @@ -237,6 +237,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { DefineParameterlessCase(AccelerationStructureNV); DefineParameterlessCase(RayQueryKHR); DefineParameterlessCase(HitObjectNV); + DefineParameterlessCase(HitObjectEXT); #undef DefineParameterlessCase case Type::kInteger: typeInst = MakeUnique( @@ -489,7 +490,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = MakeUnique( - context(), spv::Op::OpTypeCooperativeVectorNV, 0, id, + context(), spv::Op::OpTypeVectorIdEXT, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {component_type}}, {SPV_OPERAND_TYPE_ID, {coop_vec->components()}}}); @@ -525,6 +526,27 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { } break; } + case Type::kGraphARM: { + auto const gty = type->AsGraphARM(); + std::vector ops; + ops.push_back( + Operand(SPV_OPERAND_TYPE_LITERAL_INTEGER, {gty->num_inputs()})); + for (auto iotype : gty->io_types()) { + uint32_t iotype_id = GetTypeInstruction(iotype); + ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {iotype_id})); + } + typeInst = MakeUnique(context(), spv::Op::OpTypeGraphARM, 0, + id, ops); + break; + } + case Type::kBufferEXT: { + typeInst = MakeUnique( + context(), spv::Op::OpTypeBufferEXT, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_STORAGE_CLASS, + {static_cast(type->AsBufferEXT()->storage_class())}}}); + break; + } default: assert(false && "Unexpected type"); break; @@ -641,6 +663,7 @@ Type* TypeManager::RebuildType(uint32_t type_id, const Type& type) { DefineNoSubtypeCase(AccelerationStructureNV); DefineNoSubtypeCase(RayQueryKHR); DefineNoSubtypeCase(HitObjectNV); + DefineNoSubtypeCase(HitObjectEXT); #undef DefineNoSubtypeCase case Type::kVector: { const Vector* vec_ty = type.AsVector(); @@ -792,6 +815,20 @@ Type* TypeManager::RebuildType(uint32_t type_id, const Type& type) { tensor_type->rank_id(), tensor_type->shape_id()); break; } + case Type::kGraphARM: { + const GraphARM* graph_type = type.AsGraphARM(); + std::vector io_types; + for (auto ioty : graph_type->io_types()) { + io_types.push_back(RebuildType(GetId(ioty), *ioty)); + } + rebuilt_ty = MakeUnique(graph_type->num_inputs(), io_types); + break; + } + case Type::kBufferEXT: { + const BufferEXT* buffer_type = type.AsBufferEXT(); + rebuilt_ty = MakeUnique(buffer_type->storage_class()); + break; + } default: assert(false && "Unhandled type"); return nullptr; @@ -1050,7 +1087,7 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { inst.GetSingleWordInOperand(1), inst.GetSingleWordInOperand(2), inst.GetSingleWordInOperand(3), inst.GetSingleWordInOperand(4)); break; - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: type = new CooperativeVectorNV(GetType(inst.GetSingleWordInOperand(0)), inst.GetSingleWordInOperand(1)); break; @@ -1060,6 +1097,9 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { case spv::Op::OpTypeHitObjectNV: type = new HitObjectNV(); break; + case spv::Op::OpTypeHitObjectEXT: + type = new HitObjectEXT(); + break; case spv::Op::OpTypeTensorLayoutNV: type = new TensorLayoutNV(inst.GetSingleWordInOperand(0), inst.GetSingleWordInOperand(1)); @@ -1091,6 +1131,19 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { } break; } + case spv::Op::OpTypeGraphARM: { + std::vector io_types; + for (unsigned i = 1; i < inst.NumInOperands(); i++) { + io_types.push_back(GetType(inst.GetSingleWordInOperand(i))); + } + type = new GraphARM(inst.GetSingleWordInOperand(0), io_types); + break; + } + case spv::Op::OpTypeBufferEXT: { + type = new BufferEXT( + static_cast(inst.GetSingleWordInOperand(0))); + break; + } default: assert(false && "Type not handled by the type manager."); break; diff --git a/third_party/spirv-tools/source/opt/type_manager.h b/third_party/spirv-tools/source/opt/type_manager.h index d1e6fc15d0..cadc7c21be 100644 --- a/third_party/spirv-tools/source/opt/type_manager.h +++ b/third_party/spirv-tools/source/opt/type_manager.h @@ -203,7 +203,11 @@ class TypeManager { return GetRegisteredType(&bool_type); } - uint32_t GetBoolTypeId() { return GetTypeInstruction(GetBoolType()); } + uint32_t GetBoolTypeId() { + Type* bool_type = GetBoolType(); + if (bool_type == nullptr) return 0; + return GetTypeInstruction(bool_type); + } Type* GetVoidType() { Void void_type; diff --git a/third_party/spirv-tools/source/opt/types.cpp b/third_party/spirv-tools/source/opt/types.cpp index 83e0534dbc..617b6d2b63 100644 --- a/third_party/spirv-tools/source/opt/types.cpp +++ b/third_party/spirv-tools/source/opt/types.cpp @@ -135,7 +135,10 @@ std::unique_ptr Type::Clone() const { DeclareKindCase(CooperativeVectorNV); DeclareKindCase(RayQueryKHR); DeclareKindCase(HitObjectNV); + DeclareKindCase(HitObjectEXT); DeclareKindCase(TensorARM); + DeclareKindCase(GraphARM); + DeclareKindCase(BufferEXT); #undef DeclareKindCase default: assert(false && "Unhandled type"); @@ -186,9 +189,12 @@ bool Type::operator==(const Type& other) const { DeclareKindCase(CooperativeVectorNV); DeclareKindCase(RayQueryKHR); DeclareKindCase(HitObjectNV); + DeclareKindCase(HitObjectEXT); DeclareKindCase(TensorLayoutNV); DeclareKindCase(TensorViewNV); DeclareKindCase(TensorARM); + DeclareKindCase(GraphARM); + DeclareKindCase(BufferEXT); #undef DeclareKindCase default: assert(false && "Unhandled type"); @@ -247,9 +253,12 @@ size_t Type::ComputeHashValue(size_t hash, SeenTypes* seen) const { DeclareKindCase(CooperativeVectorNV); DeclareKindCase(RayQueryKHR); DeclareKindCase(HitObjectNV); + DeclareKindCase(HitObjectEXT); DeclareKindCase(TensorLayoutNV); DeclareKindCase(TensorViewNV); DeclareKindCase(TensorARM); + DeclareKindCase(GraphARM); + DeclareKindCase(BufferEXT); #undef DeclareKindCase default: assert(false && "Unhandled type"); @@ -932,6 +941,86 @@ bool TensorARM::IsSameImpl(const Type* that, IsSameCache* seen) const { HasSameDecorations(that); } +GraphARM::GraphARM(const uint32_t num_inputs, + const std::vector& io_types) + : Type(kGraphARM), num_inputs_(num_inputs), io_types_(io_types) { + assert(io_types.size() > 0); +} + +std::string GraphARM::str() const { + std::ostringstream oss; + oss << "graph<" << num_inputs_; + for (auto ioty : io_types_) { + oss << "," << ioty->str(); + } + oss << ">"; + return oss.str(); +} + +bool GraphARM::is_shaped() const { + // A graph is considered to be shaped if all its interface tensors are shaped + for (auto ioty : io_types_) { + auto tensor_type = ioty->AsTensorARM(); + assert(tensor_type); + if (!tensor_type->is_shaped()) { + return false; + } + } + return true; +} + +size_t GraphARM::ComputeExtraStateHash(size_t hash, SeenTypes* seen) const { + hash = hash_combine(hash, num_inputs_); + for (auto ioty : io_types_) { + hash = ioty->ComputeHashValue(hash, seen); + } + return hash; +} + +bool GraphARM::IsSameImpl(const Type* that, IsSameCache* seen) const { + const GraphARM* og = that->AsGraphARM(); + if (!og) { + return false; + } + if (num_inputs_ != og->num_inputs_) { + return false; + } + if (io_types_.size() != og->io_types_.size()) { + return false; + } + for (size_t i = 0; i < io_types_.size(); i++) { + if (!io_types_[i]->IsSameImpl(og->io_types_[i], seen)) { + return false; + } + } + return true; +} + +BufferEXT::BufferEXT(spv::StorageClass storage_class) + : Type(kBufferEXT), storage_class_(storage_class) {} + +std::string BufferEXT::str() const { + std::ostringstream oss; + oss << "buffer<" << static_cast(storage_class_) << ">"; + return oss.str(); +} + +size_t BufferEXT::ComputeExtraStateHash(size_t hash, SeenTypes*) const { + hash = hash_combine(hash, static_cast(storage_class_)); + return hash; +} + +bool BufferEXT::IsSameImpl(const Type* that, IsSameCache*) const { + const BufferEXT* og = that->AsBufferEXT(); + if (!og) { + return false; + } + if (storage_class_ != og->storage_class_) { + return false; + } + return true; +} + } // namespace analysis } // namespace opt } // namespace spvtools diff --git a/third_party/spirv-tools/source/opt/types.h b/third_party/spirv-tools/source/opt/types.h index 72acdb01d0..7d0ad0e102 100644 --- a/third_party/spirv-tools/source/opt/types.h +++ b/third_party/spirv-tools/source/opt/types.h @@ -67,9 +67,12 @@ class CooperativeMatrixKHR; class CooperativeVectorNV; class RayQueryKHR; class HitObjectNV; +class HitObjectEXT; class TensorLayoutNV; class TensorViewNV; class TensorARM; +class GraphARM; +class BufferEXT; // Abstract class for a SPIR-V type. It has a bunch of As() methods, // which is used as a way to probe the actual . @@ -113,9 +116,12 @@ class Type { kCooperativeVectorNV, kRayQueryKHR, kHitObjectNV, + kHitObjectEXT, kTensorLayoutNV, kTensorViewNV, kTensorARM, + kGraphARM, + kBufferEXT, kLast }; @@ -138,6 +144,12 @@ class Type { return IsSameImpl(that, &seen); } + // Returns true if this is a cooperative matrix. + bool IsCooperativeMatrix() const { + return kind() == analysis::Type::kCooperativeMatrixKHR || + kind() == analysis::Type::kCooperativeMatrixNV; + } + // Returns true if this type is exactly the same as |that| type, including // decorations. |seen| is the set of |Pointer*| pair that are currently being // compared in a parent call to |IsSameImpl|. @@ -220,9 +232,12 @@ class Type { DeclareCastMethod(CooperativeVectorNV) DeclareCastMethod(RayQueryKHR) DeclareCastMethod(HitObjectNV) + DeclareCastMethod(HitObjectEXT) DeclareCastMethod(TensorLayoutNV) DeclareCastMethod(TensorViewNV) DeclareCastMethod(TensorARM) + DeclareCastMethod(GraphARM) + DeclareCastMethod(BufferEXT) #undef DeclareCastMethod protected: @@ -793,6 +808,8 @@ class TensorARM : public Type { const Type* element_type() const { return element_type_; } uint32_t rank_id() const { return rank_id_; } uint32_t shape_id() const { return shape_id_; } + bool is_ranked() const { return rank_id_ != 0; } + bool is_shaped() const { return shape_id_ != 0; } private: bool IsSameImpl(const Type* that, IsSameCache*) const override; @@ -802,6 +819,49 @@ class TensorARM : public Type { const uint32_t shape_id_; }; +class GraphARM : public Type { + public: + GraphARM(const uint32_t num_inputs, const std::vector& io_types); + GraphARM(const GraphARM&) = default; + + std::string str() const override; + + GraphARM* AsGraphARM() override { return this; } + const GraphARM* AsGraphARM() const override { return this; } + + uint32_t num_inputs() const { return num_inputs_; } + const std::vector& io_types() const { return io_types_; } + bool is_shaped() const; + + size_t ComputeExtraStateHash(size_t hash, SeenTypes* seen) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const uint32_t num_inputs_; + const std::vector io_types_; +}; + +class BufferEXT : public Type { + public: + BufferEXT(spv::StorageClass storage_class_); + BufferEXT(const BufferEXT&) = default; + + std::string str() const override; + + BufferEXT* AsBufferEXT() override { return this; } + const BufferEXT* AsBufferEXT() const override { return this; } + + spv::StorageClass storage_class() const { return storage_class_; } + + size_t ComputeExtraStateHash(size_t hash, SeenTypes* seen) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const spv::StorageClass storage_class_; +}; + #define DefineParameterlessType(type, name) \ class type : public Type { \ public: \ @@ -834,6 +894,7 @@ DefineParameterlessType(NamedBarrier, named_barrier); DefineParameterlessType(AccelerationStructureNV, accelerationStructureNV); DefineParameterlessType(RayQueryKHR, rayQueryKHR); DefineParameterlessType(HitObjectNV, hitObjectNV); +DefineParameterlessType(HitObjectEXT, hitObjectEXT); #undef DefineParameterlessType } // namespace analysis diff --git a/third_party/spirv-tools/source/opt/upgrade_memory_model.cpp b/third_party/spirv-tools/source/opt/upgrade_memory_model.cpp index 97b5ed38e4..4af466dc9d 100644 --- a/third_party/spirv-tools/source/opt/upgrade_memory_model.cpp +++ b/third_party/spirv-tools/source/opt/upgrade_memory_model.cpp @@ -700,22 +700,29 @@ void UpgradeMemoryModel::UpgradeBarriers() { roots.push(e.GetSingleWordInOperand(1u)); if (context()->ProcessCallTreeFromRoots(CollectBarriers, &roots)) { for (auto barrier : barriers) { - // Add OutputMemoryKHR to the semantics of the barriers. + // Add OutputMemoryKHR to the semantics of the non-relaxed barriers. uint32_t semantics_id = barrier->GetSingleWordInOperand(2u); Instruction* semantics_inst = context()->get_def_use_mgr()->GetDef(semantics_id); analysis::Type* semantics_type = context()->get_type_mgr()->GetType(semantics_inst->type_id()); uint64_t semantics_value = GetIndexValue(semantics_inst); - const analysis::Constant* constant = - context()->get_constant_mgr()->GetConstant( - semantics_type, - {static_cast(semantics_value) | - uint32_t(spv::MemorySemanticsMask::OutputMemoryKHR)}); - barrier->SetInOperand(2u, {context() - ->get_constant_mgr() - ->GetDefiningInstruction(constant) - ->result_id()}); + const uint64_t memory_order_mask = + uint64_t(spv::MemorySemanticsMask::Acquire | + spv::MemorySemanticsMask::Release | + spv::MemorySemanticsMask::AcquireRelease | + spv::MemorySemanticsMask::SequentiallyConsistent); + if (semantics_value & memory_order_mask) { + const analysis::Constant* constant = + context()->get_constant_mgr()->GetConstant( + semantics_type, + {static_cast(semantics_value) | + uint32_t(spv::MemorySemanticsMask::OutputMemoryKHR)}); + barrier->SetInOperand(2u, {context() + ->get_constant_mgr() + ->GetDefiningInstruction(constant) + ->result_id()}); + } } } barriers.clear(); @@ -797,11 +804,13 @@ void UpgradeMemoryModel::UpgradeExtInst(Instruction* ext_inst) { InstructionBuilder builder( context(), where, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + // TODO(1841): Handle id overflow. auto extract_0 = builder.AddCompositeExtract(element_type_id, ext_inst->result_id(), {0}); context()->ReplaceAllUsesWith(ext_inst->result_id(), extract_0->result_id()); // The extract's input was just changed to itself, so fix that. extract_0->SetInOperand(0u, {ext_inst->result_id()}); + // TODO(1841): Handle id overflow. auto extract_1 = builder.AddCompositeExtract(pointee_type_id, ext_inst->result_id(), {1}); builder.AddStore(ptr_id, extract_1->result_id()); diff --git a/third_party/spirv-tools/source/opt/value_number_table.cpp b/third_party/spirv-tools/source/opt/value_number_table.cpp index 0c7e575e7f..a93d33cae2 100644 --- a/third_party/spirv-tools/source/opt/value_number_table.cpp +++ b/third_party/spirv-tools/source/opt/value_number_table.cpp @@ -38,6 +38,45 @@ uint32_t ValueNumberTable::GetValueNumber(uint32_t id) const { return GetValueNumber(context()->get_def_use_mgr()->GetDef(id)); } +bool ValueNumberTable::IsReadOnlyLoad(Instruction* inst) { + if (!inst->IsLoad()) { + return false; + } + + Instruction* address_def = inst->GetBaseAddress(); + if (!address_def) { + return false; + } + + auto cached_result = read_only_variable_cache_.find(address_def->result_id()); + if (cached_result != read_only_variable_cache_.end()) { + return cached_result->second; + } + + bool is_read_only = IsReadOnlyVariable(address_def); + read_only_variable_cache_[address_def->result_id()] = is_read_only; + return is_read_only; +} + +bool ValueNumberTable::IsReadOnlyVariable(Instruction* address_def) { + if (address_def->opcode() == spv::Op::OpVariable) { + if (address_def->IsReadOnlyPointer()) { + return true; + } + } + + if (address_def->opcode() == spv::Op::OpLoad) { + const analysis::Type* address_type = + context()->get_type_mgr()->GetType(address_def->type_id()); + if (address_type->AsSampledImage() != nullptr) { + const auto* image_type = + address_type->AsSampledImage()->image_type()->AsImage(); + return image_type->sampled() == 1; + } + } + return false; +} + uint32_t ValueNumberTable::AssignValueNumber(Instruction* inst) { // If it already has a value return that. uint32_t value = GetValueNumber(inst); @@ -88,7 +127,7 @@ uint32_t ValueNumberTable::AssignValueNumber(Instruction* inst) { // Note that this test will also handle volatile loads because they are not // read only. However, if this is ever relaxed because we analyze stores, we // will have to add a new case for volatile loads. - if (inst->IsLoad() && !inst->IsReadOnlyLoad()) { + if (inst->IsLoad() && !IsReadOnlyLoad(inst)) { return assign_new_number(inst); } @@ -143,8 +182,15 @@ uint32_t ValueNumberTable::AssignValueNumber(Instruction* inst) { } } - // TODO: Implement a normal form for opcodes that commute like integer - // addition. This will let us know that a+b is the same value as b+a. + // Apply normal form, so a+b == b+a + if (spvOpcodeIsCommutativeBinaryOperator(value_ins.opcode())) { + if (value_ins.GetSingleWordInOperand(0) > + value_ins.GetSingleWordInOperand(1)) { + value_ins.SetInOperands( + {{SPV_OPERAND_TYPE_ID, {value_ins.GetSingleWordInOperand(1)}}, + {SPV_OPERAND_TYPE_ID, {value_ins.GetSingleWordInOperand(0)}}}); + } + } // Otherwise, we check if this value has been computed before. auto value_iterator = instruction_to_value_.find(value_ins); diff --git a/third_party/spirv-tools/source/opt/value_number_table.h b/third_party/spirv-tools/source/opt/value_number_table.h index 39129ffa35..c7c909be9c 100644 --- a/third_party/spirv-tools/source/opt/value_number_table.h +++ b/third_party/spirv-tools/source/opt/value_number_table.h @@ -70,6 +70,14 @@ class ValueNumberTable { // Assigns a value number to every result id in the module. void BuildDominatorTreeValueNumberTable(); + // Returns true if |inst| is a load from read-only memory. This is a cached + // version of |Instruction::IsReadOnlyLoad| that is local to this pass. + bool IsReadOnlyLoad(Instruction* inst); + + // Returns true if the variable pointed to by |address_def| is read-only. + // This is the part of |IsReadOnlyLoad| that is cached. + bool IsReadOnlyVariable(Instruction* address_def); + // Returns the new value number. uint32_t TakeNextValueNumber() { return next_value_number_++; } @@ -81,6 +89,10 @@ class ValueNumberTable { std::unordered_map instruction_to_value_; std::unordered_map id_to_value_; + // A cache for the results of |IsReadOnlyVariable|. The key is the base + // variable of a load. + std::unordered_map read_only_variable_cache_; + IRContext* context_; uint32_t next_value_number_; }; diff --git a/third_party/spirv-tools/source/parsed_operand.cpp b/third_party/spirv-tools/source/parsed_operand.cpp index 649b9d62e0..5b4c68c584 100644 --- a/third_party/spirv-tools/source/parsed_operand.cpp +++ b/third_party/spirv-tools/source/parsed_operand.cpp @@ -59,7 +59,10 @@ void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst, *out << spvtools::utils::FloatProxy( uint8_t(word & 0xFF)); break; - // TODO Bfloat16 + case SPV_FP_ENCODING_BFLOAT16: + *out << spvtools::utils::FloatProxy( + uint16_t(word & 0xFFFF)); + break; case SPV_FP_ENCODING_UNKNOWN: switch (operand.number_bit_width) { case 16: diff --git a/third_party/spirv-tools/source/reduce/CMakeLists.txt b/third_party/spirv-tools/source/reduce/CMakeLists.txt index 9ebe4183ef..b631e9d067 100644 --- a/third_party/spirv-tools/source/reduce/CMakeLists.txt +++ b/third_party/spirv-tools/source/reduce/CMakeLists.txt @@ -75,11 +75,6 @@ set(SPIRV_TOOLS_REDUCE_SOURCES structured_loop_to_selection_reduction_opportunity_finder.cpp ) -if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))) - # Enable parallel builds across four cores for this lib - add_definitions(/MP4) -endif() - spvtools_pch(SPIRV_TOOLS_REDUCE_SOURCES pch_source_reduce) add_library(SPIRV-Tools-reduce ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_REDUCE_SOURCES}) diff --git a/third_party/spirv-tools/source/table2.cpp b/third_party/spirv-tools/source/table2.cpp index 4559d77219..dc1bff3e6e 100644 --- a/third_party/spirv-tools/source/table2.cpp +++ b/third_party/spirv-tools/source/table2.cpp @@ -372,4 +372,69 @@ bool GetExtensionFromString(const char* name, Extension* extension) { return false; } +// This is dirty copy of the spirv.hpp11 function +// TODO - Use a generated version of this function +const char* StorageClassToString(spv::StorageClass value) { + switch (value) { + case spv::StorageClass::UniformConstant: + return "UniformConstant"; + case spv::StorageClass::Input: + return "Input"; + case spv::StorageClass::Uniform: + return "Uniform"; + case spv::StorageClass::Output: + return "Output"; + case spv::StorageClass::Workgroup: + return "Workgroup"; + case spv::StorageClass::CrossWorkgroup: + return "CrossWorkgroup"; + case spv::StorageClass::Private: + return "Private"; + case spv::StorageClass::Function: + return "Function"; + case spv::StorageClass::Generic: + return "Generic"; + case spv::StorageClass::PushConstant: + return "PushConstant"; + case spv::StorageClass::AtomicCounter: + return "AtomicCounter"; + case spv::StorageClass::Image: + return "Image"; + case spv::StorageClass::StorageBuffer: + return "StorageBuffer"; + case spv::StorageClass::TileImageEXT: + return "TileImageEXT"; + case spv::StorageClass::TileAttachmentQCOM: + return "TileAttachmentQCOM"; + case spv::StorageClass::NodePayloadAMDX: + return "NodePayloadAMDX"; + case spv::StorageClass::CallableDataKHR: + return "CallableDataKHR"; + case spv::StorageClass::IncomingCallableDataKHR: + return "IncomingCallableDataKHR"; + case spv::StorageClass::RayPayloadKHR: + return "RayPayloadKHR"; + case spv::StorageClass::HitAttributeKHR: + return "HitAttributeKHR"; + case spv::StorageClass::IncomingRayPayloadKHR: + return "IncomingRayPayloadKHR"; + case spv::StorageClass::ShaderRecordBufferKHR: + return "ShaderRecordBufferKHR"; + case spv::StorageClass::PhysicalStorageBuffer: + return "PhysicalStorageBuffer"; + case spv::StorageClass::HitObjectAttributeNV: + return "HitObjectAttributeNV"; + case spv::StorageClass::TaskPayloadWorkgroupEXT: + return "TaskPayloadWorkgroupEXT"; + case spv::StorageClass::CodeSectionINTEL: + return "CodeSectionINTEL"; + case spv::StorageClass::DeviceOnlyINTEL: + return "DeviceOnlyINTEL"; + case spv::StorageClass::HostOnlyINTEL: + return "HostOnlyINTEL"; + default: + return "Unknown"; + } +} + } // namespace spvtools diff --git a/third_party/spirv-tools/source/table2.h b/third_party/spirv-tools/source/table2.h index e3731c4329..1218fb26d2 100644 --- a/third_party/spirv-tools/source/table2.h +++ b/third_party/spirv-tools/source/table2.h @@ -256,5 +256,8 @@ bool GetExtensionFromString(const char* str, Extension* extension); // Returns text string corresponding to |extension|. const char* ExtensionToString(Extension extension); +/// Used to provide better error message +const char* StorageClassToString(spv::StorageClass value); + } // namespace spvtools #endif // SOURCE_TABLE2_H_ diff --git a/third_party/spirv-tools/source/text_handler.cpp b/third_party/spirv-tools/source/text_handler.cpp index 1f1f1e8c25..df0cc39d5a 100644 --- a/third_party/spirv-tools/source/text_handler.cpp +++ b/third_party/spirv-tools/source/text_handler.cpp @@ -336,7 +336,7 @@ spv_result_t AssemblyContext::recordTypeDefinition( return diagnostic() << "Invalid OpTypeFloat instruction"; spv_fp_encoding_t enc = SPV_FP_ENCODING_UNKNOWN; if (pInst->words.size() >= 4) { - const spvtools::OperandDesc* desc; + const spvtools::OperandDesc* desc = nullptr; spv_result_t status = spvtools::LookupOperand(SPV_OPERAND_TYPE_FPENCODING, pInst->words[3], &desc); if (status == SPV_SUCCESS) { diff --git a/third_party/spirv-tools/source/util/bitutils.h b/third_party/spirv-tools/source/util/bitutils.h index 2763bc273b..dbf6a9ca54 100644 --- a/third_party/spirv-tools/source/util/bitutils.h +++ b/third_party/spirv-tools/source/util/bitutils.h @@ -206,6 +206,23 @@ T ZeroExtendValue(T value, uint32_t number_of_bits) { return utils::ClearHighBits(value, bit_width - number_of_bits); } +// Returns the the least significant bit from |value|. +template +constexpr T LSB(T value) { + static_assert(std::is_integral::value, "LSB requires integer type"); + if constexpr (std::is_unsigned_v) { + // Prevent warnings about doing a -x on unsigned values. + return value & (~value + 1); + } else { + return value & -value; + } +} + +static_assert(LSB(UINT32_MAX) == uint32_t(0x00000001), "LSB failed"); +static_assert(LSB(0x10001000) == uint32_t(0x00001000), "LSB failed"); +static_assert(LSB(0x10000000) == uint32_t(0x10000000), "LSB failed"); +static_assert(LSB(-1) == int32_t(0x00000001), "LSB failed"); + } // namespace utils } // namespace spvtools diff --git a/third_party/spirv-tools/source/util/hex_float.h b/third_party/spirv-tools/source/util/hex_float.h index 83b1c09c27..9bb3203d92 100644 --- a/third_party/spirv-tools/source/util/hex_float.h +++ b/third_party/spirv-tools/source/util/hex_float.h @@ -103,6 +103,34 @@ class Float16 { uint16_t val; }; +class BFloat16 { + public: + BFloat16(uint16_t v) : val(v) {} + BFloat16() = default; + BFloat16(const BFloat16& other) { val = other.val; } + + // Exponent mask: 0x7F80, Mantissa mask: 0x007F + static bool isNan(const BFloat16& val) { + return ((val.val & 0x7F80) == 0x7F80) && ((val.val & 0x007F) != 0); + } + static bool isInfinity(const BFloat16& val) { + return ((val.val & 0x7F80) == 0x7F80) && ((val.val & 0x007F) == 0); + } + + uint16_t get_value() const { return val; } + + // a sign bit of 0, and an all 1 mantissa. + static BFloat16 max() { return BFloat16(0x7F7F); } + // a sign bit of 1, and an all 1 mantissa. + static BFloat16 lowest() { return BFloat16(0xFF7F); } + + private: + // 15: Sign + // 14-7: Exponent + // 6-0: Mantissa + uint16_t val; +}; + // To specialize this type, you must override uint_type to define // an unsigned integer that can fit your floating point type. // You must also add a isNan function that returns true if @@ -212,6 +240,24 @@ struct FloatProxyTraits { static uint32_t width() { return 16u; } }; +template <> +struct FloatProxyTraits { + using uint_type = uint16_t; + static bool isNan(BFloat16 f) { return BFloat16::isNan(f); } + // Returns true if the given value is any kind of infinity. + static bool isInfinity(BFloat16 f) { return BFloat16::isInfinity(f); } + // Returns the maximum normal value. + static BFloat16 max() { return BFloat16::max(); } + // Returns the lowest normal value. + static BFloat16 lowest() { return BFloat16::lowest(); } + // Returns the value as the native floating point format. + static BFloat16 getAsFloat(const uint_type& t) { return BFloat16(t); } + // Returns the bits from the given floating pointer number. + static uint_type getBitsFromFloat(const BFloat16& t) { return t.get_value(); } + // Returns the bitwidth. + static uint32_t width() { return 16u; } +}; + // Since copying a floating point number (especially if it is NaN) // does not guarantee that bits are preserved, this class lets us // store the type and use it as a float when necessary. @@ -403,6 +449,23 @@ struct HexFloatTraits> { static const uint_type NaN_pattern = 0x7c00; }; +// Traits for BFloat16. +// 1 sign bit, 7 exponent bits, 8 fractional bits. +template <> +struct HexFloatTraits> { + using uint_type = uint16_t; + using int_type = int16_t; + using underlying_type = FloatProxy; + using underlying_typetraits = FloatProxyTraits; + using native_type = uint16_t; + static const uint_type num_used_bits = 16; + static const uint_type num_exponent_bits = 8; + static const uint_type num_fraction_bits = 7; + static const uint_type exponent_bias = 127; + static const bool has_infinity = true; + static const uint_type NaN_pattern = 0x7F80; +}; + enum class round_direction { kToZero, kToNearestEven, @@ -1038,6 +1101,26 @@ ParseNormalFloat, HexFloatTraits>>( } return is; } + +// Same flow as Float16 +template <> +inline std::istream& +ParseNormalFloat, HexFloatTraits>>( + std::istream& is, bool negate_value, + HexFloat, HexFloatTraits>>& + value) { + HexFloat> float_val(0.0f); + ParseNormalFloat(is, negate_value, float_val); + + float_val.castTo(value, round_direction::kToZero); + + if (BFloat16::isInfinity(value.value().getAsFloat())) { + value.set_value(value.isNegative() ? BFloat16::lowest() : BFloat16::max()); + is.setstate(std::ios_base::failbit); + } + return is; +} + // Specialization of ParseNormalFloat for FloatProxy values. // This will parse the float as it were a 32-bit floating point number, // and then round it down to fit into a Float8_E4M3 value. @@ -1468,6 +1551,13 @@ inline std::ostream& operator<<(std::ostream& os, return os; } +template <> +inline std::ostream& operator<< (std::ostream& os, + const FloatProxy& value) { + os << HexFloat>(value); + return os; +} + template <> inline std::ostream& operator<< ( std::ostream& os, const FloatProxy& value) { diff --git a/third_party/spirv-tools/source/util/parse_number.cpp b/third_party/spirv-tools/source/util/parse_number.cpp index 3aa0752787..117e6f293e 100644 --- a/third_party/spirv-tools/source/util/parse_number.cpp +++ b/third_party/spirv-tools/source/util/parse_number.cpp @@ -185,7 +185,15 @@ EncodeNumberStatus ParseAndEncodeFloatingPointNumber( emit(static_cast(hVal.value().getAsFloat().get_value())); return EncodeNumberStatus::kSuccess; } break; - case SPV_FP_ENCODING_BFLOAT16: // FIXME this likely needs separate handling + case SPV_FP_ENCODING_BFLOAT16: { + HexFloat> hVal(0); + if (!ParseNumber(text, &hVal)) { + ErrorMsgStream(error_msg) << "Invalid bfloat16 literal: " << text; + return EncodeNumberStatus::kInvalidText; + } + emit(static_cast(hVal.value().getAsFloat().get_value())); + return EncodeNumberStatus::kSuccess; + } break; case SPV_FP_ENCODING_IEEE754_BINARY16: { HexFloat> hVal(0); if (!ParseNumber(text, &hVal)) { diff --git a/third_party/spirv-tools/source/util/small_vector.h b/third_party/spirv-tools/source/util/small_vector.h index 1838843876..c15ede1759 100644 --- a/third_party/spirv-tools/source/util/small_vector.h +++ b/third_party/spirv-tools/source/util/small_vector.h @@ -184,7 +184,8 @@ class SmallVector { } // Avoid infinite recursion from rewritten operators in C++20 -#if __cplusplus <= 201703L +#if (defined(_MSVC_LANG) && _MSVC_LANG <= 201703L) || \ + (!defined(_MSVC_LANG) && __cplusplus <= 201703L) friend bool operator==(const std::vector& lhs, const SmallVector& rhs) { return rhs == lhs; } diff --git a/third_party/spirv-tools/source/util/status.h b/third_party/spirv-tools/source/util/status.h new file mode 100644 index 0000000000..3799d38520 --- /dev/null +++ b/third_party/spirv-tools/source/util/status.h @@ -0,0 +1,31 @@ +// Copyright (c) 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_UTIL_STATUS_H_ +#define SOURCE_UTIL_STATUS_H_ + +namespace spvtools { +namespace utils { + +// The result of processing a module. +enum class Status { + Failure = 0x0, + SuccessWithChange = 0x10, + SuccessWithoutChange = 0x11 +}; + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_STATUS_H_ diff --git a/third_party/spirv-tools/source/val/validate.cpp b/third_party/spirv-tools/source/val/validate.cpp index f553a26d9f..27bb5cb878 100644 --- a/third_party/spirv-tools/source/val/validate.cpp +++ b/third_party/spirv-tools/source/val/validate.cpp @@ -64,9 +64,12 @@ void RegisterExtension(ValidationState_t& _, spv_result_t ProcessExtensions(void* user_data, const spv_parsed_instruction_t* inst) { const spv::Op opcode = static_cast(inst->opcode); - if (opcode == spv::Op::OpCapability) return SPV_SUCCESS; + if (opcode == spv::Op::OpCapability || + opcode == spv::Op::OpConditionalCapabilityINTEL) + return SPV_SUCCESS; - if (opcode == spv::Op::OpExtension) { + if (opcode == spv::Op::OpExtension || + opcode == spv::Op::OpConditionalExtensionINTEL) { ValidationState_t& _ = *(reinterpret_cast(user_data)); RegisterExtension(_, inst); return SPV_SUCCESS; @@ -115,10 +118,11 @@ spv_result_t ValidateEntryPoints(ValidationState_t& _) { _.ComputeFunctionToEntryPointMapping(); _.ComputeRecursiveEntryPoints(); - if (_.entry_points().empty() && !_.HasCapability(spv::Capability::Linkage)) { + if (_.entry_points().empty() && !_.HasCapability(spv::Capability::Linkage) && + !_.HasCapability(spv::Capability::GraphARM)) { return _.diag(SPV_ERROR_INVALID_BINARY, nullptr) << "No OpEntryPoint instruction was found. This is only allowed if " - "the Linkage capability is being used."; + "the Linkage or GraphARM capability is being used."; } for (const auto& entry_point : _.entry_points()) { @@ -151,6 +155,16 @@ spv_result_t ValidateEntryPoints(ValidationState_t& _) { return SPV_SUCCESS; } +spv_result_t ValidateGraphEntryPoints(ValidationState_t& _) { + if (_.graph_entry_points().empty() && + _.HasCapability(spv::Capability::GraphARM)) { + return _.diag(SPV_ERROR_INVALID_BINARY, nullptr) + << "No OpGraphEntryPointARM instruction was found but the GraphARM " + "capability is declared."; + } + return SPV_SUCCESS; +} + spv_result_t ValidateBinaryUsingContextAndValidationState( const spv_context_t& context, const uint32_t* words, const size_t num_words, spv_diagnostic* pDiagnostic, ValidationState_t* vstate) { @@ -217,43 +231,59 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( // able to, briefly, de-const the instruction. Instruction* inst = const_cast(&instruction); - if (inst->opcode() == spv::Op::OpEntryPoint) { - const auto entry_point = inst->GetOperandAs(1); - const auto execution_model = inst->GetOperandAs(0); - const std::string desc_name = inst->GetOperandAs(2); + if ((inst->opcode() == spv::Op::OpEntryPoint) || + (inst->opcode() == spv::Op::OpConditionalEntryPointINTEL)) { + const int i_model = inst->opcode() == spv::Op::OpEntryPoint ? 0 : 1; + const int i_point = inst->opcode() == spv::Op::OpEntryPoint ? 1 : 2; + const int i_name = inst->opcode() == spv::Op::OpEntryPoint ? 2 : 3; + const int min_num_operands = + inst->opcode() == spv::Op::OpEntryPoint ? 3 : 4; + + const auto entry_point = inst->GetOperandAs(i_point); + const auto execution_model = + inst->GetOperandAs(i_model); + const std::string desc_name = inst->GetOperandAs(i_name); ValidationState_t::EntryPointDescription desc; desc.name = desc_name; std::vector interfaces; - for (size_t j = 3; j < inst->operands().size(); ++j) + for (size_t j = min_num_operands; j < inst->operands().size(); ++j) desc.interfaces.push_back(inst->word(inst->operand(j).offset)); vstate->RegisterEntryPoint(entry_point, execution_model, std::move(desc)); - if (visited_entry_points.size() > 0) { - for (const Instruction* check_inst : visited_entry_points) { - const auto check_execution_model = - check_inst->GetOperandAs(0); - const std::string check_name = - check_inst->GetOperandAs(2); + if (inst->opcode() == spv::Op::OpEntryPoint) { + // conditional entry points are allowed to share the same name and + // exec mode + if (visited_entry_points.size() > 0) { + for (const Instruction* check_inst : visited_entry_points) { + const auto check_execution_model = + check_inst->GetOperandAs(i_model); + const std::string check_name = + check_inst->GetOperandAs(i_name); - if (desc_name == check_name && - execution_model == check_execution_model) { - return vstate->diag(SPV_ERROR_INVALID_DATA, inst) - << "2 Entry points cannot share the same name and " - "ExecutionMode."; + if (desc_name == check_name && + execution_model == check_execution_model) { + return vstate->diag(SPV_ERROR_INVALID_DATA, inst) + << "2 Entry points cannot share the same name and " + "ExecutionMode."; + } } } + visited_entry_points.push_back(inst); } - visited_entry_points.push_back(inst); has_mask_task_nv |= (execution_model == spv::ExecutionModel::TaskNV || execution_model == spv::ExecutionModel::MeshNV); has_mask_task_ext |= (execution_model == spv::ExecutionModel::TaskEXT || execution_model == spv::ExecutionModel::MeshEXT); } + if (inst->opcode() == spv::Op::OpGraphEntryPointARM) { + const auto graph = inst->GetOperandAs(1); + vstate->RegisterGraphEntryPoint(graph); + } if (inst->opcode() == spv::Op::OpFunctionCall) { if (!vstate->in_function_body()) { return vstate->diag(SPV_ERROR_INVALID_LAYOUT, &instruction) @@ -299,6 +329,10 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) << "Missing OpFunctionEnd at end of module."; + if (vstate->graph_definition_region() != kGraphDefinitionOutside) + return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) + << "Missing OpGraphEndARM at end of module."; + if (vstate->HasCapability(spv::Capability::BindlessTextureNV) && !vstate->has_samplerimage_variable_address_mode_specified()) return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) @@ -314,7 +348,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( if (auto error = ValidateForwardDecls(*vstate)) return error; // Calculate reachability after all the blocks are parsed, but early that it - // can be relied on in subsequent pases. + // can be relied on in subsequent passes. ReachabilityPass(*vstate); // ID usage needs be handled in its own iteration of the instructions, @@ -365,9 +399,11 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( if (auto error = RayQueryPass(*vstate, &instruction)) return error; if (auto error = RayTracingPass(*vstate, &instruction)) return error; if (auto error = RayReorderNVPass(*vstate, &instruction)) return error; + if (auto error = RayReorderEXTPass(*vstate, &instruction)) return error; if (auto error = MeshShadingPass(*vstate, &instruction)) return error; if (auto error = TensorLayoutPass(*vstate, &instruction)) return error; if (auto error = TensorPass(*vstate, &instruction)) return error; + if (auto error = GraphPass(*vstate, &instruction)) return error; if (auto error = InvalidTypePass(*vstate, &instruction)) return error; } @@ -377,6 +413,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( if (auto error = ValidateAdjacency(*vstate)) return error; if (auto error = ValidateEntryPoints(*vstate)) return error; + if (auto error = ValidateGraphEntryPoints(*vstate)) return error; // CFG checks are performed after the binary has been parsed // and the CFGPass has collected information about the control flow if (auto error = PerformCfgChecks(*vstate)) return error; @@ -394,6 +431,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( if (auto error = ValidateQCOMImageProcessingTextureUsages(*vstate, &inst)) return error; } + if (auto error = ValidateLogicalPointers(*vstate)) return error; return SPV_SUCCESS; } diff --git a/third_party/spirv-tools/source/val/validate.h b/third_party/spirv-tools/source/val/validate.h index 2b4dee2c04..b21972e0bd 100644 --- a/third_party/spirv-tools/source/val/validate.h +++ b/third_party/spirv-tools/source/val/validate.h @@ -195,8 +195,8 @@ spv_result_t NonUniformPass(ValidationState_t& _, const Instruction* inst); /// Validates correctness of debug instructions. spv_result_t DebugPass(ValidationState_t& _, const Instruction* inst); -// Validates that capability declarations use operands allowed in the current -// context. +/// Validates that capability declarations use operands allowed in the current +/// context. spv_result_t CapabilityPass(ValidationState_t& _, const Instruction* inst); /// Validates correctness of primitive instructions. @@ -220,12 +220,18 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst); /// Validates correctness of shader execution reorder instructions. spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst); +/// Validates correctness of shader execution reorder EXT instructions. +spv_result_t RayReorderEXTPass(ValidationState_t& _, const Instruction* inst); + /// Validates correctness of mesh shading instructions. spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst); /// Validates correctness of tensor instructions. spv_result_t TensorPass(ValidationState_t& _, const Instruction* inst); +/// Validates correctness of graph instructions. +spv_result_t GraphPass(ValidationState_t& _, const Instruction* inst); + /// Validates correctness of certain special type instructions. spv_result_t InvalidTypePass(ValidationState_t& _, const Instruction* inst); @@ -256,6 +262,9 @@ spv_result_t ValidateSmallTypeUses(ValidationState_t& _, spv_result_t ValidateQCOMImageProcessingTextureUsages(ValidationState_t& _, const Instruction* inst); +/// Validates logical pointer restrictions. +spv_result_t ValidateLogicalPointers(ValidationState_t& _); + /// @brief Validate the ID's within a SPIR-V binary /// /// @param[in] pInstructions array of instructions diff --git a/third_party/spirv-tools/source/val/validate_annotation.cpp b/third_party/spirv-tools/source/val/validate_annotation.cpp index eaca8f0f79..73448e81da 100644 --- a/third_party/spirv-tools/source/val/validate_annotation.cpp +++ b/third_party/spirv-tools/source/val/validate_annotation.cpp @@ -37,6 +37,8 @@ bool DecorationTakesIdParameters(spv::Decoration type) { case spv::Decoration::PayloadNodeArraySizeAMDX: case spv::Decoration::PayloadNodeNameAMDX: case spv::Decoration::PayloadNodeBaseIndexAMDX: + case spv::Decoration::ArrayStrideIdEXT: + case spv::Decoration::OffsetIdEXT: return true; default: break; @@ -65,6 +67,7 @@ bool IsNotMemberDecoration(spv::Decoration dec) { case spv::Decoration::Block: case spv::Decoration::BufferBlock: case spv::Decoration::ArrayStride: + case spv::Decoration::ArrayStrideIdEXT: case spv::Decoration::GLSLShared: case spv::Decoration::GLSLPacked: case spv::Decoration::CPacked: @@ -174,7 +177,8 @@ spv_result_t ValidateDecorationTarget(ValidationState_t& _, spv::Decoration dec, if (target->opcode() != spv::Op::OpVariable && target->opcode() != spv::Op::OpUntypedVariableKHR && target->opcode() != spv::Op::OpFunctionParameter && - target->opcode() != spv::Op::OpRawAccessChainNV) { + target->opcode() != spv::Op::OpRawAccessChainNV && + target->opcode() != spv::Op::OpBufferPointerEXT) { return fail(0) << "must be a memory object declaration"; } if (!_.IsPointerType(target->type_id())) { @@ -217,6 +221,7 @@ spv_result_t ValidateDecorationTarget(ValidationState_t& _, spv::Decoration dec, sc != spv::StorageClass::IncomingCallableDataKHR && sc != spv::StorageClass::ShaderRecordBufferKHR && sc != spv::StorageClass::HitObjectAttributeNV && + sc != spv::StorageClass::HitObjectAttributeEXT && sc != spv::StorageClass::TileImageEXT) { return _.diag(SPV_ERROR_INVALID_ID, target) << _.VkErrorID(6672) << _.SpvDecorationString(dec) @@ -333,6 +338,14 @@ spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { } spv_result_t ValidateDecorateId(ValidationState_t& _, const Instruction* inst) { + const auto target_id = inst->GetOperandAs(0); + const auto target = _.FindDef(target_id); + if (target && spv::Op::OpDecorationGroup == target->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpMemberDecorate Target " << _.getIdName(target_id) + << " must not be an OpDecorationGroup instruction."; + } + const auto decoration = inst->GetOperandAs(1); if (!DecorationTakesIdParameters(decoration)) { return _.diag(SPV_ERROR_INVALID_ID, inst) @@ -340,6 +353,47 @@ spv_result_t ValidateDecorateId(ValidationState_t& _, const Instruction* inst) { "OpDecorateId"; } + if (decoration == spv::Decoration::ArrayStrideIdEXT) { + if (target->opcode() != spv::Op::OpTypeArray && + target->opcode() != spv::Op::OpTypeRuntimeArray) { + // ArrayStrideIdEXT is suppose to identical to ArrayStride, which would + // allow it to be a OpTypePointer/OpTypeUntypedPointerKHR + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "ArrayStrideIdEXT decoration must only be applied to array " + "types."; + } else { + const uint32_t operand_id = inst->GetOperandAs(2); + if (!_.IsIntScalarType(_.GetTypeId(operand_id), 32)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "ArrayStrideIdEXT extra operand must be a 32-bit int " + "scalar type."; + } + + // Strip array and should be the descriptor type + const uint32_t element_type = + _.FindDef(target_id)->GetOperandAs(1); + if (!_.IsDescriptorType(element_type)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "ArrayStrideIdEXT decoration must only be applied to" + << " array type containing a Descriptor type."; + } + } + } + + for (uint32_t i = 2; i < inst->operands().size(); ++i) { + const auto param_id = inst->GetOperandAs(i); + const auto param = _.FindDef(param_id); + + // Both target and param are elements of ordered_instructions we can + // determine their relative positions in the SPIR-V module by comparing + // pointers. + if (target <= param) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Parameter " << _.getIdName(param_id) + << " must appear earlier in the binary than the target"; + } + } + // No member decorations take id parameters, so we don't bother checking if // we are using a member only decoration here. @@ -352,24 +406,70 @@ spv_result_t ValidateMemberDecorate(ValidationState_t& _, const Instruction* inst) { const auto struct_type_id = inst->GetOperandAs(0); const auto struct_type = _.FindDef(struct_type_id); + const bool is_mem_dec_id_inst = + (inst->opcode() == spv::Op::OpMemberDecorateIdEXT); if (!struct_type || spv::Op::OpTypeStruct != struct_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpMemberDecorate Structure type " - << _.getIdName(struct_type_id) << " is not a struct type."; + << (is_mem_dec_id_inst ? "OpMemberDecorateIdEXT" + : "OpMemberDecorate") + << " Structure type " << _.getIdName(struct_type_id) + << " is not a struct type."; } const auto member = inst->GetOperandAs(1); const auto member_count = static_cast(struct_type->words().size() - 2); if (member_count <= member) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Index " << member - << " provided in OpMemberDecorate for struct " - << _.getIdName(struct_type_id) + << "Index " << member << " provided in " + << (is_mem_dec_id_inst ? "OpMemberDecorateIdEXT" + : "OpMemberDecorate") + << " for struct " << _.getIdName(struct_type_id) << " is out of bounds. The structure has " << member_count << " members. Largest valid index is " << member_count - 1 << "."; } const auto decoration = inst->GetOperandAs(2); + if (is_mem_dec_id_inst) { + if (decoration != spv::Decoration::OffsetIdEXT) { + if (decoration == spv::Decoration::ArrayStrideIdEXT) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "ArrayStrideIdEXT could only be directly applied" + << " to array type using OpDecorateId."; + } else { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Decoration operand could only be OffsetIdEXT."; + } + } + + const auto is_descriptor_type = [&_](const Instruction* type_inst) { + return _.IsDescriptorType(type_inst->opcode()); + }; + + // recursively scans the struct to find if anything has a descriptor type, + // must be at least 1 + if (decoration == spv::Decoration::OffsetIdEXT) { + const uint32_t operand_id = inst->GetOperandAs(3); + if (!_.IsIntScalarType(_.GetTypeId(operand_id), 32)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OffsetIdEXT extra operand must be a 32-bit int scalar type."; + } + if (!_.ContainsType(struct_type_id, is_descriptor_type, true)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OffsetIdEXT decoration in MemberDecorateIdEXT must only be " + "applied to members of structs where the struct contains " + "descriptor types."; + } + } + + for (uint32_t elem_idx = 3; elem_idx < inst->operands().size(); + elem_idx++) { + if (_.FindDef(inst->GetOperandAs(elem_idx)) > struct_type) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "All Extra Operands must appear before Structure Type."; + } + } + } + if (IsNotMemberDecoration(decoration)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.SpvDecorationString(decoration) @@ -388,8 +488,7 @@ spv_result_t ValidateDecorationGroup(ValidationState_t& _, if (use->opcode() != spv::Op::OpDecorate && use->opcode() != spv::Op::OpGroupDecorate && use->opcode() != spv::Op::OpGroupMemberDecorate && - use->opcode() != spv::Op::OpName && - use->opcode() != spv::Op::OpDecorateId && !use->IsNonSemantic()) { + use->opcode() != spv::Op::OpName && !use->IsNonSemantic()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Result id of OpDecorationGroup can only " << "be targeted by OpName, OpGroupDecorate, " @@ -475,7 +574,8 @@ spv_result_t RegisterDecorations(ValidationState_t& _, _.RegisterDecorationForId(target_id, Decoration(dec_type, dec_params)); break; } - case spv::Op::OpMemberDecorate: { + case spv::Op::OpMemberDecorate: + case spv::Op::OpMemberDecorateIdEXT: { const uint32_t struct_id = inst->word(1); const uint32_t index = inst->word(2); const spv::Decoration dec_type = @@ -546,6 +646,7 @@ spv_result_t AnnotationPass(ValidationState_t& _, const Instruction* inst) { // TODO(dneto): spv::Op::OpDecorateStringGOOGLE // See https://github.com/KhronosGroup/SPIRV-Tools/issues/2253 case spv::Op::OpMemberDecorate: + case spv::Op::OpMemberDecorateIdEXT: if (auto error = ValidateMemberDecorate(_, inst)) return error; break; case spv::Op::OpDecorationGroup: diff --git a/third_party/spirv-tools/source/val/validate_arithmetics.cpp b/third_party/spirv-tools/source/val/validate_arithmetics.cpp index 38281be389..eb30274043 100644 --- a/third_party/spirv-tools/source/val/validate_arithmetics.cpp +++ b/third_party/spirv-tools/source/val/validate_arithmetics.cpp @@ -36,7 +36,8 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpFDiv: case spv::Op::OpFRem: case spv::Op::OpFMod: - case spv::Op::OpFNegate: { + case spv::Op::OpFNegate: + case spv::Op::OpFmaKHR: { bool supportsCoopMat = (opcode != spv::Op::OpFMul && opcode != spv::Op::OpFRem && opcode != spv::Op::OpFMod); diff --git a/third_party/spirv-tools/source/val/validate_atomics.cpp b/third_party/spirv-tools/source/val/validate_atomics.cpp index 990ed31518..443e9709d2 100644 --- a/third_party/spirv-tools/source/val/validate_atomics.cpp +++ b/third_party/spirv-tools/source/val/validate_atomics.cpp @@ -224,7 +224,7 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { } // Can't use result_type because OpAtomicStore doesn't have a result - if (_.IsIntScalarType(data_type) && _.GetBitWidth(data_type) == 64 && + if (_.IsIntScalarType(data_type, 64) && !_.HasCapability(spv::Capability::Int64Atomics)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) @@ -235,7 +235,9 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { if (!IsStorageClassAllowedByUniversalRules(storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) - << ": storage class forbidden by universal validation rules."; + << ": Can not be used with storage class " + << spvtools::StorageClassToString(storage_class) + << " by universal validation rules"; } // Then Shader rules @@ -249,8 +251,10 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { (storage_class != spv::StorageClass::PhysicalStorageBuffer) && (storage_class != spv::StorageClass::TaskPayloadWorkgroupEXT)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4686) << spvOpcodeString(opcode) - << ": Vulkan spec only allows storage classes for atomic to " + << _.VkErrorID(4686) << spvOpcodeString(opcode) << ": " + << spvtools::StorageClassToString(storage_class) + << " is not allowed, the Vulkan spec only allows storage " + "classes for atomic to " "be: Uniform, Workgroup, Image, StorageBuffer, " "PhysicalStorageBuffer or TaskPayloadWorkgroupEXT."; } @@ -335,8 +339,9 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { (storage_class != spv::StorageClass::CrossWorkgroup) && (storage_class != spv::StorageClass::Generic)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": storage class must be Function, Workgroup, " + << spvOpcodeString(opcode) << ": storage class is " + << spvtools::StorageClassToString(storage_class) + << ", but must be Function, Workgroup, " "CrossWorkGroup or Generic in the OpenCL environment."; } @@ -352,7 +357,7 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { // If result and pointer type are different, need to do special check here if (opcode == spv::Op::OpAtomicFlagTestAndSet || opcode == spv::Op::OpAtomicFlagClear) { - if (!_.IsIntScalarType(data_type) || _.GetBitWidth(data_type) != 32) { + if (!_.IsIntScalarType(data_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Pointer to point to a value of 32-bit integer " @@ -388,27 +393,6 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { if (auto error = ValidateMemorySemantics( _, inst, unequal_semantics_index, memory_scope)) return error; - - // Volatile bits must match for equal and unequal semantics. Previous - // checks guarantee they are 32-bit constants, but we need to recheck - // whether they are evaluatable constants. - bool is_int32 = false; - bool is_equal_const = false; - bool is_unequal_const = false; - uint32_t equal_value = 0; - uint32_t unequal_value = 0; - std::tie(is_int32, is_equal_const, equal_value) = _.EvalInt32IfConst( - inst->GetOperandAs(equal_semantics_index)); - std::tie(is_int32, is_unequal_const, unequal_value) = - _.EvalInt32IfConst( - inst->GetOperandAs(unequal_semantics_index)); - if (is_equal_const && is_unequal_const && - ((equal_value & uint32_t(spv::MemorySemanticsMask::Volatile)) ^ - (unequal_value & uint32_t(spv::MemorySemanticsMask::Volatile)))) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Volatile mask setting must match for Equal and Unequal " - "memory semantics"; - } } if (opcode == spv::Op::OpAtomicStore) { diff --git a/third_party/spirv-tools/source/val/validate_barriers.cpp b/third_party/spirv-tools/source/val/validate_barriers.cpp index 0abd5c8599..43a2e862c4 100644 --- a/third_party/spirv-tools/source/val/validate_barriers.cpp +++ b/third_party/spirv-tools/source/val/validate_barriers.cpp @@ -45,10 +45,10 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { model != spv::ExecutionModel::MeshNV) { if (message) { *message = - "OpControlBarrier requires one of the following " - "Execution " - "Models: TessellationControl, GLCompute, Kernel, " - "MeshNV or TaskNV"; + "In SPIR-V 1.2 or earlier, OpControlBarrier requires " + "one of the following " + "Execution Models: TessellationControl, GLCompute, " + "Kernel, MeshNV or TaskNV"; } return false; } @@ -94,8 +94,7 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t subgroup_count_type = _.GetOperandTypeId(inst, 2); - if (!_.IsIntScalarType(subgroup_count_type) || - _.GetBitWidth(subgroup_count_type) != 32) { + if (!_.IsIntScalarType(subgroup_count_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Subgroup Count to be a 32-bit int"; diff --git a/third_party/spirv-tools/source/val/validate_builtins.cpp b/third_party/spirv-tools/source/val/validate_builtins.cpp index 549eac8a8c..130d5fbaa8 100644 --- a/third_party/spirv-tools/source/val/validate_builtins.cpp +++ b/third_party/spirv-tools/source/val/validate_builtins.cpp @@ -17,21 +17,22 @@ // Validates correctness of built-in variables. #include +#include #include #include #include #include #include -#include #include +#include #include #include "source/opcode.h" #include "source/spirv_target_env.h" -#include "source/util/bitutils.h" #include "source/val/instruction.h" #include "source/val/validate.h" #include "source/val/validation_state.h" +#include "spirv/unified1/spirv.hpp11" namespace spvtools { namespace val { @@ -122,7 +123,7 @@ typedef enum VUIDError_ { VUIDErrorMax, } VUIDError; -const static uint32_t NumVUIDBuiltins = 40; +const static uint32_t NumVUIDBuiltins = 41; typedef struct { spv::BuiltIn builtIn; @@ -169,6 +170,7 @@ std::array builtinVUIDInfo = {{ {spv::BuiltIn::CullMaskKHR, {6735, 6736, 6737}}, {spv::BuiltIn::BaryCoordKHR, {4154, 4155, 4156}}, {spv::BuiltIn::BaryCoordNoPerspKHR, {4160, 4161, 4162}}, + {spv::BuiltIn::LocalInvocationIndex, {4284, 4285, 4286}}, {spv::BuiltIn::PrimitivePointIndicesEXT, {7041, 7043, 7044}}, {spv::BuiltIn::PrimitiveLineIndicesEXT, {7047, 7049, 7050}}, {spv::BuiltIn::PrimitiveTriangleIndicesEXT, {7053, 7055, 7056}}, @@ -367,6 +369,9 @@ class BuiltInsValidator { spv_result_t ValidateShadingRateAtDefinition(const Decoration& decoration, const Instruction& inst); + spv_result_t ValidateDescriptorHeapAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateRayTracingBuiltinsAtDefinition( const Decoration& decoration, const Instruction& inst); @@ -374,11 +379,16 @@ class BuiltInsValidator { const Decoration& decoration, const Instruction& inst); // Used as a common method for validating MeshEXT builtins - spv_result_t ValidateMeshEXTBuiltinInterfaceRules( + spv_result_t ValidateMeshBuiltinInterfaceRules( const Decoration& decoration, const Instruction& inst, - spv::Op scalar_type, uint32_t array_type_vuid, uint32_t array_size_vuid, - uint32_t block_array_size_vuid, uint32_t interface_vuid, - uint32_t perprim_deco_vuid); + spv::Op scalar_type, const Instruction& referenced_from_inst); + spv_result_t ValidatePrimitiveShadingRateInterfaceRules( + const Decoration& decoration, const Instruction& inst, + const Instruction& referenced_from_inst); + // Builtin that needs check incase **not** used with MeshEXT + spv_result_t ValidateNonMeshInterfaceRules( + const Decoration& decoration, const Instruction& inst, + const Instruction& referenced_from_inst); // The following section contains functions which are called when id defined // by |referenced_inst| is @@ -689,19 +699,44 @@ class BuiltInsValidator { // instruction. void Update(const Instruction& inst); + bool IsBulitinInEntryPoint(const Instruction& inst, uint32_t entry_point) { + auto get_underlying_type_id = [&](const Instruction* ifx_var) { + auto pointer_type_inst = _.FindDef(ifx_var->type_id()); + auto type_inst = _.FindDef(pointer_type_inst->GetOperandAs(2)); + while (type_inst->opcode() == spv::Op::OpTypeArray) { + type_inst = _.FindDef(type_inst->GetOperandAs(1)); + }; + return type_inst->id(); + }; + + for (const auto& desc : _.entry_point_descriptions(entry_point)) { + for (auto interface : desc.interfaces) { + if (inst.opcode() == spv::Op::OpTypeStruct) { + auto varInst = _.FindDef(interface); + if (inst.id() == get_underlying_type_id(varInst)) { + return true; + } + } else if (inst.id() == interface) { + return true; + } + } + } + return false; + } + // Check if "inst" is an interface variable or type of a interface varibale // of any mesh entry point. Populate entry_point_interface_id with all // entry points and interface variables that refer to the "inst" - bool isMeshInterfaceVar( + bool IsMeshInterfaceVar( const Instruction& inst, std::map& entry_point_interface_id) { - auto getUnderlyingTypeId = [&](const Instruction* ifxVar) { - auto pointerTypeInst = _.FindDef(ifxVar->type_id()); - auto typeInst = _.FindDef(pointerTypeInst->GetOperandAs(2)); - while (typeInst->opcode() == spv::Op::OpTypeArray) { - typeInst = _.FindDef(typeInst->GetOperandAs(1)); + auto get_underlying_type_id = [&](const Instruction* ifx_var) { + auto pointer_type_inst = _.FindDef(ifx_var->type_id()); + auto type_inst = _.FindDef(pointer_type_inst->GetOperandAs(2)); + while (type_inst->opcode() == spv::Op::OpTypeArray) { + type_inst = _.FindDef(type_inst->GetOperandAs(1)); }; - return typeInst->id(); + return type_inst->id(); }; for (const uint32_t entry_point : _.entry_points()) { @@ -712,7 +747,7 @@ class BuiltInsValidator { for (auto interface : desc.interfaces) { if (inst.opcode() == spv::Op::OpTypeStruct) { auto varInst = _.FindDef(interface); - if (inst.id() == getUnderlyingTypeId(varInst)) { + if (inst.id() == get_underlying_type_id(varInst)) { entry_point_interface_id[entry_point] = interface; break; } @@ -727,21 +762,6 @@ class BuiltInsValidator { return !entry_point_interface_id.empty(); } - bool HasInterfaceVariableForMeshEntryPoint(spv::BuiltIn builtin, - uint32_t entry_point) { - const auto& entry_points = mesh_builtin_entry_point_.find(builtin); - if (entry_points == mesh_builtin_entry_point_.end()) return false; - - return std::any_of( - entry_points->second.begin(), entry_points->second.end(), - [entry_point](const uint32_t& ep) { return entry_point == ep; }); - } - void RegisterMeshEntryPointForBuiltin(spv::BuiltIn builtin, - uint32_t entry_point) { - auto& entry_points = mesh_builtin_entry_point_[builtin]; - entry_points.insert(entry_point); - } - ValidationState_t& _; // Mapping id -> list of rules which validate instruction referencing the @@ -763,9 +783,9 @@ class BuiltInsValidator { // Execution models with which the current function can be called. std::set execution_models_; - // Mesh Builtins which are part of interface variables corresponding to an - // entry point - std::map> mesh_builtin_entry_point_; + // For Builtin that can only be declared once in an entry point, keep track if + // the entry point has it already + std::set cull_primitive_entry_points_; }; void BuiltInsValidator::Update(const Instruction& inst) { @@ -917,9 +937,9 @@ spv_result_t BuiltInsValidator::ValidateBlockTypeOrArrayedType( } break; case spv::Op::OpTypeInt: - if (!_.IsSignedIntScalarType(underlying_type)) { + if (!_.IsIntScalarType(underlying_type)) { return diag(GetDefinitionDesc(decoration, inst) + - " is not a signed integer scalar."); + " is not an integer scalar."); } break; default: @@ -2272,51 +2292,6 @@ spv_result_t BuiltInsValidator::ValidatePositionAtReference( spv_result_t BuiltInsValidator::ValidatePrimitiveIdAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { - if (_.HasCapability(spv::Capability::MeshShadingEXT)) { - uint32_t array_type_vuid = 10595; - uint32_t interface_vuid = 0; - uint32_t array_size_vuid = 10596; - uint32_t block_array_size_vuid = 10597; - uint32_t perprim_deco_vuid = 7040; - if (spv_result_t error = ValidateMeshEXTBuiltinInterfaceRules( - decoration, inst, spv::Op::OpTypeInt, array_type_vuid, - array_size_vuid, block_array_size_vuid, interface_vuid, - perprim_deco_vuid)) { - return error; - } - } - // PrimitiveId can be a per-primitive variable for mesh shader stage. - // In such cases variable will have an array of 32-bit integers. - else if (decoration.struct_member_index() != Decoration::kInvalidMember) { - // This must be a 32-bit int scalar. - if (spv_result_t error = ValidateI32( - decoration, inst, - [this, &inst](const std::string& message) -> spv_result_t { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(4337) - << "According to the Vulkan spec BuiltIn PrimitiveId " - "variable needs to be a 32-bit int scalar. " - << message; - })) { - return error; - } - } else { - if (spv_result_t error = ValidateOptionalArrayedI32( - decoration, inst, - [this, &inst](const std::string& message) -> spv_result_t { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(4337) - << "According to the Vulkan spec BuiltIn PrimitiveId " - "variable needs to be a 32-bit int scalar. " - << message; - })) { - return error; - } - } - } - - // Seed at reference checks with this built-in. return ValidatePrimitiveIdAtReference(decoration, inst, inst, inst); } @@ -2396,6 +2371,14 @@ spv_result_t BuiltInsValidator::ValidatePrimitiveIdAtReference( referenced_from_inst, std::placeholders::_1)); } + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateMeshBuiltinInterfaceRules, this, decoration, + built_in_inst, spv::Op::OpTypeInt, std::placeholders::_1)); + + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateNonMeshInterfaceRules, this, + decoration, built_in_inst, std::placeholders::_1)); + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { case spv::ExecutionModel::Fragment: @@ -2692,6 +2675,13 @@ spv_result_t BuiltInsValidator::ValidateTessLevelOuterAtDefinition( })) { return error; } + + if (!_.HasDecoration(inst.id(), spv::Decoration::Patch)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(10880) + << "BuiltIn TessLevelOuter variable needs to also have a Patch " + "decoration."; + } } // Seed at reference checks with this built-in. @@ -2706,13 +2696,20 @@ spv_result_t BuiltInsValidator::ValidateTessLevelInnerAtDefinition( [this, &inst](const std::string& message) -> spv_result_t { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << _.VkErrorID(4397) - << "According to the Vulkan spec BuiltIn TessLevelOuter " + << "According to the Vulkan spec BuiltIn TessLevelInner " "variable needs to be a 2-component 32-bit float " "array. " << message; })) { return error; } + + if (!_.HasDecoration(inst.id(), spv::Decoration::Patch)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(10880) + << "BuiltIn TessLevelInner variable needs to also have a Patch " + "decoration."; + } } // Seed at reference checks with this built-in. @@ -2836,14 +2833,69 @@ spv_result_t BuiltInsValidator::ValidateVertexIdAtDefinition( spv_result_t BuiltInsValidator::ValidateLocalInvocationIndexAtDefinition( const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + uint32_t vuid = GetVUIDForBuiltin( + spv::BuiltIn::LocalInvocationIndex, VUIDErrorType); + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(vuid) + << "According to the Vulkan spec BuiltIn " + "LocalInvocationIndex variable needs to be a 32-bit " + "int scalar. " + << message; + })) { + return error; + } + } + // Seed at reference checks with this built-in. return ValidateLocalInvocationIndexAtReference(decoration, inst, inst, inst); } spv_result_t BuiltInsValidator::ValidateLocalInvocationIndexAtReference( const Decoration& decoration, const Instruction& built_in_inst, - const Instruction&, + const Instruction& referenced_inst, const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const spv::StorageClass storage_class = + GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { + uint32_t vuid = GetVUIDForBuiltin(spv::BuiltIn::LocalInvocationIndex, + VUIDErrorStorageClass); + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << _.VkErrorID(vuid) + << "Vulkan spec allows BuiltIn LocalInvocationIndex to be only " + "used for variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const spv::ExecutionModel execution_model : execution_models_) { + bool has_vulkan_model = + execution_model == spv::ExecutionModel::GLCompute || + execution_model == spv::ExecutionModel::TaskNV || + execution_model == spv::ExecutionModel::MeshNV || + execution_model == spv::ExecutionModel::TaskEXT || + execution_model == spv::ExecutionModel::MeshEXT; + + if (spvIsVulkanEnv(_.context()->target_env) && !has_vulkan_model) { + uint32_t vuid = GetVUIDForBuiltin(spv::BuiltIn::LocalInvocationIndex, + VUIDErrorExecutionModel); + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << _.VkErrorID(vuid) + << "Vulkan spec allows BuiltIn LocalInvocationIndex to be used " + "only with GLCompute, MeshNV, TaskNV, MeshEXT or" + << " TaskEXT execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + if (function_id_ == 0) { // Propagate this rule to all dependant ids in the global scope. id_to_at_reference_checks_[referenced_from_inst.id()].push_back( @@ -2895,139 +2947,270 @@ spv_result_t BuiltInsValidator::ValidateVertexIndexAtReference( return SPV_SUCCESS; } -spv_result_t BuiltInsValidator::ValidateMeshEXTBuiltinInterfaceRules( - const Decoration& decoration, const Instruction& inst, spv::Op scalar_type, - uint32_t array_type_vuid, uint32_t array_size_vuid, - uint32_t block_array_size_vuid, uint32_t interface_vuid, - uint32_t perprim_deco_vuid) { - bool is_block = false; - const spv::BuiltIn builtin = decoration.builtin(); - // Validate the type of the builtin and if it's part of a block or an array - if (spv_result_t error = ValidateBlockTypeOrArrayedType( - decoration, inst, is_block, scalar_type, - [this, &inst, &decoration, - &array_type_vuid](const std::string& message) -> spv_result_t { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(array_type_vuid) << "According to the " - << spvLogStringForEnv(_.context()->target_env) - << " spec BuiltIn " - << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, - (uint32_t)decoration.builtin()) - << " variable needs to be a either a boolean or an " - "array of booleans." - << message; - })) { - return error; - } +typedef struct { + uint32_t array_type; + uint32_t array_size; + uint32_t block_array_size; + uint32_t perprim_deco; +} MeshBuiltinVUIDs; - // Validate that the builtin is part of the mesh interface - std::map entry_interface_id_map; - bool found = isMeshInterfaceVar(inst, entry_interface_id_map); - if (!found) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(interface_vuid) << "Declaration of builtin type" - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - (uint32_t)builtin) - << " not found as interface variable of any meshEXT entry point. "; - } - for (const auto& id : entry_interface_id_map) { - uint32_t entry_point_id = id.first; - uint32_t interface_var_id = id.second; - if (!HasInterfaceVariableForMeshEntryPoint(builtin, entry_point_id)) { - RegisterMeshEntryPointForBuiltin(decoration.builtin(), entry_point_id); - } else { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(interface_vuid) - << "There must be only one declaration of the " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - (uint32_t)builtin) - << " associated with a entry point's interface. " - << GetIdDesc(*_.FindDef(interface_var_id)); +spv_result_t BuiltInsValidator::ValidateMeshBuiltinInterfaceRules( + const Decoration& decoration, const Instruction& inst, spv::Op scalar_type, + const Instruction& referenced_from_inst) { + if (function_id_) { + if (!execution_models_.count(spv::ExecutionModel::MeshEXT)) { + return SPV_SUCCESS; } - if (GetArrayLength(interface_var_id) != - _.GetOutputPrimitivesEXT(entry_point_id)) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(is_block ? block_array_size_vuid : array_size_vuid) - << " The size of the array decorated with " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - (uint32_t)builtin) - << " must match the value specified by OutputPrimitivesEXT. "; + + const spv::BuiltIn builtin = decoration.builtin(); + const bool is_topology = + builtin == spv::BuiltIn::PrimitiveTriangleIndicesEXT || + builtin == spv::BuiltIn::PrimitiveLineIndicesEXT || + builtin == spv::BuiltIn::PrimitivePointIndicesEXT; + + // These builtin have the ability to be an array with MeshEXT + // When an array, we need to make sure the array size lines up + std::map entry_interface_id_map; + const bool is_interface_var = + IsMeshInterfaceVar(inst, entry_interface_id_map); + + if (!is_topology) { + bool is_block = false; + + static const std::unordered_map + mesh_vuid_map = {{ + {spv::BuiltIn::CullPrimitiveEXT, {7036, 10589, 10590, 7038}}, + {spv::BuiltIn::PrimitiveId, {10595, 10596, 10597, 7040}}, + {spv::BuiltIn::Layer, {10592, 10593, 10594, 7039}}, + {spv::BuiltIn::ViewportIndex, {10601, 10602, 10603, 7060}}, + {spv::BuiltIn::PrimitiveShadingRateKHR, + {10598, 10599, 10600, 7059}}, + }}; + const MeshBuiltinVUIDs& vuids = mesh_vuid_map.at(builtin); + if (spv_result_t error = ValidateBlockTypeOrArrayedType( + decoration, inst, is_block, scalar_type, + [this, &inst, &builtin, &scalar_type, + &vuids](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(vuids.array_type) + << "According to the Vulkan specspec BuiltIn " + << _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_BUILT_IN, (uint32_t)builtin) + << " variable needs to be a either a " + << spvOpcodeString(scalar_type) + << " or an " + "array of " + << spvOpcodeString(scalar_type) << ". " << message; + })) { + return error; + } + + if (!_.HasDecoration(inst.id(), spv::Decoration::PerPrimitiveEXT)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(vuids.perprim_deco) + << "According to the Vulkan spec the variable decorated with " + "Builtin " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + (uint32_t)builtin) + << " within the MeshEXT Execution Model must also be " + << "decorated with the PerPrimitiveEXT decoration. "; + } + if (is_interface_var) { + for (const auto& id : entry_interface_id_map) { + uint32_t entry_point_id = id.first; + uint32_t interface_var_id = id.second; + + const uint64_t interface_size = GetArrayLength(interface_var_id); + const uint32_t output_prim_size = + _.GetOutputPrimitivesEXT(entry_point_id); + if (interface_size != output_prim_size) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(is_block ? vuids.block_array_size + : vuids.array_size) + << " The size of the array decorated with " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + (uint32_t)builtin) + << " (" << interface_size + << ") must match the value specified by OutputPrimitivesEXT " + "(" + << output_prim_size << "). "; + } + } + } } + + if (is_interface_var && is_topology) { + for (const auto& id : entry_interface_id_map) { + uint32_t entry_point_id = id.first; + + uint64_t max_output_primitives = + _.GetOutputPrimitivesEXT(entry_point_id); + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + uint64_t primitive_array_dim = 0; + if (_.GetIdOpcode(underlying_type) == spv::Op::OpTypeArray) { + underlying_type = _.FindDef(underlying_type)->word(3u); + if (!_.EvalConstantValUint64(underlying_type, &primitive_array_dim)) { + assert(0 && "Array type definition is corrupt"); + } + } + + const auto* modes = _.GetExecutionModes(entry_point_id); + if (builtin == spv::BuiltIn::PrimitiveTriangleIndicesEXT) { + if (!modes || !modes->count(spv::ExecutionMode::OutputTrianglesEXT)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(7054) + << "The PrimitiveTriangleIndicesEXT decoration must be used " + "with the OutputTrianglesEXT Execution Mode. "; + } + if (primitive_array_dim && + primitive_array_dim != max_output_primitives) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(7058) + << "The size of the array decorated with " + "PrimitiveTriangleIndicesEXT (" + << primitive_array_dim + << ") must match the value specified " + "by OutputPrimitivesEXT (" + << max_output_primitives << "). "; + } + } else if (builtin == spv::BuiltIn::PrimitiveLineIndicesEXT) { + if (!modes || !modes->count(spv::ExecutionMode::OutputLinesEXT)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(7048) + << "The PrimitiveLineIndicesEXT decoration must be used " + "with the OutputLinesEXT Execution Mode. "; + } + if (primitive_array_dim && + primitive_array_dim != max_output_primitives) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(7052) + << "The size of the array decorated with " + "PrimitiveLineIndicesEXT (" + << primitive_array_dim + << ") must match the value specified " + "by OutputPrimitivesEXT (" + << max_output_primitives << "). "; + } + + } else if (builtin == spv::BuiltIn::PrimitivePointIndicesEXT) { + if (!modes || !modes->count(spv::ExecutionMode::OutputPoints)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(7042) + << "The PrimitivePointIndicesEXT decoration must be used " + "with the OutputPoints Execution Mode. "; + } + if (primitive_array_dim && + primitive_array_dim != max_output_primitives) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(7046) + << "The size of the array decorated with " + "PrimitivePointIndicesEXT (" + << primitive_array_dim + << ") must match the value specified " + "by OutputPrimitivesEXT (" + << max_output_primitives << "). "; + } + } + } + } + } else { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateMeshBuiltinInterfaceRules, this, + decoration, inst, scalar_type, std::placeholders::_1)); } - if (!_.HasDecoration(inst.id(), spv::Decoration::PerPrimitiveEXT)) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(perprim_deco_vuid) - << "According to the Vulkan spec the variable decorated with " - "Builtin " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - (uint32_t)builtin) - << " within the MeshEXT Execution Model must also be " - << "decorated with the PerPrimitiveEXT decoration. "; + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidatePrimitiveShadingRateInterfaceRules( + const Decoration& decoration, const Instruction& inst, + const Instruction& referenced_from_inst) { + if (function_id_) { + if (!execution_models_.count(spv::ExecutionModel::MeshEXT)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst, + &decoration](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(4486) + << "According to the Vulkan spec BuiltIn " + << _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_BUILT_IN, + (uint32_t)decoration.builtin()) + << " variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } + } else { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidatePrimitiveShadingRateInterfaceRules, this, + decoration, inst, std::placeholders::_1)); + } + return SPV_SUCCESS; +} + +// For Layer, ViewportIndex, and PrimitiveId +spv_result_t BuiltInsValidator::ValidateNonMeshInterfaceRules( + const Decoration& decoration, const Instruction& inst, + const Instruction& referenced_from_inst) { + if (function_id_) { + // This can be a per-primitive variable for NV mesh shader stage. + // In such cases variable will have an array of 32-bit integers. + if (!execution_models_.count(spv::ExecutionModel::MeshEXT)) { + const spv::BuiltIn builtin = decoration.builtin(); + const uint32_t vuid = (builtin == spv::BuiltIn::Layer) ? 4276 + : (builtin == spv::BuiltIn::ViewportIndex) ? 4408 + : 4337; + if (decoration.struct_member_index() != Decoration::kInvalidMember) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &vuid, builtin, + &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(vuid) + << "According to the Vulkan spec BuiltIn " + << _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_BUILT_IN, (uint32_t)builtin) + << "variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } else if (spv_result_t error = ValidateOptionalArrayedI32( + decoration, inst, + [this, &vuid, builtin, + &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(vuid) + << "According to the Vulkan spec BuiltIn " + << _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_BUILT_IN, + (uint32_t)builtin) + << "variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } + } else { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateNonMeshInterfaceRules, this, + decoration, inst, std::placeholders::_1)); } return SPV_SUCCESS; } spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { - if (_.HasCapability(spv::Capability::MeshShadingEXT)) { - const spv::BuiltIn label = decoration.builtin(); - uint32_t array_type_vuid = (label == spv::BuiltIn::Layer) ? 10592 : 10601; - uint32_t interface_vuid = 0; - uint32_t array_size_vuid = (label == spv::BuiltIn::Layer) ? 10593 : 10602; - uint32_t block_array_size_vuid = - (label == spv::BuiltIn::Layer) ? 10594 : 10603; - uint32_t perprim_deco_vuid = (label == spv::BuiltIn::Layer) ? 7039 : 7060; - if (spv_result_t error = ValidateMeshEXTBuiltinInterfaceRules( - decoration, inst, spv::Op::OpTypeInt, array_type_vuid, - array_size_vuid, block_array_size_vuid, interface_vuid, - perprim_deco_vuid)) { - return error; - } - } - // This can be a per-primitive variable for NV mesh shader stage. - // In such cases variable will have an array of 32-bit integers. - else if (decoration.struct_member_index() != Decoration::kInvalidMember) { - // This must be a 32-bit int scalar. - if (spv_result_t error = ValidateI32( - decoration, inst, - [this, &decoration, - &inst](const std::string& message) -> spv_result_t { - uint32_t vuid = - (decoration.builtin() == spv::BuiltIn::Layer) ? 4276 : 4408; - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(vuid) - << "According to the Vulkan spec BuiltIn " - << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, - (uint32_t)decoration.builtin()) - << "variable needs to be a 32-bit int scalar. " - << message; - })) { - return error; - } - } else if (spv_result_t error = ValidateOptionalArrayedI32( - decoration, inst, - [this, &decoration, - &inst](const std::string& message) -> spv_result_t { - uint32_t vuid = - (decoration.builtin() == spv::BuiltIn::Layer) ? 4276 - : 4408; - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(vuid) - << "According to the Vulkan spec BuiltIn " - << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, - (uint32_t)decoration.builtin()) - << "variable needs to be a 32-bit int scalar. " - << message; - })) { - return error; - } - } - - // Seed at reference checks with this built-in. return ValidateLayerOrViewportIndexAtReference(decoration, inst, inst, inst); } @@ -3085,6 +3268,14 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference( referenced_from_inst, std::placeholders::_1)); } + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateMeshBuiltinInterfaceRules, this, decoration, + built_in_inst, spv::Op::OpTypeInt, std::placeholders::_1)); + + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateNonMeshInterfaceRules, this, + decoration, built_in_inst, std::placeholders::_1)); + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { case spv::ExecutionModel::Geometry: @@ -3509,12 +3700,47 @@ spv_result_t BuiltInsValidator::ValidateWorkgroupSizeAtDefinition( bool static_x = _.EvalConstantValUint64(inst.word(3), &x_size); bool static_y = _.EvalConstantValUint64(inst.word(4), &y_size); bool static_z = _.EvalConstantValUint64(inst.word(5), &z_size); - if (static_x && static_y && static_z && - ((x_size * y_size * z_size) == 0)) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << "WorkgroupSize decorations must not have a static " - "product of zero (X = " - << x_size << ", Y = " << y_size << ", Z = " << z_size << ")."; + if (static_x && static_y && static_z) { + const uint64_t product_size = x_size * y_size * z_size; + if (product_size == 0) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "WorkgroupSize decorations must not have a static " + "product of zero (X = " + << x_size << ", Y = " << y_size << ", Z = " << z_size << ")."; + } + + // If there is a known static workgroup size, all entrypoints with + // explicit derivative execution modes can be validated. These are only + // found in execution models that support explicit workgroup sizes + for (const uint32_t entry_point : _.entry_points()) { + const auto* modes = _.GetExecutionModes(entry_point); + if (!modes) continue; + if (modes->count(spv::ExecutionMode::DerivativeGroupQuadsKHR)) { + if (x_size % 2 != 0 || y_size % 2 != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(10151) + << "WorkgroupSize decorations has a static dimensions of " + "(X = " + << x_size << ", Y = " << y_size << ") but Entry Point id " + << entry_point + << " has an DerivativeGroupQuadsKHR execution mode, so " + "both dimensions must be a multiple of 2"; + } + } + if (modes->count(spv::ExecutionMode::DerivativeGroupLinearKHR)) { + if (product_size % 4 != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(10152) + << "WorkgroupSize decorations has a static dimensions of " + "(X = " + << x_size << ", Y = " << y_size << ", Z = " << z_size + << ") but Entry Point id " << entry_point + << " has an DerivativeGroupLinearKHR execution mode, so " + "the product (" + << product_size << ") must be a multiple of 4"; + } + } + } } } } @@ -4157,37 +4383,6 @@ spv_result_t BuiltInsValidator::ValidateNVSMOrARMCoreBuiltinsAtReference( spv_result_t BuiltInsValidator::ValidatePrimitiveShadingRateAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { - if (_.HasCapability(spv::Capability::MeshShadingEXT)) { - uint32_t array_type_vuid = 10598; - uint32_t interface_vuid = 0; - uint32_t array_size_vuid = 10599; - uint32_t block_array_size_vuid = 10600; - uint32_t perprim_deco_vuid = 7059; - if (spv_result_t error = ValidateMeshEXTBuiltinInterfaceRules( - decoration, inst, spv::Op::OpTypeInt, array_type_vuid, - array_size_vuid, block_array_size_vuid, interface_vuid, - perprim_deco_vuid)) { - return error; - } - } else if (spv_result_t error = ValidateI32( - decoration, inst, - [this, &inst, - &decoration](const std::string& message) -> spv_result_t { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(4486) - << "According to the Vulkan spec BuiltIn " - << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, - (uint32_t)decoration.builtin()) - << " variable needs to be a 32-bit int scalar. " - << message; - })) { - return error; - } - } - - // Seed at reference checks with this built-in. return ValidatePrimitiveShadingRateAtReference(decoration, inst, inst, inst); } @@ -4209,6 +4404,14 @@ spv_result_t BuiltInsValidator::ValidatePrimitiveShadingRateAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateMeshBuiltinInterfaceRules, this, decoration, + built_in_inst, spv::Op::OpTypeInt, std::placeholders::_1)); + + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidatePrimitiveShadingRateInterfaceRules, this, + decoration, built_in_inst, std::placeholders::_1)); + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { case spv::ExecutionModel::Vertex: @@ -4307,6 +4510,18 @@ spv_result_t BuiltInsValidator::ValidateShadingRateAtReference( return SPV_SUCCESS; } +spv_result_t BuiltInsValidator::ValidateDescriptorHeapAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (decoration.struct_member_index() != Decoration::kInvalidMember) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + (uint32_t)decoration.builtin()) + << " cannot be used as a member decoration "; + } + return SPV_SUCCESS; +} + spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { @@ -4540,93 +4755,46 @@ spv_result_t BuiltInsValidator::ValidateMeshShadingEXTBuiltinsAtDefinition( } break; case spv::BuiltIn::CullPrimitiveEXT: { - uint32_t array_type_vuid = vuid; - uint32_t interface_vuid = 10591; - uint32_t array_size_vuid = 10589; - uint32_t block_array_size_vuid = 10590; - uint32_t perprim_deco_vuid = 7038; - if (spv_result_t error = ValidateMeshEXTBuiltinInterfaceRules( - decoration, inst, spv::Op::OpTypeBool, array_type_vuid, - array_size_vuid, block_array_size_vuid, interface_vuid, - perprim_deco_vuid)) { - return error; + for (const uint32_t entry_point : _.entry_points()) { + auto* models = _.GetExecutionModels(entry_point); + if (models->find(spv::ExecutionModel::MeshEXT) == models->end() && + models->find(spv::ExecutionModel::MeshNV) == models->end()) { + continue; + } + + if (IsBulitinInEntryPoint(inst, entry_point)) { + if (cull_primitive_entry_points_.find(entry_point) != + cull_primitive_entry_points_.end()) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << _.VkErrorID(10591) + << "There must be only one declaration of the " + "CullPrimitiveEXT associated in entry point's " + "interface. " + << GetIdDesc(*_.FindDef(entry_point)); + } else { + cull_primitive_entry_points_.insert(entry_point); + } + } } + break; } default: assert(0 && "Unexpected mesh EXT builtin"); } - for (const uint32_t entry_point : _.entry_points()) { - const auto* modes = _.GetExecutionModes(entry_point); - uint64_t maxOutputPrimitives = _.GetOutputPrimitivesEXT(entry_point); - uint32_t underlying_type = 0; - if (spv_result_t error = - GetUnderlyingType(_, decoration, inst, &underlying_type)) { - return error; - } - uint64_t primitiveArrayDim = 0; - if (_.GetIdOpcode(underlying_type) == spv::Op::OpTypeArray) { - underlying_type = _.FindDef(underlying_type)->word(3u); - if (!_.EvalConstantValUint64(underlying_type, &primitiveArrayDim)) { - assert(0 && "Array type definition is corrupt"); - } - } - switch (builtin) { - case spv::BuiltIn::PrimitivePointIndicesEXT: - if (!modes || !modes->count(spv::ExecutionMode::OutputPoints)) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(7042) - << "The PrimitivePointIndicesEXT decoration must be used " - "with " - "the OutputPoints Execution Mode. "; - } - if (primitiveArrayDim && primitiveArrayDim != maxOutputPrimitives) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(7046) - << "The size of the array decorated with " - "PrimitivePointIndicesEXT must match the value specified " - "by OutputPrimitivesEXT. "; - } - break; - case spv::BuiltIn::PrimitiveLineIndicesEXT: - if (!modes || !modes->count(spv::ExecutionMode::OutputLinesEXT)) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(7048) - << "The PrimitiveLineIndicesEXT decoration must be used " - "with " - "the OutputLinesEXT Execution Mode. "; - } - if (primitiveArrayDim && primitiveArrayDim != maxOutputPrimitives) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(7052) - << "The size of the array decorated with " - "PrimitiveLineIndicesEXT must match the value specified " - "by OutputPrimitivesEXT. "; - } - break; - case spv::BuiltIn::PrimitiveTriangleIndicesEXT: - if (!modes || !modes->count(spv::ExecutionMode::OutputTrianglesEXT)) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(7054) - << "The PrimitiveTriangleIndicesEXT decoration must be used " - "with " - "the OutputTrianglesEXT Execution Mode. "; - } - if (primitiveArrayDim && primitiveArrayDim != maxOutputPrimitives) { - return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << _.VkErrorID(7058) - << "The size of the array decorated with " - "PrimitiveTriangleIndicesEXT must match the value " - "specified " - "by OutputPrimitivesEXT. "; - } - break; - default: - break; // no validation rules - } + // - We know this only allowed for Mesh Execution Model. + // - The Scalar type is is boolean for CullPrimitiveEXT, the other 3 builtin + // (topology) don't need this type. + // - It is possible to have multiple mesh + // shaders (https://github.com/KhronosGroup/SPIRV-Tools/issues/6320) and we + // need to validate these at reference time. + if (spv_result_t error = ValidateMeshBuiltinInterfaceRules( + decoration, inst, spv::Op::OpTypeBool, inst)) { + return error; } } + // Seed at reference checks with this built-in. return ValidateMeshShadingEXTBuiltinsAtReference(decoration, inst, inst, inst); @@ -4854,6 +5022,7 @@ spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinitionVulkan( case spv::BuiltIn::CullMaskKHR: { return ValidateRayTracingBuiltinsAtDefinition(decoration, inst); } + // These are only for Mesh, not Task execution model case spv::BuiltIn::CullPrimitiveEXT: case spv::BuiltIn::PrimitivePointIndicesEXT: case spv::BuiltIn::PrimitiveLineIndicesEXT: @@ -4866,6 +5035,10 @@ spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinitionVulkan( case spv::BuiltIn::ShadingRateKHR: { return ValidateShadingRateAtDefinition(decoration, inst); } + case spv::BuiltIn::SamplerHeapEXT: + case spv::BuiltIn::ResourceHeapEXT: { + return ValidateDescriptorHeapAtDefinition(decoration, inst); + } default: // No validation rules (for the moment). break; diff --git a/third_party/spirv-tools/source/val/validate_capability.cpp b/third_party/spirv-tools/source/val/validate_capability.cpp index 05ccb11bf1..961590c19b 100644 --- a/third_party/spirv-tools/source/val/validate_capability.cpp +++ b/third_party/spirv-tools/source/val/validate_capability.cpp @@ -147,6 +147,7 @@ bool IsSupportOptionalVulkan_1_0(uint32_t capability) { case spv::Capability::Int8: case spv::Capability::BFloat16TypeKHR: case spv::Capability::Float8EXT: + case spv::Capability::PushConstantBanksNV: return true; default: break; @@ -345,11 +346,18 @@ bool IsEnabledByCapabilityOpenCL_2_0(ValidationState_t& _, // Validates that capability declarations use operands allowed in the current // context. spv_result_t CapabilityPass(ValidationState_t& _, const Instruction* inst) { - if (inst->opcode() != spv::Op::OpCapability) return SPV_SUCCESS; + if (inst->opcode() != spv::Op::OpCapability && + inst->opcode() != spv::Op::OpConditionalCapabilityINTEL) + return SPV_SUCCESS; - assert(inst->operands().size() == 1); + assert(!((inst->opcode() == spv::Op::OpCapability) ^ + (inst->operands().size() == 1))); + assert(!((inst->opcode() == spv::Op::OpConditionalCapabilityINTEL) ^ + (inst->operands().size() == 2))); - const spv_parsed_operand_t& operand = inst->operand(0); + const uint32_t i_cap = + inst->opcode() == spv::Op::OpConditionalCapabilityINTEL ? 1 : 0; + const spv_parsed_operand_t& operand = inst->operand(i_cap); assert(operand.num_words == 1); assert(operand.offset < inst->words().size()); diff --git a/third_party/spirv-tools/source/val/validate_composites.cpp b/third_party/spirv-tools/source/val/validate_composites.cpp index 2afeae78ad..b58242bf70 100644 --- a/third_party/spirv-tools/source/val/validate_composites.cpp +++ b/third_party/spirv-tools/source/val/validate_composites.cpp @@ -16,6 +16,8 @@ // Validates correctness of composite SPIR-V instructions. +#include + #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/val/instruction.h" @@ -125,7 +127,7 @@ spv_result_t GetExtractInsertValueType(ValidationState_t& _, *member_type = type_inst->word(component_index + 2); break; } - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: case spv::Op::OpTypeCooperativeMatrixKHR: case spv::Op::OpTypeCooperativeMatrixNV: { *member_type = type_inst->word(2); @@ -153,7 +155,7 @@ spv_result_t ValidateVectorExtractDynamic(ValidationState_t& _, const uint32_t vector_type = _.GetOperandTypeId(inst, 2); const spv::Op vector_opcode = _.GetIdOpcode(vector_type); if (vector_opcode != spv::Op::OpTypeVector && - vector_opcode != spv::Op::OpTypeCooperativeVectorNV) { + vector_opcode != spv::Op::OpTypeVectorIdEXT) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Vector type to be OpTypeVector"; } @@ -182,7 +184,7 @@ spv_result_t ValidateVectorInsertDyanmic(ValidationState_t& _, const uint32_t result_type = inst->type_id(); const spv::Op result_opcode = _.GetIdOpcode(result_type); if (result_opcode != spv::Op::OpTypeVector && - result_opcode != spv::Op::OpTypeCooperativeVectorNV) { + result_opcode != spv::Op::OpTypeVectorIdEXT) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be OpTypeVector"; } @@ -221,7 +223,7 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, const spv::Op result_opcode = _.GetIdOpcode(result_type); switch (result_opcode) { case spv::Op::OpTypeVector: - case spv::Op::OpTypeCooperativeVectorNV: { + case spv::Op::OpTypeVectorIdEXT: { uint32_t num_result_components = _.GetDimension(result_type); const uint32_t result_component_type = _.GetComponentType(result_type); uint32_t given_component_count = 0; @@ -229,7 +231,8 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, bool comp_is_int32 = true, comp_is_const_int32 = true; if (result_opcode == spv::Op::OpTypeVector) { - if (num_operands <= 3) { + if (num_operands <= 3 && + !_.HasCapability(spv::Capability::LongVectorEXT)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected number of constituents to be at least 2"; } @@ -527,19 +530,18 @@ spv_result_t ValidateTranspose(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateVectorShuffle(ValidationState_t& _, const Instruction* inst) { auto resultType = _.FindDef(inst->type_id()); - if (!resultType || resultType->opcode() != spv::Op::OpTypeVector) { + if (!_.IsVectorType(resultType->id())) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The Result Type of OpVectorShuffle must be" - << " OpTypeVector. Found Op" - << spvOpcodeString(static_cast(resultType->opcode())) - << "."; + << " a vector type. Found Op" + << spvOpcodeString(resultType->opcode()) << "."; } // The number of components in Result Type must be the same as the number of // Component operands. auto componentCount = inst->operands().size() - 4; - auto resultVectorDimension = resultType->GetOperandAs(2); - if (componentCount != resultVectorDimension) { + auto resultVectorDimension = _.GetDimension(resultType->id()); + if (resultVectorDimension > 0 && componentCount != resultVectorDimension) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpVectorShuffle component literals count does not match " "Result Type " @@ -552,13 +554,13 @@ spv_result_t ValidateVectorShuffle(ValidationState_t& _, auto vector1Type = _.FindDef(vector1Object->type_id()); auto vector2Object = _.FindDef(inst->GetOperandAs(3)); auto vector2Type = _.FindDef(vector2Object->type_id()); - if (!vector1Type || vector1Type->opcode() != spv::Op::OpTypeVector) { + if (!_.IsVectorType(vector1Type->id())) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "The type of Vector 1 must be OpTypeVector."; + << "The type of Vector 1 must be a vector type."; } - if (!vector2Type || vector2Type->opcode() != spv::Op::OpTypeVector) { + if (!_.IsVectorType(vector2Type->id())) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "The type of Vector 2 must be OpTypeVector."; + << "The type of Vector 2 must be a vector type."; } auto resultComponentType = resultType->GetOperandAs(1); @@ -618,8 +620,464 @@ spv_result_t ValidateCopyLogical(ValidationState_t& _, return SPV_SUCCESS; } -} // anonymous namespace +spv_result_t ValidateCompositeConstructCoopMatQCOM(ValidationState_t& _, + const Instruction* inst) { + // Is the result of coop mat ? + const auto result_type_inst = _.FindDef(inst->type_id()); + if (!result_type_inst || + result_type_inst->opcode() != spv::Op::OpTypeCooperativeMatrixKHR) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the result type be OpTypeCooperativeMatrixKHR"; + } + const auto source = _.FindDef(inst->GetOperandAs(2u)); + const auto source_type_inst = _.FindDef(source->type_id()); + + if (!source_type_inst || source_type_inst->opcode() != spv::Op::OpTypeArray) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the input operand be an OpTypeArray."; + } + + // Is the scope Subgrouop ? + { + unsigned scope = UINT_MAX; + unsigned scope_id = result_type_inst->GetOperandAs(2u); + bool status = _.GetConstantValueAs(scope_id, scope); + bool is_scope_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(scope_id)->opcode()); + if (!is_scope_spec_const && + (!status || scope != static_cast(spv::Scope::Subgroup))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the result type's scope be Subgroup."; + } + } + + unsigned ar_len = UINT_MAX; + unsigned src_arr_len_id = source_type_inst->GetOperandAs(2u); + bool ar_len_status = _.GetConstantValueAs(src_arr_len_id, ar_len); + bool is_src_arr_len_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(src_arr_len_id)->opcode()); + + const auto source_elt_type = _.GetComponentType(source_type_inst->id()); + const auto result_elt_type = result_type_inst->GetOperandAs(1u); + + if ((source_elt_type != result_elt_type) && + !(_.ContainsSizedIntOrFloatType(source_elt_type, spv::Op::OpTypeInt, + 32) && + _.IsUnsignedIntScalarType(source_elt_type))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires ether the input element type is equal to the result " + "element type or it is the unsigned 32-bit integer."; + } + + unsigned res_row_id = result_type_inst->GetOperandAs(3u); + unsigned res_col_id = result_type_inst->GetOperandAs(4u); + unsigned res_use_id = result_type_inst->GetOperandAs(5u); + + unsigned cm_use = UINT_MAX; + bool cm_use_status = _.GetConstantValueAs(res_use_id, cm_use); + + switch (static_cast(cm_use)) { + case spv::CooperativeMatrixUse::MatrixAKHR: { + // result coopmat component type check + if (!_.IsIntNOrFP32OrFP16<8>(result_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the result element type is one of 8-bit OpTypeInt " + "signed/unsigned, 16- or 32-bit OpTypeFloat" + << " when result coopmat's use is MatrixAKHR"; + } + + // result coopmat column length check + unsigned n_cols = UINT_MAX; + bool status = _.GetConstantValueAs(res_col_id, n_cols); + bool is_res_col_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(res_col_id)->opcode()); + if (!is_res_col_spec_const && + (!status || (!(_.ContainsSizedIntOrFloatType(result_elt_type, + spv::Op::OpTypeInt, 8) && + n_cols == 32) && + !(_.ContainsSizedIntOrFloatType( + result_elt_type, spv::Op::OpTypeFloat, 16) && + n_cols == 16) && + !(_.ContainsSizedIntOrFloatType( + result_elt_type, spv::Op::OpTypeFloat, 32) && + n_cols == 8)))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the columns of the result coopmat have the bit " + "length of 256" + << " when result coopmat's use is MatrixAKHR"; + } + // source array length check + if (!is_src_arr_len_spec_const && + (!ar_len_status || + (!(_.ContainsSizedIntOrFloatType(source_elt_type, spv::Op::OpTypeInt, + 32) && + _.IsUnsignedIntScalarType(source_elt_type) && (ar_len == 8)) && + !(n_cols == ar_len)))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source array length be 8 if its elt type is " + "32-bit unsigned OpTypeInt and be the result's number of " + "columns, otherwise" + << " when result coopmat's use is MatrixAKHR"; + } + break; + } + case spv::CooperativeMatrixUse::MatrixBKHR: { + // result coopmat component type check + if (!_.IsIntNOrFP32OrFP16<8>(result_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the result element type is one of 8-bit OpTypeInt " + "signed/unsigned, 16- or 32-bit OpTypeFloat" + << " when result coopmat's use is MatrixBKHR"; + } + + // result coopmat row length check + unsigned n_rows = UINT_MAX; + bool status = _.GetConstantValueAs(res_row_id, n_rows); + bool is_res_row_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(res_row_id)->opcode()); + if (!is_res_row_spec_const && + (!status || (!(_.ContainsSizedIntOrFloatType(result_elt_type, + spv::Op::OpTypeInt, 8) && + n_rows == 32) && + !(_.ContainsSizedIntOrFloatType( + result_elt_type, spv::Op::OpTypeFloat, 16) && + n_rows == 16) && + !(_.ContainsSizedIntOrFloatType( + result_elt_type, spv::Op::OpTypeFloat, 32) && + n_rows == 8)))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the rows of the result operand have the bit " + "length of 256" + << " when result coopmat's use is MatrixBKHR"; + } + // source array length check + if (!is_src_arr_len_spec_const && + (!ar_len_status || + (!(_.ContainsSizedIntOrFloatType(source_elt_type, spv::Op::OpTypeInt, + 32) && + _.IsUnsignedIntScalarType(source_elt_type) && (ar_len == 8)) && + !(n_rows == ar_len)))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source array length be 8 if its elt type is " + "32-bit unsigned OpTypeInt and be the result's number of " + "rows, otherwise" + << " when result coopmat's use is MatrixBKHR"; + } + break; + } + case spv::CooperativeMatrixUse::MatrixAccumulatorKHR: { + // result coopmat component type check + if (!_.IsIntNOrFP32OrFP16<32>(result_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the result element type is one of 32-bit " + "OpTypeInt signed/unsigned, 16- or 32-bit OpTypeFloat" + << " when result coopmat's use is MatrixAccumulatorKHR"; + } + + // source array length check + unsigned n_cols = UINT_MAX; + bool status = _.GetConstantValueAs(res_col_id, n_cols); + bool is_res_col_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(res_col_id)->opcode()); + if (!is_res_col_spec_const && !is_src_arr_len_spec_const && + (!status || !ar_len_status || + (!(_.ContainsSizedIntOrFloatType(source_elt_type, spv::Op::OpTypeInt, + 32) && + _.IsUnsignedIntScalarType(source_elt_type) && + (_.ContainsSizedIntOrFloatType(result_elt_type, + spv::Op::OpTypeFloat, 16) + ? (n_cols / 2 == ar_len) + : n_cols == ar_len)) && + (n_cols != ar_len)))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source array length be a half of the number " + "of columns of the resulting cooerative matrix if the " + "matrix's componet type is 16-bit OpTypeFloat and be equal " + "to the number of columns, otherwise," + << " when result coopmat's use is MatrixAccumulatorKHR"; + } + break; + } + default: { + bool is_cm_use_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(res_use_id)->opcode()); + if (!is_cm_use_spec_const || !cm_use_status) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the the resulting cooerative matrix's use be " + << " one of MatrixAKHR (== 0), MatrixBKHR (== 1), and " + "MatrixAccumulatorKHR (== 2)"; + } + break; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateCompositeExtractCoopMatQCOM(ValidationState_t& _, + const Instruction* inst) { + const auto result_type_inst = _.FindDef(inst->type_id()); + if (!result_type_inst || result_type_inst->opcode() != spv::Op::OpTypeArray) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the input operand be an OpTypeArray."; + } + + const auto source = _.FindDef(inst->GetOperandAs(2u)); + const auto source_type_inst = _.FindDef(source->type_id()); + + // Is the source of coop mat ? + if (!source_type_inst || + source_type_inst->opcode() != spv::Op::OpTypeCooperativeMatrixKHR) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source type be OpTypeCooperativeMatrixKHR"; + } + + // Is the scope Subgrouop ? + { + unsigned scope = UINT_MAX; + unsigned scope_id = source_type_inst->GetOperandAs(2u); + bool status = _.GetConstantValueAs(scope_id, scope); + bool is_scope_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(scope_id)->opcode()); + if (!is_scope_spec_const && + (!status || scope != static_cast(spv::Scope::Subgroup))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source type's scope be Subgroup."; + } + } + + unsigned ar_len = UINT_MAX; + unsigned res_arr_len_id = result_type_inst->GetOperandAs(2u); + bool ar_len_status = _.GetConstantValueAs(res_arr_len_id, ar_len); + bool is_res_arr_len_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(res_arr_len_id)->opcode()); + + const auto source_elt_type = _.GetComponentType(source_type_inst->id()); + const auto result_elt_type = result_type_inst->GetOperandAs(1u); + + unsigned src_row_id = source_type_inst->GetOperandAs(3u); + unsigned src_col_id = source_type_inst->GetOperandAs(4u); + unsigned src_use_id = source_type_inst->GetOperandAs(5u); + + unsigned cm_use = UINT_MAX; + bool cm_use_status = _.GetConstantValueAs(src_use_id, cm_use); + + switch (static_cast(cm_use)) { + case spv::CooperativeMatrixUse::MatrixAKHR: { + // source coopmat component type check + if (!_.IsIntNOrFP32OrFP16<8>(source_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source element type be one of 8-bit OpTypeInt " + "signed/unsigned, 16- or 32-bit OpTypeFloat" + << " when source coopmat's use is MatrixAKHR"; + } + + // source coopmat column length check + unsigned n_cols = UINT_MAX; + bool status = _.GetConstantValueAs(src_col_id, n_cols); + bool is_src_col_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(src_col_id)->opcode()); + if (!is_src_col_spec_const && + (!status || (!(_.ContainsSizedIntOrFloatType(source_elt_type, + spv::Op::OpTypeInt, 8) && + n_cols == 32) && + !(_.ContainsSizedIntOrFloatType( + source_elt_type, spv::Op::OpTypeFloat, 16) && + n_cols == 16) && + !(_.ContainsSizedIntOrFloatType( + source_elt_type, spv::Op::OpTypeFloat, 32) && + n_cols == 8)))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the columns of the source coopmat have the bit " + "length of 256" + << " when source coopmat's use is MatrixAKHR"; + } + // result type check + if (!is_res_arr_len_spec_const && + !(source_elt_type == result_elt_type && (n_cols == ar_len)) && + !(_.ContainsSizedIntOrFloatType(result_elt_type, spv::Op::OpTypeInt, + 32) && + _.IsUnsignedIntScalarType(result_elt_type) && (ar_len == 8))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires either the result element type be the same as the " + "source cooperative matrix's component type" + << " and its length be the same as the number of columns of the " + "matrix or the result element type be" + << " unsigned 32-bit OpTypeInt and the length be 8" + << " when source coopmat's use is MatrixAKHR"; + } + break; + } + case spv::CooperativeMatrixUse::MatrixBKHR: { + // source coopmat component type check + if (!_.IsIntNOrFP32OrFP16<8>(source_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source element type be one of 8-bit OpTypeInt " + "signed/unsigned, 16- or 32-bit OpTypeFloat" + << " when source coopmat's use is MatrixBKHR"; + } + + // source coopmat row length check + unsigned n_rows = UINT_MAX; + bool status = _.GetConstantValueAs(src_row_id, n_rows); + bool is_src_row_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(src_row_id)->opcode()); + if (!is_src_row_spec_const && + (!status || (!(_.ContainsSizedIntOrFloatType(source_elt_type, + spv::Op::OpTypeInt, 8) && + n_rows == 32) && + !(_.ContainsSizedIntOrFloatType( + source_elt_type, spv::Op::OpTypeFloat, 16) && + n_rows == 16) && + !(_.ContainsSizedIntOrFloatType( + source_elt_type, spv::Op::OpTypeFloat, 32) && + n_rows == 8)))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the rows of the source coopmat have the bit " + "length of 256" + << " when source coopmat's use is MatrixBKHR"; + } + // result type check + if (!is_res_arr_len_spec_const && + !(source_elt_type == result_elt_type && (n_rows == ar_len)) && + !(_.ContainsSizedIntOrFloatType(result_elt_type, spv::Op::OpTypeInt, + 32) && + _.IsUnsignedIntScalarType(result_elt_type) && (ar_len == 8))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires either the result element type be the same as the " + "source cooperative matrix's component type" + << " and its length be the same as the number of rows of the " + "matrix or the result element type be" + << " unsigned 32-bit OpTypeInt and the length be 8" + << " when source coopmat's use is MatrixBKHR"; + } + break; + } + case spv::CooperativeMatrixUse::MatrixAccumulatorKHR: { + // source coopmat component type check + if (!_.IsIntNOrFP32OrFP16<32>(source_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source element type be one of 32-bit " + "OpTypeInt signed/unsigned, 16- or 32-bit OpTypeFloat" + << " when source coopmat's use is MatrixAccumulatorKHR"; + } + + // result type check + unsigned n_cols = UINT_MAX; + bool status = _.GetConstantValueAs(src_col_id, n_cols); + bool is_src_col_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(src_col_id)->opcode()); + if (!is_src_col_spec_const && !is_res_arr_len_spec_const && + (!status || !ar_len_status || + (!(source_elt_type == result_elt_type && (n_cols == ar_len)) && + !(_.ContainsSizedIntOrFloatType(result_elt_type, spv::Op::OpTypeInt, + 32) && + _.IsUnsignedIntScalarType(result_elt_type) && + (_.ContainsSizedIntOrFloatType(source_elt_type, + spv::Op::OpTypeFloat, 16) + ? (n_cols / 2 == ar_len) + : (n_cols == ar_len)))))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires either the result element type be the same as the " + "source cooperative matrix's component type" + << " and its length be the same as the number of columns of the " + "matrix or the result element type be" + << " unsigned 32-bit OpTypeInt and the length be the number of " + "the columns of the matrix if its component" + << " type is 32-bit OpTypeFloat and be a half of the number of " + "the columns of the matrix if its component" + << " type is 16-bit OpTypeFloat" + << " when source coopmat's use is MatrixAccumulatorKHR"; + } + break; + } + default: { + bool is_cm_use_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(src_use_id)->opcode()); + if (!is_cm_use_spec_const || !cm_use_status) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the the source cooerative matrix's use be " + << " one of MatrixAKHR (== 0), MatrixBKHR (== 1), and " + "MatrixAccumulatorKHR (== 2)"; + } + break; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateExtractSubArrayQCOM(ValidationState_t& _, + const Instruction* inst) { + const auto result_type_inst = _.FindDef(inst->type_id()); + const auto source = _.FindDef(inst->GetOperandAs(2u)); + const auto source_type_inst = _.FindDef(source->type_id()); + + // Are the input and the result arrays? + if (result_type_inst->opcode() != spv::Op::OpTypeArray || + source_type_inst->opcode() != spv::Op::OpTypeArray) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires OpTypeArray operands for the input and the result."; + } + + const auto source_elt_type = _.GetComponentType(source_type_inst->id()); + const auto result_elt_type = _.GetComponentType(result_type_inst->id()); + + // Do the input and result element types match? + if (source_elt_type != result_elt_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the input and result element types match."; + } + + // Elt type must be one of int32_t/uint32_t/float32/float16 + if (!_.IsIntNOrFP32OrFP16<32>(source_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the element type be one of 32-bit OpTypeInt " + "(signed/unsigned), 32-bit OpTypeFloat and 16-bit OpTypeFloat"; + } + + const auto start_index = _.FindDef(inst->GetOperandAs(3u)); + if (!start_index || !_.ContainsSizedIntOrFloatType(start_index->type_id(), + spv::Op::OpTypeInt, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the type of the start index operand be 32-bit " + "OpTypeInt"; + } + + return SPV_SUCCESS; +} + +} // anonymous namespace // Validates correctness of composite instructions. spv_result_t CompositesPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { @@ -641,6 +1099,12 @@ spv_result_t CompositesPass(ValidationState_t& _, const Instruction* inst) { return ValidateTranspose(_, inst); case spv::Op::OpCopyLogical: return ValidateCopyLogical(_, inst); + case spv::Op::OpCompositeConstructCoopMatQCOM: + return ValidateCompositeConstructCoopMatQCOM(_, inst); + case spv::Op::OpCompositeExtractCoopMatQCOM: + return ValidateCompositeExtractCoopMatQCOM(_, inst); + case spv::Op::OpExtractSubArrayQCOM: + return ValidateExtractSubArrayQCOM(_, inst); default: break; } diff --git a/third_party/spirv-tools/source/val/validate_constants.cpp b/third_party/spirv-tools/source/val/validate_constants.cpp index 08a1496ef4..67783818ab 100644 --- a/third_party/spirv-tools/source/val/validate_constants.cpp +++ b/third_party/spirv-tools/source/val/validate_constants.cpp @@ -54,11 +54,11 @@ spv_result_t ValidateConstantComposite(ValidationState_t& _, const auto constituent_count = inst->words().size() - 3; switch (result_type->opcode()) { case spv::Op::OpTypeVector: - case spv::Op::OpTypeCooperativeVectorNV: { + case spv::Op::OpTypeVectorIdEXT: { uint32_t num_result_components = _.GetDimension(result_type->id()); bool comp_is_int32 = true, comp_is_const_int32 = true; - if (result_type->opcode() == spv::Op::OpTypeCooperativeVectorNV) { + if (result_type->opcode() == spv::Op::OpTypeVectorIdEXT) { uint32_t comp_count_id = result_type->GetOperandAs(2); std::tie(comp_is_int32, comp_is_const_int32, num_result_components) = _.EvalInt32IfConst(comp_count_id); @@ -463,7 +463,7 @@ bool IsTypeNullable(const std::vector& instruction, case spv::Op::OpTypeMatrix: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: case spv::Op::OpTypeVector: { auto base_type = _.FindDef(instruction[2]); return base_type && IsTypeNullable(base_type->words(), _); @@ -505,6 +505,28 @@ spv_result_t ValidateConstantNull(ValidationState_t& _, return SPV_SUCCESS; } +spv_result_t ValidateConstantSizeOfEXT(ValidationState_t& _, + const Instruction* inst) { + const Instruction* result_type = _.FindDef(inst->type_id()); + const uint32_t bit_width = result_type->GetOperandAs(1); + // VVL will validate the SPV_EXT_shader_64bit_indexing interaction + if (result_type->opcode() != spv::Op::OpTypeInt || + (bit_width != 64 && bit_width != 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "For OpConstantSizeOfEXT instruction, its result type " + << "must be a 32-bit or 64-bit integer type scalar." + << " (OpCapability Int64 is required for 64-bit)"; + } + + const uint32_t type_operand = inst->GetOperandAs(2); + if (!_.IsDescriptorType(type_operand)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "For OpConstantSizeOfEXT instruction, its Type operand " + << _.getIdName(type_operand) << " must be a Descriptor type."; + } + return SPV_SUCCESS; +} + // Validates that OpSpecConstant specializes to either int or float type. spv_result_t ValidateSpecConstant(ValidationState_t& _, const Instruction* inst) { @@ -607,6 +629,9 @@ spv_result_t ConstantPass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpSpecConstantOp: if (auto error = ValidateSpecConstantOp(_, inst)) return error; break; + case spv::Op::OpConstantSizeOfEXT: + if (auto error = ValidateConstantSizeOfEXT(_, inst)) return error; + break; default: break; } diff --git a/third_party/spirv-tools/source/val/validate_conversion.cpp b/third_party/spirv-tools/source/val/validate_conversion.cpp index be50a6f1e6..d9a404f6d4 100644 --- a/third_party/spirv-tools/source/val/validate_conversion.cpp +++ b/third_party/spirv-tools/source/val/validate_conversion.cpp @@ -14,6 +14,8 @@ // Validates correctness of conversion instructions. +#include + #include "source/opcode.h" #include "source/spirv_constant.h" #include "source/spirv_target_env.h" @@ -539,7 +541,10 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { << "Expected input to be a pointer or int or float vector " << "or scalar: " << spvOpcodeString(opcode); - if (result_is_coopvec != input_is_coopvec) + // NV_cooperative_vector doesn't allow bitcasting between vec<->coopvec, + // but long_vector does. + if (result_is_coopvec != input_is_coopvec && + !_.HasCapability(spv::Capability::LongVectorEXT)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cooperative vector can only be cast to another cooperative " << "vector: " << spvOpcodeString(opcode); @@ -549,7 +554,8 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { << "Cooperative matrix can only be cast to another cooperative " << "matrix: " << spvOpcodeString(opcode); - if (result_is_coopvec) { + if (result_is_coopvec && input_is_coopvec && + !_.HasCapability(spv::Capability::LongVectorEXT)) { spv_result_t ret = _.CooperativeVectorDimensionsMatch(inst, result_type, input_type); if (ret != SPV_SUCCESS) return ret; @@ -572,26 +578,38 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { if (result_is_pointer && !input_is_pointer && !input_is_int_scalar && !(input_is_int_vector && input_has_int32)) return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected input to be a pointer, int scalar or 32-bit int " + << "In SPIR-V 1.5 or later (or with " + "SPV_KHR_physical_storage_buffer), expected input to be a " + "pointer, " + "int scalar or 32-bit int " "vector if Result Type is pointer: " << spvOpcodeString(opcode); if (input_is_pointer && !result_is_pointer && !result_is_int_scalar && !(result_is_int_vector && result_has_int32)) return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Pointer can only be converted to another pointer, int " + << "In SPIR-V 1.5 or later (or with " + "SPV_KHR_physical_storage_buffer), pointer can only be " + "converted to " + "another pointer, int " "scalar or 32-bit int vector: " << spvOpcodeString(opcode); } else { if (result_is_pointer && !input_is_pointer && !input_is_int_scalar) return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected input to be a pointer or int scalar if Result " + << "In SPIR-V 1.4 or earlier (and without " + "SPV_KHR_physical_storage_buffer), expected input to be a " + "pointer " + "or int scalar if Result " "Type is pointer: " << spvOpcodeString(opcode); if (input_is_pointer && !result_is_pointer && !result_is_int_scalar) return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Pointer can only be converted to another pointer or int " + << "In SPIR-V 1.4 or earlier (and without " + "SPV_KHR_physical_storage_buffer), pointer can only be " + "converted " + "to another pointer or int " "scalar: " << spvOpcodeString(opcode); } @@ -664,6 +682,69 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } + case spv::Op::OpBitCastArrayQCOM: { + const auto result_type_inst = _.FindDef(inst->type_id()); + const auto source = _.FindDef(inst->GetOperandAs(2u)); + const auto source_type_inst = _.FindDef(source->type_id()); + + // Are the input and the result arrays? + if (result_type_inst->opcode() != spv::Op::OpTypeArray || + source_type_inst->opcode() != spv::Op::OpTypeArray) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires OpTypeArray operands for the input and the " + "result."; + } + + const auto source_elt_type = _.GetComponentType(source_type_inst->id()); + const auto result_elt_type = _.GetComponentType(result_type_inst->id()); + + if (!_.IsIntNOrFP32OrFP16<32>(source_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the source element type be one of 32-bit " + "OpTypeInt " + "(signed/unsigned), 32-bit OpTypeFloat and 16-bit " + "OpTypeFloat"; + } + + if (!_.IsIntNOrFP32OrFP16<32>(result_elt_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires the result element type be one of 32-bit " + "OpTypeInt " + "(signed/unsigned), 32-bit OpTypeFloat and 16-bit " + "OpTypeFloat"; + } + + unsigned src_arr_len_id = source_type_inst->GetOperandAs(2u); + unsigned res_arr_len_id = result_type_inst->GetOperandAs(2u); + + // Are the input and result element types compatible? + unsigned src_arr_len = UINT_MAX, res_arr_len = UINT_MAX; + bool src_arr_len_status = + _.GetConstantValueAs(src_arr_len_id, src_arr_len); + bool res_arr_len_status = + _.GetConstantValueAs(res_arr_len_id, res_arr_len); + + bool is_src_arr_len_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(src_arr_len_id)->opcode()); + bool is_res_arr_len_spec_const = + spvOpcodeIsSpecConstant(_.FindDef(res_arr_len_id)->opcode()); + + unsigned source_bitlen = _.GetBitWidth(source_elt_type) * src_arr_len; + unsigned result_bitlen = _.GetBitWidth(result_elt_type) * res_arr_len; + if (!is_src_arr_len_spec_const && !is_res_arr_len_spec_const && + (!src_arr_len_status || !res_arr_len_status || + source_bitlen != result_bitlen)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Opcode " << spvOpcodeString(inst->opcode()) + << " requires source and result types be compatible for " + "conversion."; + } + break; + } + default: break; } diff --git a/third_party/spirv-tools/source/val/validate_decorations.cpp b/third_party/spirv-tools/source/val/validate_decorations.cpp index 384f9c61bf..79b4085c33 100644 --- a/third_party/spirv-tools/source/val/validate_decorations.cpp +++ b/third_party/spirv-tools/source/val/validate_decorations.cpp @@ -122,7 +122,8 @@ bool isMissingOffsetInStruct(uint32_t struct_id, ValidationState_t& vstate) { hasOffset.resize(struct_members.size(), false); for (auto& decoration : vstate.id_decorations(struct_id)) { - if (spv::Decoration::Offset == decoration.dec_type() && + if ((spv::Decoration::Offset == decoration.dec_type() || + spv::Decoration::OffsetIdEXT == decoration.dec_type()) && Decoration::kInvalidMember != decoration.struct_member_index()) { // Offset 0xffffffff is not valid so ignore it for simplicity's sake. if (decoration.params()[0] == 0xffffffff) return true; @@ -170,6 +171,10 @@ uint32_t getBaseAlignment(uint32_t member_id, bool roundUp, case spv::Op::OpTypeImage: if (vstate.HasCapability(spv::Capability::BindlessTextureNV)) return vstate.samplerimage_variable_address_mode() / 8; + // SPV_EXT_descriptor_heap provides a way to access opaque images, we + // assume alignment is validated at runtime as it is determined by the + // client API + if (vstate.HasCapability(spv::Capability::DescriptorHeapEXT)) return 1; assert(0); return 0; case spv::Op::OpTypeInt: @@ -182,7 +187,19 @@ uint32_t getBaseAlignment(uint32_t member_id, bool roundUp, const auto componentAlignment = getBaseAlignment( componentId, roundUp, inherited, constraints, vstate); baseAlignment = - componentAlignment * (numComponents == 3 ? 4 : numComponents); + componentAlignment * + ((numComponents == 3 || numComponents > 4) ? 4 : numComponents); + break; + } + case spv::Op::OpTypeVectorIdEXT: { + const auto componentId = words[2]; + const auto numComponents = vstate.GetDimension(inst->id()); + assert(numComponents != 0); + const auto componentAlignment = getBaseAlignment( + componentId, roundUp, inherited, constraints, vstate); + baseAlignment = + componentAlignment * + ((numComponents == 3 || numComponents > 4) ? 4 : numComponents); break; } case spv::Op::OpTypeMatrix: { @@ -245,12 +262,17 @@ uint32_t getScalarAlignment(uint32_t type_id, ValidationState_t& vstate) { case spv::Op::OpTypeImage: if (vstate.HasCapability(spv::Capability::BindlessTextureNV)) return vstate.samplerimage_variable_address_mode() / 8; + // SPV_EXT_descriptor_heap provides a way to access opaque images, we + // assume alignment is validated at runtime as it is determined by the + // client API + if (vstate.HasCapability(spv::Capability::DescriptorHeapEXT)) return 1; assert(0); return 0; case spv::Op::OpTypeInt: case spv::Op::OpTypeFloat: return words[2] / 8; case spv::Op::OpTypeVector: + case spv::Op::OpTypeVectorIdEXT: case spv::Op::OpTypeMatrix: case spv::Op::OpTypeArray: case spv::Op::OpTypeRuntimeArray: { @@ -293,6 +315,10 @@ uint32_t getSize(uint32_t member_id, const LayoutConstraints& inherited, case spv::Op::OpTypeImage: if (vstate.HasCapability(spv::Capability::BindlessTextureNV)) return vstate.samplerimage_variable_address_mode() / 8; + // SPV_EXT_descriptor_heap provides a way to access opaque images, we + // assume alignment is validated at runtime as it is determined by the + // client API + if (vstate.HasCapability(spv::Capability::DescriptorHeapEXT)) return 1; assert(0); return 0; case spv::Op::OpTypeInt: @@ -306,6 +332,15 @@ uint32_t getSize(uint32_t member_id, const LayoutConstraints& inherited, const auto size = componentSize * numComponents; return size; } + case spv::Op::OpTypeVectorIdEXT: { + const auto componentId = words[2]; + const auto numComponents = vstate.GetDimension(inst->id()); + assert(numComponents != 0); + const auto componentSize = + getSize(componentId, inherited, constraints, vstate); + const auto size = componentSize * numComponents; + return size; + } case spv::Op::OpTypeArray: { const auto sizeInst = vstate.FindDef(words[3]); if (spvOpcodeIsSpecConstant(sizeInst->opcode())) return 0; @@ -398,24 +433,6 @@ bool IsAlignedTo(uint32_t offset, uint32_t alignment) { return 0 == (offset % alignment); } -std::string getStorageClassString(spv::StorageClass sc) { - switch (sc) { - case spv::StorageClass::Uniform: - return "Uniform"; - case spv::StorageClass::UniformConstant: - return "UniformConstant"; - case spv::StorageClass::PushConstant: - return "PushConstant"; - case spv::StorageClass::Workgroup: - return "Workgroup"; - case spv::StorageClass::PhysicalStorageBuffer: - return "PhysicalStorageBuffer"; - default: - // Only other valid storage class in these checks - return "StorageBuffer"; - } -} - // Returns SPV_SUCCESS if the given struct satisfies standard layout rules for // Block or BufferBlocks in Vulkan. Otherwise emits a diagnostic and returns // something other than SPV_SUCCESS. Matrices inherit the specified column @@ -442,7 +459,7 @@ spv_result_t checkLayout(uint32_t struct_id, spv::StorageClass storage_class, DiagnosticStream ds = std::move( vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(struct_id)) << "Structure id " << struct_id << " decorated as " << decoration_str - << " for variable in " << getStorageClassString(storage_class) + << " for variable in " << StorageClassToString(storage_class) << " storage class must follow " << (scalar_block_layout ? "scalar " @@ -471,7 +488,7 @@ spv_result_t checkLayout(uint32_t struct_id, spv::StorageClass storage_class, return vstate.MissingFeature("uniformBufferStandardLayout feature", "--uniform-buffer-standard-layout", true); } else { - return vstate.MissingFeature("scalarBlockLayoutfeature feature", + return vstate.MissingFeature("scalarBlockLayout feature", "--scalar-block-layout", true); } } @@ -562,7 +579,8 @@ spv_result_t checkLayout(uint32_t struct_id, spv::StorageClass storage_class, } if (!scalar_block_layout && relaxed_block_layout && - opcode == spv::Op::OpTypeVector) { + (opcode == spv::Op::OpTypeVector || + opcode == spv::Op::OpTypeVectorIdEXT)) { // In relaxed block layout, the vector offset must be aligned to the // vector's scalar element type. const auto componentId = inst->words()[2]; @@ -586,7 +604,8 @@ spv_result_t checkLayout(uint32_t struct_id, spv::StorageClass storage_class, << nextValidOffset - 1 << extra(); if (!scalar_block_layout && relaxed_block_layout) { // Check improper straddle of vectors. - if (spv::Op::OpTypeVector == opcode && + if ((spv::Op::OpTypeVector == opcode || + spv::Op::OpTypeVectorIdEXT == opcode) && hasImproperStraddle(id, offset, constraint, constraints, vstate)) return fail(memberIdx) << "is an improperly straddling vector at offset " << offset @@ -848,32 +867,35 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { if (storage_class == spv::StorageClass::TaskPayloadWorkgroupEXT) { if (has_task_payload) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) - << "There can be at most one OpVariable with storage " + << "There can be at most one " + "OpVariable with storage " "class TaskPayloadWorkgroupEXT associated with " "an OpEntryPoint"; } has_task_payload = true; } - } - if (vstate.version() >= SPV_SPIRV_VERSION_WORD(1, 4)) { + // Starting in 1.4, OpEntryPoint must list all global variables // it statically uses and those interfaces must be unique. if (storage_class == spv::StorageClass::Function) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) - << "OpEntryPoint interfaces should only list global " + << "In SPIR-V 1.4 or later, OpEntryPoint interfaces should " + "only list global " "variables"; } if (!seen_vars.insert(var_instr).second) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) - << "Non-unique OpEntryPoint interface " + << "In SPIR-V 1.4 or later, non-unique OpEntryPoint " + "interface " << vstate.getIdName(interface) << " is disallowed"; } } else { if (storage_class != spv::StorageClass::Input && storage_class != spv::StorageClass::Output) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) - << "OpEntryPoint interfaces must be OpVariables with " + << "In SPIR-V 1.3 or earlier, OpEntryPoint interfaces must " + "be OpVariables with " "Storage Class of Input(1) or Output(3). Found Storage " "Class " << uint32_t(storage_class) << " for Entry Point id " @@ -881,6 +903,11 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { } } + // Descriptor heap's base variables have no data type in declaration. + if (untyped_pointers && var_instr->words().size() < 5 && + vstate.IsDescriptorHeapBaseVariable(var_instr)) + continue; + // It is guaranteed (by validator ID checks) that ptr_instr is // OpTypePointer. Word 3 of this instruction is the type being pointed // to. For untyped variables, the pointee type comes from the data type @@ -1013,8 +1040,7 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { hasDecoration(var_instr->id(), spv::Decoration::Flat, vstate); if (has_frag && storage_class == spv::StorageClass::Input && !has_flat && - ((vstate.IsFloatScalarType(type_id) && - vstate.GetBitWidth(type_id) == 64) || + (vstate.IsFloatScalarType(type_id, 64) || vstate.IsIntScalarOrVectorType(type_id))) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) << vstate.VkErrorID(4744) @@ -1176,6 +1202,59 @@ void ComputeMemberConstraintsForArray(MemberConstraints* constraints, } } +spv_result_t CheckDecorationsOfVariables(ValidationState_t& vstate) { + if (!spvIsVulkanEnv(vstate.context()->target_env)) { + return SPV_SUCCESS; + } + for (const auto& inst : vstate.ordered_instructions()) { + if ((spv::Op::OpVariable == inst.opcode()) || + (spv::Op::OpUntypedVariableKHR == inst.opcode())) { + const auto var_id = inst.id(); + const auto storageClass = inst.GetOperandAs(2); + const bool uniform = storageClass == spv::StorageClass::Uniform; + const bool uniform_constant = + storageClass == spv::StorageClass::UniformConstant; + const bool storage_buffer = + storageClass == spv::StorageClass::StorageBuffer; + + const char* sc_str = uniform ? "Uniform" + : uniform_constant ? "UniformConstant" + : "StorageBuffer"; + // Check variables in the UniformConstant, StorageBuffer, and Uniform + // storage classes are decorated with DescriptorSet and Binding + // (VUID-06677). + if (uniform_constant || storage_buffer || uniform) { + if (vstate.IsDescriptorHeapBaseVariable(&inst)) { + continue; + } + // Skip validation if the variable is not used and we're looking + // at a module coming from HLSL that has not been legalized yet. + if (vstate.options()->before_hlsl_legalization && + vstate.EntryPointReferences(var_id).empty()) { + continue; + } + if (!hasDecoration(var_id, spv::Decoration::DescriptorSet, vstate)) { + return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) + << vstate.VkErrorID(6677) << sc_str << " id '" << var_id + << "' is missing DescriptorSet decoration.\n" + << "From Vulkan spec:\n" + << "These variables must have DescriptorSet and Binding " + "decorations specified"; + } + if (!hasDecoration(var_id, spv::Decoration::Binding, vstate)) { + return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) + << vstate.VkErrorID(6677) << sc_str << " id '" << var_id + << "' is missing Binding decoration.\n" + << "From Vulkan spec:\n" + << "These variables must have DescriptorSet and Binding " + "decorations specified"; + } + } + } + } + return SPV_SUCCESS; +} + spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { // Set of entry points that are known to use a push constant. std::unordered_set uses_push_constant; @@ -1195,8 +1274,6 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { const auto storageClassVal = words[3]; const auto storageClass = spv::StorageClass(storageClassVal); const bool uniform = storageClass == spv::StorageClass::Uniform; - const bool uniform_constant = - storageClass == spv::StorageClass::UniformConstant; const bool push_constant = storageClass == spv::StorageClass::PushConstant; const bool storage_buffer = @@ -1205,7 +1282,8 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { if (spvIsVulkanEnv(vstate.context()->target_env)) { // Vulkan: There must be no more than one PushConstant block per entry // point. - if (push_constant) { + if (push_constant && + !(vstate.HasCapability(spv::Capability::PushConstantBanksNV))) { auto entry_points = vstate.EntryPointReferences(var_id); for (auto ep_id : entry_points) { const bool already_used = !uses_push_constant.insert(ep_id).second; @@ -1219,29 +1297,6 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { } } } - // Vulkan: Check DescriptorSet and Binding decoration for - // UniformConstant which cannot be a struct. - if (uniform_constant) { - auto entry_points = vstate.EntryPointReferences(var_id); - if (!entry_points.empty() && - !hasDecoration(var_id, spv::Decoration::DescriptorSet, vstate)) { - return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) - << vstate.VkErrorID(6677) << "UniformConstant id '" << var_id - << "' is missing DescriptorSet decoration.\n" - << "From Vulkan spec:\n" - << "These variables must have DescriptorSet and Binding " - "decorations specified"; - } - if (!entry_points.empty() && - !hasDecoration(var_id, spv::Decoration::Binding, vstate)) { - return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) - << vstate.VkErrorID(6677) << "UniformConstant id '" << var_id - << "' is missing Binding decoration.\n" - << "From Vulkan spec:\n" - << "These variables must have DescriptorSet and Binding " - "decorations specified"; - } - } } if (spvIsOpenGLEnv(vstate.context()->target_env)) { @@ -1254,7 +1309,7 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { if (!entry_points.empty() && !hasDecoration(var_id, spv::Decoration::Binding, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) - << getStorageClassString(storageClass) << " id '" << var_id + << StorageClassToString(storageClass) << " id '" << var_id << "' is missing Binding decoration.\n" << "From ARB_gl_spirv extension:\n" << "Uniform and shader storage block variables must " @@ -1269,6 +1324,24 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { storageClass == spv::StorageClass::Workgroup && vstate.HasCapability( spv::Capability::WorkgroupMemoryExplicitLayoutKHR); + + if (spvIsVulkanEnv(vstate.context()->target_env) && + inst.opcode() == spv::Op::OpUntypedVariableKHR && + storageClass != spv::StorageClass::UniformConstant && + vstate.IsDescriptorHeapBaseVariable(&inst)) { + if (vstate.IsBuiltin(inst.id(), spv::BuiltIn::ResourceHeapEXT)) { + return vstate.diag(SPV_ERROR_INVALID_DATA, &inst) + << vstate.VkErrorID(11241) + << "The variable decorated with ResourceHeapEXT must be " + << "declared using the UniformConstant storage class."; + } + if (vstate.IsBuiltin(inst.id(), spv::BuiltIn::SamplerHeapEXT)) { + return vstate.diag(SPV_ERROR_INVALID_DATA, &inst) + << vstate.VkErrorID(11239) + << "The variable decorated with SamplerHeapEXT must be " + << "declared using the UniformConstant storage class."; + } + } if (uniform || push_constant || storage_buffer || phys_storage_buffer || workgroup) { const auto ptrInst = vstate.FindDef(words[1]); @@ -1327,32 +1400,6 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { << "Such variables must be identified with a Block or " "BufferBlock decoration"; } - // Vulkan: Check DescriptorSet and Binding decoration for - // Uniform and StorageBuffer variables. - if (uniform || storage_buffer) { - auto entry_points = vstate.EntryPointReferences(var_id); - if (!entry_points.empty() && - !hasDecoration(var_id, spv::Decoration::DescriptorSet, - vstate)) { - return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) - << vstate.VkErrorID(6677) - << getStorageClassString(storageClass) << " id '" << var_id - << "' is missing DescriptorSet decoration.\n" - << "From Vulkan spec:\n" - << "These variables must have DescriptorSet and Binding " - "decorations specified"; - } - if (!entry_points.empty() && - !hasDecoration(var_id, spv::Decoration::Binding, vstate)) { - return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) - << vstate.VkErrorID(6677) - << getStorageClassString(storageClass) << " id '" << var_id - << "' is missing Binding decoration.\n" - << "From Vulkan spec:\n" - << "These variables must have DescriptorSet and Binding " - "decorations specified"; - } - } } if (id != 0) { @@ -1392,12 +1439,14 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { if (!checkForRequiredDecoration( id, [](spv::Decoration d) { - return d == spv::Decoration::ArrayStride; + return d == spv::Decoration::ArrayStride || + d == spv::Decoration::ArrayStrideIdEXT; }, spv::Op::OpTypeArray, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) << "Structure id " << id << " decorated as " << deco_str - << " must be explicitly laid out with ArrayStride " + << " must be explicitly laid out with ArrayStride or " + "ArrayStrideIdEXT " "decorations."; } @@ -1545,10 +1594,13 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { bufferRules ? (sc == spv::StorageClass::Uniform ? "BufferBlock" : "Block") : "Block"; - if (auto result = - checkLayout(data_type_id, sc, deco_str, !bufferRules, - scalar_block_layout, 0, constraints, vstate)) { - return result; + + if (!vstate.IsDescriptorHeapBaseVariable(&inst)) { + if (auto result = + checkLayout(data_type_id, sc, deco_str, !bufferRules, + scalar_block_layout, 0, constraints, vstate)) { + return result; + } } } } @@ -1583,7 +1635,8 @@ spv_result_t CheckDecorationsCompatibility(ValidationState_t& vstate) { // An Array of pairs where the decorations in the pair cannot both be applied // to the same member. static const spv::Decoration mutually_exclusive_per_member[][2] = { - {spv::Decoration::RowMajor, spv::Decoration::ColMajor}}; + {spv::Decoration::RowMajor, spv::Decoration::ColMajor}, + {spv::Decoration::Offset, spv::Decoration::OffsetIdEXT}}; static const auto num_mutually_exclusive_per_mem_pairs = sizeof(mutually_exclusive_per_member) / (2 * sizeof(spv::Decoration)); @@ -1625,7 +1678,8 @@ spv_result_t CheckDecorationsCompatibility(ValidationState_t& vstate) { << " is not allowed."; } } - } else if (spv::Op::OpMemberDecorate == inst.opcode()) { + } else if (spv::Op::OpMemberDecorate == inst.opcode() || + spv::Op::OpMemberDecorateIdEXT == inst.opcode()) { const auto id = words[1]; const auto member_id = words[2]; const auto dec_type = static_cast(words[3]); @@ -1788,6 +1842,7 @@ spv_result_t CheckNonReadableWritableDecorations(ValidationState_t& vstate, const auto type_id = inst.type_id(); if (opcode != spv::Op::OpVariable && opcode != spv::Op::OpUntypedVariableKHR && + opcode != spv::Op::OpBufferPointerEXT && opcode != spv::Op::OpFunctionParameter && opcode != spv::Op::OpRawAccessChainNV) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) @@ -1803,6 +1858,19 @@ spv_result_t CheckNonReadableWritableDecorations(ValidationState_t& vstate, : opcode == spv::Op::OpUntypedVariableKHR ? inst.GetOperandAs(3) : spv::StorageClass::Max; + + if (opcode == spv::Op::OpBufferPointerEXT) { + auto result_type = vstate.FindDef(inst.type_id()); + auto sc = result_type->GetOperandAs(1); + if (sc == spv::StorageClass::Uniform && is_non_writable) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target of NonWritable decoration is invalid: " + << "cannot be used to OpBufferPointerEXT " + << "with Uniform storage class"; + } + return SPV_SUCCESS; + } + if ((var_storage_class == spv::StorageClass::Function || var_storage_class == spv::StorageClass::Private) && vstate.features().nonwritable_var_in_function_or_private && @@ -2174,17 +2242,19 @@ bool AllowsLayout(ValidationState_t& vstate, const spv::StorageClass sc) { } } -bool UsesExplicitLayout(ValidationState_t& vstate, uint32_t type_id, - std::unordered_map& cache) { +// Returns a decoration used to make it explicit +spv::Decoration UsesExplicitLayout( + ValidationState_t& vstate, uint32_t type_id, + std::unordered_map& cache) { if (type_id == 0) { - return false; + return spv::Decoration::Max; } if (cache.count(type_id)) { return cache[type_id]; } - bool res = false; + spv::Decoration res = spv::Decoration::Max; const auto type_inst = vstate.FindDef(type_id); if (type_inst->opcode() == spv::Op::OpTypeStruct || type_inst->opcode() == spv::Op::OpTypeArray || @@ -2195,26 +2265,32 @@ bool UsesExplicitLayout(ValidationState_t& vstate, uint32_t type_id, const auto iter = id_decs.find(type_id); if (iter != id_decs.end()) { bool allowLayoutDecorations = false; - if (type_inst->opcode() == spv::Op::OpTypePointer) { + if (type_inst->opcode() == spv::Op::OpTypePointer || + type_inst->opcode() == spv::Op::OpTypeUntypedPointerKHR) { const auto sc = type_inst->GetOperandAs(1); allowLayoutDecorations = AllowsLayout(vstate, sc); } if (!allowLayoutDecorations) { - res = std::any_of( - iter->second.begin(), iter->second.end(), [](const Decoration& d) { - return d.dec_type() == spv::Decoration::Block || - d.dec_type() == spv::Decoration::BufferBlock || - d.dec_type() == spv::Decoration::Offset || - d.dec_type() == spv::Decoration::ArrayStride || - d.dec_type() == spv::Decoration::MatrixStride; - }); + for (const auto& d : iter->second) { + const spv::Decoration dec = d.dec_type(); + if (dec == spv::Decoration::Block || + dec == spv::Decoration::BufferBlock || + dec == spv::Decoration::Offset || + dec == spv::Decoration::ArrayStride || + dec == spv::Decoration::MatrixStride) { + res = dec; + break; + } + } } } - if (!res) { + if (res == spv::Decoration::Max) { switch (type_inst->opcode()) { case spv::Op::OpTypeStruct: - for (uint32_t i = 1; !res && i < type_inst->operands().size(); i++) { + for (uint32_t i = 1; + res == spv::Decoration::Max && i < type_inst->operands().size(); + i++) { res = UsesExplicitLayout( vstate, type_inst->GetOperandAs(i), cache); } @@ -2246,11 +2322,15 @@ spv_result_t CheckInvalidVulkanExplicitLayout(ValidationState_t& vstate) { return SPV_SUCCESS; } - std::unordered_map cache; + std::unordered_map cache; for (const auto& inst : vstate.ordered_instructions()) { const auto type_id = inst.type_id(); const auto type_inst = vstate.FindDef(type_id); + + spv::StorageClass sc = spv::StorageClass::Max; + spv::Decoration layout_dec = spv::Decoration::Max; uint32_t fail_id = 0; + uint32_t base_id = 0; // Variables are the main place to check for improper decorations, but some // untyped pointer instructions must also be checked since those types may // never be instantiated by a variable. Unlike verifying a valid layout, @@ -2259,16 +2339,19 @@ spv_result_t CheckInvalidVulkanExplicitLayout(ValidationState_t& vstate) { switch (inst.opcode()) { case spv::Op::OpVariable: case spv::Op::OpUntypedVariableKHR: { - const auto sc = inst.GetOperandAs(2); + sc = inst.GetOperandAs(2); auto check_id = type_id; + base_id = inst.id(); if (inst.opcode() == spv::Op::OpUntypedVariableKHR) { if (inst.operands().size() > 3) { check_id = inst.GetOperandAs(3); } } - if (!AllowsLayout(vstate, sc) && - UsesExplicitLayout(vstate, check_id, cache)) { - fail_id = check_id; + if (!AllowsLayout(vstate, sc)) { + layout_dec = UsesExplicitLayout(vstate, check_id, cache); + if (layout_dec != spv::Decoration::Max) { + fail_id = check_id; + } } break; } @@ -2278,13 +2361,18 @@ spv_result_t CheckInvalidVulkanExplicitLayout(ValidationState_t& vstate) { case spv::Op::OpUntypedInBoundsPtrAccessChainKHR: { // Check both the base type and return type. The return type may have an // invalid array stride. - const auto sc = type_inst->GetOperandAs(1); - const auto base_type_id = inst.GetOperandAs(2); + sc = type_inst->GetOperandAs(1); + base_id = vstate.FindDef(inst.GetOperandAs(3))->id(); if (!AllowsLayout(vstate, sc)) { - if (UsesExplicitLayout(vstate, base_type_id, cache)) { + const auto base_type_id = inst.GetOperandAs(2); + layout_dec = UsesExplicitLayout(vstate, base_type_id, cache); + if (layout_dec != spv::Decoration::Max) { fail_id = base_type_id; - } else if (UsesExplicitLayout(vstate, type_id, cache)) { - fail_id = type_id; + } else { + layout_dec = UsesExplicitLayout(vstate, type_id, cache); + if (layout_dec != spv::Decoration::Max) { + fail_id = type_id; + } } } break; @@ -2294,23 +2382,29 @@ spv_result_t CheckInvalidVulkanExplicitLayout(ValidationState_t& vstate) { const auto ptr_ty_id = vstate.FindDef(inst.GetOperandAs(3))->type_id(); const auto ptr_ty = vstate.FindDef(ptr_ty_id); - const auto sc = ptr_ty->GetOperandAs(1); - const auto base_type_id = inst.GetOperandAs(2); - if (!AllowsLayout(vstate, sc) && - UsesExplicitLayout(vstate, base_type_id, cache)) { - fail_id = base_type_id; + sc = ptr_ty->GetOperandAs(1); + base_id = vstate.FindDef(inst.GetOperandAs(3))->id(); + if (!AllowsLayout(vstate, sc)) { + const auto base_type_id = inst.GetOperandAs(2); + layout_dec = UsesExplicitLayout(vstate, base_type_id, cache); + if (layout_dec != spv::Decoration::Max) { + fail_id = base_type_id; + } } break; } case spv::Op::OpLoad: { const auto ptr_id = inst.GetOperandAs(2); const auto ptr_type = vstate.FindDef(vstate.FindDef(ptr_id)->type_id()); + base_id = ptr_id; if (ptr_type->opcode() == spv::Op::OpTypeUntypedPointerKHR) { // For untyped pointers check the return type for an invalid layout. - const auto sc = ptr_type->GetOperandAs(1); - if (!AllowsLayout(vstate, sc) && - UsesExplicitLayout(vstate, type_id, cache)) { - fail_id = type_id; + sc = ptr_type->GetOperandAs(1); + if (!AllowsLayout(vstate, sc)) { + layout_dec = UsesExplicitLayout(vstate, type_id, cache); + if (layout_dec != spv::Decoration::Max) { + fail_id = type_id; + } } } break; @@ -2318,26 +2412,55 @@ spv_result_t CheckInvalidVulkanExplicitLayout(ValidationState_t& vstate) { case spv::Op::OpStore: { const auto ptr_id = inst.GetOperandAs(1); const auto ptr_type = vstate.FindDef(vstate.FindDef(ptr_id)->type_id()); + base_id = inst.GetOperandAs(0); if (ptr_type->opcode() == spv::Op::OpTypeUntypedPointerKHR) { // For untyped pointers, check the type of the data operand for an // invalid layout. - const auto sc = ptr_type->GetOperandAs(1); - const auto data_type_id = vstate.GetOperandTypeId(&inst, 1); - if (!AllowsLayout(vstate, sc) && - UsesExplicitLayout(vstate, data_type_id, cache)) { - fail_id = inst.GetOperandAs(2); + sc = ptr_type->GetOperandAs(1); + if (!AllowsLayout(vstate, sc)) { + const auto data_type_id = vstate.GetOperandTypeId(&inst, 1); + layout_dec = UsesExplicitLayout(vstate, data_type_id, cache); + if (layout_dec != spv::Decoration::Max) { + fail_id = inst.GetOperandAs(2); + } } } break; } + case spv::Op::OpBufferPointerEXT: { + const auto ptr_id = inst.GetOperandAs(1); + const auto ptr_type = vstate.FindDef(vstate.FindDef(ptr_id)->type_id()); + // Check the type of the data operand for an invalid layout. + sc = ptr_type->GetOperandAs(1); + if (!AllowsLayout(vstate, sc) && + UsesExplicitLayout(vstate, type_id, cache) != + spv::Decoration::Max) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << vstate.VkErrorID(11346) + << "The result type operand of OpBufferPointerEXT must have " + << "a Type operand that is explicitly laid out : " + << vstate.getIdName(type_id); + } else if (sc != spv::StorageClass::StorageBuffer && + sc != spv::StorageClass::Uniform) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpBufferPointerEXT's Result Type must be a pointer type " + << "with a Storage Class of Uniform or StorageBuffer."; + } + break; + } default: break; } - if (fail_id != 0) { + + if (fail_id != 0 && + !vstate.IsDescriptorHeapBaseVariable(vstate.FindDef(base_id))) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << vstate.VkErrorID(10684) << "Invalid explicit layout decorations on type for operand " - << vstate.getIdName(fail_id); + << vstate.getIdName(fail_id) << ", the " + << spvtools::StorageClassToString(sc) + << " storage class has a explicit layout from the " + << vstate.SpvDecorationString(layout_dec) << " decoration."; } } @@ -2350,6 +2473,7 @@ spv_result_t ValidateDecorations(ValidationState_t& vstate) { if (auto error = CheckImportedVariableInitialization(vstate)) return error; if (auto error = CheckDecorationsOfEntryPoints(vstate)) return error; if (auto error = CheckDecorationsOfBuffers(vstate)) return error; + if (auto error = CheckDecorationsOfVariables(vstate)) return error; if (auto error = CheckDecorationsCompatibility(vstate)) return error; if (auto error = CheckLinkageAttrOfFunctions(vstate)) return error; if (auto error = CheckVulkanMemoryModelDeprecatedDecorations(vstate)) diff --git a/third_party/spirv-tools/source/val/validate_extensions.cpp b/third_party/spirv-tools/source/val/validate_extensions.cpp index 58aaf5272a..c6d99fcf9a 100644 --- a/third_party/spirv-tools/source/val/validate_extensions.cpp +++ b/third_party/spirv-tools/source/val/validate_extensions.cpp @@ -13,6 +13,7 @@ // limitations under the License. // Validates correctness of extension SPIR-V instructions. +#include #include #include #include @@ -84,12 +85,37 @@ uint32_t GetUint32Constant(ValidationState_t& _, uint32_t id) { return inst->word(3); } +std::string GetExtInstName(const ValidationState_t& _, + const Instruction* inst) { + const uint32_t ext_inst_set = inst->word(3); + const uint32_t ext_inst_index = inst->word(4); + const spv_ext_inst_type_t ext_inst_type = + spv_ext_inst_type_t(inst->ext_inst_type()); + + const ExtInstDesc* desc = nullptr; + if (LookupExtInst(ext_inst_type, ext_inst_index, &desc) != SPV_SUCCESS || + !desc) { + return std::string("Unknown ExtInst"); + } + + auto* import_inst = _.FindDef(ext_inst_set); + assert(import_inst); + + std::ostringstream ss; + ss << import_inst->GetOperandAs(1); + ss << " "; + ss << desc->name().data(); + + return ss.str(); +} + // Check that the operand of a debug info instruction |inst| at |word_index| // is a result id of an instruction with |expected_opcode|. -spv_result_t ValidateOperandForDebugInfo( - ValidationState_t& _, const std::string& operand_name, - spv::Op expected_opcode, const Instruction* inst, uint32_t word_index, - const std::function& ext_inst_name) { +spv_result_t ValidateOperandForDebugInfo(ValidationState_t& _, + const std::string& operand_name, + spv::Op expected_opcode, + const Instruction* inst, + uint32_t word_index) { auto* operand = _.FindDef(inst->word(word_index)); if (operand->opcode() != expected_opcode) { const spvtools::InstructionDesc* desc = nullptr; @@ -97,12 +123,13 @@ spv_result_t ValidateOperandForDebugInfo( &desc) != SPV_SUCCESS || !desc) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand " << operand_name << " is invalid"; + << GetExtInstName(_, inst) << ": " << "expected operand " + << operand_name << " is invalid"; } return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " << "expected operand " << operand_name - << " must be a result id of " << "Op" << desc->name().data(); + << GetExtInstName(_, inst) << ": " << "expected operand " + << operand_name << " must be a result id of " << "Op" + << desc->name().data(); } return SPV_SUCCESS; } @@ -113,28 +140,26 @@ spv_result_t ValidateOperandForDebugInfo( // word so cannot be validated. spv_result_t ValidateUint32ConstantOperandForDebugInfo( ValidationState_t& _, const std::string& operand_name, - const Instruction* inst, uint32_t word_index, - const std::function& ext_inst_name) { + const Instruction* inst, uint32_t word_index) { if (!IsUint32Constant(_, inst->word(word_index))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": expected operand " << operand_name + << GetExtInstName(_, inst) << ": expected operand " << operand_name << " must be a result id of 32-bit unsigned OpConstant"; } return SPV_SUCCESS; } -#define CHECK_OPERAND(NAME, opcode, index) \ - do { \ - auto result = ValidateOperandForDebugInfo(_, NAME, opcode, inst, index, \ - ext_inst_name); \ - if (result != SPV_SUCCESS) return result; \ +#define CHECK_OPERAND(NAME, opcode, index) \ + do { \ + auto result = ValidateOperandForDebugInfo(_, NAME, opcode, inst, index); \ + if (result != SPV_SUCCESS) return result; \ } while (0) -#define CHECK_CONST_UINT_OPERAND(NAME, index) \ - if (vulkanDebugInfo) { \ - auto result = ValidateUint32ConstantOperandForDebugInfo( \ - _, NAME, inst, index, ext_inst_name); \ - if (result != SPV_SUCCESS) return result; \ +#define CHECK_CONST_UINT_OPERAND(NAME, index) \ + if (vulkanDebugInfo) { \ + auto result = \ + ValidateUint32ConstantOperandForDebugInfo(_, NAME, inst, index); \ + if (result != SPV_SUCCESS) return result; \ } // True if the operand of a debug info instruction |inst| at |word_index| @@ -180,7 +205,7 @@ bool DoesDebugInfoOperandMatchExpectation( spv_result_t ValidateDebugInfoOperand( ValidationState_t& _, const std::string& debug_inst_name, CommonDebugInfoInstructions expected_debug_inst, const Instruction* inst, - uint32_t word_index, const std::function& ext_inst_name) { + uint32_t word_index) { std::function expectation = [expected_debug_inst](CommonDebugInfoInstructions dbg_inst) { return dbg_inst == expected_debug_inst; @@ -193,38 +218,39 @@ spv_result_t ValidateDebugInfoOperand( SPV_SUCCESS || !desc) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand " << debug_inst_name << " is invalid"; + << GetExtInstName(_, inst) << ": " << "expected operand " + << debug_inst_name << " is invalid"; } return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " << "expected operand " << debug_inst_name - << " must be a result id of " << desc->name().data(); + << GetExtInstName(_, inst) << ": " << "expected operand " + << debug_inst_name << " must be a result id of " + << desc->name().data(); } -#define CHECK_DEBUG_OPERAND(NAME, debug_opcode, index) \ - do { \ - auto result = ValidateDebugInfoOperand(_, NAME, debug_opcode, inst, index, \ - ext_inst_name); \ - if (result != SPV_SUCCESS) return result; \ +#define CHECK_DEBUG_OPERAND(NAME, debug_opcode, index) \ + do { \ + auto result = \ + ValidateDebugInfoOperand(_, NAME, debug_opcode, inst, index); \ + if (result != SPV_SUCCESS) return result; \ } while (0) // Check that the operand of a debug info instruction |inst| at |word_index| // is a result id of an debug info instruction with DebugTypeBasic. -spv_result_t ValidateOperandBaseType( - ValidationState_t& _, const Instruction* inst, uint32_t word_index, - const std::function& ext_inst_name) { +spv_result_t ValidateOperandBaseType(ValidationState_t& _, + const Instruction* inst, + uint32_t word_index) { return ValidateDebugInfoOperand(_, "Base Type", CommonDebugInfoDebugTypeBasic, - inst, word_index, ext_inst_name); + inst, word_index); } // Check that the operand of a debug info instruction |inst| at |word_index| // is a result id of a debug lexical scope instruction which is one of // DebugCompilationUnit, DebugFunction, DebugLexicalBlock, or // DebugTypeComposite. -spv_result_t ValidateOperandLexicalScope( - ValidationState_t& _, const std::string& debug_inst_name, - const Instruction* inst, uint32_t word_index, - const std::function& ext_inst_name) { +spv_result_t ValidateOperandLexicalScope(ValidationState_t& _, + const std::string& debug_inst_name, + const Instruction* inst, + uint32_t word_index) { std::function expectation = [](CommonDebugInfoInstructions dbg_inst) { return dbg_inst == CommonDebugInfoDebugCompilationUnit || @@ -236,19 +262,18 @@ spv_result_t ValidateOperandLexicalScope( return SPV_SUCCESS; return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand " << debug_inst_name - << " must be a result id of a lexical scope"; + << GetExtInstName(_, inst) << ": " << "expected operand " + << debug_inst_name << " must be a result id of a lexical scope"; } // Check that the operand of a debug info instruction |inst| at |word_index| // is a result id of a debug type instruction (See DebugTypeXXX in // "4.3. Type instructions" section of OpenCL.DebugInfo.100 spec. -spv_result_t ValidateOperandDebugType( - ValidationState_t& _, const std::string& debug_inst_name, - const Instruction* inst, uint32_t word_index, - const std::function& ext_inst_name, - bool allow_template_param) { +spv_result_t ValidateOperandDebugType(ValidationState_t& _, + const std::string& debug_inst_name, + const Instruction* inst, + uint32_t word_index, + bool allow_template_param) { // Check for NonSemanticShaderDebugInfo100 specific types. if (inst->ext_inst_type() == SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100) { @@ -275,9 +300,8 @@ spv_result_t ValidateOperandDebugType( return SPV_SUCCESS; return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand " << debug_inst_name - << " is not a valid debug type"; + << GetExtInstName(_, inst) << ": " << "expected operand " + << debug_inst_name << " is not a valid debug type"; } spv_result_t ValidateClspvReflectionKernel(ValidationState_t& _, @@ -1052,7 +1076,9 @@ bool IsDebugVariableWithIntScalarType(ValidationState_t& _, spv_result_t ValidateExtension(ValidationState_t& _, const Instruction* inst) { std::string extension = GetExtensionString(&(inst->c_inst())); if (_.version() < SPV_SPIRV_VERSION_WORD(1, 3)) { - if (extension == ExtensionToString(kSPV_KHR_vulkan_memory_model)) { + if (extension == ExtensionToString(kSPV_KHR_vulkan_memory_model) || + extension == + ExtensionToString(kSPV_QCOM_cooperative_matrix_conversion)) { return _.diag(SPV_ERROR_WRONG_VERSION, inst) << extension << " extension requires SPIR-V version 1.3 or later."; } @@ -1062,9 +1088,12 @@ spv_result_t ValidateExtension(ValidationState_t& _, const Instruction* inst) { ExtensionToString(kSPV_KHR_workgroup_memory_explicit_layout) || extension == ExtensionToString(kSPV_EXT_mesh_shader) || extension == ExtensionToString(kSPV_NV_shader_invocation_reorder) || + extension == ExtensionToString(kSPV_EXT_shader_invocation_reorder) || extension == ExtensionToString(kSPV_NV_cluster_acceleration_structure) || - extension == ExtensionToString(kSPV_NV_linear_swept_spheres)) { + extension == ExtensionToString(kSPV_NV_linear_swept_spheres) || + extension == ExtensionToString(kSPV_QCOM_image_processing) || + extension == ExtensionToString(kSPV_QCOM_image_processing2)) { return _.diag(SPV_ERROR_WRONG_VERSION, inst) << extension << " extension requires SPIR-V version 1.4 or later."; } @@ -1081,2755 +1110,2758 @@ spv_result_t ValidateExtInstImport(ValidationState_t& _, const std::string name = inst->GetOperandAs(name_id); if (name.find("NonSemantic.") == 0) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "NonSemantic extended instruction sets cannot be declared " - "without SPV_KHR_non_semantic_info."; + << "NonSemantic extended instruction " + "sets cannot be declared " + "without SPV_KHR_non_semantic_info. (This can also be fixed " + "having SPIR-V 1.6 or later)"; } } return SPV_SUCCESS; } -spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { +spv_result_t ValidateExtInstGlslStd450(ValidationState_t& _, + const Instruction* inst) { const uint32_t result_type = inst->type_id(); const uint32_t num_operands = static_cast(inst->operands().size()); - const uint32_t ext_inst_set = inst->word(3); const uint32_t ext_inst_index = inst->word(4); - const spv_ext_inst_type_t ext_inst_type = - spv_ext_inst_type_t(inst->ext_inst_type()); + const GLSLstd450 ext_inst_key = GLSLstd450(ext_inst_index); + switch (ext_inst_key) { + case GLSLstd450Round: + case GLSLstd450RoundEven: + case GLSLstd450FAbs: + case GLSLstd450Trunc: + case GLSLstd450FSign: + case GLSLstd450Floor: + case GLSLstd450Ceil: + case GLSLstd450Fract: + case GLSLstd450Sqrt: + case GLSLstd450InverseSqrt: + case GLSLstd450FMin: + case GLSLstd450FMax: + case GLSLstd450FClamp: + case GLSLstd450FMix: + case GLSLstd450Step: + case GLSLstd450SmoothStep: + case GLSLstd450Fma: + case GLSLstd450Normalize: + case GLSLstd450FaceForward: + case GLSLstd450Reflect: + case GLSLstd450NMin: + case GLSLstd450NMax: + case GLSLstd450NClamp: { + bool supportsCoopVec = + (ext_inst_key == GLSLstd450FMin || ext_inst_key == GLSLstd450FMax || + ext_inst_key == GLSLstd450FClamp || ext_inst_key == GLSLstd450NMin || + ext_inst_key == GLSLstd450NMax || ext_inst_key == GLSLstd450NClamp || + ext_inst_key == GLSLstd450Step || ext_inst_key == GLSLstd450Fma); - auto ext_inst_name = [&_, ext_inst_set, ext_inst_type, ext_inst_index]() { - const ExtInstDesc* desc = nullptr; - if (LookupExtInst(ext_inst_type, ext_inst_index, &desc) != SPV_SUCCESS || - !desc) { - return std::string("Unknown ExtInst"); + if (!_.IsFloatScalarOrVectorType(result_type) && + !(supportsCoopVec && _.IsFloatCooperativeVectorNVType(result_type))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; } - auto* import_inst = _.FindDef(ext_inst_set); - assert(import_inst); - - std::ostringstream ss; - ss << import_inst->GetOperandAs(1); - ss << " "; - ss << desc->name().data(); - - return ss.str(); - }; - - if (ext_inst_type == SPV_EXT_INST_TYPE_GLSL_STD_450) { - const GLSLstd450 ext_inst_key = GLSLstd450(ext_inst_index); - switch (ext_inst_key) { - case GLSLstd450Round: - case GLSLstd450RoundEven: - case GLSLstd450FAbs: - case GLSLstd450Trunc: - case GLSLstd450FSign: - case GLSLstd450Floor: - case GLSLstd450Ceil: - case GLSLstd450Fract: - case GLSLstd450Sqrt: - case GLSLstd450InverseSqrt: - case GLSLstd450FMin: - case GLSLstd450FMax: - case GLSLstd450FClamp: - case GLSLstd450FMix: - case GLSLstd450Step: - case GLSLstd450SmoothStep: - case GLSLstd450Fma: - case GLSLstd450Normalize: - case GLSLstd450FaceForward: - case GLSLstd450Reflect: - case GLSLstd450NMin: - case GLSLstd450NMax: - case GLSLstd450NClamp: { - bool supportsCoopVec = - (ext_inst_key == GLSLstd450FMin || ext_inst_key == GLSLstd450FMax || - ext_inst_key == GLSLstd450FClamp || - ext_inst_key == GLSLstd450NMin || ext_inst_key == GLSLstd450NMax || - ext_inst_key == GLSLstd450NClamp || - ext_inst_key == GLSLstd450Step || ext_inst_key == GLSLstd450Fma); - - if (!_.IsFloatScalarOrVectorType(result_type) && - !(supportsCoopVec && - _.IsFloatCooperativeVectorNVType(result_type))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar or vector type"; - } - - for (uint32_t operand_index = 4; operand_index < num_operands; - ++operand_index) { - const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); - if (result_type != operand_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected types of all operands to be equal to Result " - "Type"; - } - } - break; - } - - case GLSLstd450SAbs: - case GLSLstd450SSign: - case GLSLstd450UMin: - case GLSLstd450SMin: - case GLSLstd450UMax: - case GLSLstd450SMax: - case GLSLstd450UClamp: - case GLSLstd450SClamp: - case GLSLstd450FindILsb: - case GLSLstd450FindUMsb: - case GLSLstd450FindSMsb: { - bool supportsCoopVec = - (ext_inst_key == GLSLstd450UMin || ext_inst_key == GLSLstd450UMax || - ext_inst_key == GLSLstd450UClamp || - ext_inst_key == GLSLstd450SMin || ext_inst_key == GLSLstd450SMax || - ext_inst_key == GLSLstd450SClamp); - - if (!_.IsIntScalarOrVectorType(result_type) && - !(supportsCoopVec && _.IsIntCooperativeVectorNVType(result_type))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be an int scalar or vector type"; - } - - const uint32_t result_type_bit_width = _.GetBitWidth(result_type); - const uint32_t result_type_dimension = _.GetDimension(result_type); - - for (uint32_t operand_index = 4; operand_index < num_operands; - ++operand_index) { - const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); - if (!operand_type || - (!_.IsIntScalarOrVectorType(operand_type) && - !(supportsCoopVec && - _.IsIntCooperativeVectorNVType(operand_type)))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected all operands to be int scalars or vectors"; - } - - if (result_type_dimension != _.GetDimension(operand_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected all operands to have the same dimension as " - << "Result Type"; - } - - if (result_type_bit_width != _.GetBitWidth(operand_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected all operands to have the same bit width as " - << "Result Type"; - } - - if (ext_inst_key == GLSLstd450FindUMsb || - ext_inst_key == GLSLstd450FindSMsb) { - if (result_type_bit_width != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "this instruction is currently limited to 32-bit width " - << "components"; - } - } - } - break; - } - - case GLSLstd450Radians: - case GLSLstd450Degrees: - case GLSLstd450Sin: - case GLSLstd450Cos: - case GLSLstd450Tan: - case GLSLstd450Asin: - case GLSLstd450Acos: - case GLSLstd450Atan: - case GLSLstd450Sinh: - case GLSLstd450Cosh: - case GLSLstd450Tanh: - case GLSLstd450Asinh: - case GLSLstd450Acosh: - case GLSLstd450Atanh: - case GLSLstd450Exp: - case GLSLstd450Exp2: - case GLSLstd450Log: - case GLSLstd450Log2: - case GLSLstd450Atan2: - case GLSLstd450Pow: { - bool supportsCoopVec = - (ext_inst_key == GLSLstd450Atan || ext_inst_key == GLSLstd450Tanh || - ext_inst_key == GLSLstd450Exp || ext_inst_key == GLSLstd450Log); - - if (!_.IsFloatScalarOrVectorType(result_type) && - !(supportsCoopVec && - _.IsFloatCooperativeVectorNVType(result_type))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 16 or 32-bit scalar or " - "vector float type"; - } - - const uint32_t result_type_bit_width = _.GetBitWidth(result_type); - if (result_type_bit_width != 16 && result_type_bit_width != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 16 or 32-bit scalar or " - "vector float type"; - } - - for (uint32_t operand_index = 4; operand_index < num_operands; - ++operand_index) { - const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); - if (result_type != operand_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected types of all operands to be equal to Result " - "Type"; - } - } - break; - } - - case GLSLstd450Determinant: { - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - uint32_t num_rows = 0; - uint32_t num_cols = 0; - uint32_t col_type = 0; - uint32_t component_type = 0; - if (!_.GetMatrixTypeInfo(x_type, &num_rows, &num_cols, &col_type, - &component_type) || - num_rows != num_cols) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X to be a square matrix"; - } - - if (result_type != component_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X component type to be equal to " - << "Result Type"; - } - break; - } - - case GLSLstd450MatrixInverse: { - uint32_t num_rows = 0; - uint32_t num_cols = 0; - uint32_t col_type = 0; - uint32_t component_type = 0; - if (!_.GetMatrixTypeInfo(result_type, &num_rows, &num_cols, &col_type, - &component_type) || - num_rows != num_cols) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a square matrix"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - if (result_type != x_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X type to be equal to Result Type"; - } - break; - } - - case GLSLstd450Modf: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or vector float type"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - const uint32_t i_type = _.GetOperandTypeId(inst, 5); - - if (x_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X type to be equal to Result Type"; - } - - spv::StorageClass i_storage_class; - uint32_t i_data_type = 0; - if (!_.GetPointerTypeInfo(i_type, &i_data_type, &i_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand I to be a pointer"; - } - - if (i_data_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand I data type to be equal to Result Type"; - } - - break; - } - - case GLSLstd450ModfStruct: { - std::vector result_types; - if (!_.GetStructMemberTypes(result_type, &result_types) || - result_types.size() != 2 || - !_.IsFloatScalarOrVectorType(result_types[0]) || - result_types[1] != result_types[0]) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a struct with two identical " - << "scalar or vector float type members"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - if (x_type != result_types[0]) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X type to be equal to members of " - << "Result Type struct"; - } - break; - } - - case GLSLstd450Frexp: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or vector float type"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - const uint32_t exp_type = _.GetOperandTypeId(inst, 5); - - if (x_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X type to be equal to Result Type"; - } - - spv::StorageClass exp_storage_class; - uint32_t exp_data_type = 0; - if (!_.GetPointerTypeInfo(exp_type, &exp_data_type, - &exp_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Exp to be a pointer"; - } - - if (!_.IsIntScalarOrVectorType(exp_data_type) || - (!_.HasExtension(kSPV_AMD_gpu_shader_int16) && - _.GetBitWidth(exp_data_type) != 32) || - (_.HasExtension(kSPV_AMD_gpu_shader_int16) && - _.GetBitWidth(exp_data_type) != 16 && - _.GetBitWidth(exp_data_type) != 32)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Exp data type to be a " - << (_.HasExtension(kSPV_AMD_gpu_shader_int16) - ? "16-bit or 32-bit " - : "32-bit ") - << "int scalar or vector type"; - } - - if (_.GetDimension(result_type) != _.GetDimension(exp_data_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Exp data type to have the same component " - << "number as Result Type"; - } - - break; - } - - case GLSLstd450Ldexp: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or vector float type"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - const uint32_t exp_type = _.GetOperandTypeId(inst, 5); - - if (x_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X type to be equal to Result Type"; - } - - if (!_.IsIntScalarOrVectorType(exp_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Exp to be a 32-bit int scalar " - << "or vector type"; - } - - if (_.GetDimension(result_type) != _.GetDimension(exp_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Exp to have the same component " - << "number as Result Type"; - } - - break; - } - - case GLSLstd450FrexpStruct: { - std::vector result_types; - if (!_.GetStructMemberTypes(result_type, &result_types) || - result_types.size() != 2 || - !_.IsFloatScalarOrVectorType(result_types[0]) || - !_.IsIntScalarOrVectorType(result_types[1]) || - (!_.HasExtension(kSPV_AMD_gpu_shader_int16) && - _.GetBitWidth(result_types[1]) != 32) || - (_.HasExtension(kSPV_AMD_gpu_shader_int16) && - _.GetBitWidth(result_types[1]) != 16 && - _.GetBitWidth(result_types[1]) != 32) || - _.GetDimension(result_types[0]) != - _.GetDimension(result_types[1])) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a struct with two members, " - << "first member a float scalar or vector, second member a " - << (_.HasExtension(kSPV_AMD_gpu_shader_int16) - ? "16-bit or 32-bit " - : "32-bit ") - << "int scalar or vector with the same number of " - << "components as the first member"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - if (x_type != result_types[0]) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X type to be equal to the first member " - << "of Result Type struct"; - } - break; - } - - case GLSLstd450PackSnorm4x8: - case GLSLstd450PackUnorm4x8: { - if (!_.IsIntScalarType(result_type) || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be 32-bit int scalar type"; - } - - const uint32_t v_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatVectorType(v_type) || _.GetDimension(v_type) != 4 || - _.GetBitWidth(v_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand V to be a 32-bit float vector of size 4"; - } - break; - } - - case GLSLstd450PackSnorm2x16: - case GLSLstd450PackUnorm2x16: - case GLSLstd450PackHalf2x16: { - if (!_.IsIntScalarType(result_type) || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be 32-bit int scalar type"; - } - - const uint32_t v_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatVectorType(v_type) || _.GetDimension(v_type) != 2 || - _.GetBitWidth(v_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand V to be a 32-bit float vector of size 2"; - } - break; - } - - case GLSLstd450PackDouble2x32: { - if (!_.IsFloatScalarType(result_type) || - _.GetBitWidth(result_type) != 64) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be 64-bit float scalar type"; - } - - const uint32_t v_type = _.GetOperandTypeId(inst, 4); - if (!_.IsIntVectorType(v_type) || _.GetDimension(v_type) != 2 || - _.GetBitWidth(v_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand V to be a 32-bit int vector of size 2"; - } - break; - } - - case GLSLstd450UnpackSnorm4x8: - case GLSLstd450UnpackUnorm4x8: { - if (!_.IsFloatVectorType(result_type) || - _.GetDimension(result_type) != 4 || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 32-bit float vector of size " - "4"; - } - - const uint32_t v_type = _.GetOperandTypeId(inst, 4); - if (!_.IsIntScalarType(v_type) || _.GetBitWidth(v_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to be a 32-bit int scalar"; - } - break; - } - - case GLSLstd450UnpackSnorm2x16: - case GLSLstd450UnpackUnorm2x16: - case GLSLstd450UnpackHalf2x16: { - if (!_.IsFloatVectorType(result_type) || - _.GetDimension(result_type) != 2 || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 32-bit float vector of size " - "2"; - } - - const uint32_t v_type = _.GetOperandTypeId(inst, 4); - if (!_.IsIntScalarType(v_type) || _.GetBitWidth(v_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to be a 32-bit int scalar"; - } - break; - } - - case GLSLstd450UnpackDouble2x32: { - if (!_.IsIntVectorType(result_type) || - _.GetDimension(result_type) != 2 || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 32-bit int vector of size " - "2"; - } - - const uint32_t v_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatScalarType(v_type) || _.GetBitWidth(v_type) != 64) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand V to be a 64-bit float scalar"; - } - break; - } - - case GLSLstd450Length: { - if (!_.IsFloatScalarType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar type"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatScalarOrVectorType(x_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X to be of float scalar or vector type"; - } - - if (result_type != _.GetComponentType(x_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X component type to be equal to Result " - "Type"; - } - break; - } - - case GLSLstd450Distance: { - if (!_.IsFloatScalarType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar type"; - } - - const uint32_t p0_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatScalarOrVectorType(p0_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P0 to be of float scalar or vector type"; - } - - if (result_type != _.GetComponentType(p0_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P0 component type to be equal to " - << "Result Type"; - } - - const uint32_t p1_type = _.GetOperandTypeId(inst, 5); - if (!_.IsFloatScalarOrVectorType(p1_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P1 to be of float scalar or vector type"; - } - - if (result_type != _.GetComponentType(p1_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P1 component type to be equal to " - << "Result Type"; - } - - if (_.GetDimension(p0_type) != _.GetDimension(p1_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operands P0 and P1 to have the same number of " - << "components"; - } - break; - } - - case GLSLstd450Cross: { - if (!_.IsFloatVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float vector type"; - } - - if (_.GetDimension(result_type) != 3) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to have 3 components"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - const uint32_t y_type = _.GetOperandTypeId(inst, 5); - - if (x_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X type to be equal to Result Type"; - } - - if (y_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Y type to be equal to Result Type"; - } - break; - } - - case GLSLstd450Refract: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar or vector type"; - } - - const uint32_t i_type = _.GetOperandTypeId(inst, 4); - const uint32_t n_type = _.GetOperandTypeId(inst, 5); - const uint32_t eta_type = _.GetOperandTypeId(inst, 6); - - if (result_type != i_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand I to be of type equal to Result Type"; - } - - if (result_type != n_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand N to be of type equal to Result Type"; - } - - if (!_.IsFloatScalarType(eta_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Eta to be a float scalar"; - } - break; - } - - case GLSLstd450InterpolateAtCentroid: - case GLSLstd450InterpolateAtSample: - case GLSLstd450InterpolateAtOffset: { - if (!_.HasCapability(spv::Capability::InterpolationFunction)) { - return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) - << ext_inst_name() - << " requires capability InterpolationFunction"; - } - - if (!_.IsFloatScalarOrVectorType(result_type) || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 32-bit float scalar " - << "or vector type"; - } - - // If HLSL legalization and first operand is an OpLoad, use load - // pointer as the interpolant lvalue. Else use interpolate first - // operand. - uint32_t interp_id = inst->GetOperandAs(4); - auto* interp_inst = _.FindDef(interp_id); - uint32_t interpolant_type = (_.options()->before_hlsl_legalization && - interp_inst->opcode() == spv::Op::OpLoad) - ? _.GetOperandTypeId(interp_inst, 2) - : _.GetOperandTypeId(inst, 4); - - spv::StorageClass interpolant_storage_class; - uint32_t interpolant_data_type = 0; - if (!_.GetPointerTypeInfo(interpolant_type, &interpolant_data_type, - &interpolant_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Interpolant to be a pointer"; - } - - if (result_type != interpolant_data_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Interpolant data type to be equal to Result Type"; - } - - if (interpolant_storage_class != spv::StorageClass::Input) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Interpolant storage class to be Input"; - } - - if (ext_inst_key == GLSLstd450InterpolateAtSample) { - const uint32_t sample_type = _.GetOperandTypeId(inst, 5); - if (!_.IsIntScalarType(sample_type) || - _.GetBitWidth(sample_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Sample to be 32-bit integer"; - } - } - - if (ext_inst_key == GLSLstd450InterpolateAtOffset) { - const uint32_t offset_type = _.GetOperandTypeId(inst, 5); - if (!_.IsFloatVectorType(offset_type) || - _.GetDimension(offset_type) != 2 || - _.GetBitWidth(offset_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Offset to be a vector of 2 32-bit floats"; - } - } - - _.function(inst->function()->id()) - ->RegisterExecutionModelLimitation( - spv::ExecutionModel::Fragment, - ext_inst_name() + - std::string(" requires Fragment execution model")); - break; - } - - case GLSLstd450IMix: { + case GLSLstd450SAbs: + case GLSLstd450SSign: + case GLSLstd450UMin: + case GLSLstd450SMin: + case GLSLstd450UMax: + case GLSLstd450SMax: + case GLSLstd450UClamp: + case GLSLstd450SClamp: + case GLSLstd450FindILsb: + case GLSLstd450FindUMsb: + case GLSLstd450FindSMsb: { + bool supportsCoopVec = + (ext_inst_key == GLSLstd450UMin || ext_inst_key == GLSLstd450UMax || + ext_inst_key == GLSLstd450UClamp || ext_inst_key == GLSLstd450SMin || + ext_inst_key == GLSLstd450SMax || ext_inst_key == GLSLstd450SClamp); + + if (!_.IsIntScalarOrVectorType(result_type) && + !(supportsCoopVec && _.IsIntCooperativeVectorNVType(result_type))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Extended instruction GLSLstd450IMix is not supported"; + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be an int scalar or vector type"; } - case GLSLstd450Bad: { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Encountered extended instruction GLSLstd450Bad"; - } + const uint32_t result_type_bit_width = _.GetBitWidth(result_type); + const uint32_t result_type_dimension = _.GetDimension(result_type); - case GLSLstd450Count: { - assert(0); - break; + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (!operand_type || + (!_.IsIntScalarOrVectorType(operand_type) && + !(supportsCoopVec && + _.IsIntCooperativeVectorNVType(operand_type)))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected all operands to be int scalars or vectors"; + } + + if (result_type_dimension != _.GetDimension(operand_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected all operands to have the same dimension as " + << "Result Type"; + } + + if (result_type_bit_width != _.GetBitWidth(operand_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected all operands to have the same bit width as " + << "Result Type"; + } + + if (ext_inst_key == GLSLstd450FindUMsb || + ext_inst_key == GLSLstd450FindSMsb) { + if (result_type_bit_width != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "this instruction is currently limited to 32-bit width " + << "components"; + } + } } + break; } - } else if (ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_STD) { - const OpenCLLIB::Entrypoints ext_inst_key = - OpenCLLIB::Entrypoints(ext_inst_index); - switch (ext_inst_key) { - case OpenCLLIB::Acos: - case OpenCLLIB::Acosh: - case OpenCLLIB::Acospi: - case OpenCLLIB::Asin: - case OpenCLLIB::Asinh: - case OpenCLLIB::Asinpi: - case OpenCLLIB::Atan: - case OpenCLLIB::Atan2: - case OpenCLLIB::Atanh: - case OpenCLLIB::Atanpi: - case OpenCLLIB::Atan2pi: - case OpenCLLIB::Cbrt: - case OpenCLLIB::Ceil: - case OpenCLLIB::Copysign: - case OpenCLLIB::Cos: - case OpenCLLIB::Cosh: - case OpenCLLIB::Cospi: - case OpenCLLIB::Erfc: - case OpenCLLIB::Erf: - case OpenCLLIB::Exp: - case OpenCLLIB::Exp2: - case OpenCLLIB::Exp10: - case OpenCLLIB::Expm1: - case OpenCLLIB::Fabs: - case OpenCLLIB::Fdim: - case OpenCLLIB::Floor: - case OpenCLLIB::Fma: - case OpenCLLIB::Fmax: - case OpenCLLIB::Fmin: - case OpenCLLIB::Fmod: - case OpenCLLIB::Hypot: - case OpenCLLIB::Lgamma: - case OpenCLLIB::Log: - case OpenCLLIB::Log2: - case OpenCLLIB::Log10: - case OpenCLLIB::Log1p: - case OpenCLLIB::Logb: - case OpenCLLIB::Mad: - case OpenCLLIB::Maxmag: - case OpenCLLIB::Minmag: - case OpenCLLIB::Nextafter: - case OpenCLLIB::Pow: - case OpenCLLIB::Powr: - case OpenCLLIB::Remainder: - case OpenCLLIB::Rint: - case OpenCLLIB::Round: - case OpenCLLIB::Rsqrt: - case OpenCLLIB::Sin: - case OpenCLLIB::Sinh: - case OpenCLLIB::Sinpi: - case OpenCLLIB::Sqrt: - case OpenCLLIB::Tan: - case OpenCLLIB::Tanh: - case OpenCLLIB::Tanpi: - case OpenCLLIB::Tgamma: - case OpenCLLIB::Trunc: - case OpenCLLIB::Half_cos: - case OpenCLLIB::Half_divide: - case OpenCLLIB::Half_exp: - case OpenCLLIB::Half_exp2: - case OpenCLLIB::Half_exp10: - case OpenCLLIB::Half_log: - case OpenCLLIB::Half_log2: - case OpenCLLIB::Half_log10: - case OpenCLLIB::Half_powr: - case OpenCLLIB::Half_recip: - case OpenCLLIB::Half_rsqrt: - case OpenCLLIB::Half_sin: - case OpenCLLIB::Half_sqrt: - case OpenCLLIB::Half_tan: - case OpenCLLIB::Native_cos: - case OpenCLLIB::Native_divide: - case OpenCLLIB::Native_exp: - case OpenCLLIB::Native_exp2: - case OpenCLLIB::Native_exp10: - case OpenCLLIB::Native_log: - case OpenCLLIB::Native_log2: - case OpenCLLIB::Native_log10: - case OpenCLLIB::Native_powr: - case OpenCLLIB::Native_recip: - case OpenCLLIB::Native_rsqrt: - case OpenCLLIB::Native_sin: - case OpenCLLIB::Native_sqrt: - case OpenCLLIB::Native_tan: - case OpenCLLIB::FClamp: - case OpenCLLIB::Degrees: - case OpenCLLIB::FMax_common: - case OpenCLLIB::FMin_common: - case OpenCLLIB::Mix: - case OpenCLLIB::Radians: - case OpenCLLIB::Step: - case OpenCLLIB::Smoothstep: - case OpenCLLIB::Sign: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar or vector type"; - } - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } + case GLSLstd450Radians: + case GLSLstd450Degrees: + case GLSLstd450Sin: + case GLSLstd450Cos: + case GLSLstd450Tan: + case GLSLstd450Asin: + case GLSLstd450Acos: + case GLSLstd450Atan: + case GLSLstd450Sinh: + case GLSLstd450Cosh: + case GLSLstd450Tanh: + case GLSLstd450Asinh: + case GLSLstd450Acosh: + case GLSLstd450Atanh: + case GLSLstd450Exp: + case GLSLstd450Exp2: + case GLSLstd450Log: + case GLSLstd450Log2: + case GLSLstd450Atan2: + case GLSLstd450Pow: { + bool supportsCoopVec = + (ext_inst_key == GLSLstd450Atan || ext_inst_key == GLSLstd450Tanh || + ext_inst_key == GLSLstd450Exp || ext_inst_key == GLSLstd450Log); - for (uint32_t operand_index = 4; operand_index < num_operands; - ++operand_index) { - const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); - if (result_type != operand_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected types of all operands to be equal to Result " - "Type"; - } - } - break; + if (!_.IsFloatScalarOrVectorType(result_type) && + !(supportsCoopVec && _.IsFloatCooperativeVectorNVType(result_type))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 16 or 32-bit scalar or " + "vector float type"; } - case OpenCLLIB::Fract: - case OpenCLLIB::Modf: - case OpenCLLIB::Sincos: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar or vector type"; - } + const uint32_t result_type_bit_width = _.GetBitWidth(result_type); + if (result_type_bit_width != 16 && result_type_bit_width != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 16 or 32-bit scalar or " + "vector float type"; + } - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - if (result_type != x_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected type of operand X to be equal to Result Type"; - } - - const uint32_t p_type = _.GetOperandTypeId(inst, 5); - spv::StorageClass p_storage_class; - uint32_t p_data_type = 0; - if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected the last operand to be a pointer"; - } - - if (p_storage_class != spv::StorageClass::Generic && - p_storage_class != spv::StorageClass::CrossWorkgroup && - p_storage_class != spv::StorageClass::Workgroup && - p_storage_class != spv::StorageClass::Function) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected storage class of the pointer to be Generic, " - "CrossWorkgroup, Workgroup or Function"; - } - - if (!_.ContainsUntypedPointer(p_type) && result_type != p_data_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected data type of the pointer to be equal to Result " + << GetExtInstName(_, inst) << ": " + << "expected types of all operands to be equal to Result " "Type"; } - break; + } + break; + } + + case GLSLstd450Determinant: { + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + uint32_t num_rows = 0; + uint32_t num_cols = 0; + uint32_t col_type = 0; + uint32_t component_type = 0; + if (!_.GetMatrixTypeInfo(x_type, &num_rows, &num_cols, &col_type, + &component_type) || + num_rows != num_cols) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X to be a square matrix"; } - case OpenCLLIB::Frexp: - case OpenCLLIB::Lgamma_r: - case OpenCLLIB::Remquo: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar or vector type"; - } + if (result_type != component_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X component type to be equal to " + << "Result Type"; + } + break; + } - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - uint32_t operand_index = 4; - const uint32_t x_type = _.GetOperandTypeId(inst, operand_index++); - if (result_type != x_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected type of operand X to be equal to Result Type"; - } - - if (ext_inst_key == OpenCLLIB::Remquo) { - const uint32_t y_type = _.GetOperandTypeId(inst, operand_index++); - if (result_type != y_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected type of operand Y to be equal to Result Type"; - } - } - - const uint32_t p_type = _.GetOperandTypeId(inst, operand_index++); - spv::StorageClass p_storage_class; - uint32_t p_data_type = 0; - if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected the last operand to be a pointer"; - } - - if (p_storage_class != spv::StorageClass::Generic && - p_storage_class != spv::StorageClass::CrossWorkgroup && - p_storage_class != spv::StorageClass::Workgroup && - p_storage_class != spv::StorageClass::Function) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected storage class of the pointer to be Generic, " - "CrossWorkgroup, Workgroup or Function"; - } - - if ((!_.IsIntScalarOrVectorType(p_data_type) || - _.GetBitWidth(p_data_type) != 32) && - !_.ContainsUntypedPointer(p_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected data type of the pointer to be a 32-bit int " - "scalar or vector type"; - } - - if (!_.ContainsUntypedPointer(p_type) && - _.GetDimension(p_data_type) != num_components) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected data type of the pointer to have the same number " - "of components as Result Type"; - } - break; + case GLSLstd450MatrixInverse: { + uint32_t num_rows = 0; + uint32_t num_cols = 0; + uint32_t col_type = 0; + uint32_t component_type = 0; + if (!_.GetMatrixTypeInfo(result_type, &num_rows, &num_cols, &col_type, + &component_type) || + num_rows != num_cols) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a square matrix"; } - case OpenCLLIB::Ilogb: { - if (!_.IsIntScalarOrVectorType(result_type) || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 32-bit int scalar or vector " - "type"; - } + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (result_type != x_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X type to be equal to Result Type"; + } + break; + } - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatScalarOrVectorType(x_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X to be a float scalar or vector"; - } - - if (_.GetDimension(x_type) != num_components) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X to have the same number of components " - "as Result Type"; - } - break; + case GLSLstd450Modf: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or vector float type"; } - case OpenCLLIB::Ldexp: - case OpenCLLIB::Pown: - case OpenCLLIB::Rootn: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar or vector type"; - } + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t i_type = _.GetOperandTypeId(inst, 5); - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - if (result_type != x_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected type of operand X to be equal to Result Type"; - } - - const uint32_t exp_type = _.GetOperandTypeId(inst, 5); - if (!_.IsIntScalarOrVectorType(exp_type) || - _.GetBitWidth(exp_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected the exponent to be a 32-bit int scalar or vector"; - } - - if (_.GetDimension(exp_type) != num_components) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected the exponent to have the same number of " - "components as Result Type"; - } - break; + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X type to be equal to Result Type"; } - case OpenCLLIB::Nan: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar or vector type"; - } - - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - const uint32_t nancode_type = _.GetOperandTypeId(inst, 4); - if (!_.IsIntScalarOrVectorType(nancode_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Nancode to be an int scalar or vector type"; - } - - if (_.GetDimension(nancode_type) != num_components) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Nancode to have the same number of components as " - "Result Type"; - } - - if (_.GetBitWidth(result_type) != _.GetBitWidth(nancode_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Nancode to have the same bit width as Result " - "Type"; - } - break; + spv::StorageClass i_storage_class; + uint32_t i_data_type = 0; + if (!_.GetPointerTypeInfo(i_type, &i_data_type, &i_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand I to be a pointer"; } - case OpenCLLIB::SAbs: - case OpenCLLIB::SAbs_diff: - case OpenCLLIB::SAdd_sat: - case OpenCLLIB::UAdd_sat: - case OpenCLLIB::SHadd: - case OpenCLLIB::UHadd: - case OpenCLLIB::SRhadd: - case OpenCLLIB::URhadd: - case OpenCLLIB::SClamp: - case OpenCLLIB::UClamp: - case OpenCLLIB::Clz: - case OpenCLLIB::Ctz: - case OpenCLLIB::SMad_hi: - case OpenCLLIB::UMad_sat: - case OpenCLLIB::SMad_sat: - case OpenCLLIB::SMax: - case OpenCLLIB::UMax: - case OpenCLLIB::SMin: - case OpenCLLIB::UMin: - case OpenCLLIB::SMul_hi: - case OpenCLLIB::Rotate: - case OpenCLLIB::SSub_sat: - case OpenCLLIB::USub_sat: - case OpenCLLIB::Popcount: - case OpenCLLIB::UAbs: - case OpenCLLIB::UAbs_diff: - case OpenCLLIB::UMul_hi: - case OpenCLLIB::UMad_hi: { - if (!_.IsIntScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be an int scalar or vector type"; - } - - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - for (uint32_t operand_index = 4; operand_index < num_operands; - ++operand_index) { - const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); - if (result_type != operand_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected types of all operands to be equal to Result " - "Type"; - } - } - break; + if (i_data_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand I data type to be equal to Result Type"; } - case OpenCLLIB::U_Upsample: - case OpenCLLIB::S_Upsample: { - if (!_.IsIntScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be an int scalar or vector " - "type"; - } + break; + } - const uint32_t result_num_components = _.GetDimension(result_type); - if (result_num_components > 4 && result_num_components != 8 && - result_num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - const uint32_t result_bit_width = _.GetBitWidth(result_type); - if (result_bit_width != 16 && result_bit_width != 32 && - result_bit_width != 64) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected bit width of Result Type components to be 16, 32 " - "or 64"; - } - - const uint32_t hi_type = _.GetOperandTypeId(inst, 4); - const uint32_t lo_type = _.GetOperandTypeId(inst, 5); - - if (hi_type != lo_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Hi and Lo operands to have the same type"; - } - - if (result_num_components != _.GetDimension(hi_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Hi and Lo operands to have the same number of " - "components as Result Type"; - } - - if (result_bit_width != 2 * _.GetBitWidth(hi_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected bit width of components of Hi and Lo operands to " - "be half of the bit width of components of Result Type"; - } - break; + case GLSLstd450ModfStruct: { + std::vector result_types; + if (!_.GetStructMemberTypes(result_type, &result_types) || + result_types.size() != 2 || + !_.IsFloatScalarOrVectorType(result_types[0]) || + result_types[1] != result_types[0]) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a struct with two identical " + << "scalar or vector float type members"; } - case OpenCLLIB::SMad24: - case OpenCLLIB::UMad24: - case OpenCLLIB::SMul24: - case OpenCLLIB::UMul24: { - if (!_.IsIntScalarOrVectorType(result_type) || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 32-bit int scalar or vector " - "type"; - } + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (x_type != result_types[0]) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X type to be equal to members of " + << "Result Type struct"; + } + break; + } - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - for (uint32_t operand_index = 4; operand_index < num_operands; - ++operand_index) { - const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); - if (result_type != operand_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected types of all operands to be equal to Result " - "Type"; - } - } - break; + case GLSLstd450Frexp: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or vector float type"; } - case OpenCLLIB::Cross: { - if (!_.IsFloatVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float vector type"; - } + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t exp_type = _.GetOperandTypeId(inst, 5); - const uint32_t num_components = _.GetDimension(result_type); - if (num_components != 3 && num_components != 4) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to have 3 or 4 components"; - } - - const uint32_t x_type = _.GetOperandTypeId(inst, 4); - const uint32_t y_type = _.GetOperandTypeId(inst, 5); - - if (x_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X type to be equal to Result Type"; - } - - if (y_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Y type to be equal to Result Type"; - } - break; + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X type to be equal to Result Type"; } - case OpenCLLIB::Distance: - case OpenCLLIB::Fast_distance: { - if (!_.IsFloatScalarType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar type"; - } - - const uint32_t p0_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatScalarOrVectorType(p0_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P0 to be of float scalar or vector type"; - } - - const uint32_t num_components = _.GetDimension(p0_type); - if (num_components > 4) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P0 to have no more than 4 components"; - } - - if (result_type != _.GetComponentType(p0_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P0 component type to be equal to " - << "Result Type"; - } - - const uint32_t p1_type = _.GetOperandTypeId(inst, 5); - if (p0_type != p1_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operands P0 and P1 to be of the same type"; - } - break; + spv::StorageClass exp_storage_class; + uint32_t exp_data_type = 0; + if (!_.GetPointerTypeInfo(exp_type, &exp_data_type, &exp_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Exp to be a pointer"; } - case OpenCLLIB::Length: - case OpenCLLIB::Fast_length: { - if (!_.IsFloatScalarType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar type"; - } - - const uint32_t p_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatScalarOrVectorType(p_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to be a float scalar or vector"; - } - - const uint32_t num_components = _.GetDimension(p_type); - if (num_components > 4) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to have no more than 4 components"; - } - - if (result_type != _.GetComponentType(p_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P component type to be equal to Result " - "Type"; - } - break; + if (!_.IsIntScalarOrVectorType(exp_data_type) || + (!_.HasExtension(kSPV_AMD_gpu_shader_int16) && + _.GetBitWidth(exp_data_type) != 32) || + (_.HasExtension(kSPV_AMD_gpu_shader_int16) && + _.GetBitWidth(exp_data_type) != 16 && + _.GetBitWidth(exp_data_type) != 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Exp data type to be a " + << (_.HasExtension(kSPV_AMD_gpu_shader_int16) + ? "16-bit or 32-bit " + : "32-bit ") + << "int scalar or vector type"; } - case OpenCLLIB::Normalize: - case OpenCLLIB::Fast_normalize: { - if (!_.IsFloatScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar or vector type"; - } - - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to have no more than 4 components"; - } - - const uint32_t p_type = _.GetOperandTypeId(inst, 4); - if (p_type != result_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P type to be equal to Result Type"; - } - break; + if (_.GetDimension(result_type) != _.GetDimension(exp_data_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Exp data type to have the same component " + << "number as Result Type"; } - case OpenCLLIB::Bitselect: { - if (!_.IsFloatScalarOrVectorType(result_type) && - !_.IsIntScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be an int or float scalar or " - "vector type"; - } + break; + } - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - for (uint32_t operand_index = 4; operand_index < num_operands; - ++operand_index) { - const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); - if (result_type != operand_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected types of all operands to be equal to Result " - "Type"; - } - } - break; + case GLSLstd450Ldexp: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or vector float type"; } - case OpenCLLIB::Select: { - if (!_.IsFloatScalarOrVectorType(result_type) && - !_.IsIntScalarOrVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be an int or float scalar or " - "vector type"; - } + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t exp_type = _.GetOperandTypeId(inst, 5); - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - const uint32_t a_type = _.GetOperandTypeId(inst, 4); - const uint32_t b_type = _.GetOperandTypeId(inst, 5); - const uint32_t c_type = _.GetOperandTypeId(inst, 6); - - if (result_type != a_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand A type to be equal to Result Type"; - } - - if (result_type != b_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand B type to be equal to Result Type"; - } - - if (!_.IsIntScalarOrVectorType(c_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand C to be an int scalar or vector"; - } - - if (num_components != _.GetDimension(c_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand C to have the same number of components " - "as Result Type"; - } - - if (_.GetBitWidth(result_type) != _.GetBitWidth(c_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand C to have the same bit width as Result " - "Type"; - } - break; + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X type to be equal to Result Type"; } - case OpenCLLIB::Vloadn: { - if (!_.IsFloatVectorType(result_type) && - !_.IsIntVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be an int or float vector type"; - } - - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to have 2, 3, 4, 8 or 16 components"; - } - - const uint32_t offset_type = _.GetOperandTypeId(inst, 4); - const uint32_t p_type = _.GetOperandTypeId(inst, 5); - - const uint32_t size_t_bit_width = GetSizeTBitWidth(_); - if (!size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << " can only be used with physical addressing models"; - } - - if (!_.IsIntScalarType(offset_type) || - _.GetBitWidth(offset_type) != size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Offset to be of type size_t (" - << size_t_bit_width - << "-bit integer for the addressing model used in the module)"; - } - - spv::StorageClass p_storage_class; - uint32_t p_data_type = 0; - if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to be a pointer"; - } - - if (p_storage_class != spv::StorageClass::UniformConstant && - p_storage_class != spv::StorageClass::Generic && - p_storage_class != spv::StorageClass::CrossWorkgroup && - p_storage_class != spv::StorageClass::Workgroup && - p_storage_class != spv::StorageClass::Function) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P storage class to be UniformConstant, " - "Generic, CrossWorkgroup, Workgroup or Function"; - } - - if (_.GetComponentType(result_type) != p_data_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P data type to be equal to component " - "type of Result Type"; - } - - const uint32_t n_value = inst->word(7); - if (num_components != n_value) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected literal N to be equal to the number of " - "components of Result Type"; - } - break; + if (!_.IsIntScalarOrVectorType(exp_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Exp to be a 32-bit int scalar " + << "or vector type"; } - case OpenCLLIB::Vstoren: { - if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": expected Result Type to be void"; - } + if (_.GetDimension(result_type) != _.GetDimension(exp_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Exp to have the same component " + << "number as Result Type"; + } - const uint32_t data_type = _.GetOperandTypeId(inst, 4); + break; + } + + case GLSLstd450FrexpStruct: { + std::vector result_types; + if (!_.GetStructMemberTypes(result_type, &result_types) || + result_types.size() != 2 || + !_.IsFloatScalarOrVectorType(result_types[0]) || + !_.IsIntScalarOrVectorType(result_types[1]) || + (!_.HasExtension(kSPV_AMD_gpu_shader_int16) && + _.GetBitWidth(result_types[1]) != 32) || + (_.HasExtension(kSPV_AMD_gpu_shader_int16) && + _.GetBitWidth(result_types[1]) != 16 && + _.GetBitWidth(result_types[1]) != 32) || + _.GetDimension(result_types[0]) != _.GetDimension(result_types[1])) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a struct with two members, " + << "first member a float scalar or vector, second member a " + << (_.HasExtension(kSPV_AMD_gpu_shader_int16) + ? "16-bit or 32-bit " + : "32-bit ") + << "int scalar or vector with the same number of " + << "components as the first member"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (x_type != result_types[0]) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X type to be equal to the first member " + << "of Result Type struct"; + } + break; + } + + case GLSLstd450PackSnorm4x8: + case GLSLstd450PackUnorm4x8: { + if (!_.IsIntScalarType(result_type, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be 32-bit int scalar type"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatVectorType(v_type) || _.GetDimension(v_type) != 4 || + _.GetBitWidth(v_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand V to be a 32-bit float vector of size 4"; + } + break; + } + + case GLSLstd450PackSnorm2x16: + case GLSLstd450PackUnorm2x16: + case GLSLstd450PackHalf2x16: { + if (!_.IsIntScalarType(result_type, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be 32-bit int scalar type"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatVectorType(v_type) || _.GetDimension(v_type) != 2 || + _.GetBitWidth(v_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand V to be a 32-bit float vector of size 2"; + } + break; + } + + case GLSLstd450PackDouble2x32: { + if (!_.IsFloatScalarType(result_type, 64)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be 64-bit float scalar type"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntVectorType(v_type) || _.GetDimension(v_type) != 2 || + _.GetBitWidth(v_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand V to be a 32-bit int vector of size 2"; + } + break; + } + + case GLSLstd450UnpackSnorm4x8: + case GLSLstd450UnpackUnorm4x8: { + if (!_.IsFloatVectorType(result_type) || + _.GetDimension(result_type) != 4 || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 32-bit float vector of size " + "4"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntScalarType(v_type, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to be a 32-bit int scalar"; + } + break; + } + + case GLSLstd450UnpackSnorm2x16: + case GLSLstd450UnpackUnorm2x16: + case GLSLstd450UnpackHalf2x16: { + if (!_.IsFloatVectorType(result_type) || + _.GetDimension(result_type) != 2 || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 32-bit float vector of size " + "2"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntScalarType(v_type, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to be a 32-bit int scalar"; + } + break; + } + + case GLSLstd450UnpackDouble2x32: { + if (!_.IsIntVectorType(result_type) || _.GetDimension(result_type) != 2 || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 32-bit int vector of size " + "2"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarType(v_type, 64)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand V to be a 64-bit float scalar"; + } + break; + } + + case GLSLstd450Length: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X to be of float scalar or vector type"; + } + + if (result_type != _.GetComponentType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X component type to be equal to Result " + "Type"; + } + break; + } + + case GLSLstd450Distance: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t p0_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(p0_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P0 to be of float scalar or vector type"; + } + + if (result_type != _.GetComponentType(p0_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P0 component type to be equal to " + << "Result Type"; + } + + const uint32_t p1_type = _.GetOperandTypeId(inst, 5); + if (!_.IsFloatScalarOrVectorType(p1_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P1 to be of float scalar or vector type"; + } + + if (result_type != _.GetComponentType(p1_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P1 component type to be equal to " + << "Result Type"; + } + + if (_.GetDimension(p0_type) != _.GetDimension(p1_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operands P0 and P1 to have the same number of " + << "components"; + } + break; + } + + case GLSLstd450Cross: { + if (!_.IsFloatVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float vector type"; + } + + if (_.GetDimension(result_type) != 3) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to have 3 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t y_type = _.GetOperandTypeId(inst, 5); + + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X type to be equal to Result Type"; + } + + if (y_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Y type to be equal to Result Type"; + } + break; + } + + case GLSLstd450Refract: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t i_type = _.GetOperandTypeId(inst, 4); + const uint32_t n_type = _.GetOperandTypeId(inst, 5); + const uint32_t eta_type = _.GetOperandTypeId(inst, 6); + + if (result_type != i_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand I to be of type equal to Result Type"; + } + + if (result_type != n_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand N to be of type equal to Result Type"; + } + + if (!_.IsFloatScalarType(eta_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Eta to be a float scalar"; + } + break; + } + + case GLSLstd450InterpolateAtCentroid: + case GLSLstd450InterpolateAtSample: + case GLSLstd450InterpolateAtOffset: { + if (!_.HasCapability(spv::Capability::InterpolationFunction)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << GetExtInstName(_, inst) + << " requires capability InterpolationFunction"; + } + + if (!_.IsFloatScalarOrVectorType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 32-bit float scalar " + << "or vector type"; + } + + // If HLSL legalization and first operand is an OpLoad, use load + // pointer as the interpolant lvalue. Else use interpolate first + // operand. + uint32_t interp_id = inst->GetOperandAs(4); + auto* interp_inst = _.FindDef(interp_id); + uint32_t interpolant_type = (_.options()->before_hlsl_legalization && + interp_inst->opcode() == spv::Op::OpLoad) + ? _.GetOperandTypeId(interp_inst, 2) + : _.GetOperandTypeId(inst, 4); + + spv::StorageClass interpolant_storage_class; + uint32_t interpolant_data_type = 0; + if (!_.GetPointerTypeInfo(interpolant_type, &interpolant_data_type, + &interpolant_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Interpolant to be a pointer"; + } + + if (result_type != interpolant_data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Interpolant data type to be equal to Result Type"; + } + + if (interpolant_storage_class != spv::StorageClass::Input) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Interpolant storage class to be Input"; + } + + if (ext_inst_key == GLSLstd450InterpolateAtSample) { + const uint32_t sample_type = _.GetOperandTypeId(inst, 5); + if (!_.IsIntScalarType(sample_type, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Sample to be 32-bit integer"; + } + } + + if (ext_inst_key == GLSLstd450InterpolateAtOffset) { const uint32_t offset_type = _.GetOperandTypeId(inst, 5); - const uint32_t p_type = _.GetOperandTypeId(inst, 6); - - if (!_.IsFloatVectorType(data_type) && !_.IsIntVectorType(data_type)) { + if (!_.IsFloatVectorType(offset_type) || + _.GetDimension(offset_type) != 2 || + _.GetBitWidth(offset_type) != 32) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Data to be an int or float vector"; + << GetExtInstName(_, inst) << ": " + << "expected Offset to be a vector of 2 32-bit floats"; + } + } + + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + spv::ExecutionModel::Fragment, + GetExtInstName(_, inst) + + std::string(" requires Fragment execution model")); + break; + } + + case GLSLstd450IMix: { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Extended instruction GLSLstd450IMix is not supported"; + } + + case GLSLstd450Bad: { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Encountered extended instruction GLSLstd450Bad"; + } + + case GLSLstd450Count: { + assert(0); + break; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateExtInstOpenClStd(ValidationState_t& _, + const Instruction* inst) { + const uint32_t result_type = inst->type_id(); + const uint32_t num_operands = static_cast(inst->operands().size()); + const uint32_t ext_inst_index = inst->word(4); + const OpenCLLIB::Entrypoints ext_inst_key = + OpenCLLIB::Entrypoints(ext_inst_index); + switch (ext_inst_key) { + case OpenCLLIB::Acos: + case OpenCLLIB::Acosh: + case OpenCLLIB::Acospi: + case OpenCLLIB::Asin: + case OpenCLLIB::Asinh: + case OpenCLLIB::Asinpi: + case OpenCLLIB::Atan: + case OpenCLLIB::Atan2: + case OpenCLLIB::Atanh: + case OpenCLLIB::Atanpi: + case OpenCLLIB::Atan2pi: + case OpenCLLIB::Cbrt: + case OpenCLLIB::Ceil: + case OpenCLLIB::Copysign: + case OpenCLLIB::Cos: + case OpenCLLIB::Cosh: + case OpenCLLIB::Cospi: + case OpenCLLIB::Erfc: + case OpenCLLIB::Erf: + case OpenCLLIB::Exp: + case OpenCLLIB::Exp2: + case OpenCLLIB::Exp10: + case OpenCLLIB::Expm1: + case OpenCLLIB::Fabs: + case OpenCLLIB::Fdim: + case OpenCLLIB::Floor: + case OpenCLLIB::Fma: + case OpenCLLIB::Fmax: + case OpenCLLIB::Fmin: + case OpenCLLIB::Fmod: + case OpenCLLIB::Hypot: + case OpenCLLIB::Lgamma: + case OpenCLLIB::Log: + case OpenCLLIB::Log2: + case OpenCLLIB::Log10: + case OpenCLLIB::Log1p: + case OpenCLLIB::Logb: + case OpenCLLIB::Mad: + case OpenCLLIB::Maxmag: + case OpenCLLIB::Minmag: + case OpenCLLIB::Nextafter: + case OpenCLLIB::Pow: + case OpenCLLIB::Powr: + case OpenCLLIB::Remainder: + case OpenCLLIB::Rint: + case OpenCLLIB::Round: + case OpenCLLIB::Rsqrt: + case OpenCLLIB::Sin: + case OpenCLLIB::Sinh: + case OpenCLLIB::Sinpi: + case OpenCLLIB::Sqrt: + case OpenCLLIB::Tan: + case OpenCLLIB::Tanh: + case OpenCLLIB::Tanpi: + case OpenCLLIB::Tgamma: + case OpenCLLIB::Trunc: + case OpenCLLIB::Half_cos: + case OpenCLLIB::Half_divide: + case OpenCLLIB::Half_exp: + case OpenCLLIB::Half_exp2: + case OpenCLLIB::Half_exp10: + case OpenCLLIB::Half_log: + case OpenCLLIB::Half_log2: + case OpenCLLIB::Half_log10: + case OpenCLLIB::Half_powr: + case OpenCLLIB::Half_recip: + case OpenCLLIB::Half_rsqrt: + case OpenCLLIB::Half_sin: + case OpenCLLIB::Half_sqrt: + case OpenCLLIB::Half_tan: + case OpenCLLIB::Native_cos: + case OpenCLLIB::Native_divide: + case OpenCLLIB::Native_exp: + case OpenCLLIB::Native_exp2: + case OpenCLLIB::Native_exp10: + case OpenCLLIB::Native_log: + case OpenCLLIB::Native_log2: + case OpenCLLIB::Native_log10: + case OpenCLLIB::Native_powr: + case OpenCLLIB::Native_recip: + case OpenCLLIB::Native_rsqrt: + case OpenCLLIB::Native_sin: + case OpenCLLIB::Native_sqrt: + case OpenCLLIB::Native_tan: + case OpenCLLIB::FClamp: + case OpenCLLIB::Degrees: + case OpenCLLIB::FMax_common: + case OpenCLLIB::FMin_common: + case OpenCLLIB::Mix: + case OpenCLLIB::Radians: + case OpenCLLIB::Step: + case OpenCLLIB::Smoothstep: + case OpenCLLIB::Sign: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case OpenCLLIB::Fract: + case OpenCLLIB::Modf: + case OpenCLLIB::Sincos: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (result_type != x_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected type of operand X to be equal to Result Type"; + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 5); + spv::StorageClass p_storage_class; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected the last operand to be a pointer"; + } + + if (p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected storage class of the pointer to be Generic, " + "CrossWorkgroup, Workgroup or Function"; + } + + if (!_.ContainsUntypedPointer(p_type) && result_type != p_data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected data type of the pointer to be equal to Result " + "Type"; + } + break; + } + + case OpenCLLIB::Frexp: + case OpenCLLIB::Lgamma_r: + case OpenCLLIB::Remquo: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + uint32_t operand_index = 4; + const uint32_t x_type = _.GetOperandTypeId(inst, operand_index++); + if (result_type != x_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected type of operand X to be equal to Result Type"; + } + + if (ext_inst_key == OpenCLLIB::Remquo) { + const uint32_t y_type = _.GetOperandTypeId(inst, operand_index++); + if (result_type != y_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected type of operand Y to be equal to Result Type"; + } + } + + const uint32_t p_type = _.GetOperandTypeId(inst, operand_index++); + spv::StorageClass p_storage_class; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected the last operand to be a pointer"; + } + + if (p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected storage class of the pointer to be Generic, " + "CrossWorkgroup, Workgroup or Function"; + } + + if ((!_.IsIntScalarOrVectorType(p_data_type) || + _.GetBitWidth(p_data_type) != 32) && + !_.ContainsUntypedPointer(p_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected data type of the pointer to be a 32-bit int " + "scalar or vector type"; + } + + if (!_.ContainsUntypedPointer(p_type) && + _.GetDimension(p_data_type) != num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected data type of the pointer to have the same number " + "of components as Result Type"; + } + break; + } + + case OpenCLLIB::Ilogb: { + if (!_.IsIntScalarOrVectorType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 32-bit int scalar or vector " + "type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X to be a float scalar or vector"; + } + + if (_.GetDimension(x_type) != num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X to have the same number of components " + "as Result Type"; + } + break; + } + + case OpenCLLIB::Ldexp: + case OpenCLLIB::Pown: + case OpenCLLIB::Rootn: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (result_type != x_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected type of operand X to be equal to Result Type"; + } + + const uint32_t exp_type = _.GetOperandTypeId(inst, 5); + if (!_.IsIntScalarOrVectorType(exp_type) || + _.GetBitWidth(exp_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected the exponent to be a 32-bit int scalar or vector"; + } + + if (_.GetDimension(exp_type) != num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected the exponent to have the same number of " + "components as Result Type"; + } + break; + } + + case OpenCLLIB::Nan: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t nancode_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntScalarOrVectorType(nancode_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Nancode to be an int scalar or vector type"; + } + + if (_.GetDimension(nancode_type) != num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Nancode to have the same number of components as " + "Result Type"; + } + + if (_.GetBitWidth(result_type) != _.GetBitWidth(nancode_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Nancode to have the same bit width as Result " + "Type"; + } + break; + } + + case OpenCLLIB::SAbs: + case OpenCLLIB::SAbs_diff: + case OpenCLLIB::SAdd_sat: + case OpenCLLIB::UAdd_sat: + case OpenCLLIB::SHadd: + case OpenCLLIB::UHadd: + case OpenCLLIB::SRhadd: + case OpenCLLIB::URhadd: + case OpenCLLIB::SClamp: + case OpenCLLIB::UClamp: + case OpenCLLIB::Clz: + case OpenCLLIB::Ctz: + case OpenCLLIB::SMad_hi: + case OpenCLLIB::UMad_sat: + case OpenCLLIB::SMad_sat: + case OpenCLLIB::SMax: + case OpenCLLIB::UMax: + case OpenCLLIB::SMin: + case OpenCLLIB::UMin: + case OpenCLLIB::SMul_hi: + case OpenCLLIB::Rotate: + case OpenCLLIB::SSub_sat: + case OpenCLLIB::USub_sat: + case OpenCLLIB::Popcount: + case OpenCLLIB::UAbs: + case OpenCLLIB::UAbs_diff: + case OpenCLLIB::UMul_hi: + case OpenCLLIB::UMad_hi: { + if (!_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be an int scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case OpenCLLIB::U_Upsample: + case OpenCLLIB::S_Upsample: { + if (!_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be an int scalar or vector " + "type"; + } + + const uint32_t result_num_components = _.GetDimension(result_type); + if (result_num_components > 4 && result_num_components != 8 && + result_num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t result_bit_width = _.GetBitWidth(result_type); + if (result_bit_width != 16 && result_bit_width != 32 && + result_bit_width != 64) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected bit width of Result Type components to be 16, 32 " + "or 64"; + } + + const uint32_t hi_type = _.GetOperandTypeId(inst, 4); + const uint32_t lo_type = _.GetOperandTypeId(inst, 5); + + if (hi_type != lo_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Hi and Lo operands to have the same type"; + } + + if (result_num_components != _.GetDimension(hi_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Hi and Lo operands to have the same number of " + "components as Result Type"; + } + + if (result_bit_width != 2 * _.GetBitWidth(hi_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected bit width of components of Hi and Lo operands to " + "be half of the bit width of components of Result Type"; + } + break; + } + + case OpenCLLIB::SMad24: + case OpenCLLIB::UMad24: + case OpenCLLIB::SMul24: + case OpenCLLIB::UMul24: { + if (!_.IsIntScalarOrVectorType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 32-bit int scalar or vector " + "type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case OpenCLLIB::Cross: { + if (!_.IsFloatVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components != 3 && num_components != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to have 3 or 4 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t y_type = _.GetOperandTypeId(inst, 5); + + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X type to be equal to Result Type"; + } + + if (y_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Y type to be equal to Result Type"; + } + break; + } + + case OpenCLLIB::Distance: + case OpenCLLIB::Fast_distance: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t p0_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(p0_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P0 to be of float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(p0_type); + if (num_components > 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P0 to have no more than 4 components"; + } + + if (result_type != _.GetComponentType(p0_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P0 component type to be equal to " + << "Result Type"; + } + + const uint32_t p1_type = _.GetOperandTypeId(inst, 5); + if (p0_type != p1_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operands P0 and P1 to be of the same type"; + } + break; + } + + case OpenCLLIB::Length: + case OpenCLLIB::Fast_length: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(p_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to be a float scalar or vector"; + } + + const uint32_t num_components = _.GetDimension(p_type); + if (num_components > 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to have no more than 4 components"; + } + + if (result_type != _.GetComponentType(p_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P component type to be equal to Result " + "Type"; + } + break; + } + + case OpenCLLIB::Normalize: + case OpenCLLIB::Fast_normalize: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to have no more than 4 components"; + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 4); + if (p_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P type to be equal to Result Type"; + } + break; + } + + case OpenCLLIB::Bitselect: { + if (!_.IsFloatScalarOrVectorType(result_type) && + !_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be an int or float scalar or " + "vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case OpenCLLIB::Select: { + if (!_.IsFloatScalarOrVectorType(result_type) && + !_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be an int or float scalar or " + "vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t a_type = _.GetOperandTypeId(inst, 4); + const uint32_t b_type = _.GetOperandTypeId(inst, 5); + const uint32_t c_type = _.GetOperandTypeId(inst, 6); + + if (result_type != a_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand A type to be equal to Result Type"; + } + + if (result_type != b_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand B type to be equal to Result Type"; + } + + if (!_.IsIntScalarOrVectorType(c_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand C to be an int scalar or vector"; + } + + if (num_components != _.GetDimension(c_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand C to have the same number of components " + "as Result Type"; + } + + if (_.GetBitWidth(result_type) != _.GetBitWidth(c_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand C to have the same bit width as Result " + "Type"; + } + break; + } + + case OpenCLLIB::Vloadn: { + if (!_.IsFloatVectorType(result_type) && + !_.IsIntVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be an int or float vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to have 2, 3, 4, 8 or 16 components"; + } + + const uint32_t offset_type = _.GetOperandTypeId(inst, 4); + const uint32_t p_type = _.GetOperandTypeId(inst, 5); + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type, size_t_bit_width)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + spv::StorageClass p_storage_class; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != spv::StorageClass::UniformConstant && + p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P storage class to be UniformConstant, " + "Generic, CrossWorkgroup, Workgroup or Function"; + } + + if (_.GetComponentType(result_type) != p_data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P data type to be equal to component " + "type of Result Type"; + } + + const uint32_t n_value = inst->word(7); + if (num_components != n_value) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected literal N to be equal to the number of " + "components of Result Type"; + } + break; + } + + case OpenCLLIB::Vstoren: { + if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": expected Result Type to be void"; + } + + const uint32_t data_type = _.GetOperandTypeId(inst, 4); + const uint32_t offset_type = _.GetOperandTypeId(inst, 5); + const uint32_t p_type = _.GetOperandTypeId(inst, 6); + + if (!_.IsFloatVectorType(data_type) && !_.IsIntVectorType(data_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Data to be an int or float vector"; + } + + const uint32_t num_components = _.GetDimension(data_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Data to have 2, 3, 4, 8 or 16 components"; + } + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type, size_t_bit_width)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + spv::StorageClass p_storage_class; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P storage class to be Generic, " + "CrossWorkgroup, Workgroup or Function"; + } + + if (_.GetComponentType(data_type) != p_data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P data type to be equal to the type of " + "operand Data components"; + } + break; + } + + case OpenCLLIB::Vload_half: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t offset_type = _.GetOperandTypeId(inst, 4); + const uint32_t p_type = _.GetOperandTypeId(inst, 5); + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type, size_t_bit_width)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + spv::StorageClass p_storage_class; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != spv::StorageClass::UniformConstant && + p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P storage class to be UniformConstant, " + "Generic, CrossWorkgroup, Workgroup or Function"; + } + + if ((!_.IsFloatScalarType(p_data_type, 16)) && + !_.ContainsUntypedPointer(p_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P data type to be 16-bit float scalar"; + } + break; + } + + case OpenCLLIB::Vload_halfn: + case OpenCLLIB::Vloada_halfn: { + if (!_.IsFloatVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a float vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to have 2, 3, 4, 8 or 16 components"; + } + + const uint32_t offset_type = _.GetOperandTypeId(inst, 4); + const uint32_t p_type = _.GetOperandTypeId(inst, 5); + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type, size_t_bit_width)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + spv::StorageClass p_storage_class; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != spv::StorageClass::UniformConstant && + p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P storage class to be UniformConstant, " + "Generic, CrossWorkgroup, Workgroup or Function"; + } + + if ((!_.IsFloatScalarType(p_data_type, 16)) && + !_.ContainsUntypedPointer(p_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P data type to be 16-bit float scalar"; + } + + const uint32_t n_value = inst->word(7); + if (num_components != n_value) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected literal N to be equal to the number of " + "components of Result Type"; + } + break; + } + + case OpenCLLIB::Vstore_half: + case OpenCLLIB::Vstore_half_r: + case OpenCLLIB::Vstore_halfn: + case OpenCLLIB::Vstore_halfn_r: + case OpenCLLIB::Vstorea_halfn: + case OpenCLLIB::Vstorea_halfn_r: { + if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": expected Result Type to be void"; + } + + const uint32_t data_type = _.GetOperandTypeId(inst, 4); + const uint32_t offset_type = _.GetOperandTypeId(inst, 5); + const uint32_t p_type = _.GetOperandTypeId(inst, 6); + const uint32_t data_type_bit_width = _.GetBitWidth(data_type); + + if (ext_inst_key == OpenCLLIB::Vstore_half || + ext_inst_key == OpenCLLIB::Vstore_half_r) { + if (!_.IsFloatScalarType(data_type) || + (data_type_bit_width != 32 && data_type_bit_width != 64)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Data to be a 32 or 64-bit float scalar"; + } + } else { + if (!_.IsFloatVectorType(data_type) || + (data_type_bit_width != 32 && data_type_bit_width != 64)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Data to be a 32 or 64-bit float vector"; } const uint32_t num_components = _.GetDimension(data_type); if (num_components > 4 && num_components != 8 && num_components != 16) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " + << GetExtInstName(_, inst) << ": " << "expected Data to have 2, 3, 4, 8 or 16 components"; } - - const uint32_t size_t_bit_width = GetSizeTBitWidth(_); - if (!size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << " can only be used with physical addressing models"; - } - - if (!_.IsIntScalarType(offset_type) || - _.GetBitWidth(offset_type) != size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Offset to be of type size_t (" - << size_t_bit_width - << "-bit integer for the addressing model used in the module)"; - } - - spv::StorageClass p_storage_class; - uint32_t p_data_type = 0; - if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to be a pointer"; - } - - if (p_storage_class != spv::StorageClass::Generic && - p_storage_class != spv::StorageClass::CrossWorkgroup && - p_storage_class != spv::StorageClass::Workgroup && - p_storage_class != spv::StorageClass::Function) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P storage class to be Generic, " - "CrossWorkgroup, Workgroup or Function"; - } - - if (_.GetComponentType(data_type) != p_data_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P data type to be equal to the type of " - "operand Data components"; - } - break; } - case OpenCLLIB::Vload_half: { - if (!_.IsFloatScalarType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float scalar type"; - } - - const uint32_t offset_type = _.GetOperandTypeId(inst, 4); - const uint32_t p_type = _.GetOperandTypeId(inst, 5); - - const uint32_t size_t_bit_width = GetSizeTBitWidth(_); - if (!size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << " can only be used with physical addressing models"; - } - - if (!_.IsIntScalarType(offset_type) || - _.GetBitWidth(offset_type) != size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Offset to be of type size_t (" - << size_t_bit_width - << "-bit integer for the addressing model used in the module)"; - } - - spv::StorageClass p_storage_class; - uint32_t p_data_type = 0; - if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to be a pointer"; - } - - if (p_storage_class != spv::StorageClass::UniformConstant && - p_storage_class != spv::StorageClass::Generic && - p_storage_class != spv::StorageClass::CrossWorkgroup && - p_storage_class != spv::StorageClass::Workgroup && - p_storage_class != spv::StorageClass::Function) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P storage class to be UniformConstant, " - "Generic, CrossWorkgroup, Workgroup or Function"; - } - - if ((!_.IsFloatScalarType(p_data_type) || - _.GetBitWidth(p_data_type) != 16) && - !_.ContainsUntypedPointer(p_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P data type to be 16-bit float scalar"; - } - break; + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << " can only be used with physical addressing models"; } - case OpenCLLIB::Vload_halfn: - case OpenCLLIB::Vloada_halfn: { - if (!_.IsFloatVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a float vector type"; - } - - const uint32_t num_components = _.GetDimension(result_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to have 2, 3, 4, 8 or 16 components"; - } - - const uint32_t offset_type = _.GetOperandTypeId(inst, 4); - const uint32_t p_type = _.GetOperandTypeId(inst, 5); - - const uint32_t size_t_bit_width = GetSizeTBitWidth(_); - if (!size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << " can only be used with physical addressing models"; - } - - if (!_.IsIntScalarType(offset_type) || - _.GetBitWidth(offset_type) != size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Offset to be of type size_t (" - << size_t_bit_width - << "-bit integer for the addressing model used in the module)"; - } - - spv::StorageClass p_storage_class; - uint32_t p_data_type = 0; - if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to be a pointer"; - } - - if (p_storage_class != spv::StorageClass::UniformConstant && - p_storage_class != spv::StorageClass::Generic && - p_storage_class != spv::StorageClass::CrossWorkgroup && - p_storage_class != spv::StorageClass::Workgroup && - p_storage_class != spv::StorageClass::Function) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P storage class to be UniformConstant, " - "Generic, CrossWorkgroup, Workgroup or Function"; - } - - if ((!_.IsFloatScalarType(p_data_type) || - _.GetBitWidth(p_data_type) != 16) && - !_.ContainsUntypedPointer(p_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P data type to be 16-bit float scalar"; - } - - const uint32_t n_value = inst->word(7); - if (num_components != n_value) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected literal N to be equal to the number of " - "components of Result Type"; - } - break; + if (!_.IsIntScalarType(offset_type, size_t_bit_width)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; } - case OpenCLLIB::Vstore_half: - case OpenCLLIB::Vstore_half_r: - case OpenCLLIB::Vstore_halfn: - case OpenCLLIB::Vstore_halfn_r: - case OpenCLLIB::Vstorea_halfn: - case OpenCLLIB::Vstorea_halfn_r: { - if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": expected Result Type to be void"; - } - - const uint32_t data_type = _.GetOperandTypeId(inst, 4); - const uint32_t offset_type = _.GetOperandTypeId(inst, 5); - const uint32_t p_type = _.GetOperandTypeId(inst, 6); - const uint32_t data_type_bit_width = _.GetBitWidth(data_type); - - if (ext_inst_key == OpenCLLIB::Vstore_half || - ext_inst_key == OpenCLLIB::Vstore_half_r) { - if (!_.IsFloatScalarType(data_type) || - (data_type_bit_width != 32 && data_type_bit_width != 64)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Data to be a 32 or 64-bit float scalar"; - } - } else { - if (!_.IsFloatVectorType(data_type) || - (data_type_bit_width != 32 && data_type_bit_width != 64)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Data to be a 32 or 64-bit float vector"; - } - - const uint32_t num_components = _.GetDimension(data_type); - if (num_components > 4 && num_components != 8 && - num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Data to have 2, 3, 4, 8 or 16 components"; - } - } - - const uint32_t size_t_bit_width = GetSizeTBitWidth(_); - if (!size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << " can only be used with physical addressing models"; - } - - if (!_.IsIntScalarType(offset_type) || - _.GetBitWidth(offset_type) != size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Offset to be of type size_t (" - << size_t_bit_width - << "-bit integer for the addressing model used in the module)"; - } - - spv::StorageClass p_storage_class; - uint32_t p_data_type = 0; - if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P to be a pointer"; - } - - if (p_storage_class != spv::StorageClass::Generic && - p_storage_class != spv::StorageClass::CrossWorkgroup && - p_storage_class != spv::StorageClass::Workgroup && - p_storage_class != spv::StorageClass::Function) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P storage class to be Generic, " - "CrossWorkgroup, Workgroup or Function"; - } - - if ((!_.IsFloatScalarType(p_data_type) || - _.GetBitWidth(p_data_type) != 16) && - !_.ContainsUntypedPointer(p_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand P data type to be 16-bit float scalar"; - } - - // Rounding mode enum is checked by assembler. - break; + spv::StorageClass p_storage_class; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P to be a pointer"; } - case OpenCLLIB::Shuffle: - case OpenCLLIB::Shuffle2: { - if (!_.IsFloatVectorType(result_type) && - !_.IsIntVectorType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be an int or float vector type"; - } - - const uint32_t result_num_components = _.GetDimension(result_type); - if (result_num_components != 2 && result_num_components != 4 && - result_num_components != 8 && result_num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to have 2, 4, 8 or 16 components"; - } - - uint32_t operand_index = 4; - const uint32_t x_type = _.GetOperandTypeId(inst, operand_index++); - - if (ext_inst_key == OpenCLLIB::Shuffle2) { - const uint32_t y_type = _.GetOperandTypeId(inst, operand_index++); - if (x_type != y_type) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operands X and Y to be of the same type"; - } - } - - const uint32_t shuffle_mask_type = - _.GetOperandTypeId(inst, operand_index++); - - if (!_.IsFloatVectorType(x_type) && !_.IsIntVectorType(x_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X to be an int or float vector"; - } - - const uint32_t x_num_components = _.GetDimension(x_type); - if (x_num_components != 2 && x_num_components != 4 && - x_num_components != 8 && x_num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X to have 2, 4, 8 or 16 components"; - } - - const uint32_t result_component_type = _.GetComponentType(result_type); - - if (result_component_type != _.GetComponentType(x_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand X and Result Type to have equal " - "component types"; - } - - if (!_.IsIntVectorType(shuffle_mask_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Shuffle Mask to be an int vector"; - } - - if (result_num_components != _.GetDimension(shuffle_mask_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Shuffle Mask to have the same number of " - "components as Result Type"; - } - - if (_.GetBitWidth(result_component_type) != - _.GetBitWidth(shuffle_mask_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Shuffle Mask components to have the same " - "bit width as Result Type components"; - } - break; + if (p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P storage class to be Generic, " + "CrossWorkgroup, Workgroup or Function"; } - case OpenCLLIB::Printf: { - if (!_.IsIntScalarType(result_type) || - _.GetBitWidth(result_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a 32-bit int type"; - } - - const uint32_t format_type = _.GetOperandTypeId(inst, 4); - spv::StorageClass format_storage_class; - uint32_t format_data_type = 0; - if (!_.GetPointerTypeInfo(format_type, &format_data_type, - &format_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Format to be a pointer"; - } - - if (_.HasExtension( - Extension::kSPV_EXT_relaxed_printf_string_address_space)) { - if (format_storage_class != spv::StorageClass::UniformConstant && - // Extension SPV_EXT_relaxed_printf_string_address_space allows - // format strings in Global, Local, Private and Generic address - // spaces - - // Global - format_storage_class != spv::StorageClass::CrossWorkgroup && - // Local - format_storage_class != spv::StorageClass::Workgroup && - // Private - format_storage_class != spv::StorageClass::Function && - // Generic - format_storage_class != spv::StorageClass::Generic) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Format storage class to be UniformConstant, " - "Crossworkgroup, Workgroup, Function, or Generic"; - } - } else { - if (format_storage_class != spv::StorageClass::UniformConstant) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Format storage class to be UniformConstant"; - } - } - - // If pointer points to an array, get the type of an element - if (_.IsIntArrayType(format_data_type)) - format_data_type = _.GetComponentType(format_data_type); - - if ((!_.IsIntScalarType(format_data_type) || - _.GetBitWidth(format_data_type) != 8) && - !_.ContainsUntypedPointer(format_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Format data type to be 8-bit int"; - } - break; + if ((!_.IsFloatScalarType(p_data_type, 16)) && + !_.ContainsUntypedPointer(p_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand P data type to be 16-bit float scalar"; } - case OpenCLLIB::Prefetch: { - if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": expected Result Type to be void"; - } - - const uint32_t p_type = _.GetOperandTypeId(inst, 4); - const uint32_t num_elements_type = _.GetOperandTypeId(inst, 5); - - spv::StorageClass p_storage_class; - uint32_t p_data_type = 0; - if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Ptr to be a pointer"; - } - - if (p_storage_class != spv::StorageClass::CrossWorkgroup) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Ptr storage class to be CrossWorkgroup"; - } - - if (!_.IsFloatScalarOrVectorType(p_data_type) && - !_.IsIntScalarOrVectorType(p_data_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Ptr data type to be int or float scalar or " - "vector"; - } - - const uint32_t num_components = _.GetDimension(p_data_type); - if (num_components > 4 && num_components != 8 && num_components != 16) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected Result Type to be a scalar or a vector with 2, " - "3, 4, 8 or 16 components"; - } - - const uint32_t size_t_bit_width = GetSizeTBitWidth(_); - if (!size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << " can only be used with physical addressing models"; - } - - if (!_.IsIntScalarType(num_elements_type) || - _.GetBitWidth(num_elements_type) != size_t_bit_width) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Num Elements to be of type size_t (" - << size_t_bit_width - << "-bit integer for the addressing model used in the module)"; - } - break; - } - } - } else if (ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100 || - ext_inst_type == - SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100) { - if (!_.IsVoidType(result_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected result type must be a result id of " - << "OpTypeVoid"; + // Rounding mode enum is checked by assembler. + break; } - const bool vulkanDebugInfo = - ext_inst_type == SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100; + case OpenCLLIB::Shuffle: + case OpenCLLIB::Shuffle2: { + if (!_.IsFloatVectorType(result_type) && + !_.IsIntVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be an int or float vector type"; + } - auto num_words = inst->words().size(); + const uint32_t result_num_components = _.GetDimension(result_type); + if (result_num_components != 2 && result_num_components != 4 && + result_num_components != 8 && result_num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to have 2, 4, 8 or 16 components"; + } - // Handle any non-common NonSemanticShaderDebugInfo instructions. - if (vulkanDebugInfo) { - const NonSemanticShaderDebugInfo100Instructions ext_inst_key = - NonSemanticShaderDebugInfo100Instructions(ext_inst_index); - switch (ext_inst_key) { - // The following block of instructions will be handled by the common - // validation. - case NonSemanticShaderDebugInfo100DebugInfoNone: - case NonSemanticShaderDebugInfo100DebugCompilationUnit: - case NonSemanticShaderDebugInfo100DebugTypePointer: - case NonSemanticShaderDebugInfo100DebugTypeQualifier: - case NonSemanticShaderDebugInfo100DebugTypeArray: - case NonSemanticShaderDebugInfo100DebugTypeVector: - case NonSemanticShaderDebugInfo100DebugTypedef: - case NonSemanticShaderDebugInfo100DebugTypeFunction: - case NonSemanticShaderDebugInfo100DebugTypeEnum: - case NonSemanticShaderDebugInfo100DebugTypeComposite: - case NonSemanticShaderDebugInfo100DebugTypeMember: - case NonSemanticShaderDebugInfo100DebugTypeInheritance: - case NonSemanticShaderDebugInfo100DebugTypePtrToMember: - case NonSemanticShaderDebugInfo100DebugTypeTemplate: - case NonSemanticShaderDebugInfo100DebugTypeTemplateParameter: - case NonSemanticShaderDebugInfo100DebugTypeTemplateTemplateParameter: - case NonSemanticShaderDebugInfo100DebugTypeTemplateParameterPack: - case NonSemanticShaderDebugInfo100DebugGlobalVariable: - case NonSemanticShaderDebugInfo100DebugFunctionDeclaration: - case NonSemanticShaderDebugInfo100DebugFunction: - case NonSemanticShaderDebugInfo100DebugLexicalBlock: - case NonSemanticShaderDebugInfo100DebugLexicalBlockDiscriminator: - case NonSemanticShaderDebugInfo100DebugScope: - case NonSemanticShaderDebugInfo100DebugNoScope: - case NonSemanticShaderDebugInfo100DebugInlinedAt: - case NonSemanticShaderDebugInfo100DebugLocalVariable: - case NonSemanticShaderDebugInfo100DebugInlinedVariable: - case NonSemanticShaderDebugInfo100DebugValue: - case NonSemanticShaderDebugInfo100DebugOperation: - case NonSemanticShaderDebugInfo100DebugExpression: - case NonSemanticShaderDebugInfo100DebugMacroDef: - case NonSemanticShaderDebugInfo100DebugMacroUndef: - case NonSemanticShaderDebugInfo100DebugImportedEntity: - case NonSemanticShaderDebugInfo100DebugSource: - break; + uint32_t operand_index = 4; + const uint32_t x_type = _.GetOperandTypeId(inst, operand_index++); - // These checks are for operands that are differnet in - // ShaderDebugInfo100 - case NonSemanticShaderDebugInfo100DebugTypeBasic: { - CHECK_CONST_UINT_OPERAND("Flags", 8); - break; + if (ext_inst_key == OpenCLLIB::Shuffle2) { + const uint32_t y_type = _.GetOperandTypeId(inst, operand_index++); + if (x_type != y_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operands X and Y to be of the same type"; } - case NonSemanticShaderDebugInfo100DebugDeclare: { - for (uint32_t word_index = 8; word_index < num_words; ++word_index) { - auto index_inst = _.FindDef(inst->word(word_index)); - auto type_id = index_inst != nullptr ? index_inst->type_id() : 0; - if (type_id == 0 || !IsIntScalar(_, type_id, false, false)) - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected index must be scalar integer"; - } - break; + } + + const uint32_t shuffle_mask_type = + _.GetOperandTypeId(inst, operand_index++); + + if (!_.IsFloatVectorType(x_type) && !_.IsIntVectorType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X to be an int or float vector"; + } + + const uint32_t x_num_components = _.GetDimension(x_type); + if (x_num_components != 2 && x_num_components != 4 && + x_num_components != 8 && x_num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X to have 2, 4, 8 or 16 components"; + } + + const uint32_t result_component_type = _.GetComponentType(result_type); + + if (result_component_type != _.GetComponentType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand X and Result Type to have equal " + "component types"; + } + + if (!_.IsIntVectorType(shuffle_mask_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Shuffle Mask to be an int vector"; + } + + if (result_num_components != _.GetDimension(shuffle_mask_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Shuffle Mask to have the same number of " + "components as Result Type"; + } + + if (_.GetBitWidth(result_component_type) != + _.GetBitWidth(shuffle_mask_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Shuffle Mask components to have the same " + "bit width as Result Type components"; + } + break; + } + + case OpenCLLIB::Printf: { + if (!_.IsIntScalarType(result_type, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a 32-bit int type"; + } + + const uint32_t format_type = _.GetOperandTypeId(inst, 4); + spv::StorageClass format_storage_class; + uint32_t format_data_type = 0; + if (!_.GetPointerTypeInfo(format_type, &format_data_type, + &format_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Format to be a pointer"; + } + + if (_.HasExtension( + Extension::kSPV_EXT_relaxed_printf_string_address_space)) { + if (format_storage_class != spv::StorageClass::UniformConstant && + // Extension SPV_EXT_relaxed_printf_string_address_space allows + // format strings in Global, Local, Private and Generic address + // spaces + + // Global + format_storage_class != spv::StorageClass::CrossWorkgroup && + // Local + format_storage_class != spv::StorageClass::Workgroup && + // Private + format_storage_class != spv::StorageClass::Function && + // Generic + format_storage_class != spv::StorageClass::Generic) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Format storage class to be UniformConstant, " + "Crossworkgroup, Workgroup, Function, or Generic"; } - case NonSemanticShaderDebugInfo100DebugTypeMatrix: { - CHECK_DEBUG_OPERAND("Vector Type", CommonDebugInfoDebugTypeVector, 5); + } else { + if (format_storage_class != spv::StorageClass::UniformConstant) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Format storage class to be UniformConstant"; + } + } - CHECK_CONST_UINT_OPERAND("Vector Count", 6); + // If pointer points to an array, get the type of an element + if (_.IsIntArrayType(format_data_type)) + format_data_type = _.GetComponentType(format_data_type); - uint32_t vector_count = inst->word(6); + if (!_.IsIntScalarType(format_data_type, 8) && + !_.ContainsUntypedPointer(format_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Format data type to be 8-bit int"; + } + break; + } + + case OpenCLLIB::Prefetch: { + if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": expected Result Type to be void"; + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 4); + const uint32_t num_elements_type = _.GetOperandTypeId(inst, 5); + + spv::StorageClass p_storage_class; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Ptr to be a pointer"; + } + + if (p_storage_class != spv::StorageClass::CrossWorkgroup) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Ptr storage class to be CrossWorkgroup"; + } + + if (!_.IsFloatScalarOrVectorType(p_data_type) && + !_.IsIntScalarOrVectorType(p_data_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Ptr data type to be int or float scalar or " + "vector"; + } + + const uint32_t num_components = _.GetDimension(p_data_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(num_elements_type) || + _.GetBitWidth(num_elements_type) != size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Num Elements to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + break; + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateExtInstDebugInfo100(ValidationState_t& _, + const Instruction* inst) { + const uint32_t result_type = inst->type_id(); + const uint32_t ext_inst_index = inst->word(4); + if (!_.IsVoidType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected result type must be a result id of " << "OpTypeVoid"; + } + + const spv_ext_inst_type_t ext_inst_type = + spv_ext_inst_type_t(inst->ext_inst_type()); + const bool vulkanDebugInfo = + ext_inst_type == SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100; + + auto num_words = inst->words().size(); + + // Handle any non-common NonSemanticShaderDebugInfo instructions. + if (vulkanDebugInfo) { + const NonSemanticShaderDebugInfo100Instructions ext_inst_key = + NonSemanticShaderDebugInfo100Instructions(ext_inst_index); + switch (ext_inst_key) { + // The following block of instructions will be handled by the common + // validation. + case NonSemanticShaderDebugInfo100DebugInfoNone: + case NonSemanticShaderDebugInfo100DebugCompilationUnit: + case NonSemanticShaderDebugInfo100DebugTypePointer: + case NonSemanticShaderDebugInfo100DebugTypeQualifier: + case NonSemanticShaderDebugInfo100DebugTypeArray: + case NonSemanticShaderDebugInfo100DebugTypeVector: + case NonSemanticShaderDebugInfo100DebugTypedef: + case NonSemanticShaderDebugInfo100DebugTypeFunction: + case NonSemanticShaderDebugInfo100DebugTypeEnum: + case NonSemanticShaderDebugInfo100DebugTypeComposite: + case NonSemanticShaderDebugInfo100DebugTypeMember: + case NonSemanticShaderDebugInfo100DebugTypeInheritance: + case NonSemanticShaderDebugInfo100DebugTypePtrToMember: + case NonSemanticShaderDebugInfo100DebugTypeTemplate: + case NonSemanticShaderDebugInfo100DebugTypeTemplateParameter: + case NonSemanticShaderDebugInfo100DebugTypeTemplateTemplateParameter: + case NonSemanticShaderDebugInfo100DebugTypeTemplateParameterPack: + case NonSemanticShaderDebugInfo100DebugGlobalVariable: + case NonSemanticShaderDebugInfo100DebugFunctionDeclaration: + case NonSemanticShaderDebugInfo100DebugFunction: + case NonSemanticShaderDebugInfo100DebugLexicalBlock: + case NonSemanticShaderDebugInfo100DebugLexicalBlockDiscriminator: + case NonSemanticShaderDebugInfo100DebugScope: + case NonSemanticShaderDebugInfo100DebugNoScope: + case NonSemanticShaderDebugInfo100DebugInlinedAt: + case NonSemanticShaderDebugInfo100DebugLocalVariable: + case NonSemanticShaderDebugInfo100DebugInlinedVariable: + case NonSemanticShaderDebugInfo100DebugValue: + case NonSemanticShaderDebugInfo100DebugOperation: + case NonSemanticShaderDebugInfo100DebugExpression: + case NonSemanticShaderDebugInfo100DebugMacroDef: + case NonSemanticShaderDebugInfo100DebugMacroUndef: + case NonSemanticShaderDebugInfo100DebugImportedEntity: + case NonSemanticShaderDebugInfo100DebugSource: + break; + + // These checks are for operands that are differnet in + // ShaderDebugInfo100 + case NonSemanticShaderDebugInfo100DebugTypeBasic: { + CHECK_CONST_UINT_OPERAND("Flags", 8); + break; + } + case NonSemanticShaderDebugInfo100DebugDeclare: { + for (uint32_t word_index = 8; word_index < num_words; ++word_index) { + auto index_inst = _.FindDef(inst->word(word_index)); + auto type_id = index_inst != nullptr ? index_inst->type_id() : 0; + if (type_id == 0 || !IsIntScalar(_, type_id, false, false)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected index must be scalar integer"; + } + break; + } + case NonSemanticShaderDebugInfo100DebugTypeMatrix: { + CHECK_DEBUG_OPERAND("Vector Type", CommonDebugInfoDebugTypeVector, 5); + + CHECK_CONST_UINT_OPERAND("Vector Count", 6); + + uint32_t vector_count = inst->word(6); + uint64_t const_val; + if (!_.EvalConstantValUint64(vector_count, &const_val)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": Vector Count must be 32-bit integer OpConstant"; + } + + vector_count = const_val & 0xffffffff; + if (!vector_count || vector_count > 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": Vector Count must be positive " + << "integer less than or equal to 4"; + } + break; + } + case NonSemanticShaderDebugInfo100DebugFunctionDefinition: { + CHECK_DEBUG_OPERAND("Function", CommonDebugInfoDebugFunction, 5); + CHECK_OPERAND("Definition", spv::Op::OpFunction, 6); + const auto* current_function = inst->function(); + if (current_function->first_block()->id() != inst->block()->id()) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": must be in the entry basic block of the function"; + } + + const uint32_t definition_id = inst->word(6); + if (definition_id != current_function->id()) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": operand Definition must point to the OpFunction it is " + "inside"; + } + break; + } + case NonSemanticShaderDebugInfo100DebugLine: { + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 5); + CHECK_CONST_UINT_OPERAND("Line Start", 6); + CHECK_CONST_UINT_OPERAND("Line End", 7); + CHECK_CONST_UINT_OPERAND("Column Start", 8); + CHECK_CONST_UINT_OPERAND("Column End", 9); + + // above already validates if 32-bit and non-spec constant + // but want to use EvalInt32IfConst to be consistent with other Eval + // locations + bool is_int32 = false, is_const_int32 = false; + uint32_t line_start = 0; + uint32_t line_end = 0; + uint32_t column_start = 0; + uint32_t column_end = 0; + std::tie(is_int32, is_const_int32, line_start) = + _.EvalInt32IfConst(inst->word(6)); + std::tie(is_int32, is_const_int32, line_end) = + _.EvalInt32IfConst(inst->word(7)); + std::tie(is_int32, is_const_int32, column_start) = + _.EvalInt32IfConst(inst->word(8)); + std::tie(is_int32, is_const_int32, column_end) = + _.EvalInt32IfConst(inst->word(9)); + if (line_end < line_start) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": operand Line End (" + << line_end << ") is less than Line Start (" << line_start + << ")"; + } else if (line_start == line_end && column_end < column_start) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": operand Column End (" + << column_end << ") is less than Column Start (" + << column_start << ") when Line Start equals Line End"; + } + break; + } + case NonSemanticShaderDebugInfo100DebugSourceContinued: { + CHECK_OPERAND("Text", spv::Op::OpString, 5); + break; + } + case NonSemanticShaderDebugInfo100DebugBuildIdentifier: { + CHECK_OPERAND("Identifier", spv::Op::OpString, 5); + CHECK_CONST_UINT_OPERAND("Flags", 6); + break; + } + case NonSemanticShaderDebugInfo100DebugStoragePath: { + CHECK_OPERAND("Path", spv::Op::OpString, 5); + break; + } + case NonSemanticShaderDebugInfo100DebugEntryPoint: { + CHECK_DEBUG_OPERAND("Entry Point", CommonDebugInfoDebugFunction, 5); + CHECK_DEBUG_OPERAND("Compilation Unit", + CommonDebugInfoDebugCompilationUnit, 6); + CHECK_OPERAND("Compiler Signature", spv::Op::OpString, 7); + CHECK_OPERAND("Command-line Arguments", spv::Op::OpString, 8); + break; + } + + // Has no additional checks + case NonSemanticShaderDebugInfo100DebugNoLine: + break; + case NonSemanticShaderDebugInfo100InstructionsMax: + assert(0); + break; + } + } + + // Handle any non-common OpenCL insts, then common + if (ext_inst_type != SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100 || + OpenCLDebugInfo100Instructions(ext_inst_index) != + OpenCLDebugInfo100DebugModuleINTEL) { + const CommonDebugInfoInstructions ext_inst_key = + CommonDebugInfoInstructions(ext_inst_index); + switch (ext_inst_key) { + case CommonDebugInfoDebugInfoNone: + case CommonDebugInfoDebugNoScope: + break; + // The binary parser validates the opcode for DebugInfoNone, + // DebugNoScope, DebugOperation. We just check the parameters to + // DebugOperation are properly constants for vulkan debug info. + case CommonDebugInfoDebugOperation: { + CHECK_CONST_UINT_OPERAND("Operation", 5); + for (uint32_t i = 6; i < num_words; ++i) { + CHECK_CONST_UINT_OPERAND("Operand", i); + } + break; + } + case CommonDebugInfoDebugCompilationUnit: { + CHECK_CONST_UINT_OPERAND("Version", 5); + CHECK_CONST_UINT_OPERAND("DWARF Version", 6); + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Language", 8); + break; + } + case CommonDebugInfoDebugSource: { + CHECK_OPERAND("File", spv::Op::OpString, 5); + if (num_words == 7) CHECK_OPERAND("Text", spv::Op::OpString, 6); + break; + } + case CommonDebugInfoDebugTypeBasic: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + CHECK_OPERAND("Size", spv::Op::OpConstant, 6); + CHECK_CONST_UINT_OPERAND("Encoding", 7); + break; + } + case CommonDebugInfoDebugTypePointer: { + auto validate_base_type = + ValidateOperandDebugType(_, "Base Type", inst, 5, false); + if (validate_base_type != SPV_SUCCESS) return validate_base_type; + CHECK_CONST_UINT_OPERAND("Storage Class", 6); + CHECK_CONST_UINT_OPERAND("Flags", 7); + break; + } + case CommonDebugInfoDebugTypeQualifier: { + auto validate_base_type = + ValidateOperandDebugType(_, "Base Type", inst, 5, false); + if (validate_base_type != SPV_SUCCESS) return validate_base_type; + CHECK_CONST_UINT_OPERAND("Type Qualifier", 6); + break; + } + case CommonDebugInfoDebugTypeVector: { + auto validate_base_type = ValidateOperandBaseType(_, inst, 5); + if (validate_base_type != SPV_SUCCESS) return validate_base_type; + + CHECK_CONST_UINT_OPERAND("Component Count", 6); + uint32_t component_count = inst->word(6); + if (vulkanDebugInfo) { uint64_t const_val; - if (!_.EvalConstantValUint64(vector_count, &const_val)) { + if (!_.EvalConstantValUint64(component_count, &const_val)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << ": Vector Count must be 32-bit integer OpConstant"; + << GetExtInstName(_, inst) + << ": Component Count must be 32-bit integer OpConstant"; } - - vector_count = const_val & 0xffffffff; - if (!vector_count || vector_count > 4) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": Vector Count must be positive " - << "integer less than or equal to 4"; - } - break; - } - case NonSemanticShaderDebugInfo100DebugFunctionDefinition: { - CHECK_DEBUG_OPERAND("Function", CommonDebugInfoDebugFunction, 5); - CHECK_OPERAND("Definition", spv::Op::OpFunction, 6); - const auto* current_function = inst->function(); - if (current_function->first_block()->id() != inst->block()->id()) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << ": must be in the entry basic block of the function"; - } - - const uint32_t definition_id = inst->word(6); - if (definition_id != current_function->id()) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << ": operand Definition must point to the OpFunction it is " - "inside"; - } - break; - } - case NonSemanticShaderDebugInfo100DebugLine: { - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 5); - CHECK_CONST_UINT_OPERAND("Line Start", 6); - CHECK_CONST_UINT_OPERAND("Line End", 7); - CHECK_CONST_UINT_OPERAND("Column Start", 8); - CHECK_CONST_UINT_OPERAND("Column End", 9); - - // above already validates if 32-bit and non-spec constant - // but want to use EvalInt32IfConst to be consistent with other Eval - // locations - bool is_int32 = false, is_const_int32 = false; - uint32_t line_start = 0; - uint32_t line_end = 0; - uint32_t column_start = 0; - uint32_t column_end = 0; - std::tie(is_int32, is_const_int32, line_start) = - _.EvalInt32IfConst(inst->word(6)); - std::tie(is_int32, is_const_int32, line_end) = - _.EvalInt32IfConst(inst->word(7)); - std::tie(is_int32, is_const_int32, column_start) = - _.EvalInt32IfConst(inst->word(8)); - std::tie(is_int32, is_const_int32, column_end) = - _.EvalInt32IfConst(inst->word(9)); - if (line_end < line_start) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": operand Line End (" << line_end - << ") is less than Line Start (" << line_start << ")"; - } else if (line_start == line_end && column_end < column_start) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": operand Column End (" << column_end - << ") is less than Column Start (" << column_start - << ") when Line Start equals Line End"; - } - break; - } - case NonSemanticShaderDebugInfo100DebugSourceContinued: { - CHECK_OPERAND("Text", spv::Op::OpString, 5); - break; - } - case NonSemanticShaderDebugInfo100DebugBuildIdentifier: { - CHECK_OPERAND("Identifier", spv::Op::OpString, 5); - CHECK_CONST_UINT_OPERAND("Flags", 6); - break; - } - case NonSemanticShaderDebugInfo100DebugStoragePath: { - CHECK_OPERAND("Path", spv::Op::OpString, 5); - break; - } - case NonSemanticShaderDebugInfo100DebugEntryPoint: { - CHECK_DEBUG_OPERAND("Entry Point", CommonDebugInfoDebugFunction, 5); - CHECK_DEBUG_OPERAND("Compilation Unit", - CommonDebugInfoDebugCompilationUnit, 6); - CHECK_OPERAND("Compiler Signature", spv::Op::OpString, 7); - CHECK_OPERAND("Command-line Arguments", spv::Op::OpString, 8); - break; + component_count = const_val & 0xffffffff; } - // Has no additional checks - case NonSemanticShaderDebugInfo100DebugNoLine: - break; - case NonSemanticShaderDebugInfo100InstructionsMax: - assert(0); - break; + if (!component_count || component_count > 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": Component Count must be positive " + << "integer less than or equal to 4"; + } + break; } - } - - // Handle any non-common OpenCL insts, then common - if (ext_inst_type != SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100 || - OpenCLDebugInfo100Instructions(ext_inst_index) != - OpenCLDebugInfo100DebugModuleINTEL) { - const CommonDebugInfoInstructions ext_inst_key = - CommonDebugInfoInstructions(ext_inst_index); - switch (ext_inst_key) { - case CommonDebugInfoDebugInfoNone: - case CommonDebugInfoDebugNoScope: - break; - // The binary parser validates the opcode for DebugInfoNone, - // DebugNoScope, DebugOperation. We just check the parameters to - // DebugOperation are properly constants for vulkan debug info. - case CommonDebugInfoDebugOperation: { - CHECK_CONST_UINT_OPERAND("Operation", 5); - for (uint32_t i = 6; i < num_words; ++i) { - CHECK_CONST_UINT_OPERAND("Operand", i); - } - break; - } - case CommonDebugInfoDebugCompilationUnit: { - CHECK_CONST_UINT_OPERAND("Version", 5); - CHECK_CONST_UINT_OPERAND("DWARF Version", 6); - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Language", 8); - break; - } - case CommonDebugInfoDebugSource: { - CHECK_OPERAND("File", spv::Op::OpString, 5); - if (num_words == 7) CHECK_OPERAND("Text", spv::Op::OpString, 6); - break; - } - case CommonDebugInfoDebugTypeBasic: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - CHECK_OPERAND("Size", spv::Op::OpConstant, 6); - CHECK_CONST_UINT_OPERAND("Encoding", 7); - break; - } - case CommonDebugInfoDebugTypePointer: { - auto validate_base_type = ValidateOperandDebugType( - _, "Base Type", inst, 5, ext_inst_name, false); - if (validate_base_type != SPV_SUCCESS) return validate_base_type; - CHECK_CONST_UINT_OPERAND("Storage Class", 6); - CHECK_CONST_UINT_OPERAND("Flags", 7); - break; - } - case CommonDebugInfoDebugTypeQualifier: { - auto validate_base_type = ValidateOperandDebugType( - _, "Base Type", inst, 5, ext_inst_name, false); - if (validate_base_type != SPV_SUCCESS) return validate_base_type; - CHECK_CONST_UINT_OPERAND("Type Qualifier", 6); - break; - } - case CommonDebugInfoDebugTypeVector: { - auto validate_base_type = - ValidateOperandBaseType(_, inst, 5, ext_inst_name); - if (validate_base_type != SPV_SUCCESS) return validate_base_type; - - CHECK_CONST_UINT_OPERAND("Component Count", 6); - uint32_t component_count = inst->word(6); - if (vulkanDebugInfo) { - uint64_t const_val; - if (!_.EvalConstantValUint64(component_count, &const_val)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() - << ": Component Count must be 32-bit integer OpConstant"; + case CommonDebugInfoDebugTypeArray: { + auto validate_base_type = + ValidateOperandDebugType(_, "Base Type", inst, 5, false); + if (validate_base_type != SPV_SUCCESS) return validate_base_type; + for (uint32_t i = 6; i < num_words; ++i) { + bool invalid = false; + auto* component_count = _.FindDef(inst->word(i)); + if (IsConstIntScalarTypeWith32Or64Bits(_, component_count)) { + // TODO: We need a spec discussion for the runtime array for + // OpenCL. + if (!vulkanDebugInfo && !component_count->word(3)) { + invalid = true; } - component_count = const_val & 0xffffffff; - } - - if (!component_count || component_count > 4) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": Component Count must be positive " - << "integer less than or equal to 4"; - } - break; - } - case CommonDebugInfoDebugTypeArray: { - auto validate_base_type = ValidateOperandDebugType( - _, "Base Type", inst, 5, ext_inst_name, false); - if (validate_base_type != SPV_SUCCESS) return validate_base_type; - for (uint32_t i = 6; i < num_words; ++i) { - bool invalid = false; - auto* component_count = _.FindDef(inst->word(i)); - if (IsConstIntScalarTypeWith32Or64Bits(_, component_count)) { - // TODO: We need a spec discussion for the runtime array for - // OpenCL. - if (!vulkanDebugInfo && !component_count->word(3)) { + } else if (component_count->words().size() > 6 && + (CommonDebugInfoInstructions(component_count->word(4)) == + CommonDebugInfoDebugLocalVariable || + CommonDebugInfoInstructions(component_count->word(4)) == + CommonDebugInfoDebugGlobalVariable)) { + auto* component_count_type = _.FindDef(component_count->word(6)); + if (component_count_type->words().size() > 7) { + uint32_t encoding = component_count_type->word(7); + if (CommonDebugInfoInstructions(component_count_type->word(4)) != + CommonDebugInfoDebugTypeBasic || + (vulkanDebugInfo && !IsUint32Constant(_, encoding)) || + OpenCLDebugInfo100DebugBaseTypeAttributeEncoding( + vulkanDebugInfo + ? GetUint32Constant(_, encoding) + : encoding) != OpenCLDebugInfo100Unsigned) { invalid = true; - } - } else if (component_count->words().size() > 6 && - (CommonDebugInfoInstructions(component_count->word(4)) == - CommonDebugInfoDebugLocalVariable || - CommonDebugInfoInstructions(component_count->word(4)) == - CommonDebugInfoDebugGlobalVariable)) { - auto* component_count_type = _.FindDef(component_count->word(6)); - if (component_count_type->words().size() > 7) { - uint32_t encoding = component_count_type->word(7); - if (CommonDebugInfoInstructions(component_count_type->word( - 4)) != CommonDebugInfoDebugTypeBasic || - (vulkanDebugInfo && !IsUint32Constant(_, encoding)) || - OpenCLDebugInfo100DebugBaseTypeAttributeEncoding( - vulkanDebugInfo - ? GetUint32Constant(_, encoding) - : encoding) != OpenCLDebugInfo100Unsigned) { - invalid = true; - } else { - // DebugTypeBasic for DebugLocalVariable/DebugGlobalVariable - // must have Unsigned encoding and 32 or 64 as its size in - // bits. - Instruction* size_in_bits = - _.FindDef(component_count_type->word(6)); - if (!_.IsIntScalarType(size_in_bits->type_id()) || - (size_in_bits->word(3) != 32 && - size_in_bits->word(3) != 64)) { - invalid = true; - } - } } else { - invalid = true; + // DebugTypeBasic for DebugLocalVariable/DebugGlobalVariable + // must have Unsigned encoding and 32 or 64 as its size in + // bits. + Instruction* size_in_bits = + _.FindDef(component_count_type->word(6)); + if (!_.IsIntScalarType(size_in_bits->type_id()) || + (size_in_bits->word(3) != 32 && + size_in_bits->word(3) != 64)) { + invalid = true; + } } } else { invalid = true; } - if (invalid) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": Component Count must be " - << "OpConstant with a 32- or 64-bits integer scalar type " - "or " - << "DebugGlobalVariable or DebugLocalVariable with a 32- " - "or " - << "64-bits unsigned integer scalar type"; - } - } - break; - } - case CommonDebugInfoDebugTypedef: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - auto validate_base_type = - ValidateOperandBaseType(_, inst, 6, ext_inst_name); - if (validate_base_type != SPV_SUCCESS) return validate_base_type; - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Line", 8); - CHECK_CONST_UINT_OPERAND("Column", 9); - auto validate_parent = - ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); - if (validate_parent != SPV_SUCCESS) return validate_parent; - break; - } - case CommonDebugInfoDebugTypeFunction: { - CHECK_CONST_UINT_OPERAND("Flags", 5); - auto* return_type = _.FindDef(inst->word(6)); - // TODO: We need a spec discussion that we have to allow return and - // parameter types of a DebugTypeFunction to have template parameter. - if (return_type->opcode() != spv::Op::OpTypeVoid) { - auto validate_return = ValidateOperandDebugType( - _, "Return Type", inst, 6, ext_inst_name, true); - if (validate_return != SPV_SUCCESS) return validate_return; - } - for (uint32_t word_index = 7; word_index < num_words; ++word_index) { - auto validate_param = ValidateOperandDebugType( - _, "Parameter Types", inst, word_index, ext_inst_name, true); - if (validate_param != SPV_SUCCESS) return validate_param; - } - break; - } - case CommonDebugInfoDebugTypeEnum: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - if (!DoesDebugInfoOperandMatchExpectation( - _, - [](CommonDebugInfoInstructions dbg_inst) { - return dbg_inst == CommonDebugInfoDebugInfoNone; - }, - inst, 6)) { - auto validate_underlying_type = ValidateOperandDebugType( - _, "Underlying Types", inst, 6, ext_inst_name, false); - if (validate_underlying_type != SPV_SUCCESS) - return validate_underlying_type; - } - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Line", 8); - CHECK_CONST_UINT_OPERAND("Column", 9); - auto validate_parent = - ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); - if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_OPERAND("Size", spv::Op::OpConstant, 11); - auto* size = _.FindDef(inst->word(11)); - if (!_.IsIntScalarType(size->type_id()) || !size->word(3)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": expected operand Size is a " - << "positive integer"; - } - CHECK_CONST_UINT_OPERAND("Flags", 12); - for (uint32_t word_index = 13; word_index + 1 < num_words; - word_index += 2) { - CHECK_OPERAND("Value", spv::Op::OpConstant, word_index); - CHECK_OPERAND("Name", spv::Op::OpString, word_index + 1); - } - break; - } - case CommonDebugInfoDebugTypeComposite: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Line", 8); - CHECK_CONST_UINT_OPERAND("Column", 9); - auto validate_parent = - ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); - if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); - if (!DoesDebugInfoOperandMatchExpectation( - _, - [](CommonDebugInfoInstructions dbg_inst) { - return dbg_inst == CommonDebugInfoDebugInfoNone; - }, - inst, 12)) { - CHECK_OPERAND("Size", spv::Op::OpConstant, 12); - } - CHECK_CONST_UINT_OPERAND("Flags", 13); - for (uint32_t word_index = 14; word_index < num_words; ++word_index) { - if (!DoesDebugInfoOperandMatchExpectation( - _, - [](CommonDebugInfoInstructions dbg_inst) { - return dbg_inst == CommonDebugInfoDebugTypeMember || - dbg_inst == CommonDebugInfoDebugFunction || - dbg_inst == CommonDebugInfoDebugTypeInheritance; - }, - inst, word_index)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Members " - << "must be DebugTypeMember, DebugFunction, or " - "DebugTypeInheritance"; - } - } - break; - } - case CommonDebugInfoDebugTypeMember: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - // TODO: We need a spec discussion that we have to allow member types - // to have template parameter. - auto validate_type = - ValidateOperandDebugType(_, "Type", inst, 6, ext_inst_name, true); - if (validate_type != SPV_SUCCESS) return validate_type; - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Line", 8); - CHECK_CONST_UINT_OPERAND("Column", 9); - // NonSemantic.Shader.DebugInfo doesn't have the Parent operand - if (vulkanDebugInfo) { - CHECK_OPERAND("Offset", spv::Op::OpConstant, 10); - CHECK_OPERAND("Size", spv::Op::OpConstant, 11); - CHECK_CONST_UINT_OPERAND("Flags", 12); - if (num_words == 14) - CHECK_OPERAND("Value", spv::Op::OpConstant, 13); } else { - CHECK_DEBUG_OPERAND("Parent", CommonDebugInfoDebugTypeComposite, - 10); - CHECK_OPERAND("Offset", spv::Op::OpConstant, 11); - CHECK_OPERAND("Size", spv::Op::OpConstant, 12); - CHECK_CONST_UINT_OPERAND("Flags", 13); - if (num_words == 15) - CHECK_OPERAND("Value", spv::Op::OpConstant, 14); + invalid = true; } - break; - } - case CommonDebugInfoDebugTypeInheritance: { - CHECK_DEBUG_OPERAND("Child", CommonDebugInfoDebugTypeComposite, 5); - auto* debug_inst = _.FindDef(inst->word(5)); - auto composite_type = - OpenCLDebugInfo100DebugCompositeType(debug_inst->word(6)); - if (composite_type != OpenCLDebugInfo100Class && - composite_type != OpenCLDebugInfo100Structure) { + if (invalid) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Child must be class or struct debug " - "type"; + << GetExtInstName(_, inst) << ": Component Count must be " + << "OpConstant with a 32- or 64-bits integer scalar type " + "or " + << "DebugGlobalVariable or DebugLocalVariable with a 32- " + "or " + << "64-bits unsigned integer scalar type"; } - CHECK_DEBUG_OPERAND("Parent", CommonDebugInfoDebugTypeComposite, 6); - debug_inst = _.FindDef(inst->word(6)); - composite_type = - OpenCLDebugInfo100DebugCompositeType(debug_inst->word(6)); - if (composite_type != OpenCLDebugInfo100Class && - composite_type != OpenCLDebugInfo100Structure) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Parent must be class or struct debug " - "type"; - } - CHECK_OPERAND("Offset", spv::Op::OpConstant, 7); - CHECK_OPERAND("Size", spv::Op::OpConstant, 8); - CHECK_CONST_UINT_OPERAND("Flags", 9); - break; } - case CommonDebugInfoDebugFunction: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - CHECK_DEBUG_OPERAND("Type", CommonDebugInfoDebugTypeFunction, 6); - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Line", 8); - CHECK_CONST_UINT_OPERAND("Column", 9); - auto validate_parent = - ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); - if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); - CHECK_CONST_UINT_OPERAND("Flags", 12); - CHECK_CONST_UINT_OPERAND("Scope Line", 13); - // NonSemantic.Shader.DebugInfo.100 doesn't include a reference to the - // OpFunction - if (vulkanDebugInfo) { - if (num_words == 15) { - CHECK_DEBUG_OPERAND("Declaration", - CommonDebugInfoDebugFunctionDeclaration, 14); - } - } else { - if (!DoesDebugInfoOperandMatchExpectation( - _, - [](CommonDebugInfoInstructions dbg_inst) { - return dbg_inst == CommonDebugInfoDebugInfoNone; - }, - inst, 14)) { - CHECK_OPERAND("Function", spv::Op::OpFunction, 14); - } - if (num_words == 16) { - CHECK_DEBUG_OPERAND("Declaration", - CommonDebugInfoDebugFunctionDeclaration, 15); - } - } - break; - } - case CommonDebugInfoDebugFunctionDeclaration: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - CHECK_DEBUG_OPERAND("Type", CommonDebugInfoDebugTypeFunction, 6); - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Line", 8); - CHECK_CONST_UINT_OPERAND("Column", 9); - auto validate_parent = - ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); - if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); - CHECK_CONST_UINT_OPERAND("Flags", 12); - break; - } - case CommonDebugInfoDebugLexicalBlock: { - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 5); - CHECK_CONST_UINT_OPERAND("Line", 6); - CHECK_CONST_UINT_OPERAND("Column", 7); - auto validate_parent = - ValidateOperandLexicalScope(_, "Parent", inst, 8, ext_inst_name); - if (validate_parent != SPV_SUCCESS) return validate_parent; - if (num_words == 10) CHECK_OPERAND("Name", spv::Op::OpString, 9); - break; - } - case CommonDebugInfoDebugScope: { - auto validate_scope = - ValidateOperandLexicalScope(_, "Scope", inst, 5, ext_inst_name); - if (validate_scope != SPV_SUCCESS) return validate_scope; - if (num_words == 7) { - CHECK_DEBUG_OPERAND("Inlined At", CommonDebugInfoDebugInlinedAt, 6); - } - break; - } - case CommonDebugInfoDebugLocalVariable: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - // TODO: We need a spec discussion that we have to allow local - // variable types to have template parameter. - auto validate_type = - ValidateOperandDebugType(_, "Type", inst, 6, ext_inst_name, true); - if (validate_type != SPV_SUCCESS) return validate_type; - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Line", 8); - CHECK_CONST_UINT_OPERAND("Column", 9); - auto validate_parent = - ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); - if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_CONST_UINT_OPERAND("Flags", 11); - if (num_words == 13) { - CHECK_CONST_UINT_OPERAND("ArgNumber", 12); - } - break; - } - case CommonDebugInfoDebugDeclare: { - CHECK_DEBUG_OPERAND("Local Variable", - CommonDebugInfoDebugLocalVariable, 5); - auto* operand = _.FindDef(inst->word(6)); - if (operand->opcode() != spv::Op::OpVariable && - operand->opcode() != spv::Op::OpFunctionParameter) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Variable must be a result id of " - "OpVariable or OpFunctionParameter"; - } - - CHECK_DEBUG_OPERAND("Expression", CommonDebugInfoDebugExpression, 7); - break; - } - case CommonDebugInfoDebugExpression: { - for (uint32_t word_index = 5; word_index < num_words; ++word_index) { - CHECK_DEBUG_OPERAND("Operation", CommonDebugInfoDebugOperation, - word_index); - } - break; - } - case CommonDebugInfoDebugTypeTemplate: { - if (!DoesDebugInfoOperandMatchExpectation( - _, - [](CommonDebugInfoInstructions dbg_inst) { - return dbg_inst == CommonDebugInfoDebugTypeComposite || - dbg_inst == CommonDebugInfoDebugFunction; - }, - inst, 5)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Target must be DebugTypeComposite " - << "or DebugFunction"; - } - for (uint32_t word_index = 6; word_index < num_words; ++word_index) { - if (!DoesDebugInfoOperandMatchExpectation( - _, - [](CommonDebugInfoInstructions dbg_inst) { - return dbg_inst == - CommonDebugInfoDebugTypeTemplateParameter || - dbg_inst == - CommonDebugInfoDebugTypeTemplateTemplateParameter; - }, - inst, word_index)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Parameters must be " - << "DebugTypeTemplateParameter or " - << "DebugTypeTemplateTemplateParameter"; - } - } - break; - } - case CommonDebugInfoDebugTypeTemplateParameter: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - auto validate_actual_type = ValidateOperandDebugType( - _, "Actual Type", inst, 6, ext_inst_name, false); - if (validate_actual_type != SPV_SUCCESS) return validate_actual_type; - if (!DoesDebugInfoOperandMatchExpectation( - _, - [](CommonDebugInfoInstructions dbg_inst) { - return dbg_inst == CommonDebugInfoDebugInfoNone; - }, - inst, 7)) { - CHECK_OPERAND("Value", spv::Op::OpConstant, 7); - } - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 8); - CHECK_CONST_UINT_OPERAND("Line", 9); - CHECK_CONST_UINT_OPERAND("Column", 10); - break; - } - case CommonDebugInfoDebugGlobalVariable: { - CHECK_OPERAND("Name", spv::Op::OpString, 5); - auto validate_type = ValidateOperandDebugType(_, "Type", inst, 6, - ext_inst_name, false); - if (validate_type != SPV_SUCCESS) return validate_type; - CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); - CHECK_CONST_UINT_OPERAND("Line", 8); - CHECK_CONST_UINT_OPERAND("Column", 9); - auto validate_scope = - ValidateOperandLexicalScope(_, "Scope", inst, 10, ext_inst_name); - if (validate_scope != SPV_SUCCESS) return validate_scope; - CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); - if (!DoesDebugInfoOperandMatchExpectation( - _, - [](CommonDebugInfoInstructions dbg_inst) { - return dbg_inst == CommonDebugInfoDebugInfoNone; - }, - inst, 12)) { - auto* operand = _.FindDef(inst->word(12)); - if (operand->opcode() != spv::Op::OpVariable && - operand->opcode() != spv::Op::OpConstant) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": " - << "expected operand Variable must be a result id of " - "OpVariable or OpConstant or DebugInfoNone"; - } - } - if (num_words == 15) { - CHECK_DEBUG_OPERAND("Static Member Declaration", - CommonDebugInfoDebugTypeMember, 14); - } - break; - } - case CommonDebugInfoDebugInlinedAt: { - CHECK_CONST_UINT_OPERAND("Line", 5); - auto validate_scope = - ValidateOperandLexicalScope(_, "Scope", inst, 6, ext_inst_name); - if (validate_scope != SPV_SUCCESS) return validate_scope; - if (num_words == 8) { - CHECK_DEBUG_OPERAND("Inlined", CommonDebugInfoDebugInlinedAt, 7); - } - break; - } - case CommonDebugInfoDebugValue: { - CHECK_DEBUG_OPERAND("Local Variable", - CommonDebugInfoDebugLocalVariable, 5); - CHECK_DEBUG_OPERAND("Expression", CommonDebugInfoDebugExpression, 7); - - for (uint32_t word_index = 8; word_index < num_words; ++word_index) { - // TODO: The following code simply checks if it is a const int - // scalar or a DebugLocalVariable or DebugGlobalVariable, but we - // have to check it using the same validation for Indexes of - // OpAccessChain. - if (!IsConstWithIntScalarType(_, inst, word_index) && - !IsDebugVariableWithIntScalarType(_, inst, word_index)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << ext_inst_name() << ": expected operand Indexes is " - << "OpConstant, DebugGlobalVariable, or " - << "type is OpConstant with an integer scalar type"; - } - } - break; - } - - // TODO: Add validation rules for remaining cases as well. - case CommonDebugInfoDebugTypePtrToMember: - case CommonDebugInfoDebugTypeTemplateTemplateParameter: - case CommonDebugInfoDebugTypeTemplateParameterPack: - case CommonDebugInfoDebugLexicalBlockDiscriminator: - case CommonDebugInfoDebugInlinedVariable: - case CommonDebugInfoDebugMacroDef: - case CommonDebugInfoDebugMacroUndef: - case CommonDebugInfoDebugImportedEntity: - break; - case CommonDebugInfoInstructionsMax: - assert(0); - break; + break; } - } - } else if (ext_inst_type == SPV_EXT_INST_TYPE_NONSEMANTIC_CLSPVREFLECTION) { - auto import_inst = _.FindDef(inst->GetOperandAs(2)); - const std::string name = import_inst->GetOperandAs(1); - const std::string reflection = "NonSemantic.ClspvReflection."; - char* end_ptr; - auto version_string = name.substr(reflection.size()); - if (version_string.empty()) { - return _.diag(SPV_ERROR_INVALID_DATA, import_inst) - << "Missing NonSemantic.ClspvReflection import version"; - } - uint32_t version = static_cast( - std::strtoul(version_string.c_str(), &end_ptr, 10)); - if (end_ptr && *end_ptr != '\0') { - return _.diag(SPV_ERROR_INVALID_DATA, import_inst) - << "NonSemantic.ClspvReflection import does not encode the " - "version correctly"; - } - if (version == 0 || version > NonSemanticClspvReflectionRevision) { - return _.diag(SPV_ERROR_INVALID_DATA, import_inst) - << "Unknown NonSemantic.ClspvReflection import version"; - } + case CommonDebugInfoDebugTypedef: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + auto validate_base_type = ValidateOperandBaseType(_, inst, 6); + if (validate_base_type != SPV_SUCCESS) return validate_base_type; + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Line", 8); + CHECK_CONST_UINT_OPERAND("Column", 9); + auto validate_parent = + ValidateOperandLexicalScope(_, "Parent", inst, 10); + if (validate_parent != SPV_SUCCESS) return validate_parent; + break; + } + case CommonDebugInfoDebugTypeFunction: { + CHECK_CONST_UINT_OPERAND("Flags", 5); + auto* return_type = _.FindDef(inst->word(6)); + // TODO: We need a spec discussion that we have to allow return and + // parameter types of a DebugTypeFunction to have template parameter. + if (return_type->opcode() != spv::Op::OpTypeVoid) { + auto validate_return = + ValidateOperandDebugType(_, "Return Type", inst, 6, true); + if (validate_return != SPV_SUCCESS) return validate_return; + } + for (uint32_t word_index = 7; word_index < num_words; ++word_index) { + auto validate_param = ValidateOperandDebugType( + _, "Parameter Types", inst, word_index, true); + if (validate_param != SPV_SUCCESS) return validate_param; + } + break; + } + case CommonDebugInfoDebugTypeEnum: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + if (!DoesDebugInfoOperandMatchExpectation( + _, + [](CommonDebugInfoInstructions dbg_inst) { + return dbg_inst == CommonDebugInfoDebugInfoNone; + }, + inst, 6)) { + auto validate_underlying_type = + ValidateOperandDebugType(_, "Underlying Types", inst, 6, false); + if (validate_underlying_type != SPV_SUCCESS) + return validate_underlying_type; + } + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Line", 8); + CHECK_CONST_UINT_OPERAND("Column", 9); + auto validate_parent = + ValidateOperandLexicalScope(_, "Parent", inst, 10); + if (validate_parent != SPV_SUCCESS) return validate_parent; + CHECK_OPERAND("Size", spv::Op::OpConstant, 11); + auto* size = _.FindDef(inst->word(11)); + if (!_.IsIntScalarType(size->type_id()) || !size->word(3)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": expected operand Size is a " + << "positive integer"; + } + CHECK_CONST_UINT_OPERAND("Flags", 12); + for (uint32_t word_index = 13; word_index + 1 < num_words; + word_index += 2) { + CHECK_OPERAND("Value", spv::Op::OpConstant, word_index); + CHECK_OPERAND("Name", spv::Op::OpString, word_index + 1); + } + break; + } + case CommonDebugInfoDebugTypeComposite: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Line", 8); + CHECK_CONST_UINT_OPERAND("Column", 9); + auto validate_parent = + ValidateOperandLexicalScope(_, "Parent", inst, 10); + if (validate_parent != SPV_SUCCESS) return validate_parent; + CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); + if (!DoesDebugInfoOperandMatchExpectation( + _, + [](CommonDebugInfoInstructions dbg_inst) { + return dbg_inst == CommonDebugInfoDebugInfoNone; + }, + inst, 12)) { + CHECK_OPERAND("Size", spv::Op::OpConstant, 12); + } + CHECK_CONST_UINT_OPERAND("Flags", 13); + for (uint32_t word_index = 14; word_index < num_words; ++word_index) { + if (!DoesDebugInfoOperandMatchExpectation( + _, + [](CommonDebugInfoInstructions dbg_inst) { + return dbg_inst == CommonDebugInfoDebugTypeMember || + dbg_inst == CommonDebugInfoDebugFunction || + dbg_inst == CommonDebugInfoDebugTypeInheritance; + }, + inst, word_index)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Members " + << "must be DebugTypeMember, DebugFunction, or " + "DebugTypeInheritance"; + } + } + break; + } + case CommonDebugInfoDebugTypeMember: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + // TODO: We need a spec discussion that we have to allow member types + // to have template parameter. + auto validate_type = ValidateOperandDebugType(_, "Type", inst, 6, true); + if (validate_type != SPV_SUCCESS) return validate_type; + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Line", 8); + CHECK_CONST_UINT_OPERAND("Column", 9); + // NonSemantic.Shader.DebugInfo doesn't have the Parent operand + if (vulkanDebugInfo) { + CHECK_OPERAND("Offset", spv::Op::OpConstant, 10); + CHECK_OPERAND("Size", spv::Op::OpConstant, 11); + CHECK_CONST_UINT_OPERAND("Flags", 12); + if (num_words == 14) CHECK_OPERAND("Value", spv::Op::OpConstant, 13); + } else { + CHECK_DEBUG_OPERAND("Parent", CommonDebugInfoDebugTypeComposite, 10); + CHECK_OPERAND("Offset", spv::Op::OpConstant, 11); + CHECK_OPERAND("Size", spv::Op::OpConstant, 12); + CHECK_CONST_UINT_OPERAND("Flags", 13); + if (num_words == 15) CHECK_OPERAND("Value", spv::Op::OpConstant, 14); + } + break; + } + case CommonDebugInfoDebugTypeInheritance: { + CHECK_DEBUG_OPERAND("Child", CommonDebugInfoDebugTypeComposite, 5); + auto* debug_inst = _.FindDef(inst->word(5)); + auto composite_type = + OpenCLDebugInfo100DebugCompositeType(debug_inst->word(6)); + if (composite_type != OpenCLDebugInfo100Class && + composite_type != OpenCLDebugInfo100Structure) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Child must be class or struct debug " + "type"; + } + CHECK_DEBUG_OPERAND("Parent", CommonDebugInfoDebugTypeComposite, 6); + debug_inst = _.FindDef(inst->word(6)); + composite_type = + OpenCLDebugInfo100DebugCompositeType(debug_inst->word(6)); + if (composite_type != OpenCLDebugInfo100Class && + composite_type != OpenCLDebugInfo100Structure) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Parent must be class or struct debug " + "type"; + } + CHECK_OPERAND("Offset", spv::Op::OpConstant, 7); + CHECK_OPERAND("Size", spv::Op::OpConstant, 8); + CHECK_CONST_UINT_OPERAND("Flags", 9); + break; + } + case CommonDebugInfoDebugFunction: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + CHECK_DEBUG_OPERAND("Type", CommonDebugInfoDebugTypeFunction, 6); + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Line", 8); + CHECK_CONST_UINT_OPERAND("Column", 9); + auto validate_parent = + ValidateOperandLexicalScope(_, "Parent", inst, 10); + if (validate_parent != SPV_SUCCESS) return validate_parent; + CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); + CHECK_CONST_UINT_OPERAND("Flags", 12); + CHECK_CONST_UINT_OPERAND("Scope Line", 13); + // NonSemantic.Shader.DebugInfo.100 doesn't include a reference to the + // OpFunction + if (vulkanDebugInfo) { + if (num_words == 15) { + CHECK_DEBUG_OPERAND("Declaration", + CommonDebugInfoDebugFunctionDeclaration, 14); + } + } else { + if (!DoesDebugInfoOperandMatchExpectation( + _, + [](CommonDebugInfoInstructions dbg_inst) { + return dbg_inst == CommonDebugInfoDebugInfoNone; + }, + inst, 14)) { + CHECK_OPERAND("Function", spv::Op::OpFunction, 14); + } + if (num_words == 16) { + CHECK_DEBUG_OPERAND("Declaration", + CommonDebugInfoDebugFunctionDeclaration, 15); + } + } + break; + } + case CommonDebugInfoDebugFunctionDeclaration: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + CHECK_DEBUG_OPERAND("Type", CommonDebugInfoDebugTypeFunction, 6); + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Line", 8); + CHECK_CONST_UINT_OPERAND("Column", 9); + auto validate_parent = + ValidateOperandLexicalScope(_, "Parent", inst, 10); + if (validate_parent != SPV_SUCCESS) return validate_parent; + CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); + CHECK_CONST_UINT_OPERAND("Flags", 12); + break; + } + case CommonDebugInfoDebugLexicalBlock: { + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 5); + CHECK_CONST_UINT_OPERAND("Line", 6); + CHECK_CONST_UINT_OPERAND("Column", 7); + auto validate_parent = + ValidateOperandLexicalScope(_, "Parent", inst, 8); + if (validate_parent != SPV_SUCCESS) return validate_parent; + if (num_words == 10) CHECK_OPERAND("Name", spv::Op::OpString, 9); + break; + } + case CommonDebugInfoDebugScope: { + auto validate_scope = ValidateOperandLexicalScope(_, "Scope", inst, 5); + if (validate_scope != SPV_SUCCESS) return validate_scope; + if (num_words == 7) { + CHECK_DEBUG_OPERAND("Inlined At", CommonDebugInfoDebugInlinedAt, 6); + } + break; + } + case CommonDebugInfoDebugLocalVariable: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + // TODO: We need a spec discussion that we have to allow local + // variable types to have template parameter. + auto validate_type = ValidateOperandDebugType(_, "Type", inst, 6, true); + if (validate_type != SPV_SUCCESS) return validate_type; + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Line", 8); + CHECK_CONST_UINT_OPERAND("Column", 9); + auto validate_parent = + ValidateOperandLexicalScope(_, "Parent", inst, 10); + if (validate_parent != SPV_SUCCESS) return validate_parent; + CHECK_CONST_UINT_OPERAND("Flags", 11); + if (num_words == 13) { + CHECK_CONST_UINT_OPERAND("ArgNumber", 12); + } + break; + } + case CommonDebugInfoDebugDeclare: { + CHECK_DEBUG_OPERAND("Local Variable", CommonDebugInfoDebugLocalVariable, + 5); + auto* operand = _.FindDef(inst->word(6)); + if (operand->opcode() != spv::Op::OpVariable && + operand->opcode() != spv::Op::OpFunctionParameter) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Variable must be a result id of " + "OpVariable or OpFunctionParameter"; + } - return ValidateClspvReflectionInstruction(_, inst, version); + CHECK_DEBUG_OPERAND("Expression", CommonDebugInfoDebugExpression, 7); + break; + } + case CommonDebugInfoDebugExpression: { + for (uint32_t word_index = 5; word_index < num_words; ++word_index) { + CHECK_DEBUG_OPERAND("Operation", CommonDebugInfoDebugOperation, + word_index); + } + break; + } + case CommonDebugInfoDebugTypeTemplate: { + if (!DoesDebugInfoOperandMatchExpectation( + _, + [](CommonDebugInfoInstructions dbg_inst) { + return dbg_inst == CommonDebugInfoDebugTypeComposite || + dbg_inst == CommonDebugInfoDebugFunction; + }, + inst, 5)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Target must be DebugTypeComposite " + << "or DebugFunction"; + } + for (uint32_t word_index = 6; word_index < num_words; ++word_index) { + if (!DoesDebugInfoOperandMatchExpectation( + _, + [](CommonDebugInfoInstructions dbg_inst) { + return dbg_inst == + CommonDebugInfoDebugTypeTemplateParameter || + dbg_inst == + CommonDebugInfoDebugTypeTemplateTemplateParameter; + }, + inst, word_index)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Parameters must be " + << "DebugTypeTemplateParameter or " + << "DebugTypeTemplateTemplateParameter"; + } + } + break; + } + case CommonDebugInfoDebugTypeTemplateParameter: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + auto validate_actual_type = + ValidateOperandDebugType(_, "Actual Type", inst, 6, false); + if (validate_actual_type != SPV_SUCCESS) return validate_actual_type; + if (!DoesDebugInfoOperandMatchExpectation( + _, + [](CommonDebugInfoInstructions dbg_inst) { + return dbg_inst == CommonDebugInfoDebugInfoNone; + }, + inst, 7)) { + CHECK_OPERAND("Value", spv::Op::OpConstant, 7); + } + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 8); + CHECK_CONST_UINT_OPERAND("Line", 9); + CHECK_CONST_UINT_OPERAND("Column", 10); + break; + } + case CommonDebugInfoDebugGlobalVariable: { + CHECK_OPERAND("Name", spv::Op::OpString, 5); + auto validate_type = + ValidateOperandDebugType(_, "Type", inst, 6, false); + if (validate_type != SPV_SUCCESS) return validate_type; + CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); + CHECK_CONST_UINT_OPERAND("Line", 8); + CHECK_CONST_UINT_OPERAND("Column", 9); + auto validate_scope = ValidateOperandLexicalScope(_, "Scope", inst, 10); + if (validate_scope != SPV_SUCCESS) return validate_scope; + CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); + if (!DoesDebugInfoOperandMatchExpectation( + _, + [](CommonDebugInfoInstructions dbg_inst) { + return dbg_inst == CommonDebugInfoDebugInfoNone; + }, + inst, 12)) { + auto* operand = _.FindDef(inst->word(12)); + std::initializer_list allowed_opcodes = { + spv::Op::OpVariable, + spv::Op::OpConstantTrue, + spv::Op::OpConstantFalse, + spv::Op::OpConstant, + spv::Op::OpConstantComposite, + spv::Op::OpConstantSampler, + spv::Op::OpConstantNull, + spv::Op::OpSpecConstantTrue, + spv::Op::OpSpecConstantFalse, + spv::Op::OpSpecConstant, + spv::Op::OpSpecConstantComposite, + spv::Op::OpSpecConstantOp}; + if (std::find(allowed_opcodes.begin(), allowed_opcodes.end(), + operand->opcode()) == allowed_opcodes.end()) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) << ": " + << "expected operand Variable must be a result id of " + "OpVariable, OpConstant variant, OpSpecConstant variant " + "or DebugInfoNone"; + } + } + if (num_words == 15) { + CHECK_DEBUG_OPERAND("Static Member Declaration", + CommonDebugInfoDebugTypeMember, 14); + } + break; + } + case CommonDebugInfoDebugInlinedAt: { + CHECK_CONST_UINT_OPERAND("Line", 5); + auto validate_scope = ValidateOperandLexicalScope(_, "Scope", inst, 6); + if (validate_scope != SPV_SUCCESS) return validate_scope; + if (num_words == 8) { + CHECK_DEBUG_OPERAND("Inlined", CommonDebugInfoDebugInlinedAt, 7); + } + break; + } + case CommonDebugInfoDebugValue: { + CHECK_DEBUG_OPERAND("Local Variable", CommonDebugInfoDebugLocalVariable, + 5); + CHECK_DEBUG_OPERAND("Expression", CommonDebugInfoDebugExpression, 7); + + for (uint32_t word_index = 8; word_index < num_words; ++word_index) { + // TODO: The following code simply checks if it is a const int + // scalar or a DebugLocalVariable or DebugGlobalVariable, but we + // have to check it using the same validation for Indexes of + // OpAccessChain. + if (!IsConstWithIntScalarType(_, inst, word_index) && + !IsDebugVariableWithIntScalarType(_, inst, word_index)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << GetExtInstName(_, inst) + << ": expected operand Indexes is " + << "OpConstant, DebugGlobalVariable, or " + << "type is OpConstant with an integer scalar type"; + } + } + break; + } + + // TODO: Add validation rules for remaining cases as well. + case CommonDebugInfoDebugTypePtrToMember: + case CommonDebugInfoDebugTypeTemplateTemplateParameter: + case CommonDebugInfoDebugTypeTemplateParameterPack: + case CommonDebugInfoDebugLexicalBlockDiscriminator: + case CommonDebugInfoDebugInlinedVariable: + case CommonDebugInfoDebugMacroDef: + case CommonDebugInfoDebugMacroUndef: + case CommonDebugInfoDebugImportedEntity: + break; + case CommonDebugInfoInstructionsMax: + assert(0); + break; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateExtInstNonsemanticClspvReflection( + ValidationState_t& _, const Instruction* inst) { + auto import_inst = _.FindDef(inst->GetOperandAs(2)); + const std::string name = import_inst->GetOperandAs(1); + const std::string reflection = "NonSemantic.ClspvReflection."; + char* end_ptr; + auto version_string = name.substr(reflection.size()); + if (version_string.empty()) { + return _.diag(SPV_ERROR_INVALID_DATA, import_inst) + << "Missing NonSemantic.ClspvReflection import version"; + } + uint32_t version = + static_cast(std::strtoul(version_string.c_str(), &end_ptr, 10)); + if (end_ptr && *end_ptr != '\0') { + return _.diag(SPV_ERROR_INVALID_DATA, import_inst) + << "NonSemantic.ClspvReflection import does not encode the " + "version correctly"; + } + if (version == 0 || version > NonSemanticClspvReflectionRevision) { + return _.diag(SPV_ERROR_INVALID_DATA, import_inst) + << "Unknown NonSemantic.ClspvReflection import version"; + } + + return ValidateClspvReflectionInstruction(_, inst, version); +} + +spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { + const spv_ext_inst_type_t ext_inst_type = + spv_ext_inst_type_t(inst->ext_inst_type()); + + if (ext_inst_type == SPV_EXT_INST_TYPE_GLSL_STD_450) { + return ValidateExtInstGlslStd450(_, inst); + } else if (ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_STD) { + return ValidateExtInstOpenClStd(_, inst); + } else if (ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100 || + ext_inst_type == + SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100) { + return ValidateExtInstDebugInfo100(_, inst); + } else if (ext_inst_type == SPV_EXT_INST_TYPE_NONSEMANTIC_CLSPVREFLECTION) { + return ValidateExtInstNonsemanticClspvReflection(_, inst); } return SPV_SUCCESS; diff --git a/third_party/spirv-tools/source/val/validate_function.cpp b/third_party/spirv-tools/source/val/validate_function.cpp index b08c5b4da9..1a6437bab3 100644 --- a/third_party/spirv-tools/source/val/validate_function.cpp +++ b/third_party/spirv-tools/source/val/validate_function.cpp @@ -89,7 +89,10 @@ spv_result_t ValidateFunction(ValidationState_t& _, const Instruction* inst) { spv::Op::OpName, spv::Op::OpCooperativeMatrixPerElementOpNV, spv::Op::OpCooperativeMatrixReduceNV, - spv::Op::OpCooperativeMatrixLoadTensorNV}; + spv::Op::OpCooperativeMatrixLoadTensorNV, + spv::Op::OpConditionalEntryPointINTEL, + }; + for (auto& pair : inst->uses()) { const auto* use = pair.first; if (std::find(acceptable.begin(), acceptable.end(), use->opcode()) == @@ -109,11 +112,6 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _, // NOTE: Find OpFunction & ensure OpFunctionParameter is not out of place. size_t param_index = 0; size_t inst_num = inst->LineNum() - 1; - if (inst_num == 0) { - return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) - << "Function parameter cannot be the first instruction."; - } - auto func_inst = &_.ordered_instructions()[inst_num]; while (--inst_num) { func_inst = &_.ordered_instructions()[inst_num]; @@ -172,6 +170,34 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _, << "s type does not match Function " << _.getIdName(return_type->id()) << "s return type."; } + if (!_.options()->relax_logical_pointer && + (_.addressing_model() == spv::AddressingModel::Logical || + _.addressing_model() == spv::AddressingModel::PhysicalStorageBuffer64)) { + if (return_type->opcode() == spv::Op::OpTypePointer || + return_type->opcode() == spv::Op::OpTypeUntypedPointerKHR) { + const auto sc = return_type->GetOperandAs(1); + if (sc != spv::StorageClass::PhysicalStorageBuffer) { + if (!_.HasCapability(spv::Capability::VariablePointersStorageBuffer) && + sc == spv::StorageClass::StorageBuffer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "In Logical addressing, functions may only return a " + "storage buffer pointer if the " + "VariablePointersStorageBuffer capability is declared"; + } else if (!_.HasCapability(spv::Capability::VariablePointers) && + sc == spv::StorageClass::Workgroup) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "In Logical addressing, functions may only return a " + "workgroup pointer if the VariablePointers capability is " + "declared"; + } else if (sc != spv::StorageClass::StorageBuffer && + sc != spv::StorageClass::Workgroup) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "In Logical addressing, functions may not return a pointer " + "in this storage class"; + } + } + } + } const auto function_type_id = function->GetOperandAs(3); const auto function_type = _.FindDef(function_type_id); @@ -218,51 +244,59 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _, } } - if (_.addressing_model() == spv::AddressingModel::Logical) { + if (_.addressing_model() == spv::AddressingModel::Logical || + _.addressing_model() == spv::AddressingModel::PhysicalStorageBuffer64) { if ((parameter_type->opcode() == spv::Op::OpTypePointer || parameter_type->opcode() == spv::Op::OpTypeUntypedPointerKHR) && !_.options()->relax_logical_pointer) { spv::StorageClass sc = parameter_type->GetOperandAs(1u); - // Validate which storage classes can be pointer operands. - switch (sc) { - case spv::StorageClass::UniformConstant: - case spv::StorageClass::Function: - case spv::StorageClass::Private: - case spv::StorageClass::Workgroup: - case spv::StorageClass::AtomicCounter: - // These are always allowed. - break; - case spv::StorageClass::StorageBuffer: - if (!_.features().variable_pointers) { + if (sc != spv::StorageClass::PhysicalStorageBuffer) { + // Validate which storage classes can be pointer operands. + switch (sc) { + case spv::StorageClass::UniformConstant: + case spv::StorageClass::Function: + case spv::StorageClass::Private: + case spv::StorageClass::Workgroup: + case spv::StorageClass::AtomicCounter: + // SPV_EXT_tile_image + case spv::StorageClass::TileImageEXT: + // SPV_KHR_ray_tracing + case spv::StorageClass::ShaderRecordBufferKHR: + // These are always allowed. + break; + case spv::StorageClass::StorageBuffer: + if (!_.features().variable_pointers) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "StorageBuffer pointer operand " + << _.getIdName(argument_id) + << " requires a variable pointers capability"; + } + break; + default: return _.diag(SPV_ERROR_INVALID_ID, inst) - << "StorageBuffer pointer operand " - << _.getIdName(argument_id) - << " requires a variable pointers capability"; - } - break; - default: - return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Invalid storage class for pointer operand " - << _.getIdName(argument_id); - } + << "Invalid storage class for pointer operand " + << _.getIdName(argument_id); + } - // Validate memory object declaration requirements. - if (argument->opcode() != spv::Op::OpVariable && - argument->opcode() != spv::Op::OpUntypedVariableKHR && - argument->opcode() != spv::Op::OpFunctionParameter) { - const bool ssbo_vptr = - _.HasCapability(spv::Capability::VariablePointersStorageBuffer) && - sc == spv::StorageClass::StorageBuffer; - const bool wg_vptr = - _.HasCapability(spv::Capability::VariablePointers) && - sc == spv::StorageClass::Workgroup; - const bool uc_ptr = sc == spv::StorageClass::UniformConstant; - if (!_.options()->before_hlsl_legalization && !ssbo_vptr && - !wg_vptr && !uc_ptr) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Pointer operand " << _.getIdName(argument_id) - << " must be a memory object declaration"; + // Validate memory object declaration requirements. + if (argument->opcode() != spv::Op::OpVariable && + argument->opcode() != spv::Op::OpUntypedVariableKHR && + argument->opcode() != spv::Op::OpFunctionParameter) { + const bool ssbo_vptr = + _.HasCapability( + spv::Capability::VariablePointersStorageBuffer) && + sc == spv::StorageClass::StorageBuffer; + const bool wg_vptr = + _.HasCapability(spv::Capability::VariablePointers) && + sc == spv::StorageClass::Workgroup; + const bool uc_ptr = sc == spv::StorageClass::UniformConstant; + if (!_.options()->before_hlsl_legalization && !ssbo_vptr && + !wg_vptr && !uc_ptr) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Pointer operand " << _.getIdName(argument_id) + << " must be a memory object declaration"; + } } } } @@ -321,14 +355,14 @@ spv_result_t ValidateCooperativeMatrixPerElementOp(ValidationState_t& _, const auto param0_id = function_type->GetOperandAs(2); const auto param1_id = function_type->GetOperandAs(3); const auto param2_id = function_type->GetOperandAs(4); - if (!_.IsIntScalarType(param0_id) || _.GetBitWidth(param0_id) != 32) { + if (!_.IsIntScalarType(param0_id, 32)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpCooperativeMatrixPerElementOpNV function type first parameter " "type " << _.getIdName(param0_id) << " must be a 32-bit integer."; } - if (!_.IsIntScalarType(param1_id) || _.GetBitWidth(param1_id) != 32) { + if (!_.IsIntScalarType(param1_id, 32)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpCooperativeMatrixPerElementOpNV function type second " "parameter type " diff --git a/third_party/spirv-tools/source/val/validate_graph.cpp b/third_party/spirv-tools/source/val/validate_graph.cpp new file mode 100644 index 0000000000..09d53ead92 --- /dev/null +++ b/third_party/spirv-tools/source/val/validate_graph.cpp @@ -0,0 +1,547 @@ +// Copyright (c) 2023-2025 Arm Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Validates correctness of graph instructions. + +#include + +#include "source/opcode.h" +#include "source/val/validate.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +bool IsTensorArray(ValidationState_t& _, uint32_t id) { + auto def = _.FindDef(id); + if (!def || (def->opcode() != spv::Op::OpTypeArray && + def->opcode() != spv::Op::OpTypeRuntimeArray)) { + return false; + } + auto tdef = _.FindDef(def->word(2)); + if (!tdef || tdef->opcode() != spv::Op::OpTypeTensorARM) { + return false; + } + return true; +} + +bool IsGraphInterfaceType(ValidationState_t& _, uint32_t id) { + return _.IsTensorType(id) || IsTensorArray(_, id); +} + +bool IsGraph(ValidationState_t& _, uint32_t id) { + auto def = _.FindDef(id); + if (!def || def->opcode() != spv::Op::OpGraphARM) { + return false; + } + return true; +} + +bool IsGraphType(ValidationState_t& _, uint32_t id) { + auto def = _.FindDef(id); + if (!def || def->opcode() != spv::Op::OpTypeGraphARM) { + return false; + } + return true; +} + +const uint32_t kGraphTypeIOStartWord = 3; + +uint32_t GraphTypeInstNumIO(const Instruction* inst) { + return static_cast(inst->words().size()) - kGraphTypeIOStartWord; +} + +uint32_t GraphTypeInstNumInputs(const Instruction* inst) { + return inst->word(2); +} + +uint32_t GraphTypeInstNumOutputs(const Instruction* inst) { + return GraphTypeInstNumIO(inst) - GraphTypeInstNumInputs(inst); +} + +uint32_t GraphTypeInstGetOutputAtIndex(const Instruction* inst, + uint64_t index) { + return inst->word(kGraphTypeIOStartWord + GraphTypeInstNumInputs(inst) + + static_cast(index)); +} + +uint32_t GraphTypeInstGetInputAtIndex(const Instruction* inst, uint64_t index) { + return inst->word(kGraphTypeIOStartWord + static_cast(index)); +} + +spv_result_t ValidateGraphType(ValidationState_t& _, const Instruction* inst) { + // Check there are at least NumInputs types + uint32_t NumInputs = GraphTypeInstNumInputs(inst); + size_t NumIOTypes = GraphTypeInstNumIO(inst); + if (NumIOTypes < NumInputs) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << NumIOTypes << " I/O types were provided but the graph has " + << NumInputs << " inputs."; + } + + // Check there is at least one output + if (NumIOTypes == NumInputs) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "A graph type must have at least one output."; + } + + // Check all I/O types are graph interface type + for (unsigned i = kGraphTypeIOStartWord; i < inst->words().size(); i++) { + auto tid = inst->word(i); + if (!IsGraphInterfaceType(_, tid)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "I/O type " << _.getIdName(tid) + << " is not a Graph Interface Type."; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGraphConstant(ValidationState_t& _, + const Instruction* inst) { + // Check Result Type + if (!_.IsTensorType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) + << " must have a Result Type that is a tensor type."; + } + + // Check the instruction is not preceded by another OpGraphConstantARM with + // the same ID + const uint32_t cst_id = inst->word(3); + size_t inst_num = inst->LineNum() - 1; + while (--inst_num) { + auto prev_inst = &_.ordered_instructions()[inst_num]; + if (prev_inst->opcode() == spv::Op::OpGraphConstantARM) { + const uint32_t prev_cst_id = prev_inst->word(3); + if (prev_cst_id == cst_id) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "No two OpGraphConstantARM instructions may have the same " + "GraphConstantID"; + } + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateGraphEntryPoint(ValidationState_t& _, + const Instruction* inst) { + // Graph must be an OpGraphARM + uint32_t graph = inst->GetOperandAs(0); + auto graph_inst = _.FindDef(graph); + if (!IsGraph(_, graph)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) + << " Graph must be a OpGraphARM but found " + << spvOpcodeString(graph_inst->opcode()) << "."; + } + + // Check number of Interface IDs matches number of I/Os of graph + auto graph_type_inst = _.FindDef(graph_inst->type_id()); + size_t graph_type_num_io = GraphTypeInstNumIO(graph_type_inst); + size_t graph_entry_point_num_interface_id = inst->operands().size() - 2; + if (graph_type_inst->opcode() != spv::Op::OpTypeGraphARM) { + // This is invalid but we want ValidateGraph to report a clear error + // so stop validating the graph entry point instruction + return SPV_SUCCESS; + } + if (graph_type_num_io != graph_entry_point_num_interface_id) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) << " Interface list contains " + << graph_entry_point_num_interface_id << " IDs but Graph's type " + << _.getIdName(graph_inst->type_id()) << " has " << graph_type_num_io + << " inputs and outputs."; + } + + // Check Interface IDs + for (uint32_t i = 2; i < inst->operands().size(); i++) { + uint32_t interface_id = inst->GetOperandAs(i); + auto interface_inst = _.FindDef(interface_id); + + // Check interface IDs come from OpVariable + if ((interface_inst->opcode() != spv::Op::OpVariable) || + (interface_inst->GetOperandAs(2) != + spv::StorageClass::UniformConstant)) { + return _.diag(SPV_ERROR_INVALID_DATA, interface_inst) + << spvOpcodeString(inst->opcode()) << " Interface ID " + << _.getIdName(interface_id) + << " must come from OpVariable with UniformConstant Storage " + "Class."; + } + + // Check type of interface variable matches type of the corresponding graph + // I/O + uint32_t corresponding_graph_io_type = + graph_type_inst->GetOperandAs(i); + + uint32_t interface_ptr_type = interface_inst->type_id(); + auto interface_ptr_inst = _.FindDef(interface_ptr_type); + auto interface_pointee_type = interface_ptr_inst->GetOperandAs(2); + if (interface_pointee_type != corresponding_graph_io_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) << " Interface ID type " + << _.getIdName(interface_pointee_type) + << " must match the type of the corresponding graph I/O " + << _.getIdName(corresponding_graph_io_type); + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGraph(ValidationState_t& _, const Instruction* inst) { + // Result Type must be an OpTypeGraphARM + if (!IsGraphType(_, inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) + << " Result Type must be an OpTypeGraphARM."; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGraphInput(ValidationState_t& _, const Instruction* inst) { + // Check type of InputIndex + auto input_index_inst = _.FindDef(inst->GetOperandAs(2)); + if (!input_index_inst || + !_.IsIntScalarType(input_index_inst->type_id(), 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) + << " InputIndex must be a 32-bit integer."; + } + + bool has_element_index = inst->operands().size() > 3; + + // Check type of ElementIndex + if (has_element_index) { + auto element_index_inst = _.FindDef(inst->GetOperandAs(3)); + if (!element_index_inst || + !_.IsIntScalarType(element_index_inst->type_id(), 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) + << " ElementIndex must be a 32-bit integer."; + } + } + + // Find graph definition + size_t inst_num = inst->LineNum() - 1; + auto graph_inst = &_.ordered_instructions()[inst_num]; + while (--inst_num) { + graph_inst = &_.ordered_instructions()[inst_num]; + if (graph_inst->opcode() == spv::Op::OpGraphARM) { + break; + } + } + + // Can the InputIndex be evaluated? + // If not, there's nothing more we can validate here. + uint64_t input_index; + if (!_.EvalConstantValUint64(inst->GetOperandAs(2), &input_index)) { + return SPV_SUCCESS; + } + + auto const graph_type_inst = _.FindDef(graph_inst->type_id()); + size_t graph_type_num_inputs = graph_type_inst->GetOperandAs(1); + + // Check InputIndex is in range + if (input_index >= graph_type_num_inputs) { + std::string disassembly = _.Disassemble(*inst); + return _.diag(SPV_ERROR_INVALID_DATA, nullptr) + << "Type " << _.getIdName(graph_type_inst->id()) << " for graph " + << _.getIdName(graph_inst->id()) << " has " << graph_type_num_inputs + << " inputs but found an OpGraphInputARM instruction with an " + "InputIndex that is " + << input_index << ": " << disassembly; + } + + uint32_t graph_type_input_type = + GraphTypeInstGetInputAtIndex(graph_type_inst, input_index); + + if (has_element_index) { + // Check ElementIndex is allowed + if (!IsTensorArray(_, graph_type_input_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "OpGraphInputARM ElementIndex not allowed when the graph input " + "selected by " + << "InputIndex is not an OpTypeArray or OpTypeRuntimeArray"; + } + + // Check ElementIndex is in range if it can be evaluated and the input is a + // fixed-sized array whose Length can be evaluated + uint64_t element_index; + if (_.IsArrayType(graph_type_input_type) && + _.EvalConstantValUint64(inst->GetOperandAs(3), + &element_index)) { + uint64_t array_length; + auto graph_type_input_type_inst = _.FindDef(graph_type_input_type); + if (_.EvalConstantValUint64( + graph_type_input_type_inst->GetOperandAs(2), + &array_length)) { + if (element_index >= array_length) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "OpGraphInputARM ElementIndex out of range. The type of " + "the graph input being accessed " + << _.getIdName(graph_type_input_type) << " is an array of " + << array_length << " elements but " << "ElementIndex is " + << element_index; + } + } + } + } + + // Check result type matches with graph type + if (has_element_index) { + uint32_t expected_type = _.GetComponentType(graph_type_input_type); + if (inst->type_id() != expected_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result Type " << _.getIdName(inst->type_id()) + << " of graph input instruction " << _.getIdName(inst->id()) + << " does not match the component type " + << _.getIdName(expected_type) << " of input " << input_index + << " in the graph type."; + } + } else { + if (inst->type_id() != graph_type_input_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result Type " << _.getIdName(inst->type_id()) + << " of graph input instruction " << _.getIdName(inst->id()) + << " does not match the type " + << _.getIdName(graph_type_input_type) << " of input " + << input_index << " in the graph type."; + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateGraphSetOutput(ValidationState_t& _, + const Instruction* inst) { + // Check type of OutputIndex + auto output_index_inst = _.FindDef(inst->GetOperandAs(1)); + if (!output_index_inst || + !_.IsIntScalarType(output_index_inst->type_id(), 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) + << " OutputIndex must be a 32-bit integer."; + } + + bool has_element_index = inst->operands().size() > 2; + + // Check type of ElementIndex + if (has_element_index) { + auto element_index_inst = _.FindDef(inst->GetOperandAs(2)); + if (!element_index_inst || + !_.IsIntScalarType(element_index_inst->type_id(), 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) + << " ElementIndex must be a 32-bit integer."; + } + } + + // Find graph definition + size_t inst_num = inst->LineNum() - 1; + auto graph_inst = &_.ordered_instructions()[inst_num]; + while (--inst_num) { + graph_inst = &_.ordered_instructions()[inst_num]; + if (graph_inst->opcode() == spv::Op::OpGraphARM) { + break; + } + } + + // Can the OutputIndex be evaluated? + // If not, there's nothing more we can validate here. + uint64_t output_index; + if (!_.EvalConstantValUint64(inst->GetOperandAs(1), + &output_index)) { + return SPV_SUCCESS; + } + + // Check that the OutputIndex is valid with respect to the graph type + auto graph_type_inst = _.FindDef(graph_inst->type_id()); + size_t graph_type_num_outputs = GraphTypeInstNumOutputs(graph_type_inst); + + if (output_index >= graph_type_num_outputs) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(inst->opcode()) << " setting OutputIndex " + << output_index << " but graph only has " << graph_type_num_outputs + << " outputs."; + } + + uint32_t graph_type_output_type = + GraphTypeInstGetOutputAtIndex(graph_type_inst, output_index); + + if (has_element_index) { + // Check ElementIndex is allowed + if (!IsTensorArray(_, graph_type_output_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "OpGraphSetOutputARM ElementIndex not allowed when the graph " + "output selected by " + << "OutputIndex is not an OpTypeArray or OpTypeRuntimeArray"; + } + + // Check ElementIndex is in range if it can be evaluated and the output is a + // fixed-sized array whose Length can be evaluated + uint64_t element_index; + if (_.IsArrayType(graph_type_output_type) && + _.EvalConstantValUint64(inst->GetOperandAs(2), + &element_index)) { + uint64_t array_length; + auto graph_type_output_type_inst = _.FindDef(graph_type_output_type); + if (_.EvalConstantValUint64( + graph_type_output_type_inst->GetOperandAs(2), + &array_length)) { + if (element_index >= array_length) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "OpGraphSetOutputARM ElementIndex out of range. The type " + "of the graph output being accessed " + << _.getIdName(graph_type_output_type) << " is an array of " + << array_length << " elements but " << "ElementIndex is " + << element_index; + } + } + } + } + + // Check Value's type matches with graph type + uint32_t value = inst->GetOperandAs(0); + uint32_t value_type = _.FindDef(value)->type_id(); + if (has_element_index) { + uint32_t expected_type = _.GetComponentType(graph_type_output_type); + if (value_type != expected_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The type " << _.getIdName(value_type) + << " of Value provided to the graph output instruction " + << _.getIdName(value) << " does not match the component type " + << _.getIdName(expected_type) << " of output " << output_index + << " in the graph type."; + } + } else { + if (value_type != graph_type_output_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The type " << _.getIdName(value_type) + << " of Value provided to the graph output instruction " + << _.getIdName(value) << " does not match the type " + << _.getIdName(graph_type_output_type) << " of output " + << output_index << " in the graph type."; + } + } + return SPV_SUCCESS; +} + +bool InputOutputInstructionsHaveDuplicateIndices( + ValidationState_t& _, std::deque& inout_insts, + const Instruction** first_dup) { + std::set> inout_element_indices; + for (auto const inst : inout_insts) { + const bool is_input = inst->opcode() == spv::Op::OpGraphInputARM; + bool has_element_index = inst->operands().size() > (is_input ? 3 : 2); + uint64_t inout_index; + if (!_.EvalConstantValUint64(inst->GetOperandAs(is_input ? 2 : 1), + &inout_index)) { + continue; + } + uint64_t element_index = -1; // -1 means no ElementIndex + if (has_element_index) { + if (!_.EvalConstantValUint64( + inst->GetOperandAs(is_input ? 3 : 2), &element_index)) { + continue; + } + } + auto inout_element_pair = std::make_pair(inout_index, element_index); + auto inout_noelement_pair = std::make_pair(inout_index, -1); + if (inout_element_indices.count(inout_element_pair) || + inout_element_indices.count(inout_noelement_pair)) { + *first_dup = inst; + return true; + } + inout_element_indices.insert(inout_element_pair); + } + return false; +} + +spv_result_t ValidateGraphEnd(ValidationState_t& _, const Instruction* inst) { + size_t end_inst_num = inst->LineNum() - 1; + + // Gather OpGraphInputARM and OpGraphSetOutputARM instructions + std::deque graph_inputs, graph_outputs; + size_t in_inst_num = end_inst_num; + auto graph_inst = &_.ordered_instructions()[in_inst_num]; + while (--in_inst_num) { + graph_inst = &_.ordered_instructions()[in_inst_num]; + if (graph_inst->opcode() == spv::Op::OpGraphInputARM) { + graph_inputs.push_front(graph_inst); + continue; + } + if (graph_inst->opcode() == spv::Op::OpGraphSetOutputARM) { + graph_outputs.push_front(graph_inst); + continue; + } + if (graph_inst->opcode() == spv::Op::OpGraphARM) { + break; + } + } + + const Instruction* first_dup; + + // Check that there are no duplicate InputIndex and ElementIndex values + if (InputOutputInstructionsHaveDuplicateIndices(_, graph_inputs, + &first_dup)) { + return _.diag(SPV_ERROR_INVALID_DATA, first_dup) + << "Two OpGraphInputARM instructions with the same InputIndex " + "must not be part of the same " + << "graph definition unless ElementIndex is present in both with " + "different values."; + } + + // Check that there are no duplicate OutputIndex and ElementIndex values + if (InputOutputInstructionsHaveDuplicateIndices(_, graph_outputs, + &first_dup)) { + return _.diag(SPV_ERROR_INVALID_DATA, first_dup) + << "Two OpGraphSetOutputARM instructions with the same " + "OutputIndex must not be part of the same " + << "graph definition unless ElementIndex is present in both with " + "different values."; + } + + return SPV_SUCCESS; +} + +} // namespace + +// Validates correctness of graph instructions. +spv_result_t GraphPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case spv::Op::OpTypeGraphARM: + return ValidateGraphType(_, inst); + case spv::Op::OpGraphConstantARM: + return ValidateGraphConstant(_, inst); + case spv::Op::OpGraphEntryPointARM: + return ValidateGraphEntryPoint(_, inst); + case spv::Op::OpGraphARM: + return ValidateGraph(_, inst); + case spv::Op::OpGraphInputARM: + return ValidateGraphInput(_, inst); + case spv::Op::OpGraphSetOutputARM: + return ValidateGraphSetOutput(_, inst); + case spv::Op::OpGraphEndARM: + return ValidateGraphEnd(_, inst); + default: + break; + } + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_id.cpp b/third_party/spirv-tools/source/val/validate_id.cpp index 23d706c03b..98e81a37d2 100644 --- a/third_party/spirv-tools/source/val/validate_id.cpp +++ b/third_party/spirv-tools/source/val/validate_id.cpp @@ -122,6 +122,10 @@ bool InstructionCanHaveTypeOperand(const Instruction* inst) { spv::Op::OpCooperativeMatrixLengthKHR, spv::Op::OpUntypedArrayLengthKHR, spv::Op::OpFunction, + spv::Op::OpAsmINTEL, + spv::Op::OpConstantSizeOfEXT, + spv::Op::OpBufferPointerEXT, + spv::Op::OpUntypedImageTexelPointerEXT, }; const auto opcode = inst->opcode(); bool type_instruction = spvOpcodeGeneratesType(opcode); @@ -149,6 +153,7 @@ bool InstructionRequiresTypeOperand(const Instruction* inst) { spv::Op::OpCooperativeMatrixLengthKHR, spv::Op::OpPhi, spv::Op::OpUntypedArrayLengthKHR, + spv::Op::OpAsmINTEL, }; const auto opcode = inst->opcode(); bool debug_instruction = spvOpcodeIsDebug(opcode) || inst->IsDebugInfo(); diff --git a/third_party/spirv-tools/source/val/validate_image.cpp b/third_party/spirv-tools/source/val/validate_image.cpp index 58f22f2ab6..d3ce76f7d8 100644 --- a/third_party/spirv-tools/source/val/validate_image.cpp +++ b/third_party/spirv-tools/source/val/validate_image.cpp @@ -237,6 +237,23 @@ uint32_t GetMinCoordSize(spv::Op opcode, const ImageTypeInfo& info) { return 3; } + if (opcode == spv::Op::OpImageQueryLod) { + return GetPlaneCoordSize(info); + } + + if (opcode == spv::Op::OpImageTexelPointer) { + if (info.arrayed == 0) { + return GetPlaneCoordSize(info); + } else if (info.dim == spv::Dim::Dim1D) { + return 2; + } else if (info.dim == spv::Dim::Cube || info.dim == spv::Dim::Dim2D) { + return 3; + } else { + assert(false); + return 0; // caught elsewhere + } + } + return GetPlaneCoordSize(info) + info.arrayed + (IsProj(opcode) ? 1 : 0); } @@ -314,10 +331,10 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, << "Image Operand Bias can only be used with ImplicitLod opcodes"; } - const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); - if (!_.IsFloatScalarType(type_id)) { + const uint32_t bias_type_id = _.GetTypeId(inst->word(word_index++)); + if (!_.IsFloatScalarType(bias_type_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image Operand Bias to be float scalar"; + << "Expected Image Operand Bias to be a 32-bit float scalar"; } if (info.dim != spv::Dim::Dim1D && info.dim != spv::Dim::Dim2D && @@ -327,7 +344,10 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, "or Cube"; } - // Multisampled is already checked. + // - |Sample| operand is required to have MS != 0 + // - |Sample| is only allowed with [Fetch, Write, or Read] + // - |Bias| can only be used with |ImplicitLod| opcodes + // Multisampled is already checked in all cases } if (mask & uint32_t(spv::ImageOperandsMask::Lod)) { @@ -345,17 +365,19 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, "time"; } - const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); + const uint32_t lod_type_id = _.GetTypeId(inst->word(word_index++)); if (is_explicit_lod || is_valid_gather_lod_bias_amd) { - if (!_.IsFloatScalarType(type_id)) { + if (!_.IsFloatScalarType(lod_type_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image Operand Lod to be float scalar when used " + << "Expected Image Operand Lod to be a 32-bit float scalar when " + "used " << "with ExplicitLod"; } } else { - if (!_.IsIntScalarType(type_id)) { + if (!_.IsIntScalarType(lod_type_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image Operand Lod to be int scalar when used with " + << "Expected Image Operand Lod to be a 32-bit int scalar when " + "used with " << "OpImageFetch"; } } @@ -367,7 +389,10 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, "or Cube"; } - // Multisampled is already checked. + if (info.multisampled != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Lod requires 'MS' parameter to be 0"; + } } if (mask & uint32_t(spv::ImageOperandsMask::Grad)) { @@ -379,9 +404,12 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, const uint32_t dx_type_id = _.GetTypeId(inst->word(word_index++)); const uint32_t dy_type_id = _.GetTypeId(inst->word(word_index++)); if (!_.IsFloatScalarOrVectorType(dx_type_id) || - !_.IsFloatScalarOrVectorType(dy_type_id)) { + _.GetBitWidth(dx_type_id) != 32 || + !_.IsFloatScalarOrVectorType(dy_type_id) || + _.GetBitWidth(dy_type_id) != 32) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected both Image Operand Grad ids to be float scalars or " + << "Expected both Image Operand Grad ids to be 32-bit float " + "scalars or " << "vectors"; } @@ -400,7 +428,10 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, << " components, but given " << dy_size; } - // Multisampled is already checked. + // - |Sample| operand is required to have MS != 0 + // - |Sample| is only allowed with [Fetch, Write, or Read] + // - |Grad| can only be used with |ExplicitLod| opcodes + // Multisampled is already checked in all cases } if (mask & uint32_t(spv::ImageOperandsMask::ConstOffset)) { @@ -410,21 +441,23 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, "'Dim'"; } - const uint32_t id = inst->word(word_index++); - const uint32_t type_id = _.GetTypeId(id); - if (!_.IsIntScalarOrVectorType(type_id)) { + const uint32_t offset_id = inst->word(word_index++); + const uint32_t offset_type_id = _.GetTypeId(offset_id); + if (!_.IsIntScalarOrVectorType(offset_type_id) || + _.GetBitWidth(offset_type_id) != 32) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image Operand ConstOffset to be int scalar or " + << "Expected Image Operand ConstOffset to be a 32-bit int scalar " + "or " << "vector"; } - if (!spvOpcodeIsConstant(_.GetIdOpcode(id))) { + if (!spvOpcodeIsConstant(_.GetIdOpcode(offset_id))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image Operand ConstOffset to be a const object"; } const uint32_t plane_size = GetPlaneCoordSize(info); - const uint32_t offset_size = _.GetDimension(type_id); + const uint32_t offset_size = _.GetDimension(offset_type_id); if (plane_size != offset_size) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image Operand ConstOffset to have " << plane_size @@ -438,16 +471,17 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, << "Image Operand Offset cannot be used with Cube Image 'Dim'"; } - const uint32_t id = inst->word(word_index++); - const uint32_t type_id = _.GetTypeId(id); - if (!_.IsIntScalarOrVectorType(type_id)) { + const uint32_t offset_id = inst->word(word_index++); + const uint32_t offset_type_id = _.GetTypeId(offset_id); + if (!_.IsIntScalarOrVectorType(offset_type_id) || + _.GetBitWidth(offset_type_id) != 32) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image Operand Offset to be int scalar or " + << "Expected Image Operand Offset to be a 32-bit int scalar or " << "vector"; } const uint32_t plane_size = GetPlaneCoordSize(info); - const uint32_t offset_size = _.GetDimension(type_id); + const uint32_t offset_size = _.GetDimension(offset_type_id); if (plane_size != offset_size) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image Operand Offset to have " << plane_size @@ -487,9 +521,9 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, "'Dim'"; } - const uint32_t id = inst->word(word_index++); - const uint32_t type_id = _.GetTypeId(id); - const Instruction* type_inst = _.FindDef(type_id); + const uint32_t offset_id = inst->word(word_index++); + const uint32_t offset_type_id = _.GetTypeId(offset_id); + const Instruction* type_inst = _.FindDef(offset_type_id); assert(type_inst); if (type_inst->opcode() != spv::Op::OpTypeArray) { @@ -509,13 +543,14 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, const uint32_t component_type = type_inst->word(2); if (!_.IsIntVectorType(component_type) || - _.GetDimension(component_type) != 2) { + _.GetDimension(component_type) != 2 || + _.GetBitWidth(component_type) != 32) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image Operand ConstOffsets array components to be " - "int vectors of size 2"; + << "Expected Image Operand ConstOffsets array components to be a " + "32-bit int vectors of size 2"; } - if (!spvOpcodeIsConstant(_.GetIdOpcode(id))) { + if (!spvOpcodeIsConstant(_.GetIdOpcode(offset_id))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image Operand ConstOffsets to be a const object"; } @@ -537,10 +572,10 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, << "Image Operand Sample requires non-zero 'MS' parameter"; } - const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); - if (!_.IsIntScalarType(type_id)) { + const uint32_t sample_type_id = _.GetTypeId(inst->word(word_index++)); + if (!_.IsIntScalarType(sample_type_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image Operand Sample to be int scalar"; + << "Expected Image Operand Sample to be a 32-bit int scalar"; } } @@ -551,10 +586,10 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, << "opcodes or together with Image Operand Grad"; } - const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); - if (!_.IsFloatScalarType(type_id)) { + const uint32_t minlod_type_id = _.GetTypeId(inst->word(word_index++)); + if (!_.IsFloatScalarType(minlod_type_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image Operand MinLod to be float scalar"; + << "Expected Image Operand MinLod to be a 32-bit float scalar"; } if (info.dim != spv::Dim::Dim1D && info.dim != spv::Dim::Dim2D && @@ -782,8 +817,7 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { << "Corrupt image type definition"; } - if (_.IsIntScalarType(info.sampled_type) && - (64 == _.GetBitWidth(info.sampled_type)) && + if (_.IsIntScalarType(info.sampled_type, 64) && !_.HasCapability(spv::Capability::Int64ImageEXT)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability Int64ImageEXT is required when using Sampled Type of " @@ -792,12 +826,9 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { const auto target_env = _.context()->target_env; if (spvIsVulkanEnv(target_env)) { - if ((!_.IsFloatScalarType(info.sampled_type) && - !_.IsIntScalarType(info.sampled_type)) || - ((32 != _.GetBitWidth(info.sampled_type)) && - (64 != _.GetBitWidth(info.sampled_type))) || - ((64 == _.GetBitWidth(info.sampled_type)) && - _.IsFloatScalarType(info.sampled_type))) { + if (!_.IsFloatScalarType(info.sampled_type, 32) && + !_.IsIntScalarType(info.sampled_type, 32) && + !_.IsIntScalarType(info.sampled_type, 64)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4656) << "Expected Sampled Type to be a 32-bit int, 64-bit int or " @@ -1007,6 +1038,85 @@ bool IsAllowedSampledImageOperand(spv::Op opcode, ValidationState_t& _) { } } +spv_result_t ValidateImageCoordinate(ValidationState_t& _, + const Instruction* inst, + const ImageTypeInfo& info, + uint32_t word_index) { + const spv::Op opcode = inst->opcode(); + const uint32_t coord_type = _.GetOperandTypeId(inst, word_index); + + const bool float_only = + opcode == spv::Op::OpImageSampleImplicitLod || + opcode == spv::Op::OpImageSampleDrefImplicitLod || + opcode == spv::Op::OpImageSampleDrefExplicitLod || + opcode == spv::Op::OpImageSampleProjImplicitLod || + opcode == spv::Op::OpImageSampleProjExplicitLod || + opcode == spv::Op::OpImageSampleProjDrefImplicitLod || + opcode == spv::Op::OpImageSampleProjDrefExplicitLod || + opcode == spv::Op::OpImageGather || + opcode == spv::Op::OpImageDrefGather || + (opcode == spv::Op::OpImageQueryLod && + !_.HasCapability(spv::Capability::Kernel)) || + opcode == spv::Op::OpImageSparseSampleImplicitLod || + opcode == spv::Op::OpImageSparseSampleDrefImplicitLod || + opcode == spv::Op::OpImageSparseSampleDrefExplicitLod || + opcode == spv::Op::OpImageSparseGather || + opcode == spv::Op::OpImageSparseDrefGather; + + const bool int_only = opcode == spv::Op::OpImageFetch || + opcode == spv::Op::OpImageSparseFetch || + opcode == spv::Op::OpImageTexelPointer || + opcode == spv::Op::OpUntypedImageTexelPointerEXT; + + const bool int_or_float = opcode == spv::Op::OpImageSampleExplicitLod || + opcode == spv::Op::OpImageSparseSampleExplicitLod || + opcode == spv::Op::OpImageRead || + opcode == spv::Op::OpImageWrite || + (opcode == spv::Op::OpImageQueryLod && + _.HasCapability(spv::Capability::Kernel)) || + opcode == spv::Op::OpImageSparseRead; + + assert(float_only || int_only || int_or_float); + + if (float_only && !_.IsFloatScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be a 32-bit float scalar or vector"; + } else if (int_only && !_.IsIntScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be a 32-bit integer scalar or vector"; + } else if (int_or_float) { + if (!_.IsFloatScalarOrVectorType(coord_type) && + !_.IsIntScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be a 32-bit integer or float scalar or " + "vector"; + } + } + + // Needs to be after we validate the scalar/vector + if (_.GetBitWidth(coord_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be a 32-bit scalar or vector"; + } + + const uint32_t min_coord_size = GetMinCoordSize(opcode, info); + const uint32_t actual_coord_size = _.GetDimension(coord_type); + + if (opcode == spv::Op::OpImageTexelPointer) { + if (min_coord_size != actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have " << min_coord_size + << " components, but given " << actual_coord_size; + } + } else if (min_coord_size > actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have at least " << min_coord_size + << " components, but given only " << actual_coord_size; + } + + return SPV_SUCCESS; +} + spv_result_t ValidateSampledImage(ValidationState_t& _, const Instruction* inst) { auto type_inst = _.FindDef(inst->type_id()); @@ -1100,7 +1210,7 @@ spv_result_t ValidateSampledImage(ValidationState_t& _, << "Result from OpSampledImage instruction must not appear " "as " "operands of Op" - << spvOpcodeString(static_cast(consumer_opcode)) << "." + << spvOpcodeString(consumer_opcode) << "." << " Found result " << _.getIdName(inst->id()) << " as an operand of " << _.getIdName(consumer_instr->id()) << "."; @@ -1110,12 +1220,11 @@ spv_result_t ValidateSampledImage(ValidationState_t& _, return _.diag(SPV_ERROR_INVALID_ID, inst) << "Result from OpSampledImage instruction must not appear " "as operand for Op" - << spvOpcodeString(static_cast(consumer_opcode)) + << spvOpcodeString(consumer_opcode) << ", since it is not specified as taking an " - << "OpTypeSampledImage." - << " Found result " << _.getIdName(inst->id()) - << " as an operand of " << _.getIdName(consumer_instr->id()) - << "."; + << "OpTypeSampledImage." << " Found result " + << _.getIdName(inst->id()) << " as an operand of " + << _.getIdName(consumer_instr->id()) << "."; } } } @@ -1136,6 +1245,8 @@ spv_result_t ValidateSampledImage(ValidationState_t& _, spv_result_t ValidateImageTexelPointer(ValidationState_t& _, const Instruction* inst) { + bool isUntyped = (inst->opcode() == spv::Op::OpUntypedImageTexelPointerEXT); + const auto result_type = _.FindDef(inst->type_id()); if (result_type->opcode() != spv::Op::OpTypePointer && result_type->opcode() != spv::Op::OpTypeUntypedPointerKHR) { @@ -1166,16 +1277,23 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, } } - const auto image_ptr = _.FindDef(_.GetOperandTypeId(inst, 2)); - if (!image_ptr || image_ptr->opcode() != spv::Op::OpTypePointer) { + const auto image_ptr = + _.FindDef(_.GetOperandTypeId(inst, (isUntyped ? 3 : 2))); + if (!image_ptr || + (isUntyped && image_ptr->opcode() != spv::Op::OpTypeUntypedPointerKHR) || + (!isUntyped && image_ptr->opcode() != spv::Op::OpTypePointer)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image to be OpTypePointer"; + << "Expected Image to be " + << (isUntyped ? "OpTypeUntypedPointerKHR" : "OpTypePointer"); } - const auto image_type = image_ptr->GetOperandAs(2); + const auto image_type = isUntyped ? inst->GetOperandAs(2) + : image_ptr->GetOperandAs(2); if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image to be OpTypePointer with Type OpTypeImage"; + << "Expected Image to be " + << (isUntyped ? "OpTypeUntypedPointerKHR" : "OpTypePointer ") + << "with Type OpTypeImage"; } ImageTypeInfo info; @@ -1200,49 +1318,23 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, if (info.dim == spv::Dim::SubpassData) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Image Dim SubpassData cannot be used with OpImageTexelPointer"; + << "Image Dim SubpassData cannot be used with " + << (isUntyped ? "OpUntypedImageTexelPointerEXT" + : "OpImageTexelPointer"); } if (info.dim == spv::Dim::TileImageDataEXT) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Dim TileImageDataEXT cannot be used with " - "OpImageTexelPointer"; + << (isUntyped ? "OpUntypedImageTexelPointerEXT" + : "OpImageTexelPointer"); } - const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if (!coord_type || !_.IsIntScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be integer scalar or vector"; - } + if (spv_result_t result = ValidateImageCoordinate( + _, inst, info, /* word_index = */ (isUntyped ? 4 : 3))) + return result; - uint32_t expected_coord_size = 0; - if (info.arrayed == 0) { - expected_coord_size = GetPlaneCoordSize(info); - } else if (info.arrayed == 1) { - switch (info.dim) { - case spv::Dim::Dim1D: - expected_coord_size = 2; - break; - case spv::Dim::Cube: - case spv::Dim::Dim2D: - expected_coord_size = 3; - break; - default: - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Image 'Dim' must be one of 1D, 2D, or Cube when " - "Arrayed is 1"; - break; - } - } - - const uint32_t actual_coord_size = _.GetDimension(coord_type); - if (expected_coord_size != actual_coord_size) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to have " << expected_coord_size - << " components, but given " << actual_coord_size; - } - - const uint32_t sample_type = _.GetOperandTypeId(inst, 4); + const uint32_t sample_type = _.GetOperandTypeId(inst, (isUntyped ? 5 : 4)); if (!sample_type || !_.IsIntScalarType(sample_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Sample to be integer scalar"; @@ -1250,7 +1342,8 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, if (info.multisampled == 0) { uint64_t ms = 0; - if (!_.EvalConstantValUint64(inst->GetOperandAs(4), &ms) || + if (!_.EvalConstantValUint64( + inst->GetOperandAs(isUntyped ? 5 : 4), &ms) || ms != 0) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Sample for Image with MS 0 to be a valid for " @@ -1259,18 +1352,24 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, } if (spvIsVulkanEnv(_.context()->target_env)) { - if ((info.format != spv::ImageFormat::R64i) && - (info.format != spv::ImageFormat::R64ui) && - (info.format != spv::ImageFormat::R32f) && - (info.format != spv::ImageFormat::R32i) && - (info.format != spv::ImageFormat::R32ui) && - !((info.format == spv::ImageFormat::Rg16f || - info.format == spv::ImageFormat::Rgba16f) && - _.HasCapability(spv::Capability::AtomicFloat16VectorNV))) { + bool valid_format = info.format == spv::ImageFormat::R64i || + info.format == spv::ImageFormat::R64ui || + info.format == spv::ImageFormat::R32f || + info.format == spv::ImageFormat::R32i || + info.format == spv::ImageFormat::R32ui; + if (!valid_format && + _.HasCapability(spv::Capability::AtomicFloat16VectorNV)) { + valid_format = info.format == spv::ImageFormat::Rg16f || + info.format == spv::ImageFormat::Rgba16f; + } + + if (!valid_format) { + const uint32_t vuid = isUntyped ? 11416 : 4658; return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4658) + << _.VkErrorID(vuid) << "Expected the Image Format in Image to be R64i, R64ui, R32f, " - "R32i, or R32ui for Vulkan environment"; + "R32i, or R32ui for Vulkan environment using Op" + << spvOpcodeString(inst->opcode()); } } @@ -1331,29 +1430,9 @@ spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { } } - const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if ((opcode == spv::Op::OpImageSampleExplicitLod || - opcode == spv::Op::OpImageSparseSampleExplicitLod) && - _.HasCapability(spv::Capability::Kernel)) { - if (!_.IsFloatScalarOrVectorType(coord_type) && - !_.IsIntScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be int or float scalar or vector"; - } - } else { - if (!_.IsFloatScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be float scalar or vector"; - } - } - - const uint32_t min_coord_size = GetMinCoordSize(opcode, info); - const uint32_t actual_coord_size = _.GetDimension(coord_type); - if (min_coord_size > actual_coord_size) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to have at least " << min_coord_size - << " components, but given only " << actual_coord_size; - } + if (spv_result_t result = + ValidateImageCoordinate(_, inst, info, /* word_index = */ 3)) + return result; const uint32_t mask = inst->words().size() <= 5 ? 0 : inst->word(5); @@ -1378,7 +1457,7 @@ spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateImageDref(ValidationState_t& _, const Instruction* inst, const ImageTypeInfo& info) { const uint32_t dref_type = _.GetOperandTypeId(inst, 4); - if (!_.IsFloatScalarType(dref_type) || _.GetBitWidth(dref_type) != 32) { + if (!_.IsFloatScalarType(dref_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Dref to be of 32-bit float type"; } @@ -1440,19 +1519,9 @@ spv_result_t ValidateImageDrefLod(ValidationState_t& _, << GetActualResultTypeStr(opcode); } - const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if (!_.IsFloatScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be float scalar or vector"; - } - - const uint32_t min_coord_size = GetMinCoordSize(opcode, info); - const uint32_t actual_coord_size = _.GetDimension(coord_type); - if (min_coord_size > actual_coord_size) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to have at least " << min_coord_size - << " components, but given only " << actual_coord_size; - } + if (spv_result_t result = + ValidateImageCoordinate(_, inst, info, /* word_index = */ 3)) + return result; if (spv_result_t result = ValidateImageDref(_, inst, info)) return result; @@ -1514,19 +1583,9 @@ spv_result_t ValidateImageFetch(ValidationState_t& _, const Instruction* inst) { << "Expected Image 'Sampled' parameter to be 1"; } - const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if (!_.IsIntScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be int scalar or vector"; - } - - const uint32_t min_coord_size = GetMinCoordSize(opcode, info); - const uint32_t actual_coord_size = _.GetDimension(coord_type); - if (min_coord_size > actual_coord_size) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to have at least " << min_coord_size - << " components, but given only " << actual_coord_size; - } + if (spv_result_t result = + ValidateImageCoordinate(_, inst, info, /* word_index = */ 3)) + return result; if (spv_result_t result = ValidateImageOperands(_, inst, info, /* word_index = */ 6)) @@ -1594,26 +1653,15 @@ spv_result_t ValidateImageGather(ValidationState_t& _, << "Expected Image 'Dim' to be 2D, Cube, or Rect"; } - const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if (!_.IsFloatScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be float scalar or vector"; - } - - const uint32_t min_coord_size = GetMinCoordSize(opcode, info); - const uint32_t actual_coord_size = _.GetDimension(coord_type); - if (min_coord_size > actual_coord_size) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to have at least " << min_coord_size - << " components, but given only " << actual_coord_size; - } + if (spv_result_t result = + ValidateImageCoordinate(_, inst, info, /* word_index = */ 3)) + return result; if (opcode == spv::Op::OpImageGather || opcode == spv::Op::OpImageSparseGather) { const uint32_t component = inst->GetOperandAs(4); const uint32_t component_index_type = _.GetTypeId(component); - if (!_.IsIntScalarType(component_index_type) || - _.GetBitWidth(component_index_type) != 32) { + if (!_.IsIntScalarType(component_index_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Component to be 32-bit int scalar"; } @@ -1737,19 +1785,9 @@ spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { if (spv_result_t result = ValidateImageReadWrite(_, inst, info)) return result; - const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if (!_.IsIntScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be int scalar or vector"; - } - - const uint32_t min_coord_size = GetMinCoordSize(opcode, info); - const uint32_t actual_coord_size = _.GetDimension(coord_type); - if (min_coord_size > actual_coord_size) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to have at least " << min_coord_size - << " components, but given only " << actual_coord_size; - } + if (spv_result_t result = + ValidateImageCoordinate(_, inst, info, /* word_index = */ 3)) + return result; if (spvIsVulkanEnv(_.context()->target_env)) { if (info.format == spv::ImageFormat::Unknown && @@ -1794,19 +1832,9 @@ spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) { if (spv_result_t result = ValidateImageReadWrite(_, inst, info)) return result; - const uint32_t coord_type = _.GetOperandTypeId(inst, 1); - if (!_.IsIntScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be int scalar or vector"; - } - - const uint32_t min_coord_size = GetMinCoordSize(inst->opcode(), info); - const uint32_t actual_coord_size = _.GetDimension(coord_type); - if (min_coord_size > actual_coord_size) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to have at least " << min_coord_size - << " components, but given only " << actual_coord_size; - } + if (spv_result_t result = + ValidateImageCoordinate(_, inst, info, /* word_index = */ 1)) + return result; // because it needs to match with 'Sampled Type' the Texel can't be a boolean const uint32_t texel_type = _.GetOperandTypeId(inst, 2); @@ -1934,9 +1962,9 @@ spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _, } const uint32_t lod_type = _.GetOperandTypeId(inst, 3); - if (!_.IsIntScalarType(lod_type)) { + if (!_.IsIntScalarType(lod_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Level of Detail to be int scalar"; + << "Expected Level of Detail to be a 32-bit int scalar"; } return SPV_SUCCESS; } @@ -2097,27 +2125,9 @@ spv_result_t ValidateImageQueryLod(ValidationState_t& _, << "Image 'Dim' must be 1D, 2D, 3D or Cube"; } - const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if (_.HasCapability(spv::Capability::Kernel)) { - if (!_.IsFloatScalarOrVectorType(coord_type) && - !_.IsIntScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be int or float scalar or vector"; - } - } else { - if (!_.IsFloatScalarOrVectorType(coord_type)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to be float scalar or vector"; - } - } - - const uint32_t min_coord_size = GetPlaneCoordSize(info); - const uint32_t actual_coord_size = _.GetDimension(coord_type); - if (min_coord_size > actual_coord_size) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected Coordinate to have at least " << min_coord_size - << " components, but given only " << actual_coord_size; - } + if (spv_result_t result = + ValidateImageCoordinate(_, inst, info, /* word_index = */ 3)) + return result; // The operand is a sampled image. // The sampled image type is already checked to be parameterized by an image @@ -2382,6 +2392,7 @@ spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpSampledImage: return ValidateSampledImage(_, inst); case spv::Op::OpImageTexelPointer: + case spv::Op::OpUntypedImageTexelPointerEXT: return ValidateImageTexelPointer(_, inst); case spv::Op::OpImageSampleImplicitLod: diff --git a/third_party/spirv-tools/source/val/validate_instruction.cpp b/third_party/spirv-tools/source/val/validate_instruction.cpp index 655408d09b..26273afe7c 100644 --- a/third_party/spirv-tools/source/val/validate_instruction.cpp +++ b/third_party/spirv-tools/source/val/validate_instruction.cpp @@ -195,7 +195,8 @@ spv_result_t CheckRequiredCapabilities(ValidationState_t& state, // registers a capability with the module *before* checking capabilities. // So in the case of an OpCapability instruction, don't bother checking // enablement by another capability. - if (inst->opcode() != spv::Op::OpCapability) { + if (inst->opcode() != spv::Op::OpCapability && + inst->opcode() != spv::Op::OpConditionalCapabilityINTEL) { const bool enabled_by_cap = state.HasAnyOfCapabilities(enabling_capabilities); if (!enabling_capabilities.empty() && !enabled_by_cap) { @@ -461,10 +462,13 @@ spv_result_t CheckIfKnownExtension(ValidationState_t& _, spv_result_t InstructionPass(ValidationState_t& _, const Instruction* inst) { const spv::Op opcode = inst->opcode(); - if (opcode == spv::Op::OpExtension) { + if (opcode == spv::Op::OpExtension || + opcode == spv::Op::OpConditionalExtensionINTEL) { CheckIfKnownExtension(_, inst); } else if (opcode == spv::Op::OpCapability) { _.RegisterCapability(inst->GetOperandAs(0)); + } else if (opcode == spv::Op::OpConditionalCapabilityINTEL) { + _.RegisterCapability(inst->GetOperandAs(1)); } else if (opcode == spv::Op::OpMemoryModel) { if (_.has_memory_model_specified()) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) diff --git a/third_party/spirv-tools/source/val/validate_interfaces.cpp b/third_party/spirv-tools/source/val/validate_interfaces.cpp index b80c7d85e9..3035f94bb0 100644 --- a/third_party/spirv-tools/source/val/validate_interfaces.cpp +++ b/third_party/spirv-tools/source/val/validate_interfaces.cpp @@ -155,11 +155,12 @@ spv_result_t NumConsumedLocations(ValidationState_t& _, const Instruction* type, *num_locations = 1; break; case spv::Op::OpTypeVector: + case spv::Op::OpTypeVectorIdEXT: // 3- and 4-component 64-bit vectors consume two locations. if ((_.ContainsSizedIntOrFloatType(type->id(), spv::Op::OpTypeInt, 64) || _.ContainsSizedIntOrFloatType(type->id(), spv::Op::OpTypeFloat, 64)) && - (type->GetOperandAs(2) > 2)) { + (_.GetDimension(type->id()) > 2)) { *num_locations = 2; } else { *num_locations = 1; @@ -239,12 +240,13 @@ uint32_t NumConsumedComponents(ValidationState_t& _, const Instruction* type) { } break; case spv::Op::OpTypeVector: + case spv::Op::OpTypeVectorIdEXT: // Vectors consume components equal to the underlying type's consumption // times the number of elements in the vector. Note that 3- and 4-element // vectors cannot have a component decoration (i.e. assumed to be zero). num_components = NumConsumedComponents(_, _.FindDef(type->GetOperandAs(1))); - num_components *= type->GetOperandAs(2); + num_components *= _.GetDimension(type->id()); break; case spv::Op::OpTypeArray: // Skip the array. @@ -615,7 +617,8 @@ spv_result_t ValidateStorageClass(ValidationState_t& _, auto storage_class = interface_var->GetOperandAs(2); switch (storage_class) { case spv::StorageClass::PushConstant: { - if (has_push_constant) { + if (has_push_constant && + !(_.HasCapability(spv::Capability::PushConstantBanksNV))) { return _.diag(SPV_ERROR_INVALID_DATA, entry_point) << _.VkErrorID(6673) << "Entry-point has more than one variable with the " @@ -690,7 +693,7 @@ spv_result_t ValidateStorageClass(ValidationState_t& _, return false; })) { return _.diag(SPV_ERROR_INVALID_ID, interface_var) - << "FP8 E4M3/E5M2 OpVariable " // TODO VUID + << _.VkErrorID(10823) << "FP8 E4M3/E5M2 OpVariable " << _.getIdName(interface_var->id()) << " must not be declared " << "with a Storage Class of Input or Output."; } diff --git a/third_party/spirv-tools/source/val/validate_invalid_type.cpp b/third_party/spirv-tools/source/val/validate_invalid_type.cpp index bc4827ce06..05c09e2e61 100644 --- a/third_party/spirv-tools/source/val/validate_invalid_type.cpp +++ b/third_party/spirv-tools/source/val/validate_invalid_type.cpp @@ -69,12 +69,11 @@ spv_result_t InvalidTypePass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpGroupNonUniformFMul: case spv::Op::OpGroupNonUniformFMin: { const uint32_t result_type = inst->type_id(); - if (_.IsBfloat16ScalarType(result_type) || - _.IsBfloat16VectorType(result_type)) { + if (_.IsBfloat16Type(result_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << " doesn't support BFloat16 type."; } - if (_.IsFP8ScalarOrVectorType(result_type)) { + if (_.IsFP8Type(result_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << " doesn't support FP8 E4M3/E5M2 types."; @@ -101,14 +100,28 @@ spv_result_t InvalidTypePass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpIsInf: case spv::Op::OpIsFinite: case spv::Op::OpIsNormal: + case spv::Op::OpFOrdEqual: + case spv::Op::OpFUnordEqual: + case spv::Op::OpFOrdNotEqual: + case spv::Op::OpFUnordNotEqual: + case spv::Op::OpFOrdLessThan: + case spv::Op::OpFUnordLessThan: + case spv::Op::OpFOrdGreaterThan: + case spv::Op::OpFUnordGreaterThan: + case spv::Op::OpFOrdLessThanEqual: + case spv::Op::OpFUnordLessThanEqual: + case spv::Op::OpFOrdGreaterThanEqual: + case spv::Op::OpFUnordGreaterThanEqual: + case spv::Op::OpLessOrGreater: + case spv::Op::OpOrdered: + case spv::Op::OpUnordered: case spv::Op::OpSignBitSet: { const uint32_t operand_type = _.GetOperandTypeId(inst, 2); - if (_.IsBfloat16ScalarType(operand_type) || - _.IsBfloat16VectorType(operand_type)) { + if (_.IsBfloat16Type(operand_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << " doesn't support BFloat16 type."; } - if (_.IsFP8ScalarOrVectorType(operand_type)) { + if (_.IsFP8Type(operand_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << " doesn't support FP8 E4M3/E5M2 types."; @@ -118,12 +131,11 @@ spv_result_t InvalidTypePass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpGroupNonUniformAllEqual: { const auto value_type = _.GetOperandTypeId(inst, 3); - if (_.IsBfloat16ScalarType(value_type) || - _.IsBfloat16VectorType(value_type)) { + if (_.IsBfloat16Type(value_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << " doesn't support BFloat16 type."; } - if (_.IsFP8ScalarOrVectorType(value_type)) { + if (_.IsFP8Type(value_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << " doesn't support FP8 E4M3/E5M2 types."; @@ -140,12 +152,12 @@ spv_result_t InvalidTypePass(ValidationState_t& _, const Instruction* inst) { uint32_t res_component_type = 0; if (_.GetMatrixTypeInfo(result_type, &res_num_rows, &res_num_cols, &res_col_type, &res_component_type)) { - if (_.IsBfloat16ScalarType(res_component_type)) { + if (_.IsBfloat16Type(res_component_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << " doesn't support BFloat16 type."; } - if (_.IsFP8ScalarOrVectorType(res_component_type)) { + if (_.IsFP8Type(res_component_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << " doesn't support FP8 E4M3/E5M2 types."; diff --git a/third_party/spirv-tools/source/val/validate_layout.cpp b/third_party/spirv-tools/source/val/validate_layout.cpp index baf36b89bd..dcc4e5bb80 100644 --- a/third_party/spirv-tools/source/val/validate_layout.cpp +++ b/third_party/spirv-tools/source/val/validate_layout.cpp @@ -342,13 +342,84 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _, break; } } else { - return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) - << spvOpcodeString(opcode) - << " cannot appear in a function declaration"; + _.ProgressToNextLayoutSectionOrder(); + // All function sections have been processed. Recursively call + // ModuleLayoutPass to process the next section of the module + return ModuleLayoutPass(_, inst); } return SPV_SUCCESS; } +spv_result_t GraphScopedInstructions(ValidationState_t& _, + const Instruction* inst, spv::Op opcode) { + if (_.IsOpcodeInCurrentLayoutSection(opcode)) { + switch (opcode) { + case spv::Op::OpGraphARM: { + if (_.graph_definition_region() > kGraphDefinitionOutside) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Cannot define a graph in a graph"; + } + _.SetGraphDefinitionRegion(kGraphDefinitionBegin); + } break; + case spv::Op::OpGraphInputARM: { + if ((_.graph_definition_region() != kGraphDefinitionBegin) && + (_.graph_definition_region() != kGraphDefinitionInputs)) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "OpGraphInputARM" + << " must immediately follow an OpGraphARM or OpGraphInputARM " + "instruction."; + } + _.SetGraphDefinitionRegion(kGraphDefinitionInputs); + } break; + case spv::Op::OpGraphSetOutputARM: { + if ((_.graph_definition_region() != kGraphDefinitionBegin) && + (_.graph_definition_region() != kGraphDefinitionInputs) && + (_.graph_definition_region() != kGraphDefinitionBody) && + (_.graph_definition_region() != kGraphDefinitionOutputs)) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Op" << spvOpcodeString(opcode) + << " must immediately precede an OpGraphEndARM or " + "OpGraphSetOutputARM instruction."; + } + _.SetGraphDefinitionRegion(kGraphDefinitionOutputs); + } break; + case spv::Op::OpGraphEndARM: { + if (_.graph_definition_region() != kGraphDefinitionOutputs) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << spvOpcodeString(opcode) + << " must be preceded by at least one OpGraphSetOutputARM " + "instruction"; + } + _.SetGraphDefinitionRegion(kGraphDefinitionOutside); + } break; + case spv::Op::OpGraphEntryPointARM: + if (_.graph_definition_region() != kGraphDefinitionOutside) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << spvOpcodeString(opcode) + << " cannot appear in the definition of a graph"; + } + break; + default: + if (_.graph_definition_region() == kGraphDefinitionOutside) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Op" << spvOpcodeString(opcode) + << " must appear in a graph body"; + } + if (_.graph_definition_region() == kGraphDefinitionOutputs) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << spvOpcodeString(opcode) + << " cannot appear after a graph output instruction"; + } + _.SetGraphDefinitionRegion(kGraphDefinitionBody); + break; + } + } else { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Op" << spvOpcodeString(opcode) + << " cannot appear in the graph definitions section"; + } + return SPV_SUCCESS; +} } // namespace // TODO(umar): Check linkage capabilities for function declarations @@ -379,6 +450,11 @@ spv_result_t ModuleLayoutPass(ValidationState_t& _, const Instruction* inst) { return error; } break; + case kLayoutGraphDefinitions: + if (auto error = GraphScopedInstructions(_, inst, opcode)) { + return error; + } + break; } return SPV_SUCCESS; } diff --git a/third_party/spirv-tools/source/val/validate_logical_pointers.cpp b/third_party/spirv-tools/source/val/validate_logical_pointers.cpp new file mode 100644 index 0000000000..3e5daaebcf --- /dev/null +++ b/third_party/spirv-tools/source/val/validate_logical_pointers.cpp @@ -0,0 +1,1021 @@ +// Copyright (c) 2025 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include + +#include "source/opcode.h" +#include "source/val/validate.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Returns true if inst is a logical pointer. +bool IsLogicalPointer(const ValidationState_t& _, const Instruction* inst) { + if (!_.IsPointerType(inst->type_id())) { + return false; + } + + // Physical storage buffer pointers are not logical pointers. + auto type_inst = _.FindDef(inst->type_id()); + auto sc = type_inst->GetOperandAs(1); + if (sc == spv::StorageClass::PhysicalStorageBuffer) { + return false; + } + + return true; +} + +// Returns true if inst is a variable pointer. +// Caches the result in variable_pointers. +bool IsVariablePointer(const ValidationState_t& _, + std::unordered_map& variable_pointers, + const Instruction* inst) { + const auto iter = variable_pointers.find(inst->id()); + if (iter != variable_pointers.end()) { + return iter->second; + } + + // Temporarily mark the instruction as NOT a variable pointer. + variable_pointers[inst->id()] = false; + + bool is_var_ptr = false; + switch (inst->opcode()) { + case spv::Op::OpPtrAccessChain: + case spv::Op::OpUntypedPtrAccessChainKHR: + case spv::Op::OpUntypedInBoundsPtrAccessChainKHR: + case spv::Op::OpLoad: + case spv::Op::OpSelect: + case spv::Op::OpPhi: + case spv::Op::OpFunctionCall: + case spv::Op::OpConstantNull: + is_var_ptr = true; + break; + case spv::Op::OpFunctionParameter: + // Special case: skip to function calls. + if (IsLogicalPointer(_, inst)) { + auto func = inst->function(); + auto func_inst = _.FindDef(func->id()); + + const auto param_inst_num = inst - &_.ordered_instructions()[0]; + uint32_t param_index = 0; + uint32_t inst_index = 1; + while (_.ordered_instructions()[param_inst_num - inst_index].opcode() != + spv::Op::OpFunction) { + if (_.ordered_instructions()[param_inst_num - inst_index].opcode() == + spv::Op::OpFunctionParameter) { + param_index++; + } + ++inst_index; + } + + for (const auto& use_pair : func_inst->uses()) { + const auto use_inst = use_pair.first; + if (use_inst->opcode() == spv::Op::OpFunctionCall) { + const auto arg_id = + use_inst->GetOperandAs(3 + param_index); + const auto arg_inst = _.FindDef(arg_id); + is_var_ptr |= IsVariablePointer(_, variable_pointers, arg_inst); + } + } + } + break; + default: { + for (uint32_t i = 0; i < inst->operands().size(); ++i) { + if (inst->operands()[i].type != SPV_OPERAND_TYPE_ID) { + continue; + } + + auto op_inst = _.FindDef(inst->GetOperandAs(i)); + if (IsLogicalPointer(_, op_inst)) { + is_var_ptr |= IsVariablePointer(_, variable_pointers, op_inst); + } + } + break; + } + } + variable_pointers[inst->id()] = is_var_ptr; + return is_var_ptr; +} + +spv_result_t ValidateLogicalPointerOperands(ValidationState_t& _, + const Instruction* inst) { + bool has_pointer_operand = false; + spv::StorageClass sc = spv::StorageClass::Function; + for (uint32_t i = 0; i < inst->operands().size(); ++i) { + if (inst->operands()[i].type != SPV_OPERAND_TYPE_ID) { + continue; + } + + auto op_inst = _.FindDef(inst->GetOperandAs(i)); + if (IsLogicalPointer(_, op_inst)) { + has_pointer_operand = true; + + // Assume that there are not mixed storage classes in the instruction. + // This is not true for OpCopyMemory and OpCopyMemorySized, but they allow + // all storage classes. + auto type_inst = _.FindDef(op_inst->type_id()); + sc = type_inst->GetOperandAs(1); + break; + } + } + + if (!has_pointer_operand) { + return SPV_SUCCESS; + } + + switch (inst->opcode()) { + // The following instructions allow logical pointer operands in all cases + // without capabilities. + case spv::Op::OpLoad: + case spv::Op::OpStore: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpFunctionCall: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyObject: + case spv::Op::OpArrayLength: + case spv::Op::OpExtInst: + // Core spec bugs + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpGroupDecorate: + case spv::Op::OpEntryPoint: + case spv::Op::OpName: + case spv::Op::OpDecorateString: + // SPV_KHR_untyped_pointers + case spv::Op::OpUntypedArrayLengthKHR: + case spv::Op::OpUntypedAccessChainKHR: + case spv::Op::OpUntypedInBoundsAccessChainKHR: + case spv::Op::OpCopyMemorySized: + // Cooperative matrix KHR/NV + case spv::Op::OpCooperativeMatrixLoadKHR: + case spv::Op::OpCooperativeMatrixLoadNV: + case spv::Op::OpCooperativeMatrixStoreKHR: + case spv::Op::OpCooperativeMatrixStoreNV: + // SPV_KHR_ray_tracing + case spv::Op::OpTraceRayKHR: + case spv::Op::OpExecuteCallableKHR: + // SPV_KHR_ray_query + case spv::Op::OpRayQueryConfirmIntersectionKHR: + case spv::Op::OpRayQueryInitializeKHR: + case spv::Op::OpRayQueryTerminateKHR: + case spv::Op::OpRayQueryGenerateIntersectionKHR: + case spv::Op::OpRayQueryProceedKHR: + case spv::Op::OpRayQueryGetIntersectionTypeKHR: + case spv::Op::OpRayQueryGetRayTMinKHR: + case spv::Op::OpRayQueryGetRayFlagsKHR: + case spv::Op::OpRayQueryGetIntersectionTKHR: + case spv::Op::OpRayQueryGetIntersectionInstanceCustomIndexKHR: + case spv::Op::OpRayQueryGetIntersectionInstanceIdKHR: + case spv::Op:: + OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: + case spv::Op::OpRayQueryGetIntersectionGeometryIndexKHR: + case spv::Op::OpRayQueryGetIntersectionPrimitiveIndexKHR: + case spv::Op::OpRayQueryGetIntersectionBarycentricsKHR: + case spv::Op::OpRayQueryGetIntersectionFrontFaceKHR: + case spv::Op::OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: + case spv::Op::OpRayQueryGetIntersectionObjectRayDirectionKHR: + case spv::Op::OpRayQueryGetIntersectionObjectRayOriginKHR: + case spv::Op::OpRayQueryGetWorldRayDirectionKHR: + case spv::Op::OpRayQueryGetWorldRayOriginKHR: + case spv::Op::OpRayQueryGetIntersectionObjectToWorldKHR: + case spv::Op::OpRayQueryGetIntersectionWorldToObjectKHR: + // SPV_KHR_ray_tracing_position_fetch + case spv::Op::OpRayQueryGetIntersectionTriangleVertexPositionsKHR: + // SPV_NV_cluster_acceleration_structure + case spv::Op::OpRayQueryGetClusterIdNV: + case spv::Op::OpHitObjectGetClusterIdNV: + // SPV_NV_ray_tracing_motion_blur + case spv::Op::OpTraceMotionNV: + case spv::Op::OpTraceRayMotionNV: + // SPV_NV_linear_swept_spheres + case spv::Op::OpRayQueryGetIntersectionSpherePositionNV: + case spv::Op::OpRayQueryGetIntersectionSphereRadiusNV: + case spv::Op::OpRayQueryGetIntersectionLSSPositionsNV: + case spv::Op::OpRayQueryGetIntersectionLSSRadiiNV: + case spv::Op::OpRayQueryGetIntersectionLSSHitValueNV: + case spv::Op::OpRayQueryIsSphereHitNV: + case spv::Op::OpRayQueryIsLSSHitNV: + case spv::Op::OpHitObjectGetSpherePositionNV: + case spv::Op::OpHitObjectGetSphereRadiusNV: + case spv::Op::OpHitObjectGetLSSPositionsNV: + case spv::Op::OpHitObjectGetLSSRadiiNV: + case spv::Op::OpHitObjectIsSphereHitNV: + case spv::Op::OpHitObjectIsLSSHitNV: + // SPV_NV_shader_invocation_reorder + case spv::Op::OpReorderThreadWithHitObjectNV: + case spv::Op::OpHitObjectTraceRayNV: + case spv::Op::OpHitObjectTraceRayMotionNV: + case spv::Op::OpHitObjectRecordHitNV: + case spv::Op::OpHitObjectRecordHitMotionNV: + case spv::Op::OpHitObjectRecordHitWithIndexNV: + case spv::Op::OpHitObjectRecordHitWithIndexMotionNV: + case spv::Op::OpHitObjectRecordMissNV: + case spv::Op::OpHitObjectRecordMissMotionNV: + case spv::Op::OpHitObjectRecordEmptyNV: + case spv::Op::OpHitObjectExecuteShaderNV: + case spv::Op::OpHitObjectGetCurrentTimeNV: + case spv::Op::OpHitObjectGetAttributesNV: + case spv::Op::OpHitObjectGetHitKindNV: + case spv::Op::OpHitObjectGetPrimitiveIndexNV: + case spv::Op::OpHitObjectGetGeometryIndexNV: + case spv::Op::OpHitObjectGetInstanceIdNV: + case spv::Op::OpHitObjectGetInstanceCustomIndexNV: + case spv::Op::OpHitObjectGetObjectRayOriginNV: + case spv::Op::OpHitObjectGetObjectRayDirectionNV: + case spv::Op::OpHitObjectGetWorldRayDirectionNV: + case spv::Op::OpHitObjectGetWorldRayOriginNV: + case spv::Op::OpHitObjectGetObjectToWorldNV: + case spv::Op::OpHitObjectGetWorldToObjectNV: + case spv::Op::OpHitObjectGetRayTMaxNV: + case spv::Op::OpHitObjectGetRayTMinNV: + case spv::Op::OpHitObjectGetShaderBindingTableRecordIndexNV: + case spv::Op::OpHitObjectGetShaderRecordBufferHandleNV: + case spv::Op::OpHitObjectIsEmptyNV: + case spv::Op::OpHitObjectIsHitNV: + case spv::Op::OpHitObjectIsMissNV: + // SPV_EXT_shader_invocation_reorder + case spv::Op::OpHitObjectRecordFromQueryEXT: + case spv::Op::OpHitObjectRecordMissEXT: + case spv::Op::OpHitObjectRecordMissMotionEXT: + case spv::Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT: + case spv::Op::OpHitObjectGetRayFlagsEXT: + case spv::Op::OpHitObjectSetShaderBindingTableRecordIndexEXT: + case spv::Op::OpHitObjectReorderExecuteShaderEXT: + case spv::Op::OpHitObjectTraceReorderExecuteEXT: + case spv::Op::OpHitObjectTraceMotionReorderExecuteEXT: + case spv::Op::OpReorderThreadWithHintEXT: + case spv::Op::OpReorderThreadWithHitObjectEXT: + case spv::Op::OpHitObjectTraceRayEXT: + case spv::Op::OpHitObjectTraceRayMotionEXT: + case spv::Op::OpHitObjectRecordEmptyEXT: + case spv::Op::OpHitObjectExecuteShaderEXT: + case spv::Op::OpHitObjectGetCurrentTimeEXT: + case spv::Op::OpHitObjectGetAttributesEXT: + case spv::Op::OpHitObjectGetHitKindEXT: + case spv::Op::OpHitObjectGetPrimitiveIndexEXT: + case spv::Op::OpHitObjectGetGeometryIndexEXT: + case spv::Op::OpHitObjectGetInstanceIdEXT: + case spv::Op::OpHitObjectGetInstanceCustomIndexEXT: + case spv::Op::OpHitObjectGetObjectRayOriginEXT: + case spv::Op::OpHitObjectGetObjectRayDirectionEXT: + case spv::Op::OpHitObjectGetWorldRayDirectionEXT: + case spv::Op::OpHitObjectGetWorldRayOriginEXT: + case spv::Op::OpHitObjectGetObjectToWorldEXT: + case spv::Op::OpHitObjectGetWorldToObjectEXT: + case spv::Op::OpHitObjectGetRayTMaxEXT: + case spv::Op::OpHitObjectGetRayTMinEXT: + case spv::Op::OpHitObjectGetShaderBindingTableRecordIndexEXT: + case spv::Op::OpHitObjectGetShaderRecordBufferHandleEXT: + case spv::Op::OpHitObjectIsEmptyEXT: + case spv::Op::OpHitObjectIsHitEXT: + case spv::Op::OpHitObjectIsMissEXT: + // SPV_NV_raw_access_chains + case spv::Op::OpRawAccessChainNV: + // SPV_NV_cooperative_matrix2 + case spv::Op::OpCooperativeMatrixLoadTensorNV: + case spv::Op::OpCooperativeMatrixStoreTensorNV: + // SPV_NV_cooperative_vector + case spv::Op::OpCooperativeVectorLoadNV: + case spv::Op::OpCooperativeVectorStoreNV: + case spv::Op::OpCooperativeVectorMatrixMulNV: + case spv::Op::OpCooperativeVectorMatrixMulAddNV: + case spv::Op::OpCooperativeVectorOuterProductAccumulateNV: + case spv::Op::OpCooperativeVectorReduceSumAccumulateNV: + // SPV_EXT_mesh_shader + case spv::Op::OpEmitMeshTasksEXT: + // SPV_AMD_shader_enqueue (spec bugs) + case spv::Op::OpEnqueueNodePayloadsAMDX: + case spv::Op::OpNodePayloadArrayLengthAMDX: + case spv::Op::OpIsNodePayloadValidAMDX: + case spv::Op::OpFinishWritingNodePayloadAMDX: + // SPV_ARM_graph + case spv::Op::OpGraphEntryPointARM: + return SPV_SUCCESS; + // SPV_EXT_descriptor_heap + case spv::Op::OpBufferPointerEXT: + case spv::Op::OpUntypedImageTexelPointerEXT: + return SPV_SUCCESS; + // The following cases require a variable pointer capability. Since all + // instructions are for variable pointers, the storage class and capability + // are also checked. + case spv::Op::OpReturnValue: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpPtrEqual: + case spv::Op::OpPtrNotEqual: + case spv::Op::OpPtrDiff: + // Core spec bugs + case spv::Op::OpSelect: + case spv::Op::OpPhi: + case spv::Op::OpVariable: + // SPV_KHR_untyped_pointers + case spv::Op::OpUntypedPtrAccessChainKHR: + if ((_.HasCapability(spv::Capability::VariablePointersStorageBuffer) && + sc == spv::StorageClass ::StorageBuffer) || + (_.HasCapability(spv::Capability::VariablePointers) && + sc == spv::StorageClass::Workgroup)) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Instruction may only have a logical pointer operand in the " + "StorageBuffer or Workgroup storage classes with appropriate " + "variable pointers capability"; + default: + if (spvOpcodeIsAtomicOp(inst->opcode())) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Instruction may not have a logical pointer operand"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateLogicalPointerReturns(ValidationState_t& _, + const Instruction* inst) { + if (!IsLogicalPointer(_, inst)) { + return SPV_SUCCESS; + } + + const auto type_inst = _.FindDef(inst->type_id()); + const auto sc = type_inst->GetOperandAs(1u); + + switch (inst->opcode()) { + // Core spec without an variable pointer capability. + case spv::Op::OpVariable: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpFunctionParameter: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpCopyObject: + // Core spec bugs + case spv::Op::OpUndef: + // SPV_KHR_untyped_pointers + case spv::Op::OpUntypedAccessChainKHR: + case spv::Op::OpUntypedInBoundsAccessChainKHR: + case spv::Op::OpUntypedVariableKHR: + // SPV_NV_raw_access_chains + case spv::Op::OpRawAccessChainNV: + // SPV_AMD_shader_enqueue (spec bugs) + case spv::Op::OpAllocateNodePayloadsAMDX: + return SPV_SUCCESS; + // SPV_EXT_descriptor_heap + case spv::Op::OpBufferPointerEXT: + case spv::Op::OpUntypedImageTexelPointerEXT: + return SPV_SUCCESS; + // Core spec with variable pointer capability. Check storage classes since + // variable pointers can only be in certain storage classes. + case spv::Op::OpSelect: + case spv::Op::OpPhi: + case spv::Op::OpFunctionCall: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpLoad: + case spv::Op::OpConstantNull: + case spv::Op::OpFunction: + // SPV_KHR_untyped_pointers + case spv::Op::OpUntypedPtrAccessChainKHR: + if ((_.HasCapability(spv::Capability::VariablePointersStorageBuffer) && + sc == spv::StorageClass ::StorageBuffer) || + (_.HasCapability(spv::Capability::VariablePointers) && + sc == spv::StorageClass::Workgroup)) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Instruction may only return a logical pointer in the " + "StorageBuffer or Workgroup storage classes with appropriate " + "variable pointers capability"; + default: + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Instruction may not return a logical pointer"; + } + + return SPV_SUCCESS; +} + +spv_result_t IsBlockArray(ValidationState_t& _, const Instruction* type) { + if (type->opcode() == spv::Op::OpTypeArray || + type->opcode() == spv::Op::OpTypeRuntimeArray) { + const auto element_type = _.FindDef(type->GetOperandAs(1)); + if (element_type->opcode() == spv::Op::OpTypeStruct && + (_.HasDecoration(element_type->id(), spv::Decoration::Block) || + _.HasDecoration(element_type->id(), spv::Decoration::BufferBlock))) { + return SPV_ERROR_INVALID_DATA; + } + } + return SPV_SUCCESS; +} + +spv_result_t CheckMatrixElementTyped(ValidationState_t& _, + const Instruction* inst) { + switch (inst->opcode()) { + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: { + // Get the type of the base operand. + uint32_t start_index = + inst->opcode() == spv::Op::OpPtrAccessChain ? 4 : 3; + const auto access_type_id = _.GetOperandTypeId(inst, 2); + auto access_type = _.FindDef(access_type_id); + access_type = _.FindDef(access_type->GetOperandAs(2)); + + // If the base operand is a matrix, then it was definitely pointing to a + // sub-component. + if (access_type->opcode() == spv::Op::OpTypeMatrix) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to a column or a " + "component of a column of a matrix"; + } + + // Otherwise, step through the indices to see if we pass a matrix. + for (uint32_t i = start_index; i < inst->operands().size(); ++i) { + const auto index = inst->GetOperandAs(i); + if (access_type->opcode() == spv::Op::OpTypeStruct) { + uint64_t val = 0; + _.EvalConstantValUint64(index, &val); + access_type = _.FindDef(access_type->GetOperandAs( + 1 + static_cast(val))); + } else { + access_type = _.FindDef(_.GetComponentType(access_type->id())); + } + + if (access_type->opcode() == spv::Op::OpTypeMatrix) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to a column or a " + "component of a column of a matrix"; + } + } + break; + } + default: + break; + } + return SPV_SUCCESS; +} + +spv_result_t CheckMatrixElementUntyped(ValidationState_t& _, + const Instruction* inst) { + switch (inst->opcode()) { + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpUntypedAccessChainKHR: + case spv::Op::OpUntypedInBoundsAccessChainKHR: + case spv::Op::OpUntypedPtrAccessChainKHR: { + const bool untyped = spvOpcodeGeneratesUntypedPointer(inst->opcode()); + uint32_t start_index; + Instruction* access_type = nullptr; + if (untyped) { + // Get the type of the base operand. + start_index = + inst->opcode() == spv::Op::OpUntypedPtrAccessChainKHR ? 5 : 4; + const auto access_type_id = inst->GetOperandAs(2); + access_type = _.FindDef(access_type_id); + } else { + start_index = inst->opcode() == spv::Op::OpPtrAccessChain ? 4 : 3; + const auto access_type_id = _.GetOperandTypeId(inst, 2); + access_type = _.FindDef(access_type_id); + access_type = _.FindDef(access_type->GetOperandAs(2)); + } + + // If the base operand is a matrix, then it was definitely pointing to a + // sub-component. + if (access_type->opcode() == spv::Op::OpTypeMatrix) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to a column or a " + "component of a column of a matrix."; + } + + // Otherwise, step through the indices to see if we pass a matrix. + for (uint32_t i = start_index; i < inst->operands().size(); ++i) { + const auto index = inst->GetOperandAs(i); + if (access_type->opcode() == spv::Op::OpTypeStruct) { + uint64_t val = 0; + _.EvalConstantValUint64(index, &val); + access_type = _.FindDef(access_type->GetOperandAs( + 1 + static_cast(val))); + } else { + access_type = _.FindDef(_.GetComponentType(access_type->id())); + } + + if (access_type->opcode() == spv::Op::OpTypeMatrix) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to a column or a " + "component of a column of a matrix."; + } + } + break; + } + default: + break; + } + return SPV_SUCCESS; +} + +// Traces the variable pointer inst backwards. +// checker is called on each visited instruction. +spv_result_t TraceVariablePointers( + ValidationState_t& _, const Instruction* inst, + const std::function& + checker) { + std::vector stack; + std::unordered_set seen; + stack.push_back(inst); + while (!stack.empty()) { + const Instruction* trace_inst = stack.back(); + stack.pop_back(); + + if (!seen.insert(trace_inst).second) { + continue; + } + + if (auto error = checker(_, trace_inst)) { + return error; + } + + const auto untyped = spvOpcodeGeneratesUntypedPointer(trace_inst->opcode()); + switch (trace_inst->opcode()) { + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(2))); + break; + case spv::Op::OpUntypedAccessChainKHR: + case spv::Op::OpUntypedInBoundsAccessChainKHR: + case spv::Op::OpUntypedPtrAccessChainKHR: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(3))); + break; + case spv::Op::OpPhi: + for (uint32_t i = 2; i < trace_inst->operands().size(); i += 2) { + stack.push_back(_.FindDef(trace_inst->GetOperandAs(i))); + } + break; + case spv::Op::OpSelect: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(3))); + stack.push_back(_.FindDef(trace_inst->GetOperandAs(4))); + break; + case spv::Op::OpFunctionParameter: { + // Jump to function calls + auto func = trace_inst->function(); + auto func_inst = _.FindDef(func->id()); + + const auto param_inst_num = trace_inst - &_.ordered_instructions()[0]; + uint32_t param_index = 0; + uint32_t inst_index = 1; + while (_.ordered_instructions()[param_inst_num - inst_index].opcode() != + spv::Op::OpFunction) { + if (_.ordered_instructions()[param_inst_num - inst_index].opcode() == + spv::Op::OpFunctionParameter) { + param_index++; + } + ++inst_index; + } + + for (const auto& use_pair : func_inst->uses()) { + const auto use_inst = use_pair.first; + if (use_inst->opcode() == spv::Op::OpFunctionCall) { + const auto arg_id = + use_inst->GetOperandAs(3 + param_index); + const auto arg_inst = _.FindDef(arg_id); + stack.push_back(arg_inst); + } + } + break; + } + case spv::Op::OpFunctionCall: { + // Jump to return values. + const auto* func = _.function(trace_inst->GetOperandAs(2)); + for (auto* bb : func->ordered_blocks()) { + const auto* terminator = bb->terminator(); + if (terminator->opcode() == spv::Op::OpReturnValue) { + stack.push_back(terminator); + } + } + break; + } + case spv::Op::OpReturnValue: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(0))); + break; + case spv::Op::OpCopyObject: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(2))); + break; + case spv::Op::OpLoad: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(2))); + break; + case spv::Op::OpStore: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(0))); + break; + case spv::Op::OpVariable: + case spv::Op::OpUntypedVariableKHR: { + const auto sc = trace_inst->GetOperandAs(2); + if (sc == spv::StorageClass::Function || + sc == spv::StorageClass::Private) { + // Add the initializer + const uint32_t init_operand = untyped ? 4 : 3; + if (trace_inst->operands().size() > init_operand) { + stack.push_back( + _.FindDef(trace_inst->GetOperandAs(init_operand))); + } + // Jump to stores + std::vector> store_stack( + trace_inst->uses()); + std::unordered_set store_seen; + while (!store_stack.empty()) { + const auto use = store_stack.back(); + store_stack.pop_back(); + + if (!store_seen.insert(use.first).second) { + continue; + } + + // If the use is a store pointer, trace the store object. + // Note: use.second is a word index. + if (use.first->opcode() == spv::Op::OpStore && use.second == 1) { + stack.push_back(_.FindDef(use.first->GetOperandAs(1))); + } else { + // Most likely a gep so keep tracing. + for (auto& next_use : use.first->uses()) { + store_stack.push_back(next_use); + } + } + } + } + break; + } + default: + break; + } + } + + return SPV_SUCCESS; +} + +// Traces the variable pointer inst backwards, but only unmodified pointers. +// checker is called on each visited instruction. +spv_result_t TraceUnmodifiedVariablePointers( + ValidationState_t& _, const Instruction* inst, + const std::function& + checker) { + std::vector stack; + std::unordered_set seen; + stack.push_back(inst); + while (!stack.empty()) { + const Instruction* trace_inst = stack.back(); + stack.pop_back(); + + if (!seen.insert(trace_inst).second) { + continue; + } + + if (auto error = checker(_, trace_inst)) { + return error; + } + + const auto untyped = spvOpcodeGeneratesUntypedPointer(trace_inst->opcode()); + switch (trace_inst->opcode()) { + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + if (trace_inst->operands().size() == 2) { + stack.push_back(_.FindDef(trace_inst->GetOperandAs(2))); + } + break; + case spv::Op::OpUntypedAccessChainKHR: + case spv::Op::OpUntypedInBoundsAccessChainKHR: + case spv::Op::OpUntypedPtrAccessChainKHR: + if (trace_inst->operands().size() == 3) { + stack.push_back(_.FindDef(trace_inst->GetOperandAs(3))); + } + break; + case spv::Op::OpPhi: + for (uint32_t i = 2; i < trace_inst->operands().size(); i += 2) { + stack.push_back(_.FindDef(trace_inst->GetOperandAs(i))); + } + break; + case spv::Op::OpSelect: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(3))); + stack.push_back(_.FindDef(trace_inst->GetOperandAs(4))); + break; + case spv::Op::OpFunctionParameter: { + // Jump to function calls + auto func = trace_inst->function(); + auto func_inst = _.FindDef(func->id()); + + const auto param_inst_num = trace_inst - &_.ordered_instructions()[0]; + uint32_t param_index = 0; + uint32_t inst_index = 1; + while (_.ordered_instructions()[param_inst_num - inst_index].opcode() != + spv::Op::OpFunction) { + if (_.ordered_instructions()[param_inst_num - inst_index].opcode() == + spv::Op::OpFunctionParameter) { + param_index++; + } + ++inst_index; + } + + for (const auto& use_pair : func_inst->uses()) { + const auto use_inst = use_pair.first; + if (use_inst->opcode() == spv::Op::OpFunctionCall) { + const auto arg_id = + use_inst->GetOperandAs(3 + param_index); + const auto arg_inst = _.FindDef(arg_id); + stack.push_back(arg_inst); + } + } + break; + } + case spv::Op::OpFunctionCall: { + // Jump to return values. + const auto* func = _.function(trace_inst->GetOperandAs(2)); + for (auto* bb : func->ordered_blocks()) { + const auto* terminator = bb->terminator(); + if (terminator->opcode() == spv::Op::OpReturnValue) { + stack.push_back(terminator); + } + } + break; + } + case spv::Op::OpReturnValue: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(0))); + break; + case spv::Op::OpCopyObject: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(2))); + break; + case spv::Op::OpLoad: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(2))); + break; + case spv::Op::OpStore: + stack.push_back(_.FindDef(trace_inst->GetOperandAs(0))); + break; + case spv::Op::OpVariable: + case spv::Op::OpUntypedVariableKHR: { + const auto sc = trace_inst->GetOperandAs(2); + if (sc == spv::StorageClass::Function || + sc == spv::StorageClass::Private) { + // Add the initializer + const uint32_t init_operand = untyped ? 4 : 3; + if (trace_inst->operands().size() > init_operand) { + stack.push_back( + _.FindDef(trace_inst->GetOperandAs(init_operand))); + } + // Jump to stores + std::vector> store_stack( + trace_inst->uses()); + std::unordered_set store_seen; + while (!store_stack.empty()) { + const auto use = store_stack.back(); + store_stack.pop_back(); + + if (!store_seen.insert(use.first).second) { + continue; + } + + // If the use is a store pointer, trace the store object. + // Note: use.second is a word index. + if (use.first->opcode() == spv::Op::OpStore && use.second == 1) { + stack.push_back(_.FindDef(use.first->GetOperandAs(1))); + } else { + // Most likely a gep so keep tracing. + for (auto& next_use : use.first->uses()) { + store_stack.push_back(next_use); + } + } + } + } + break; + } + default: + break; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateVariablePointers( + ValidationState_t& _, std::unordered_map& variable_pointers, + const Instruction* inst) { + // Variable pointers cannot be operands to array length. + if (inst->opcode() == spv::Op::OpArrayLength || + inst->opcode() == spv::Op::OpUntypedArrayLengthKHR) { + const auto ptr_index = inst->opcode() == spv::Op::OpArrayLength ? 2 : 3; + const auto ptr_id = inst->GetOperandAs(ptr_index); + const auto ptr_inst = _.FindDef(ptr_id); + if (IsVariablePointer(_, variable_pointers, ptr_inst)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Pointer operand must not be a variable pointer"; + } + return SPV_SUCCESS; + } + + // Check untyped loads and stores of variable pointers for matrix types. + // Neither instruction would be a variable pointer in a such a case. + if (inst->opcode() == spv::Op::OpLoad) { + const auto pointer = _.FindDef(inst->GetOperandAs(2)); + const auto pointer_type = _.FindDef(pointer->type_id()); + if (pointer_type->opcode() == spv::Op::OpTypeUntypedPointerKHR && + IsVariablePointer(_, variable_pointers, pointer)) { + const auto data_type = _.FindDef(inst->type_id()); + if (_.ContainsType( + data_type->id(), + [](const Instruction* type_inst) { + return type_inst->opcode() == spv::Op::OpTypeMatrix; + }, + /* traverse_all_types = */ false)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to an object that is or " + "contains a matrix"; + } + } + } else if (inst->opcode() == spv::Op::OpStore) { + const auto pointer = _.FindDef(inst->GetOperandAs(0)); + const auto pointer_type = _.FindDef(pointer->type_id()); + if (pointer_type->opcode() == spv::Op::OpTypeUntypedPointerKHR && + IsVariablePointer(_, variable_pointers, pointer)) { + const auto data_type_id = _.GetOperandTypeId(inst, 1); + const auto data_type = _.FindDef(data_type_id); + if (_.ContainsType( + data_type->id(), + [](const Instruction* type_inst) { + return type_inst->opcode() == spv::Op::OpTypeMatrix; + }, + /* traverse_all_types = */ false)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to an object that is or " + "contains a matrix"; + } + } + } + + if (!IsLogicalPointer(_, inst) || + !IsVariablePointer(_, variable_pointers, inst)) { + return SPV_SUCCESS; + } + + const auto result_type = _.FindDef(inst->type_id()); + const auto untyped = + result_type->opcode() == spv::Op::OpTypeUntypedPointerKHR; + + // Pointers must be selected from the same buffer unless the VariablePointers + // capability is declared. + if (!_.HasCapability(spv::Capability::VariablePointers) && + (inst->opcode() == spv::Op::OpSelect || + inst->opcode() == spv::Op::OpPhi)) { + std::unordered_set sources; + const auto checker = [&sources, &inst]( + ValidationState_t& vstate, + const Instruction* check_inst) -> spv_result_t { + switch (check_inst->opcode()) { + case spv::Op::OpVariable: + case spv::Op::OpUntypedVariableKHR: + if (check_inst->GetOperandAs(2) == + spv::StorageClass::StorageBuffer || + check_inst->GetOperandAs(2) == + spv::StorageClass::Workgroup) { + sources.insert(check_inst); + } + if (sources.size() > 1) { + return vstate.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointers must point into the same structure " + "(or OpConstantNull)"; + } + break; + default: + break; + } + return SPV_SUCCESS; + }; + if (auto error = TraceVariablePointers(_, inst, checker)) { + return error; + } + } + + // Variable pointers must not: + // * point to array of Block- or BufferBlock-decorated structs + // * point to an object that is or contains a matrix + // * point to a column, or component in a column, of a matrix + if (untyped) { + if (auto error = + TraceVariablePointers(_, inst, CheckMatrixElementUntyped)) { + return error; + } + + // Block arrays can only really appear as the top most type so only look at + // unmodified pointers to determine if one is used. + const auto num_operands = inst->operands().size(); + if (!(num_operands == 3 && + (inst->opcode() == spv::Op::OpUntypedAccessChainKHR || + inst->opcode() == spv::Op::OpUntypedInBoundsAccessChainKHR || + inst->opcode() == spv::Op::OpUntypedPtrAccessChainKHR))) { + const auto checker = [&inst]( + ValidationState_t& vstate, + const Instruction* check_inst) -> spv_result_t { + bool fail = false; + if (check_inst->opcode() == spv::Op::OpUntypedVariableKHR) { + if (check_inst->operands().size() > 3) { + const auto type = + vstate.FindDef(check_inst->GetOperandAs(3)); + fail = IsBlockArray(vstate, type); + } + } else if (check_inst->opcode() == spv::Op::OpVariable) { + const auto res_type = vstate.FindDef(check_inst->type_id()); + const auto pointee_type = + vstate.FindDef(res_type->GetOperandAs(2)); + fail = IsBlockArray(vstate, pointee_type); + } + + if (fail) { + return vstate.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to an array of Block- or " + "BufferBlock-decorated structs"; + } + return SPV_SUCCESS; + }; + + if (auto error = TraceUnmodifiedVariablePointers(_, inst, checker)) { + return error; + } + } + } else { + const auto pointee_type = _.FindDef(result_type->GetOperandAs(2)); + if (IsBlockArray(_, pointee_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to an array of Block- or " + "BufferBlock-decorated structs"; + } else if (_.ContainsType( + pointee_type->id(), + [](const Instruction* type_inst) { + return type_inst->opcode() == spv::Op::OpTypeMatrix; + }, + /* traverse_all_types = */ false)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Variable pointer must not point to an object that is or " + "contains a matrix"; + } else if (_.IsFloatScalarOrVectorType(pointee_type->id())) { + // Pointing to a column or component in a column is trickier to detect. + // Trace backwards and check encountered access chains to determine if + // this pointer is pointing into a matrix. + if (auto error = + TraceVariablePointers(_, inst, CheckMatrixElementTyped)) { + return error; + } + } + } + + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t ValidateLogicalPointers(ValidationState_t& _) { + // Only the following addressing models have logical pointers. + if (_.addressing_model() != spv::AddressingModel::Logical && + _.addressing_model() != spv::AddressingModel::PhysicalStorageBuffer64) { + return SPV_SUCCESS; + } + + if (_.options()->relax_logical_pointer) { + return SPV_SUCCESS; + } + + // Cache all variable pointers + std::unordered_map variable_pointers; + for (auto& inst : _.ordered_instructions()) { + if (!IsLogicalPointer(_, &inst)) { + continue; + } + + IsVariablePointer(_, variable_pointers, &inst); + } + + for (auto& inst : _.ordered_instructions()) { + if (auto error = ValidateLogicalPointerOperands(_, &inst)) { + return error; + } + if (auto error = ValidateLogicalPointerReturns(_, &inst)) { + return error; + } + if (auto error = ValidateVariablePointers(_, variable_pointers, &inst)) { + return error; + } + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_logicals.cpp b/third_party/spirv-tools/source/val/validate_logicals.cpp index 8a2e5d8c42..ed868166db 100644 --- a/third_party/spirv-tools/source/val/validate_logicals.cpp +++ b/third_party/spirv-tools/source/val/validate_logicals.cpp @@ -184,6 +184,10 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { dimension = type_inst->word(3); break; } + case spv::Op::OpTypeVectorIdEXT: { + dimension = _.GetDimension(result_type); + break; + } case spv::Op::OpTypeBool: case spv::Op::OpTypeInt: diff --git a/third_party/spirv-tools/source/val/validate_memory.cpp b/third_party/spirv-tools/source/val/validate_memory.cpp index ae7de40d98..dd641cabe2 100644 --- a/third_party/spirv-tools/source/val/validate_memory.cpp +++ b/third_party/spirv-tools/source/val/validate_memory.cpp @@ -15,11 +15,13 @@ // limitations under the License. #include +#include #include #include #include "source/opcode.h" #include "source/spirv_target_env.h" +#include "source/table2.h" #include "source/val/instruction.h" #include "source/val/validate.h" #include "source/val/validate_scopes.h" @@ -196,10 +198,10 @@ bool ContainsInvalidBool(ValidationState_t& _, const Instruction* storage, return false; } -std::pair GetStorageClass( - ValidationState_t& _, const Instruction* inst) { - spv::StorageClass dst_sc = spv::StorageClass::Max; - spv::StorageClass src_sc = spv::StorageClass::Max; +std::pair GetPointerTypes(ValidationState_t& _, + const Instruction* inst) { + Instruction* dst_pointer_type = nullptr; + Instruction* src_pointer_type = nullptr; switch (inst->opcode()) { case spv::Op::OpCooperativeMatrixLoadNV: case spv::Op::OpCooperativeMatrixLoadTensorNV: @@ -207,8 +209,7 @@ std::pair GetStorageClass( case spv::Op::OpCooperativeVectorLoadNV: case spv::Op::OpLoad: { auto load_pointer = _.FindDef(inst->GetOperandAs(2)); - auto load_pointer_type = _.FindDef(load_pointer->type_id()); - dst_sc = load_pointer_type->GetOperandAs(1); + dst_pointer_type = _.FindDef(load_pointer->type_id()); break; } case spv::Op::OpCooperativeMatrixStoreNV: @@ -217,25 +218,23 @@ std::pair GetStorageClass( case spv::Op::OpCooperativeVectorStoreNV: case spv::Op::OpStore: { auto store_pointer = _.FindDef(inst->GetOperandAs(0)); - auto store_pointer_type = _.FindDef(store_pointer->type_id()); - dst_sc = store_pointer_type->GetOperandAs(1); + dst_pointer_type = _.FindDef(store_pointer->type_id()); break; } + // Spec: "Matching Storage Class is not required" case spv::Op::OpCopyMemory: case spv::Op::OpCopyMemorySized: { - auto dst = _.FindDef(inst->GetOperandAs(0)); - auto dst_type = _.FindDef(dst->type_id()); - dst_sc = dst_type->GetOperandAs(1); - auto src = _.FindDef(inst->GetOperandAs(1)); - auto src_type = _.FindDef(src->type_id()); - src_sc = src_type->GetOperandAs(1); + auto dst_pointer = _.FindDef(inst->GetOperandAs(0)); + dst_pointer_type = _.FindDef(dst_pointer->type_id()); + auto src_pointer = _.FindDef(inst->GetOperandAs(1)); + src_pointer_type = _.FindDef(src_pointer->type_id()); break; } default: break; } - return std::make_pair(dst_sc, src_sc); + return std::make_pair(dst_pointer_type, src_pointer_type); } // Returns the number of instruction words taken up by a memory access @@ -288,8 +287,17 @@ bool DoesStructContainRTA(const ValidationState_t& _, const Instruction* inst) { spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst, uint32_t index) { - spv::StorageClass dst_sc, src_sc; - std::tie(dst_sc, src_sc) = GetStorageClass(_, inst); + Instruction* dst_pointer_type = nullptr; + Instruction* src_pointer_type = nullptr; // only used for OpCopyMemory + std::tie(dst_pointer_type, src_pointer_type) = GetPointerTypes(_, inst); + + const spv::StorageClass dst_sc = + dst_pointer_type ? dst_pointer_type->GetOperandAs(1) + : spv::StorageClass::Max; + const spv::StorageClass src_sc = + src_pointer_type ? src_pointer_type->GetOperandAs(1) + : spv::StorageClass::Max; + if (inst->operands().size() <= index) { // Cases where lack of some operand is invalid if (src_sc == spv::StorageClass::PhysicalStorageBuffer || @@ -390,6 +398,32 @@ spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst, << "Memory accesses Aligned operand value " << aligned_value << " is not a power of two."; } + + uint32_t largest_scalar = 0; + if (dst_sc == spv::StorageClass::PhysicalStorageBuffer) { + if (dst_pointer_type->opcode() != spv::Op::OpTypeUntypedPointerKHR) { + largest_scalar = + _.GetLargestScalarType(dst_pointer_type->GetOperandAs(2)); + } else if (inst->type_id() != 0) { + largest_scalar = _.GetLargestScalarType(inst->type_id()); + } else { + // TODO need to handle cases like OpStore and OpCopyMemorySized which + // don't have a result type + } + } + // TODO - Handle Untyped in OpCopyMemory + if (src_sc == spv::StorageClass::PhysicalStorageBuffer && + src_pointer_type->opcode() != spv::Op::OpTypeUntypedPointerKHR) { + largest_scalar = std::max( + largest_scalar, + _.GetLargestScalarType(src_pointer_type->GetOperandAs(2))); + } + if (aligned_value < largest_scalar) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(6314) << "Memory accesses Aligned operand value " + << aligned_value << " is too small, the largest scalar type is " + << largest_scalar << " bytes."; + } } return SPV_SUCCESS; @@ -417,7 +451,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { inst->GetOperandAs(storage_class_index); uint32_t value_id = 0; if (untyped_pointer) { - const auto has_data_type = 3u < inst->operands().size(); + const bool has_data_type = 3u < inst->operands().size(); if (has_data_type) { value_id = inst->GetOperandAs(3u); auto data_type = _.FindDef(value_id); @@ -433,9 +467,23 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { << "Data type must be specified for Function, Private, and " "Workgroup storage classes"; } + // Added from SPV_EXT_descriptor_heap + // Vulkan allows untyped pointer without |Data Type| but only for heap + // decorated variable that are in UniformConstant if (spvIsVulkanEnv(_.context()->target_env)) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Vulkan requires that data type be specified"; + if (storage_class != spv::StorageClass::UniformConstant) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(11167) << "Storage class is " + << StorageClassToString(storage_class) + << ", but Vulkan requires that Data Type be specified when " + "not using UniformConstant storage class"; + } else if (!(_.IsDescriptorHeapBaseVariable(inst))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(11347) + << "Storage class is UniformConstant, but Vulkan requires " + "that Data Type be specified if the variable is not " + "decorated with SamplerHeapEXT or ResourceHeapEXT"; + } } } } @@ -482,6 +530,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { storage_class != spv::StorageClass::IncomingCallableDataKHR && storage_class != spv::StorageClass::TaskPayloadWorkgroupEXT && storage_class != spv::StorageClass::HitObjectAttributeNV && + storage_class != spv::StorageClass::HitObjectAttributeEXT && storage_class != spv::StorageClass::NodePayloadAMDX) { bool storage_input_or_output = storage_class == spv::StorageClass::Input || storage_class == spv::StorageClass::Output; @@ -553,20 +602,38 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { const auto pointee = untyped_pointer ? value_id == 0 ? nullptr : _.FindDef(value_id) : _.FindDef(result_type->word(3)); - if (_.addressing_model() == spv::AddressingModel::Logical && + if ((_.addressing_model() == spv::AddressingModel::Logical || + _.addressing_model() == spv::AddressingModel::PhysicalStorageBuffer64) && !_.options()->relax_logical_pointer) { - // VariablePointersStorageBuffer is implied by VariablePointers. - if (pointee && pointee->opcode() == spv::Op::OpTypePointer) { - if (!_.HasCapability(spv::Capability::VariablePointersStorageBuffer)) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << "In Logical addressing, variables may not allocate a pointer " - << "type"; - } else if (storage_class != spv::StorageClass::Function && - storage_class != spv::StorageClass::Private) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << "In Logical addressing with variable pointers, variables " - << "that allocate pointers must be in Function or Private " - << "storage classes"; + if (pointee && (pointee->opcode() == spv::Op::OpTypePointer || + pointee->opcode() == spv::Op::OpTypeUntypedPointerKHR)) { + const auto sc = pointee->GetOperandAs(1u); + if (sc != spv::StorageClass::PhysicalStorageBuffer) { + if (sc != spv::StorageClass::StorageBuffer && + sc != spv::StorageClass::Workgroup) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "In Logical addressing, variables can only allocate a " + "pointer to the StorageBuffer or Workgroup storage classes"; + } else if (!_.HasCapability( + spv::Capability::VariablePointersStorageBuffer) && + sc == spv::StorageClass::StorageBuffer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "In Logical addressing, variables can only allocate a " + "storage buffer pointer if the " + "VariablePointersStorageBuffer capability is declared"; + } else if (!_.HasCapability(spv::Capability::VariablePointers) && + sc == spv::StorageClass::Workgroup) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "In Logical addressing, variables can only allocate a " + "workgroup pointer if the VariablePointers capability is " + "declared"; + } else if (storage_class != spv::StorageClass::Function && + storage_class != spv::StorageClass::Private) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "In Logical addressing with variable pointers, variables " + << "that allocate pointers must be in Function or Private " + << "storage classes"; + } } } } @@ -705,6 +772,11 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { << "OpVariable, " << _.getIdName(inst->id()) << ", initializer are not allowed for HitObjectAttributeNV"; } + if (storage_class == spv::StorageClass::HitObjectAttributeEXT) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpVariable, " << _.getIdName(inst->id()) + << ", initializer are not allowed for HitObjectAttributeEXT"; + } } if (storage_class == spv::StorageClass::PhysicalStorageBuffer) { @@ -716,16 +788,17 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { if (spvIsVulkanEnv(_.context()->target_env)) { // OpTypeRuntimeArray should only ever be in a container like OpTypeStruct, // so should never appear as a bare variable. - // Unless the module has the RuntimeDescriptorArrayEXT capability. + // Unless the module has the RuntimeDescriptorArray capability. if (value_type && value_type->opcode() == spv::Op::OpTypeRuntimeArray) { - if (!_.HasCapability(spv::Capability::RuntimeDescriptorArrayEXT)) { + if (!_.HasCapability(spv::Capability::RuntimeDescriptorArray)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) << "OpVariable, " << _.getIdName(inst->id()) << ", is attempting to create memory for an illegal type, " << "OpTypeRuntimeArray.\nFor Vulkan OpTypeRuntimeArray can only " << "appear as the final member of an OpTypeStruct, thus cannot " - << "be instantiated via OpVariable"; + << "be instantiated via OpVariable, unless the " + "RuntimeDescriptorArray Capability is declared"; } else { // A bare variable OpTypeRuntimeArray is allowed in this context, but // still need to check the storage class. @@ -734,7 +807,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { storage_class != spv::StorageClass::UniformConstant) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) - << "For Vulkan with RuntimeDescriptorArrayEXT, a variable " + << "For Vulkan with RuntimeDescriptorArray, a variable " << "containing OpTypeRuntimeArray must have storage class of " << "StorageBuffer, Uniform, or UniformConstant."; } @@ -743,8 +816,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { // If an OpStruct has an OpTypeRuntimeArray somewhere within it, then it // must either have the storage class StorageBuffer and be decorated - // with Block, or it must be in the Uniform storage class and be decorated - // as BufferBlock. + // with Block, or it must be in the Uniform storage class if (value_type && value_type->opcode() == spv::Op::OpTypeStruct) { if (DoesStructContainRTA(_, value_type)) { if (storage_class == spv::StorageClass::StorageBuffer || @@ -758,13 +830,14 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { "PhysicalStorageBuffer."; } } else if (storage_class == spv::StorageClass::Uniform) { - if (!_.HasDecoration(value_id, spv::Decoration::BufferBlock)) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << _.VkErrorID(4680) - << "For Vulkan, an OpTypeStruct variable containing an " - << "OpTypeRuntimeArray must be decorated with BufferBlock " - << "if it has storage class Uniform."; - } + // BufferBlock Uniform were always allowed. + // + // Block Uniform use to be invalid, but Vulkan added + // VK_EXT_shader_uniform_buffer_unsized_array and now this is + // validated at runtime + // + // The uniform must have either the Block or BufferBlock decoration + // (see VUID-StandaloneSpirv-Uniform-06676) } else { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) @@ -792,18 +865,72 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { "parameters"; } - if ((storage_class != spv::StorageClass::Function && - storage_class != spv::StorageClass::Private) && - pointee && - _.ContainsType(pointee->id(), [](const Instruction* type_inst) { - auto opcode = type_inst->opcode(); - return opcode == spv::Op::OpTypeCooperativeVectorNV; - })) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Cooperative vector types (or types containing them) can only be " - "allocated " - << "in Function or Private storage classes or as function " - "parameters"; + // Vulkan-specific validation for long vectors + if (spvIsVulkanEnv(_.context()->target_env)) { + if (_.HasCapability(spv::Capability::LongVectorEXT)) { + if ((storage_class != spv::StorageClass::Function && + storage_class != spv::StorageClass::Private && + storage_class != spv::StorageClass::StorageBuffer && + storage_class != spv::StorageClass::PhysicalStorageBuffer && + storage_class != spv::StorageClass::Workgroup && + storage_class != spv::StorageClass::Uniform && + storage_class != spv::StorageClass::PushConstant && + storage_class != spv::StorageClass::ShaderRecordBufferKHR) && + pointee && + _.ContainsType(pointee->id(), [&](const Instruction* type_inst) { + auto opcode = type_inst->opcode(); + if (opcode == spv::Op::OpTypeVector || + opcode == spv::Op::OpTypeVectorIdEXT) { + uint32_t dim = _.GetDimension(type_inst->id()); + return dim > 4; + } + return false; + })) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Long vector types with more than 4 components (or types " + "containing them) not supported in storage class " + << StorageClassToString(storage_class); + } + + if (pointee && + (storage_class == spv::StorageClass::StorageBuffer || + storage_class == spv::StorageClass::PhysicalStorageBuffer || + storage_class == spv::StorageClass::Uniform || + storage_class == spv::StorageClass::PushConstant || + storage_class == spv::StorageClass::ShaderRecordBufferKHR || + (storage_class == spv::StorageClass::Workgroup && + _.HasDecoration(pointee->id(), spv::Decoration::Block))) && + _.ContainsType(pointee->id(), [&](const Instruction* type_inst) { + auto opcode = type_inst->opcode(); + if (opcode == spv::Op::OpTypeVectorIdEXT) { + auto component_count = + _.FindDef(type_inst->GetOperandAs(2u)); + return (bool)spvOpcodeIsSpecConstant(component_count->opcode()); + } + return false; + })) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(12294) + << "Long vector types with spec constant component count " + "not supported in storage class with explicit layout " + << StorageClassToString(storage_class); + } + } else { + if ((storage_class != spv::StorageClass::Function && + storage_class != spv::StorageClass::Private) && + pointee && + _.ContainsType(pointee->id(), [](const Instruction* type_inst) { + auto opcode = type_inst->opcode(); + return opcode == spv::Op::OpTypeVectorIdEXT; + })) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Cooperative vector types (or types containing them) can " + "only be " + "allocated " + << "in Function or Private storage classes or as function " + "parameters"; + } + } } if (_.HasCapability(spv::Capability::Shader)) { @@ -1061,8 +1188,81 @@ spv_result_t ValidateLoad(ValidationState_t& _, const Instruction* inst) { } } + // Skip checking if there is zero chance for this having a mesh shader + // entrypoint + if (_.HasCapability(spv::Capability::MeshShadingEXT) && + pointer_type->GetOperandAs(1) == + spv::StorageClass::Output) { + std::string errorVUID = _.VkErrorID(7107); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [errorVUID](spv::ExecutionModel model, std::string* message) { + // Seems the NV Mesh extension was less strict and allowed + // writting to outputs + if (model == spv::ExecutionModel::MeshEXT) { + if (message) { + *message = errorVUID + + "The Output Storage Class in a Mesh Execution " + "Model must not be read from"; + } + return false; + } + return true; + }); + } + _.RegisterQCOMImageProcessingTextureConsumer(pointer_id, inst, nullptr); + // EXT_descriptor_heap + if (spvIsVulkanEnv(_.context()->target_env) && + _.IsDescriptorHeapBaseVariable(_.FindDef(pointer_id))) { + auto descBaseVariable = _.FindUntypedBaseVariable(_.FindDef(pointer_id)); + auto descBaseVariableId = descBaseVariable->id(); + if (!_.HasDecoration(descBaseVariableId, spv::Decoration::DescriptorSet) && + !_.HasDecoration(descBaseVariableId, spv::Decoration::Binding)) { + switch (result_type->opcode()) { + case spv::Op::OpTypeSampler: + if (!_.IsBuiltin(descBaseVariableId, spv::BuiltIn::SamplerHeapEXT)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(11336) + << "OpTypeSampler pointer instruction has no descriptor set " + << "or binding and is not derived from a variable decorated " + "with " + "SamplerHeapEXT"; + } + break; + case spv::Op::OpTypeImage: + if (!_.IsBuiltin(descBaseVariableId, spv::BuiltIn::ResourceHeapEXT)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(11337) + << "OpTypeImage pointer instruction has no descriptor set " + << "or binding and is not derived from a variable decorated " + "with " + "ResourceHeapEXT"; + } + break; + case spv::Op::OpTypeAccelerationStructureKHR: + uint32_t data_type; + spv::StorageClass sc; + if (_.GetPointerTypeInfo(descBaseVariable->type_id(), &data_type, + &sc) && + sc != spv::StorageClass::Private && + sc != spv::StorageClass::Function && + !_.IsBuiltin(descBaseVariableId, spv::BuiltIn::ResourceHeapEXT)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(11339) + << "OpTypeAccelerationStructureKHR pointer instruction has " + "no " + << "descriptor set or binding and is not derived from a " + "variable decorated with ResourceHeapEXT"; + } + break; + default: + break; + } + } + } + return SPV_SUCCESS; } @@ -1266,7 +1466,7 @@ spv_result_t ValidateCopyMemoryMemoryAccess(ValidationState_t& _, } } else { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(static_cast(inst->opcode())) + << spvOpcodeString(inst->opcode()) << " with two memory access operands requires SPIR-V 1.4 or " "later"; } @@ -1518,9 +1718,7 @@ spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateAccessChain(ValidationState_t& _, const Instruction* inst) { - std::string instr_name = - "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); - + const spv::Op opcode = inst->opcode(); const bool untyped_pointer = spvOpcodeGeneratesUntypedPointer(inst->opcode()); // The result type must be OpTypePointer for regular access chains and an @@ -1530,19 +1728,17 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, if (!result_type || spv::Op::OpTypeUntypedPointerKHR != result_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "The Result Type of " << instr_name << " " + << "The Result Type of Op" << spvOpcodeString(opcode) << " " << _.getIdName(inst->id()) << " must be OpTypeUntypedPointerKHR. Found Op" - << spvOpcodeString(static_cast(result_type->opcode())) - << "."; + << spvOpcodeString(result_type->opcode()) << "."; } } else { if (!result_type || spv::Op::OpTypePointer != result_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "The Result Type of " << instr_name << " " + << "The Result Type of Op" << spvOpcodeString(opcode) << " " << _.getIdName(inst->id()) << " must be OpTypePointer. Found Op" - << spvOpcodeString(static_cast(result_type->opcode())) - << "."; + << spvOpcodeString(result_type->opcode()) << "."; } } @@ -1555,6 +1751,60 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, return _.diag(SPV_ERROR_INVALID_ID, inst) << "Base type must be a non-pointer type"; } + + const auto ContainsBlock = [&_](const Instruction* type_inst) { + if (type_inst->opcode() == spv::Op::OpTypeStruct) { + if (_.HasDecoration(type_inst->id(), spv::Decoration::Block) || + _.HasDecoration(type_inst->id(), spv::Decoration::BufferBlock)) { + return true; + } + } + return false; + }; + + // Block (and BufferBlock) arrays cannot be reinterpreted via untyped access + // chains. + const bool base_type_block_array = + base_type->opcode() == spv::Op::OpTypeArray && + _.ContainsType(base_type->id(), ContainsBlock, + /* traverse_all_types = */ false); + + const auto base_index = untyped_pointer ? 3 : 2; + const auto base_id = inst->GetOperandAs(base_index); + auto base = _.FindDef(base_id); + // Strictly speaking this misses trivial access chains and function + // parameter chasing, but that would be a significant complication in the + // traversal. + while (base->opcode() == spv::Op::OpCopyObject) { + base = _.FindDef(base->GetOperandAs(2)); + } + const Instruction* base_data_type = nullptr; + if (base->opcode() == spv::Op::OpVariable) { + const auto ptr_type = _.FindDef(base->type_id()); + base_data_type = _.FindDef(ptr_type->GetOperandAs(2)); + } else if (base->opcode() == spv::Op::OpUntypedVariableKHR) { + if (base->operands().size() > 3) { + base_data_type = _.FindDef(base->GetOperandAs(3)); + } + } + + if (base_data_type) { + const bool base_block_array = + base_data_type->opcode() == spv::Op::OpTypeArray && + _.ContainsType(base_data_type->id(), ContainsBlock, + /* traverse_all_types = */ false); + + if (base_type_block_array != base_block_array) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Both Base Type and Base must be Block or BufferBlock arrays " + "or neither can be"; + } else if (base_type_block_array && base_block_array && + base_type->id() != base_data_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "If Base or Base Type is a Block or BufferBlock array, the " + "other must also be the same array"; + } + } } // Base must be a pointer, pointing to the base of a composite object. @@ -1566,8 +1816,8 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, (untyped_pointer && spv::Op::OpTypeUntypedPointerKHR == base_type->opcode()))) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "The Base " << _.getIdName(base_id) << " in " << instr_name - << " instruction must be a pointer."; + << "The Base " << _.getIdName(base_id) << " in Op" + << spvOpcodeString(opcode) << " instruction must be a pointer."; } // The result pointer storage class and base pointer storage class must match. @@ -1577,8 +1827,8 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, if (result_type_storage_class != base_type_storage_class) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The result pointer storage class and base " - "pointer storage class in " - << instr_name << " do not match."; + "pointer storage class in Op" + << spvOpcodeString(opcode) << " do not match."; } // The type pointed to by OpTypePointer (word 3) must be a composite type. @@ -1602,8 +1852,9 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, _.options()->universal_limits_.max_access_chain_indexes; if (num_indexes > num_indexes_limit) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "The number of indexes in " << instr_name << " may not exceed " - << num_indexes_limit << ". Found " << num_indexes << " indexes."; + << "The number of indexes in Op" << spvOpcodeString(opcode) + << " may not exceed " << num_indexes_limit << ". Found " + << num_indexes << " indexes."; } // Indexes walk the type hierarchy to the desired depth, potentially down to // scalar granularity. The first index in Indexes will select the top-level @@ -1627,20 +1878,40 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, auto index_type = _.FindDef(cur_word_instr->type_id()); if (!index_type || spv::Op::OpTypeInt != index_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Indexes passed to " << instr_name + << "Indexes passed to Op" << spvOpcodeString(opcode) << " must be of type integer."; } + + // Logical pointer restrictions: any constant index with a signed integer + // type must not have its sign bit set. + if (!_.options()->relax_logical_pointer && + (_.addressing_model() == spv::AddressingModel::Logical || + _.addressing_model() == + spv::AddressingModel::PhysicalStorageBuffer64) && + result_type_storage_class != + static_cast(spv::StorageClass::PhysicalStorageBuffer)) { + if (index_type->GetOperandAs(2) == 1) { + int64_t val = 0; + if (_.EvalConstantValInt64(cur_word, &val)) { + if (val < 0) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Index at word " << i << " may not have a negative value"; + } + } + } + } + switch (type_pointee->opcode()) { case spv::Op::OpTypeMatrix: case spv::Op::OpTypeVector: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: case spv::Op::OpTypeArray: case spv::Op::OpTypeRuntimeArray: case spv::Op::OpTypeNodePayloadArrayAMDX: { // In OpTypeMatrix, OpTypeVector, spv::Op::OpTypeCooperativeMatrixNV, - // OpTypeCooperativeVectorNV, OpTypeArray, and OpTypeRuntimeArray, word + // OpTypeVectorIdEXT, OpTypeArray, and OpTypeRuntimeArray, word // 2 is the Element Type. type_pointee = _.FindDef(type_pointee->word(2)); break; @@ -1651,8 +1922,8 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, int64_t cur_index; if (!_.EvalConstantValInt64(cur_word, &cur_index)) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "The passed to " << instr_name << " to index " - << _.getIdName(cur_word) + << "The passed to Op" << spvOpcodeString(opcode) + << " to index " << _.getIdName(cur_word) << " into a " "structure must be an OpConstant."; } @@ -1663,8 +1934,8 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, static_cast(type_pointee->words().size() - 2); if (cur_index >= num_struct_members || cur_index < 0) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Index " << _.getIdName(cur_word) - << " is out of bounds: " << instr_name << " cannot find index " + << "Index " << _.getIdName(cur_word) << " is out of bounds: Op" + << spvOpcodeString(opcode) << " cannot find index " << cur_index << " into the structure " << _.getIdName(type_pointee->id()) << ". This structure has " << num_struct_members << " members. Largest valid index is " @@ -1679,7 +1950,7 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, default: { // Give an error. reached non-composite type while indexes still remain. return _.diag(SPV_ERROR_INVALID_ID, inst) - << instr_name + << "Op" << spvOpcodeString(opcode) << " reached non-composite type while indexes " "still remain to be traversed."; } @@ -1694,15 +1965,19 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, // At this point, we have fully walked down from the base using the indeces. // The type being pointed to should be the same as the result type. if (type_pointee->id() != result_type_pointee->id()) { + bool same_type = result_type_pointee->opcode() == type_pointee->opcode(); return _.diag(SPV_ERROR_INVALID_ID, inst) - << instr_name << " result type (Op" - << spvOpcodeString( - static_cast(result_type_pointee->opcode())) + << "Op" << spvOpcodeString(opcode) << " result type " + << _.getIdName(result_type_pointee->id()) << " (Op" + << spvOpcodeString(result_type_pointee->opcode()) << ") does not match the type that results from indexing into the " "base " - " (Op" - << spvOpcodeString(static_cast(type_pointee->opcode())) - << ")."; + " " + << _.getIdName(type_pointee->id()) << " (Op" + << spvOpcodeString(type_pointee->opcode()) << ")." + << (same_type ? " (The types must be the exact same Id, so the " + "two types referenced are slighlty different)" + : ""); } } @@ -1711,13 +1986,12 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, spv_result_t ValidateRawAccessChain(ValidationState_t& _, const Instruction* inst) { - std::string instr_name = "Op" + std::string(spvOpcodeString(inst->opcode())); - + const spv::Op opcode = inst->opcode(); // The result type must be OpTypePointer. const auto result_type = _.FindDef(inst->type_id()); if (spv::Op::OpTypePointer != result_type->opcode()) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The Result Type of " << instr_name << " " + << "The Result Type of Op" << spvOpcodeString(opcode) << " " << _.getIdName(inst->id()) << " must be OpTypePointer. Found Op" << spvOpcodeString(result_type->opcode()) << '.'; } @@ -1728,7 +2002,7 @@ spv_result_t ValidateRawAccessChain(ValidationState_t& _, storage_class != spv::StorageClass::PhysicalStorageBuffer && storage_class != spv::StorageClass::Uniform) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The Result Type of " << instr_name << " " + << "The Result Type of Op" << spvOpcodeString(opcode) << " " << _.getIdName(inst->id()) << " must point to a storage class of " "StorageBuffer, PhysicalStorageBuffer, or Uniform."; @@ -1741,7 +2015,7 @@ spv_result_t ValidateRawAccessChain(ValidationState_t& _, result_type_pointee->opcode() == spv::Op::OpTypeMatrix || result_type_pointee->opcode() == spv::Op::OpTypeStruct) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The Result Type of " << instr_name << " " + << "The Result Type of Op" << spvOpcodeString(opcode) << " " << _.getIdName(inst->id()) << " must not point to " "OpTypeArray, OpTypeMatrix, or OpTypeStruct."; @@ -1751,7 +2025,7 @@ spv_result_t ValidateRawAccessChain(ValidationState_t& _, const auto stride = _.FindDef(inst->GetOperandAs(3)); if (stride->opcode() != spv::Op::OpConstant) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The Stride of " << instr_name << " " + << "The Stride of Op" << spvOpcodeString(opcode) << " " << _.getIdName(inst->id()) << " must be OpConstant. Found Op" << spvOpcodeString(stride->opcode()) << '.'; } @@ -1759,7 +2033,7 @@ spv_result_t ValidateRawAccessChain(ValidationState_t& _, const auto stride_type = _.FindDef(stride->type_id()); if (stride_type->opcode() != spv::Op::OpTypeInt) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The type of Stride of " << instr_name << " " + << "The type of Stride of Op" << spvOpcodeString(opcode) << " " << _.getIdName(inst->id()) << " must be OpTypeInt. Found Op" << spvOpcodeString(stride_type->opcode()) << '.'; } @@ -1771,16 +2045,17 @@ spv_result_t ValidateRawAccessChain(ValidationState_t& _, const auto value_type = _.FindDef(value->type_id()); if (value_type->opcode() != spv::Op::OpTypeInt) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The type of " << name << " of " << instr_name << " " - << _.getIdName(inst->id()) << " must be OpTypeInt. Found Op" + << "The type of " << name << " of Op" << spvOpcodeString(opcode) + << " " << _.getIdName(inst->id()) + << " must be OpTypeInt. Found Op" << spvOpcodeString(value_type->opcode()) << '.'; } const auto width = value_type->GetOperandAs(1); if (width != 32) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The integer width of " << name << " of " << instr_name - << " " << _.getIdName(inst->id()) << " must be 32. Found " - << width << '.'; + << "The integer width of " << name << " of Op" + << spvOpcodeString(opcode) << " " << _.getIdName(inst->id()) + << " must be 32. Found " << width << '.'; } return SPV_SUCCESS; }; @@ -1831,28 +2106,39 @@ spv_result_t ValidateRawAccessChain(ValidationState_t& _, spv_result_t ValidatePtrAccessChain(ValidationState_t& _, const Instruction* inst) { - if (_.addressing_model() == spv::AddressingModel::Logical && - inst->opcode() == spv::Op::OpPtrAccessChain) { - if (!_.features().variable_pointers) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Generating variable pointers requires capability " - << "VariablePointers or VariablePointersStorageBuffer"; - } - } - // Need to call first, will make sure Base is a valid ID if (auto error = ValidateAccessChain(_, inst)) return error; const bool untyped_pointer = spvOpcodeGeneratesUntypedPointer(inst->opcode()); - const auto base_id = inst->GetOperandAs(2); - const auto base = _.FindDef(base_id); - const auto base_type = untyped_pointer - ? _.FindDef(inst->GetOperandAs(2)) - : _.FindDef(base->type_id()); + const auto base_idx = untyped_pointer ? 3 : 2; + const auto base = _.FindDef(inst->GetOperandAs(base_idx)); + const auto base_type = _.FindDef(base->type_id()); const auto base_type_storage_class = base_type->GetOperandAs(1); + const auto element_idx = untyped_pointer ? 4 : 3; + const auto element = _.FindDef(inst->GetOperandAs(element_idx)); + const auto element_type = _.FindDef(element->type_id()); + if (!element_type || element_type->opcode() != spv::Op::OpTypeInt) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Element must be an integer"; + } + uint64_t element_val = 0; + if (_.EvalConstantValUint64(element->id(), &element_val)) { + if (element_val != 0) { + const auto interp_type = + untyped_pointer ? _.FindDef(inst->GetOperandAs(2)) + : _.FindDef(base_type->GetOperandAs(2)); + if (interp_type->opcode() == spv::Op::OpTypeStruct && + (_.HasDecoration(interp_type->id(), spv::Decoration::Block) || + _.HasDecoration(interp_type->id(), spv::Decoration::BufferBlock))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Element must be 0 if the interpretation type is a Block- or " + "BufferBlock-decorated structure"; + } + } + } + if (_.HasCapability(spv::Capability::Shader) && (base_type_storage_class == spv::StorageClass::Uniform || base_type_storage_class == spv::StorageClass::StorageBuffer || @@ -1860,10 +2146,11 @@ spv_result_t ValidatePtrAccessChain(ValidationState_t& _, base_type_storage_class == spv::StorageClass::PushConstant || (_.HasCapability(spv::Capability::WorkgroupMemoryExplicitLayoutKHR) && base_type_storage_class == spv::StorageClass::Workgroup)) && - !_.HasDecoration(base_type->id(), spv::Decoration::ArrayStride)) { + (!_.HasDecoration(base_type->id(), spv::Decoration::ArrayStride) && + !_.HasDecoration(base_type->id(), spv::Decoration::ArrayStrideIdEXT))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "OpPtrAccessChain must have a Base whose type is decorated " - "with ArrayStride"; + "with ArrayStride or ArrayStrideIdEXT"; } if (spvIsVulkanEnv(_.context()->target_env)) { @@ -1899,32 +2186,39 @@ spv_result_t ValidatePtrAccessChain(ValidationState_t& _, spv_result_t ValidateArrayLength(ValidationState_t& state, const Instruction* inst) { - std::string instr_name = - "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); + const spv::Op opcode = inst->opcode(); - // Result type must be a 32-bit unsigned int. - auto result_type = state.FindDef(inst->type_id()); - if (result_type->opcode() != spv::Op::OpTypeInt || - result_type->GetOperandAs(1) != 32 || - result_type->GetOperandAs(2) != 0) { + // Result type must be a 32- or 64-bit unsigned int. + // 64-bit requires CapabilityShader64BitIndexingEXT or a pipeline/shader + // flag and is validated in VVL. + const uint32_t result_type_id = inst->type_id(); + if (!state.IsIntScalarTypeWithSignedness(result_type_id, 0)) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "The Result Type of " << instr_name << " " + << "The Result Type of Op" << spvOpcodeString(opcode) << " " << state.getIdName(inst->id()) - << " must be OpTypeInt with width 32 and signedness 0."; + << " must be OpTypeInt with width 32 or 64 and signedness 0."; + } + const uint32_t result_type_width = state.GetBitWidth(inst->type_id()); + if (result_type_width != 32 && result_type_width != 64) { + return state.diag(SPV_ERROR_INVALID_ID, inst) + << "The Result Type of Op" << spvOpcodeString(opcode) << " " + << state.getIdName(inst->id()) + << " must be OpTypeInt with width 32 or 64 and signedness 0."; } const bool untyped = inst->opcode() == spv::Op::OpUntypedArrayLengthKHR; auto pointer_ty_id = state.GetOperandTypeId(inst, (untyped ? 3 : 2)); auto pointer_ty = state.FindDef(pointer_ty_id); if (untyped) { - if (pointer_ty->opcode() != spv::Op::OpTypeUntypedPointerKHR) { + if (!pointer_ty || + pointer_ty->opcode() != spv::Op::OpTypeUntypedPointerKHR) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "Pointer must be an untyped pointer"; + << "Pointer must be an untyped pointer object"; } } else if (pointer_ty->opcode() != spv::Op::OpTypePointer) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "The Structure's type in " << instr_name << " " - << state.getIdName(inst->id()) + << "The Structure's type in Op" << spvOpcodeString(opcode) + << " " << state.getIdName(inst->id()) << " must be a pointer to an OpTypeStruct."; } @@ -1937,8 +2231,8 @@ spv_result_t ValidateArrayLength(ValidationState_t& state, if (structure_type->opcode() != spv::Op::OpTypeStruct) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "The Structure's type in " << instr_name << " " - << state.getIdName(inst->id()) + << "The Structure's type in Op" << spvOpcodeString(opcode) + << " " << state.getIdName(inst->id()) << " must be a pointer to an OpTypeStruct."; } @@ -1947,8 +2241,9 @@ spv_result_t ValidateArrayLength(ValidationState_t& state, state.FindDef(structure_type->GetOperandAs(num_of_members)); if (last_member->opcode() != spv::Op::OpTypeRuntimeArray) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "The Structure's last member in " << instr_name << " " - << state.getIdName(inst->id()) << " must be an OpTypeRuntimeArray."; + << "The Structure's last member in Op" << spvOpcodeString(opcode) + << " " << state.getIdName(inst->id()) + << " must be an OpTypeRuntimeArray."; } // The array member must the index of the last element (the run time @@ -1956,25 +2251,34 @@ spv_result_t ValidateArrayLength(ValidationState_t& state, const auto index = untyped ? 4 : 3; if (inst->GetOperandAs(index) != num_of_members - 1) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "The array member in " << instr_name << " " + << "The array member in Op" << spvOpcodeString(opcode) << " " << state.getIdName(inst->id()) << " must be the last member of the struct."; } + + if (spvIsVulkanEnv(state.context()->target_env)) { + const auto storage_class = pointer_ty->GetOperandAs(1); + if (storage_class == spv::StorageClass::Uniform && + state.HasDecoration(structure_type->id(), spv::Decoration::Block)) { + return state.diag(SPV_ERROR_INVALID_ID, inst) + << state.VkErrorID(11805) << "Op" << spvOpcodeString(opcode) + << " must not be used on the OpTypeRuntimeArray inside a Uniform " + "block"; + } + } + return SPV_SUCCESS; } spv_result_t ValidateCooperativeMatrixLengthNV(ValidationState_t& state, const Instruction* inst) { - std::string instr_name = - "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); - + const spv::Op opcode = inst->opcode(); // Result type must be a 32-bit unsigned int. - auto result_type = state.FindDef(inst->type_id()); - if (result_type->opcode() != spv::Op::OpTypeInt || - result_type->GetOperandAs(1) != 32 || - result_type->GetOperandAs(2) != 0) { + const uint32_t result_type_id = inst->type_id(); + if (!state.IsIntScalarTypeWithSignedness(result_type_id, 0) || + state.GetBitWidth(inst->type_id()) != 32) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "The Result Type of " << instr_name << " " + << "The Result Type of Op" << spvOpcodeString(opcode) << " " << state.getIdName(inst->id()) << " must be OpTypeInt with width 32 and signedness 0."; } @@ -1984,12 +2288,12 @@ spv_result_t ValidateCooperativeMatrixLengthNV(ValidationState_t& state, auto type = state.FindDef(type_id); if (isKhr && type->opcode() != spv::Op::OpTypeCooperativeMatrixKHR) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "The type in " << instr_name << " " + << "The type in Op" << spvOpcodeString(opcode) << " " << state.getIdName(type_id) << " must be OpTypeCooperativeMatrixKHR."; } else if (!isKhr && type->opcode() != spv::Op::OpTypeCooperativeMatrixNV) { return state.diag(SPV_ERROR_INVALID_ID, inst) - << "The type in " << instr_name << " " + << "The type in Op" << spvOpcodeString(opcode) << " " << state.getIdName(type_id) << " must be OpTypeCooperativeMatrixNV."; } return SPV_SUCCESS; @@ -2192,23 +2496,96 @@ spv_result_t ValidateCooperativeMatrixLoadStoreKHR(ValidationState_t& _, } bool stride_required = false; + bool layout_requires_constant_stride = false; uint64_t layout; if (_.EvalConstantValUint64(layout_id, &layout)) { + const bool is_arm_layout = + (layout == + (uint64_t)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM) || + (layout == + (uint64_t)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM); + + if (is_arm_layout) { + if (!_.HasCapability(spv::Capability::CooperativeMatrixLayoutsARM)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Using the RowBlockedInterleavedARM or " + "ColumnBlockedInterleavedARM MemoryLayout requires the " + "CooperativeMatrixLayoutsARM capability be declared"; + } + } + stride_required = (layout == (uint64_t)spv::CooperativeMatrixLayout::RowMajorKHR) || - (layout == (uint64_t)spv::CooperativeMatrixLayout::ColumnMajorKHR); + (layout == (uint64_t)spv::CooperativeMatrixLayout::ColumnMajorKHR) || + is_arm_layout; + layout_requires_constant_stride = is_arm_layout; } const auto stride_index = (inst->opcode() == spv::Op::OpCooperativeMatrixLoadKHR) ? 4u : 3u; if (inst->operands().size() > stride_index) { const auto stride_id = inst->GetOperandAs(stride_index); - const auto stride = _.FindDef(stride_id); - if (!stride || !_.IsIntScalarType(stride->type_id())) { + const auto stride_inst = _.FindDef(stride_id); + if (!stride_inst || !_.IsIntScalarType(stride_inst->type_id())) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Stride operand " << _.getIdName(stride_id) << " must be a scalar integer type."; } + // Check SPV_ARM_cooperative_matrix_layouts constraints + if (layout_requires_constant_stride && + !spvOpcodeIsConstant(stride_inst->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "MemoryLayout " << layout + << " requires Stride come from a constant instruction."; + } + if (layout_requires_constant_stride) { + uint64_t stride; + if (_.EvalConstantValUint64(stride_id, &stride)) { + if ((layout == + (uint64_t) + spv::CooperativeMatrixLayout::RowBlockedInterleavedARM) || + (layout == + (uint64_t) + spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM)) { + if ((stride != 1) && (stride != 2) && (stride != 4)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "MemoryLayout " << layout + << " requires Stride be 1, 2, or 4."; + } + } + const uint32_t elty_id = matrix_type->GetOperandAs(1); + const uint32_t rows_id = matrix_type->GetOperandAs(3); + const uint32_t cols_id = matrix_type->GetOperandAs(4); + uint64_t rows = 0, cols = 0; + _.EvalConstantValUint64(rows_id, &rows); + _.EvalConstantValUint64(cols_id, &cols); + uint32_t sizeof_component_in_bytes = _.GetBitWidth(elty_id) / 8; + uint64_t rows_required_multiple = 4; + uint64_t cols_required_multiple = 16 / sizeof_component_in_bytes; + + if (layout == + (uint64_t)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM) { + cols_required_multiple *= stride; + } + if (layout == + (uint64_t) + spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM) { + rows_required_multiple *= stride; + } + if ((rows != 0) && (rows % rows_required_multiple != 0)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "MemoryLayout " << layout << " with a Stride of " << stride + << " requires that the number of rows be a multiple of " + << rows_required_multiple; + } + if ((cols != 0) && (cols % cols_required_multiple != 0)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "MemoryLayout " << layout << " with a Stride of " << stride + << " requires that the number of columns be a multiple of " + << cols_required_multiple; + } + } + } } else if (stride_required) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "MemoryLayout " << layout << " requires a Stride."; @@ -2224,6 +2601,27 @@ spv_result_t ValidateCooperativeMatrixLoadStoreKHR(ValidationState_t& _, return SPV_SUCCESS; } +spv_result_t ValidateBufferPointerEXT(ValidationState_t& _, + const Instruction* inst) { + const auto storage_class_ptr = _.FindDef(inst->GetOperandAs(0)); + if (storage_class_ptr->opcode() != spv::Op::OpTypeUntypedPointerKHR && + storage_class_ptr->opcode() != spv::Op::OpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpBufferPointerEXT's Result Type should be " + << "a pointer type."; + } else { + // Buffer operand + auto buffer = + _.FindUntypedBaseVariable(_.FindDef(inst->GetOperandAs(2))); + if (!_.IsBuiltin(buffer->id(), spv::BuiltIn::ResourceHeapEXT)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpBufferPointerEXT's buffer must be an untyped pointer" + << " into a variable declared with the ResourceHeapEXT built-in"; + } + } + return SPV_SUCCESS; +} + // Returns the number of instruction words taken up by a tensor addressing // operands argument and its implied operands. int TensorAddressingOperandsNumWords(spv::TensorAddressingOperandsMask mask) { @@ -2446,7 +2844,7 @@ spv_result_t ValidateInt32Operand(ValidationState_t& _, const Instruction* inst, const char* operand_name) { const auto type_id = _.FindDef(inst->GetOperandAs(operand_index))->type_id(); - if (!_.IsIntScalarType(type_id) || _.GetBitWidth(type_id) != 32) { + if (!_.IsIntScalarType(type_id, 32)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opcode_name << " " << operand_name << " type " << _.getIdName(type_id) << " is not a 32 bit integer."; @@ -2454,6 +2852,23 @@ spv_result_t ValidateInt32Operand(ValidationState_t& _, const Instruction* inst, return SPV_SUCCESS; } +spv_result_t ValidateInt32Or64Operand(ValidationState_t& _, + const Instruction* inst, + uint32_t operand_index, + const char* opcode_name, + const char* operand_name) { + const auto type_id = + _.FindDef(inst->GetOperandAs(operand_index))->type_id(); + if (!_.IsIntScalarType(type_id) || + !(_.GetBitWidth(type_id) == 32 || _.GetBitWidth(type_id) == 64)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " " << operand_name << " type " + << _.getIdName(type_id) << " is not a 32 or 64 bit integer."; + } + + return SPV_SUCCESS; +} + spv_result_t ValidateCooperativeVectorPointer(ValidationState_t& _, const Instruction* inst, const char* opname, @@ -2529,7 +2944,7 @@ spv_result_t ValidateCooperativeVectorLoadStoreNV(ValidationState_t& _, auto vector_type = _.FindDef(type_id); - if (vector_type->opcode() != spv::Op::OpTypeCooperativeVectorNV) { + if (vector_type->opcode() != spv::Op::OpTypeVectorIdEXT) { if (inst->opcode() == spv::Op::OpCooperativeVectorLoadNV) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "spv::Op::OpCooperativeVectorLoadNV Result Type " @@ -2544,11 +2959,19 @@ spv_result_t ValidateCooperativeVectorLoadStoreNV(ValidationState_t& _, const auto pointer_index = (inst->opcode() == spv::Op::OpCooperativeVectorLoadNV) ? 2u : 0u; + const auto offset_index = + (inst->opcode() == spv::Op::OpCooperativeVectorLoadNV) ? 3u : 1u; + if (auto error = ValidateCooperativeVectorPointer(_, inst, opname, pointer_index)) { return error; } + if (auto error = + ValidateInt32Or64Operand(_, inst, offset_index, opname, "Offset")) { + return error; + } + const auto memory_access_index = (inst->opcode() == spv::Op::OpCooperativeVectorLoadNV) ? 4u : 3u; if (inst->operands().size() > memory_access_index) { @@ -2573,7 +2996,7 @@ spv_result_t ValidateCooperativeVectorOuterProductNV(ValidationState_t& _, auto type_id = _.FindDef(inst->GetOperandAs(2))->type_id(); auto a_type = _.FindDef(type_id); - if (a_type->opcode() != spv::Op::OpTypeCooperativeVectorNV) { + if (a_type->opcode() != spv::Op::OpTypeVectorIdEXT) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opcode_name << " A type " << _.getIdName(type_id) << " is not a cooperative vector type."; @@ -2582,7 +3005,7 @@ spv_result_t ValidateCooperativeVectorOuterProductNV(ValidationState_t& _, type_id = _.FindDef(inst->GetOperandAs(3))->type_id(); auto b_type = _.FindDef(type_id); - if (b_type->opcode() != spv::Op::OpTypeCooperativeVectorNV) { + if (b_type->opcode() != spv::Op::OpTypeVectorIdEXT) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opcode_name << " B type " << _.getIdName(type_id) << " is not a cooperative vector type."; @@ -2598,7 +3021,8 @@ spv_result_t ValidateCooperativeVectorOuterProductNV(ValidationState_t& _, << _.getIdName(b_component_type_id) << " do not match."; } - if (auto error = ValidateInt32Operand(_, inst, 1, opcode_name, "Offset")) { + if (auto error = + ValidateInt32Or64Operand(_, inst, 1, opcode_name, "Offset")) { return error; } @@ -2635,13 +3059,14 @@ spv_result_t ValidateCooperativeVectorReduceSumNV(ValidationState_t& _, auto type_id = _.FindDef(inst->GetOperandAs(2))->type_id(); auto v_type = _.FindDef(type_id); - if (v_type->opcode() != spv::Op::OpTypeCooperativeVectorNV) { + if (v_type->opcode() != spv::Op::OpTypeVectorIdEXT) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opcode_name << " V type " << _.getIdName(type_id) << " is not a cooperative vector type."; } - if (auto error = ValidateInt32Operand(_, inst, 1, opcode_name, "Offset")) { + if (auto error = + ValidateInt32Or64Operand(_, inst, 1, opcode_name, "Offset")) { return error; } @@ -2674,8 +3099,10 @@ spv_result_t ValidateCooperativeVectorMatrixMulNV(ValidationState_t& _, const auto input_index = 2u; const auto input_interpretation_index = 3u; const auto matrix_index = 4u; + const auto matrix_offset_index = 5u; const auto matrix_interpretation_index = 6u; const auto bias_index = 7u; + const auto bias_offset_index = 8u; const auto bias_interpretation_index = 9u; const auto m_index = 7u + bias_offset; const auto k_index = 8u + bias_offset; @@ -2710,18 +3137,16 @@ spv_result_t ValidateCooperativeVectorMatrixMulNV(ValidationState_t& _, const auto result_type = _.FindDef(result_type_id); - if (result_type->opcode() != spv::Op::OpTypeCooperativeVectorNV) { + if (result_type->opcode() != spv::Op::OpTypeVectorIdEXT) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opcode_name << " result type " << _.getIdName(result_type_id) << " is not a cooperative vector type."; } const auto result_component_type_id = result_type->GetOperandAs(1u); - if (!(_.IsIntScalarType(result_component_type_id) && - _.GetBitWidth(result_component_type_id) == 32) && - !(_.IsFloatScalarType(result_component_type_id) && - (_.GetBitWidth(result_component_type_id) == 32 || - _.GetBitWidth(result_component_type_id) == 16))) { + if (!_.IsIntScalarType(result_component_type_id, 32) && + !_.IsFloatScalarType(result_component_type_id, 32) && + !_.IsFloatScalarType(result_component_type_id, 16)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opcode_name << " result component type " << _.getIdName(result_component_type_id) @@ -2823,15 +3248,33 @@ spv_result_t ValidateCooperativeVectorMatrixMulNV(ValidationState_t& _, return error; } + if (auto error = ValidateInt32Or64Operand(_, inst, matrix_offset_index, + opcode_name, "MatrixOffset")) { + return error; + } + if (has_bias) { + if (auto error = ValidateInt32Or64Operand(_, inst, bias_offset_index, + opcode_name, "BiasOffset")) { + return error; + } + } + return SPV_SUCCESS; } spv_result_t ValidatePtrComparison(ValidationState_t& _, const Instruction* inst) { - if (_.addressing_model() == spv::AddressingModel::Logical && + const auto op1 = _.FindDef(inst->GetOperandAs(2u)); + const auto op2 = _.FindDef(inst->GetOperandAs(3u)); + const auto op1_type = _.FindDef(op1->type_id()); + const auto op2_type = _.FindDef(op2->type_id()); + spv::StorageClass sc = op1_type->GetOperandAs(1u); + if ((_.addressing_model() == spv::AddressingModel::Logical || + _.addressing_model() == spv::AddressingModel::PhysicalStorageBuffer64) && + sc != spv::StorageClass::PhysicalStorageBuffer && !_.features().variable_pointers) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Instruction cannot for logical addressing model be used without " + << "Instruction on logical pointers cannot be used without " "a variable pointers capability"; } @@ -2848,10 +3291,6 @@ spv_result_t ValidatePtrComparison(ValidationState_t& _, } } - const auto op1 = _.FindDef(inst->GetOperandAs(2u)); - const auto op2 = _.FindDef(inst->GetOperandAs(3u)); - const auto op1_type = _.FindDef(op1->type_id()); - const auto op2_type = _.FindDef(op2->type_id()); if (!op1_type || (op1_type->opcode() != spv::Op::OpTypePointer && op1_type->opcode() != spv::Op::OpTypeUntypedPointerKHR)) { return _.diag(SPV_ERROR_INVALID_ID, inst) @@ -2886,7 +3325,6 @@ spv_result_t ValidatePtrComparison(ValidationState_t& _, } } - spv::StorageClass sc = op1_type->GetOperandAs(1u); if (_.addressing_model() == spv::AddressingModel::Logical) { if (sc != spv::StorageClass::Workgroup && sc != spv::StorageClass::StorageBuffer) { @@ -2916,6 +3354,9 @@ spv_result_t MemoryPass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpUntypedVariableKHR: if (auto error = ValidateVariable(_, inst)) return error; break; + case spv::Op::OpBufferPointerEXT: + if (auto error = ValidateBufferPointerEXT(_, inst)) return error; + break; case spv::Op::OpLoad: if (auto error = ValidateLoad(_, inst)) return error; break; diff --git a/third_party/spirv-tools/source/val/validate_memory_semantics.cpp b/third_party/spirv-tools/source/val/validate_memory_semantics.cpp index d94d37dbf4..1cee9f1234 100644 --- a/third_party/spirv-tools/source/val/validate_memory_semantics.cpp +++ b/third_party/spirv-tools/source/val/validate_memory_semantics.cpp @@ -32,6 +32,9 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, uint32_t value = 0; std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(id); + const bool is_vulkan = spvIsVulkanEnv(_.context()->target_env) || + _.memory_model() == spv::MemoryModel::VulkanKHR; + if (!is_int32) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) @@ -56,6 +59,21 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, return SPV_SUCCESS; } + if (value & uint32_t(spv::MemorySemanticsMask::UniformMemory) && + !_.HasCapability(spv::Capability::Shader)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Memory Semantics UniformMemory requires capability Shader"; + } + + if (value & uint32_t(spv::MemorySemanticsMask::OutputMemoryKHR) && + !_.HasCapability(spv::Capability::VulkanMemoryModel)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Memory Semantics OutputMemoryKHR requires capability " + << "VulkanMemoryModelKHR"; + } + const size_t num_memory_order_set_bits = spvtools::utils::CountSetBits( value & uint32_t(spv::MemorySemanticsMask::Acquire | spv::MemorySemanticsMask::Release | @@ -64,197 +82,207 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, if (num_memory_order_set_bits > 1) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": Memory Semantics can have at most one of the following " - "bits set: Acquire, Release, AcquireRelease or " - "SequentiallyConsistent"; + << _.VkErrorID(10865) << spvOpcodeString(opcode) + << ": Memory Semantics must have at most one non-relaxed " + "memory order bit set"; } - if (_.memory_model() == spv::MemoryModel::VulkanKHR && - value & uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent)) { + if (is_vulkan && + (value & uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "SequentiallyConsistent memory " - "semantics cannot be used with " - "the VulkanKHR memory model."; + << _.VkErrorID(10866) << spvOpcodeString(opcode) + << ": Memory Semantics with SequentiallyConsistent memory order " + "must not be used in the Vulkan API"; } - if (value & uint32_t(spv::MemorySemanticsMask::MakeAvailableKHR) && - !_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { + if ((opcode == spv::Op::OpAtomicStore || + opcode == spv::Op::OpAtomicFlagClear) && + (value & uint32_t(spv::MemorySemanticsMask::Acquire) || + value & uint32_t(spv::MemorySemanticsMask::AcquireRelease))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": Memory Semantics MakeAvailableKHR requires capability " - << "VulkanMemoryModelKHR"; + << _.VkErrorID(10867) << spvOpcodeString(opcode) + << ": MemorySemantics must not use Acquire or AcquireRelease " + "memory order with " + << spvOpcodeString(opcode); } - if (value & uint32_t(spv::MemorySemanticsMask::MakeVisibleKHR) && - !_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { + if (opcode == spv::Op::OpAtomicLoad && + (value & uint32_t(spv::MemorySemanticsMask::Release) || + value & uint32_t(spv::MemorySemanticsMask::AcquireRelease))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": Memory Semantics MakeVisibleKHR requires capability " - << "VulkanMemoryModelKHR"; + << _.VkErrorID(10868) << spvOpcodeString(opcode) + << ": MemorySemantics must not use Release or AcquireRelease " + "memory order with " + << spvOpcodeString(opcode); } - if (value & uint32_t(spv::MemorySemanticsMask::OutputMemoryKHR) && - !_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { + // In OpenCL, a relaxed fence has no effect but is not explicitly forbidden + if (is_vulkan && opcode == spv::Op::OpMemoryBarrier && + !num_memory_order_set_bits) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": Memory Semantics OutputMemoryKHR requires capability " - << "VulkanMemoryModelKHR"; + << _.VkErrorID(10869) << spvOpcodeString(opcode) + << ": MemorySemantics must not use Relaxed memory order with " + << spvOpcodeString(opcode); + } + + if (is_vulkan) { + const bool includes_storage_class = + value & uint32_t(spv::MemorySemanticsMask::UniformMemory | + spv::MemorySemanticsMask::WorkgroupMemory | + spv::MemorySemanticsMask::ImageMemory | + spv::MemorySemanticsMask::OutputMemoryKHR); + + if (num_memory_order_set_bits && !includes_storage_class) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(10870) << spvOpcodeString(opcode) + << ": Memory Semantics with a non-relaxed memory order (Acquire, " + "Release, or AcquireRelease) must have at least one " + "Vulkan-supported storage class semantics bit set " + "(UniformMemory, WorkgroupMemory, ImageMemory, or " + "OutputMemory)"; + } + + if (!num_memory_order_set_bits && includes_storage_class) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(10871) << spvOpcodeString(opcode) + << ": Memory Semantics with at least one Vulkan-supported " + "storage class semantics bit set (UniformMemory, " + "WorkgroupMemory, ImageMemory, or OutputMemory) must use " + "a non-relaxed memory order (Acquire, Release, or " + "AcquireRelease)"; + } + } + + if (value & uint32_t(spv::MemorySemanticsMask::MakeAvailableKHR)) { + if (!_.HasCapability(spv::Capability::VulkanMemoryModel)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Memory Semantics MakeAvailableKHR requires capability " + << "VulkanMemoryModelKHR"; + } + if (!(value & uint32_t(spv::MemorySemanticsMask::Release | + spv::MemorySemanticsMask::AcquireRelease))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(10872) << spvOpcodeString(opcode) + << ": Memory Semantics with MakeAvailable bit set must use " + "Release or AcquireRelease memory order"; + } + } + + if (value & uint32_t(spv::MemorySemanticsMask::MakeVisibleKHR)) { + if (!_.HasCapability(spv::Capability::VulkanMemoryModel)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Memory Semantics MakeVisibleKHR requires capability " + << "VulkanMemoryModelKHR"; + } + if (!(value & uint32_t(spv::MemorySemanticsMask::Acquire | + spv::MemorySemanticsMask::AcquireRelease))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(10873) << spvOpcodeString(opcode) + << ": Memory Semantics with MakeVisible bit set must use Acquire " + "or AcquireRelease memory order"; + } } if (value & uint32_t(spv::MemorySemanticsMask::Volatile)) { - if (!_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { + if (!_.HasCapability(spv::Capability::VulkanMemoryModel)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Memory Semantics Volatile requires capability " "VulkanMemoryModelKHR"; } - if (!spvOpcodeIsAtomicOp(inst->opcode())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Memory Semantics Volatile can only be used with atomic " - "instructions"; + << _.VkErrorID(10874) << spvOpcodeString(opcode) + << ": Memory Semantics with Volatile bit set must not be used " + "with barrier instructions"; } } - if (value & uint32_t(spv::MemorySemanticsMask::UniformMemory) && - !_.HasCapability(spv::Capability::Shader)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": Memory Semantics UniformMemory requires capability Shader"; - } - - // Checking for spv::Capability::AtomicStorage is intentionally not done here. - // See https://github.com/KhronosGroup/glslang/issues/1618 for the reasoning - // why. - - if (value & uint32_t(spv::MemorySemanticsMask::MakeAvailableKHR | - spv::MemorySemanticsMask::MakeVisibleKHR)) { - const bool includes_storage_class = - value & uint32_t(spv::MemorySemanticsMask::UniformMemory | - spv::MemorySemanticsMask::SubgroupMemory | - spv::MemorySemanticsMask::WorkgroupMemory | - spv::MemorySemanticsMask::CrossWorkgroupMemory | - spv::MemorySemanticsMask::AtomicCounterMemory | - spv::MemorySemanticsMask::ImageMemory | - spv::MemorySemanticsMask::OutputMemoryKHR); - - if (!includes_storage_class) { + if ((opcode == spv::Op::OpAtomicCompareExchange || + opcode == spv::Op::OpAtomicCompareExchangeWeak) && + operand_index == 5) { + if (value & uint32_t(spv::MemorySemanticsMask::Release) || + value & uint32_t(spv::MemorySemanticsMask::AcquireRelease)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": expected Memory Semantics to include a storage class"; + << _.VkErrorID(10875) << spvOpcodeString(opcode) + << " Unequal Memory Semantics must not use Release or " + "AcquireRelease memory order"; } - } - if (value & uint32_t(spv::MemorySemanticsMask::MakeVisibleKHR) && - !(value & uint32_t(spv::MemorySemanticsMask::Acquire | - spv::MemorySemanticsMask::AcquireRelease))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": MakeVisibleKHR Memory Semantics also requires either Acquire " - "or AcquireRelease Memory Semantics"; - } + bool is_equal_int32 = false; + bool is_equal_const = false; + uint32_t equal_value = 0; + std::tie(is_equal_int32, is_equal_const, equal_value) = + _.EvalInt32IfConst(inst->GetOperandAs(4)); - if (value & uint32_t(spv::MemorySemanticsMask::MakeAvailableKHR) && - !(value & uint32_t(spv::MemorySemanticsMask::Release | - spv::MemorySemanticsMask::AcquireRelease))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": MakeAvailableKHR Memory Semantics also requires either " - "Release or AcquireRelease Memory Semantics"; - } + const auto equal_mask_seq_cst = + uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent); + const auto equal_mask_acquire = uint32_t( + // Allow EqualMemorySemantics Release with UnequalMemorySemantics + // Acquire, since the C standard doesn't clearly forbid it. + spv::MemorySemanticsMask::SequentiallyConsistent | + spv::MemorySemanticsMask::AcquireRelease | + spv::MemorySemanticsMask::Release | spv::MemorySemanticsMask::Acquire); - if (spvIsVulkanEnv(_.context()->target_env)) { - const bool includes_storage_class = - value & uint32_t(spv::MemorySemanticsMask::UniformMemory | - spv::MemorySemanticsMask::WorkgroupMemory | - spv::MemorySemanticsMask::ImageMemory | - spv::MemorySemanticsMask::OutputMemoryKHR); - - if (opcode == spv::Op::OpMemoryBarrier && !num_memory_order_set_bits) { + if (((value & uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent)) && + !(equal_value & equal_mask_seq_cst)) || + ((value & uint32_t(spv::MemorySemanticsMask::Acquire)) && + !(equal_value & equal_mask_acquire))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4732) << spvOpcodeString(opcode) - << ": Vulkan specification requires Memory Semantics to have " - "one of the following bits set: Acquire, Release, " - "AcquireRelease or SequentiallyConsistent"; - } else if (opcode != spv::Op::OpMemoryBarrier && - num_memory_order_set_bits) { - // should leave only atomics and control barriers for Vulkan env - bool memory_is_int32 = false, memory_is_const_int32 = false; - uint32_t memory_value = 0; - std::tie(memory_is_int32, memory_is_const_int32, memory_value) = - _.EvalInt32IfConst(memory_scope); - if (memory_is_int32 && - spv::Scope(memory_value) == spv::Scope::Invocation) { + << _.VkErrorID(10876) << spvOpcodeString(opcode) + << " Unequal Memory Semantics must not use a stronger memory " + "order than the corresponding Equal Memory Semantics"; + } + + if (is_vulkan) { + auto storage_class_semantics_mask = + uint32_t(spv::MemorySemanticsMask::UniformMemory | + spv::MemorySemanticsMask::WorkgroupMemory | + spv::MemorySemanticsMask::ImageMemory | + spv::MemorySemanticsMask::OutputMemoryKHR); + + if (value & ~equal_value & storage_class_semantics_mask) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4641) << spvOpcodeString(opcode) - << ": Vulkan specification requires Memory Semantics to be None " - "if used with Invocation Memory Scope"; + << _.VkErrorID(10877) << spvOpcodeString(opcode) + << " Unequal Memory Semantics must not have any " + "Vulkan-supported storage class semantics bit set " + "(UniformMemory, WorkgroupMemory, ImageMemory, or " + "OutputMemory) unless this bit is also set in the " + "corresponding Equal Memory Semantics"; } - } - if (opcode == spv::Op::OpMemoryBarrier && !includes_storage_class) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4733) << spvOpcodeString(opcode) - << ": expected Memory Semantics to include a Vulkan-supported " - "storage class"; - } - - if (opcode == spv::Op::OpControlBarrier && value) { - if (!num_memory_order_set_bits) { + if (value & ~equal_value & + uint32_t(spv::MemorySemanticsMask::MakeVisibleKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(10609) << spvOpcodeString(opcode) - << ": Vulkan specification requires non-zero Memory Semantics " - "to have one of the following bits set: Acquire, Release, " - "AcquireRelease or SequentiallyConsistent"; + << _.VkErrorID(10878) << spvOpcodeString(opcode) + << " Unequal Memory Semantics must not have MakeVisible bit set " + "unless this bit is also set in the corresponding Equal " + "Memory Semantics"; } - if (!includes_storage_class) { + + if ((equal_value & uint32_t(spv::MemorySemanticsMask::Volatile)) ^ + (value & uint32_t(spv::MemorySemanticsMask::Volatile))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4650) << spvOpcodeString(opcode) - << ": expected Memory Semantics to include a Vulkan-supported " - "storage class if Memory Semantics is not None"; + << _.VkErrorID(10879) << spvOpcodeString(opcode) + << " Unequal Memory Semantics must have Volatile bit set if and " + "only if this bit is also set in the corresponding Equal " + "Memory Semantics"; } } } - if (opcode == spv::Op::OpAtomicFlagClear && - (value & uint32_t(spv::MemorySemanticsMask::Acquire) || - value & uint32_t(spv::MemorySemanticsMask::AcquireRelease))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Memory Semantics Acquire and AcquireRelease cannot be used " - "with " - << spvOpcodeString(opcode); - } - - if (opcode == spv::Op::OpAtomicCompareExchange && operand_index == 5 && - (value & uint32_t(spv::MemorySemanticsMask::Release) || - value & uint32_t(spv::MemorySemanticsMask::AcquireRelease))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(opcode) - << ": Memory Semantics Release and AcquireRelease cannot be " - "used " - "for operand Unequal"; - } - - if (spvIsVulkanEnv(_.context()->target_env)) { - if (opcode == spv::Op::OpAtomicLoad && - (value & uint32_t(spv::MemorySemanticsMask::Release) || - value & uint32_t(spv::MemorySemanticsMask::AcquireRelease) || - value & uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent))) { + if (is_vulkan && num_memory_order_set_bits) { + bool memory_is_int32 = false, memory_is_const_int32 = false; + uint32_t memory_value = 0; + std::tie(memory_is_int32, memory_is_const_int32, memory_value) = + _.EvalInt32IfConst(memory_scope); + if (memory_is_int32 && spv::Scope(memory_value) == spv::Scope::Invocation) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4731) - << "Vulkan spec disallows OpAtomicLoad with Memory Semantics " - "Release, AcquireRelease and SequentiallyConsistent"; - } - - if (opcode == spv::Op::OpAtomicStore && - (value & uint32_t(spv::MemorySemanticsMask::Acquire) || - value & uint32_t(spv::MemorySemanticsMask::AcquireRelease) || - value & uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4730) - << "Vulkan spec disallows OpAtomicStore with Memory Semantics " - "Acquire, AcquireRelease and SequentiallyConsistent"; + << _.VkErrorID(4641) << spvOpcodeString(opcode) + << ": Vulkan specification requires Memory Semantics to be " + "Relaxed if used with Invocation Memory Scope"; } } diff --git a/third_party/spirv-tools/source/val/validate_mesh_shading.cpp b/third_party/spirv-tools/source/val/validate_mesh_shading.cpp index 3bd1dbd38d..d7352eb8d9 100644 --- a/third_party/spirv-tools/source/val/validate_mesh_shading.cpp +++ b/third_party/spirv-tools/source/val/validate_mesh_shading.cpp @@ -132,9 +132,9 @@ spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst) { } case spv::Op::OpVariable: { if (_.HasCapability(spv::Capability::MeshShadingEXT)) { - bool meshInterfaceVar = + bool is_mesh_interface_var = IsInterfaceVariable(_, inst, spv::ExecutionModel::MeshEXT); - bool fragInterfaceVar = + bool is_frag_interface_var = IsInterfaceVariable(_, inst, spv::ExecutionModel::Fragment); const spv::StorageClass storage_class = @@ -143,14 +143,14 @@ spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst) { bool storage_input = (storage_class == spv::StorageClass::Input); if (_.HasDecoration(inst->id(), spv::Decoration::PerPrimitiveEXT)) { - if (fragInterfaceVar && !storage_input) { + if (is_frag_interface_var && !storage_input) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "PerPrimitiveEXT decoration must be applied only to " "variables in the Input Storage Class in the Fragment " "Execution Model."; } - if (meshInterfaceVar && !storage_output) { + if (is_mesh_interface_var && !storage_output) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4336) << "PerPrimitiveEXT decoration must be applied only to " @@ -158,6 +158,20 @@ spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst) { "Storage Class in the MeshEXT Execution Model."; } } + + // This only applies to user interface variables, not built-ins (they + // are validated with the rest of the builtin) + if (is_mesh_interface_var && storage_output && + !_.HasDecoration(inst->id(), spv::Decoration::BuiltIn)) { + const Instruction* pointer_inst = _.FindDef(inst->type_id()); + if (pointer_inst->opcode() == spv::Op::OpTypePointer) { + if (!_.IsArrayType(pointer_inst->word(3))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "In the MeshEXT Execution Mode, all Output Variables " + "must contain an Array."; + } + } + } } break; } diff --git a/third_party/spirv-tools/source/val/validate_mode_setting.cpp b/third_party/spirv-tools/source/val/validate_mode_setting.cpp index a5cd8b30b6..22d464fe21 100644 --- a/third_party/spirv-tools/source/val/validate_mode_setting.cpp +++ b/third_party/spirv-tools/source/val/validate_mode_setting.cpp @@ -27,6 +27,48 @@ namespace spvtools { namespace val { namespace { +// TODO - Make a common util if someone else needs it too outside this file +const char* ExecutionModelToString(spv::ExecutionModel value) { + switch (value) { + case spv::ExecutionModel::Vertex: + return "Vertex"; + case spv::ExecutionModel::TessellationControl: + return "TessellationControl"; + case spv::ExecutionModel::TessellationEvaluation: + return "TessellationEvaluation"; + case spv::ExecutionModel::Geometry: + return "Geometry"; + case spv::ExecutionModel::Fragment: + return "Fragment"; + case spv::ExecutionModel::GLCompute: + return "GLCompute"; + case spv::ExecutionModel::Kernel: + return "Kernel"; + case spv::ExecutionModel::TaskNV: + return "TaskNV"; + case spv::ExecutionModel::MeshNV: + return "MeshNV"; + case spv::ExecutionModel::RayGenerationKHR: + return "RayGenerationKHR"; + case spv::ExecutionModel::IntersectionKHR: + return "IntersectionKHR"; + case spv::ExecutionModel::AnyHitKHR: + return "AnyHitKHR"; + case spv::ExecutionModel::ClosestHitKHR: + return "ClosestHitKHR"; + case spv::ExecutionModel::MissKHR: + return "MissKHR"; + case spv::ExecutionModel::CallableKHR: + return "CallableKHR"; + case spv::ExecutionModel::TaskEXT: + return "TaskEXT"; + case spv::ExecutionModel::MeshEXT: + return "MeshEXT"; + default: + return "Unknown"; + } +} + spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { const auto entry_point_id = inst->GetOperandAs(1); auto entry_point = _.FindDef(entry_point_id); @@ -59,20 +101,22 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { } const auto* execution_modes = _.GetExecutionModes(entry_point_id); + auto has_mode = [&execution_modes](spv::ExecutionMode mode) { + return execution_modes && execution_modes->count(mode); + }; + if (_.HasCapability(spv::Capability::Shader)) { switch (execution_model) { case spv::ExecutionModel::Fragment: - if (execution_modes && - execution_modes->count(spv::ExecutionMode::OriginUpperLeft) && - execution_modes->count(spv::ExecutionMode::OriginLowerLeft)) { + if (has_mode(spv::ExecutionMode::OriginUpperLeft) && + has_mode(spv::ExecutionMode::OriginLowerLeft)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Fragment execution model entry points can only specify " "one of OriginUpperLeft or OriginLowerLeft execution " "modes."; } - if (!execution_modes || - (!execution_modes->count(spv::ExecutionMode::OriginUpperLeft) && - !execution_modes->count(spv::ExecutionMode::OriginLowerLeft))) { + if (!has_mode(spv::ExecutionMode::OriginUpperLeft) && + !has_mode(spv::ExecutionMode::OriginLowerLeft)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Fragment execution model entry points require either an " "OriginUpperLeft or OriginLowerLeft execution mode."; @@ -285,115 +329,105 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { } } + bool has_workgroup_size = false; + bool has_local_size_id = false; + for (auto& i : _.ordered_instructions()) { + if (i.opcode() == spv::Op::OpFunction) break; + if (i.opcode() == spv::Op::OpDecorate && i.operands().size() > 2) { + if (i.GetOperandAs(1) == spv::Decoration::BuiltIn && + i.GetOperandAs(2) == spv::BuiltIn::WorkgroupSize) { + has_workgroup_size = true; + } + } + if (i.opcode() == spv::Op::OpExecutionModeId) { + if (i.GetOperandAs(1) == + spv::ExecutionMode::LocalSizeId) { + has_local_size_id = true; + } + } + } + if (spvIsVulkanEnv(_.context()->target_env)) { - switch (execution_model) { - case spv::ExecutionModel::GLCompute: - if (!execution_modes || - !execution_modes->count(spv::ExecutionMode::LocalSize)) { - bool ok = false; - for (auto& i : _.ordered_instructions()) { - if (i.opcode() == spv::Op::OpDecorate) { - if (i.operands().size() > 2) { - if (i.GetOperandAs(1) == - spv::Decoration::BuiltIn && - i.GetOperandAs(2) == - spv::BuiltIn::WorkgroupSize) { - ok = true; - break; - } - } - } - if (i.opcode() == spv::Op::OpExecutionModeId) { - const auto mode = i.GetOperandAs(1); - if (mode == spv::ExecutionMode::LocalSizeId) { - ok = true; - break; - } - } - } - if (!ok && _.HasCapability(spv::Capability::TileShadingQCOM)) { - ok = - execution_modes && - execution_modes->count(spv::ExecutionMode::TileShadingRateQCOM); - } - if (!ok) { + // SPV_QCOM_tile_shading checks + if (execution_model == spv::ExecutionModel::GLCompute) { + if (_.HasCapability(spv::Capability::TileShadingQCOM)) { + if (has_mode(spv::ExecutionMode::TileShadingRateQCOM) && + (has_mode(spv::ExecutionMode::LocalSize) || + has_mode(spv::ExecutionMode::LocalSizeId))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "If the TileShadingRateQCOM execution mode is used, " + << "LocalSize and LocalSizeId must not be specified."; + } + if (has_mode(spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The NonCoherentTileAttachmentQCOM execution mode must " + "not be used in any stage other than fragment."; + } + } else { + if (has_mode(spv::ExecutionMode::TileShadingRateQCOM)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "If the TileShadingRateQCOM execution mode is used, the " + "TileShadingQCOM capability must be enabled."; + } + } + } else { + if (has_mode(spv::ExecutionMode::TileShadingRateQCOM)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The TileShadingRateQCOM execution mode must not be used " + "in any stage other than compute."; + } + if (execution_model != spv::ExecutionModel::Fragment) { + if (has_mode(spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The NonCoherentTileAttachmentQCOM execution mode must " + "not be used in any stage other than fragment."; + } + if (_.HasCapability(spv::Capability::TileShadingQCOM)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << "The TileShadingQCOM capability must not be enabled in " + "any stage other than compute or fragment."; + } + } else { + if (has_mode(spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) { + if (!_.HasCapability(spv::Capability::TileShadingQCOM)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << (_.HasCapability(spv::Capability::TileShadingQCOM) - ? _.VkErrorID(10685) - : _.VkErrorID(6426)) - << "In the Vulkan environment, GLCompute execution model " - "entry points require either the " - << (_.HasCapability(spv::Capability::TileShadingQCOM) - ? "TileShadingRateQCOM, " - : "") - << "LocalSize or LocalSizeId execution mode or an object " - "decorated with WorkgroupSize must be specified."; + << "If the NonCoherentTileAttachmentReadQCOM execution " + "mode is used, the TileShadingQCOM capability must be " + "enabled."; } } + } + } - if (_.HasCapability(spv::Capability::TileShadingQCOM)) { - if (execution_modes) { - if (execution_modes->count( - spv::ExecutionMode::TileShadingRateQCOM) && - (execution_modes->count(spv::ExecutionMode::LocalSize) || - execution_modes->count(spv::ExecutionMode::LocalSizeId))) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "If the TileShadingRateQCOM execution mode is used, " - << "LocalSize and LocalSizeId must not be specified."; - } - if (execution_modes->count( - spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The NonCoherentTileAttachmentQCOM execution mode must " - "not be used in any stage other than fragment."; - } - } - } else { - if (execution_modes && - execution_modes->count(spv::ExecutionMode::TileShadingRateQCOM)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "If the TileShadingRateQCOM execution mode is used, the " - "TileShadingQCOM capability must be enabled."; - } + switch (execution_model) { + case spv::ExecutionModel::GLCompute: + case spv::ExecutionModel::MeshEXT: + case spv::ExecutionModel::MeshNV: + case spv::ExecutionModel::TaskEXT: + case spv::ExecutionModel::TaskNV: + if (!has_mode(spv::ExecutionMode::LocalSize) && !has_workgroup_size && + !has_local_size_id && + !has_mode(spv::ExecutionMode::TileShadingRateQCOM)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(10685) << "In the Vulkan environment, " + << ExecutionModelToString(execution_model) + << " execution model " + "entry points require either the " + << (_.HasCapability(spv::Capability::TileShadingQCOM) + ? "TileShadingRateQCOM, " + : "") + << "LocalSize or LocalSizeId execution mode or an object " + "decorated with WorkgroupSize must be specified."; } break; default: - if (execution_modes && - execution_modes->count(spv::ExecutionMode::TileShadingRateQCOM)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The TileShadingRateQCOM execution mode must not be used " - "in any stage other than compute."; - } - if (execution_model != spv::ExecutionModel::Fragment) { - if (execution_modes && - execution_modes->count( - spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "The NonCoherentTileAttachmentQCOM execution mode must " - "not be used in any stage other than fragment."; - } - if (_.HasCapability(spv::Capability::TileShadingQCOM)) { - return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) - << "The TileShadingQCOM capability must not be enabled in " - "any stage other than compute or fragment."; - } - } else { - if (execution_modes && - execution_modes->count( - spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) { - if (!_.HasCapability(spv::Capability::TileShadingQCOM)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "If the NonCoherentTileAttachmentReadQCOM execution " - "mode is used, the TileShadingQCOM capability must be " - "enabled."; - } - } - } break; } } - if (_.EntryPointHasLocalSizeOrId(entry_point_id)) { + // WorkgroupSize decoration takes precedence over any LocalSize or LocalSizeId + // execution mode, so the values can be ignored + if (_.EntryPointHasLocalSizeOrId(entry_point_id) && !has_workgroup_size) { const Instruction* local_size_inst = _.EntryPointLocalSizeOrId(entry_point_id); if (local_size_inst) { @@ -402,7 +436,8 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { const uint32_t operand_y = local_size_inst->GetOperandAs(3); const uint32_t operand_z = local_size_inst->GetOperandAs(4); if (mode == spv::ExecutionMode::LocalSize) { - if ((operand_x * operand_y * operand_z) == 0) { + const uint64_t product_size = operand_x * operand_y * operand_z; + if (product_size == 0) { return _.diag(SPV_ERROR_INVALID_DATA, local_size_inst) << "Local Size execution mode must not have a product of zero " "(X " @@ -410,6 +445,32 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { << operand_x << ", Y = " << operand_y << ", Z = " << operand_z << ")."; } + if (has_mode(spv::ExecutionMode::DerivativeGroupQuadsKHR)) { + if (operand_x % 2 != 0 || operand_y % 2 != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, local_size_inst) + << _.VkErrorID(10151) + << "Local Size execution mode dimensions is " + "(X = " + << operand_x << ", Y = " << operand_y + << ") but Entry Point id " << entry_point_id + << " also has an DerivativeGroupQuadsKHR execution mode, so " + "both dimensions must be a multiple of 2"; + } + } + if (has_mode(spv::ExecutionMode::DerivativeGroupLinearKHR)) { + if (product_size % 4 != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, local_size_inst) + << _.VkErrorID(10152) + << "Local Size execution mode dimensions is (X = " + << operand_x << ", Y = " << operand_y + << ", Z = " << operand_z << ") but Entry Point id " + << entry_point_id + << " also has an DerivativeGroupLinearKHR execution mode, " + "so " + "the product (" + << product_size << ") must be a multiple of 4"; + } + } } else if (mode == spv::ExecutionMode::LocalSizeId) { // can only validate product if static and not spec constant // (This is done for us in EvalConstantValUint64) @@ -417,13 +478,42 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { bool static_x = _.EvalConstantValUint64(operand_x, &x_size); bool static_y = _.EvalConstantValUint64(operand_y, &y_size); bool static_z = _.EvalConstantValUint64(operand_z, &z_size); - if (static_x && static_y && static_z && - ((x_size * y_size * z_size) == 0)) { - return _.diag(SPV_ERROR_INVALID_DATA, local_size_inst) - << "Local Size Id execution mode must not have a product of " - "zero " - "(X = " - << x_size << ", Y = " << y_size << ", Z = " << z_size << ")."; + if (static_x && static_y && static_z) { + const uint64_t product_size = x_size * y_size * z_size; + if (product_size == 0) { + return _.diag(SPV_ERROR_INVALID_DATA, local_size_inst) + << "LocalSizeId execution mode must not have a product of " + "zero " + "(X = " + << x_size << ", Y = " << y_size << ", Z = " << z_size + << ")."; + } + if (has_mode(spv::ExecutionMode::DerivativeGroupQuadsKHR)) { + if (x_size % 2 != 0 || y_size % 2 != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, local_size_inst) + << _.VkErrorID(10151) + << "LocalSizeId execution mode dimensions is " + "(X = " + << x_size << ", Y = " << y_size << ") but Entry Point id " + << entry_point_id + << " also has an DerivativeGroupQuadsKHR execution mode, " + "so " + "both dimensions must be a multiple of 2"; + } + } + if (has_mode(spv::ExecutionMode::DerivativeGroupLinearKHR)) { + if (product_size % 4 != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, local_size_inst) + << _.VkErrorID(10152) + << "LocalSizeId execution mode dimensions is (X = " + << x_size << ", Y = " << y_size << ", Z = " << z_size + << ") but Entry Point id " << entry_point_id + << " also has an DerivativeGroupLinearKHR execution mode, " + "so " + "the product (" + << product_size << ") must be a multiple of 4"; + } + } } } } diff --git a/third_party/spirv-tools/source/val/validate_non_uniform.cpp b/third_party/spirv-tools/source/val/validate_non_uniform.cpp index fd422a50ed..97118658f8 100644 --- a/third_party/spirv-tools/source/val/validate_non_uniform.cpp +++ b/third_party/spirv-tools/source/val/validate_non_uniform.cpp @@ -130,7 +130,7 @@ spv_result_t ValidateGroupNonUniformBroadcastShuffle(ValidationState_t& _, if (!spvOpcodeIsConstant(id_op)) { std::string operand = GetOperandName(inst->opcode()); return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Before SPIR-V 1.5, " << operand + << "In SPIR-V 1.4 or earlier, " << operand << " must be a constant instruction"; } } diff --git a/third_party/spirv-tools/source/val/validate_ray_query.cpp b/third_party/spirv-tools/source/val/validate_ray_query.cpp index bd790ac396..6be50c7659 100644 --- a/third_party/spirv-tools/source/val/validate_ray_query.cpp +++ b/third_party/spirv-tools/source/val/validate_ray_query.cpp @@ -66,8 +66,7 @@ spv_result_t ValidateIntersectionId(ValidationState_t& _, inst->GetOperandAs(intersection_index); const uint32_t intersection_type = _.GetTypeId(intersection_id); const spv::Op intersection_opcode = _.GetIdOpcode(intersection_id); - if (!_.IsIntScalarType(intersection_type) || - _.GetBitWidth(intersection_type) != 32 || + if (!_.IsIntScalarType(intersection_type, 32) || !spvOpcodeIsConstant(intersection_opcode)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "expected Intersection ID to be a constant 32-bit int scalar"; @@ -94,13 +93,13 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t ray_flags = _.GetOperandTypeId(inst, 2); - if (!_.IsIntScalarType(ray_flags) || _.GetBitWidth(ray_flags) != 32) { + if (!_.IsIntScalarType(ray_flags, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray Flags must be a 32-bit int scalar"; } const uint32_t cull_mask = _.GetOperandTypeId(inst, 3); - if (!_.IsIntScalarType(cull_mask) || _.GetBitWidth(cull_mask) != 32) { + if (!_.IsIntScalarType(cull_mask, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cull Mask must be a 32-bit int scalar"; } @@ -113,7 +112,7 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t ray_tmin = _.GetOperandTypeId(inst, 5); - if (!_.IsFloatScalarType(ray_tmin) || _.GetBitWidth(ray_tmin) != 32) { + if (!_.IsFloatScalarType(ray_tmin, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray TMin must be a 32-bit float scalar"; } @@ -127,7 +126,7 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t ray_tmax = _.GetOperandTypeId(inst, 7); - if (!_.IsFloatScalarType(ray_tmax) || _.GetBitWidth(ray_tmax) != 32) { + if (!_.IsFloatScalarType(ray_tmax, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray TMax must be a 32-bit float scalar"; } @@ -144,7 +143,7 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { if (auto error = ValidateRayQueryPointer(_, inst, 0)) return error; const uint32_t hit_t_id = _.GetOperandTypeId(inst, 1); - if (!_.IsFloatScalarType(hit_t_id) || _.GetBitWidth(hit_t_id) != 32) { + if (!_.IsFloatScalarType(hit_t_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Hit T must be a 32-bit float scalar"; } @@ -173,8 +172,7 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpRayQueryGetRayTMinKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; - if (!_.IsFloatScalarType(result_type) || - _.GetBitWidth(result_type) != 32) { + if (!_.IsFloatScalarType(result_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "expected Result Type to be 32-bit float scalar type"; } @@ -196,7 +194,7 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpRayQueryGetRayFlagsKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; - if (!_.IsIntScalarType(result_type) || _.GetBitWidth(result_type) != 32) { + if (!_.IsIntScalarType(result_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "expected Result Type to be 32-bit int scalar type"; } @@ -278,7 +276,7 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; if (auto error = ValidateIntersectionId(_, inst, 3)) return error; - if (!_.IsIntScalarType(result_type) || _.GetBitWidth(result_type) != 32) { + if (!_.IsIntScalarType(result_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "expected Result Type to be 32-bit int scalar type"; } @@ -335,8 +333,7 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; if (auto error = ValidateIntersectionId(_, inst, 3)) return error; - if (!_.IsFloatScalarType(result_type) || - _.GetBitWidth(result_type) != 32) { + if (!_.IsFloatScalarType(result_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "expected Result Type to be 32-bit floating point " "scalar type"; diff --git a/third_party/spirv-tools/source/val/validate_ray_tracing.cpp b/third_party/spirv-tools/source/val/validate_ray_tracing.cpp index f74e9d4b9d..fd9f2b64a2 100644 --- a/third_party/spirv-tools/source/val/validate_ray_tracing.cpp +++ b/third_party/spirv-tools/source/val/validate_ray_tracing.cpp @@ -52,31 +52,31 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t ray_flags = _.GetOperandTypeId(inst, 1); - if (!_.IsIntScalarType(ray_flags) || _.GetBitWidth(ray_flags) != 32) { + if (!_.IsIntScalarType(ray_flags, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray Flags must be a 32-bit int scalar"; } const uint32_t cull_mask = _.GetOperandTypeId(inst, 2); - if (!_.IsIntScalarType(cull_mask) || _.GetBitWidth(cull_mask) != 32) { + if (!_.IsIntScalarType(cull_mask, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cull Mask must be a 32-bit int scalar"; } const uint32_t sbt_offset = _.GetOperandTypeId(inst, 3); - if (!_.IsIntScalarType(sbt_offset) || _.GetBitWidth(sbt_offset) != 32) { + if (!_.IsIntScalarType(sbt_offset, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "SBT Offset must be a 32-bit int scalar"; } const uint32_t sbt_stride = _.GetOperandTypeId(inst, 4); - if (!_.IsIntScalarType(sbt_stride) || _.GetBitWidth(sbt_stride) != 32) { + if (!_.IsIntScalarType(sbt_stride, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "SBT Stride must be a 32-bit int scalar"; } const uint32_t miss_index = _.GetOperandTypeId(inst, 5); - if (!_.IsIntScalarType(miss_index) || _.GetBitWidth(miss_index) != 32) { + if (!_.IsIntScalarType(miss_index, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Miss Index must be a 32-bit int scalar"; } @@ -89,7 +89,7 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t ray_tmin = _.GetOperandTypeId(inst, 7); - if (!_.IsFloatScalarType(ray_tmin) || _.GetBitWidth(ray_tmin) != 32) { + if (!_.IsFloatScalarType(ray_tmin, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray TMin must be a 32-bit float scalar"; } @@ -103,7 +103,7 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t ray_tmax = _.GetOperandTypeId(inst, 9); - if (!_.IsFloatScalarType(ray_tmax) || _.GetBitWidth(ray_tmax) != 32) { + if (!_.IsFloatScalarType(ray_tmax, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray TMax must be a 32-bit float scalar"; } @@ -144,7 +144,7 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t hit = _.GetOperandTypeId(inst, 2); - if (!_.IsFloatScalarType(hit) || _.GetBitWidth(hit) != 32) { + if (!_.IsFloatScalarType(hit, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Hit must be a 32-bit int scalar"; } diff --git a/third_party/spirv-tools/source/val/validate_ray_tracing_reorder.cpp b/third_party/spirv-tools/source/val/validate_ray_tracing_reorder.cpp index 3685a76530..d1c4ee5705 100644 --- a/third_party/spirv-tools/source/val/validate_ray_tracing_reorder.cpp +++ b/third_party/spirv-tools/source/val/validate_ray_tracing_reorder.cpp @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Validates ray tracing instructions from SPV_NV_shader_execution_reorder +// Validates ray tracing instructions from SPV_NV_shader_invocation_reorder and +// SPV_EXT_shader_invocation_reorder #include "source/opcode.h" #include "source/val/instruction.h" @@ -37,18 +38,29 @@ uint32_t GetArrayLength(ValidationState_t& _, const Instruction* array_type) { return array_length; } +spv_result_t ValidateRayQueryPointer(ValidationState_t& _, + const Instruction* inst, + uint32_t ray_query_index) { + const uint32_t ray_query_id = inst->GetOperandAs(ray_query_index); + auto variable = _.FindDef(ray_query_id); + auto pointer = _.FindDef(variable->GetOperandAs(0)); + if (!pointer || pointer->opcode() != spv::Op::OpTypePointer) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Query must be a pointer"; + } + auto type = _.FindDef(pointer->GetOperandAs(2)); + if (!type || type->opcode() != spv::Op::OpTypeRayQueryKHR) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Query must be a pointer to OpTypeRayQueryKHR"; + } + return SPV_SUCCESS; +} + spv_result_t ValidateHitObjectPointer(ValidationState_t& _, const Instruction* inst, uint32_t hit_object_index) { const uint32_t hit_object_id = inst->GetOperandAs(hit_object_index); auto variable = _.FindDef(hit_object_id); - const auto var_opcode = variable->opcode(); - if (!variable || (var_opcode != spv::Op::OpVariable && - var_opcode != spv::Op::OpFunctionParameter && - var_opcode != spv::Op::OpAccessChain)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Hit Object must be a memory object declaration"; - } auto pointer = _.FindDef(variable->GetOperandAs(0)); if (!pointer || pointer->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -62,6 +74,24 @@ spv_result_t ValidateHitObjectPointer(ValidationState_t& _, return SPV_SUCCESS; } +spv_result_t ValidateHitObjectPointerEXT(ValidationState_t& _, + const Instruction* inst, + uint32_t hit_object_index) { + const uint32_t hit_object_id = inst->GetOperandAs(hit_object_index); + auto variable = _.FindDef(hit_object_id); + auto pointer = _.FindDef(variable->GetOperandAs(0)); + if (!pointer || pointer->opcode() != spv::Op::OpTypePointer) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Object must be a pointer"; + } + auto type = _.FindDef(pointer->GetOperandAs(2)); + if (!type || type->opcode() != spv::Op::OpTypeHitObjectEXT) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Type must be OpTypeHitObjectEXT"; + } + return SPV_SUCCESS; +} + spv_result_t ValidateHitObjectInstructionCommonParameters( ValidationState_t& _, const Instruction* inst, uint32_t acceleration_struct_index, uint32_t instance_id_index, @@ -83,7 +113,7 @@ spv_result_t ValidateHitObjectInstructionCommonParameters( if (isValidId(instance_id_index)) { const uint32_t instance_id = _.GetOperandTypeId(inst, instance_id_index); - if (!_.IsIntScalarType(instance_id) || _.GetBitWidth(instance_id) != 32) { + if (!_.IsIntScalarType(instance_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Instance Id must be a 32-bit int scalar"; } @@ -91,7 +121,7 @@ spv_result_t ValidateHitObjectInstructionCommonParameters( if (isValidId(primtive_id_index)) { const uint32_t primitive_id = _.GetOperandTypeId(inst, primtive_id_index); - if (!_.IsIntScalarType(primitive_id) || _.GetBitWidth(primitive_id) != 32) { + if (!_.IsIntScalarType(primitive_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Primitive Id must be a 32-bit int scalar"; } @@ -99,8 +129,7 @@ spv_result_t ValidateHitObjectInstructionCommonParameters( if (isValidId(geometry_index)) { const uint32_t geometry_index_id = _.GetOperandTypeId(inst, geometry_index); - if (!_.IsIntScalarType(geometry_index_id) || - _.GetBitWidth(geometry_index_id) != 32) { + if (!_.IsIntScalarType(geometry_index_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Geometry Index must be a 32-bit int scalar"; } @@ -184,7 +213,7 @@ spv_result_t ValidateHitObjectInstructionCommonParameters( if (isValidId(ray_tmin_index)) { const uint32_t ray_tmin_id = _.GetOperandTypeId(inst, ray_tmin_index); - if (!_.IsFloatScalarType(ray_tmin_id) || _.GetBitWidth(ray_tmin_id) != 32) { + if (!_.IsFloatScalarType(ray_tmin_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray TMin must be a 32-bit float scalar"; } @@ -203,7 +232,7 @@ spv_result_t ValidateHitObjectInstructionCommonParameters( if (isValidId(ray_tmax_index)) { const uint32_t ray_tmax_id = _.GetOperandTypeId(inst, ray_tmax_index); - if (!_.IsFloatScalarType(ray_tmax_id) || _.GetBitWidth(ray_tmax_id) != 32) { + if (!_.IsFloatScalarType(ray_tmax_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray TMax must be a 32-bit float scalar"; } @@ -211,7 +240,7 @@ spv_result_t ValidateHitObjectInstructionCommonParameters( if (isValidId(ray_flags_index)) { const uint32_t ray_flags_id = _.GetOperandTypeId(inst, ray_flags_index); - if (!_.IsIntScalarType(ray_flags_id) || _.GetBitWidth(ray_flags_id) != 32) { + if (!_.IsIntScalarType(ray_flags_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray Flags must be a 32-bit int scalar"; } @@ -247,8 +276,10 @@ spv_result_t ValidateHitObjectInstructionCommonParameters( auto variable = _.FindDef(hit_object_attr_id); const auto var_opcode = variable->opcode(); if (!variable || var_opcode != spv::Op::OpVariable || - (variable->GetOperandAs(2)) != - spv::StorageClass::HitObjectAttributeNV) { + !((variable->GetOperandAs(2) == + spv::StorageClass::HitObjectAttributeNV) || + (variable->GetOperandAs(2) == + spv::StorageClass::HitObjectAttributeEXT))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Hit Object Attributes id must be a OpVariable of storage " "class HitObjectAttributeNV"; @@ -320,7 +351,7 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { RegisterOpcodeForValidModel(_, inst); if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; - if (!_.IsIntScalarType(result_type) || !_.GetBitWidth(result_type)) + if (!_.IsIntScalarType(result_type, 32)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected 32-bit integer type scalar as Result Type: " << spvOpcodeString(opcode); @@ -333,7 +364,7 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { RegisterOpcodeForValidModel(_, inst); if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; - if (!_.IsFloatScalarType(result_type) || _.GetBitWidth(result_type) != 32) + if (!_.IsFloatScalarType(result_type, 32)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected 32-bit floating-point type scalar as Result Type: " << spvOpcodeString(opcode); @@ -449,7 +480,7 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t ray_tmin = _.GetOperandTypeId(inst, 3); - if (!_.IsFloatScalarType(ray_tmin) || _.GetBitWidth(ray_tmin) != 32) { + if (!_.IsFloatScalarType(ray_tmin, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray TMin must be a 32-bit float scalar"; } @@ -463,7 +494,7 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { } const uint32_t ray_tmax = _.GetOperandTypeId(inst, 5); - if (!_.IsFloatScalarType(ray_tmax) || _.GetBitWidth(ray_tmax) != 32) { + if (!_.IsFloatScalarType(ray_tmax, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray TMax must be a 32-bit float scalar"; } @@ -531,8 +562,7 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { return error; // Current Time const uint32_t current_time_id = _.GetOperandTypeId(inst, 11); - if (!_.IsFloatScalarType(current_time_id) || - _.GetBitWidth(current_time_id) != 32) { + if (!_.IsFloatScalarType(current_time_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Current Times must be a 32-bit float scalar type"; } @@ -586,12 +616,12 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { // Validate the optional opreands Hint and Bits const uint32_t hint_id = _.GetOperandTypeId(inst, 1); - if (!_.IsIntScalarType(hint_id) || _.GetBitWidth(hint_id) != 32) { + if (!_.IsIntScalarType(hint_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Hint must be a 32-bit int scalar"; } const uint32_t bits_id = _.GetOperandTypeId(inst, 2); - if (!_.IsIntScalarType(bits_id) || _.GetBitWidth(bits_id) != 32) { + if (!_.IsIntScalarType(bits_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "bits must be a 32-bit int scalar"; } @@ -615,13 +645,13 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { }); const uint32_t hint_id = _.GetOperandTypeId(inst, 0); - if (!_.IsIntScalarType(hint_id) || _.GetBitWidth(hint_id) != 32) { + if (!_.IsIntScalarType(hint_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Hint must be a 32-bit int scalar"; } const uint32_t bits_id = _.GetOperandTypeId(inst, 1); - if (!_.IsIntScalarType(bits_id) || _.GetBitWidth(bits_id) != 32) { + if (!_.IsIntScalarType(bits_id, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "bits must be a 32-bit int scalar"; } @@ -632,7 +662,7 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { RegisterOpcodeForValidModel(_, inst); if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; - if (!_.IsIntScalarType(result_type) || _.GetBitWidth(result_type) != 32) + if (!_.IsIntScalarType(result_type, 32)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected 32-bit integer type scalar as Result Type: " << spvOpcodeString(opcode); @@ -658,8 +688,7 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { RegisterOpcodeForValidModel(_, inst); if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; - if (!_.IsFloatScalarType(result_type) || - _.GetBitWidth(result_type) != 32) { + if (!_.IsFloatScalarType(result_type, 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected 32-bit floating point scalar as Result Type: " << spvOpcodeString(opcode); @@ -728,5 +757,644 @@ spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { } return SPV_SUCCESS; } + +spv_result_t RayReorderEXTPass(ValidationState_t& _, const Instruction* inst) { + const spv::Op opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + auto RegisterOpcodeForValidModel = [](ValidationState_t& vs, + const Instruction* rtinst) { + std::string opcode_name = spvOpcodeString(rtinst->opcode()); + vs.function(rtinst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR, ClosestHitKHR and " + "MissKHR execution models"; + } + return false; + } + return true; + }); + return; + }; + + switch (opcode) { + case spv::Op::OpHitObjectIsMissEXT: + case spv::Op::OpHitObjectIsHitEXT: + case spv::Op::OpHitObjectIsEmptyEXT: { + RegisterOpcodeForValidModel(_, inst); + if (!_.IsBoolScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "expected Result Type to be bool scalar type"; + } + + if (auto error = ValidateHitObjectPointerEXT(_, inst, 2)) return error; + break; + } + + case spv::Op::OpHitObjectGetShaderRecordBufferHandleEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 2)) return error; + + if (!_.IsIntVectorType(result_type) || + (_.GetDimension(result_type) != 2) || + (_.GetBitWidth(result_type) != 32)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit integer type 2-component vector as Result " + "Type: " + << spvOpcodeString(opcode); + break; + } + + case spv::Op::OpHitObjectGetHitKindEXT: + case spv::Op::OpHitObjectGetPrimitiveIndexEXT: + case spv::Op::OpHitObjectGetGeometryIndexEXT: + case spv::Op::OpHitObjectGetInstanceIdEXT: + case spv::Op::OpHitObjectGetInstanceCustomIndexEXT: + case spv::Op::OpHitObjectGetShaderBindingTableRecordIndexEXT: + case spv::Op::OpHitObjectGetRayFlagsEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 2)) return error; + + if (!_.IsIntScalarType(result_type, 32)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit integer type scalar as Result Type: " + << spvOpcodeString(opcode); + break; + } + + case spv::Op::OpHitObjectGetCurrentTimeEXT: + case spv::Op::OpHitObjectGetRayTMaxEXT: + case spv::Op::OpHitObjectGetRayTMinEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 2)) return error; + + if (!_.IsFloatScalarType(result_type, 32)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit floating-point type scalar as Result Type: " + << spvOpcodeString(opcode); + break; + } + + case spv::Op::OpHitObjectGetObjectToWorldEXT: + case spv::Op::OpHitObjectGetWorldToObjectEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 2)) return error; + + uint32_t num_rows = 0; + uint32_t num_cols = 0; + uint32_t col_type = 0; + uint32_t component_type = 0; + + if (!_.GetMatrixTypeInfo(result_type, &num_rows, &num_cols, &col_type, + &component_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "expected matrix type as Result Type: " + << spvOpcodeString(opcode); + } + + if (num_cols != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "expected Result Type matrix to have a Column Count of 4" + << spvOpcodeString(opcode); + } + + if (!_.IsFloatScalarType(component_type) || + _.GetBitWidth(result_type) != 32 || num_rows != 3) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "expected Result Type matrix to have a Column Type of " + "3-component 32-bit float vectors: " + << spvOpcodeString(opcode); + } + break; + } + + case spv::Op::OpHitObjectGetObjectRayOriginEXT: + case spv::Op::OpHitObjectGetObjectRayDirectionEXT: + case spv::Op::OpHitObjectGetWorldRayDirectionEXT: + case spv::Op::OpHitObjectGetWorldRayOriginEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 2)) return error; + + if (!_.IsFloatVectorType(result_type) || + (_.GetDimension(result_type) != 3) || + (_.GetBitWidth(result_type) != 32)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit floating-point type 3-component vector as " + "Result Type: " + << spvOpcodeString(opcode); + break; + } + + case spv::Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 2)) return error; + + auto result_id = _.FindDef(result_type); + if ((result_id->opcode() != spv::Op::OpTypeArray) || + (GetArrayLength(_, result_id) != 3) || + !_.IsFloatVectorType(_.GetComponentType(result_type)) || + _.GetDimension(_.GetComponentType(result_type)) != 3 || + _.GetBitWidth(_.GetComponentType(result_type)) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 3 element array of 32-bit 3 component float " + "vectors as Result Type: " + << spvOpcodeString(opcode); + } + break; + } + + case spv::Op::OpHitObjectGetAttributesEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + const uint32_t hit_object_attr_id = inst->GetOperandAs(1); + auto variable = _.FindDef(hit_object_attr_id); + const auto var_opcode = variable->opcode(); + if (!variable || var_opcode != spv::Op::OpVariable || + variable->GetOperandAs(2) != + spv::StorageClass::HitObjectAttributeEXT) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Object Attributes id must be a OpVariable of storage " + "class HitObjectAttributeEXT"; + } + break; + } + + case spv::Op::OpHitObjectSetShaderBindingTableRecordIndexEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + const uint32_t sbt_index_id = _.GetOperandTypeId(inst, 1); + if (!_.IsIntScalarType(sbt_index_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "SBT Index must be a 32-bit integer scalar"; + } + break; + } + + case spv::Op::OpHitObjectExecuteShaderEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + const uint32_t payload_id = inst->GetOperandAs(1); + auto variable = _.FindDef(payload_id); + const auto var_opcode = variable->opcode(); + if (!variable || var_opcode != spv::Op::OpVariable || + (variable->GetOperandAs(2) != + spv::StorageClass::RayPayloadKHR && + variable->GetOperandAs(2) != + spv::StorageClass::IncomingRayPayloadKHR)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Payload must be a OpVariable of storage " + "class RayPayloadKHR or IncomingRayPayloadKHR"; + } + break; + } + + case spv::Op::OpHitObjectRecordEmptyEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + break; + } + + case spv::Op::OpHitObjectRecordFromQueryEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + if (auto error = ValidateRayQueryPointer(_, inst, 1)) return error; + + if (!_.HasCapability(spv::Capability::RayQueryKHR)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": requires RayQueryKHR capability"; + + // Validate SBT Record Index (operand 2) + const uint32_t sbt_record_index_id = _.GetOperandTypeId(inst, 2); + if (!_.IsIntScalarType(sbt_record_index_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "SBT Record Index must be a 32-bit integer scalar"; + } + + // Validate Hit Object Attributes (operand 3) + const uint32_t hit_object_attr_id = inst->GetOperandAs(3); + auto attr_variable = _.FindDef(hit_object_attr_id); + const auto attr_var_opcode = attr_variable->opcode(); + if (!attr_variable || attr_var_opcode != spv::Op::OpVariable || + attr_variable->GetOperandAs(2) != + spv::StorageClass::HitObjectAttributeEXT) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Object Attributes id must be a OpVariable of storage " + "class HitObjectAttributeEXT"; + } + break; + } + + case spv::Op::OpHitObjectRecordMissEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + // Ray Flags (operand 1) + const uint32_t ray_flags_id = _.GetOperandTypeId(inst, 1); + if (!_.IsIntScalarType(ray_flags_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Flags must be a 32-bit int scalar"; + } + + // Miss Index (operand 2) + const uint32_t miss_index = _.GetOperandTypeId(inst, 2); + if (!_.IsUnsignedIntScalarType(miss_index) || + _.GetBitWidth(miss_index) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Miss Index must be a 32-bit unsigned int scalar"; + } + + // Ray Origin (operand 3) + const uint32_t ray_origin = _.GetOperandTypeId(inst, 3); + if (!_.IsFloatVectorType(ray_origin) || _.GetDimension(ray_origin) != 3 || + _.GetBitWidth(ray_origin) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Origin must be a 32-bit float 3-component vector"; + } + + // Ray TMin (operand 4) + const uint32_t ray_tmin = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarType(ray_tmin, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray TMin must be a 32-bit float scalar"; + } + + // Ray Direction (operand 5) + const uint32_t ray_direction = _.GetOperandTypeId(inst, 5); + if (!_.IsFloatVectorType(ray_direction) || + _.GetDimension(ray_direction) != 3 || + _.GetBitWidth(ray_direction) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Direction must be a 32-bit float 3-component vector"; + } + + // Ray TMax (operand 6) + const uint32_t ray_tmax = _.GetOperandTypeId(inst, 6); + if (!_.IsFloatScalarType(ray_tmax, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray TMax must be a 32-bit float scalar"; + } + break; + } + + case spv::Op::OpHitObjectRecordMissMotionEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + // Ray Flags (operand 1) + const uint32_t ray_flags_id = _.GetOperandTypeId(inst, 1); + if (!_.IsIntScalarType(ray_flags_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Flags must be a 32-bit int scalar"; + } + + // Miss Index (operand 2) + const uint32_t miss_index = _.GetOperandTypeId(inst, 2); + if (!_.IsUnsignedIntScalarType(miss_index) || + _.GetBitWidth(miss_index) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Miss Index must be a 32-bit unsigned int scalar"; + } + + // Ray Origin (operand 3) + const uint32_t ray_origin = _.GetOperandTypeId(inst, 3); + if (!_.IsFloatVectorType(ray_origin) || _.GetDimension(ray_origin) != 3 || + _.GetBitWidth(ray_origin) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Origin must be a 32-bit float 3-component vector"; + } + + // Ray TMin (operand 4) + const uint32_t ray_tmin = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarType(ray_tmin, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray TMin must be a 32-bit float scalar"; + } + + // Ray Direction (operand 5) + const uint32_t ray_direction = _.GetOperandTypeId(inst, 5); + if (!_.IsFloatVectorType(ray_direction) || + _.GetDimension(ray_direction) != 3 || + _.GetBitWidth(ray_direction) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Direction must be a 32-bit float 3-component vector"; + } + + // Ray TMax (operand 6) + const uint32_t ray_tmax = _.GetOperandTypeId(inst, 6); + if (!_.IsFloatScalarType(ray_tmax, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray TMax must be a 32-bit float scalar"; + } + + // Current Time (operand 7) + const uint32_t current_time_id = _.GetOperandTypeId(inst, 7); + if (!_.IsFloatScalarType(current_time_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Current Time must be a 32-bit float scalar"; + } + break; + } + + case spv::Op::OpReorderThreadWithHintEXT: { + std::string opcode_name = spvOpcodeString(inst->opcode()); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR execution model"; + } + return false; + } + return true; + }); + + const uint32_t hint_id = _.GetOperandTypeId(inst, 0); + if (!_.IsIntScalarType(hint_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint must be a 32-bit int scalar"; + } + + const uint32_t bits_id = _.GetOperandTypeId(inst, 1); + if (!_.IsIntScalarType(bits_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Bits must be a 32-bit int scalar"; + } + break; + } + + case spv::Op::OpReorderThreadWithHitObjectEXT: { + std::string opcode_name = spvOpcodeString(inst->opcode()); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR execution model"; + } + return false; + } + return true; + }); + + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + if (inst->operands().size() > 1) { + if (inst->operands().size() != 3) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint and Bits are optional together i.e " + << " Either both Hint and Bits should be provided or neither."; + } + + // Validate the optional operands Hint and Bits + const uint32_t hint_id = _.GetOperandTypeId(inst, 1); + if (!_.IsIntScalarType(hint_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint must be a 32-bit int scalar"; + } + const uint32_t bits_id = _.GetOperandTypeId(inst, 2); + if (!_.IsIntScalarType(bits_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Bits must be a 32-bit int scalar"; + } + } + break; + } + + case spv::Op::OpHitObjectTraceRayEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + if (auto error = ValidateHitObjectInstructionCommonParameters( + _, inst, 1 /* Acceleration Struct */, + KRayParamInvalidId /* Instance Id */, + KRayParamInvalidId /* Primitive Id */, + KRayParamInvalidId /* Geometry Index */, 2 /* Ray Flags */, + 3 /* Cull Mask */, KRayParamInvalidId /* Hit Kind*/, + KRayParamInvalidId /* SBT index */, 4 /* SBT Offset */, + 5 /* SBT Stride */, KRayParamInvalidId /* SBT Record Offset */, + KRayParamInvalidId /* SBT Record Stride */, 6 /* Miss Index */, + 7 /* Ray Origin */, 8 /* Ray TMin */, 9 /* Ray Direction */, + 10 /* Ray TMax */, 11 /* Payload */, + KRayParamInvalidId /* Hit Object Attribute */)) + return error; + break; + } + + case spv::Op::OpHitObjectTraceRayMotionEXT: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + if (auto error = ValidateHitObjectInstructionCommonParameters( + _, inst, 1 /* Acceleration Struct */, + KRayParamInvalidId /* Instance Id */, + KRayParamInvalidId /* Primitive Id */, + KRayParamInvalidId /* Geometry Index */, 2 /* Ray Flags */, + 3 /* Cull Mask */, KRayParamInvalidId /* Hit Kind*/, + KRayParamInvalidId /* SBT index */, 4 /* SBT Offset */, + 5 /* SBT Stride */, KRayParamInvalidId /* SBT Record Offset */, + KRayParamInvalidId /* SBT Record Stride */, 6 /* Miss Index */, + 7 /* Ray Origin */, 8 /* Ray TMin */, 9 /* Ray Direction */, + 10 /* Ray TMax */, 12 /* Payload */, + KRayParamInvalidId /* Hit Object Attribute */)) + return error; + + // Current Time (operand 11) + const uint32_t current_time_id = _.GetOperandTypeId(inst, 11); + if (!_.IsFloatScalarType(current_time_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Current Time must be a 32-bit float scalar"; + } + break; + } + + case spv::Op::OpHitObjectReorderExecuteShaderEXT: { + std::string opcode_name = spvOpcodeString(inst->opcode()); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR execution model"; + } + return false; + } + return true; + }); + + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + // Validate Payload (operand 1) + const uint32_t payload_id = inst->GetOperandAs(1); + auto variable = _.FindDef(payload_id); + const auto var_opcode = variable->opcode(); + if (!variable || var_opcode != spv::Op::OpVariable || + (variable->GetOperandAs(2) != + spv::StorageClass::RayPayloadKHR && + variable->GetOperandAs(2) != + spv::StorageClass::IncomingRayPayloadKHR)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Payload must be a OpVariable of storage " + "class RayPayloadKHR or IncomingRayPayloadKHR"; + } + + // Check for optional Hint and Bits (operands 2 and 3) + if (inst->operands().size() > 2) { + if (inst->operands().size() != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint and Bits are optional together i.e " + << " Either both Hint and Bits should be provided or neither."; + } + + // Validate optional Hint and Bits + const uint32_t hint_id = _.GetOperandTypeId(inst, 2); + if (!_.IsIntScalarType(hint_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint must be a 32-bit int scalar"; + } + const uint32_t bits_id = _.GetOperandTypeId(inst, 3); + if (!_.IsIntScalarType(bits_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Bits must be a 32-bit int scalar"; + } + } + break; + } + + case spv::Op::OpHitObjectTraceReorderExecuteEXT: { + std::string opcode_name = spvOpcodeString(inst->opcode()); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR execution model"; + } + return false; + } + return true; + }); + + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + // Validate base trace ray parameters (operands 1-11) + if (auto error = ValidateHitObjectInstructionCommonParameters( + _, inst, 1 /* Acceleration Struct */, + KRayParamInvalidId /* Instance Id */, + KRayParamInvalidId /* Primitive Id */, + KRayParamInvalidId /* Geometry Index */, 2 /* Ray Flags */, + 3 /* Cull Mask */, KRayParamInvalidId /* Hit Kind*/, + KRayParamInvalidId /* SBT index */, 4 /* SBT Offset */, + 5 /* SBT Stride */, KRayParamInvalidId /* SBT Record Offset */, + KRayParamInvalidId /* SBT Record Stride */, 6 /* Miss Index */, + 7 /* Ray Origin */, 8 /* Ray TMin */, 9 /* Ray Direction */, + 10 /* Ray TMax */, 11 /* Payload */, + KRayParamInvalidId /* Hit Object Attribute */)) + return error; + + // Check for optional Hint and Bits (operands 12 and 13) + if (inst->operands().size() > 12) { + if (inst->operands().size() != 14) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint and Bits are optional together i.e " + << " Either both Hint and Bits should be provided or neither."; + } + + // Validate optional Hint and Bits + const uint32_t hint_id = _.GetOperandTypeId(inst, 12); + if (!_.IsIntScalarType(hint_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint must be a 32-bit int scalar"; + } + const uint32_t bits_id = _.GetOperandTypeId(inst, 13); + if (!_.IsIntScalarType(bits_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Bits must be a 32-bit int scalar"; + } + } + break; + } + + case spv::Op::OpHitObjectTraceMotionReorderExecuteEXT: { + std::string opcode_name = spvOpcodeString(inst->opcode()); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR execution model"; + } + return false; + } + return true; + }); + + if (auto error = ValidateHitObjectPointerEXT(_, inst, 0)) return error; + + // Validate base trace ray parameters (operands 1-12) + if (auto error = ValidateHitObjectInstructionCommonParameters( + _, inst, 1 /* Acceleration Struct */, + KRayParamInvalidId /* Instance Id */, + KRayParamInvalidId /* Primitive Id */, + KRayParamInvalidId /* Geometry Index */, 2 /* Ray Flags */, + 3 /* Cull Mask */, KRayParamInvalidId /* Hit Kind*/, + KRayParamInvalidId /* SBT index */, 4 /* SBT Offset */, + 5 /* SBT Stride */, KRayParamInvalidId /* SBT Record Offset */, + KRayParamInvalidId /* SBT Record Stride */, 6 /* Miss Index */, + 7 /* Ray Origin */, 8 /* Ray TMin */, 9 /* Ray Direction */, + 10 /* Ray TMax */, 12 /* Payload */, + KRayParamInvalidId /* Hit Object Attribute */)) + return error; + + // Current Time (operand 11) + const uint32_t current_time_id = _.GetOperandTypeId(inst, 11); + if (!_.IsFloatScalarType(current_time_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Current Time must be a 32-bit float scalar"; + } + + // Check for optional Hint and Bits (operands 13 and 14) + if (inst->operands().size() > 13) { + if (inst->operands().size() != 15) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint and Bits are optional together i.e " + << " Either both Hint and Bits should be provided or neither."; + } + + // Validate optional Hint and Bits + const uint32_t hint_id = _.GetOperandTypeId(inst, 13); + if (!_.IsIntScalarType(hint_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint must be a 32-bit int scalar"; + } + const uint32_t bits_id = _.GetOperandTypeId(inst, 14); + if (!_.IsIntScalarType(bits_id, 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Bits must be a 32-bit int scalar"; + } + } + break; + } + + default: + break; + } + return SPV_SUCCESS; +} } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_scopes.cpp b/third_party/spirv-tools/source/val/validate_scopes.cpp index 6b493538a5..c7ef5f22db 100644 --- a/third_party/spirv-tools/source/val/validate_scopes.cpp +++ b/third_party/spirv-tools/source/val/validate_scopes.cpp @@ -94,7 +94,7 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, // Vulkan specific rules if (spvIsVulkanEnv(_.context()->target_env)) { - // Vulkan 1.1 specific rules + // Subgroups were not added until 1.1 if (_.context()->target_env != SPV_ENV_VULKAN_1_0) { // Scope for Non Uniform Group Operations must be limited to Subgroup if ((spvOpcodeIsNonUniformGroupOperation(opcode) && diff --git a/third_party/spirv-tools/source/val/validate_tensor_layout.cpp b/third_party/spirv-tools/source/val/validate_tensor_layout.cpp index 35c766b83d..cbd9c988fc 100644 --- a/third_party/spirv-tools/source/val/validate_tensor_layout.cpp +++ b/third_party/spirv-tools/source/val/validate_tensor_layout.cpp @@ -129,8 +129,7 @@ spv_result_t ValidateTensorTypeWithDimValuesNV(ValidationState_t& _, for (uint32_t i = 0; i < num_values; ++i) { const auto val_id = inst->GetOperandAs(i + 3); const auto val = _.FindDef(val_id); - if (!val || !_.IsIntScalarType(val->type_id()) || - _.GetBitWidth(val->type_id()) != 32) { + if (!val || !_.IsIntScalarType(val->type_id(), 32)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << spvOpcodeString(inst->opcode()) << " operand " << _.getIdName(val_id) << " is not a 32-bit integer."; diff --git a/third_party/spirv-tools/source/val/validate_type.cpp b/third_party/spirv-tools/source/val/validate_type.cpp index 709869cb13..a8c6f91fb0 100644 --- a/third_party/spirv-tools/source/val/validate_type.cpp +++ b/third_party/spirv-tools/source/val/validate_type.cpp @@ -140,7 +140,7 @@ spv_result_t ValidateTypeFloat(ValidationState_t& _, const Instruction* inst) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "8-bit floating point type requires an encoding."; } - const spvtools::OperandDesc* desc; + const spvtools::OperandDesc* desc = nullptr; const std::set known_encodings{ spv::FPEncoding::Float8E4M3EXT, spv::FPEncoding::Float8E5M2EXT}; spv_result_t status = spvtools::LookupOperand(SPV_OPERAND_TYPE_FPENCODING, @@ -200,6 +200,9 @@ spv_result_t ValidateTypeVector(ValidationState_t& _, const Instruction* inst) { auto num_components = inst->GetOperandAs(2); if (num_components == 2 || num_components == 3 || num_components == 4) { return SPV_SUCCESS; + } else if (num_components > 0 && + _.HasCapability(spv::Capability::LongVectorEXT)) { + return SPV_SUCCESS; } else if (num_components == 8 || num_components == 16) { if (_.HasCapability(spv::Capability::Vector16)) { return SPV_SUCCESS; @@ -217,15 +220,16 @@ spv_result_t ValidateTypeVector(ValidationState_t& _, const Instruction* inst) { return SPV_SUCCESS; } -spv_result_t ValidateTypeCooperativeVectorNV(ValidationState_t& _, - const Instruction* inst) { +spv_result_t ValidateTypeVectorIdEXT(ValidationState_t& _, + const Instruction* inst) { const auto component_index = 1; const auto component_type_id = inst->GetOperandAs(component_index); const auto component_type = _.FindDef(component_type_id); - if (!component_type || (spv::Op::OpTypeFloat != component_type->opcode() && - spv::Op::OpTypeInt != component_type->opcode())) { + if (!component_type || !_.IsScalarType(component_type_id) || + (!_.HasCapability(spv::Capability::LongVectorEXT) && + spv::Op::OpTypeBool == component_type->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpTypeCooperativeVectorNV Component Type " + << "OpTypeVectorIdEXT Component Type " << _.getIdName(component_type_id) << " is not a scalar numerical type."; } @@ -236,32 +240,25 @@ spv_result_t ValidateTypeCooperativeVectorNV(ValidationState_t& _, const auto num_components = _.FindDef(num_components_id); if (!num_components || !spvOpcodeIsConstant(num_components->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpTypeCooperativeVectorNV component count " + << "OpTypeVectorIdEXT component count " << _.getIdName(num_components_id) << " is not a scalar constant type."; } - // NOTE: Check the initialiser value of the constant - const auto const_inst = num_components->words(); - const auto const_result_type_index = 1; - const auto const_result_type = _.FindDef(const_inst[const_result_type_index]); - if (!const_result_type || spv::Op::OpTypeInt != const_result_type->opcode()) { + if (!_.IsIntScalarType(num_components->type_id(), 32)) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpTypeCooperativeVectorNV component count " - << _.getIdName(num_components_id) - << " is not a constant integer type."; + << "OpTypeVectorIdEXT component count type " + << _.getIdName(num_components->type_id()) + << " is not a 32-bit integer type."; } - int64_t num_components_value; - if (_.EvalConstantValInt64(num_components_id, &num_components_value)) { - auto& type_words = const_result_type->words(); - const bool is_signed = type_words[3] > 0; - if (num_components_value == 0 || (num_components_value < 0 && is_signed)) { + uint64_t num_components_value; + if (_.EvalConstantValUint64(num_components_id, &num_components_value)) { + if (num_components_value == 0) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpTypeCooperativeVectorNV component count " + << "OpTypeVectorIdEXT component count " << _.getIdName(num_components_id) - << " default value must be at least 1: found " - << num_components_value; + << " default value must be at least 1: found 0."; } } @@ -318,10 +315,11 @@ spv_result_t ValidateTypeArray(ValidationState_t& _, const Instruction* inst) { if (element_type->opcode() == spv::Op::OpTypeStruct && (_.HasDecoration(element_type->id(), spv::Decoration::Block) || _.HasDecoration(element_type->id(), spv::Decoration::BufferBlock))) { - if (_.HasDecoration(inst->id(), spv::Decoration::ArrayStride)) { + if (_.HasDecoration(inst->id(), spv::Decoration::ArrayStride) || + _.HasDecoration(inst->id(), spv::Decoration::ArrayStrideIdEXT)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Array containing a Block or BufferBlock must not be " - "decorated with ArrayStride"; + "decorated with ArrayStride or ArrayStrideIdEXT"; } } } @@ -388,10 +386,11 @@ spv_result_t ValidateTypeRuntimeArray(ValidationState_t& _, if (element_type->opcode() == spv::Op::OpTypeStruct && (_.HasDecoration(element_type->id(), spv::Decoration::Block) || _.HasDecoration(element_type->id(), spv::Decoration::BufferBlock))) { - if (_.HasDecoration(inst->id(), spv::Decoration::ArrayStride)) { + if (_.HasDecoration(inst->id(), spv::Decoration::ArrayStride) || + _.HasDecoration(inst->id(), spv::Decoration::ArrayStrideIdEXT)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Array containing a Block or BufferBlock must not be " - "decorated with ArrayStride"; + "decorated with ArrayStride or ArrayStrideIdEXT"; } } } @@ -433,10 +432,9 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { << "Structure " << _.getIdName(member_type_id) << " contains members with BuiltIn decoration. Therefore this " << "structure may not be contained as a member of another " - << "structure " - << "type. Structure " << _.getIdName(struct_id) - << " contains structure " << _.getIdName(member_type_id) - << "."; + << "structure " << "type. Structure " + << _.getIdName(struct_id) << " contains structure " + << _.getIdName(member_type_id) << "."; } if (spvIsVulkanEnv(_.context()->target_env) && @@ -496,7 +494,9 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { std::unordered_set built_in_members; for (auto decoration : _.id_decorations(struct_id)) { if (decoration.dec_type() == spv::Decoration::BuiltIn && - decoration.struct_member_index() != Decoration::kInvalidMember) { + decoration.struct_member_index() != Decoration::kInvalidMember && + decoration.builtin() != spv::BuiltIn::ResourceHeapEXT && + decoration.builtin() != spv::BuiltIn::SamplerHeapEXT) { built_in_members.insert(decoration.struct_member_index()); } } @@ -514,25 +514,32 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { _.RegisterStructTypeWithBuiltInMember(struct_id); } - const auto isOpaqueType = [&_](const Instruction* opaque_inst) { - auto opcode = opaque_inst->opcode(); - if (_.HasCapability(spv::Capability::BindlessTextureNV) && - (opcode == spv::Op::OpTypeImage || opcode == spv::Op::OpTypeSampler || - opcode == spv::Op::OpTypeSampledImage)) { - return false; - } else if (spvOpcodeIsBaseOpaqueType(opcode)) { - return true; - } - return false; - }; - if (spvIsVulkanEnv(_.context()->target_env) && - !_.options()->before_hlsl_legalization && - _.ContainsType(inst->id(), isOpaqueType)) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << _.VkErrorID(4667) << "In " - << spvLogStringForEnv(_.context()->target_env) - << ", OpTypeStruct must not contain an opaque type."; + !_.options()->before_hlsl_legalization) { + // By default, without extensions, all opaque types are invalid in a struct. + // Check the exceptions allowed by the various capabilities + const auto IsInvalidOpaqueType = [&_](const Instruction* opaque_inst) { + const spv::Op opcode = opaque_inst->opcode(); + if (_.HasCapability(spv::Capability::DescriptorHeapEXT) && + _.IsDescriptorType(opcode)) { + return false; + } else if (_.HasCapability(spv::Capability::BindlessTextureNV) && + (opcode == spv::Op::OpTypeImage || + opcode == spv::Op::OpTypeSampler || + opcode == spv::Op::OpTypeSampledImage)) { + return false; + } + return spvOpcodeIsBaseOpaqueType(opcode); + }; + + if (_.ContainsType(inst->id(), IsInvalidOpaqueType)) { + const uint32_t vuid = + _.HasCapability(spv::Capability::DescriptorHeapEXT) ? 11482 : 4667; + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(vuid) << "In " + << spvLogStringForEnv(_.context()->target_env) + << ", OpTypeStruct must not contain an invalid opaque type."; + } } return SPV_SUCCESS; @@ -617,6 +624,7 @@ spv_result_t ValidateTypeFunction(ValidationState_t& _, for (auto& pair : inst->uses()) { const auto* use = pair.first; if (use->opcode() != spv::Op::OpFunction && + use->opcode() != spv::Op::OpAsmINTEL && !spvOpcodeIsDebug(use->opcode()) && !use->IsNonSemantic() && !spvOpcodeIsDecoration(use->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, use) @@ -737,9 +745,10 @@ spv_result_t ValidateTypeCooperativeMatrix(ValidationState_t& _, } } - uint64_t scope_value; - if (_.EvalConstantValUint64(scope_id, &scope_value)) { - if (scope_value == static_cast(spv::Scope::Workgroup)) { + uint64_t scope_raw_value; + if (_.EvalConstantValUint64(scope_id, &scope_raw_value)) { + spv::Scope scope_value = static_cast(scope_raw_value); + if (scope_value == spv::Scope::Workgroup) { for (auto entry_point_id : _.entry_points()) { if (!_.EntryPointHasLocalSizeOrId(entry_point_id)) { return _.diag(SPV_ERROR_INVALID_ID, inst) @@ -766,6 +775,13 @@ spv_result_t ValidateTypeCooperativeMatrix(ValidationState_t& _, } } } + if (scope_value != spv::Scope::Workgroup && + scope_value != spv::Scope::Subgroup) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(12243) + << "OpTypeCooperativeMatrixKHR Scope is limited to Workgroup and " + "Subgroup"; + } } return SPV_SUCCESS; @@ -789,8 +805,23 @@ spv_result_t ValidateTypeUntypedPointerKHR(ValidationState_t& _, case spv::StorageClass::Uniform: case spv::StorageClass::PushConstant: break; + case spv::StorageClass::UniformConstant: + if (!_.HasCapability(spv::Capability::DescriptorHeapEXT)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "UniformConstant storage class untyped pointers in Vulkan " + "require DescriptorHeapEXT be declared"; + } + break; + case spv::StorageClass::Image: + if (!_.HasCapability(spv::Capability::DescriptorHeapEXT)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Image storage class untyped pointers in Vulkan " + "require DescriptorHeapEXT be declared"; + } + break; default: return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(11417) << "In Vulkan, untyped pointers can only be used in an " "explicitly laid out storage class"; } @@ -802,8 +833,7 @@ spv_result_t ValidateTensorDim(ValidationState_t& _, const Instruction* inst) { const auto dim_index = 1; const auto dim_id = inst->GetOperandAs(dim_index); const auto dim = _.FindDef(dim_id); - if (!dim || !_.IsIntScalarType(dim->type_id()) || - _.GetBitWidth(dim->type_id()) != 32) { + if (!dim || !_.IsIntScalarType(dim->type_id(), 32)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << spvOpcodeString(inst->opcode()) << " Dim " << _.getIdName(dim_id) << " is not a 32-bit integer."; @@ -870,8 +900,7 @@ spv_result_t ValidateTypeTensorViewNV(ValidationState_t& _, for (size_t p_index = 3; p_index < inst->operands().size(); ++p_index) { auto p_id = inst->GetOperandAs(p_index); const auto p = _.FindDef(p_id); - if (!p || !_.IsIntScalarType(p->type_id()) || - _.GetBitWidth(p->type_id()) != 32) { + if (!p || !_.IsIntScalarType(p->type_id(), 32)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << spvOpcodeString(inst->opcode()) << " Permutation " << _.getIdName(p_id) << " is not a 32-bit integer."; @@ -982,6 +1011,18 @@ spv_result_t ValidateTypeTensorARM(ValidationState_t& _, return SPV_SUCCESS; } + +spv_result_t ValidateTypeBufferEXT(ValidationState_t& _, + const Instruction* inst) { + auto sc = inst->GetOperandAs(1); + if (sc != spv::StorageClass::Uniform && + sc != spv::StorageClass::StorageBuffer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << spvOpcodeString(inst->opcode()) + << " StorageClass could only be StorageBuffer or Uniform."; + } + return SPV_SUCCESS; +} } // namespace spv_result_t TypePass(ValidationState_t& _, const Instruction* inst) { @@ -1027,8 +1068,8 @@ spv_result_t TypePass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpTypeCooperativeMatrixKHR: if (auto error = ValidateTypeCooperativeMatrix(_, inst)) return error; break; - case spv::Op::OpTypeCooperativeVectorNV: - if (auto error = ValidateTypeCooperativeVectorNV(_, inst)) return error; + case spv::Op::OpTypeVectorIdEXT: + if (auto error = ValidateTypeVectorIdEXT(_, inst)) return error; break; case spv::Op::OpTypeUntypedPointerKHR: if (auto error = ValidateTypeUntypedPointerKHR(_, inst)) return error; @@ -1042,6 +1083,9 @@ spv_result_t TypePass(ValidationState_t& _, const Instruction* inst) { case spv::Op::OpTypeTensorARM: if (auto error = ValidateTypeTensorARM(_, inst)) return error; break; + case spv::Op::OpTypeBufferEXT: + if (auto error = ValidateTypeBufferEXT(_, inst)) return error; + break; default: break; } diff --git a/third_party/spirv-tools/source/val/validation_state.cpp b/third_party/spirv-tools/source/val/validation_state.cpp index 836e3316c5..8e9e617bb6 100644 --- a/third_party/spirv-tools/source/val/validation_state.cpp +++ b/third_party/spirv-tools/source/val/validation_state.cpp @@ -17,6 +17,7 @@ #include "source/val/validation_state.h" #include +#include #include #include @@ -42,14 +43,17 @@ ModuleLayoutSection InstructionLayoutSection( switch (op) { case spv::Op::OpCapability: + case spv::Op::OpConditionalCapabilityINTEL: return kLayoutCapabilities; case spv::Op::OpExtension: + case spv::Op::OpConditionalExtensionINTEL: return kLayoutExtensions; case spv::Op::OpExtInstImport: return kLayoutExtInstImport; case spv::Op::OpMemoryModel: return kLayoutMemoryModel; case spv::Op::OpEntryPoint: + case spv::Op::OpConditionalEntryPointINTEL: return kLayoutEntryPoint; case spv::Op::OpExecutionMode: case spv::Op::OpExecutionModeId: @@ -66,6 +70,7 @@ ModuleLayoutSection InstructionLayoutSection( return kLayoutDebug3; case spv::Op::OpDecorate: case spv::Op::OpMemberDecorate: + case spv::Op::OpMemberDecorateIdEXT: case spv::Op::OpGroupDecorate: case spv::Op::OpGroupMemberDecorate: case spv::Op::OpDecorationGroup: @@ -85,6 +90,9 @@ ModuleLayoutSection InstructionLayoutSection( // spv::Op::OpExtInst is only allowed in types section for certain // extended instruction sets. This will be checked separately. if (current_section == kLayoutTypes) return kLayoutTypes; + // SpvOpExtInst is allowed in graph definitions. + if (current_section == kLayoutGraphDefinitions) + return kLayoutGraphDefinitions; return kLayoutFunctionDefinitions; case spv::Op::OpLine: case spv::Op::OpNoLine: @@ -99,6 +107,16 @@ ModuleLayoutSection InstructionLayoutSection( return kLayoutFunctionDefinitions; case spv::Op::OpSamplerImageAddressingModeNV: return kLayoutSamplerImageAddressMode; + case spv::Op::OpGraphEntryPointARM: + case spv::Op::OpGraphARM: + case spv::Op::OpGraphInputARM: + case spv::Op::OpGraphSetOutputARM: + case spv::Op::OpGraphEndARM: + return kLayoutGraphDefinitions; + case spv::Op::OpCompositeExtract: + if (current_section == kLayoutGraphDefinitions) + return kLayoutGraphDefinitions; + return kLayoutFunctionDefinitions; default: break; } @@ -174,6 +192,7 @@ ValidationState_t::ValidationState_t(const spv_const_context ctx, pointer_size_and_alignment_(0), sampler_image_addressing_mode_(0), in_function_(false), + graph_definition_region_(kGraphDefinitionOutside), num_of_warnings_(0), max_num_of_warnings_(max_warnings) { assert(opt && "Validator options may not be Null."); @@ -362,6 +381,10 @@ bool ValidationState_t::in_block() const { module_functions_.back().current_block() != nullptr; } +GraphDefinitionRegion ValidationState_t::graph_definition_region() const { + return graph_definition_region_; +} + void ValidationState_t::RegisterCapability(spv::Capability cap) { // Avoid redundant work. Otherwise the recursion could induce work // quadrdatic in the capability dependency depth. (Ok, not much, but @@ -532,6 +555,13 @@ spv_result_t ValidationState_t::RegisterFunctionEnd() { return SPV_SUCCESS; } +void ValidationState_t::SetGraphDefinitionRegion(GraphDefinitionRegion region) { + assert((region == kGraphDefinitionOutside && + graph_definition_region_ == kGraphDefinitionOutputs) || + region >= graph_definition_region_); + graph_definition_region_ = region; +} + Instruction* ValidationState_t::AddOrderedInstruction( const spv_parsed_instruction_t* inst) { ordered_instructions_.emplace_back(inst); @@ -831,6 +861,22 @@ void ValidationState_t::RegisterStorageClassConsumer( } return true; }); + } else if (storage_class == spv::StorageClass::HitObjectAttributeEXT) { + function(consumer->function()->id()) + ->RegisterExecutionModelLimitation([](spv::ExecutionModel model, + std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR) { + if (message) { + *message = + "HitObjectAttributeEXT Storage Class is limited to " + "RayGenerationKHR, ClosestHitKHR or MissKHR execution model"; + } + return false; + } + return true; + }); } } @@ -875,9 +921,12 @@ uint32_t ValidationState_t::GetComponentType(uint32_t id) const { case spv::Op::OpTypeFloat: case spv::Op::OpTypeInt: case spv::Op::OpTypeBool: + case spv::Op::OpTypePointer: + case spv::Op::OpTypeUntypedPointerKHR: return id; case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: return inst->word(2); case spv::Op::OpTypeVector: @@ -888,7 +937,7 @@ uint32_t ValidationState_t::GetComponentType(uint32_t id) const { case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: return inst->word(2); case spv::Op::OpTypeTensorARM: @@ -920,10 +969,18 @@ uint32_t ValidationState_t::GetDimension(uint32_t id) const { case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: // Actual dimension isn't known, return 0 return 0; + case spv::Op::OpTypeVectorIdEXT: { + uint64_t value = 0; + if (EvalConstantValUint64(inst->word(3), &value)) { + return static_cast(value); + } + + return 0; + } + default: break; } @@ -939,11 +996,20 @@ uint32_t ValidationState_t::GetBitWidth(uint32_t id) const { const Instruction* inst = FindDef(component_type_id); assert(inst); - if (inst->opcode() == spv::Op::OpTypeFloat || - inst->opcode() == spv::Op::OpTypeInt) - return inst->word(2); - - if (inst->opcode() == spv::Op::OpTypeBool) return 1; + switch (inst->opcode()) { + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeInt: + return inst->word(2); + case spv::Op::OpTypeBool: + return 1; + case spv::Op::OpTypePointer: + case spv::Op::OpTypeUntypedPointerKHR: + assert(inst->GetOperandAs(1) == + spv::StorageClass::PhysicalStorageBuffer); + return 64; // all pointers to another PSB is 64-bit + default: + break; + } assert(0); return 0; @@ -958,6 +1024,33 @@ bool ValidationState_t::IsScalarType(uint32_t id) const { return IsIntScalarType(id) || IsFloatScalarType(id) || IsBoolScalarType(id); } +bool ValidationState_t::IsVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + if (!inst) { + return false; + } + + return inst->opcode() == spv::Op::OpTypeVector || + inst->opcode() == spv::Op::OpTypeVectorIdEXT; +} + +bool ValidationState_t::IsArrayType(uint32_t id, uint64_t length) const { + const Instruction* inst = FindDef(id); + if (!inst || inst->opcode() != spv::Op::OpTypeArray) { + return false; + } + if (length != 0) { + const auto len_id = inst->GetOperandAs(2); + const auto len = FindDef(len_id); + uint64_t len_value = 0; + if (!len || !spvOpcodeIsConstant(len->opcode()) || + (EvalConstantValUint64(len_id, &len_value) && (length != len_value))) { + return false; + } + } + return true; +} + bool ValidationState_t::IsBfloat16ScalarType(uint32_t id) const { const Instruction* inst = FindDef(id); if (inst && inst->opcode() == spv::Op::OpTypeFloat) { @@ -977,13 +1070,31 @@ bool ValidationState_t::IsBfloat16VectorType(uint32_t id) const { return false; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsBfloat16ScalarType(GetComponentType(id)); } return false; } +bool ValidationState_t::IsBfloat16CoopMatType(uint32_t id) const { + const Instruction* inst = FindDef(id); + if (!inst) { + return false; + } + + if (inst->opcode() == spv::Op::OpTypeCooperativeMatrixKHR) { + return IsBfloat16ScalarType(inst->word(2)); + } + + return false; +} + +bool ValidationState_t::IsBfloat16Type(uint32_t id) const { + return IsBfloat16ScalarType(id) || IsBfloat16VectorType(id) || + IsBfloat16CoopMatType(id); +} + bool ValidationState_t::IsFP8ScalarType(uint32_t id) const { const Instruction* inst = FindDef(id); if (inst && inst->opcode() == spv::Op::OpTypeFloat) { @@ -1004,42 +1115,53 @@ bool ValidationState_t::IsFP8VectorType(uint32_t id) const { return false; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsFP8ScalarType(GetComponentType(id)); } return false; } -bool ValidationState_t::IsFP8ScalarOrVectorType(uint32_t id) const { - return IsFP8ScalarType(id) || IsFP8VectorType(id); -} - -bool ValidationState_t::IsFloatScalarType(uint32_t id) const { - const Instruction* inst = FindDef(id); - return inst && inst->opcode() == spv::Op::OpTypeFloat; -} - -bool ValidationState_t::IsFloatArrayType(uint32_t id) const { +bool ValidationState_t::IsFP8CoopMatType(uint32_t id) const { const Instruction* inst = FindDef(id); if (!inst) { return false; } - if (inst->opcode() == spv::Op::OpTypeArray) { - return IsFloatScalarType(GetComponentType(id)); + if (inst->opcode() == spv::Op::OpTypeCooperativeMatrixKHR) { + return IsFP8ScalarType(inst->word(2)); } return false; } +bool ValidationState_t::IsFP8Type(uint32_t id) const { + return IsFP8ScalarType(id) || IsFP8VectorType(id) || IsFP8CoopMatType(id); +} + +bool ValidationState_t::IsFloatScalarType(uint32_t id, uint32_t width) const { + const Instruction* inst = FindDef(id); + bool is_float = inst && inst->opcode() == spv::Op::OpTypeFloat; + if (!is_float) { + return false; + } + if ((width != 0) && (width != inst->word(2))) { + return false; + } + return true; +} + +bool ValidationState_t::IsFloatArrayType(uint32_t id) const { + return IsArrayType(id) && IsFloatScalarType(GetComponentType(id)); +} + bool ValidationState_t::IsFloatVectorType(uint32_t id) const { const Instruction* inst = FindDef(id); if (!inst) { return false; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsFloatScalarType(GetComponentType(id)); } @@ -1047,10 +1169,7 @@ bool ValidationState_t::IsFloatVectorType(uint32_t id) const { } bool ValidationState_t::IsFloat16Vector2Or4Type(uint32_t id) const { - const Instruction* inst = FindDef(id); - assert(inst); - - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { uint32_t vectorDim = GetDimension(id); return IsFloatScalarType(GetComponentType(id)) && (vectorDim == 2 || vectorDim == 4) && @@ -1070,43 +1189,34 @@ bool ValidationState_t::IsFloatScalarOrVectorType(uint32_t id) const { return true; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsFloatScalarType(GetComponentType(id)); } return false; } -bool ValidationState_t::IsIntScalarType(uint32_t id) const { +bool ValidationState_t::IsIntScalarType(uint32_t id, uint32_t width) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == spv::Op::OpTypeInt; + bool is_int = inst && inst->opcode() == spv::Op::OpTypeInt; + if (!is_int) { + return false; + } + if ((width != 0) && (width != inst->word(2))) { + return false; + } + return true; +} + +bool ValidationState_t::IsIntScalarTypeWithSignedness( + uint32_t id, uint32_t signedness) const { + const Instruction* inst = FindDef(id); + return inst && inst->opcode() == spv::Op::OpTypeInt && + inst->word(3) == signedness; } bool ValidationState_t::IsIntArrayType(uint32_t id, uint64_t length) const { - const Instruction* inst = FindDef(id); - if (!inst) { - return false; - } - - if (inst->opcode() != spv::Op::OpTypeArray) { - return false; - } - - if (!IsIntScalarType(GetComponentType(id))) { - return false; - } - - if (length != 0) { - const auto len_id = inst->GetOperandAs(2); - const auto len = FindDef(len_id); - uint64_t len_value = 0; - if (!len || !spvOpcodeIsConstant(len->opcode()) || - (EvalConstantValUint64(len_id, &len_value) && (length != len_value))) { - return false; - } - } - - return true; + return IsArrayType(id, length) && IsIntScalarType(GetComponentType(id)); } bool ValidationState_t::IsIntVectorType(uint32_t id) const { @@ -1115,7 +1225,7 @@ bool ValidationState_t::IsIntVectorType(uint32_t id) const { return false; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsIntScalarType(GetComponentType(id)); } @@ -1132,7 +1242,7 @@ bool ValidationState_t::IsIntScalarOrVectorType(uint32_t id) const { return true; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsIntScalarType(GetComponentType(id)); } @@ -1140,8 +1250,7 @@ bool ValidationState_t::IsIntScalarOrVectorType(uint32_t id) const { } bool ValidationState_t::IsUnsignedIntScalarType(uint32_t id) const { - const Instruction* inst = FindDef(id); - return inst && inst->opcode() == spv::Op::OpTypeInt && inst->word(3) == 0; + return IsIntScalarTypeWithSignedness(id, 0); } bool ValidationState_t::IsUnsignedIntVectorType(uint32_t id) const { @@ -1150,7 +1259,7 @@ bool ValidationState_t::IsUnsignedIntVectorType(uint32_t id) const { return false; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsUnsignedIntScalarType(GetComponentType(id)); } @@ -1167,7 +1276,7 @@ bool ValidationState_t::IsUnsignedIntScalarOrVectorType(uint32_t id) const { return inst->GetOperandAs(2) == 0; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsUnsignedIntScalarType(GetComponentType(id)); } @@ -1185,7 +1294,7 @@ bool ValidationState_t::IsSignedIntVectorType(uint32_t id) const { return false; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsSignedIntScalarType(GetComponentType(id)); } @@ -1203,7 +1312,7 @@ bool ValidationState_t::IsBoolVectorType(uint32_t id) const { return false; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsBoolScalarType(GetComponentType(id)); } @@ -1220,7 +1329,7 @@ bool ValidationState_t::IsBoolScalarOrVectorType(uint32_t id) const { return true; } - if (inst->opcode() == spv::Op::OpTypeVector) { + if (IsVectorType(id)) { return IsBoolScalarType(GetComponentType(id)); } @@ -1312,6 +1421,29 @@ bool ValidationState_t::GetPointerTypeInfo( return true; } +uint32_t ValidationState_t::GetLargestScalarType(uint32_t id) const { + const Instruction* inst = FindDef(id); + + switch (inst->opcode()) { + case spv::Op::OpTypeStruct: { + uint32_t size = 0; + for (uint32_t i = 1; i < inst->operands().size(); ++i) { + const uint32_t member_size = + GetLargestScalarType(inst->GetOperandAs(i)); + size = std::max(size, member_size); + } + return size; + } + case spv::Op::OpTypeArray: + return GetLargestScalarType(inst->GetOperandAs(1)); + case spv::Op::OpTypeVector: + case spv::Op::OpTypeVectorIdEXT: + return GetLargestScalarType(inst->GetOperandAs(1)); + default: + return GetBitWidth(id) / 8; + } +} + bool ValidationState_t::IsAccelerationStructureType(uint32_t id) const { const Instruction* inst = FindDef(id); return inst && inst->opcode() == spv::Op::OpTypeAccelerationStructureKHR; @@ -1392,7 +1524,7 @@ bool ValidationState_t::IsUnsigned64BitHandle(uint32_t id) const { bool ValidationState_t::IsCooperativeVectorNVType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == spv::Op::OpTypeCooperativeVectorNV; + return inst && inst->opcode() == spv::Op::OpTypeVectorIdEXT; } bool ValidationState_t::IsFloatCooperativeVectorNVType(uint32_t id) const { @@ -1411,6 +1543,95 @@ bool ValidationState_t::IsUnsignedIntCooperativeVectorNVType( return IsUnsignedIntScalarType(FindDef(id)->word(2)); } +bool ValidationState_t::IsTensorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + return inst && inst->opcode() == spv::Op::OpTypeTensorARM; +} + +// Opaque handles from [Descriptor] section (added from SPV_EXT_descriptor_heap) +bool ValidationState_t::IsDescriptorType(spv::Op opcode) const { + return opcode == spv::Op::OpTypeBufferEXT || opcode == spv::Op::OpTypeImage || + opcode == spv::Op::OpTypeTensorARM || + opcode == spv::Op::OpTypeSampler || + opcode == spv::Op::OpTypeAccelerationStructureKHR; +} + +// Opaque handles from [Descriptor] section (added from SPV_EXT_descriptor_heap) +bool ValidationState_t::IsDescriptorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + return inst && IsDescriptorType(inst->opcode()); +} + +const Instruction* ValidationState_t::FindUntypedBaseVariable( + const Instruction* inst) { + bool found_heap_base = false; + const Instruction* base_inst = inst; + while (!found_heap_base) { + switch (base_inst->opcode()) { + case spv::Op::OpUntypedAccessChainKHR: + case spv::Op::OpUntypedInBoundsAccessChainKHR: + case spv::Op::OpUntypedPtrAccessChainKHR: + case spv::Op::OpUntypedInBoundsPtrAccessChainKHR: + case spv::Op::OpUntypedArrayLengthKHR: + base_inst = FindDef(base_inst->GetOperandAs(3)); + break; + case spv::Op::OpLoad: + case spv::Op::OpAtomicLoad: + if (GetIdOpcode(GetOperandTypeId(base_inst, 2)) == + spv::Op::OpTypeUntypedPointerKHR) { + base_inst = FindDef(base_inst->GetOperandAs(2)); + } + break; + case spv::Op::OpAtomicExchange: + case spv::Op::OpAtomicCompareExchange: + case spv::Op::OpAtomicCompareExchangeWeak: + case spv::Op::OpAtomicIIncrement: + case spv::Op::OpAtomicIDecrement: + case spv::Op::OpAtomicIAdd: + case spv::Op::OpAtomicISub: + case spv::Op::OpAtomicSMin: + case spv::Op::OpAtomicUMin: + case spv::Op::OpAtomicSMax: + case spv::Op::OpAtomicUMax: + case spv::Op::OpAtomicAnd: + case spv::Op::OpAtomicOr: + case spv::Op::OpAtomicXor: + base_inst = FindDef(base_inst->GetOperandAs(2)); + break; + case spv::Op::OpStore: + case spv::Op::OpAtomicStore: + if (GetIdOpcode(GetOperandTypeId(base_inst, 0)) == + spv::Op::OpTypeUntypedPointerKHR) { + base_inst = FindDef(base_inst->GetOperandAs(0)); + } + break; + default: + found_heap_base = true; + break; + } + + if (found_heap_base) { + break; + } + } + + return base_inst; +} + +bool ValidationState_t::IsDescriptorHeapBaseVariable(const Instruction* inst) { + if (!HasCapability(spv::Capability::DescriptorHeapEXT)) { + return false; + } + const Instruction* base_inst = FindUntypedBaseVariable(inst); + const bool is_heap_base = + IsBuiltin(base_inst->id(), spv::BuiltIn::SamplerHeapEXT) || + IsBuiltin(base_inst->id(), spv::BuiltIn::ResourceHeapEXT); + + return FindDef(base_inst->id())->opcode() == spv::Op::OpBufferPointerEXT || + (FindDef(base_inst->id())->opcode() == spv::Op::OpUntypedVariableKHR && + is_heap_base); +} + spv_result_t ValidationState_t::CooperativeMatrixShapesMatch( const Instruction* inst, uint32_t result_type_id, uint32_t m2, bool is_conversion, bool swap_row_col) { @@ -1445,8 +1666,7 @@ spv_result_t ValidationState_t::CooperativeMatrixShapesMatch( if (m1_is_const_int32 && m2_is_const_int32 && m1_value != m2_value) { return diag(SPV_ERROR_INVALID_DATA, inst) - << "Expected scopes of Matrix and Result Type to be " - << "identical"; + << "Expected scopes of Matrix and Result Type to be " << "identical"; } std::tie(m1_is_int32, m1_is_const_int32, m1_value) = @@ -1816,7 +2036,7 @@ bool ValidationState_t::ContainsType( case spv::Op::OpTypeSampledImage: case spv::Op::OpTypeCooperativeMatrixNV: case spv::Op::OpTypeCooperativeMatrixKHR: - case spv::Op::OpTypeCooperativeVectorNV: + case spv::Op::OpTypeVectorIdEXT: return ContainsType(inst->GetOperandAs(1u), f, traverse_all_types); case spv::Op::OpTypePointer: @@ -1891,6 +2111,7 @@ bool ValidationState_t::ContainsUntypedPointer(uint32_t id) const { case spv::Op::OpTypeArray: case spv::Op::OpTypeRuntimeArray: case spv::Op::OpTypeVector: + case spv::Op::OpTypeVectorIdEXT: case spv::Op::OpTypeMatrix: case spv::Op::OpTypeImage: case spv::Op::OpTypeSampledImage: @@ -1937,6 +2158,7 @@ bool ValidationState_t::IsValidStorageClass( case spv::StorageClass::ShaderRecordBufferKHR: case spv::StorageClass::TaskPayloadWorkgroupEXT: case spv::StorageClass::HitObjectAttributeNV: + case spv::StorageClass::HitObjectAttributeEXT: case spv::StorageClass::TileImageEXT: case spv::StorageClass::NodePayloadAMDX: case spv::StorageClass::TileAttachmentQCOM: @@ -2159,6 +2381,12 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-LocalInvocationId-LocalInvocationId-04282); case 4283: return VUID_WRAP(VUID-LocalInvocationId-LocalInvocationId-04283); + case 4284: + return VUID_WRAP(VUID-LocalInvocationIndex-LocalInvocationIndex-04284); + case 4285: + return VUID_WRAP(VUID-LocalInvocationIndex-LocalInvocationIndex-04285); + case 4286: + return VUID_WRAP(VUID-LocalInvocationIndex-LocalInvocationIndex-04286); case 4293: return VUID_WRAP(VUID-NumSubgroups-NumSubgroups-04293); case 4294: @@ -2220,7 +2448,7 @@ std::string ValidationState_t::VkErrorID(uint32_t id, case 4330: return VUID_WRAP(VUID-PrimitiveId-PrimitiveId-04330); case 4333: - return VUID_WRAP(VUID-PrimitiveId-PrimitiveId-04333); + return VUID_WRAP(VUID-PrimitiveId-Fragment-04333); case 4334: return VUID_WRAP(VUID-PrimitiveId-PrimitiveId-04334); case 4336: @@ -2409,10 +2637,6 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-StandaloneSpirv-None-04644); case 4645: return VUID_WRAP(VUID-StandaloneSpirv-None-04645); - case 10609: - return VUID_WRAP(VUID-StandaloneSpirv-OpControlBarrier-10609); - case 4650: - return VUID_WRAP(VUID-StandaloneSpirv-OpControlBarrier-04650); case 4651: return VUID_WRAP(VUID-StandaloneSpirv-OpVariable-04651); case 4652: @@ -2447,8 +2671,6 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-StandaloneSpirv-OpTypeRuntimeArray-04680); case 4682: return VUID_WRAP(VUID-StandaloneSpirv-OpControlBarrier-04682); - case 6426: - return VUID_WRAP(VUID-StandaloneSpirv-LocalSize-06426); // formally 04683 case 4685: return VUID_WRAP(VUID-StandaloneSpirv-OpGroupNonUniformBallotBitCount-04685); case 4686: @@ -2479,14 +2701,6 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-StandaloneSpirv-PhysicalStorageBuffer64-04710); case 4711: return VUID_WRAP(VUID-StandaloneSpirv-OpTypeForwardPointer-04711); - case 4730: - return VUID_WRAP(VUID-StandaloneSpirv-OpAtomicStore-04730); - case 4731: - return VUID_WRAP(VUID-StandaloneSpirv-OpAtomicLoad-04731); - case 4732: - return VUID_WRAP(VUID-StandaloneSpirv-OpMemoryBarrier-04732); - case 4733: - return VUID_WRAP(VUID-StandaloneSpirv-OpMemoryBarrier-04733); case 4734: return VUID_WRAP(VUID-StandaloneSpirv-OpVariable-04734); case 4744: @@ -2519,6 +2733,8 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-StandaloneSpirv-Flat-06202); case 6214: return VUID_WRAP(VUID-StandaloneSpirv-OpTypeImage-06214); + case 6314: + return VUID_WRAP(VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314); case 6491: return VUID_WRAP(VUID-StandaloneSpirv-DescriptorSet-06491); case 6671: @@ -2597,6 +2813,8 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-ViewportIndex-ViewportIndex-07060); case 7102: return VUID_WRAP(VUID-StandaloneSpirv-MeshEXT-07102); + case 7107: + return VUID_WRAP(VUID-StandaloneSpirv-MeshEXT-07107); case 7290: return VUID_WRAP(VUID-StandaloneSpirv-Input-07290); case 7320: @@ -2629,6 +2847,10 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-StandaloneSpirv-OpEntryPoint-09658); case 9659: return VUID_WRAP(VUID-StandaloneSpirv-OpEntryPoint-09659); + case 10151: + return VUID_WRAP(VUID-StandaloneSpirv-DerivativeGroupQuadsKHR-10151); + case 10152: + return VUID_WRAP(VUID-StandaloneSpirv-DerivativeGroupLinearKHR-10152); case 10213: // This use to be a standalone, but maintenance8 will set allow_offset_texture_operand now return VUID_WRAP(VUID-RuntimeSpirv-Offset-10213); @@ -2663,10 +2885,72 @@ std::string ValidationState_t::VkErrorID(uint32_t id, case 10684: return VUID_WRAP(VUID-StandaloneSpirv-None-10684); case 10685: - return VUID_WRAP(VUID-StandaloneSpirv-None-10685); + return VUID_WRAP(VUID-StandaloneSpirv-None-10685); // formally 04683/06426 + case 10823: + return VUID_WRAP(VUID-StandaloneSpirv-OpTypeFloat-10823); case 10824: // This use to be a standalone, but maintenance9 will set allow_vulkan_32_bit_bitwise now return VUID_WRAP(VUID-RuntimeSpirv-None-10824); + case 10865: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10865); + case 10866: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10866); + case 10867: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10867); + case 10868: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10868); + case 10869: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10869); + case 10870: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10870); + case 10871: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10871); + case 10872: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10872); + case 10873: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10873); + case 10874: + return VUID_WRAP(VUID-StandaloneSpirv-MemorySemantics-10874); + case 10875: + return VUID_WRAP(VUID-StandaloneSpirv-UnequalMemorySemantics-10875); + case 10876: + return VUID_WRAP(VUID-StandaloneSpirv-UnequalMemorySemantics-10876); + case 10877: + return VUID_WRAP(VUID-StandaloneSpirv-UnequalMemorySemantics-10877); + case 10878: + return VUID_WRAP(VUID-StandaloneSpirv-UnequalMemorySemantics-10878); + case 10879: + return VUID_WRAP(VUID-StandaloneSpirv-UnequalMemorySemantics-10879); + case 10880: + return VUID_WRAP(VUID-StandaloneSpirv-TessLevelInner-10880); + case 11167: + return VUID_WRAP(VUID-StandaloneSpirv-OpUntypedVariableKHR-11167); + case 11239: + return VUID_WRAP(VUID-SamplerHeapEXT-SamplerHeapEXT-11239); + case 11241: + return VUID_WRAP(VUID-ResourceHeapEXT-ResourceHeapEXT-11241); + case 11336: + return VUID_WRAP(VUID-StandaloneSpirv-Result-11336); + case 11337: + return VUID_WRAP(VUID-StandaloneSpirv-Result-11337); + case 11339: + return VUID_WRAP(VUID-StandaloneSpirv-Result-11339); + case 11346: + return VUID_WRAP(VUID-StandaloneSpirv-Result-11346); + case 11347: + return VUID_WRAP(VUID-StandaloneSpirv-OpUntypedVariableKHR-11347); + case 11416: + return VUID_WRAP(VUID-StandaloneSpirv-OpUntypedImageTexelPointerEXT-11416); + case 11417: + return VUID_WRAP(VUID-StandaloneSpirv-OpTypeUntypedPointerKHR-11417); + case 11482: + return VUID_WRAP(VUID-StandaloneSpirv-DescriptorHeapEXT-11482); + case 11805: + return VUID_WRAP(VUID-StandaloneSpirv-OpArrayLength-11805); + case 12243: + return VUID_WRAP(VUID-StandaloneSpirv-Scope-12243); + case 12294: + return VUID_WRAP(VUID-StandaloneSpirv-Function-12294); default: return ""; // unknown id } diff --git a/third_party/spirv-tools/source/val/validation_state.h b/third_party/spirv-tools/source/val/validation_state.h index 0e402ef2b1..560122433b 100644 --- a/third_party/spirv-tools/source/val/validation_state.h +++ b/third_party/spirv-tools/source/val/validation_state.h @@ -50,6 +50,7 @@ enum ModuleLayoutSection { kLayoutExtInstImport, /// < Section 2.4 #3 kLayoutMemoryModel, /// < Section 2.4 #4 kLayoutSamplerImageAddressMode, /// < Section 2.4 #5 + /// (SPV_NV_bindless_texture) kLayoutEntryPoint, /// < Section 2.4 #6 kLayoutExecutionMode, /// < Section 2.4 #7 kLayoutDebug1, /// < Section 2.4 #8 > 1 @@ -58,7 +59,18 @@ enum ModuleLayoutSection { kLayoutAnnotations, /// < Section 2.4 #9 kLayoutTypes, /// < Section 2.4 #10 kLayoutFunctionDeclarations, /// < Section 2.4 #11 - kLayoutFunctionDefinitions /// < Section 2.4 #12 + kLayoutFunctionDefinitions, /// < Section 2.4 #12 + kLayoutGraphDefinitions /// < Section 2.4 #13 (SPV_ARM_graph) +}; + +/// This enum represents the regions of a graph definition. The relative +/// ordering of the values is significant. +enum GraphDefinitionRegion { + kGraphDefinitionOutside, + kGraphDefinitionBegin, + kGraphDefinitionInputs, + kGraphDefinitionBody, + kGraphDefinitionOutputs, }; /// This class manages the state of the SPIR-V validation as it is being parsed. @@ -213,6 +225,9 @@ class ValidationState_t { /// instruction bool in_block() const; + /// Returns the region of a graph definition we are in. + GraphDefinitionRegion graph_definition_region() const; + struct EntryPointDescription { std::string name; std::vector interfaces; @@ -313,6 +328,16 @@ class ValidationState_t { /// ComputeFunctionToEntryPointMapping. void ComputeRecursiveEntryPoints(); + /// Registers |id| as a graph entry point. + void RegisterGraphEntryPoint(const uint32_t id) { + graph_entry_points_.push_back(id); + } + + /// Returns a list of graph entry point graph ids + const std::vector& graph_entry_points() const { + return graph_entry_points_; + } + /// Returns all the entry points that can call |func|. const std::vector& FunctionEntryPoints(uint32_t func) const; @@ -350,6 +375,9 @@ class ValidationState_t { /// Register a function end instruction spv_result_t RegisterFunctionEnd(); + /// Sets the region of a graph definition we're in. + void SetGraphDefinitionRegion(GraphDefinitionRegion region); + /// Returns true if the capability is enabled in the module. bool HasCapability(spv::Capability cap) const { return module_capabilities_.contains(cap); @@ -494,6 +522,29 @@ class ValidationState_t { [dec](const Decoration& d) { return dec == d.dec_type(); }); } + /// Returns true if the given id has the given built-in decoration , + /// otherwise returns false. + bool IsBuiltin(spv::Id id, spv::BuiltIn bt) { + for (auto& dec : id_decorations(id)) { + if (dec.dec_type() == spv::Decoration::BuiltIn) { + if (dec.builtin() == bt) return true; + break; + } + } + return false; + } + + bool ContainsBuiltin(spv::Id id, spv::BuiltIn bt) { + const auto isHeapType = [&](const Instruction* inst) { + if (HasCapability(spv::Capability::DescriptorHeapEXT) && + IsBuiltin(inst->id(), bt)) { + return true; + } + return false; + }; + return ContainsType(uint32_t(id), isHeapType); + } + /// Finds id's def, if it exists. If found, returns the definition otherwise /// nullptr const Instruction* FindDef(uint32_t id) const; @@ -632,23 +683,27 @@ class ValidationState_t { bool GetStructMemberTypes(uint32_t struct_type_id, std::vector* member_types) const; - // Returns true iff |id| is a type corresponding to the name of the function. + // Returns true if |id| is a type corresponding to the name of the function. // Only works for types not for objects. bool IsVoidType(uint32_t id) const; bool IsScalarType(uint32_t id) const; + bool IsVectorType(uint32_t id) const; bool IsBfloat16ScalarType(uint32_t id) const; bool IsBfloat16VectorType(uint32_t id) const; + bool IsBfloat16CoopMatType(uint32_t id) const; + bool IsBfloat16Type(uint32_t id) const; bool IsFP8ScalarType(uint32_t id) const; bool IsFP8VectorType(uint32_t id) const; - bool IsFP8ScalarOrVectorType(uint32_t id) const; - bool IsFloatScalarType(uint32_t id) const; + bool IsFP8CoopMatType(uint32_t id) const; + bool IsFP8Type(uint32_t id) const; + bool IsFloatScalarType(uint32_t id, uint32_t width = 0) const; bool IsFloatArrayType(uint32_t id) const; bool IsFloatVectorType(uint32_t id) const; bool IsFloat16Vector2Or4Type(uint32_t id) const; bool IsFloatScalarOrVectorType(uint32_t id) const; bool IsFloatMatrixType(uint32_t id) const; - bool IsIntScalarType(uint32_t id) const; - bool IsIntArrayType(uint32_t id, uint64_t length = 0) const; + bool IsIntScalarType(uint32_t id, uint32_t width = 0) const; + bool IsIntScalarTypeWithSignedness(uint32_t id, uint32_t signedness) const; bool IsIntVectorType(uint32_t id) const; bool IsIntScalarOrVectorType(uint32_t id) const; bool IsUnsignedIntScalarType(uint32_t id) const; @@ -675,6 +730,40 @@ class ValidationState_t { bool IsFloatCooperativeVectorNVType(uint32_t id) const; bool IsIntCooperativeVectorNVType(uint32_t id) const; bool IsUnsignedIntCooperativeVectorNVType(uint32_t id) const; + bool IsTensorType(uint32_t id) const; + bool IsDescriptorType(spv::Op opcode) const; + bool IsDescriptorType(uint32_t id) const; + // When |length| is not 0, return true only if the array length is equal to + // |length| and the array length is not defined by a specialization constant. + bool IsArrayType(uint32_t id, uint64_t length = 0) const; + bool IsIntArrayType(uint32_t id, uint64_t length = 0) const; + template + bool IsIntNOrFP32OrFP16(unsigned int type_id) { + return this->ContainsType( + type_id, + [](const Instruction* inst) { + if (inst->opcode() == spv::Op::OpTypeInt) { + return inst->GetOperandAs(1) == N; + } else if (inst->opcode() == spv::Op::OpTypeFloat) { + if (inst->operands().size() > 2) { + // Not IEEE + return false; + } + auto width = inst->GetOperandAs(1); + return width == 32 || width == 16; + } + return false; + }, + /* traverse_all_types = */ false); + } + + // Will walk the type to find the largest scalar value size. + // Returns value is in bytes. + // This is designed to pass in the %type from a PSB pointer + // %ptr = OpTypePointer PhysicalStorageBuffer %type + uint32_t GetLargestScalarType(uint32_t id) const; + bool IsDescriptorHeapBaseVariable(const Instruction* inst); + const Instruction* FindUntypedBaseVariable(const Instruction* inst); // Returns true if |id| is a type id that contains |type| (or integer or // floating point type) of |width| bits. @@ -715,6 +804,17 @@ class ValidationState_t { bool GetPointerTypeInfo(uint32_t id, uint32_t* data_type, spv::StorageClass* storage_class) const; + // Returns the value assocated with id via 'value' if id is an OpConstant + template + bool GetConstantValueAs(unsigned int id, T& value) { + const auto inst = FindDef(id); + uint64_t ui64_val = 0u; + bool status = (inst && spvOpcodeIsConstant(inst->opcode()) && + EvalConstantValUint64(id, &ui64_val)); + if (status == true) value = static_cast(ui64_val); + return status; + } + // Is the ID the type of a pointer to a uniform block: Block-decorated struct // in uniform storage class? The result is only valid after internal method // CheckDecorationsOfBuffers has been called. @@ -955,6 +1055,9 @@ class ValidationState_t { /// graph that recurses. std::set recursive_entry_points_; + /// IDs that are graph entry points, ie, arguments to OpGraphEntryPointARM. + std::vector graph_entry_points_; + /// Functions IDs that are target of OpFunctionCall. std::unordered_set function_call_targets_; @@ -997,9 +1100,13 @@ class ValidationState_t { /// bit width of sampler/image type variables. Valid values are 32 and 64 uint32_t sampler_image_addressing_mode_; - /// NOTE: See correspoding getter functions + /// NOTE: See corresponding getter functions bool in_function_; + /// Where in a graph definition we are + /// NOTE: See corresponding getter/setter functions + GraphDefinitionRegion graph_definition_region_; + /// The state of optional features. These are determined by capabilities /// declared by the module and the environment. Feature features_; diff --git a/third_party/spirv-tools/test/CMakeLists.txt b/third_party/spirv-tools/test/CMakeLists.txt index acd5116200..d7f60b50e1 100644 --- a/third_party/spirv-tools/test/CMakeLists.txt +++ b/third_party/spirv-tools/test/CMakeLists.txt @@ -103,6 +103,7 @@ set(TEST_SOURCES diagnostic_test.cpp enum_string_mapping_test.cpp enum_set_test.cpp + ext_inst.arm_motion_engine_test.cpp ext_inst.cldebug100_test.cpp ext_inst.debuginfo_test.cpp ext_inst.glsl_test.cpp diff --git a/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_autogen.cpp b/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_autogen.cpp new file mode 100644 index 0000000000..bc510d091c --- /dev/null +++ b/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_autogen.cpp @@ -0,0 +1,292 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by generate_tests.py +// +// Copyright (c) 2022 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "../diff_test_utils.h" +#include "gtest/gtest.h" + +namespace spvtools { +namespace diff { +namespace { + +// Tests a diff where the shader has OpExtInst in the debug, decorations and +// types/variables sections. +constexpr char kSrc[] = R"( OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "GLSL.std.450" + %20 = OpExtInstImport "NonSemantic.MadeUp" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + %21 = OpExtInst %2 %20 123 + %22 = OpExtInst %2 %20 234 + OpName %9 "color" + OpName %11 "v" + OpDecorate %9 RelaxedPrecision + OpDecorate %9 Location 0 + OpDecorate %11 RelaxedPrecision + OpDecorate %11 Location 0 + %23 = OpExtInst %2 %20 345 + %24 = OpExtInst %2 %20 456 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %6 + %11 = OpVariable %10 Input + %25 = OpExtInst %2 %20 567 + %26 = OpExtInst %2 %20 678 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %6 %11 + %13 = OpExtInst %6 %1 Log2 %12 + %14 = OpCompositeConstruct %7 %13 %13 %13 %13 + OpStore %9 %14 + OpReturn + OpFunctionEnd)"; +constexpr char kDst[] = R"( OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "GLSL.std.450" + %30 = OpExtInstImport "NonSemantic.MadeUp" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + %31 = OpExtInst %2 %30 123 + %32 = OpExtInst %2 %30 2340 + OpName %9 "color" + OpName %11 "v" + OpDecorate %9 RelaxedPrecision + OpDecorate %9 Location 0 + OpDecorate %11 RelaxedPrecision + OpDecorate %11 Location 0 + %33 = OpExtInst %2 %30 3450 + %34 = OpExtInst %2 %30 456 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %6 + %11 = OpVariable %10 Input + %35 = OpExtInst %2 %30 567 + %36 = OpExtInst %2 %30 678 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %6 %11 + %13 = OpExtInst %6 %1 Log2 %12 + %14 = OpCompositeConstruct %7 %13 %13 %13 %13 + OpStore %9 %14 + OpReturn + OpFunctionEnd +)"; + +TEST(DiffTest, OpextinstInVariables) { + constexpr char kDiff[] = R"( ; SPIR-V + ; Version: 1.6 + ; Generator: Khronos SPIR-V Tools Assembler; 0 +-; Bound: 27 ++; Bound: 29 + ; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "GLSL.std.450" + %20 = OpExtInstImport "NonSemantic.MadeUp" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "color" + OpName %11 "v" + OpDecorate %9 RelaxedPrecision + OpDecorate %9 Location 0 + OpDecorate %11 RelaxedPrecision + OpDecorate %11 Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %21 = OpExtInst %2 %20 123 +-%22 = OpExtInst %2 %20 234 +-%23 = OpExtInst %2 %20 345 ++%27 = OpExtInst %2 %20 2340 ++%28 = OpExtInst %2 %20 3450 + %24 = OpExtInst %2 %20 456 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %6 + %11 = OpVariable %10 Input + %25 = OpExtInst %2 %20 567 + %26 = OpExtInst %2 %20 678 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %6 %11 + %13 = OpExtInst %6 %1 Log2 %12 + %14 = OpCompositeConstruct %7 %13 %13 %13 %13 + OpStore %9 %14 + OpReturn + OpFunctionEnd +)"; + Options options; + DoStringDiffTest(kSrc, kDst, kDiff, options); +} + +TEST(DiffTest, OpextinstInVariablesNoDebug) { + constexpr char kSrcNoDebug[] = R"( OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "GLSL.std.450" + %20 = OpExtInstImport "NonSemantic.MadeUp" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + %21 = OpExtInst %2 %20 123 + %22 = OpExtInst %2 %20 234 + OpDecorate %9 RelaxedPrecision + OpDecorate %9 Location 0 + OpDecorate %11 RelaxedPrecision + OpDecorate %11 Location 0 + %23 = OpExtInst %2 %20 345 + %24 = OpExtInst %2 %20 456 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %6 + %11 = OpVariable %10 Input + %25 = OpExtInst %2 %20 567 + %26 = OpExtInst %2 %20 678 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %6 %11 + %13 = OpExtInst %6 %1 Log2 %12 + %14 = OpCompositeConstruct %7 %13 %13 %13 %13 + OpStore %9 %14 + OpReturn + OpFunctionEnd +)"; + constexpr char kDstNoDebug[] = R"( OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "GLSL.std.450" + %30 = OpExtInstImport "NonSemantic.MadeUp" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + %31 = OpExtInst %2 %30 123 + %32 = OpExtInst %2 %30 2340 + OpDecorate %9 RelaxedPrecision + OpDecorate %9 Location 0 + OpDecorate %11 RelaxedPrecision + OpDecorate %11 Location 0 + %33 = OpExtInst %2 %30 3450 + %34 = OpExtInst %2 %30 456 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %6 + %11 = OpVariable %10 Input + %35 = OpExtInst %2 %30 567 + %36 = OpExtInst %2 %30 678 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %6 %11 + %13 = OpExtInst %6 %1 Log2 %12 + %14 = OpCompositeConstruct %7 %13 %13 %13 %13 + OpStore %9 %14 + OpReturn + OpFunctionEnd +)"; + constexpr char kDiff[] = R"( ; SPIR-V + ; Version: 1.6 + ; Generator: Khronos SPIR-V Tools Assembler; 0 +-; Bound: 27 ++; Bound: 29 + ; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "GLSL.std.450" + %20 = OpExtInstImport "NonSemantic.MadeUp" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpDecorate %9 RelaxedPrecision + OpDecorate %9 Location 0 + OpDecorate %11 RelaxedPrecision + OpDecorate %11 Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %21 = OpExtInst %2 %20 123 +-%22 = OpExtInst %2 %20 234 +-%23 = OpExtInst %2 %20 345 ++%27 = OpExtInst %2 %20 2340 ++%28 = OpExtInst %2 %20 3450 + %24 = OpExtInst %2 %20 456 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %6 + %11 = OpVariable %10 Input + %25 = OpExtInst %2 %20 567 + %26 = OpExtInst %2 %20 678 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %6 %11 + %13 = OpExtInst %6 %1 Log2 %12 + %14 = OpCompositeConstruct %7 %13 %13 %13 %13 + OpStore %9 %14 + OpReturn + OpFunctionEnd +)"; + Options options; + DoStringDiffTest(kSrcNoDebug, kDstNoDebug, kDiff, options); +} + +} // namespace +} // namespace diff +} // namespace spvtools diff --git a/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_dst.spvasm b/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_dst.spvasm new file mode 100644 index 0000000000..59ba05bef0 --- /dev/null +++ b/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_dst.spvasm @@ -0,0 +1,40 @@ + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "GLSL.std.450" + %30 = OpExtInstImport "NonSemantic.MadeUp" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + %31 = OpExtInst %2 %30 123 + %32 = OpExtInst %2 %30 2340 + OpName %9 "color" + OpName %11 "v" + OpDecorate %9 RelaxedPrecision + OpDecorate %9 Location 0 + OpDecorate %11 RelaxedPrecision + OpDecorate %11 Location 0 + %33 = OpExtInst %2 %30 3450 + %34 = OpExtInst %2 %30 456 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %6 + %11 = OpVariable %10 Input + %35 = OpExtInst %2 %30 567 + %36 = OpExtInst %2 %30 678 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %6 %11 + %13 = OpExtInst %6 %1 Log2 %12 + %14 = OpCompositeConstruct %7 %13 %13 %13 %13 + OpStore %9 %14 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_src.spvasm b/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_src.spvasm new file mode 100644 index 0000000000..ca78909176 --- /dev/null +++ b/third_party/spirv-tools/test/diff/diff_files/OpExtInst_in_variables_src.spvasm @@ -0,0 +1,41 @@ +;; Tests a diff where the shader has OpExtInst in the debug, decorations and types/variables sections. + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "GLSL.std.450" + %20 = OpExtInstImport "NonSemantic.MadeUp" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + %21 = OpExtInst %2 %20 123 + %22 = OpExtInst %2 %20 234 + OpName %9 "color" + OpName %11 "v" + OpDecorate %9 RelaxedPrecision + OpDecorate %9 Location 0 + OpDecorate %11 RelaxedPrecision + OpDecorate %11 Location 0 + %23 = OpExtInst %2 %20 345 + %24 = OpExtInst %2 %20 456 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %6 + %11 = OpVariable %10 Input + %25 = OpExtInst %2 %20 567 + %26 = OpExtInst %2 %20 678 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %6 %11 + %13 = OpExtInst %6 %1 Log2 %12 + %14 = OpCompositeConstruct %7 %13 %13 %13 %13 + OpStore %9 %14 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-tools/test/diff/diff_files/diff_test_files_autogen.cmake b/third_party/spirv-tools/test/diff/diff_files/diff_test_files_autogen.cmake index ce687d52c1..b916cd713a 100644 --- a/third_party/spirv-tools/test/diff/diff_files/diff_test_files_autogen.cmake +++ b/third_party/spirv-tools/test/diff/diff_files/diff_test_files_autogen.cmake @@ -18,6 +18,7 @@ list(APPEND DIFF_TEST_FILES "diff_files/OpExtInst_in_dst_only_autogen.cpp" "diff_files/OpExtInst_in_src_only_autogen.cpp" +"diff_files/OpExtInst_in_variables_autogen.cpp" "diff_files/OpTypeForwardPointer_basic_autogen.cpp" "diff_files/OpTypeForwardPointer_intertwined_autogen.cpp" "diff_files/OpTypeForwardPointer_mismatching_class_autogen.cpp" diff --git a/third_party/spirv-tools/test/ext_inst.arm_motion_engine_test.cpp b/third_party/spirv-tools/test/ext_inst.arm_motion_engine_test.cpp new file mode 100644 index 0000000000..a4fa7be4de --- /dev/null +++ b/third_party/spirv-tools/test/ext_inst.arm_motion_engine_test.cpp @@ -0,0 +1,94 @@ +// Copyright (c) 2024-2025 Arm Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "gmock/gmock.h" +#include "source/util/string_utils.h" +#include "spirv/unified1/ArmMotionEngine.100.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::Concatenate; +using spvtest::MakeInstruction; +using spvtest::TextToBinaryTest; +using testing::Eq; +using utils::MakeVector; + +TEST_F(TextToBinaryTest, ArmMotionEngineImportTest) { + const std::string src = "%1 = OpExtInstImport \"Arm.MotionEngine.100\""; + EXPECT_THAT(CompiledInstructions(src), + Eq(MakeInstruction(spv::Op::OpExtInstImport, {1}, + MakeVector("Arm.MotionEngine.100")))); +} + +TEST_F(TextToBinaryTest, ArmMotionEngineInstructionMIN_SAD) { + const std::string src = + "%1 = OpExtInstImport \"Arm.MotionEngine.100\"\n" + "%3 = OpExtInst %2 %1 MIN_SAD %4 %5 %6 %7 %8 %9 %10 %11 %12\n"; + + // First make sure it assembles correctly. + EXPECT_THAT( + CompiledInstructions(src), + Eq(Concatenate({MakeInstruction(spv::Op::OpExtInstImport, {1}, + MakeVector("Arm.MotionEngine.100")), + MakeInstruction(spv::Op::OpExtInst, + {2, 3, 1, ArmMotionEngineMIN_SAD, 4, 5, 6, + 7, 8, 9, 10, 11, 12})}))) + << src; + // Now check the round trip through the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(src), src) << src; +} + +TEST_F(TextToBinaryTest, ArmMotionEngineInstructionMIN_SAD_COST) { + const std::string src = + "%1 = OpExtInstImport \"Arm.MotionEngine.100\"\n" + "%3 = OpExtInst %2 %1 MIN_SAD_COST %4 %5 %6 %7 %8 %9 %10 %11 %12\n"; + + // First make sure it assembles correctly. + EXPECT_THAT( + CompiledInstructions(src), + Eq(Concatenate({MakeInstruction(spv::Op::OpExtInstImport, {1}, + MakeVector("Arm.MotionEngine.100")), + MakeInstruction(spv::Op::OpExtInst, + {2, 3, 1, ArmMotionEngineMIN_SAD_COST, 4, + 5, 6, 7, 8, 9, 10, 11, 12})}))) + << src; + // Now check the round trip through the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(src), src) << src; +} + +TEST_F(TextToBinaryTest, ArmMotionEngineInstructionRAW_SAD) { + const std::string src = + "%1 = OpExtInstImport \"Arm.MotionEngine.100\"\n" + "%3 = OpExtInst %2 %1 RAW_SAD %4 %5 %6 %7 %8 %9 %10 %11\n"; + + // First make sure it assembles correctly. + EXPECT_THAT( + CompiledInstructions(src), + Eq(Concatenate( + {MakeInstruction(spv::Op::OpExtInstImport, {1}, + MakeVector("Arm.MotionEngine.100")), + MakeInstruction(spv::Op::OpExtInst, {2, 3, 1, ArmMotionEngineRAW_SAD, + 4, 5, 6, 7, 8, 9, 10, 11})}))) + << src; + // Now check the round trip through the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(src), src) << src; +} + +} // namespace +} // namespace spvtools diff --git a/third_party/spirv-tools/test/fuzz/fuzzer_pass_donate_modules_test.cpp b/third_party/spirv-tools/test/fuzz/fuzzer_pass_donate_modules_test.cpp index 81687ac30f..ac94fbf72d 100644 --- a/third_party/spirv-tools/test/fuzz/fuzzer_pass_donate_modules_test.cpp +++ b/third_party/spirv-tools/test/fuzz/fuzzer_pass_donate_modules_test.cpp @@ -569,6 +569,7 @@ TEST(FuzzerPassDonateModulesTest, DonateOpConstantNull) { const auto env = SPV_ENV_UNIVERSAL_1_3; const auto consumer = nullptr; spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); const auto recipient_context = BuildModule(env, consumer, recipient_shader, kFuzzAssembleOption); @@ -2002,6 +2003,7 @@ TEST(FuzzerPassDonateModulesTest, HandlesCapabilities) { const auto env = SPV_ENV_UNIVERSAL_1_3; const auto consumer = nullptr; spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); const auto recipient_context = BuildModule(env, consumer, recipient_shader, kFuzzAssembleOption); @@ -2235,6 +2237,7 @@ TEST(FuzzerPassDonateModulesTest, HandlesOpPhisInMergeBlock) { const auto env = SPV_ENV_UNIVERSAL_1_3; const auto consumer = nullptr; spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); const auto recipient_context = BuildModule(env, consumer, recipient_shader, kFuzzAssembleOption); diff --git a/third_party/spirv-tools/test/fuzz/transformation_access_chain_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_access_chain_test.cpp index fa19aa50fa..4d79d03c50 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_access_chain_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_access_chain_test.cpp @@ -105,6 +105,7 @@ TEST(TransformationAccessChainTest, BasicTest) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); diff --git a/third_party/spirv-tools/test/fuzz/transformation_add_copy_memory_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_add_copy_memory_test.cpp index 29a936c1f0..da82fede10 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_add_copy_memory_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_add_copy_memory_test.cpp @@ -142,6 +142,7 @@ TEST(TransformationAddCopyMemoryTest, BasicTest) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( diff --git a/third_party/spirv-tools/test/fuzz/transformation_add_synonym_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_add_synonym_test.cpp index 385590e61e..7936cad430 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_add_synonym_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_add_synonym_test.cpp @@ -71,6 +71,7 @@ TEST(TransformationAddSynonymTest, NotApplicable) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( @@ -208,6 +209,7 @@ TEST(TransformationAddSynonymTest, AddZeroSubZeroMulOne) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( @@ -1271,6 +1273,7 @@ TEST(TransformationAddSynonymTest, DoNotCopyNullPointers) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( diff --git a/third_party/spirv-tools/test/fuzz/transformation_load_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_load_test.cpp index 6fde49ab91..e3f6d0cea4 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_load_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_load_test.cpp @@ -86,6 +86,7 @@ TEST(TransformationLoadTest, BasicTest) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( diff --git a/third_party/spirv-tools/test/fuzz/transformation_mutate_pointer_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_mutate_pointer_test.cpp index e0cb61541b..92d1ab99ff 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_mutate_pointer_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_mutate_pointer_test.cpp @@ -79,6 +79,7 @@ TEST(TransformationMutatePointerTest, BasicTest) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( diff --git a/third_party/spirv-tools/test/fuzz/transformation_propagate_instruction_down_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_propagate_instruction_down_test.cpp index 8bedef2ccc..f9db30ddc2 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_propagate_instruction_down_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_propagate_instruction_down_test.cpp @@ -679,6 +679,7 @@ TEST(TransformationPropagateInstructionDownTest, TestCreatedFacts) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( diff --git a/third_party/spirv-tools/test/fuzz/transformation_propagate_instruction_up_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_propagate_instruction_up_test.cpp index 20cf4b3e1a..ac0c14a5fd 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_propagate_instruction_up_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_propagate_instruction_up_test.cpp @@ -690,6 +690,7 @@ TEST(TransformationPropagateInstructionUpTest, const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( @@ -770,6 +771,7 @@ TEST(TransformationPropagateInstructionUpTest, const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( diff --git a/third_party/spirv-tools/test/fuzz/transformation_push_id_through_variable_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_push_id_through_variable_test.cpp index 0d4850d4f4..a4641bac94 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_push_id_through_variable_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_push_id_through_variable_test.cpp @@ -99,6 +99,7 @@ TEST(TransformationPushIdThroughVariableTest, IsApplicable) { BuildModule(env, consumer, reference_shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); TransformationContext transformation_context( MakeUnique(context.get()), validator_options); // Tests the reference shader validity. @@ -339,6 +340,7 @@ TEST(TransformationPushIdThroughVariableTest, Apply) { BuildModule(env, consumer, reference_shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); TransformationContext transformation_context( MakeUnique(context.get()), validator_options); uint32_t value_id = 80; @@ -606,6 +608,7 @@ TEST(TransformationPushIdThroughVariableTest, AddSynonymsForRelevantIds) { BuildModule(env, consumer, reference_shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); TransformationContext transformation_context( MakeUnique(context.get()), validator_options); // Tests the reference shader validity. @@ -707,6 +710,7 @@ TEST(TransformationPushIdThroughVariableTest, DontAddSynonymsForIrrelevantIds) { BuildModule(env, consumer, reference_shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); TransformationContext transformation_context( MakeUnique(context.get()), validator_options); // Tests the reference shader validity. @@ -772,6 +776,7 @@ TEST(TransformationPushIdThroughVariableTest, DontAddSynonymsInDeadBlocks) { BuildModule(env, consumer, reference_shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); TransformationContext transformation_context( MakeUnique(context.get()), validator_options); // Tests the reference shader validity. diff --git a/third_party/spirv-tools/test/fuzz/transformation_store_test.cpp b/third_party/spirv-tools/test/fuzz/transformation_store_test.cpp index fe24d744ae..6779ee2f66 100644 --- a/third_party/spirv-tools/test/fuzz/transformation_store_test.cpp +++ b/third_party/spirv-tools/test/fuzz/transformation_store_test.cpp @@ -95,6 +95,7 @@ TEST(TransformationStoreTest, BasicTest) { const auto consumer = nullptr; const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption); spvtools::ValidatorOptions validator_options; + validator_options.SetRelaxLogicalPointer(true); ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options, kConsoleMessageConsumer)); TransformationContext transformation_context( diff --git a/third_party/spirv-tools/test/hex_float_test.cpp b/third_party/spirv-tools/test/hex_float_test.cpp index 2e384d4303..caa8e569bb 100644 --- a/third_party/spirv-tools/test/hex_float_test.cpp +++ b/third_party/spirv-tools/test/hex_float_test.cpp @@ -582,6 +582,9 @@ int32_t unbiased_exponent(double f) { int16_t unbiased_half_exponent(uint16_t f) { return HexFloat>(f).getUnbiasedNormalizedExponent(); } +int16_t unbiased_bfloat16_exponent(uint16_t f) { + return HexFloat>(f).getUnbiasedNormalizedExponent(); +} int8_t unbiased_E4M3_exponent(uint8_t f) { return HexFloat>(f).getUnbiasedNormalizedExponent(); } @@ -623,6 +626,17 @@ TEST(HexFloatOperationTest, UnbiasedExponent) { // Smallest representable number EXPECT_EQ(-24, unbiased_half_exponent(0x0001)); + EXPECT_EQ(0, unbiased_bfloat16_exponent(0x3F80)); + EXPECT_EQ(3, unbiased_bfloat16_exponent(0x4100)); + EXPECT_EQ(-1, unbiased_bfloat16_exponent(0x3F00)); + EXPECT_EQ(-126, unbiased_bfloat16_exponent(0x0080)); + EXPECT_EQ(127, unbiased_bfloat16_exponent(0x7F00)); + EXPECT_EQ(10, unbiased_bfloat16_exponent(0x4480)); + EXPECT_EQ(128, unbiased_bfloat16_exponent(0x7F80)); + // Test case for the smallest representable denormal number. + // Effective exponent is 1 - bias - (leading_one_pos) = 1 - 127 - 7 = -133 + EXPECT_EQ(-133, unbiased_bfloat16_exponent(0x0001)); + // E4M3 cases // The exponent is represented in the bits 0x78 // The offset is -7 @@ -1479,6 +1493,7 @@ INSTANTIATE_TEST_SUITE_P( TEST(HexFloatOperationTests, NanTests) { using HF = HexFloat>; using HF16 = HexFloat>; + using BF16 = HexFloat>; using FE4M3 = HexFloat>; using FE5M2 = HexFloat>; round_direction rounding[] = {round_direction::kToZero, @@ -1490,6 +1505,7 @@ TEST(HexFloatOperationTests, NanTests) { for (round_direction round : rounding) { HF16 f16(0); HF f(0.f); + BF16 bf16(0); FE4M3 fe4m3(0); FE5M2 fe5m2(0); HF(std::numeric_limits::quiet_NaN()).castTo(f16, round); @@ -1508,6 +1524,17 @@ TEST(HexFloatOperationTests, NanTests) { HF16(0xFF00).castTo(f, round); EXPECT_TRUE(f.value().isNan()); + BF16(0x7F81).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + BF16(0x7F91).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + BF16(0xFF81).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + BF16(0x7F90).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + BF16(0xFFE0).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + HF(std::numeric_limits::quiet_NaN()).castTo(fe4m3, round); EXPECT_TRUE(fe4m3.value().isNan()); HF(std::numeric_limits::signaling_NaN()).castTo(fe4m3, round); diff --git a/third_party/spirv-tools/test/link/CMakeLists.txt b/third_party/spirv-tools/test/link/CMakeLists.txt index ee41b91617..40765307e3 100644 --- a/third_party/spirv-tools/test/link/CMakeLists.txt +++ b/third_party/spirv-tools/test/link/CMakeLists.txt @@ -24,5 +24,6 @@ add_spvtools_unittest(TARGET link partial_linkage_test.cpp unique_ids_test.cpp type_match_test.cpp + function_variants.cpp LIBS SPIRV-Tools-opt SPIRV-Tools-link ) diff --git a/third_party/spirv-tools/test/link/function_variants.cpp b/third_party/spirv-tools/test/link/function_variants.cpp new file mode 100644 index 0000000000..1f0841455b --- /dev/null +++ b/third_party/spirv-tools/test/link/function_variants.cpp @@ -0,0 +1,581 @@ +// Copyright 2025 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using FunctionVariants = spvtest::LinkerTest; + +TEST_F(FunctionVariants, Dot4) { + constexpr const char* const dot4_fp32 = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Int8 + OpCapability Int64 + OpCapability Linkage + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %2 "dot4" %3 + OpExecutionMode %2 ContractionOff + OpSource OpenCL_C 102000 + OpName %2 "dot4" + OpName %3 "__spirv_BuiltInGlobalInvocationId" + OpName %4 "entry" + %5 = OpTypeFloat 32 + %6 = OpTypePointer CrossWorkgroup %5 + %7 = OpTypeInt 8 0 + %8 = OpTypePointer CrossWorkgroup %7 + %9 = OpTypeVoid + %10 = OpTypeFunction %9 %6 %6 %8 + %11 = OpTypeInt 64 0 + %12 = OpTypeInt 32 0 + %13 = OpTypeVector %11 3 + %14 = OpTypePointer Input %13 + %15 = OpTypeVector %5 4 + %16 = OpConstant %11 30 + %17 = OpConstant %11 32 + %18 = OpConstant %12 2 + %3 = OpVariable %14 Input + %2 = OpFunction %9 None %10 + %19 = OpFunctionParameter %6 + %20 = OpFunctionParameter %6 + %21 = OpFunctionParameter %8 + %4 = OpLabel + %22 = OpLoad %13 %3 Aligned 1 + %23 = OpCompositeExtract %11 %22 0 + %24 = OpUConvert %12 %23 + %25 = OpShiftLeftLogical %12 %24 %18 + %26 = OpSConvert %11 %25 + %27 = OpExtInst %15 %1 vloadn %26 %19 4 + %28 = OpExtInst %15 %1 vloadn %26 %20 4 + %29 = OpDot %5 %27 %28 + %30 = OpShiftLeftLogical %11 %23 %17 + %31 = OpShiftRightArithmetic %11 %30 %16 + %32 = OpInBoundsPtrAccessChain %8 %21 %31 + %33 = OpBitcast %6 %32 + OpStore %33 %29 Aligned 4 + OpReturn + OpFunctionEnd + )"; + + constexpr const char* const dot4_fp16 = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Int8 + OpCapability Int64 + OpCapability Float16 + OpCapability Linkage + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %2 "dot4" %3 + OpExecutionMode %2 ContractionOff + OpSource OpenCL_C 102000 + OpName %2 "dot4" + OpName %3 "__spirv_BuiltInGlobalInvocationId" + OpName %4 "entry" + %5 = OpTypeFloat 16 + %6 = OpTypePointer CrossWorkgroup %5 + %7 = OpTypeInt 8 0 + %8 = OpTypePointer CrossWorkgroup %7 + %9 = OpTypeVoid + %10 = OpTypeFunction %9 %6 %6 %8 + %11 = OpTypeInt 64 0 + %12 = OpTypeInt 32 0 + %13 = OpTypeVector %11 3 + %14 = OpTypePointer Input %13 + %15 = OpTypeVector %5 4 + %16 = OpConstant %11 31 + %17 = OpConstant %11 32 + %18 = OpConstant %12 2 + %3 = OpVariable %14 Input + %2 = OpFunction %9 None %10 + %19 = OpFunctionParameter %6 + %20 = OpFunctionParameter %6 + %21 = OpFunctionParameter %8 + %4 = OpLabel + %22 = OpLoad %13 %3 Aligned 1 + %23 = OpCompositeExtract %11 %22 0 + %24 = OpUConvert %12 %23 + %25 = OpShiftLeftLogical %12 %24 %18 + %26 = OpSConvert %11 %25 + %27 = OpExtInst %15 %1 vloadn %26 %19 4 + %28 = OpExtInst %15 %1 vloadn %26 %20 4 + %29 = OpDot %5 %27 %28 + %30 = OpShiftLeftLogical %11 %23 %17 + %31 = OpShiftRightArithmetic %11 %30 %16 + %32 = OpInBoundsPtrAccessChain %8 %21 %31 + %33 = OpBitcast %6 %32 + OpStore %33 %29 Aligned 4 + OpReturn + OpFunctionEnd + )"; + + // clang-format off + const std::vector expected_lines = { + "OpCapability FunctionVariantsINTEL", + "OpCapability SpecConditionalINTEL", + "OpCapability Kernel", + "OpCapability Addresses", + "OpCapability Int8", + "OpCapability Int64", + "OpCapability Linkage", + "OpConditionalCapabilityINTEL %dot4_fp16_spv Float16", + "OpExtension \"SPV_INTEL_function_variants\"", + "OpConditionalEntryPointINTEL %dot4_fp32_spv Kernel %dot4 \"dot4\" %__spirv_BuiltInGlobalInvocationId", + "OpConditionalEntryPointINTEL %dot4_fp16_spv Kernel %dot4_0 \"dot4\" %__spirv_BuiltInGlobalInvocationId_0", + "OpModuleProcessed \"SPV_INTEL_function_variants registry version 0\"", + "OpDecorate %ulong_30 ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %ulong_32 ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %uint_2 ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %__spirv_BuiltInGlobalInvocationId ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %dot4 ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %ulong_31 ConditionalINTEL %dot4_fp16_spv", + "OpDecorate %ulong_32_0 ConditionalINTEL %dot4_fp16_spv", + "OpDecorate %uint_2_0 ConditionalINTEL %dot4_fp16_spv", + "OpDecorate %__spirv_BuiltInGlobalInvocationId_0 ConditionalINTEL %dot4_fp16_spv", + "OpDecorate %dot4_0 ConditionalINTEL %dot4_fp16_spv", + "OpDecorate %float ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %_ptr_CrossWorkgroup_float ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %18 ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %v4float ConditionalINTEL %dot4_fp32_spv", + "OpDecorate %half ConditionalINTEL %dot4_fp16_spv", + "OpDecorate %_ptr_CrossWorkgroup_half ConditionalINTEL %dot4_fp16_spv", + "OpDecorate %22 ConditionalINTEL %dot4_fp16_spv", + "OpDecorate %v4half ConditionalINTEL %dot4_fp16_spv", + "%float = OpTypeFloat 32", + "%_ptr_CrossWorkgroup_float = OpTypePointer CrossWorkgroup %float", + "%18 = OpTypeFunction %void %_ptr_CrossWorkgroup_float %_ptr_CrossWorkgroup_float %_ptr_CrossWorkgroup_uchar", + "%v4float = OpTypeVector %float 4", + "%ulong_30 = OpConstant %ulong 30", + "%ulong_32 = OpConstant %ulong 32", + "%uint_2 = OpConstant %uint 2", + "%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input", + "%bool = OpTypeBool", + "%32 = OpSpecConstantArchitectureINTEL %bool 2 3 174 0", + "%33 = OpSpecConstantTargetINTEL %bool 7", + "%34 = OpSpecConstantTargetINTEL %bool 8", + "%35 = OpSpecConstantCapabilitiesINTEL %bool Addresses Linkage Kernel Int64 Int8", + "%36 = OpSpecConstantOp %bool LogicalOr %33 %34", + "%37 = OpSpecConstantOp %bool LogicalAnd %35 %32", + "%38 = OpSpecConstantOp %bool LogicalAnd %37 %36", + "%half = OpTypeFloat 16", + "%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half", + "%22 = OpTypeFunction %void %_ptr_CrossWorkgroup_half %_ptr_CrossWorkgroup_half %_ptr_CrossWorkgroup_uchar", + "%v4half = OpTypeVector %half 4", + "%ulong_31 = OpConstant %ulong 31", + "%ulong_32_0 = OpConstant %ulong 32", + "%uint_2_0 = OpConstant %uint 2", + "%__spirv_BuiltInGlobalInvocationId_0 = OpVariable %_ptr_Input_v3ulong Input", + "%39 = OpSpecConstantArchitectureINTEL %bool 2 3 174 4", + "%40 = OpSpecConstantTargetINTEL %bool 7", + "%41 = OpSpecConstantTargetINTEL %bool 8", + "%42 = OpSpecConstantCapabilitiesINTEL %bool Addresses Linkage Kernel Float16 Int64 Int8", + "%43 = OpSpecConstantOp %bool LogicalOr %40 %41", + "%44 = OpSpecConstantOp %bool LogicalAnd %42 %39", + "%dot4_fp16_spv = OpSpecConstantOp %bool LogicalAnd %44 %43", + "%45 = OpSpecConstantOp %bool LogicalNot %dot4_fp16_spv", + "%dot4_fp32_spv = OpSpecConstantOp %bool LogicalAnd %38 %45", + "%dot4 = OpFunction %void None %18", + "%56 = OpDot %float %54 %55", + "%dot4_0 = OpFunction %void None %22", + "%71 = OpDot %half %69 %70", + }; + // clang-format on + + const std::string targets_csv = + "module,target,features\n" + "dot4_fp32.spv,7,\n" + "dot4_fp32.spv,8,\n" + "dot4_fp16.spv,7,\n" + "dot4_fp16.spv,8,\n"; + const std::string architectures_csv = + "module,category,family,op,architecture\n" + "dot4_fp32.spv,2,3,174,0\n" + "dot4_fp16.spv,2,3,174,4\n"; + const std::vector sources = {dot4_fp32, dot4_fp16}; + const std::vector in_files = {"dot4_fp32.spv", "dot4_fp16.spv"}; + + LinkerOptions options; + options.SetInFiles(in_files); + options.SetFnVarTargetsCsv(targets_csv); + options.SetFnVarArchitecturesCsv(architectures_csv); + options.SetHasFnVarCapabilities(true); + options.SetCreateLibrary(true); + options.SetVerifyIds(true); + + spvtest::Binary linked_binary; + spv_result_t res = AssembleAndLink(sources, &linked_binary, options); + EXPECT_EQ(SPV_SUCCESS, res) << GetErrorMessage(); + EXPECT_THAT(GetErrorMessage(), std::string()); + EXPECT_TRUE(Validate(linked_binary)); + + std::string linked_asm; + res = Disassemble(linked_binary, &linked_asm); + EXPECT_EQ(SPV_SUCCESS, res) << GetErrorMessage(); + for (const auto& expected : expected_lines) { + EXPECT_THAT(linked_asm, testing::HasSubstr(expected)); + } +} + +TEST_F(FunctionVariants, FAddAsm) { + constexpr const char* const foo_base = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Int8 + OpCapability Int64 + OpCapability Linkage + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpSource OpenCL_CPP 100000 + OpName %2 "foo" + OpName %3 "add" + OpName %4 "entry" + OpName %5 "work" + OpName %6 "call" + OpName %7 "entry" + OpDecorate %2 LinkageAttributes "foo" Export + OpDecorate %5 LinkageAttributes "work" Export + %8 = OpTypeFloat 32 + %9 = OpTypePointer Function %8 + %10 = OpTypeFunction %8 %9 %9 %9 + %11 = OpTypeInt 8 0 + %12 = OpTypePointer Function %11 + %13 = OpTypeInt 64 0 + %14 = OpConstant %13 28 + %15 = OpConstant %13 24 + %16 = OpConstant %13 20 + %17 = OpConstant %13 16 + %18 = OpConstant %13 12 + %19 = OpConstant %13 8 + %20 = OpConstant %13 4 + %2 = OpFunction %8 DontInline %10 + %21 = OpFunctionParameter %9 + %22 = OpFunctionParameter %9 + %23 = OpFunctionParameter %9 + %4 = OpLabel + %24 = OpLoad %8 %21 Aligned 4 + %25 = OpLoad %8 %22 Aligned 4 + %3 = OpFAdd %8 %24 %25 + OpStore %23 %3 Aligned 4 + OpReturnValue %3 + OpFunctionEnd + %5 = OpFunction %8 None %10 + %26 = OpFunctionParameter %9 + %27 = OpFunctionParameter %9 + %28 = OpFunctionParameter %9 + %7 = OpLabel + %6 = OpFunctionCall %8 %2 %26 %27 %28 + %29 = OpFDiv %8 %6 %6 + %30 = OpFDiv %8 %29 %6 + OpReturnValue %30 + OpFunctionEnd + )"; + + constexpr const char* const foo_asm = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Linkage + OpCapability AsmINTEL + OpExtension "SPV_INTEL_inline_assembly" + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpSource OpenCL_CPP 100000 + OpName %2 "a" + OpName %3 "b" + OpName %4 "c" + OpName %5 "foo" + OpName %6 "add" + OpName %7 "entry" + OpDecorate %2 FuncParamAttr NoWrite + OpDecorate %2 FuncParamAttr NoAlias + OpDecorate %3 FuncParamAttr NoWrite + OpDecorate %3 FuncParamAttr NoAlias + OpDecorate %4 FuncParamAttr NoAlias + OpDecorate %5 LinkageAttributes "foo" Export + OpDecorate %8 SideEffectsINTEL + %9 = OpTypeFloat 32 + %10 = OpTypePointer Function %9 + %11 = OpTypeFunction %9 %10 %10 %10 + %12 = OpTypeVoid + %13 = OpTypeFunction %12 + %14 = OpAsmTargetINTEL "spirv64-unknown-unknown" + %8 = OpAsmINTEL %12 %13 %14 "nop1" "" + %5 = OpFunction %9 None %11 + %2 = OpFunctionParameter %10 + %3 = OpFunctionParameter %10 + %4 = OpFunctionParameter %10 + %7 = OpLabel + %15 = OpLoad %9 %2 Aligned 4 + %16 = OpLoad %9 %3 Aligned 4 + %6 = OpFSub %9 %15 %16 + OpStore %4 %6 Aligned 4 + %17 = OpAsmCallINTEL %12 %8 + OpReturnValue %6 + OpFunctionEnd + )"; + + // same as foo_asm, just with OpFMul and a different assembly string in + // OpAsmINTEL + constexpr const char* const foo_asm2 = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Linkage + OpCapability AsmINTEL + OpExtension "SPV_INTEL_inline_assembly" + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpSource OpenCL_CPP 100000 + OpName %2 "a" + OpName %3 "b" + OpName %4 "c" + OpName %5 "foo" + OpName %6 "add" + OpName %7 "entry" + OpDecorate %2 FuncParamAttr NoWrite + OpDecorate %2 FuncParamAttr NoAlias + OpDecorate %3 FuncParamAttr NoWrite + OpDecorate %3 FuncParamAttr NoAlias + OpDecorate %4 FuncParamAttr NoAlias + OpDecorate %5 LinkageAttributes "foo" Export + OpDecorate %8 SideEffectsINTEL + %9 = OpTypeFloat 32 + %10 = OpTypePointer Function %9 + %11 = OpTypeFunction %9 %10 %10 %10 + %12 = OpTypeVoid + %13 = OpTypeFunction %12 + %14 = OpAsmTargetINTEL "spirv64-unknown-unknown" + %8 = OpAsmINTEL %12 %13 %14 "nop2" "" + %5 = OpFunction %9 None %11 + %2 = OpFunctionParameter %10 + %3 = OpFunctionParameter %10 + %4 = OpFunctionParameter %10 + %7 = OpLabel + %15 = OpLoad %9 %2 Aligned 4 + %16 = OpLoad %9 %3 Aligned 4 + %6 = OpFMul %9 %15 %16 + OpStore %4 %6 Aligned 4 + %17 = OpAsmCallINTEL %12 %8 + OpReturnValue %6 + OpFunctionEnd + )"; + + // clang-format off + const std::vector expected_lines = { + "OpCapability FunctionVariantsINTEL", + "OpCapability SpecConditionalINTEL", + "OpCapability Kernel", + "OpCapability Addresses", + "OpConditionalCapabilityINTEL %foo_spv Int8", + "OpConditionalCapabilityINTEL %foo_spv Int64", + "OpCapability Linkage", + "OpConditionalCapabilityINTEL %2 AsmINTEL", + "OpExtension \"SPV_INTEL_function_variants\"", + "OpConditionalExtensionINTEL %2 \"SPV_INTEL_inline_assembly\"", + "OpModuleProcessed \"SPV_INTEL_function_variants registry version 0\"", + "OpDecorate %foo LinkageAttributes \"foo\" Export", + "OpDecorate %work LinkageAttributes \"work\" Export", + "OpDecorate %ulong_28 ConditionalINTEL %foo_spv", + "OpDecorate %ulong_24 ConditionalINTEL %foo_spv", + "OpDecorate %ulong_20 ConditionalINTEL %foo_spv", + "OpDecorate %ulong_16 ConditionalINTEL %foo_spv", + "OpDecorate %ulong_12 ConditionalINTEL %foo_spv", + "OpDecorate %ulong_8 ConditionalINTEL %foo_spv", + "OpDecorate %ulong_4 ConditionalINTEL %foo_spv", + "OpDecorate %foo ConditionalINTEL %foo_spv", + "OpDecorate %foo_0 LinkageAttributes \"foo\" Export", + "OpDecorate %32 ConditionalINTEL %foo_asm_spv", + "OpDecorate %31 ConditionalINTEL %foo_asm_spv", + "OpDecorate %foo_0 ConditionalINTEL %foo_asm_spv", + "OpDecorate %foo_1 LinkageAttributes \"foo\" Export", + "OpDecorate %34 ConditionalINTEL %foo_asm2_spv", + "OpDecorate %33 ConditionalINTEL %foo_asm2_spv", + "OpDecorate %foo_1 ConditionalINTEL %foo_asm2_spv", + "OpDecorate %call ConditionalINTEL %foo_spv", + "OpDecorate %35 ConditionalINTEL %foo_asm_spv", + "OpDecorate %36 ConditionalINTEL %foo_asm2_spv", + "OpDecorate %uchar ConditionalINTEL %foo_spv", + "OpDecorate %_ptr_Function_uchar ConditionalINTEL %foo_spv", + "OpDecorate %ulong ConditionalINTEL %foo_spv", + "OpDecorate %void ConditionalINTEL %2", + "OpDecorate %41 ConditionalINTEL %2", + "%ulong_28 = OpConstant %ulong 28", + "%ulong_24 = OpConstant %ulong 24", + "%ulong_20 = OpConstant %ulong 20", + "%ulong_16 = OpConstant %ulong 16", + "%ulong_12 = OpConstant %ulong 12", + "%ulong_8 = OpConstant %ulong 8", + "%ulong_4 = OpConstant %ulong 4", + "%bool = OpTypeBool", + "%46 = OpSpecConstantTargetINTEL %bool 4", + "%47 = OpSpecConstantCapabilitiesINTEL %bool Addresses Linkage Kernel Int64 Int8", + "%48 = OpSpecConstantOp %bool LogicalAnd %47 %46", + "%31 = OpAsmINTEL %void %41 %32 \"nop1\" \"\"", + "%49 = OpSpecConstantArchitectureINTEL %bool 1 1 170 1", + "%50 = OpSpecConstantTargetINTEL %bool 4 9 10", + "%51 = OpSpecConstantCapabilitiesINTEL %bool Addresses Linkage Kernel AsmINTEL", + "%52 = OpSpecConstantOp %bool LogicalAnd %51 %49", + "%foo_asm_spv = OpSpecConstantOp %bool LogicalAnd %52 %50", + "%33 = OpAsmINTEL %void %41 %34 \"nop2\" \"\"", + "%53 = OpSpecConstantArchitectureINTEL %bool 1 7 174 1", + "%54 = OpSpecConstantArchitectureINTEL %bool 1 7 178 3", + "%55 = OpSpecConstantArchitectureINTEL %bool 1 8 170 1", + "%56 = OpSpecConstantArchitectureINTEL %bool 1 9 174 1", + "%57 = OpSpecConstantArchitectureINTEL %bool 1 9 178 3", + "%58 = OpSpecConstantTargetINTEL %bool 5 2 4 5", + "%59 = OpSpecConstantTargetINTEL %bool 6 2 4 5", + "%60 = OpSpecConstantCapabilitiesINTEL %bool Addresses Linkage Kernel AsmINTEL", + "%61 = OpSpecConstantOp %bool LogicalAnd %53 %54", + "%62 = OpSpecConstantOp %bool LogicalAnd %56 %57", + "%63 = OpSpecConstantOp %bool LogicalOr %61 %55", + "%64 = OpSpecConstantOp %bool LogicalOr %63 %62", + "%65 = OpSpecConstantOp %bool LogicalOr %58 %59", + "%66 = OpSpecConstantOp %bool LogicalAnd %60 %64", + "%foo_asm2_spv = OpSpecConstantOp %bool LogicalAnd %66 %65", + "%67 = OpSpecConstantOp %bool LogicalOr %foo_asm_spv %foo_asm2_spv", + "%68 = OpSpecConstantOp %bool LogicalNot %67", + "%foo_spv = OpSpecConstantOp %bool LogicalAnd %48 %68", + "%2 = OpSpecConstantOp %bool LogicalOr %foo_asm_spv %foo_asm2_spv", + "%foo = OpFunction %float DontInline %44", + "%add = OpFAdd %float %72 %73", + "%work = OpFunction %float None %44", + "%call = OpFunctionCall %float %foo %74 %75 %76", + "%35 = OpFunctionCall %float %foo_0 %74 %75 %76", + "%36 = OpFunctionCall %float %foo_1 %74 %75 %76", + "%77 = OpConditionalCopyObjectINTEL %float %foo_spv %call %foo_asm_spv %35 %foo_asm2_spv %36", + "%78 = OpFDiv %float %77 %77", + "%79 = OpFDiv %float %78 %77", + "OpReturnValue %79", + "%foo_0 = OpFunction %float None %44", + "%add_0 = OpFSub %float %80 %81", + "%82 = OpAsmCallINTEL %void %31", + "%foo_1 = OpFunction %float None %44", + "%add_1 = OpFMul %float %83 %84", + "%85 = OpAsmCallINTEL %void %33", + }; + // clang-format on + + const std::string targets_csv = + "module,target,features\n" + "foo.spv,04,\n" // test leading zeros + "foo_asm.spv,4,9/0010\n" // test leading zeros + "foo_asm2.spv,5,2/4/5\n" + "foo_asm2.spv,6,2/4/5\n"; + const std::string architectures_csv = + "module,category,family,op,architecture\n" + "foo_asm.spv,1,1,170,1\n" + "foo_asm2.spv,1,7,174,1\n" + "foo_asm2.spv,1,7,178,3\n" + "foo_asm2.spv,1,8,170,1\n" + "foo_asm2.spv,1,9,174,1\n" + "foo_asm2.spv,1,9,178,3\n"; + const std::vector sources = {foo_base, foo_asm, foo_asm2}; + const std::vector in_files = {"foo.spv", "foo_asm.spv", + "foo_asm2.spv"}; + + LinkerOptions options; + options.SetInFiles(in_files); + options.SetFnVarTargetsCsv(targets_csv); + options.SetFnVarArchitecturesCsv(architectures_csv); + options.SetHasFnVarCapabilities(true); + options.SetCreateLibrary(true); + options.SetVerifyIds(true); + + spvtest::Binary linked_binary; + spv_result_t res = AssembleAndLink(sources, &linked_binary, options); + EXPECT_EQ(SPV_SUCCESS, res) << GetErrorMessage(); + EXPECT_THAT(GetErrorMessage(), std::string()); + EXPECT_TRUE(Validate(linked_binary)); + + std::string linked_asm; + res = Disassemble(linked_binary, &linked_asm); + EXPECT_EQ(SPV_SUCCESS, res) << GetErrorMessage(); + for (const auto& expected : expected_lines) { + EXPECT_THAT(linked_asm, testing::HasSubstr(expected)); + } +} + +TEST_F(FunctionVariants, InvalidNumber1) { + const std::string targets_csv = + "module,target,features\n" + "foo.spv,-4,9/10\n"; + const std::string architectures_csv = ""; + const std::vector sources = {""}; + const std::vector in_files = {"foo.spv"}; + + LinkerOptions options; + options.SetInFiles(in_files); + options.SetFnVarTargetsCsv(targets_csv); + options.SetFnVarArchitecturesCsv(architectures_csv); + options.SetHasFnVarCapabilities(true); + options.SetCreateLibrary(true); + options.SetVerifyIds(true); + + spvtest::Binary linked_binary; + spv_result_t res = AssembleAndLink(sources, &linked_binary, options); + EXPECT_EQ(SPV_ERROR_FNVAR, res) << GetErrorMessage(); + EXPECT_THAT(GetErrorMessage(), "ERROR: 0: Error converting -4 to target."); +} + +TEST_F(FunctionVariants, InvalidNumber2) { + const std::string targets_csv = + "module,target,features\n" + "foo.spv,4,9/-10\n"; + const std::string architectures_csv = ""; + const std::vector sources = {""}; + const std::vector in_files = {"foo.spv"}; + + LinkerOptions options; + options.SetInFiles(in_files); + options.SetFnVarTargetsCsv(targets_csv); + options.SetFnVarArchitecturesCsv(architectures_csv); + options.SetHasFnVarCapabilities(true); + options.SetCreateLibrary(true); + options.SetVerifyIds(true); + + spvtest::Binary linked_binary; + spv_result_t res = AssembleAndLink(sources, &linked_binary, options); + EXPECT_EQ(SPV_ERROR_FNVAR, res) << GetErrorMessage(); + EXPECT_THAT(GetErrorMessage(), + "ERROR: 0: Error converting -10 in 9/-10 to target feature."); +} + +TEST_F(FunctionVariants, InvalidNumber3) { + const std::string targets_csv = + "module,target,features\n" + "foo.spv,4.0,9/10\n"; + const std::string architectures_csv = ""; + const std::vector sources = {""}; + const std::vector in_files = {"foo.spv"}; + + LinkerOptions options; + options.SetInFiles(in_files); + options.SetFnVarTargetsCsv(targets_csv); + options.SetFnVarArchitecturesCsv(architectures_csv); + options.SetHasFnVarCapabilities(true); + options.SetCreateLibrary(true); + options.SetVerifyIds(true); + + spvtest::Binary linked_binary; + spv_result_t res = AssembleAndLink(sources, &linked_binary, options); + EXPECT_EQ(SPV_ERROR_FNVAR, res) << GetErrorMessage(); + EXPECT_THAT(GetErrorMessage(), "ERROR: 0: Error converting 4.0 to target."); +} + +} // namespace +} // namespace spvtools diff --git a/third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp b/third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp index b255696c97..e5990d4bb4 100644 --- a/third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp @@ -6757,79 +6757,78 @@ TEST_F(AggressiveDCETest, ShaderDebugInfoKeepInFunctionElimStoreVar) { %g_sAniso = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant %in_var_TEXCOORD2 = OpVariable %_ptr_Input_v2float Input %out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output - %51 = OpExtInst %void %1 DebugInfoNone - %52 = OpExtInst %void %1 DebugExpression - %53 = OpExtInst %void %1 DebugOperation %uint_0 - %54 = OpExtInst %void %1 DebugExpression %53 - %55 = OpExtInst %void %1 DebugSource %7 - %56 = OpExtInst %void %1 DebugCompilationUnit %uint_1 %uint_4 %55 %uint_5 - %59 = OpExtInst %void %1 DebugTypeBasic %9 %uint_32 %uint_3 %uint_0 - %60 = OpExtInst %void %1 DebugTypeVector %59 %uint_4 - %58 = OpExtInst %void %1 DebugTypeMember %10 %60 %55 %uint_12 %uint_5 %uint_0 %uint_128 %uint_3 - %57 = OpExtInst %void %1 DebugTypeComposite %8 %uint_1 %55 %uint_10 %uint_1 %56 %8 %uint_128 %uint_3 %58 - %63 = OpExtInst %void %1 DebugTypeVector %59 %uint_2 - %62 = OpExtInst %void %1 DebugTypeMember %12 %63 %55 %uint_7 %uint_5 %uint_0 %uint_64 %uint_3 - %61 = OpExtInst %void %1 DebugTypeComposite %11 %uint_1 %55 %uint_5 %uint_1 %56 %11 %uint_64 %uint_3 %62 - %64 = OpExtInst %void %1 DebugTypeComposite %13 %uint_0 %55 %uint_0 %uint_0 %56 %14 %51 %uint_3 - %67 = OpExtInst %void %1 DebugTypeFunction %uint_3 %57 %61 - %68 = OpExtInst %void %1 DebugFunction %16 %67 %55 %uint_15 %uint_1 %56 %16 %uint_3 %uint_16 - %69 = OpExtInst %void %1 DebugLexicalBlock %55 %uint_16 %uint_1 %68 - %70 = OpExtInst %void %1 DebugLocalVariable %17 %63 %55 %uint_19 %uint_12 %69 %uint_4 - %71 = OpExtInst %void %1 DebugLocalVariable %18 %57 %55 %uint_17 %uint_15 %69 %uint_4 - %72 = OpExtInst %void %1 DebugLocalVariable %19 %61 %55 %uint_15 %uint_29 %68 %uint_4 %uint_1 - %73 = OpExtInst %void %1 DebugTypeComposite %20 %uint_1 %55 %uint_0 %uint_0 %56 %21 %51 %uint_3 - %74 = OpExtInst %void %1 DebugGlobalVariable %22 %73 %55 %uint_3 %uint_14 %56 %22 %g_sAniso %uint_8 - %75 = OpExtInst %void %1 DebugGlobalVariable %23 %64 %55 %uint_1 %uint_11 %56 %23 %g_tColor %uint_8 + %75 = OpExtInst %void %1 DebugInfoNone + %76 = OpExtInst %void %1 DebugExpression + %77 = OpExtInst %void %1 DebugOperation %uint_0 + %78 = OpExtInst %void %1 DebugExpression %77 + %79 = OpExtInst %void %1 DebugSource %7 + %80 = OpExtInst %void %1 DebugCompilationUnit %uint_1 %uint_4 %79 %uint_5 + %81 = OpExtInst %void %1 DebugTypeBasic %9 %uint_32 %uint_3 %uint_0 + %82 = OpExtInst %void %1 DebugTypeVector %81 %uint_4 + %83 = OpExtInst %void %1 DebugTypeMember %10 %82 %79 %uint_12 %uint_5 %uint_0 %uint_128 %uint_3 + %84 = OpExtInst %void %1 DebugTypeComposite %8 %uint_1 %79 %uint_10 %uint_1 %80 %8 %uint_128 %uint_3 %83 + %85 = OpExtInst %void %1 DebugTypeVector %81 %uint_2 + %86 = OpExtInst %void %1 DebugTypeMember %12 %85 %79 %uint_7 %uint_5 %uint_0 %uint_64 %uint_3 + %87 = OpExtInst %void %1 DebugTypeComposite %11 %uint_1 %79 %uint_5 %uint_1 %80 %11 %uint_64 %uint_3 %86 + %88 = OpExtInst %void %1 DebugTypeComposite %13 %uint_0 %79 %uint_0 %uint_0 %80 %14 %75 %uint_3 + %89 = OpExtInst %void %1 DebugTypeFunction %uint_3 %84 %87 + %90 = OpExtInst %void %1 DebugFunction %16 %89 %79 %uint_15 %uint_1 %80 %16 %uint_3 %uint_16 + %91 = OpExtInst %void %1 DebugLexicalBlock %79 %uint_16 %uint_1 %90 + %92 = OpExtInst %void %1 DebugLocalVariable %17 %85 %79 %uint_19 %uint_12 %91 %uint_4 + %93 = OpExtInst %void %1 DebugLocalVariable %18 %84 %79 %uint_17 %uint_15 %91 %uint_4 + %94 = OpExtInst %void %1 DebugLocalVariable %19 %87 %79 %uint_15 %uint_29 %90 %uint_4 %uint_1 + %95 = OpExtInst %void %1 DebugTypeComposite %20 %uint_1 %79 %uint_0 %uint_0 %80 %21 %75 %uint_3 + %96 = OpExtInst %void %1 DebugGlobalVariable %22 %95 %79 %uint_3 %uint_14 %80 %22 %g_sAniso %uint_8 + %97 = OpExtInst %void %1 DebugGlobalVariable %23 %88 %79 %uint_1 %uint_11 %80 %23 %g_tColor %uint_8 %MainPs = OpFunction %void None %45 - %76 = OpLabel - %78 = OpVariable %_ptr_Function_PS_OUTPUT Function - %79 = OpVariable %_ptr_Function_v2float Function - %81 = OpVariable %_ptr_Function_PS_OUTPUT Function + %98 = OpLabel + %99 = OpVariable %_ptr_Function_PS_OUTPUT Function + %100 = OpVariable %_ptr_Function_v2float Function + %101 = OpVariable %_ptr_Function_PS_OUTPUT Function %param_var_i = OpVariable %_ptr_Function_PS_INPUT Function - %82 = OpLoad %v2float %in_var_TEXCOORD2 - %83 = OpCompositeConstruct %PS_INPUT %82 - OpStore %param_var_i %83 - %112 = OpExtInst %void %1 DebugFunctionDefinition %68 %MainPs - %109 = OpExtInst %void %1 DebugScope %68 - %85 = OpExtInst %void %1 DebugDeclare %72 %param_var_i %52 - %110 = OpExtInst %void %1 DebugScope %69 - %87 = OpExtInst %void %1 DebugDeclare %71 %78 %52 -;CHECK: {{%\w+}} = OpExtInst %void %1 DebugFunctionDefinition %68 %MainPs -;CHECK: {{%\w+}} = OpExtInst %void %1 DebugScope %68 -;CHECK: {{%\w+}} = OpExtInst %void %1 DebugDeclare %72 %param_var_i %52 -;CHECK: {{%\w+}} = OpExtInst %void %1 DebugScope %69 -;CHECK: {{%\w+}} = OpExtInst %void %1 DebugDeclare %71 %78 %52 - %300 = OpExtInst %void %1 DebugLine %55 %uint_19 %uint_19 %uint_17 %uint_30 -;CHECK: {{%\w+}} = OpExtInst %void %1 DebugLine %55 %uint_19 %uint_19 %uint_17 %uint_30 - %88 = OpAccessChain %_ptr_Function_v2float %param_var_i %int_0 - %89 = OpLoad %v2float %88 - %301 = OpExtInst %void %1 DebugLine %55 %uint_19 %uint_19 %uint_12 %uint_35 - OpStore %79 %89 -;CHECK-NOT: OpStore %79 %89 - %302 = OpExtInst %void %1 DebugLine %55 %uint_19 %uint_19 %uint_12 %uint_35 -;CHECK: {{%\w+}} = OpExtInst %void %1 DebugLine %55 %uint_19 %uint_19 %uint_12 %uint_35 - %106 = OpExtInst %void %1 DebugValue %70 %89 %52 -;CHECK: {{%\w+}} = OpExtInst %void %1 DebugValue %70 %89 %52 - %303 = OpExtInst %void %1 DebugLine %55 %uint_20 %uint_20 %uint_25 %uint_32 - %91 = OpLoad %type_2d_image %g_tColor - %304 = OpExtInst %void %1 DebugLine %55 %uint_20 %uint_20 %uint_41 %uint_48 - %92 = OpLoad %type_sampler %g_sAniso - %305 = OpExtInst %void %1 DebugLine %55 %uint_20 %uint_20 %uint_25 %uint_53 - %94 = OpSampledImage %type_sampled_image %91 %92 - %95 = OpImageSampleImplicitLod %v4float %94 %89 None - %306 = OpExtInst %void %1 DebugLine %55 %uint_20 %uint_20 %uint_5 %uint_53 - %96 = OpAccessChain %_ptr_Function_v4float %78 %int_0 - OpStore %96 %95 - %307 = OpExtInst %void %1 DebugLine %55 %uint_21 %uint_21 %uint_12 %uint_20 - %97 = OpLoad %PS_OUTPUT %78 - %308 = OpExtInst %void %1 DebugLine %55 %uint_21 %uint_21 %uint_5 %uint_20 - OpStore %81 %97 - %309 = OpExtInst %void %1 DebugNoLine + %102 = OpLoad %v2float %in_var_TEXCOORD2 + %103 = OpCompositeConstruct %PS_INPUT %102 + OpStore %param_var_i %103 + %104 = OpExtInst %void %1 DebugFunctionDefinition %90 %MainPs + %142 = OpExtInst %void %1 DebugScope %90 + %106 = OpExtInst %void %1 DebugDeclare %94 %param_var_i %76 + %143 = OpExtInst %void %1 DebugScope %91 + %108 = OpExtInst %void %1 DebugDeclare %93 %99 %76 +;CHECK: {{%\w+}} = OpExtInst %void %1 DebugFunctionDefinition %90 %MainPs +;CHECK: {{%\w+}} = OpExtInst %void %1 DebugScope %90 +;CHECK: {{%\w+}} = OpExtInst %void %1 DebugDeclare %94 %param_var_i %76 +;CHECK: {{%\w+}} = OpExtInst %void %1 DebugScope %91 +;CHECK: {{%\w+}} = OpExtInst %void %1 DebugDeclare %93 %99 %76 + %109 = OpExtInst %void %1 DebugLine %79 %uint_19 %uint_19 %uint_17 %uint_30 +;CHECK: {{%\w+}} = OpExtInst %void %1 DebugLine %79 %uint_19 %uint_19 %uint_17 %uint_30 + %110 = OpAccessChain %_ptr_Function_v2float %param_var_i %int_0 + %111 = OpLoad %v2float %110 + %112 = OpExtInst %void %1 DebugLine %79 %uint_20 %uint_20 %uint_25 %uint_32 +;CHECK: {{%\w+}} = OpExtInst %void %1 DebugLine %79 %uint_20 %uint_20 %uint_25 %uint_32 + OpStore %100 %111 +;CHECK-NOT: OpStore %100 %111 + %114 = OpExtInst %void %1 DebugValue %92 %111 %76 +;CHECK: {{%\w+}} = OpExtInst %void %1 DebugValue %92 %111 %76 + %115 = OpExtInst %void %1 DebugLine %79 %uint_20 %uint_20 %uint_25 %uint_32 + %116 = OpLoad %type_2d_image %g_tColor + %117 = OpExtInst %void %1 DebugLine %79 %uint_20 %uint_20 %uint_41 %uint_48 + %118 = OpLoad %type_sampler %g_sAniso + %119 = OpExtInst %void %1 DebugLine %79 %uint_20 %uint_20 %uint_25 %uint_53 + %120 = OpSampledImage %type_sampled_image %116 %118 + %121 = OpImageSampleImplicitLod %v4float %120 %111 None + %122 = OpExtInst %void %1 DebugLine %79 %uint_20 %uint_20 %uint_5 %uint_53 + %123 = OpAccessChain %_ptr_Function_v4float %99 %int_0 + OpStore %123 %121 + %124 = OpExtInst %void %1 DebugLine %79 %uint_21 %uint_21 %uint_12 %uint_20 + %125 = OpLoad %PS_OUTPUT %99 + %126 = OpExtInst %void %1 DebugLine %79 %uint_21 %uint_21 %uint_5 %uint_20 + OpStore %101 %125 + %127 = OpExtInst %void %1 DebugNoLine ;CHECK: {{%\w+}} = OpExtInst %void %1 DebugNoLine - %111 = OpExtInst %void %1 DebugNoScope + %144 = OpExtInst %void %1 DebugNoScope ;CHECK: {{%\w+}} = OpExtInst %void %1 DebugNoScope - %100 = OpCompositeExtract %v4float %97 0 - OpStore %out_var_SV_Target0 %100 + %129 = OpCompositeExtract %v4float %125 0 + OpStore %out_var_SV_Target0 %129 OpReturn OpFunctionEnd )"; @@ -8477,6 +8476,554 @@ TEST_F(AggressiveDCETest, KeepCopyLogical) { SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); SinglePassRunAndMatch(before, true); } +TEST_F(AggressiveDCETest, KeepOnlyLiveDebugValues) { + // DebugValue should replace dead Value with Undef. + const std::string before = + R"(OpCapability MinLod +OpCapability StorageImageWriteWithoutFormat +OpCapability StorageImageReadWithoutFormat +OpCapability FragmentShaderSampleInterlockEXT +OpCapability FragmentShaderPixelInterlockEXT +OpCapability FragmentShaderShadingRateInterlockEXT +OpCapability ComputeDerivativeGroupQuadsKHR +OpCapability ComputeDerivativeGroupLinearKHR +OpCapability RayQueryKHR +OpCapability GroupNonUniformPartitionedNV +OpCapability InterpolationFunction +OpCapability QuadControlKHR +OpCapability Shader +OpCapability SampledBuffer +OpCapability ImageBuffer +OpExtension "SPV_EXT_fragment_shader_interlock" +OpExtension "SPV_KHR_compute_shader_derivatives" +OpExtension "SPV_KHR_ray_query" +OpExtension "SPV_NV_shader_subgroup_partitioned" +OpExtension "SPV_KHR_quad_control" +OpExtension "SPV_KHR_non_semantic_info" +%1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%3 = OpString "partially_unused_var.cs.hlsl" +%17 = OpString "int" +%25 = OpString "main" +%26 = OpString "" +%30 = OpString "a" +%33 = OpString "__dxc_setup" +%35 = OpString "cb000c74" +%36 = OpString " -E main -T cs_6_6 -spirv -fspv-print-all -fspv-debug=vulkan -Qembed_debug" +%39 = OpString "@type.buffer.image" +%40 = OpString "type.buffer.image" +%42 = OpString "TemplateParam" +%45 = OpString "b" +OpName %type_buffer_image "type.buffer.image" +OpName %b "b" +OpName %main "main" +OpDecorate %b DescriptorSet 0 +OpDecorate %b Binding 0 +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%uint_32 = OpConstant %uint 32 +%type_buffer_image = OpTypeImage %int Buffer 2 0 0 2 R32i +%_ptr_UniformConstant_type_buffer_image = OpTypePointer UniformConstant %type_buffer_image +%void = OpTypeVoid +%uint_4 = OpConstant %uint 4 +%uint_5 = OpConstant %uint 5 +%uint_13 = OpConstant %uint 13 +%uint_7 = OpConstant %uint 7 +%uint_15 = OpConstant %uint 15 +%uint_8 = OpConstant %uint 8 +%49 = OpTypeFunction %void +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 +%v4int = OpTypeVector %int 4 +%uint_21 = OpConstant %uint 21 +%uint_27 = OpConstant %uint 27 +%uint_14 = OpConstant %uint 14 +%uint_31 = OpConstant %uint 31 +%_ptr_Function_int = OpTypePointer Function %int +%uint_6 = OpConstant %uint 6 +%uint_10 = OpConstant %uint 10 +%b = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +; CHECK: %281 = OpUndef %int +%38 = OpExtInst %void %1 DebugInfoNone +%16 = OpExtInst %void %1 DebugExpression +; CHECK: %216 = OpExtInst %void %1 DebugOperation %uint_0 +%216 = OpExtInst %void %1 DebugOperation %uint_0 +%18 = OpExtInst %void %1 DebugTypeBasic %17 %uint_32 %uint_4 %uint_0 +%20 = OpExtInst %void %1 DebugTypeArray %18 %uint_3 +%21 = OpExtInst %void %1 DebugTypeFunction %uint_3 %void +%22 = OpExtInst %void %1 DebugSource %3 +%23 = OpExtInst %void %1 DebugCompilationUnit %uint_1 %uint_4 %22 %uint_5 +%27 = OpExtInst %void %1 DebugFunction %25 %21 %22 %uint_4 %uint_1 %23 %26 %uint_3 %uint_4 +%28 = OpExtInst %void %1 DebugLexicalBlock %22 %uint_4 %uint_13 %27 +%31 = OpExtInst %void %1 DebugLocalVariable %30 %20 %22 %uint_5 %uint_7 %28 %uint_4 +%34 = OpExtInst %void %1 DebugFunction %33 %21 %22 %uint_4 %uint_1 %23 %26 %uint_3 %uint_4 +%41 = OpExtInst %void %1 DebugTypeComposite %39 %uint_0 %22 %uint_0 %uint_0 %23 %40 %38 %uint_3 +%43 = OpExtInst %void %1 DebugTypeTemplateParameter %42 %18 %38 %22 %uint_0 %uint_0 +%44 = OpExtInst %void %1 DebugTypeTemplate %41 %43 +%46 = OpExtInst %void %1 DebugGlobalVariable %45 %44 %22 %uint_1 %uint_15 %23 %45 %b %uint_8 +%37 = OpExtInst %void %1 DebugEntryPoint %34 %23 %35 %36 +%138 = OpExtInst %void %1 DebugInlinedAt %uint_4 %34 +; CHECK: %215 = OpExtInst %void %1 DebugExpression %216 +%215 = OpExtInst %void %1 DebugExpression %216 +%main = OpFunction %void None %49 +%50 = OpLabel +%205 = OpVariable %_ptr_Function_int Function +%204 = OpVariable %_ptr_Function_int Function +%203 = OpVariable %_ptr_Function_int Function +%255 = OpExtInst %void %1 DebugScope %34 +%52 = OpExtInst %void %1 DebugFunctionDefinition %34 %main +%256 = OpExtInst %void %1 DebugScope %28 %138 +%155 = OpExtInst %void %1 DebugLine %22 %uint_5 %uint_5 %uint_15 %uint_15 +%141 = OpLoad %type_buffer_image %b +%142 = OpImageRead %v4int %141 %uint_1 None +%143 = OpCompositeExtract %int %142 0 +%158 = OpExtInst %void %1 DebugLine %22 %uint_5 %uint_5 %uint_21 %uint_21 +%144 = OpLoad %type_buffer_image %b +%145 = OpImageRead %v4int %144 %uint_2 None +%146 = OpCompositeExtract %int %145 0 +%161 = OpExtInst %void %1 DebugLine %22 %uint_5 %uint_5 %uint_27 %uint_27 +%147 = OpLoad %type_buffer_image %b +%148 = OpImageRead %v4int %147 %uint_3 None +%149 = OpCompositeExtract %int %148 0 +%164 = OpExtInst %void %1 DebugLine %22 %uint_5 %uint_5 %uint_14 %uint_31 +%150 = OpCompositeConstruct %_arr_int_uint_3 %143 %146 %149 +%207 = OpExtInst %void %1 DebugLine %22 %uint_5 %uint_5 %uint_3 %uint_31 +%206 = OpCompositeExtract %int %150 0 +; CHECK-NOT: OpStore %203 %206 +OpStore %203 %206 +; CHECK: %253 = OpExtInst %void %1 DebugValue %31 %206 %16 %int_0 +%253 = OpExtInst %void %1 DebugValue %31 %206 %16 %int_0 +; CHECK-NOT: %209 = OpCompositeExtract %int %150 1 +%209 = OpCompositeExtract %int %150 1 +; CHECK-NOT: OpStore %204 %209 +OpStore %204 %209 +; CHECK: %250 = OpExtInst %void %1 DebugValue %31 %281 %16 %int_1 +%250 = OpExtInst %void %1 DebugValue %31 %209 %16 %int_1 +; CHECK-NOT: %212 = OpCompositeExtract %int %150 2 +%212 = OpCompositeExtract %int %150 2 +; CHECK-NOT: OpStore %205 %212 +OpStore %205 %212 +; CHECK: %247 = OpExtInst %void %1 DebugValue %31 %281 %16 %int_2 +%247 = OpExtInst %void %1 DebugValue %31 %212 %16 %int_2 +%169 = OpExtInst %void %1 DebugLine %22 %uint_6 %uint_6 %uint_3 %uint_13 +%154 = OpLoad %type_buffer_image %b +OpImageWrite %154 %uint_0 %206 None +%257 = OpExtInst %void %1 DebugScope %34 +%55 = OpExtInst %void %1 DebugLine %22 %uint_7 %uint_7 %uint_1 %uint_1 +OpReturn +%258 = OpExtInst %void %1 DebugNoScope +OpFunctionEnd +)"; + + SetTargetEnv(SPV_ENV_UNIVERSAL_1_6); + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(before, false); +} +TEST_F(AggressiveDCETest, KeepLocalDebugValue) { + // DebugValue should only be live when Value is live. + const std::string before = + R"( +OpCapability MinLod +OpCapability StorageImageWriteWithoutFormat +OpCapability StorageImageReadWithoutFormat +OpCapability FragmentShaderSampleInterlockEXT +OpCapability FragmentShaderPixelInterlockEXT +OpCapability FragmentShaderShadingRateInterlockEXT +OpCapability ComputeDerivativeGroupQuadsKHR +OpCapability ComputeDerivativeGroupLinearKHR +OpCapability RayQueryKHR +OpCapability GroupNonUniformPartitionedNV +OpCapability InterpolationFunction +OpCapability QuadControlKHR +OpCapability Shader +OpCapability SampledBuffer +OpCapability ImageBuffer +OpExtension "SPV_EXT_fragment_shader_interlock" +OpExtension "SPV_KHR_compute_shader_derivatives" +OpExtension "SPV_KHR_ray_query" +OpExtension "SPV_NV_shader_subgroup_partitioned" +OpExtension "SPV_KHR_quad_control" +OpExtension "SPV_KHR_non_semantic_info" +%1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%3 = OpString "partially_unused_var2.cs.hlsl" +%17 = OpString "int" +%25 = OpString "main" +%26 = OpString "" +; CHECK: [[VarName:%\w+]] = OpString "some_real_obvious_name" +%30 = OpString "some_real_obvious_name" +%33 = OpString "__dxc_setup" +%35 = OpString "cb000c74" +%36 = OpString " -E main -T cs_6_6 -spirv -fspv-print-all -fspv-debug=vulkan -Qembed_debug" +%39 = OpString "@type.buffer.image" +%40 = OpString "type.buffer.image" +%42 = OpString "TemplateParam" +%45 = OpString "b" +OpName %type_buffer_image "type.buffer.image" +OpName %b "b" +OpName %main "main" +OpDecorate %b DescriptorSet 0 +OpDecorate %b Binding 0 +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%uint_32 = OpConstant %uint 32 +%type_buffer_image = OpTypeImage %int Buffer 2 0 0 2 R32i +%_ptr_UniformConstant_type_buffer_image = OpTypePointer UniformConstant %type_buffer_image +%void = OpTypeVoid +%uint_4 = OpConstant %uint 4 +%uint_5 = OpConstant %uint 5 +%uint_13 = OpConstant %uint 13 +%uint_7 = OpConstant %uint 7 +%uint_15 = OpConstant %uint 15 +%uint_8 = OpConstant %uint 8 +%49 = OpTypeFunction %void +%uint_52 = OpConstant %uint 52 +%uint_6 = OpConstant %uint 6 +%uint_10 = OpConstant %uint 10 +%b = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +; CHECK: [[undef:%\w+]] = OpUndef %int +%198 = OpUndef %int +%38 = OpExtInst %void %1 DebugInfoNone +%16 = OpExtInst %void %1 DebugExpression +%18 = OpExtInst %void %1 DebugTypeBasic %17 %uint_32 %uint_4 %uint_0 +%20 = OpExtInst %void %1 DebugTypeArray %18 %uint_3 +%21 = OpExtInst %void %1 DebugTypeFunction %uint_3 %void +%22 = OpExtInst %void %1 DebugSource %3 +%23 = OpExtInst %void %1 DebugCompilationUnit %uint_1 %uint_4 %22 %uint_5 +%27 = OpExtInst %void %1 DebugFunction %25 %21 %22 %uint_4 %uint_1 %23 %26 %uint_3 %uint_4 +%28 = OpExtInst %void %1 DebugLexicalBlock %22 %uint_4 %uint_13 %27 +%31 = OpExtInst %void %1 DebugLocalVariable %30 %20 %22 %uint_5 %uint_7 %28 %uint_4 +; CHECK: [[var:%\w+]] = OpExtInst %void {{%\w+}} DebugLocalVariable [[VarName]] +%34 = OpExtInst %void %1 DebugFunction %33 %21 %22 %uint_4 %uint_1 %23 %26 %uint_3 %uint_4 +%41 = OpExtInst %void %1 DebugTypeComposite %39 %uint_0 %22 %uint_0 %uint_0 %23 %40 %38 %uint_3 +%43 = OpExtInst %void %1 DebugTypeTemplateParameter %42 %18 %38 %22 %uint_0 %uint_0 +%44 = OpExtInst %void %1 DebugTypeTemplate %41 %43 +%46 = OpExtInst %void %1 DebugGlobalVariable %45 %44 %22 %uint_1 %uint_15 %23 %45 %b %uint_8 +%37 = OpExtInst %void %1 DebugEntryPoint %34 %23 %35 %36 +%133 = OpExtInst %void %1 DebugInlinedAt %uint_4 %34 +%main = OpFunction %void None %49 +%50 = OpLabel +%303 = OpExtInst %void %1 DebugScope %34 +%52 = OpExtInst %void %1 DebugFunctionDefinition %34 %main +%304 = OpExtInst %void %1 DebugScope %28 %133 +%199 = OpExtInst %void %1 DebugLine %22 %uint_5 %uint_5 %uint_3 %uint_52 +%245 = OpExtInst %void %1 DebugValue %31 %198 %16 %int_0 +%242 = OpExtInst %void %1 DebugValue %31 %198 %16 %int_1 +%239 = OpExtInst %void %1 DebugValue %31 %198 %16 %int_2 +; CHECK: {{%\w+}} = OpExtInst %void {{%\w+}} DebugValue [[var]] [[undef]] {{%\w+}} %int_0 +; CHECK: {{%\w+}} = OpExtInst %void {{%\w+}} DebugValue [[var]] [[undef]] {{%\w+}} %int_1 +; CHECK: {{%\w+}} = OpExtInst %void {{%\w+}} DebugValue [[var]] [[undef]] {{%\w+}} %int_2 +%160 = OpExtInst %void %1 DebugLine %22 %uint_6 %uint_6 %uint_3 %uint_10 +%147 = OpLoad %type_buffer_image %b +OpImageWrite %147 %uint_0 %int_0 None +%305 = OpExtInst %void %1 DebugScope %34 +%55 = OpExtInst %void %1 DebugLine %22 %uint_7 %uint_7 %uint_1 %uint_1 +OpReturn +%306 = OpExtInst %void %1 DebugNoScope +OpFunctionEnd +)"; + + SetTargetEnv(SPV_ENV_UNIVERSAL_1_6); + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(before, false); +} + +TEST_F(AggressiveDCETest, UndefIsOutsideFunction) { + const std::string spirv = R"( + ; CHECK: OpUndef + ; CHECK: OpFunction %void + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" + OpExecutionMode %2 LocalSize 1 1 1 + %3 = OpString "" + %4 = OpString "int" + %5 = OpString "x" + %6 = OpString "Val.set" + %7 = OpString "Val" + %8 = OpString "this" + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_11 = OpConstant %uint 11 + %uint_5 = OpConstant %uint 5 + %uint_100 = OpConstant %uint 100 + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint_0 = OpConstant %uint 0 + %uint_15 = OpConstant %uint 15 + %uint_6 = OpConstant %uint 6 + %uint_32 = OpConstant %uint 32 + %uint_4 = OpConstant %uint 4 +%uint_131072 = OpConstant %uint 131072 + %uint_1 = OpConstant %uint 1 + %uint_10 = OpConstant %uint 10 + %uint_8 = OpConstant %uint 8 + %26 = OpExtInst %void %1 DebugOperation %uint_0 + %27 = OpExtInst %void %1 DebugSource %3 %3 + %28 = OpExtInst %void %1 DebugCompilationUnit %uint_100 %uint_5 %27 %uint_11 + %29 = OpExtInst %void %1 DebugTypeBasic %4 %uint_32 %uint_4 %uint_131072 + %30 = OpExtInst %void %1 DebugTypeFunction %uint_0 %void + %31 = OpExtInst %void %1 DebugFunction %6 %30 %27 %uint_6 %uint_10 %28 %6 %uint_0 %uint_6 + %32 = OpExtInst %void %1 DebugTypeMember %5 %29 %27 %uint_1 %uint_8 %uint_0 %uint_32 %uint_0 + %33 = OpExtInst %void %1 DebugTypeComposite %7 %uint_1 %27 %uint_1 %uint_8 %28 %7 %uint_32 %uint_131072 %32 + %34 = OpExtInst %void %1 DebugLocalVariable %8 %33 %27 %uint_6 %uint_10 %31 %uint_0 %uint_1 + %35 = OpExtInst %void %1 DebugExpression %26 + %2 = OpFunction %void None %14 + %36 = OpLabel + %37 = OpVariable %_ptr_Function_int Function + %38 = OpExtInst %void %1 DebugValue %34 %37 %35 %uint_0 + OpReturn + OpFunctionEnd + +)"; + + SinglePassRunAndMatch(spirv, true); +} +TEST_F(AggressiveDCETest, ConvertDebugDeclareToDebugValue) { + const std::string spirv = + R"(OpCapability Shader +OpExtension "SPV_KHR_non_semantic_info" +%1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %input1 %input2 %output +OpExecutionMode %main OriginUpperLeft +%5 = OpString "test.hlsl" +OpSource HLSL 600 +OpName %main "main" +OpDecorate %input1 Location 0 +OpDecorate %input2 Location 1 +OpDecorate %output Location 0 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%v3float = OpTypeVector %float 3 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_32 = OpConstant %uint 32 +%uint_0 = OpConstant %uint 0 +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Output_v3float = OpTypePointer Output %v3float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%input1 = OpVariable %_ptr_Input_v3float Input +%input2 = OpVariable %_ptr_Input_v3float Input +%output = OpVariable %_ptr_Output_v3float Output +%29 = OpTypeFunction %void +; CHECK: [[initial:%\w+]] = OpConstantComposite +; CHECK: [[expr:%\w+]] = OpExtInst %void {{%\w+}} DebugExpression +; CHECK: [[source:%\w+]] = OpExtInst %void {{%\w+}} DebugSource %6 +%30 = OpExtInst %void %1 DebugSource %5 +%31 = OpExtInst %void %1 DebugCompilationUnit %uint_1 %uint_3 %30 %uint_32 +; CHECK: [[basic:%\w+]] = OpExtInst %void {{%\w+}} DebugTypeBasic +%32 = OpExtInst %void %1 DebugTypeBasic %5 %uint_32 %uint_3 %uint_0 +; CHECK: [[vec_type:%\w+]] = OpExtInst %void {{%\w+}} DebugTypeVector [[basic]] %uint_4 +%33 = OpExtInst %void %1 DebugTypeVector %32 %uint_4 +%34 = OpExtInst %void %1 DebugTypeFunction %uint_0 %void +%35 = OpExtInst %void %1 DebugFunction %5 %34 %30 %uint_1 %uint_0 %31 %5 %uint_0 %uint_1 +; CHECK: [[local:%\w+]] = OpExtInst %void {{%\w+}} DebugLocalVariable %6 [[vec_type]] [[source]] %uint_1 +%36 = OpExtInst %void %1 DebugLocalVariable %5 %33 %30 %uint_1 %uint_0 %35 %uint_0 +%38 = OpExtInst %void %1 DebugExpression +%initial_value = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%main = OpFunction %void None %29 +%39 = OpLabel +%dead_pos_w = OpVariable %_ptr_Function_v4float Function +%live_var1 = OpVariable %_ptr_Function_v4float Function +%live_var2 = OpVariable %_ptr_Function_v4float Function +%input1_value = OpLoad %v3float %input1 +%input2_value = OpLoad %v3float %input2 +; CHECK-NOT: DebugDeclare +%40 = OpExtInst %void %1 DebugDeclare %36 %dead_pos_w %38 +OpStore %dead_pos_w %initial_value +; CHECK: DebugValue %30 [[initial]] %31 +OpStore %live_var1 %initial_value +%computed1 = OpVectorTimesScalar %v3float %input1_value %float_1 +%computed2 = OpFAdd %v3float %computed1 %input2_value +; CHECK: [[new:%\w+]] = OpCompositeConstruct +%new_pos_w = OpCompositeConstruct %v4float %computed2 %float_1 +OpStore %dead_pos_w %new_pos_w +; CHECK: DebugValue %30 [[new]] %31 +OpStore %live_var2 %new_pos_w +%loaded1 = OpLoad %v4float %live_var1 +%loaded2 = OpLoad %v4float %live_var2 +%pos_xyz1 = OpVectorShuffle %v3float %loaded1 %loaded1 0 1 2 +%pos_xyz2 = OpVectorShuffle %v3float %loaded2 %loaded2 0 1 2 +%mixed_result = OpFAdd %v3float %pos_xyz1 %pos_xyz2 +OpStore %output %mixed_result +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(spirv, true); +} + +TEST_F(AggressiveDCETest, DebugDeclareConvertedToDebugValueKeepsDebugScope) { + const std::string spirv = R"( +; CHECK: [[ext:%\w+]] = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" +; CHECK-DAG: [[inlined:%\w+]] = OpExtInst %void [[ext]] DebugInlinedAt +; CHECK-DAG: [[UniformVar:%\w+]] = OpVariable %_ptr_Uniform_float Uniform +; CHECK: [[scope:%\w+]] = OpExtInst %void [[ext]] DebugScope {{%\w+}} [[inlined]] +; CHECK-NEXT: OpExtInst %void [[ext]] DebugValue {{%\w+}} {{%\w+}} {{%\w+}} +; CHECK-NEXT: DebugScope +; CHECK-NEXT: DebugLine +; CHECK-NEXT: OpStore [[UniformVar]] %float_0 +; CHECK-NEXT: OpReturn + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" + OpExecutionMode %2 LocalSize 1 1 1 + %3 = OpString "" + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %13 = OpVariable %_ptr_Uniform_float Uniform + %uint_57 = OpConstant %uint 57 + %15 = OpExtInst %void %1 DebugExpression + %16 = OpExtInst %void %1 DebugSource %3 %3 + %17 = OpExtInst %void %1 DebugCompilationUnit %uint_0 %uint_0 %16 %uint_0 + %18 = OpExtInst %void %1 DebugTypeBasic %3 %uint_0 %uint_0 %uint_0 + %19 = OpExtInst %void %1 DebugTypeVector %18 %uint_3 + %20 = OpExtInst %void %1 DebugTypePointer %19 %uint_0 %uint_0 + %21 = OpExtInst %void %1 DebugTypeFunction %uint_0 %void %20 + %22 = OpExtInst %void %1 DebugFunction %3 %21 %16 %uint_0 %uint_0 %17 %3 %uint_0 %uint_0 + %23 = OpExtInst %void %1 DebugTypeBasic %3 %uint_0 %uint_3 %uint_0 + %24 = OpExtInst %void %1 DebugTypeMember %3 %23 %16 %uint_0 %uint_0 %uint_0 %uint_0 %uint_0 + %25 = OpExtInst %void %1 DebugTypeComposite %3 %uint_0 %16 %uint_0 %uint_0 %17 %3 %uint_0 %uint_0 %24 + %26 = OpExtInst %void %1 DebugTypeFunction %uint_0 %23 %25 %23 + %27 = OpExtInst %void %1 DebugFunction %3 %26 %16 %uint_0 %uint_0 %17 %3 %uint_0 %uint_0 + %28 = OpExtInst %void %1 DebugLocalVariable %3 %23 %16 %uint_0 %uint_0 %27 %uint_0 %uint_0 + %29 = OpExtInst %void %1 DebugInlinedAt %uint_0 %22 + %2 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpVariable %_ptr_Function_float Function + %32 = OpExtInst %void %1 DebugScope %27 %29 + %33 = OpExtInst %void %1 DebugNoLine + %34 = OpExtInst %void %1 DebugDeclare %28 %31 %15 + OpStore %31 %float_0 + %35 = OpExtInst %void %1 DebugScope %22 + %36 = OpExtInst %void %1 DebugLine %16 %uint_0 %uint_0 %uint_0 %uint_0 + OpStore %13 %float_0 + OpReturn + %37 = OpExtInst %void %1 DebugNoScope + OpFunctionEnd +)"; + + SinglePassRunAndMatch(spirv, true); +} + +TEST_F(AggressiveDCETest, DebugValueWithDeadOperandKeepsDebugScope) { + const std::string spirv = R"( +; CHECK: [[ext:%\w+]] = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" +; CHECK-DAG: [[inlined:%\w+]] = OpExtInst %void [[ext]] DebugInlinedAt +; CHECK-DAG: [[undef:%\w+]] = OpUndef %float +; CHECK: [[scope:%\w+]] = OpExtInst %void [[ext]] DebugScope {{%\w+}} [[inlined]] +; CHECK-NEXT: OpExtInst %void [[ext]] DebugValue {{%\w+}} [[undef]] {{%\w+}} + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" + OpExecutionMode %2 LocalSize 1 1 1 + %4 = OpString "" + %5 = OpString "file.slang" + %6 = OpString "uint" + %7 = OpString "computeMain" + %8 = OpString "float" + %9 = OpString "x" + %10 = OpString "A" + %11 = OpString "test" + %12 = OpString "v" + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_11 = OpConstant %uint 11 + %uint_5 = OpConstant %uint 5 + %uint_100 = OpConstant %uint 100 + %21 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint_32 = OpConstant %uint 32 + %uint_6 = OpConstant %uint 6 +%uint_131072 = OpConstant %uint 131072 + %uint_3 = OpConstant %uint 3 + %uint_7 = OpConstant %uint 7 + %uint_0 = OpConstant %uint 0 + %uint_46 = OpConstant %uint 46 + %uint_1 = OpConstant %uint 1 + %uint_8 = OpConstant %uint 8 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %uint_50 = OpConstant %uint 50 + %uint_34 = OpConstant %uint 34 + %uint_2 = OpConstant %uint 2 + %uint_56 = OpConstant %uint 56 +%_runtimearr_float = OpTypeRuntimeArray %float + %uint_57 = OpConstant %uint 57 + %42 = OpExtInst %void %1 DebugExpression + %43 = OpExtInst %void %1 DebugSource %5 %4 + %44 = OpExtInst %void %1 DebugCompilationUnit %uint_100 %uint_5 %43 %uint_11 + %45 = OpExtInst %void %1 DebugTypeBasic %6 %uint_32 %uint_6 %uint_131072 + %46 = OpExtInst %void %1 DebugTypeVector %45 %uint_3 + %47 = OpExtInst %void %1 DebugTypePointer %46 %uint_7 %uint_131072 + %48 = OpExtInst %void %1 DebugTypeFunction %uint_0 %void %47 + %49 = OpExtInst %void %1 DebugFunction %7 %48 %43 %uint_46 %uint_6 %44 %7 %uint_0 %uint_46 + %50 = OpExtInst %void %1 DebugTypeBasic %8 %uint_32 %uint_3 %uint_131072 + %51 = OpExtInst %void %1 DebugTypeMember %9 %50 %43 %uint_8 %uint_11 %uint_0 %uint_32 %uint_0 + %52 = OpExtInst %void %1 DebugTypeComposite %10 %uint_1 %43 %uint_6 %uint_8 %44 %10 %uint_32 %uint_131072 %51 + %53 = OpExtInst %void %1 DebugTypeFunction %uint_0 %50 %52 %50 + %54 = OpExtInst %void %1 DebugFunction %11 %53 %43 %uint_34 %uint_7 %44 %11 %uint_0 %uint_34 + %55 = OpExtInst %void %1 DebugLocalVariable %12 %50 %43 %uint_34 %uint_7 %54 %uint_0 %uint_2 + %56 = OpExtInst %void %1 DebugInlinedAt %uint_50 %49 + %2 = OpFunction %void None %21 + %57 = OpLabel + %59 = OpExtInst %void %1 DebugScope %54 %56 + %60 = OpExtInst %void %1 DebugNoLine + %val = OpFAdd %float %float_0 %float_0 + %61 = OpExtInst %void %1 DebugValue %55 %val %42 + %62 = OpExtInst %void %1 DebugScope %49 + %63 = OpExtInst %void %1 DebugLine %43 %uint_56 %uint_56 %uint_5 %uint_6 + OpReturn + %66 = OpExtInst %void %1 DebugNoScope + OpFunctionEnd +)"; + + SinglePassRunAndMatch(spirv, true); +} } // namespace } // namespace opt diff --git a/third_party/spirv-tools/test/opt/canonicalize_ids_test.cpp b/third_party/spirv-tools/test/opt/canonicalize_ids_test.cpp index a968253455..cc4b7bdce5 100644 --- a/third_party/spirv-tools/test/opt/canonicalize_ids_test.cpp +++ b/third_party/spirv-tools/test/opt/canonicalize_ids_test.cpp @@ -2008,6 +2008,111 @@ OpFunctionEnd SinglePassRunAndCheck(before, after, false, false); } +TEST_F(CanonicalizeIdsTest, NonSemanticDebugInfo) { + std::string before = R"( +OpCapability Shader +OpExtension "SPV_KHR_non_semantic_info" +OpExtension "SPV_KHR_storage_buffer_storage_class" +%1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %2 "main" +OpExecutionMode %2 LocalSize 1 1 1 +%4 = OpString "" +OpDecorate %6 ArrayStride 4 +OpDecorate %7 Block +OpMemberDecorate %7 0 Offset 0 +OpDecorate %3 Binding 0 +OpDecorate %3 DescriptorSet 0 +%8 = OpTypeVoid +%9 = OpTypeInt 32 0 +%10 = OpConstant %9 100 +%11 = OpTypeFunction %8 +%12 = OpTypeInt 32 1 +%13 = OpConstant %12 0 +%14 = OpTypeFloat 32 +%5 = OpTypePointer StorageBuffer %14 +%6 = OpTypeRuntimeArray %14 +%7 = OpTypeStruct %6 +%15 = OpTypePointer StorageBuffer %7 +%16 = OpConstant %14 0 +%3 = OpVariable %15 StorageBuffer +%17 = OpExtInst %8 %1 DebugInfoNone +%18 = OpExtInst %8 %1 DebugSource %4 %4 +%19 = OpExtInst %8 %1 DebugCompilationUnit %10 %10 %18 %10 +%20 = OpExtInst %8 %1 DebugTypeFunction %10 %8 +%21 = OpExtInst %8 %1 DebugFunction %4 %20 %18 %10 %10 %19 %4 %10 %10 +%22 = OpExtInst %8 %1 DebugEntryPoint %21 %19 %4 %4 +%23 = OpExtInst %8 %1 DebugTypeBasic %4 %10 %10 %10 +%24 = OpExtInst %8 %1 DebugTypeArray %23 %10 +%25 = OpExtInst %8 %1 DebugTypeMember %4 %24 %18 %10 %10 %10 %10 %10 +%26 = OpExtInst %8 %1 DebugTypeComposite %4 %10 %18 %10 %10 %19 %4 %10 %10 %25 +%27 = OpExtInst %8 %1 DebugGlobalVariable %4 %26 %18 %10 %10 %19 %4 %3 %10 +%2 = OpFunction %8 None %11 +%28 = OpLabel +%29 = OpExtInst %8 %1 DebugFunctionDefinition %21 %2 +%30 = OpExtInst %8 %1 DebugScope %21 +%31 = OpExtInst %8 %1 DebugLine %18 %10 %10 %10 %10 +%32 = OpAccessChain %5 %3 %13 %13 +OpStore %32 %16 +OpReturn +%33 = OpExtInst %8 %1 DebugNoScope +OpFunctionEnd +)"; + + std::string after = R"(OpCapability Shader +OpExtension "SPV_KHR_non_semantic_info" +OpExtension "SPV_KHR_storage_buffer_storage_class" +%1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %10742 "main" +OpExecutionMode %10742 LocalSize 1 1 1 +%3 = OpString "" +OpDecorate %2002 ArrayStride 4 +OpDecorate %1952 Block +OpMemberDecorate %1952 0 Offset 0 +OpDecorate %2 Binding 0 +OpDecorate %2 DescriptorSet 0 +%8 = OpTypeVoid +%11 = OpTypeInt 32 0 +%2870 = OpConstant %11 100 +%1282 = OpTypeFunction %8 +%12 = OpTypeInt 32 1 +%2571 = OpConstant %12 0 +%13 = OpTypeFloat 32 +%650 = OpTypePointer StorageBuffer %13 +%2002 = OpTypeRuntimeArray %13 +%1952 = OpTypeStruct %2002 +%2589 = OpTypePointer StorageBuffer %1952 +%2572 = OpConstant %13 0 +%2 = OpVariable %2589 StorageBuffer +%4 = OpExtInst %8 %1 DebugInfoNone +%5 = OpExtInst %8 %1 DebugSource %3 %3 +%6 = OpExtInst %8 %1 DebugCompilationUnit %2870 %2870 %5 %2870 +%7 = OpExtInst %8 %1 DebugTypeFunction %2870 %8 +%9 = OpExtInst %8 %1 DebugFunction %3 %7 %5 %2870 %2870 %6 %3 %2870 %2870 +%10 = OpExtInst %8 %1 DebugEntryPoint %9 %6 %3 %3 +%14 = OpExtInst %8 %1 DebugTypeBasic %3 %2870 %2870 %2870 +%15 = OpExtInst %8 %1 DebugTypeArray %14 %2870 +%16 = OpExtInst %8 %1 DebugTypeMember %3 %15 %5 %2870 %2870 %2870 %2870 %2870 +%17 = OpExtInst %8 %1 DebugTypeComposite %3 %2870 %5 %2870 %2870 %6 %3 %2870 %2870 %16 +%18 = OpExtInst %8 %1 DebugGlobalVariable %3 %17 %5 %2870 %2870 %6 %3 %2 %2870 +%10742 = OpFunction %8 None %1282 +%9442 = OpLabel +%15450 = OpExtInst %8 %1 DebugFunctionDefinition %9 %10742 +%20275 = OpExtInst %8 %1 DebugScope %9 +%19 = OpExtInst %8 %1 DebugLine %5 %2870 %2870 %2870 %2870 +%20274 = OpAccessChain %650 %2 %2571 %2571 +OpStore %20274 %2572 +OpReturn +%20276 = OpExtInst %8 %1 DebugNoScope +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, true); +} + } // namespace } // namespace opt } // namespace spvtools diff --git a/third_party/spirv-tools/test/opt/ccp_test.cpp b/third_party/spirv-tools/test/opt/ccp_test.cpp index a8e9557db0..1d525266ce 100644 --- a/third_party/spirv-tools/test/opt/ccp_test.cpp +++ b/third_party/spirv-tools/test/opt/ccp_test.cpp @@ -926,6 +926,7 @@ OpReturn OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndMatch(text, true); } @@ -1237,6 +1238,34 @@ TEST_F(CCPTest, CCPNoChangeFailureWithUnfoldableInstr) { EXPECT_EQ(std::get<1>(result), Pass::Status::SuccessWithChange); } +TEST_F(CCPTest, CCPSuccessWithNoCCPOnExtendedInstruction) { + // We don't expect to have Constant Propagation on certain + // extended instructions with 16 bit integers. This is to + // test that this stage doesn't throw errors. If we add support + // for 16 bit integers, this test should change. + + const std::string text = R"(OpCapability Shader +OpCapability Float16 +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +%void = OpTypeVoid +%half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%6 = OpTypeFunction %void +%main = OpFunction %void None %6 +%7 = OpLabel +%8 = OpExtInst %half %1 Cos %half_0x1p_0 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(text, text, false); +} + TEST_F(CCPTest, FunctionDeclaration) { // Make sure the pass works with a function declaration that is called. const std::string text = R"(OpCapability Addresses diff --git a/third_party/spirv-tools/test/opt/combine_access_chains_test.cpp b/third_party/spirv-tools/test/opt/combine_access_chains_test.cpp index ef7addc7eb..677f9bc594 100644 --- a/third_party/spirv-tools/test/opt/combine_access_chains_test.cpp +++ b/third_party/spirv-tools/test/opt/combine_access_chains_test.cpp @@ -573,6 +573,7 @@ OpReturn OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndMatch(text, true); } @@ -610,6 +611,7 @@ OpReturn OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndMatch(text, true); } @@ -648,6 +650,7 @@ OpReturn OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndMatch(text, true); } @@ -763,6 +766,7 @@ OpReturn OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndMatch(text, true); } diff --git a/third_party/spirv-tools/test/opt/convert_relaxed_to_half_test.cpp b/third_party/spirv-tools/test/opt/convert_relaxed_to_half_test.cpp index c5774045c3..169ab29d9a 100644 --- a/third_party/spirv-tools/test/opt/convert_relaxed_to_half_test.cpp +++ b/third_party/spirv-tools/test/opt/convert_relaxed_to_half_test.cpp @@ -514,28 +514,30 @@ OpFunctionEnd %14 = OpFAdd %half %55 %56 %16 = OpCompositeConstruct %v2half %13 %14 %58 = OpFConvert %float %14 -%18 = OpImageSampleDrefImplicitLod %float %46 %16 %58 +%59 = OpFConvert %v2float %16 +%18 = OpImageSampleDrefImplicitLod %float %46 %59 %58 %48 = OpLoad %27 %g_tTex1df4 %49 = OpLoad %29 %g_sSamp %50 = OpSampledImage %31 %48 %49 -%59 = OpFConvert %half %12 -%60 = OpFConvert %half %float_0_200000003 -%15 = OpFMul %half %59 %60 +%60 = OpFConvert %half %12 +%61 = OpFConvert %half %float_0_200000003 +%15 = OpFMul %half %60 %61 %51 = OpAccessChain %_ptr_Uniform_float %_ %int_1 %17 = OpLoad %float %51 -%61 = OpFConvert %half %17 -%62 = OpFConvert %half %float_0_200000003 -%19 = OpFAdd %half %61 %62 +%62 = OpFConvert %half %17 +%63 = OpFConvert %half %float_0_200000003 +%19 = OpFAdd %half %62 %63 %20 = OpCompositeConstruct %v2half %15 %19 -%63 = OpFConvert %float %19 -%21 = OpImageSampleDrefImplicitLod %float %50 %20 %63 -%64 = OpFConvert %half %18 -%65 = OpFConvert %half %21 -%22 = OpFAdd %half %64 %65 -%66 = OpFConvert %half %float_0_5 -%23 = OpFMul %half %22 %66 -%67 = OpFConvert %float %23 -OpStore %_entryPointOutput_Color %67 +%64 = OpFConvert %float %19 +%65 = OpFConvert %v2float %20 +%21 = OpImageSampleDrefImplicitLod %float %50 %65 %64 +%66 = OpFConvert %half %18 +%67 = OpFConvert %half %21 +%22 = OpFAdd %half %66 %67 +%68 = OpFConvert %half %float_0_5 +%23 = OpFMul %half %22 %68 +%69 = OpFConvert %float %23 +OpStore %_entryPointOutput_Color %69 OpReturn OpFunctionEnd )"; @@ -1616,6 +1618,7 @@ OpFunctionEnd TEST_F(ConvertToHalfTest, PreserveImageOperandPrecision) { // Ensure that a non-relaxed texture coordinate does not get relaxed nor // converted to half precision if the image instruction is marked relaxed. + // Update - coordinates are not allowed to be 16-bit regardless // Also ensure that a relaxed local variable does get converted to half // precision before being passed to an image opeartor. @@ -1639,7 +1642,7 @@ TEST_F(ConvertToHalfTest, PreserveImageOperandPrecision) { OpCapability Float16 %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %4 "main" %13 %25 + OpEntryPoint Fragment %4 "main" %13 %26 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 310 OpDecorate %9 RelaxedPrecision @@ -1648,8 +1651,8 @@ TEST_F(ConvertToHalfTest, PreserveImageOperandPrecision) { OpDecorate %17 DescriptorSet 3 OpDecorate %17 Binding 0 OpDecorate %18 RelaxedPrecision - OpDecorate %23 RelaxedPrecision - OpDecorate %25 Location 10 + OpDecorate %24 RelaxedPrecision + OpDecorate %26 Location 10 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeFloat 32 @@ -1669,13 +1672,13 @@ TEST_F(ConvertToHalfTest, PreserveImageOperandPrecision) { %17 = OpVariable %16 UniformConstant %19 = OpTypeVector %6 2 ;CHECK: [[vec2_t:%\w+]] = OpTypeVector [[float32_t]] 2 - %24 = OpTypePointer Input %7 + %25 = OpTypePointer Input %7 ;CHECK: [[input_ptr_t:%\w+]] = OpTypePointer Input [[vec4_t]] - %25 = OpVariable %24 Input - %29 = OpTypeFloat 16 + %26 = OpVariable %25 Input + %30 = OpTypeFloat 16 ;CHECK: [[float16_t:%\w+]] = OpTypeFloat 16 - %30 = OpTypeVector %29 4 - %33 = OpTypeVector %29 2 + %31 = OpTypeVector %30 4 + %34 = OpTypeVector %30 2 ;CHECK: [[vec2_16b_t:%\w+]] = OpTypeVector [[float16_t]] 2 %4 = OpFunction %2 None %3 %5 = OpLabel @@ -1686,26 +1689,27 @@ TEST_F(ConvertToHalfTest, PreserveImageOperandPrecision) { OpStore %9 %11 %18 = OpLoad %15 %17 %20 = OpLoad %7 %9 - %31 = OpFConvert %30 %20 - %32 = OpFConvert %30 %20 + %32 = OpFConvert %31 %20 + %33 = OpFConvert %31 %20 -; The first sample op should get a 16b coordinate - %21 = OpVectorShuffle %33 %31 %32 0 1 +; The first sample op should get a 32b coordinate, even if relaxed + %21 = OpVectorShuffle %34 %32 %33 0 1 ;CHECK: [[uv_16b:%\w+]] = OpVectorShuffle [[vec2_16b_t]] - %22 = OpImageSampleImplicitLod %7 %18 %21 -;CHECK: OpImageSampleImplicitLod [[vec4_t]] {{%\w+}} [[uv_16b]] + %22 = OpFConvert %19 %21 + %23 = OpImageSampleImplicitLod %7 %18 %22 +;CHECK: OpImageSampleImplicitLod [[vec4_t]] {{%\w+}} {{%\w+}} - OpStore %13 %22 - %23 = OpLoad %15 %17 - %26 = OpLoad %7 %25 + OpStore %13 %23 + %24 = OpLoad %15 %17 + %27 = OpLoad %7 %26 ; The second sample op should get a 32b coordinate - %27 = OpVectorShuffle %19 %26 %26 0 1 + %28 = OpVectorShuffle %19 %27 %27 0 1 ;CHECK: [[uv_32b:%\w+]] = OpVectorShuffle [[vec2_t]] - %28 = OpImageSampleImplicitLod %7 %23 %27 + %29 = OpImageSampleImplicitLod %7 %24 %28 ;CHECK: OpImageSampleImplicitLod [[vec4_t]] {{%\w+}} [[uv_32b]] - OpStore %13 %28 + OpStore %13 %29 OpReturn OpFunctionEnd )"; diff --git a/third_party/spirv-tools/test/opt/eliminate_dead_member_test.cpp b/third_party/spirv-tools/test/opt/eliminate_dead_member_test.cpp index bb0ec039bc..6fdf91bbe7 100644 --- a/third_party/spirv-tools/test/opt/eliminate_dead_member_test.cpp +++ b/third_party/spirv-tools/test/opt/eliminate_dead_member_test.cpp @@ -958,7 +958,7 @@ TEST_F(EliminateDeadMemberTest, RemoveMemberPtrAccessChain) { ; CHECK: OpMemberDecorate %type__Globals 1 Offset 16 ; CHECK: %type__Globals = OpTypeStruct %float %float ; CHECK: [[ac:%\w+]] = OpAccessChain %_ptr_Uniform_type__Globals %_Globals %uint_0 -; CHECK: OpPtrAccessChain %_ptr_Uniform_float [[ac]] %uint_1 %uint_0 +; CHECK: OpPtrAccessChain %_ptr_Uniform_float [[ac]] %uint_0 %uint_0 ; CHECK: OpPtrAccessChain %_ptr_Uniform_float [[ac]] %uint_0 %uint_1 OpCapability Shader OpCapability VariablePointersStorageBuffer @@ -995,12 +995,13 @@ TEST_F(EliminateDeadMemberTest, RemoveMemberPtrAccessChain) { %main = OpFunction %void None %14 %16 = OpLabel %17 = OpAccessChain %_ptr_Uniform_type__Globals %_Globals %uint_0 - %18 = OpPtrAccessChain %_ptr_Uniform_float %17 %uint_1 %uint_0 + %18 = OpPtrAccessChain %_ptr_Uniform_float %17 %uint_0 %uint_0 %19 = OpPtrAccessChain %_ptr_Uniform_float %17 %uint_0 %uint_2 OpReturn OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndMatch(text, true); } @@ -1060,6 +1061,7 @@ TEST_F(EliminateDeadMemberTest, RemoveMemberInBoundsPtrAccessChain) { OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndMatch(text, true); } diff --git a/third_party/spirv-tools/test/opt/feature_manager_test.cpp b/third_party/spirv-tools/test/opt/feature_manager_test.cpp index 7e8f92c3c1..6366d425fd 100644 --- a/third_party/spirv-tools/test/opt/feature_manager_test.cpp +++ b/third_party/spirv-tools/test/opt/feature_manager_test.cpp @@ -179,6 +179,45 @@ OpMemoryModel Logical GLSL450 EXPECT_TRUE(capabilities.contains(spv::Capability::Matrix)); } +TEST_F(FeatureManagerTest, HasConditionalExtension) { + const std::string text = R"( + OpCapability Linkage + OpCapability Shader + OpCapability SpecConditionalINTEL + OpExtension "SPV_INTEL_function_variants" + OpConditionalExtensionINTEL %1 "SPV_KHR_variable_pointers" + OpMemoryModel Logical GLSL450 + %bool = OpTypeBool + %1 = OpSpecConstantTrue %bool + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_6, nullptr, text); + ASSERT_NE(context, nullptr); + + EXPECT_TRUE(context->get_feature_mgr()->HasExtension( + Extension::kSPV_KHR_variable_pointers)); +} + +TEST_F(FeatureManagerTest, HasConditionalCapability) { + const std::string text = R"( + OpCapability Linkage + OpCapability Shader + OpCapability SpecConditionalINTEL + OpConditionalCapabilityINTEL %1 Int8 + OpExtension "SPV_INTEL_function_variants" + OpMemoryModel Logical GLSL450 + %bool = OpTypeBool + %1 = OpSpecConstantTrue %bool + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_6, nullptr, text); + ASSERT_NE(context, nullptr); + + EXPECT_TRUE(context->get_feature_mgr()->HasCapability(spv::Capability::Int8)); +} + } // namespace } // namespace opt } // namespace spvtools diff --git a/third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp b/third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp index 335e0f5162..2d5af28f59 100644 --- a/third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp +++ b/third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2016 Google Inc. +// Copyright (c) 2025 Arm Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -737,6 +738,9 @@ std::vector CommonTypesAndConstants() { "%inner_struct = OpTypeStruct %bool %int %float", "%outer_struct = OpTypeStruct %inner_struct %int", "%flat_struct = OpTypeStruct %bool %int %float", + "%flat_struct_replicate = OpTypeStruct %int %int %int", + "%inner_struct_replicate = OpTypeStruct %float %float %float", + "%outer_struct_replicate = OpTypeStruct %inner_struct_replicate %inner_struct_replicate", // common constants // scalar constants: @@ -826,7 +830,7 @@ TEST_P(FoldSpecConstantOpAndCompositePassTest, ParamTestCase) { StripOpNameInstructions(optimized)); } -// Tests that OpSpecConstantComposite opcodes are replace with +// Tests that OpSpecConstantComposite opcodes are replaced with // OpConstantComposite correctly. INSTANTIATE_TEST_SUITE_P( Composite, FoldSpecConstantOpAndCompositePassTest, @@ -946,6 +950,113 @@ INSTANTIATE_TEST_SUITE_P( // clang-format on }))); +// Tests that OpSpecConstantCompositeReplicateEXT opcodes are replaced with +// OpConstantCompositeReplicateEXT correctly. +INSTANTIATE_TEST_SUITE_P( + CompositeReplicate, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn(std::vector< + FoldSpecConstantOpAndCompositePassTestCase>({ + // clang-format off + // normal vector + { + // original + { + "%spec_v2bool = OpSpecConstantCompositeReplicateEXT %v2bool %bool_true", + "%spec_v2uint = OpSpecConstantCompositeReplicateEXT %v2uint %unsigned_one", + "%spec_v2int_a = OpSpecConstantCompositeReplicateEXT %v2int %signed_two", + // Spec constants whose value can not be fully resolved should + // not be processed. + "%spec_int = OpSpecConstant %int 99", + "%spec_v2int_b = OpSpecConstantCompositeReplicateEXT %v2int %spec_int", + }, + // expected + { + "%spec_v2bool = OpConstantCompositeReplicateEXT %v2bool %bool_true", + "%spec_v2uint = OpConstantCompositeReplicateEXT %v2uint %unsigned_one", + "%spec_v2int_a = OpConstantCompositeReplicateEXT %v2int %signed_two", + "%spec_int = OpSpecConstant %int 99", + "%spec_v2int_b = OpSpecConstantCompositeReplicateEXT %v2int %spec_int", + }, + }, + // vector with null constants + { + // original + { + "%null_bool = OpConstantNull %bool", + "%null_int = OpConstantNull %int", + "%spec_v2bool = OpSpecConstantCompositeReplicateEXT %v2bool %null_bool", + "%spec_v3int = OpSpecConstantCompositeReplicateEXT %v3int %null_int", + "%spec_v4int = OpSpecConstantCompositeReplicateEXT %v4int %null_int", + }, + // expected + { + "%null_bool = OpConstantNull %bool", + "%null_int = OpConstantNull %int", + "%spec_v2bool = OpConstantCompositeReplicateEXT %v2bool %null_bool", + "%spec_v3int = OpConstantCompositeReplicateEXT %v3int %null_int", + "%spec_v4int = OpConstantCompositeReplicateEXT %v4int %null_int", + }, + }, + // flat struct + { + // original + { + "%int_1 = OpConstant %int 1", + "%flat_1 = OpSpecConstantCompositeReplicateEXT %flat_struct_replicate %int_1", + // following struct should not be folded as the value of + // %spec_float is not determined. + "%spec_int = OpSpecConstant %int 1", + "%flat_2 = OpSpecConstantCompositeReplicateEXT %flat_struct_replicate %spec_int", + }, + // expected + { + "%int_1 = OpConstant %int 1", + "%flat_1 = OpConstantCompositeReplicateEXT %flat_struct_replicate %int_1", + "%spec_int = OpSpecConstant %int 1", + "%flat_2 = OpSpecConstantCompositeReplicateEXT %flat_struct_replicate %spec_int", + } + }, + // nested struct + { + // original + { + "%float_1 = OpConstant %float 1", + "%inner_1 = OpSpecConstantCompositeReplicateEXT %inner_struct_replicate %float_1", + "%outer_1 = OpSpecConstantCompositeReplicateEXT %outer_struct_replicate %inner_1", + // following structs should not be folded as the value of + // %spec_float is not determined. + "%spec_float = OpSpecConstant %float 1", + "%inner_2 = OpSpecConstantCompositeReplicateEXT %inner_struct_replicate %spec_float", + "%outer_2 = OpSpecConstantCompositeReplicateEXT %outer_struct_replicate %inner_2", + }, + // expected + { + "%float_1 = OpConstant %float 1", + "%inner_1 = OpConstantCompositeReplicateEXT %inner_struct_replicate %float_1", + "%outer_1 = OpConstantCompositeReplicateEXT %outer_struct_replicate %inner_1", + "%spec_float = OpSpecConstant %float 1", + "%inner_2 = OpSpecConstantCompositeReplicateEXT %inner_struct_replicate %spec_float", + "%outer_2 = OpSpecConstantCompositeReplicateEXT %outer_struct_replicate %inner_2", + } + }, + // composite constants touched by OpUndef should be skipped + { + // original + { + "%undef = OpUndef %float", + "%inner = OpConstantCompositeReplicateEXT %inner_struct_replicate %undef", + "%outer = OpSpecConstantCompositeReplicateEXT %outer_struct_replicate %inner", + }, + // expected + { + "%undef = OpUndef %float", + "%inner = OpConstantCompositeReplicateEXT %inner_struct_replicate %undef", + "%outer = OpSpecConstantCompositeReplicateEXT %outer_struct_replicate %inner", + }, + }, + // clang-format on + }))); + // Tests for operations that resulting in different types. INSTANTIATE_TEST_SUITE_P( Cast, FoldSpecConstantOpAndCompositePassTest, diff --git a/third_party/spirv-tools/test/opt/fold_test.cpp b/third_party/spirv-tools/test/opt/fold_test.cpp index 299ad7503f..8c7649bb90 100644 --- a/third_party/spirv-tools/test/opt/fold_test.cpp +++ b/third_party/spirv-tools/test/opt/fold_test.cpp @@ -211,6 +211,8 @@ TEST_P(IntegerInstructionFoldingTest, Case) { #define UINT_0_ID 109 #define INT_NULL_ID 110 #define UINT_NULL_ID 111 +#define HALF_3_ID 112 +#define FLOAT_NULL_ID 113 const std::string& Header() { static const std::string header = R"(OpCapability Shader OpCapability Float16 @@ -246,16 +248,23 @@ OpName %main "main" %ulong = OpTypeInt 64 0 %v2int = OpTypeVector %int 2 %v4int = OpTypeVector %int 4 +%v2ubyte = OpTypeVector %ubyte 2 +%v4ubyte = OpTypeVector %ubyte 4 +%v4byte = OpTypeVector %byte 4 +%v2ushort = OpTypeVector %ushort 2 +%v4ushort = OpTypeVector %ushort 4 %v2short = OpTypeVector %short 2 %v2long = OpTypeVector %long 2 %v4long = OpTypeVector %long 4 %v4float = OpTypeVector %float 4 %v4double = OpTypeVector %double 4 +%v4uint = OpTypeVector %uint 4 %v2uint = OpTypeVector %uint 2 %v2ulong = OpTypeVector %ulong 2 %v2float = OpTypeVector %float 2 %v2double = OpTypeVector %double 2 %v2half = OpTypeVector %half 2 +%v4half = OpTypeVector %half 4 %v2bool = OpTypeVector %bool 2 %m2x2int = OpTypeMatrix %v2int 2 %mat4v2float = OpTypeMatrix %v2float 4 @@ -275,17 +284,29 @@ OpName %main "main" %_ptr_v4int = OpTypePointer Function %v4int %_ptr_v4float = OpTypePointer Function %v4float %_ptr_v4double = OpTypePointer Function %v4double +%_ptr_v4half = OpTypePointer Function %v4half %_ptr_struct_v2int_int_int = OpTypePointer Function %struct_v2int_int_int %_ptr_v2float = OpTypePointer Function %v2float %_ptr_v2double = OpTypePointer Function %v2double %int_2 = OpConstant %int 2 %int_arr_2 = OpTypeArray %int %int_2 +%short_n1 = OpConstant %short -1 %short_0 = OpConstant %short 0 %short_2 = OpConstant %short 2 %short_3 = OpConstant %short 3 %short_n5 = OpConstant %short -5 %ubyte_1 = OpConstant %ubyte 1 +%ubyte_a = OpConstant %ubyte 10 +%ubyte_b = OpConstant %ubyte 11 +%ubyte_c = OpConstant %ubyte 12 +%ubyte_d = OpConstant %ubyte 13 %byte_n1 = OpConstant %byte -1 +%byte_0 = OpConstant %byte 0 +%ushort_0 = OpConstant %ushort 0 +%ushort_1 = OpConstant %ushort 1 +%ushort_2 = OpConstant %ushort 2 +%ushort_3 = OpConstant %ushort 3 +%ushort_null = OpConstantNull %ushort %100 = OpConstant %int 0 ; Need a def with an numerical id to define id maps. %110 = OpConstantNull %int ; Need a def with an numerical id to define id maps. %103 = OpConstant %int 7 ; Need a def with an numerical id to define id maps. @@ -329,6 +350,7 @@ OpName %main "main" %uint_42 = OpConstant %uint 42 %uint_2147483649 = OpConstant %uint 2147483649 %uint_max = OpConstant %uint 4294967295 +%uint_0x0000ffff = OpConstant %uint 65535 %ulong_0 = OpConstant %ulong 0 %ulong_1 = OpConstant %ulong 1 %ulong_2 = OpConstant %ulong 2 @@ -344,6 +366,8 @@ OpName %main "main" %v2int_4_4 = OpConstantComposite %v2int %int_4 %int_4 %v2int_min_max = OpConstantComposite %v2int %int_min %int_max %v2short_2_n5 = OpConstantComposite %v2short %short_2 %short_n5 +%v2short_n1_0 = OpConstantComposite %v2short %short_n1 %short_0 +%v2short_null = OpConstantNull %v2short %v2long_2_2 = OpConstantComposite %v2long %long_2 %long_2 %v2long_2_3 = OpConstantComposite %v2long %long_2 %long_3 %v2bool_null = OpConstantNull %v2bool @@ -358,6 +382,7 @@ OpName %main "main" %struct_undef_0_0 = OpConstantComposite %struct_v2int_int_int %v2int_undef %int_0 %int_0 %float_n1 = OpConstant %float -1 %104 = OpConstant %float 0 ; Need a def with an numerical id to define id maps. +%113 = OpConstantNull %float ; Need a def with an numerical id to define id maps. %float_null = OpConstantNull %float %float_0 = OpConstant %float 0 %float_n0 = OpConstant %float -0.0 @@ -402,9 +427,13 @@ OpName %main "main" %v2double_2_0p5 = OpConstantComposite %v2double %double_2 %double_0p5 %v2double_null = OpConstantNull %v2double %108 = OpConstant %half 0 +%half_0p5 = OpConstant %half 0.5 %half_1 = OpConstant %half 1 %half_2 = OpConstant %half 2 +%112 = OpConstant %half 3 +%half_null = OpConstantNull %half %half_0_1 = OpConstantComposite %v2half %108 %half_1 +%v4half_0_1_0_0 = OpConstantComposite %v4half %108 %half_1 %108 %108 %106 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 %v4float_0_0_0_0 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 %v4float_0_0_0_1 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 @@ -431,6 +460,14 @@ OpName %main "main" %uint_0x3f800000 = OpConstant %uint 0x3f800000 %uint_0xbf800000 = OpConstant %uint 0xbf800000 %v2uint_0x3f800000_0xbf800000 = OpConstantComposite %v2uint %uint_0x3f800000 %uint_0xbf800000 +%v4uint_1_0x0000ffff_uint_0_uint_max = OpConstantComposite %v4uint %uint_1 %uint_0x0000ffff %uint_0 %uint_max +%v2uint_1_null = OpConstantComposite %v2uint %uint_1 %111 +%v2uint_null = OpConstantNull %v2uint +%v2ushort_1_null = OpConstantComposite %v2ushort %ushort_1 %ushort_null +%v4ushort_0_1_2_3 = OpConstantComposite %v4ushort %ushort_0 %ushort_1 %ushort_2 %ushort_3 +%v2ubyte_a_b = OpConstantComposite %v2ubyte %ubyte_a %ubyte_b +%v4ubyte_a_b_c_d = OpConstantComposite %v4ubyte %ubyte_a %ubyte_b %ubyte_c %ubyte_d +%v4byte_n1_0_0_0 = OpConstantComposite %v4byte %byte_n1 %byte_0 %byte_0 %byte_0 %long_0xbf8000003f800000 = OpConstant %long 0xbf8000003f800000 %int_0x3FF00000 = OpConstant %int 0x3FF00000 %int_0x00000000 = OpConstant %int 0x00000000 @@ -771,7 +808,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + - "%2 = OpExtInst %int %1 UMin %int_3 %int_4\n" + + "%2 = OpExtInst %int %1 SMin %int_3 %int_4\n" + "OpReturn\n" + "OpFunctionEnd", 2, 3), @@ -783,7 +820,39 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 2), - // Test case 34: fold UMax 3 4 + // Test case 34: fold SMin short -5 2 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %short %1 SMin %short_n5 %short_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -5), + // Test case 35: fold UMin ushort 2 0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %ushort %1 UMin %ushort_2 %ushort_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 36: fold SMin int OpConstNull -1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %int %1 SMin %110 %int_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -1), + // Test case 37: fold SMin int -1 OpConstNull + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %int %1 SMin %int_n1 %110\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -1), + // Test case 38: fold UMax 3 4 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -791,7 +860,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 4), - // Test case 35: fold UMax 3 2 + // Test case 39: fold UMax 3 2 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -799,15 +868,15 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 3), - // Test case 36: fold SMax 3 4 + // Test case 40: fold SMax 3 4 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + - "%2 = OpExtInst %int %1 UMax %int_3 %int_4\n" + + "%2 = OpExtInst %int %1 SMax %int_3 %int_4\n" + "OpReturn\n" + "OpFunctionEnd", 2, 4), - // Test case 37: fold SMax 3 2 + // Test case 41: fold SMax 3 2 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -815,7 +884,31 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 3), - // Test case 38: fold UClamp 2 3 4 + // Test case 42: fold SMax short -5 2 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %short %1 SMax %short_n5 %short_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2), + // Test case 43: fold UMax ushort 2 0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %ushort %1 UMax %ushort_2 %ushort_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2), + // Test case 44: fold SMax int OpConstNull 1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %int %1 SMax %110 %int_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1), + // Test case 45: fold UClamp 2 3 4 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -823,7 +916,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 3), - // Test case 39: fold UClamp 2 0 4 + // Test case 46: fold UClamp 2 0 4 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -831,7 +924,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 2), - // Test case 40: fold UClamp 2 0 1 + // Test case 47: fold UClamp 2 0 1 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -839,7 +932,15 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 1), - // Test case 41: fold SClamp 2 3 4 + // Test case 48: fold UClamp short 2 0 1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %ushort %1 UClamp %ushort_2 %ushort_0 %ushort_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1), + // Test case 49: fold SClamp 2 3 4 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -847,7 +948,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 3), - // Test case 42: fold SClamp 2 0 4 + // Test case 50: fold SClamp 2 0 4 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -855,7 +956,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 2), - // Test case 43: fold SClamp 2 0 1 + // Test case 51: fold SClamp 2 0 1 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -863,7 +964,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 1), - // Test case 44: SClamp 1 2 x + // Test case 52: SClamp 1 2 x InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -872,7 +973,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 2), - // Test case 45: SClamp 2 x 1 + // Test case 53: SClamp 2 x 1 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -881,7 +982,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 1), - // Test case 46: UClamp 1 2 x + // Test case 54: UClamp 1 2 x InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -890,7 +991,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 2), - // Test case 47: UClamp 2 x 1 + // Test case 55: UClamp 2 x 1 InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -899,7 +1000,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 1), - // Test case 48: Bit-cast int 0 to unsigned int + // Test case 56: Bit-cast int 0 to unsigned int InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -907,7 +1008,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0), - // Test case 49: Bit-cast int -24 to unsigned int + // Test case 57: Bit-cast int -24 to unsigned int InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -915,7 +1016,15 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, static_cast(-24)), - // Test case 50: Bit-cast float 1.0f to unsigned int + // Test case 58: Bit-cast int const null to unsigned int + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %uint %110\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 59: Bit-cast float 1.0f to unsigned int InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -923,7 +1032,15 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, static_cast(0x3f800000)), - // Test case 51: Bit-cast ushort 0xBC00 to ushort + // Test case 60: Bit-cast float constant null to unsigned int + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %uint %float_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 61: Bit-cast ushort 0xBC00 to ushort InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -931,7 +1048,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xBC00), - // Test case 52: Bit-cast short 0xBC00 to ushort + // Test case 62: Bit-cast short 0xBC00 to ushort InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -939,7 +1056,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xBC00), - // Test case 53: Bit-cast half 1 to ushort + // Test case 63: Bit-cast half 1 to ushort InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -947,7 +1064,15 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0x3C00), - // Test case 54: Bit-cast ushort 0xBC00 to short + // Test case 64: Bit-cast half const null to ushort + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %ushort %half_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x0000), + // Test case 65: Bit-cast ushort 0xBC00 to short InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -955,7 +1080,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xFFFFBC00), - // Test case 55: Bit-cast short 0xBC00 to short + // Test case 66: Bit-cast short 0xBC00 to short InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -963,7 +1088,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xFFFFBC00), - // Test case 56: Bit-cast half 1 to short + // Test case 67: Bit-cast half 1 to short InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -971,7 +1096,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0x3C00), - // Test case 57: Bit-cast ushort 0xBC00 to half + // Test case 68: Bit-cast ushort 0xBC00 to half InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -979,7 +1104,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xBC00), - // Test case 58: Bit-cast short 0xBC00 to half + // Test case 69: Bit-cast short 0xBC00 to half InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -987,7 +1112,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xFFFFBC00), - // Test case 59: Bit-cast half 1 to half + // Test case 70: Bit-cast half 1 to half InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -995,7 +1120,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0x3C00), - // Test case 60: Bit-cast ubyte 1 to byte + // Test case 71: Bit-cast ubyte 1 to byte InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1003,7 +1128,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 1), - // Test case 61: Bit-cast byte -1 to ubyte + // Test case 72: Bit-cast byte -1 to ubyte InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1011,7 +1136,63 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xFF), - // Test case 62: Negate 2. + // Test case 73: Bit-cast v2shorts (-5,2) to uint + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %uint %v2short_2_n5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0xFFFB0002), + // Test case 74: Bit-cast v4ubytes (0xA, 0xB, 0xC, 0xD) to int + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %int %v4ubyte_a_b_c_d\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x0D0C0B0A), + // Test case 75: Bit-cast v2ushort (1, OpConstNull) to int + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %int %v2ushort_1_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000001), + // Test case 76: Bit-cast v2short OpConstNull to int + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %int %v2short_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 77: Bit-cast v2ubytes (0xA, 0xB) to ushort + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %int %v2ubyte_a_b\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x0B0A), + // Test case 78: Bit-cast v2short (-1, 0) to uint + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %uint %v2short_n1_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x0000FFFF), + // Test case 79: Bit-cast v4bytes (-1, 0, 0, 0) to uint + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %uint %v4byte_n1_0_0_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x000000FF), + // Test case 80: Negate 2. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1019,7 +1200,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, -2), - // Test case 63: Negate negative short. + // Test case 81: Negate negative short. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1027,7 +1208,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0x4400 /* expected to be sign extended. */), - // Test case 64: Negate positive short. + // Test case 82: Negate positive short. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1035,7 +1216,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xFFFFBC00 /* expected to be sign extended. */), - // Test case 65: Negate a negative short. + // Test case 83: Negate a negative short. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1043,7 +1224,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0x4400 /* expected to be zero extended. */), - // Test case 66: Negate positive short. + // Test case 84: Negate positive short. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1051,7 +1232,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 0xBC00 /* expected to be zero extended. */), - // Test case 67: Fold 2 + 3 (short) + // Test case 85: Fold 2 + 3 (short) InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1059,7 +1240,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 5), - // Test case 68: Fold 2 + -5 (short) + // Test case 86: Fold 2 + -5 (short) InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1067,7 +1248,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, -3), - // Test case 69: Fold int(3ll) + // Test case 87: Fold int(3ll) InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1075,7 +1256,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 3), - // Test case 70: Fold short(-3ll) + // Test case 88: Fold short(-3ll) InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1083,7 +1264,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, -3), - // Test case 71: Fold short(32768ll) - This should do a sign extend when + // Test case 89: Fold short(32768ll) - This should do a sign extend when // converting to short. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + @@ -1092,7 +1273,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, -32768), - // Test case 72: Fold short(-57344) - This should do a sign extend when + // Test case 90: Fold short(-57344) - This should do a sign extend when // converting to short making the upper bits 0. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + @@ -1101,7 +1282,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 8192), - // Test case 73: Fold int(-5(short)). The -5 should be interpreted as an unsigned value, and be zero extended to 32-bits. + // Test case 91: Fold int(-5(short)). The -5 should be interpreted as an unsigned value, and be zero extended to 32-bits. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1109,14 +1290,53 @@ INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, 65531), - // Test case 74: Fold short(-24(int)). The upper bits should be cleared. So 0xFFFFFFE8 should become 0x0000FFE8. + // Test case 92: Fold short(-24(int)). The upper bits should be cleared. So 0xFFFFFFE8 should become 0x0000FFE8. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%2 = OpUConvert %ushort %int_n24\n" + "OpReturn\n" + "OpFunctionEnd", - 2, 65512) + 2, 65512), + // Test case 93: Fold BitReverse of 1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitReverse %uint %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000), + // Test case 94: Fold BitReverse of 0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitReverse %uint %uint_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 95: Fold BitReverse of uint max + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitReverse %uint %uint_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0xffffffff), + // Test case 96: Fold BitReverse of 0x0000FFFF + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitReverse %uint %uint_0x0000ffff\n" + + "OpReturn\n" + "OpFunctionEnd", + 2, 0xffff0000), + // Test case 97: Fold BitReverse of OpConstNull + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitReverse %uint %111\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0) )); // clang-format on @@ -1136,6 +1356,7 @@ TEST_P(LongIntegerInstructionFoldingTest, Case) { }); } +// clang-format off INSTANTIATE_TEST_SUITE_P( TestCase, LongIntegerInstructionFoldingTest, ::testing::Values( @@ -1280,7 +1501,41 @@ INSTANTIATE_TEST_SUITE_P( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%2 = OpUConvert %ulong %short_n5\n" + "OpReturn\n" + "OpFunctionEnd", - 2, 65531ull))); + 2, 65531ull), + // Test case 16: fold SMin long 0 -1. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %long %1 SMin %long_0 %long_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -1ll), + // Test case 17: fold UMin ulong 9223372036854775809 max. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %ulong %1 UMin %ulong_9223372036854775809 %ulong_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 9223372036854775809ull), + // Test case 18: fold SMax long 0 -1. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %long %1 SMax %long_0 %long_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0ll), + // Test case 19: fold UMax ulong 9223372036854775809 max. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %ulong %1 UMax %ulong_9223372036854775809 %ulong_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 18446744073709551615ull) + )); +// clang-format on using UIntVectorInstructionFoldingTest = ::testing::TestWithParam>>; @@ -1292,6 +1547,7 @@ TEST_P(UIntVectorInstructionFoldingTest, Case) { Instruction* inst; std::tie(context, inst) = FoldInstruction(tc.test_body, tc.id_to_fold, SPV_ENV_UNIVERSAL_1_1); + CheckForExpectedVectorConstant( inst, tc.expected_result, [](const analysis::Constant* c) { return c->GetU32(); }); @@ -1304,42 +1560,59 @@ INSTANTIATE_TEST_SUITE_P(TestCase, UIntVectorInstructionFoldingTest, InstructionFoldingCase>( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + - "%n = OpVariable %_ptr_int Function\n" + - "%load = OpLoad %int %n\n" + "%2 = OpVectorShuffle %v2int %v2int_2_2 %v2int_2_3 0 3\n" + "OpReturn\n" + "OpFunctionEnd", 2, {2,3}), + // Test case 1: fold vectorshuffle of nullconstant of type vec2int InstructionFoldingCase>( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + - "%n = OpVariable %_ptr_int Function\n" + - "%load = OpLoad %int %n\n" + "%2 = OpVectorShuffle %v2int %v2int_null %v2int_2_3 0 3\n" + "OpReturn\n" + "OpFunctionEnd", 2, {0,3}), - // Test case 4: fold bit-cast int -24 to unsigned int + // Test case 2: fold bit-cast int -24 to unsigned int InstructionFoldingCase>( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + - "%n = OpVariable %_ptr_int Function\n" + - "%load = OpLoad %int %n\n" + "%2 = OpBitcast %v2uint %v2int_min_max\n" + "OpReturn\n" + "OpFunctionEnd", 2, {2147483648, 2147483647}), - // Test case 5: fold SNegate vector of uint + // Test case 3: fold bit-cast nullconstant of type vec2uint to int2 + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %v2int %v2uint_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {0, 0}), + // Test case 4: fold bit-cast if any component is nullconstant + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %v2int %v2uint_1_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {1, 0}), + // Test case 5: fold bit-cast v4ushort (0, 1, 2, 3) to v2uint + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitcast %v2uint %v4ushort_0_1_2_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {0x00010000, 0x00030002}), + // Test case 6: fold SNegate vector of uint InstructionFoldingCase>( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + - "%n = OpVariable %_ptr_int Function\n" + - "%load = OpLoad %int %n\n" + "%2 = OpSNegate %v2uint %v2uint_0x3f800000_0xbf800000\n" + "OpReturn\n" + "OpFunctionEnd", - 2, {static_cast(-0x3f800000), static_cast(-0xbf800000)}), - // Test case 6: fold vector components of uint (including integer overflow) + 2, {static_cast(-0x3f800000), static_cast(-0xbf800000ll)}), + // Test case 7: fold vector components of uint (including integer overflow) InstructionFoldingCase>( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1347,7 +1620,7 @@ INSTANTIATE_TEST_SUITE_P(TestCase, UIntVectorInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, {0x7f000000u, 0x7f000000u}), - // Test case 6: fold vector components of uint + // Test case 8: fold vector components of uint InstructionFoldingCase>( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -1355,14 +1628,38 @@ INSTANTIATE_TEST_SUITE_P(TestCase, UIntVectorInstructionFoldingTest, "OpReturn\n" + "OpFunctionEnd", 2, {2,static_cast(-5)}), - // Test case 6: fold vector components of uint (incuding integer overflow) + // Test case 9: fold vector components of uint (incuding integer overflow) InstructionFoldingCase>( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%2 = OpUConvert %v2uint %v2short_2_n5\n" + "OpReturn\n" + "OpFunctionEnd", - 2, {2,65531}) + 2, {2,65531}), + // Test case 10: fold bitreverse of a vector of uint + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitReverse %v4uint %v4uint_1_0x0000ffff_uint_0_uint_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {0x80000000, 0xffff0000, 0, 0xffffffff}), + // Test case 11: Fold bitreverse of ConstantNull of type v2uint + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitReverse %v2uint %v2uint_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {0, 0}), + // Test case 12: Fold bitreverse if any component is NullConstant + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpBitReverse %v2uint %v2uint_1_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {0x80000000, 0}) )); // clang-format on @@ -1581,7 +1878,7 @@ TEST_P(FloatVectorInstructionFoldingTest, Case) { // clang-format off INSTANTIATE_TEST_SUITE_P(TestCase, FloatVectorInstructionFoldingTest, ::testing::Values( - // Test case 0: FMix {2.0, 2.0}, {2.0, 3.0} {0.2,0.5} + // Test case 0: FMix {2.0, 3.0}, {0.0, 0.0} {0.2,0.5} InstructionFoldingCase>( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -2359,6 +2656,27 @@ TEST_P(FloatInstructionFoldingTest, Case) { }); } +using FloatBitsInstructionFoldingTest = + ::testing::TestWithParam>; + +TEST_P(FloatBitsInstructionFoldingTest, Case) { + const auto& tc = GetParam(); + + std::unique_ptr context; + Instruction* inst; + std::tie(context, inst) = + FoldInstruction(tc.test_body, tc.id_to_fold, SPV_ENV_UNIVERSAL_1_1); + + CheckForExpectedScalarConstant( + inst, tc.expected_result, [](const analysis::Constant* c) { + float f = c->AsFloatConstant()->GetFloatValue(); + uint32_t fbits{}; + static_assert(sizeof(float) == sizeof(uint32_t)); + std::memcpy(&fbits, &f, sizeof(uint32_t)); + return fbits; + }); +} + // Not testing NaNs because there are no expectations concerning NaNs according // to the "Precision and Operation of SPIR-V Instructions" section of the Vulkan // specification. @@ -2751,8 +3069,417 @@ INSTANTIATE_TEST_SUITE_P(FloatConstantFoldingTest, FloatInstructionFoldingTest, "%2 = OpFDiv %float %float_0 %float_n0\n" + "OpReturn\n" + "OpFunctionEnd", + 2, std::numeric_limits::quiet_NaN()), + // Test case 47: NMin 1.0 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMin %float_1 %float_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0f), + // Test case 48: NMin 4.0 0.2 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMin %float_4 %float_0p2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0.2f), + // Test case 49: NMin NaN 4.0 + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMin %float_nan %float_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0f), + // Test case 50: NMin 2.0 NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMin %float_2 %float_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0f), + // Test case 51: NMin NaN NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMin %float_nan %float_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, std::numeric_limits::quiet_NaN()), + // Test case 52: NMax 1.0 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMax %float_1 %float_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0f), + // Test case 53: NMax 1.0 0.2 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMax %float_1 %float_0p2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0f), + // Test case 54: NMax 1.0 NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMax %float_1 %float_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0f), + // Test case 55: NMax NaN 0.5 + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMax %float_nan %float_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0.5f), + // Test case 56: NMax NaN NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMax %float_nan %float_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, std::numeric_limits::quiet_NaN()), + // Test case 57: NClamp 1.0 0.2 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_1 %float_0p2 %float_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0f), + // Test case 58: NClamp 0.2 2.0 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_0p2 %float_2 %float_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0f), + // Test case 59: NClamp 2049.0 2.0 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_2049 %float_2 %float_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0f), + // Test case 60: NClamp 1.0 2.0 x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%undef = OpUndef %float\n" + + "%2 = OpExtInst %float %1 NClamp %float_1 %float_2 %undef\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0), + // Test case 61: NClamp 1.0 x 0.5 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%undef = OpUndef %float\n" + + "%2 = OpExtInst %float %1 NClamp %float_1 %undef %float_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0.5), + // Test case 62: NClamp NaN 2.0 4.0 + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_nan %float_2 %float_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0f), + // Test case 63: NClamp 2049.0 NaN 4.0 + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_2049 %float_nan %float_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0f), + // Test case 64: NClamp 1.0 2.0 NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_1 %float_2 %float_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0f), + // Test case 65: NClamp 4.0 NaN NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_4 %float_nan %float_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0f), + // Test case 66: NClamp NaN NaN NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_nan %float_nan %float_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", 2, std::numeric_limits::quiet_NaN()) )); + +INSTANTIATE_TEST_SUITE_P(MinMaxZeroFoldingTest, FloatBitsInstructionFoldingTest, +::testing::Values( + // Test case 0: Fold FMin 0.0 -0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FMin %float_0 %float_n0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 1: Fold FMin -0.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FMin %float_n0 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 2: Fold FMax 0.0 -0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FMax %float_0 %float_n0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 3: Fold FMax -0.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FMax %float_n0 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 4: Fold FClamp -0.0 0.0 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FClamp %float_n0 %float_0 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 5: Fold FClamp 0.0 -0.0 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FClamp %float_0 %float_n0 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 6: Fold FClamp 1.0 -0.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FClamp %float_1 %float_n0 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 7: Fold FClamp 0.0 -1.0 -0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FClamp %float_0 %float_n1 %float_n0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 8: Fold FClamp -0.0 -1.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FClamp %float_n0 %float_n1 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 9: Fold FClamp -1.0 -0.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 FClamp %float_n1 %float_n0 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 10: Fold NMin 0.0 -0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMin %float_0 %float_n0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 11: Fold NMin -0.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMin %float_n0 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 12: Fold NMax 0.0 -0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMax %float_0 %float_n0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 13: Fold NMax -0.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NMax %float_n0 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 14: Fold NClamp -0.0 0.0 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_n0 %float_0 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 15: Fold NClamp 0.0 -0.0 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_0 %float_n0 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 16: Fold NClamp 1.0 -0.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_1 %float_n0 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x00000000u), + // Test case 17: Fold NClamp 0.0 -1.0 -0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_0 %float_n1 %float_n0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 18: Fold NClamp -0.0 -1.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_n0 %float_n1 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u), + // Test case 19: Fold NClamp -1.0 -0.0 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %float %1 NClamp %float_n1 %float_n0 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0x80000000u) +)); + +INSTANTIATE_TEST_SUITE_P(RedundantDivFloatTest, FloatInstructionFoldingTest, + ::testing::Values( + // Test case 0: Fold x / x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFDiv %float %3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0), + // Test case 1: Fold -x / x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpFNegate %float %3\n" + + "%2 = OpFDiv %float %4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -1.0), + // Test case 2: Fold x / -x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpFNegate %float %3\n" + + "%2 = OpFDiv %float %3 %4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -1.0) + )); + +INSTANTIATE_TEST_SUITE_P(RedundantDivIntTest, IntegerInstructionFoldingTest, + ::testing::Values( + // Test case 0: Fold x / x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%2 = OpSDiv %int %3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1), + // Test case 1: Fold x / x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%2 = OpUDiv %uint %3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1), + // Test case 2: Fold -x / x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%4 = OpSNegate %int %3\n" + + "%2 = OpSDiv %int %4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT32_MAX), + // Test case 3: Fold x / -x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%4 = OpSNegate %int %3\n" + + "%2 = OpSDiv %int %3 %4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT32_MAX) + )); + // clang-format on using DoubleInstructionFoldingTest = @@ -3001,6 +3728,168 @@ INSTANTIATE_TEST_SUITE_P(DoubleConstantFoldingTest, DoubleInstructionFoldingTest "%2 = OpFDiv %double %double_0 %double_n0\n" + "OpReturn\n" + "OpFunctionEnd", + 2, std::numeric_limits::quiet_NaN()), + // Test case 27: NMin 1.0 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMin %double_1 %double_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0), + // Test case 28: NMin 4.0 0.2 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMin %double_4 %double_0p2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0.2), + // Test case 29: NMax 1.0 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMax %double_1 %double_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0), + // Test case 30: NMin NaN 4.0 + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMin %double_nan %double_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0), + // Test case 31: NMin 2.0 NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMin %double_2 %double_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0), + // Test case 32: NMin NaN NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMin %double_nan %double_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, std::numeric_limits::quiet_NaN()), + // Test case 33: NMax 1.0 0.2 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMax %double_1 %double_0p2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0), + // Test case 34: NMax 1.0 NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMax %double_1 %double_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0), + // Test case 35: NMax NaN 0.5 + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMax %double_nan %double_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0.5), + // Test case 36: NMax NaN NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NMax %double_nan %double_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, std::numeric_limits::quiet_NaN()), + // Test case 37: NClamp 1.0 0.2 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NClamp %double_1 %double_0p2 %double_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0), + // Test case 38: NClamp 0.2 2.0 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NClamp %double_0p2 %double_2 %double_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0), + // Test case 39: NClamp 5.0 2.0 4.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NClamp %double_5 %double_2 %double_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0), + // Test case 40: NClamp 1.0 2.0 x + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%undef = OpUndef %double\n" + + "%2 = OpExtInst %double %1 NClamp %double_1 %double_2 %undef\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0), + // Test case 41: NClamp 1.0 x 0.5 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%undef = OpUndef %double\n" + + "%2 = OpExtInst %double %1 NClamp %double_1 %undef %double_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0.5), + // Test case 42: NClamp NaN 2.0 4.0 + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NClamp %double_nan %double_2 %double_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0), + // Test case 43: NClamp 5.0 NaN 4.0 + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NClamp %double_5 %double_nan %double_4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0), + // Test case 44: NClamp 1.0 2.0 NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NClamp %double_1 %double_2 %double_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 2.0), + // Test case 45: NClamp 4.0 NaN NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NClamp %double_4 %double_nan %double_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4.0), + // Test case 46: NClamp NaN NaN NaN + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %double %1 NClamp %double_nan %double_nan %double_nan\n" + + "OpReturn\n" + + "OpFunctionEnd", 2, std::numeric_limits::quiet_NaN()) )); // clang-format on @@ -4789,7 +5678,7 @@ INSTANTIATE_TEST_SUITE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTes "OpReturn\n" + "OpFunctionEnd", 2, 0), - // Test case 27: Don't fold OpIAdd for cooperative matrices. + // Test case 27: Don't fold OpFAdd for cooperative matrices. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -4797,7 +5686,7 @@ INSTANTIATE_TEST_SUITE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTes "OpReturn\n" + "OpFunctionEnd", 2, 0), - // Test case 28: Don't fold OpISub for cooperative matrices. + // Test case 28: Don't fold OpFSub for cooperative matrices. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -4805,7 +5694,7 @@ INSTANTIATE_TEST_SUITE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTes "OpReturn\n" + "OpFunctionEnd", 2, 0), - // Test case 29: Don't fold OpIMul for cooperative matrices. + // Test case 29: Don't fold OpFMul for cooperative matrices. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -4813,7 +5702,7 @@ INSTANTIATE_TEST_SUITE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTes "OpReturn\n" + "OpFunctionEnd", 2, 0), - // Test case 30: Don't fold OpSDiv for cooperative matrices. + // Test case 30: Don't fold OpFDiv for cooperative matrices. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + @@ -4828,7 +5717,59 @@ INSTANTIATE_TEST_SUITE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTes "%2 = OpMatrixTimesScalar %float_coop_matrix %undef_float_coop_matrix %float_3\n" + "OpReturn\n" + "OpFunctionEnd", - 2, 0) + 2, 0), + // Test case 32: Don't fold FMix half (1.0, 2.0, 0.5) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %half %1 FMix %half_1 %half_2 %half_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 33: Fold FMix half (3.0, 2.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %half %1 FMix %112 %half_2 %108\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, HALF_3_ID), + // Test case 34: Fold FMix half (3.0, 2.0, null) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %half %1 FMix %112 %half_2 %half_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, HALF_3_ID), + // Test case 35: Don't fold FMix half (1.0, 2.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpExtInst %half %1 FMix %half_1 %half_2 %half_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 36: Fold n - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFSub %float %3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, FLOAT_NULL_ID), + // Test case 37: Fold n - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%2 = OpISub %int %3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, INT_NULL_ID) )); INSTANTIATE_TEST_SUITE_P(DoubleRedundantFoldingTest, GeneralInstructionFoldingTest, @@ -5823,7 +6764,7 @@ INSTANTIATE_TEST_SUITE_P(RedundantIntegerMatching, MatchingInstructionFoldingTes "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%n = OpVariable %_ptr_int Function\n" + - "%3 = OpLoad %uint %n\n" + + "%3 = OpLoad %int %n\n" + "%2 = OpIAdd %uint %int_0 %3\n" + "OpReturn\n" + "OpFunctionEnd\n", @@ -5835,14 +6776,59 @@ INSTANTIATE_TEST_SUITE_P(RedundantIntegerMatching, MatchingInstructionFoldingTes "; CHECK: %2 = OpBitcast [[int]] %3\n" + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + - "%n = OpVariable %_ptr_int Function\n" + - "%3 = OpLoad %int %n\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + "%2 = OpIAdd %int %uint_0 %3\n" + "OpReturn\n" + "OpFunctionEnd\n", 2, true) )); +INSTANTIATE_TEST_SUITE_P(RedundantBitcastTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: uint32 x; asuint32(x) => x + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: %2 = OpCopyObject [[uint]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%2 = OpBitcast %uint %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 2, true), + // Test case 1: uint32 x; asuint32(asint32(x)) => x + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: %2 = OpCopyObject [[uint]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%4 = OpBitcast %int %3\n" + + "%2 = OpBitcast %uint %4\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 2, true), + // Test case 2: float32 x; asuint32(asint32(x)) => asuint32(x) + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: %2 = OpBitcast [[uint]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpBitcast %int %3\n" + + "%2 = OpBitcast %uint %4\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 2, true) + )); + INSTANTIATE_TEST_SUITE_P(MergeNegateTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: fold consecutive fnegate @@ -6368,6 +7354,221 @@ INSTANTIATE_TEST_SUITE_P(MergeNegateTest, MatchingInstructionFoldingTest, 4, false) )); +INSTANTIATE_TEST_SUITE_P(ReassociateCommutiveBitwiseTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold (n ^ 248) ^ 31 = n ^ 231 + InstructionFoldingCase( + Header() + + "%uint_248 = OpConstant %uint 248\n" + + "%uint_31 = OpConstant %uint 31\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_231:%\\w+]] = OpConstant [[uint]] 231\n" + + "; CHECK: %2 = OpBitwiseXor [[uint]] %4 [[uint_231]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_248\n" + + "%2 = OpBitwiseXor %uint %3 %uint_31\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 1: fold 31 ^ (n ^ 248) = n ^ 231 + InstructionFoldingCase( + Header() + + "%uint_248 = OpConstant %uint 248\n" + + "%uint_31 = OpConstant %uint 31\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_231:%\\w+]] = OpConstant [[uint]] 231\n" + + "; CHECK: %2 = OpBitwiseXor [[uint]] %4 [[uint_231]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_248\n" + + "%2 = OpBitwiseXor %uint %uint_31 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 2: fold (248 ^ n) ^ 31 = n ^ 231 + InstructionFoldingCase( + Header() + + "%uint_248 = OpConstant %uint 248\n" + + "%uint_31 = OpConstant %uint 31\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_231:%\\w+]] = OpConstant [[uint]] 231\n" + + "; CHECK: %2 = OpBitwiseXor [[uint]] %4 [[uint_231]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %uint_248 %4\n" + + "%2 = OpBitwiseXor %uint %3 %uint_31\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 3: fold 31 ^ (248 ^ n) = n ^ 231 + InstructionFoldingCase( + Header() + + "%uint_248 = OpConstant %uint 248\n" + + "%uint_31 = OpConstant %uint 31\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_231:%\\w+]] = OpConstant [[uint]] 231\n" + + "; CHECK: %2 = OpBitwiseXor [[uint]] %4 [[uint_231]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %uint_248 %4\n" + + "%2 = OpBitwiseXor %uint %uint_31 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 4: fold 3 | (n | 193) = n | 195 + InstructionFoldingCase( + Header() + + "%uint_193 = OpConstant %uint 193\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_195:%\\w+]] = OpConstant [[uint]] 195\n" + + "; CHECK: %2 = OpBitwiseOr [[uint]] %4 [[uint_195]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_193\n" + + "%2 = OpBitwiseOr %uint %uint_3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 5: fold (n | 193) | 3 = n | 195 + InstructionFoldingCase( + Header() + + "%uint_193 = OpConstant %uint 193\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_195:%\\w+]] = OpConstant [[uint]] 195\n" + + "; CHECK: %2 = OpBitwiseOr [[uint]] %4 [[uint_195]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_193\n" + + "%2 = OpBitwiseOr %uint %3 %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 6: fold 3 | (193 | n) = n | 195 + InstructionFoldingCase( + Header() + + "%uint_193 = OpConstant %uint 193\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_195:%\\w+]] = OpConstant [[uint]] 195\n" + + "; CHECK: %2 = OpBitwiseOr [[uint]] %4 [[uint_195]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %uint_193 %4\n" + + "%2 = OpBitwiseOr %uint %uint_3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 7: fold (193 | n) | 3 = n | 195 + InstructionFoldingCase( + Header() + + "%uint_193 = OpConstant %uint 193\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_195:%\\w+]] = OpConstant [[uint]] 195\n" + + "; CHECK: %2 = OpBitwiseOr [[uint]] %4 [[uint_195]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %uint_193 %4\n" + + "%2 = OpBitwiseOr %uint %3 %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 8: fold 65520 & (n & 4095) = n & 4080 + InstructionFoldingCase( + Header() + + "%uint_65520 = OpConstant %uint 65520\n" + + "%uint_4095 = OpConstant %uint 4095\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_4080:%\\w+]] = OpConstant [[uint]] 4080\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_4080]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseAnd %uint %4 %uint_4095\n" + + "%2 = OpBitwiseAnd %uint %uint_65520 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 9: fold (n & 4095) & 65520 = n & 4080 + InstructionFoldingCase( + Header() + + "%uint_65520 = OpConstant %uint 65520\n" + + "%uint_4095 = OpConstant %uint 4095\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_4080:%\\w+]] = OpConstant [[uint]] 4080\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_4080]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseAnd %uint %4 %uint_4095\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_65520\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 10: fold 65520 & (4095 & n) = n & 4080 + InstructionFoldingCase( + Header() + + "%uint_65520 = OpConstant %uint 65520\n" + + "%uint_4095 = OpConstant %uint 4095\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_4080:%\\w+]] = OpConstant [[uint]] 4080\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_4080]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseAnd %uint %uint_4095 %4\n" + + "%2 = OpBitwiseAnd %uint %uint_65520 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 11: fold (4095 & n) & 65520 = n & 4080 + InstructionFoldingCase( + Header() + + "%uint_65520 = OpConstant %uint 65520\n" + + "%uint_4095 = OpConstant %uint 4095\n" + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_4080:%\\w+]] = OpConstant [[uint]] 4080\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_4080]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseAnd %uint %uint_4095 %4\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_65520\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); + INSTANTIATE_TEST_SUITE_P(ReciprocalFDivTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: scalar reicprocal @@ -6964,6 +8165,103 @@ INSTANTIATE_TEST_SUITE_P(MergeMulTest, MatchingInstructionFoldingTest, "%4 = OpIMul %long %3 %long_10\n" + "OpReturn\n" + "OpFunctionEnd\n", + 4, true), + // Test case 31: merge fmul with two negatives + // (-x) * (-y) = x * y + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFMul [[float]] [[x]] [[y]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%x = OpLoad %float %var\n" + + "%y = OpLoad %float %var\n" + + "%nx = OpFNegate %float %x\n" + + "%ny = OpFNegate %float %y\n" + + "%4 = OpFMul %float %nx %ny\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 32: merge OpVectorTimesScalar with two negatives + // (-x) * (-y) = x * y + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float2:%\\w+]] = OpTypeVector [[float]] 2\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[float2]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpVectorTimesScalar [[float2]] [[x]] [[y]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var_f2 = OpVariable %_ptr_v2float Function\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%x = OpLoad %v2float %var_f2\n" + + "%y = OpLoad %float %var\n" + + "%nx = OpFNegate %v2float %x\n" + + "%ny = OpFNegate %float %y\n" + + "%4 = OpVectorTimesScalar %v2float %nx %ny\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 33: merge smul with two negatives + // (-x) * (-y) = x * y + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpIMul [[long]] [[x]] [[y]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%x = OpLoad %long %var\n" + + "%y = OpLoad %long %var\n" + + "%nx = OpSNegate %long %x\n" + + "%ny = OpSNegate %long %y\n" + + "%4 = OpIMul %long %nx %ny\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 34: merge fdiv with two negatives + // (-x) / (-y) = x / y + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFDiv [[float]] [[x]] [[y]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%x = OpLoad %float %var\n" + + "%y = OpLoad %float %var\n" + + "%nx = OpFNegate %float %x\n" + + "%ny = OpFNegate %float %y\n" + + "%4 = OpFDiv %float %nx %ny\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 35: merge sdiv with two negatives + // (-x) / (-y) = x / y + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpSDiv [[long]] [[x]] [[y]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%x = OpLoad %long %var\n" + + "%y = OpLoad %long %var\n" + + "%nx = OpSNegate %long %x\n" + + "%ny = OpSNegate %long %y\n" + + "%4 = OpSDiv %long %nx %ny\n" + + "OpReturn\n" + + "OpFunctionEnd\n", 4, true) )); @@ -7231,73 +8529,970 @@ INSTANTIATE_TEST_SUITE_P(MergeDivTest, MatchingInstructionFoldingTest, 4, false) )); +INSTANTIATE_TEST_SUITE_P(RedundantAndOrXorTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: Fold + // 1 & (n | 2) = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_2\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 1: Fold + // 1 & (2 | n) = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %uint_2 %4\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 2: Fold + // (n | 2) & 1 = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_2\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 3: Fold + // (2 | n) & 1 = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %uint_2 %4\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 4: Fold + // 1 & (n | 3) = 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpCopyObject [[uint]] [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_3\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 5: Fold + // 1 & (3 | n) = 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpCopyObject [[uint]] [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %uint_3 %4\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 6: Fold + // (n | 3) & 1 = 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpCopyObject [[uint]] [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_3\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 7: Fold + // (3 | n) & 1 = 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpCopyObject [[uint]] [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %uint_3 %4\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 8: Do not fold + // 3 & (n | 1) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %uint_3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 9: Do not fold + // 3 & (1 | n) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %uint_1 %4\n" + + "%2 = OpBitwiseAnd %uint %uint_3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 10: Do not fold + // (n | 1) & 3 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 11: Do not fold + // (1 | n) & 3 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %uint_1 %4\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 12: Fold + // 1 & (n ^ 2) = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_2\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 13: Fold + // 1 & (2 ^ n) = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %uint_2 %4\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 14: Fold + // (n ^ 2) & 1 = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_2\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 15: Fold + // (2 ^ n) & 1 = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %uint_2 %4\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 16: Do not fold + // 1 & (n ^ 3) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_3\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 17: Do not fold + // 1 & (3 ^ n) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %uint_3 %4\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 18: Do not fold + // (n ^ 3) & 1 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_3\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 19: Do not fold + // (3 ^ n) & 1 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %uint_3 %4\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 20: Fold + // 0b101 & (n | 0b10101) = 0b101 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_5:%\\w+]] = OpConstant [[uint]] 5\n" + + "; CHECK: %2 = OpCopyObject [[uint]] [[uint_5]]\n" + + "%uint_5 = OpConstant %uint 5\n" + + "%uint_21 = OpConstant %uint 21\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_21\n" + + "%2 = OpBitwiseAnd %uint %uint_5 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 21: Do not fold + // 0b101 & (n ^ 0b10101) + InstructionFoldingCase( + Header() + + "%uint_5 = OpConstant %uint 5\n" + + "%uint_21 = OpConstant %uint 21\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_21\n" + + "%2 = OpBitwiseAnd %uint %uint_5 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 22: Fold + // 0b101 & (n ^ 0b1010) = n & 0b101 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_5:%\\w+]] = OpConstant [[uint]] 5\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_5]]\n" + + "%uint_5 = OpConstant %uint 5\n" + + "%uint_10 = OpConstant %uint 10\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_10\n" + + "%2 = OpBitwiseAnd %uint %uint_5 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 23: Fold + // 0b101 & (n | 0b1010) = n & 0b101 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_5:%\\w+]] = OpConstant [[uint]] 5\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_5]]\n" + + "%uint_5 = OpConstant %uint 5\n" + + "%uint_10 = OpConstant %uint 10\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_10\n" + + "%2 = OpBitwiseAnd %uint %uint_5 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 24: Fold + // 0b11000 & (n ^ 0b00111) = n & 0b11000 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_24:%\\w+]] = OpConstant [[uint]] 24\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_24]]\n" + + "%uint_24 = OpConstant %uint 24\n" + + "%uint_7 = OpConstant %uint 7\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseXor %uint %4 %uint_7\n" + + "%2 = OpBitwiseAnd %uint %uint_24 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 25: Fold + // 0b11000 & (n | 0b00111) = n & 0b11000 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_24:%\\w+]] = OpConstant [[uint]] 24\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_24]]\n" + + "%uint_24 = OpConstant %uint 24\n" + + "%uint_7 = OpConstant %uint 7\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpBitwiseOr %uint %4 %uint_7\n" + + "%2 = OpBitwiseAnd %uint %uint_24 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) + )); + +INSTANTIATE_TEST_SUITE_P(RedundantAndAddSubTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: Fold + // 1 & (n + 2) = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %4 %uint_2\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 1: Fold + // 1 & (2 + n) = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %uint_2 %4\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 2: Fold + // (n + 2) & 1 = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %4 %uint_2\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 3: Fold + // (2 + n) & 1 = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %uint_2 %4\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 4: Fold + // 1 & (n - 2) = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpISub %uint %4 %uint_2\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 5: Do not fold + // 1 & (2 - n) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpISub %uint %uint_2 %4\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 6: Fold + // (n - 2) & 1 = n & 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_1:%\\w+]] = OpConstant [[uint]] 1\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpISub %uint %4 %uint_2\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Test case 7: Do not fold + // (2 - n) & 1 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpISub %uint %uint_2 %4\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 8: Do not fold + // 1 & (n + 1) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 9: Do not fold + // 1 & (n - 1) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpISub %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 10: Do not fold + // 2 & (n + 1) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 11: Do not fold + // 2 & (n - 1) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpISub %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 12: Do not fold + // 0b10 & (n + 0b101) + InstructionFoldingCase( + Header() + + "%uint_5 = OpConstant %uint 5\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %4 %uint_5\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + + // Test case 13: Fold + // 0b10010 & (n + 0b11100000) = n & 0b10010 + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: [[uint_18:%\\w+]] = OpConstant [[uint]] 18\n" + + "; CHECK: %2 = OpBitwiseAnd [[uint]] %4 [[uint_18]]\n" + + "%uint_18 = OpConstant %uint 18\n" + + "%uint_224 = OpConstant %uint 224\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %4 %uint_224\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_18\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + + // Testcase 14: Do not fold + // 0b10000 & (n + 0b11100001) + InstructionFoldingCase( + Header() + + "%uint_16 = OpConstant %uint 16\n" + + "%uint_225 = OpConstant %uint 225\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpIAdd %uint %4 %uint_225\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_16\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false) + )); + + INSTANTIATE_TEST_SUITE_P(RedundantAndShiftTest, GeneralInstructionFoldingTest, + ::testing::Values( + // Test case 0: Fold + // 1 & (n << 1) = 0 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftLeftLogical %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT_NULL_ID), + + // Test case 1: Fold + // (n << 1) & 1 = 0 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftLeftLogical %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT_NULL_ID), + + // Test case 2: Do not fold + // 3 & (n << 1) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftLeftLogical %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %uint_3 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + + // Test case 3: Do not fold + // (n << 1) & 3 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftLeftLogical %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + + // Test case 4: Fold + // 0x80000000 & (n >> 1) = 0 + InstructionFoldingCase( + Header() + + "%uint_2147483648 = OpConstant %uint 2147483648\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftRightLogical %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %uint_2147483648 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT_NULL_ID), + + // Test case 5: Fold + // (n >> 1) & 0x80000000 = 0 + InstructionFoldingCase( + Header() + + "%uint_2147483648 = OpConstant %uint 2147483648\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftRightLogical %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_2147483648\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT_NULL_ID), + + // Test case 6: Do not fold + // (n >> 1) & 0xc0000000 + InstructionFoldingCase( + Header() + + "%uint_3221225472 = OpConstant %uint 3221225472\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftRightLogical %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %3 %uint_3221225472\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + + // Test case 7: Do not fold + // 0xc0000000 & (n >> 1) + InstructionFoldingCase( + Header() + + "%uint_3221225472 = OpConstant %uint 3221225472\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftRightLogical %uint %4 %uint_1\n" + + "%2 = OpBitwiseAnd %uint %uint_3221225472 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + + // Test case 8: Fold + // 0b1111 & (n << 4) = 0 + InstructionFoldingCase( + Header() + + "%uint_15 = OpConstant %uint 15\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftLeftLogical %uint %4 %uint_4\n" + + "%2 = OpBitwiseAnd %uint %uint_15 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT_NULL_ID), + + // Test case 9: Fold + // 0b1000 & (n << 4) = 0 + InstructionFoldingCase( + Header() + + "%uint_8 = OpConstant %uint 8\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftLeftLogical %uint %4 %uint_4\n" + + "%2 = OpBitwiseAnd %uint %uint_8 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT_NULL_ID), + + // Test case 10: Do not fold + // 0b1111 & (n << 3) + InstructionFoldingCase( + Header() + + "%uint_15 = OpConstant %uint 15\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftLeftLogical %uint %4 %uint_3\n" + + "%2 = OpBitwiseAnd %uint %uint_15 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + + // Test case 11: Do not fold + // 0b1000 & (n << 3) + InstructionFoldingCase( + Header() + + "%uint_8 = OpConstant %uint 8\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftLeftLogical %uint %4 %uint_3\n" + + "%2 = OpBitwiseAnd %uint %uint_8 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + + // Test case 12: Fold + // 0xf0000000 & (n >> 4) = 0 + InstructionFoldingCase( + Header() + + "%uint_4026531840 = OpConstant %uint 4026531840\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftRightLogical %uint %4 %uint_4\n" + + "%2 = OpBitwiseAnd %uint %uint_4026531840 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, UINT_NULL_ID), + + // Test case 13: Do not fold + // 0xf0000000 & (n >> 3) + InstructionFoldingCase( + Header() + + "%uint_4026531840 = OpConstant %uint 4026531840\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftRightLogical %uint %4 %uint_3\n" + + "%2 = OpBitwiseAnd %uint %uint_4026531840 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + + // Test case 14: Do not fold + // 0xf0000001 & (n >> 4) + InstructionFoldingCase( + Header() + + "%uint_4026531841 = OpConstant %uint 4026531841\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%4 = OpLoad %uint %n\n" + + "%3 = OpShiftRightLogical %uint %4 %uint_4\n" + + "%2 = OpBitwiseAnd %uint %uint_4026531841 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0) + )); + INSTANTIATE_TEST_SUITE_P(MergeAddTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: merge add of negate - // (-x) + 2 = 2 - x + // (-x) + y = y - x InstructionFoldingCase( Header() + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + - "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + - "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + - "; CHECK: %4 = OpFSub [[float]] [[float_2]] [[ld]]\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[y]] [[x]]\n" + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%var = OpVariable %_ptr_float Function\n" + - "%2 = OpLoad %float %var\n" + - "%3 = OpFNegate %float %2\n" + - "%4 = OpFAdd %float %3 %float_2\n" + + "%x = OpLoad %float %var\n" + + "%y = OpLoad %float %var\n" + + "%nx = OpFNegate %float %x\n" + + "%4 = OpFAdd %float %nx %y\n" + "OpReturn\n" + "OpFunctionEnd\n", 4, true), // Test case 1: merge add of negate - // 2 + (-x) = 2 - x + // y + (-x) = y - x InstructionFoldingCase( Header() + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + - "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + - "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + - "; CHECK: %4 = OpFSub [[float]] [[float_2]] [[ld]]\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[y]] [[x]]\n" + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%var = OpVariable %_ptr_float Function\n" + - "%2 = OpLoad %float %var\n" + - "%3 = OpSNegate %float %2\n" + - "%4 = OpIAdd %float %float_2 %3\n" + + "%x = OpLoad %float %var\n" + + "%y = OpLoad %float %var\n" + + "%nx = OpFNegate %float %x\n" + + "%4 = OpFAdd %float %y %nx\n" + "OpReturn\n" + "OpFunctionEnd\n", 4, true), // Test case 2: merge add of negate - // (-x) + 2 = 2 - x + // (-x) + y = y - x InstructionFoldingCase( Header() + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + - "; CHECK: [[long_2:%\\w+]] = OpConstant [[long]] 2\n" + - "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + - "; CHECK: %4 = OpISub [[long]] [[long_2]] [[ld]]\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpISub [[long]] [[y]] [[x]]\n" + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%var = OpVariable %_ptr_long Function\n" + - "%2 = OpLoad %long %var\n" + - "%3 = OpSNegate %long %2\n" + - "%4 = OpIAdd %long %3 %long_2\n" + + "%x = OpLoad %long %var\n" + + "%y = OpLoad %long %var\n" + + "%nx = OpSNegate %long %x\n" + + "%4 = OpIAdd %long %nx %y\n" + "OpReturn\n" + "OpFunctionEnd\n", 4, true), // Test case 3: merge add of negate - // 2 + (-x) = 2 - x + // y + (-x) = y - x InstructionFoldingCase( Header() + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + - "; CHECK: [[long_2:%\\w+]] = OpConstant [[long]] 2\n" + - "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + - "; CHECK: %4 = OpISub [[long]] [[long_2]] [[ld]]\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpISub [[long]] [[y]] [[x]]\n" + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%var = OpVariable %_ptr_long Function\n" + - "%2 = OpLoad %long %var\n" + - "%3 = OpSNegate %long %2\n" + - "%4 = OpIAdd %long %long_2 %3\n" + + "%x = OpLoad %long %var\n" + + "%y = OpLoad %long %var\n" + + "%nx = OpSNegate %long %x\n" + + "%4 = OpIAdd %long %y %nx\n" + "OpReturn\n" + "OpFunctionEnd\n", 4, true), @@ -7667,6 +9862,94 @@ INSTANTIATE_TEST_SUITE_P(FactorAddMul, MatchingInstructionFoldingTest, 9, true) )); +INSTANTIATE_TEST_SUITE_P(FactorSubMul, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: factor of sub of muls + // (a * b) - (a * c) => a * (b - c) + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[newsub:%\\w+]] = OpFSub [[float]] %4 %5\n" + + "; CHECK: %9 = OpFMul [[float]] %6 [[newsub]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var0 = OpVariable %_ptr_float Function\n" + + "%var1 = OpVariable %_ptr_float Function\n" + + "%var2 = OpVariable %_ptr_float Function\n" + + "%4 = OpLoad %float %var0\n" + + "%5 = OpLoad %float %var1\n" + + "%6 = OpLoad %float %var2\n" + + "%7 = OpFMul %float %6 %4\n" + + "%8 = OpFMul %float %6 %5\n" + + "%9 = OpFSub %float %7 %8\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 9, true), + // Test case 1: factor of sub of muls + // (b * a) - (a * c) => a * (b - c) + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[newsub:%\\w+]] = OpFSub [[float]] %4 %5\n" + + "; CHECK: %9 = OpFMul [[float]] %6 [[newsub]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var0 = OpVariable %_ptr_float Function\n" + + "%var1 = OpVariable %_ptr_float Function\n" + + "%var2 = OpVariable %_ptr_float Function\n" + + "%4 = OpLoad %float %var0\n" + + "%5 = OpLoad %float %var1\n" + + "%6 = OpLoad %float %var2\n" + + "%7 = OpFMul %float %4 %6\n" + + "%8 = OpFMul %float %6 %5\n" + + "%9 = OpFSub %float %7 %8\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 9, true), + // Test case 2: factor of sub of muls + // (a * b) - (c * a) => a * (b - c) + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[newsub:%\\w+]] = OpFSub [[float]] %4 %5\n" + + "; CHECK: %9 = OpFMul [[float]] %6 [[newsub]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var0 = OpVariable %_ptr_float Function\n" + + "%var1 = OpVariable %_ptr_float Function\n" + + "%var2 = OpVariable %_ptr_float Function\n" + + "%4 = OpLoad %float %var0\n" + + "%5 = OpLoad %float %var1\n" + + "%6 = OpLoad %float %var2\n" + + "%7 = OpFMul %float %6 %4\n" + + "%8 = OpFMul %float %5 %6\n" + + "%9 = OpFSub %float %7 %8\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 9, true), + // Test case 3: factor of sub of muls + // (b * a) - (c * a) => a * (b - c) + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[newsub:%\\w+]] = OpFSub [[float]] %4 %5\n" + + "; CHECK: %9 = OpFMul [[float]] %6 [[newsub]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var0 = OpVariable %_ptr_float Function\n" + + "%var1 = OpVariable %_ptr_float Function\n" + + "%var2 = OpVariable %_ptr_float Function\n" + + "%4 = OpLoad %float %var0\n" + + "%5 = OpLoad %float %var1\n" + + "%6 = OpLoad %float %var2\n" + + "%7 = OpFMul %float %4 %6\n" + + "%8 = OpFMul %float %5 %6\n" + + "%9 = OpFSub %float %7 %8\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 9, true) +)); + INSTANTIATE_TEST_SUITE_P(MergeSubTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: merge sub of negate @@ -7687,19 +9970,20 @@ INSTANTIATE_TEST_SUITE_P(MergeSubTest, MatchingInstructionFoldingTest, "OpFunctionEnd\n", 4, true), // Test case 1: merge sub of negate - // 2 - (-x) = x + 2 + // y - (-x) = y + x InstructionFoldingCase( Header() + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + - "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + - "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + - "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_2]]\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[y]] [[x]]\n" + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%var = OpVariable %_ptr_float Function\n" + - "%2 = OpLoad %float %var\n" + - "%3 = OpFNegate %float %2\n" + - "%4 = OpFSub %float %float_2 %3\n" + + "%x = OpLoad %float %var\n" + + "%y = OpLoad %float %var\n" + + "%nx = OpFNegate %float %x\n" + + "%4 = OpFSub %float %y %nx\n" + "OpReturn\n" + "OpFunctionEnd\n", 4, true), @@ -7721,19 +10005,20 @@ INSTANTIATE_TEST_SUITE_P(MergeSubTest, MatchingInstructionFoldingTest, "OpFunctionEnd\n", 4, true), // Test case 3: merge sub of negate - // 2 - (-x) = x + 2 + // y - (-x) = y + x InstructionFoldingCase( Header() + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + - "; CHECK: [[long_2:%\\w+]] = OpConstant [[long]] 2\n" + - "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + - "; CHECK: %4 = OpIAdd [[long]] [[ld]] [[long_2]]\n" + + "; CHECK: [[x:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: [[y:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpIAdd [[long]] [[y]] [[x]]\n" + "%main = OpFunction %void None %void_func\n" + "%main_lab = OpLabel\n" + "%var = OpVariable %_ptr_long Function\n" + - "%2 = OpLoad %long %var\n" + - "%3 = OpSNegate %long %2\n" + - "%4 = OpISub %long %long_2 %3\n" + + "%x = OpLoad %long %var\n" + + "%y = OpLoad %long %var\n" + + "%nx = OpSNegate %long %x\n" + + "%4 = OpISub %long %y %nx\n" + "OpReturn\n" + "OpFunctionEnd\n", 4, true), @@ -8048,9 +10333,606 @@ INSTANTIATE_TEST_SUITE_P(SelectFoldingTest, MatchingInstructionFoldingTest, "%4 = OpSelect %v2int %v2bool_false_true %2 %3\n" + "OpReturn\n" + "OpFunctionEnd", - 4, true) + 4, true), + // Test case 7: Fold select with different type of zeros for both sides + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_null:%\\w+]] = OpConstantNull [[float]]\n" + + "; CHECK: %2 = OpCopyObject [[float]] [[float_null]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%load = OpLoad %bool %n\n" + + "%2 = OpSelect %float %load %float_null %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) )); +INSTANTIATE_TEST_SUITE_P(FoldConstantBooleanSelectTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: + // x ? true : false = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpSelect %bool %3 %true %false\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 1: + // x ? false : true = !x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpLogicalNot [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpSelect %bool %3 %false %true\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: + // x ? true : null_false = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpSelect %bool %3 %true %bool_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: + // x ? null_false : true = !x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpLogicalNot [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpSelect %bool %3 %bool_null %true\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) + )); + +INSTANTIATE_TEST_SUITE_P(RedundantLogicalAndTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: + // x && true = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpLogicalAnd %bool %3 %true\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 1: + // true && x = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpLogicalAnd %bool %true %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) + )); + +INSTANTIATE_TEST_SUITE_P(RedundantLogicalOrTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: + // x || false = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpLogicalOr %bool %3 %false\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 1: + // false || x = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpLogicalOr %bool %false %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: + // x || null_false = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpLogicalOr %bool %3 %bool_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: + // null_false || x = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%2 = OpLogicalOr %bool %bool_null %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) + )); + +INSTANTIATE_TEST_SUITE_P(RedundantLogicalNotTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: + // !!x = x + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpCopyObject [[bool]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%4 = OpLogicalNot %bool %3\n" + + "%2 = OpLogicalNot %bool %4\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) + )); + +INSTANTIATE_TEST_SUITE_P(FoldLogicalNotComparisonTest, MatchingInstructionFoldingTest, + ::testing::Values( + // Test case 0: + // !(a == b) = (a != b) [OpIEqual => OpINotEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpINotEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%4 = OpLoad %int %m\n" + + "%5 = OpIEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 1: + // !(a != b) = (a == b) [OpINotEqual => OpIEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpIEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%4 = OpLoad %int %m\n" + + "%5 = OpINotEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: + // !(a == b) = (a != b) [OpFOrdEqual => OpFUnordNotEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFUnordNotEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFOrdEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: + // !(a != b) = (a == b) [OpFUnordNotEqual => OpFOrdEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFOrdEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFUnordNotEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 4: + // !(a == b) = (a != b) [OpFUnordEqual => OpFOrdNotEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFOrdNotEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFUnordEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 5: + // !(a != b) = (a == b) [OpFOrdNotEqual => OpFUnordEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFUnordEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFOrdNotEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 6: + // !(a == b) = (a != b) [OpLogicalEqual => OpLogicalNotEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpLogicalNotEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%m = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%4 = OpLoad %bool %m\n" + + "%5 = OpLogicalEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 7: + // !(a != b) = (a == b) [OpLogicalNotEqual => OpLogicalEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpLogicalEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%m = OpVariable %_ptr_bool Function\n" + + "%3 = OpLoad %bool %n\n" + + "%4 = OpLoad %bool %m\n" + + "%5 = OpLogicalNotEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 8: + // !(a > b) = (a <= b) [OpUGreaterThan => OpULessThanEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpULessThanEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%4 = OpLoad %uint %m\n" + + "%5 = OpUGreaterThan %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 9: + // !(a <= b) = (a > b) [OpULessThanEqual => OpUGreaterThan] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpUGreaterThan [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%4 = OpLoad %uint %m\n" + + "%5 = OpULessThanEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 10: + // !(a > b) = (a <= b) [OpSGreaterThan => OpSLessThanEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpSLessThanEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%4 = OpLoad %int %m\n" + + "%5 = OpSGreaterThan %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 11: + // !(a <= b) = (a > b) [OpSLessThanEqual => OpSGreaterThan] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpSGreaterThan [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%4 = OpLoad %int %m\n" + + "%5 = OpSLessThanEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 12: + // !(a > b) = (a <= b) [OpFOrdGreaterThan => OpFUnordLessThanEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFUnordLessThanEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFOrdGreaterThan %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 13: + // !(a <= b) = (a > b) [OpFUnordLessThanEqual => OpFOrdGreaterThan] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFOrdGreaterThan [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFUnordLessThanEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 14: + // !(a > b) = (a <= b) [OpFUnordGreaterThan => OpFOrdLessThanEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFOrdLessThanEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFUnordGreaterThan %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 15: + // !(a <= b) = (a > b) [OpFOrdLessThanEqual => OpFUnordGreaterThan] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFUnordGreaterThan [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFOrdLessThanEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 16: + // !(a < b) = (a >= b) [OpULessThan => OpUGreaterThanEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpUGreaterThanEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%4 = OpLoad %uint %m\n" + + "%5 = OpULessThan %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 17: + // !(a >= b) = (a < b) [OpUGreaterThanEqual => OpULessThan] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpULessThan [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%4 = OpLoad %uint %m\n" + + "%5 = OpUGreaterThanEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 18: + // !(a < b) = (a >= b) [OpSLessThan => OpSGreaterThanEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpSGreaterThanEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%4 = OpLoad %int %m\n" + + "%5 = OpSLessThan %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 19: + // !(a >= b) = (a < b) [OpSGreaterThanEqual => OpSLessThan] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpSLessThan [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%4 = OpLoad %int %m\n" + + "%5 = OpSGreaterThanEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 20: + // !(a < b) = (a >= b) [OpFOrdLessThan => OpFUnordGreaterThanEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFUnordGreaterThanEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFOrdLessThan %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 21: + // !(a >= b) = (a < b) [OpFUnordGreaterThanEqual => OpFOrdLessThan] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFOrdLessThan [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFUnordGreaterThanEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 22: + // !(a < b) = (a >= b) [OpFUnordLessThan => OpFOrdGreaterThanEqual] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFOrdGreaterThanEqual [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFUnordLessThan %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 23: + // !(a >= b) = (a < b) [OpFOrdGreaterThanEqual => OpFUnordLessThan] + InstructionFoldingCase( + Header() + + "; CHECK: [[bool:%\\w+]] = OpTypeBool\n" + + "; CHECK: %2 = OpFUnordLessThan [[bool]] %3 %4\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%m = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%4 = OpLoad %float %m\n" + + "%5 = OpFOrdGreaterThanEqual %bool %3 %4\n" + + "%2 = OpLogicalNot %bool %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) + )); + INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: Extracting from result of consecutive shuffles of differing @@ -8177,7 +11059,22 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 5, false), - // Test case 7: Extracting the undefined literal value from a vector + // Test case 7: Don't fold: Using fmix feeding extract with half type in + // the a position. + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%m = OpVariable %_ptr_v4half Function\n" + + "%n = OpVariable %_ptr_v4half Function\n" + + "%2 = OpLoad %v4half %m\n" + + "%3 = OpLoad %v4half %n\n" + + "%4 = OpExtInst %v4half %1 FMix %2 %3 %v4half_0_1_0_0\n" + + "%5 = OpCompositeExtract %half %4 0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, false), + // Test case 8: Extracting the undefined literal value from a vector // shuffle. InstructionFoldingCase( Header() + @@ -8192,7 +11089,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 4, true), - // Test case 8: Inserting every element of a vector turns into a composite construct. + // Test case 9: Inserting every element of a vector turns into a composite construct. InstructionFoldingCase( Header() + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + @@ -8211,7 +11108,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 5, true), - // Test case 9: Inserting every element of a vector turns into a composite construct in a different order. + // Test case 10: Inserting every element of a vector turns into a composite construct in a different order. InstructionFoldingCase( Header() + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + @@ -8230,7 +11127,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 5, true), - // Test case 10: Check multiple inserts to the same position are handled correctly. + // Test case 11: Check multiple inserts to the same position are handled correctly. InstructionFoldingCase( Header() + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + @@ -8250,7 +11147,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 6, true), - // Test case 11: The last indexes are 0 and 1, but they have different first indexes. This should not be folded. + // Test case 12: The last indexes are 0 and 1, but they have different first indexes. This should not be folded. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + @@ -8260,7 +11157,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 3, false), - // Test case 12: Don't fold when there is a partial insertion. + // Test case 13: Don't fold when there is a partial insertion. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + @@ -8271,7 +11168,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 4, false), - // Test case 13: Insert into a column of a matrix + // Test case 14: Insert into a column of a matrix InstructionFoldingCase( Header() + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + @@ -8290,7 +11187,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 3, true), - // Test case 14: Insert all elements of the matrix. + // Test case 15: Insert all elements of the matrix. InstructionFoldingCase( Header() + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + @@ -8313,7 +11210,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 5, true), - // Test case 15: Replace construct with extract when reconstructing a member + // Test case 16: Replace construct with extract when reconstructing a member // of another object. InstructionFoldingCase( Header() + @@ -8330,7 +11227,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 5, true), - // Test case 16: Don't fold when type cannot be deduced to a constant. + // Test case 17: Don't fold when type cannot be deduced to a constant. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + @@ -8339,7 +11236,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 4, false), - // Test case 17: Don't fold when index into composite is out of bounds. + // Test case 18: Don't fold when index into composite is out of bounds. InstructionFoldingCase( Header() + "%main = OpFunction %void None %void_func\n" + @@ -8348,7 +11245,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 4, false), - // Test case 18: Fold when every element of an array is inserted. + // Test case 19: Fold when every element of an array is inserted. InstructionFoldingCase( Header() + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + @@ -8365,7 +11262,7 @@ INSTANTIATE_TEST_SUITE_P(CompositeExtractOrInsertMatchingTest, MatchingInstructi "OpReturn\n" + "OpFunctionEnd", 5, true), - // Test case 19: Don't fold for isomorphic structs + // Test case 20: Don't fold for isomorphic structs InstructionFoldingCase( Header() + "%structA = OpTypeStruct %ulong\n" + diff --git a/third_party/spirv-tools/test/opt/graphics_robust_access_test.cpp b/third_party/spirv-tools/test/opt/graphics_robust_access_test.cpp index a1a3b7d3fd..20fb7e30ff 100644 --- a/third_party/spirv-tools/test/opt/graphics_robust_access_test.cpp +++ b/third_party/spirv-tools/test/opt/graphics_robust_access_test.cpp @@ -110,6 +110,7 @@ std::string ShaderPreamble() { OpCapability Shader OpMemoryModel Logical Simple OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 16 1 1 )"; } @@ -228,6 +229,7 @@ std::string ACCheckFail(const std::string& access_chain_inst, // TODO(dneto): RuntimeArray TEST_F(GraphicsRobustAccessTest, ACVectorLeastInboundConstantUntouched) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() << R"( @@ -244,6 +246,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorLeastInboundConstantUntouched) { } TEST_F(GraphicsRobustAccessTest, ACVectorMostInboundConstantUntouched) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() << R"( @@ -260,6 +263,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorMostInboundConstantUntouched) { } TEST_F(GraphicsRobustAccessTest, ACVectorExcessConstantClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() << R"( @@ -276,6 +280,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorExcessConstantClamped) { } TEST_F(GraphicsRobustAccessTest, ACVectorNegativeConstantClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() << R"( @@ -295,6 +300,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorNegativeConstantClamped) { // Like the previous test, but ensures the pass knows how to modify an index // which does not come first in the access chain. TEST_F(GraphicsRobustAccessTest, ACVectorInArrayNegativeConstantClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() << R"( @@ -315,6 +321,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorInArrayNegativeConstantClamped) { } TEST_F(GraphicsRobustAccessTest, ACVectorGeneralClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"i"}) << TypesVoid() << TypesInt() << R"( @@ -335,6 +342,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorGeneralClamped) { } TEST_F(GraphicsRobustAccessTest, ACVectorGeneralShortClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Show that signed 16 bit integers are clamped as well. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -360,6 +368,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorGeneralShortClamped) { } TEST_F(GraphicsRobustAccessTest, ACVectorGeneralUShortClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Show that unsigned 16 bit integers are clamped as well. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -385,6 +394,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorGeneralUShortClamped) { } TEST_F(GraphicsRobustAccessTest, ACVectorGeneralLongClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Show that signed 64 bit integers are clamped as well. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -410,6 +420,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorGeneralLongClamped) { } TEST_F(GraphicsRobustAccessTest, ACVectorGeneralULongClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Show that unsigned 64 bit integers are clamped as well. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -435,6 +446,7 @@ TEST_F(GraphicsRobustAccessTest, ACVectorGeneralULongClamped) { } TEST_F(GraphicsRobustAccessTest, ACMatrixLeastInboundConstantUntouched) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() @@ -454,6 +466,7 @@ TEST_F(GraphicsRobustAccessTest, ACMatrixLeastInboundConstantUntouched) { } TEST_F(GraphicsRobustAccessTest, ACMatrixMostInboundConstantUntouched) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() @@ -473,6 +486,7 @@ TEST_F(GraphicsRobustAccessTest, ACMatrixMostInboundConstantUntouched) { } TEST_F(GraphicsRobustAccessTest, ACMatrixExcessConstantClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() @@ -492,6 +506,7 @@ TEST_F(GraphicsRobustAccessTest, ACMatrixExcessConstantClamped) { } TEST_F(GraphicsRobustAccessTest, ACMatrixNegativeConstantClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() @@ -511,6 +526,7 @@ TEST_F(GraphicsRobustAccessTest, ACMatrixNegativeConstantClamped) { } TEST_F(GraphicsRobustAccessTest, ACMatrixGeneralClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"i"}) << TypesVoid() << TypesInt() @@ -534,6 +550,7 @@ TEST_F(GraphicsRobustAccessTest, ACMatrixGeneralClamped) { } TEST_F(GraphicsRobustAccessTest, ACArrayLeastInboundConstantUntouched) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() @@ -551,6 +568,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayLeastInboundConstantUntouched) { } TEST_F(GraphicsRobustAccessTest, ACArrayMostInboundConstantUntouched) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() @@ -568,6 +586,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayMostInboundConstantUntouched) { } TEST_F(GraphicsRobustAccessTest, ACArrayGeneralClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"i"}) << TypesVoid() << TypesInt() @@ -590,6 +609,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayGeneralClamped) { } TEST_F(GraphicsRobustAccessTest, ACArrayGeneralShortIndexUIntBoundsClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Index is signed short, array bounds overflows the index type. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -615,6 +635,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayGeneralShortIndexUIntBoundsClamped) { } TEST_F(GraphicsRobustAccessTest, ACArrayGeneralUShortIndexIntBoundsClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Index is unsigned short, array bounds overflows the index type. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -640,6 +661,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayGeneralUShortIndexIntBoundsClamped) { } TEST_F(GraphicsRobustAccessTest, ACArrayGeneralUIntIndexShortBoundsClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Signed int index i is wider than the array bounds type. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -664,6 +686,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayGeneralUIntIndexShortBoundsClamped) { } TEST_F(GraphicsRobustAccessTest, ACArrayGeneralIntIndexUShortBoundsClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Unsigned int index i is wider than the array bounds type. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -688,6 +711,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayGeneralIntIndexUShortBoundsClamped) { } TEST_F(GraphicsRobustAccessTest, ACArrayGeneralLongIndexUIntBoundsClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Signed long index i is wider than the array bounds type. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -712,6 +736,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayGeneralLongIndexUIntBoundsClamped) { } TEST_F(GraphicsRobustAccessTest, ACArrayGeneralULongIndexIntBoundsClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Unsigned long index i is wider than the array bounds type. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -737,6 +762,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayGeneralULongIndexIntBoundsClamped) { TEST_F(GraphicsRobustAccessTest, ACArrayGeneralShortIndeArrayBiggerThanShortMaxClipsToShortIntMax) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << "OpCapability Int16\n" @@ -761,6 +787,7 @@ TEST_F(GraphicsRobustAccessTest, TEST_F(GraphicsRobustAccessTest, ACArrayGeneralIntIndexArrayBiggerThanIntMaxClipsToSignedIntMax) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"i"}) << TypesVoid() << TypesInt() @@ -784,6 +811,7 @@ TEST_F(GraphicsRobustAccessTest, TEST_F(GraphicsRobustAccessTest, ACArrayGeneralLongIndexArrayBiggerThanLongMaxClipsToSignedLongMax) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << "OpCapability Int64\n" @@ -811,6 +839,7 @@ TEST_F(GraphicsRobustAccessTest, } TEST_F(GraphicsRobustAccessTest, ACArraySpecIdSizedAlwaysClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"spec200"}) << R"( @@ -837,6 +866,7 @@ TEST_F(GraphicsRobustAccessTest, ACArraySpecIdSizedAlwaysClamped) { } TEST_F(GraphicsRobustAccessTest, ACStructLeastUntouched) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() @@ -853,6 +883,7 @@ TEST_F(GraphicsRobustAccessTest, ACStructLeastUntouched) { } TEST_F(GraphicsRobustAccessTest, ACStructMostUntouched) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << TypesVoid() << TypesInt() @@ -869,6 +900,7 @@ TEST_F(GraphicsRobustAccessTest, ACStructMostUntouched) { } TEST_F(GraphicsRobustAccessTest, ACStructSpecConstantFail) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"struct", "spec200"}) @@ -891,6 +923,7 @@ TEST_F(GraphicsRobustAccessTest, ACStructSpecConstantFail) { } TEST_F(GraphicsRobustAccessTest, ACStructFloatConstantFail) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"struct"}) << @@ -911,6 +944,7 @@ TEST_F(GraphicsRobustAccessTest, ACStructFloatConstantFail) { } TEST_F(GraphicsRobustAccessTest, ACStructNonConstantFail) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"struct", "i"}) << @@ -932,6 +966,7 @@ TEST_F(GraphicsRobustAccessTest, ACStructNonConstantFail) { } TEST_F(GraphicsRobustAccessTest, ACStructExcessFail) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"struct", "i"}) << TypesVoid() << TypesInt() @@ -951,6 +986,7 @@ TEST_F(GraphicsRobustAccessTest, ACStructExcessFail) { } TEST_F(GraphicsRobustAccessTest, ACStructNegativeFail) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"struct", "i"}) << TypesVoid() << TypesInt() @@ -970,6 +1006,7 @@ TEST_F(GraphicsRobustAccessTest, ACStructNegativeFail) { } TEST_F(GraphicsRobustAccessTest, ACRTArrayLeastInboundClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC() << "OpDecorate %rtarr ArrayStride 4 " @@ -997,6 +1034,7 @@ TEST_F(GraphicsRobustAccessTest, ACRTArrayLeastInboundClamped) { } TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralShortIndexClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << "OpCapability Int16\n" @@ -1028,6 +1066,7 @@ TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralShortIndexClamped) { } TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralUShortIndexClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << "OpCapability Int16\n" @@ -1059,6 +1098,7 @@ TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralUShortIndexClamped) { } TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralIntIndexClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"i"}) << "OpDecorate %rtarr ArrayStride 4 " @@ -1087,6 +1127,7 @@ TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralIntIndexClamped) { } TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralUIntIndexClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << ShaderPreambleAC({"i"}) << "OpDecorate %rtarr ArrayStride 4 " @@ -1115,6 +1156,7 @@ TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralUIntIndexClamped) { } TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralLongIndexClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << "OpCapability Int64" << ShaderPreambleAC({"i"}) @@ -1144,6 +1186,7 @@ TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralLongIndexClamped) { } TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralULongIndexClamped) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); for (auto* ac : AccessChains()) { std::ostringstream shaders; shaders << "OpCapability Int64" << ShaderPreambleAC({"i"}) @@ -1173,6 +1216,7 @@ TEST_F(GraphicsRobustAccessTest, ACRTArrayGeneralULongIndexClamped) { } TEST_F(GraphicsRobustAccessTest, ACRTArrayStructVectorElem) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // The point of this test is that the access chain can have indices past the // index into the runtime array. For good measure, the index into the final // struct is out of bounds. We have to clamp that index too. @@ -1213,6 +1257,7 @@ TEST_F(GraphicsRobustAccessTest, ACRTArrayStructVectorElem) { } TEST_F(GraphicsRobustAccessTest, ACArrayRTArrayStructVectorElem) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Now add an additional level of arrays around the Block-decorated struct. for (auto* ac : AccessChains()) { std::ostringstream shaders; @@ -1257,6 +1302,7 @@ TEST_F(GraphicsRobustAccessTest, ACArrayRTArrayStructVectorElem) { } TEST_F(GraphicsRobustAccessTest, ACSplitACArrayRTArrayStructVectorElem) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Split the address calculation across two access chains. Force // the transform to walk up the access chains to find the base variable. for (auto* ac : AccessChains()) { @@ -1318,6 +1364,7 @@ TEST_F(GraphicsRobustAccessTest, ACSplitACArrayRTArrayStructVectorElem) { TEST_F(GraphicsRobustAccessTest, ACSplitACArrayRTArrayStructVectorElemAcrossBasicBlocks) { + SetTargetEnv(SPV_ENV_VULKAN_1_0); // Split the address calculation across two access chains. Force // the transform to walk up the access chains to find the base variable. // This time, put the different access chains in different basic blocks. diff --git a/third_party/spirv-tools/test/opt/ir_loader_test.cpp b/third_party/spirv-tools/test/opt/ir_loader_test.cpp index 769a25dd6c..6e0aa414a2 100644 --- a/third_party/spirv-tools/test/opt/ir_loader_test.cpp +++ b/third_party/spirv-tools/test/opt/ir_loader_test.cpp @@ -1523,6 +1523,74 @@ TEST(IrBuilder, UniqueIds) { }); } +TEST(IrBuilder, RoundTripSimpleGraphWithBody) { + DoRoundTripCheck(R"(OpCapability Shader +OpCapability TensorsARM +OpCapability GraphARM +OpExtension "SPV_ARM_tensors" +OpExtension "SPV_ARM_graph" +%1 = OpExtInstImport "TOSA.001000.1" +OpMemoryModel Logical GLSL450 +OpDecorate %2 DescriptorSet 0 +OpDecorate %2 Binding 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_5 = OpConstant %uint 5 +%uint_10 = OpConstant %uint 10 +%float_0 = OpConstant %float 0 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 +%_arr_uint_uint_4 = OpTypeArray %uint %uint_4 +%16 = OpConstantComposite %_arr_uint_uint_1 %uint_1 +%17 = OpConstantComposite %_arr_uint_uint_1 %uint_2 +%18 = OpConstantComposite %_arr_uint_uint_1 %uint_4 +%19 = OpConstantComposite %_arr_uint_uint_4 %uint_1 %uint_10 %uint_10 %uint_3 +%20 = OpConstantComposite %_arr_uint_uint_4 %uint_1 %uint_5 %uint_5 %uint_3 +%21 = OpTypeTensorARM %float %uint_1 %16 +%22 = OpTypeTensorARM %uint %uint_1 %17 +%23 = OpTypeTensorARM %uint %uint_1 %18 +%24 = OpTypeTensorARM %float %uint_4 %19 +%25 = OpTypeTensorARM %float %uint_4 %20 +%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 +%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25 +%28 = OpConstantComposite %23 %uint_3 %uint_3 +%29 = OpConstantComposite %23 %uint_2 %uint_2 +%30 = OpConstantComposite %24 %uint_0 %uint_0 %uint_0 %uint_0 +%31 = OpConstantComposite %22 %float_0 +%32 = OpTypeGraphARM 1 %24 %25 +%2 = OpVariable %_ptr_UniformConstant_24 UniformConstant +%3 = OpVariable %_ptr_UniformConstant_25 UniformConstant +OpGraphEntryPointARM %33 "main" %2 %3 +%33 = OpGraphARM %32 +%34 = OpGraphInputARM %24 %uint_0 +%35 = OpExtInst %25 %1 AVG_POOL2D %28 %29 %30 %uint_2 %34 %31 %31 +OpGraphSetOutputARM %35 %uint_0 +OpGraphEndARM +)"); +} + +TEST(IrBuilder, GraphInsideGraph) { + DoErrorMessageCheck("%2 = OpGraphARM %1\n%3 = OpGraphARM %2", + "graph inside graph", 2); +} + +TEST(IrBuilder, GraphEndOutsideOfGraph) { + DoErrorMessageCheck("OpGraphEndARM\n", + "OpGraphEndARM without corresponding OpGraphARM", 1); +} + +TEST(IrBuilder, GraphUnhandledInstruction) { + DoErrorMessageCheck( + "%2 = OpGraphARM %1\n%3 = OpGraphInputARM %4 %5\nOpNop\nOpGraphEndARM", + "unhandled instruction (opcode 0) inside graph", 3); +} + } // namespace } // namespace opt } // namespace spvtools diff --git a/third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp b/third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp index b35f3a3f86..8b1231446d 100644 --- a/third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp +++ b/third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp @@ -1344,6 +1344,7 @@ OpReturn OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndCheck(assembly, assembly, false, true); } diff --git a/third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp b/third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp index 810d98596c..4ea09262f0 100644 --- a/third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp @@ -4225,6 +4225,7 @@ TEST_F(LocalSSAElimTest, PointerVariables) { OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; SinglePassRunAndMatch(text, true); } diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp index ef7daeeaeb..cda72a0f63 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp @@ -3415,7 +3415,8 @@ TEST_F(FusionLegalTest, DifferentArraysInLoopsNoPreheader) { EXPECT_FALSE(fusion.AreCompatible()); } - ld.CreatePreHeaderBlocksIfMissing(); + auto status = ld.CreatePreHeaderBlocksIfMissing(); + EXPECT_NE(status, LoopDescriptor::Status::Failure); { LoopFusion fusion(context.get(), loops[0], loops[1]); @@ -3588,7 +3589,8 @@ TEST_F(FusionLegalTest, AdjacentLoopsNoPreheaders) { EXPECT_FALSE(fusion.AreCompatible()); } - ld.CreatePreHeaderBlocksIfMissing(); + auto status = ld.CreatePreHeaderBlocksIfMissing(); + EXPECT_NE(status, LoopDescriptor::Status::Failure); { LoopFusion fusion(context.get(), loops[0], loops[1]); diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp index 6214902ae3..256b48718e 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp @@ -3864,6 +3864,81 @@ OpFunctionEnd SinglePassRunAndCheck(text, text, false); } +TEST_F(PassClassTest, ApplyDecorationsToClonedInstructions) { + const std::string text = R"( + ; CHECK: OpDecorate [[ld1:%\w+]] RelaxedPrecision + ; CHECK: OpDecorate [[mul1:%\w+]] RelaxedPrecision + ; CHECK: OpDecorate [[add1:%\w+]] RelaxedPrecision + ; CHECK: OpDecorate [[ld2:%\w+]] RelaxedPrecision + ; CHECK: OpDecorate [[mul2:%\w+]] RelaxedPrecision + ; CHECK: OpDecorate [[add2:%\w+]] RelaxedPrecision + ; CHECK: OpDecorate [[ld3:%\w+]] RelaxedPrecision + ; CHECK: OpDecorate [[mul3:%\w+]] RelaxedPrecision + ; CHECK: OpDecorate [[add3:%\w+]] RelaxedPrecision + +; CHECK: [[ld1]] = OpLoad %float +; CHECK: [[mul1]] = OpFMul %float +; CHECK: [[add1]] = OpFAdd %float +; CHECK: [[ld2]] = OpLoad %float +; CHECK: [[mul2]] = OpFMul %float +; CHECK: [[add2]] = OpFAdd %float +; CHECK: [[ld3]] = OpLoad %float +; CHECK: [[mul3]] = OpFMul %float +; CHECK: [[add3]] = OpFAdd %float + + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 Block + OpDecorate %5 RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_4 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_4 = OpTypePointer StorageBuffer %_struct_4 + %uint = OpTypeInt 32 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %2 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer + %1 = OpFunction %void None %16 + %19 = OpLabel + OpBranch %20 + %20 = OpLabel + %21 = OpPhi %int %int_0 %19 %22 %23 + %24 = OpSLessThan %bool %21 %int_3 + OpLoopMerge %25 %23 Unroll + OpBranchConditional %24 %26 %25 + %26 = OpLabel + %27 = OpBitcast %uint %21 + %28 = OpAccessChain %_ptr_StorageBuffer_float %2 %int_0 %27 + %5 = OpLoad %float %28 + %6 = OpFMul %float %5 %5 + %7 = OpFAdd %float %5 %6 + OpStore %28 %7 + OpBranch %23 + %23 = OpLabel + %22 = OpIAdd %int %21 %int_1 + OpBranch %20 + %25 = OpLabel + OpReturn + OpFunctionEnd +)"; + SetTargetEnv(SPV_ENV_UNIVERSAL_1_6); + SinglePassRunAndMatch(text, true); +} + } // namespace } // namespace opt } // namespace spvtools diff --git a/third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp b/third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp index 131a6b4bc4..9cf420f5c4 100644 --- a/third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp +++ b/third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp @@ -639,6 +639,131 @@ OpFunctionEnd EXPECT_EQ(GetErrorMessage(), ""); } +TEST_F(RemoveDuplicatesTest, DuplicateExtensions) { + const std::string spirv = R"( +OpExtension "SPV_INTEL_function_variants" +OpExtension "SPV_INTEL_function_variants" +)"; + const std::string after = R"(OpExtension "SPV_INTEL_function_variants" +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, DuplicateConditionalExtensions) { + const std::string spirv = R"( +OpConditionalExtensionINTEL %1 "SPV_INTEL_function_variants" +OpConditionalExtensionINTEL %1 "SPV_INTEL_function_variants" +)"; + const std::string after = + R"(OpConditionalExtensionINTEL %1 "SPV_INTEL_function_variants" +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, MixedConditionalExtensions) { + const std::string spirv = R"( +OpConditionalExtensionINTEL %1 "SPV_INTEL_function_variants" +OpConditionalExtensionINTEL %2 "SPV_INTEL_function_variants" +OpConditionalExtensionINTEL %2 "SPV_INTEL_inline_assembly" +OpConditionalExtensionINTEL %2 "SPV_INTEL_inline_assembly" +OpExtension "SPV_INTEL_function_variants" +)"; + const std::string after = + R"(OpConditionalExtensionINTEL %1 "SPV_INTEL_function_variants" +OpConditionalExtensionINTEL %2 "SPV_INTEL_function_variants" +OpConditionalExtensionINTEL %2 "SPV_INTEL_inline_assembly" +OpExtension "SPV_INTEL_function_variants" +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, MixedConditionalExtensionsReordered) { + const std::string spirv = R"( +OpConditionalExtensionINTEL %2 "SPV_INTEL_function_variants" +OpConditionalExtensionINTEL %2 "SPV_INTEL_inline_assembly" +OpConditionalExtensionINTEL %2 "SPV_INTEL_inline_assembly" +OpConditionalExtensionINTEL %1 "SPV_INTEL_function_variants" +OpExtension "SPV_INTEL_function_variants" +%3 = OpTypeBool +%1 = OpSpecConstantTrue %3 +%2 = OpSpecConstantFalse %3 +)"; + const std::string after = + R"(OpConditionalExtensionINTEL %1 "SPV_INTEL_function_variants" +OpConditionalExtensionINTEL %1 "SPV_INTEL_inline_assembly" +OpConditionalExtensionINTEL %2 "SPV_INTEL_function_variants" +OpExtension "SPV_INTEL_function_variants" +%3 = OpTypeBool +%2 = OpSpecConstantTrue %3 +%1 = OpSpecConstantFalse %3 +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, DuplicateConditionalCapabilities) { + const std::string spirv = R"( +OpConditionalCapabilityINTEL %1 Kernel +OpConditionalCapabilityINTEL %1 Kernel +)"; + const std::string after = R"(OpConditionalCapabilityINTEL %1 Kernel +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, MixedConditionalCapabilities) { + const std::string spirv = R"( +OpConditionalCapabilityINTEL %1 Kernel +OpConditionalCapabilityINTEL %2 Kernel +OpConditionalCapabilityINTEL %2 Linkage +OpConditionalCapabilityINTEL %2 Linkage +OpCapability Kernel +)"; + const std::string after = + R"(OpConditionalCapabilityINTEL %1 Kernel +OpConditionalCapabilityINTEL %2 Kernel +OpConditionalCapabilityINTEL %2 Linkage +OpCapability Kernel +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, MixedConditionalCapabilitiesReordered) { + const std::string spirv = R"( +OpConditionalCapabilityINTEL %2 Kernel +OpConditionalCapabilityINTEL %2 Linkage +OpConditionalCapabilityINTEL %2 Linkage +OpConditionalCapabilityINTEL %1 Kernel +OpCapability Kernel +%3 = OpTypeBool +%1 = OpSpecConstantTrue %3 +%2 = OpSpecConstantFalse %3 +)"; + const std::string after = + R"(OpConditionalCapabilityINTEL %1 Kernel +OpConditionalCapabilityINTEL %1 Linkage +OpConditionalCapabilityINTEL %2 Kernel +OpCapability Kernel +%3 = OpTypeBool +%2 = OpSpecConstantTrue %3 +%1 = OpSpecConstantFalse %3 +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + } // namespace } // namespace opt } // namespace spvtools diff --git a/third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp b/third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp index 7799d45d03..6af110730e 100644 --- a/third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp +++ b/third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp @@ -84,6 +84,34 @@ TEST_F(RedundancyEliminationTest, RemoveRedundantAdd) { SinglePassRunAndMatch(text, false); } +// Remove a redundant add with flipped arguments. +TEST_F(RedundancyEliminationTest, RemoveRedundantAddFlipped) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFMul %5 %9 %9 + %11 = OpFAdd %5 %9 %10 +; CHECK: OpFAdd +; CHECK-NEXT: OpReturn + %12 = OpFAdd %5 %10 %9 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + // Remove a redundant add going through a multiple basic blocks. TEST_F(RedundancyEliminationTest, RemoveRedundantAddDiamond) { const std::string text = R"( diff --git a/third_party/spirv-tools/test/opt/scalar_replacement_test.cpp b/third_party/spirv-tools/test/opt/scalar_replacement_test.cpp index 01fa7217f5..0256ac264f 100644 --- a/third_party/spirv-tools/test/opt/scalar_replacement_test.cpp +++ b/third_party/spirv-tools/test/opt/scalar_replacement_test.cpp @@ -1863,6 +1863,7 @@ OpReturn OpFunctionEnd )"; + ValidatorOptions()->relax_logical_pointer = true; auto result = SinglePassRunAndDisassemble(text, true, true, 0); EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); diff --git a/third_party/spirv-tools/test/opt/strip_nonsemantic_info_test.cpp b/third_party/spirv-tools/test/opt/strip_nonsemantic_info_test.cpp index 3aacffa343..5c3909c093 100644 --- a/third_party/spirv-tools/test/opt/strip_nonsemantic_info_test.cpp +++ b/third_party/spirv-tools/test/opt/strip_nonsemantic_info_test.cpp @@ -224,6 +224,70 @@ OpFunctionEnd SinglePassRunAndMatch(text, true); } +TEST_F(StripNonSemanticInfoTest, StripNonSemanticScopes) { + std::string text = R"( +;CHECK-NOT: OpExtension "SPV_KHR_non_semantic_info +;CHECK-NOT: OpExtInstImport "NonSemantic.Shader.DebugInfo.100 +;CHECK-NOT: OpExtInst %8 {{%\w+}} DebugInfoNon +;CHECK-NOT: OpExtInst %8 {{%\w+}} DebugSource +;CHECK-NOT: OpExtInst %8 {{%\w+}} DebugCompilationUnit +;CHECK-NOT: OpExtInst %8 {{%\w+}} DebugTypeFunction +;CHECK-NOT: OpExtInst %8 {{%\w+}} DebugFunction +;CHECK-NOT: OpExtInst %8 {{%\w+}} DebugScope +;CHECK-NOT: OpExtInst %8 {{%\w+}} DebugNoScope + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + OpExtension "SPV_KHR_storage_buffer_storage_class" + %1 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 + OpExecutionMode %2 LocalSize 1 1 1 + %4 = OpString "" + OpDecorate %5 ArrayStride 4 + OpDecorate %6 ArrayStride 4 + OpDecorate %7 Block + OpMemberDecorate %7 0 Offset 0 + OpDecorate %3 Binding 0 + OpDecorate %3 DescriptorSet 0 + %8 = OpTypeVoid + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 100 + %11 = OpTypeFunction %8 + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypeFloat 32 + %5 = OpTypePointer StorageBuffer %14 + %6 = OpTypeRuntimeArray %14 + %7 = OpTypeStruct %6 + %15 = OpTypePointer StorageBuffer %7 + %16 = OpConstant %14 0 + %3 = OpVariable %15 StorageBuffer + %17 = OpExtInst %8 %1 DebugInfoNone + %18 = OpExtInst %8 %1 DebugSource %4 %4 + %19 = OpExtInst %8 %1 DebugCompilationUnit %10 %10 %18 %10 + %20 = OpExtInst %8 %1 DebugTypeFunction %10 %8 + %21 = OpExtInst %8 %1 DebugFunction %4 %20 %18 %10 %10 %19 %4 %10 %10 + %22 = OpExtInst %8 %1 DebugEntryPoint %21 %19 %4 %4 + %23 = OpExtInst %8 %1 DebugTypeBasic %4 %10 %10 %10 + %24 = OpExtInst %8 %1 DebugTypeArray %23 %10 + %25 = OpExtInst %8 %1 DebugTypeMember %4 %24 %18 %10 %10 %10 %10 %10 + %26 = OpExtInst %8 %1 DebugTypeComposite %4 %10 %18 %10 %10 %19 %4 %10 %10 %25 + %27 = OpExtInst %8 %1 DebugGlobalVariable %4 %26 %18 %10 %10 %19 %4 %3 %10 + %2 = OpFunction %8 None %11 + %28 = OpLabel + %29 = OpExtInst %8 %1 DebugFunctionDefinition %21 %2 + %30 = OpExtInst %8 %1 DebugScope %21 + %31 = OpExtInst %8 %1 DebugLine %18 %10 %10 %10 %10 + %32 = OpAccessChain %5 %3 %13 %13 + OpStore %32 %16 + OpReturn + %33 = OpExtInst %8 %1 DebugNoScope + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, false); +} + // Make sure that strip reflect does not remove the debug info (OpString and // OpLine). TEST_F(StripNonSemanticInfoTest, DontStripDebug) { diff --git a/third_party/spirv-tools/test/opt/trim_capabilities_pass_test.cpp b/third_party/spirv-tools/test/opt/trim_capabilities_pass_test.cpp index d487f0a733..43271da231 100644 --- a/third_party/spirv-tools/test/opt/trim_capabilities_pass_test.cpp +++ b/third_party/spirv-tools/test/opt/trim_capabilities_pass_test.cpp @@ -3000,8 +3000,8 @@ TEST_F(TrimCapabilitiesPassTest, GroupNonUniform_RemovedWhenUnused) { ; CHECK-NOT: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3030,8 +3030,8 @@ TEST_F(TrimCapabilitiesPassTest, ; CHECK-NOT: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK: OpCapability GroupNonUniform OpCapability Shader @@ -3066,8 +3066,8 @@ TEST_F(TrimCapabilitiesPassTest, ; CHECK-NOT: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3102,8 +3102,8 @@ TEST_F(TrimCapabilitiesPassTest, ; CHECK-NOT: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3138,8 +3138,8 @@ TEST_F(TrimCapabilitiesPassTest, ; CHECK: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3175,8 +3175,8 @@ TEST_F(TrimCapabilitiesPassTest, ; CHECK: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3212,8 +3212,8 @@ TEST_F(TrimCapabilitiesPassTest, ; CHECK: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3249,8 +3249,8 @@ TEST_F(TrimCapabilitiesPassTest, ; CHECK-NOT: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3306,10 +3306,10 @@ static const std::vector kSubgroupTestCases{ // clang-format on }; -using TrimCapabilitiesPassTestSubgroupNV_Unsigned = PassTest< +using TrimCapabilitiesPassTestSubgroupEXT_Unsigned = PassTest< ::testing::TestWithParam>>; -TEST_P(TrimCapabilitiesPassTestSubgroupNV_Unsigned, - GroupNonUniformPartitionedNV_Remains) { +TEST_P(TrimCapabilitiesPassTestSubgroupEXT_Unsigned, + GroupNonUniformPartitionedEXT_Remains) { SubgroupTestCase test_case = std::get<0>(GetParam()); const std::string operation = std::get<1>(GetParam()); @@ -3321,8 +3321,8 @@ TEST_P(TrimCapabilitiesPassTestSubgroupNV_Unsigned, ; CHECK-NOT: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3358,14 +3358,14 @@ TEST_P(TrimCapabilitiesPassTestSubgroupNV_Unsigned, } INSTANTIATE_TEST_SUITE_P( - TrimCapabilitiesPassTestSubgroupNV_Unsigned_I, - TrimCapabilitiesPassTestSubgroupNV_Unsigned, + TrimCapabilitiesPassTestSubgroupEXT_Unsigned_I, + TrimCapabilitiesPassTestSubgroupEXT_Unsigned, ::testing::Combine(::testing::ValuesIn(kSubgroupTestCases), - ::testing::Values("PartitionedReduceNV", - "PartitionedInclusiveScanNV", - "PartitionedExclusiveScanNV")), + ::testing::Values("PartitionedReduceEXT", + "PartitionedInclusiveScanEXT", + "PartitionedExclusiveScanEXT")), [](const ::testing::TestParamInfo< - TrimCapabilitiesPassTestSubgroupNV_Unsigned::ParamType>& info) { + TrimCapabilitiesPassTestSubgroupEXT_Unsigned::ParamType>& info) { return std::get<0>(info.param).opcode + "_" + std::get<1>(info.param); }); @@ -3384,8 +3384,8 @@ TEST_P(TrimCapabilitiesPassTestSubgroupArithmetic_Unsigned, ; CHECK: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK-NOT: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3445,8 +3445,8 @@ TEST_P(TrimCapabilitiesPassTestSubgroupClustered_Unsigned, ; CHECK-NOT: OpCapability GroupNonUniformArithmetic OpCapability GroupNonUniformClustered ; CHECK: OpCapability GroupNonUniformClustered - OpCapability GroupNonUniformPartitionedNV -; CHECK-NOT: OpCapability GroupNonUniformPartitionedNV + OpCapability GroupNonUniformPartitionedEXT +; CHECK-NOT: OpCapability GroupNonUniformPartitionedEXT OpCapability GroupNonUniform ; CHECK-NOT: OpCapability GroupNonUniform OpExtension "SPV_NV_shader_subgroup_partitioned" @@ -3635,6 +3635,167 @@ TEST_F(TrimCapabilitiesPassTest, PhysicalStorageBuffer_RecursiveTypes) { EXPECT_EQ(std::get<1>(result), Pass::Status::SuccessWithoutChange); } +TEST_F(TrimCapabilitiesPassTest, Geometry_Remains) { + const std::string kTest = R"( + OpCapability Geometry +; CHECK: OpCapability Geometry + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %gs_main "gs_main" %gl_Position + OpExecutionMode %gs_main OutputVertices 3 + OpExecutionMode %gs_main Invocations 1 + OpExecutionMode %gs_main Triangles + OpExecutionMode %gs_main OutputTriangleStrip + OpSource HLSL 660 + OpName %gs_main "gs_main" + OpDecorate %gl_Position BuiltIn Position + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %7 = OpTypeFunction %void +%gl_Position = OpVariable %_ptr_Output_v4float Output + %gs_main = OpFunction %void None %7 + %8 = OpLabel + OpEmitVertex + OpReturn + OpFunctionEnd + )"; + const auto result = + SinglePassRunAndMatch(kTest, /* skip_nop= */ false); + EXPECT_EQ(std::get<1>(result), Pass::Status::SuccessWithoutChange); +} + +// FIXME(6277): enable once spirv-opt supports SPV_INTEL_function_variants +#if 0 +TEST_F(TrimCapabilitiesPassTest, Geometry_RemainsIntel) { + const std::string kTest = R"( + OpCapability Geometry + ; CHECK: OpCapability Geometry + OpCapability SpecConditionalINTEL + OpExtension "SPV_INTEL_function_variants" + OpMemoryModel Logical GLSL450 + OpConditionalEntryPointINTEL %false Geometry %gs_main "gs_main" + OpExecutionMode %gs_main OutputVertices 3 + OpExecutionMode %gs_main Invocations 1 + OpExecutionMode %gs_main Triangles + OpExecutionMode %gs_main OutputTriangleStrip + OpSource HLSL 660 + OpName %gs_main "gs_main" + OpDecorate %gl_Position BuiltIn Position + %bool = OpTypeBool + %false = OpSpecConstantFalse %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %7 = OpTypeFunction %void + %gl_Position = OpVariable %_ptr_Output_v4float Output + %gs_main = OpFunction %void None %7 + %8 = OpLabel + OpEmitVertex + OpReturn + OpFunctionEnd + )"; + const auto result = + SinglePassRunAndMatch(kTest, /* skip_nop= */ false); + EXPECT_EQ(std::get<1>(result), Pass::Status::SuccessWithoutChange); +} +#endif + +TEST_F(TrimCapabilitiesPassTest, Geometry_Removed) { + const std::string kTest = R"( + OpCapability Shader + OpCapability Geometry +; CHECK-NOT: OpCapability Geometry + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %ps_main "ps_main" %in_var_POSITION %out_var_SV_Target + OpExecutionMode %ps_main OriginUpperLeft + OpSource HLSL 660 + OpName %in_var_POSITION "in.var.POSITION" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %ps_main "ps_main" + OpDecorate %in_var_POSITION Location 0 + OpDecorate %out_var_SV_Target Location 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %9 = OpTypeFunction %void +%in_var_POSITION = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output + %ps_main = OpFunction %void None %9 + %10 = OpLabel + %11 = OpLoad %v4float %in_var_POSITION + OpStore %out_var_SV_Target %11 + OpReturn + OpFunctionEnd + )"; + const auto result = + SinglePassRunAndMatch(kTest, /* skip_nop= */ false); + EXPECT_EQ(std::get<1>(result), Pass::Status::SuccessWithChange); +} + +// FIXME(6277): enable once spirv-opt supports SPV_INTEL_function_variants +#if 0 +TEST_F(TrimCapabilitiesPassTest, Geometry_RemovedIntel) { + const std::string kTest = R"( + OpCapability Shader + OpCapability Geometry +; CHECK-NOT: OpCapability Geometry + OpCapability SpecConditionalINTEL + OpExtension "SPV_INTEL_function_variants" + OpMemoryModel Logical GLSL450 + OpConditionalEntryPointINTEL %false Fragment %ps_main "ps_main" %in_var_POSITION %out_var_SV_Target + OpExecutionMode %ps_main OriginUpperLeft + OpSource HLSL 660 + OpName %in_var_POSITION "in.var.POSITION" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %ps_main "ps_main" + OpDecorate %in_var_POSITION Location 0 + OpDecorate %out_var_SV_Target Location 0 + %bool = OpTypeBool + %false = OpSpecConstantFalse %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %9 = OpTypeFunction %void +%in_var_POSITION = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output + %ps_main = OpFunction %void None %9 + %10 = OpLabel + %11 = OpLoad %v4float %in_var_POSITION + OpStore %out_var_SV_Target %11 + OpReturn + OpFunctionEnd + )"; + const auto result = + SinglePassRunAndMatch(kTest, /* skip_nop= */ false); + EXPECT_EQ(std::get<1>(result), Pass::Status::SuccessWithChange); +} +#endif + +TEST_F(TrimCapabilitiesPassTest, CheckNop) { + const std::string kTest = R"( + OpCapability Shader +; CHECK: OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %1 = OpFunction %void None %3 + %6 = OpLabel + OpNop + OpReturn + OpFunctionEnd; + )"; + const auto result = + SinglePassRunAndMatch(kTest, /* skip_nop= */ false); + EXPECT_EQ(std::get<1>(result), Pass::Status::SuccessWithoutChange); +} + INSTANTIATE_TEST_SUITE_P( TrimCapabilitiesPassTestSubgroupClustered_Unsigned_I, TrimCapabilitiesPassTestSubgroupClustered_Unsigned, diff --git a/third_party/spirv-tools/test/opt/type_manager_test.cpp b/third_party/spirv-tools/test/opt/type_manager_test.cpp index 86d6bc0645..29feaa0125 100644 --- a/third_party/spirv-tools/test/opt/type_manager_test.cpp +++ b/third_party/spirv-tools/test/opt/type_manager_test.cpp @@ -177,6 +177,7 @@ std::vector> GenerateAllTypes() { types.emplace_back(new CooperativeMatrixKHR(f32, 8, 8, 8, 1002)); types.emplace_back(new RayQueryKHR()); types.emplace_back(new HitObjectNV()); + types.emplace_back(new HitObjectEXT()); types.emplace_back(new CooperativeVectorNV(f32, 16)); // SPV_AMDX_shader_enqueue @@ -184,8 +185,19 @@ std::vector> GenerateAllTypes() { // Tensors types.emplace_back(new TensorARM(f32)); + auto* tensor_f32 = types.back().get(); types.emplace_back(new TensorARM(f32, 4)); + auto* tensor_f32_ranked = types.back().get(); types.emplace_back(new TensorARM(f32, 4, 44)); + auto* tensor_f32_shaped = types.back().get(); + + // BufferEXT (SPV_EXT_descriptor_heap) + types.emplace_back(new BufferEXT(spv::StorageClass::StorageBuffer)); + + // Graph + types.emplace_back(new GraphARM(0, {tensor_f32})); + types.emplace_back(new GraphARM(1, {tensor_f32_ranked, tensor_f32_ranked})); + types.emplace_back(new GraphARM(1, {tensor_f32_shaped, tensor_f32_shaped})); types.emplace_back(new TensorLayoutNV(1002, 1000)); types.emplace_back(new TensorViewNV(1002, 1003, {1000, 1001})); @@ -261,6 +273,9 @@ TEST(TypeManager, TypeStrings) { %ts = OpTypeTensorARM %u32 %tsr = OpTypeTensorARM %u32 %id4 %tss = OpTypeTensorARM %u32 %id4 %ts_shape + %g_noin = OpTypeGraphARM 0 %ts + %g_onein = OpTypeGraphARM 1 %tsr %tsr + %g_shaped = OpTypeGraphARM 1 %tss %tss )"; std::vector> type_id_strs = { @@ -305,6 +320,11 @@ TEST(TypeManager, TypeStrings) { {44, "tensor"}, {45, "tensor"}, {46, "tensor"}, + {47, "graph<0,tensor>"}, + {48, + "graph<1,tensor,tensor>"}, + {49, + "graph<1,tensor,tensor>"}, }; std::unique_ptr context = @@ -1124,9 +1144,12 @@ TEST(TypeManager, GetTypeInstructionAllTypes) { ; CHECK: OpTypeCooperativeMatrixKHR [[f32]] [[uint8]] [[uint8]] [[uint8]] [[uint2]] ; CHECK: OpTypeRayQueryKHR ; CHECK: OpTypeHitObjectNV -; CHECK: OpTypeTensorARM [[f32]] -; CHECK: OpTypeTensorARM [[f32]] [[uint4]] -; CHECK: OpTypeTensorARM [[f32]] [[uint4]] [[uint_arr4_44]] +; CHECK: [[tensor_f32:%\w+]] = OpTypeTensorARM [[f32]] +; CHECK: [[tensor_f32_ranked:%\w+]] = OpTypeTensorARM [[f32]] [[uint4]] +; CHECK: [[tensor_f32_shaped:%\w+]] = OpTypeTensorARM [[f32]] [[uint4]] [[uint_arr4_44]] +; CHECK: OpTypeGraphARM 0 [[tensor_f32]] +; CHECK: OpTypeGraphARM 1 [[tensor_f32_ranked]] [[tensor_f32_ranked]] +; CHECK: OpTypeGraphARM 1 [[tensor_f32_shaped]] [[tensor_f32_shaped]] OpCapability Shader OpCapability Int64 OpCapability Linkage diff --git a/third_party/spirv-tools/test/opt/upgrade_memory_model_test.cpp b/third_party/spirv-tools/test/opt/upgrade_memory_model_test.cpp index 45581fbf48..9c921049fe 100644 --- a/third_party/spirv-tools/test/opt/upgrade_memory_model_test.cpp +++ b/third_party/spirv-tools/test/opt/upgrade_memory_model_test.cpp @@ -637,7 +637,7 @@ TEST_F(UpgradeMemoryModelTest, VariablePointerIndirectSelect) { const std::string text = R"( ; CHECK-NOT: OpDecorate {{%\w+}} Coherent ; CHECK: [[scope:%\w+]] = OpConstant {{%\w+}} 5 -; CHECK: [[buffer:%\w+]] = OpLoad {{%\w+}} {{%\w+}} +; CHECK: [[buffer:%\w+]] = OpSelect {{%\w+}} {{%\w+}} ; CHECK: [[ld_gep:%\w+]] = OpAccessChain {{%\w+}} [[buffer]] {{%\w+}} {{%\w+}} ; CHECK: OpLoad {{%\w+}} [[ld_gep]] MakePointerVisible|NonPrivatePointer [[scope]] OpCapability Shader @@ -660,15 +660,15 @@ OpDecorate %_struct_4 Block %_ptr_Function__ptr_StorageBuffer__struct_4 = OpTypePointer Function %_ptr_StorageBuffer__struct_4 %functy = OpTypeFunction %uint %_ptr_Function__ptr_StorageBuffer__struct_4 %_ptr_Function_uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%null = OpConstantNull %_ptr_Function__ptr_StorageBuffer__struct_4 +%null = OpConstantNull %_ptr_StorageBuffer__struct_4 %func = OpFunction %uint None %functy %param_buf = OpFunctionParameter %_ptr_Function__ptr_StorageBuffer__struct_4 %param_offset = OpFunctionParameter %_ptr_Function_uint %bb_entry = OpLabel -%select = OpSelect %_ptr_Function__ptr_StorageBuffer__struct_4 %true %param_buf %null -%buf = OpLoad %_ptr_StorageBuffer__struct_4 %select +%buf = OpLoad %_ptr_StorageBuffer__struct_4 %param_buf +%select = OpSelect %_ptr_StorageBuffer__struct_4 %true %buf %null %offset = OpLoad %uint %param_offset -%ld_gep = OpAccessChain %_ptr_StorageBuffer_uint %buf %uint_0 %offset +%ld_gep = OpAccessChain %_ptr_StorageBuffer_uint %select %uint_0 %offset %data = OpLoad %uint %ld_gep OpReturnValue %data OpFunctionEnd @@ -720,7 +720,7 @@ TEST_F(UpgradeMemoryModelTest, VariablePointerIndirectPhi) { const std::string text = R"( ; CHECK-NOT: OpDecorate {{%\w+}} Coherent ; CHECK: [[scope:%\w+]] = OpConstant {{%\w+}} 5 -; CHECK: [[buffer:%\w+]] = OpLoad {{%\w+}} {{%\w+}} +; CHECK: [[buffer:%\w+]] = OpPhi {{%\w+}} {{%\w+}} ; CHECK: [[ld_gep:%\w+]] = OpAccessChain {{%\w+}} [[buffer]] {{%\w+}} {{%\w+}} ; CHECK: OpLoad {{%\w+}} [[ld_gep]] MakePointerVisible|NonPrivatePointer [[scope]] OpCapability Shader @@ -743,11 +743,12 @@ OpDecorate %_struct_4 Block %_ptr_Function__ptr_StorageBuffer__struct_4 = OpTypePointer Function %_ptr_StorageBuffer__struct_4 %functy = OpTypeFunction %uint %_ptr_Function__ptr_StorageBuffer__struct_4 %_ptr_Function_uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%null = OpConstantNull %_ptr_Function__ptr_StorageBuffer__struct_4 +%null = OpConstantNull %_ptr_StorageBuffer__struct_4 %func = OpFunction %uint None %functy %param_buf = OpFunctionParameter %_ptr_Function__ptr_StorageBuffer__struct_4 %param_offset = OpFunctionParameter %_ptr_Function_uint %bb_entry = OpLabel +%buf = OpLoad %_ptr_StorageBuffer__struct_4 %param_buf OpSelectionMerge %bb_end None OpBranchConditional %true %bb_then %bb_else %bb_then = OpLabel @@ -755,10 +756,9 @@ OpBranch %bb_end %bb_else = OpLabel OpBranch %bb_end %bb_end = OpLabel -%phi_buf_ptr = OpPhi %_ptr_Function__ptr_StorageBuffer__struct_4 %param_buf %bb_then %null %bb_else -%buf = OpLoad %_ptr_StorageBuffer__struct_4 %phi_buf_ptr +%phi_buf_ptr = OpPhi %_ptr_StorageBuffer__struct_4 %buf %bb_then %null %bb_else %offset = OpLoad %uint %param_offset -%ld_gep = OpAccessChain %_ptr_StorageBuffer_uint %buf %uint_0 %offset +%ld_gep = OpAccessChain %_ptr_StorageBuffer_uint %phi_buf_ptr %uint_0 %offset %data = OpLoad %uint %ld_gep OpReturnValue %data OpFunctionEnd @@ -1562,9 +1562,9 @@ OpFunctionEnd TEST_F(UpgradeMemoryModelTest, TessellationControlBarrierNoChange) { const std::string text = R"( -; CHECK: [[none:%\w+]] = OpConstant {{%\w+}} 0 -; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2 -; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[none]] +; CHECK: [[none:%\w+]] = OpConstant {{%\w+}} 0{{\s*$}} +; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2{{\s*$}} +; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[none]]{{\s*$}} OpCapability Tessellation OpMemoryModel Logical GLSL450 OpEntryPoint TessellationControl %func "func" @@ -1583,11 +1583,11 @@ OpFunctionEnd SinglePassRunAndMatch(text, true); } -TEST_F(UpgradeMemoryModelTest, TessellationControlBarrierAddOutput) { +TEST_F(UpgradeMemoryModelTest, TessellationControlBarrierRelaxedNoChange) { const std::string text = R"( -; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2 -; CHECK: [[output:%\w+]] = OpConstant {{%\w+}} 4096 -; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[output]] +; CHECK: [[none:%\w+]] = OpConstant {{%\w+}} 0{{\s*$}} +; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2{{\s*$}} +; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[none]]{{\s*$}} OpCapability Tessellation OpMemoryModel Logical GLSL450 OpEntryPoint TessellationControl %func "func" %var @@ -1610,25 +1610,52 @@ OpFunctionEnd SinglePassRunAndMatch(text, true); } -TEST_F(UpgradeMemoryModelTest, TessellationMemoryBarrierNoChange) { +TEST_F(UpgradeMemoryModelTest, TessellationControlBarrierAddOutput) { const std::string text = R"( -; CHECK: [[none:%\w+]] = OpConstant {{%\w+}} 0 -; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2 -; CHECK: OpMemoryBarrier [[workgroup]] [[none]] +; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2{{\s*$}} +; CHECK: [[acqrel_workgroup_output:%\w+]] = OpConstant {{%\w+}} 4360{{\s*$}} +; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[acqrel_workgroup_output]]{{\s*$}} OpCapability Tessellation OpMemoryModel Logical GLSL450 OpEntryPoint TessellationControl %func "func" %var %void = OpTypeVoid %int = OpTypeInt 32 0 -%none = OpConstant %int 0 %workgroup = OpConstant %int 2 +%acqrel_workgroup = OpConstant %int 264 %ptr_int_Output = OpTypePointer Output %int %var = OpVariable %ptr_int_Output Output %func_ty = OpTypeFunction %void %func = OpFunction %void None %func_ty %1 = OpLabel %ld = OpLoad %int %var -OpMemoryBarrier %workgroup %none +OpControlBarrier %workgroup %workgroup %acqrel_workgroup +OpStore %var %ld +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(UpgradeMemoryModelTest, TessellationMemoryBarrierNoChange) { + const std::string text = R"( +; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2{{\s*$}} +; CHECK: [[acqrel_workgroup:%\w+]] = OpConstant {{%\w+}} 264{{\s*$}} +; CHECK: OpMemoryBarrier [[workgroup]] [[acqrel_workgroup]]{{\s*$}} +OpCapability Tessellation +OpMemoryModel Logical GLSL450 +OpEntryPoint TessellationControl %func "func" %var +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%workgroup = OpConstant %int 2 +%acqrel_workgroup = OpConstant %int 264 +%ptr_int_Output = OpTypePointer Output %int +%var = OpVariable %ptr_int_Output Output +%func_ty = OpTypeFunction %void +%func = OpFunction %void None %func_ty +%1 = OpLabel +%ld = OpLoad %int %var +OpMemoryBarrier %workgroup %acqrel_workgroup OpStore %var %ld OpReturn OpFunctionEnd @@ -1639,16 +1666,16 @@ OpFunctionEnd TEST_F(UpgradeMemoryModelTest, TessellationControlBarrierAddOutputSubFunction) { const std::string text = R"( -; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2 -; CHECK: [[output:%\w+]] = OpConstant {{%\w+}} 4096 -; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[output]] +; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2{{\s*$}} +; CHECK: [[acqrel_workgroup_output:%\w+]] = OpConstant {{%\w+}} 4360{{\s*$}} +; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[acqrel_workgroup_output]]{{\s*$}} OpCapability Tessellation OpMemoryModel Logical GLSL450 OpEntryPoint TessellationControl %func "func" %var %void = OpTypeVoid %int = OpTypeInt 32 0 -%none = OpConstant %int 0 %workgroup = OpConstant %int 2 +%acqrel_workgroup = OpConstant %int 264 %ptr_int_Output = OpTypePointer Output %int %var = OpVariable %ptr_int_Output Output %func_ty = OpTypeFunction %void @@ -1660,7 +1687,7 @@ OpFunctionEnd %sub_func = OpFunction %void None %func_ty %2 = OpLabel %ld = OpLoad %int %var -OpControlBarrier %workgroup %workgroup %none +OpControlBarrier %workgroup %workgroup %acqrel_workgroup OpStore %var %ld OpReturn OpFunctionEnd @@ -1672,16 +1699,16 @@ OpFunctionEnd TEST_F(UpgradeMemoryModelTest, TessellationControlBarrierAddOutputDifferentFunctions) { const std::string text = R"( -; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2 -; CHECK: [[output:%\w+]] = OpConstant {{%\w+}} 4096 -; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[output]] +; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2{{\s*$}} +; CHECK: [[acqrel_workgroup_output:%\w+]] = OpConstant {{%\w+}} 4360{{\s*$}} +; CHECK: OpControlBarrier [[workgroup]] [[workgroup]] [[acqrel_workgroup_output]]{{\s*$}} OpCapability Tessellation OpMemoryModel Logical GLSL450 OpEntryPoint TessellationControl %func "func" %var %void = OpTypeVoid %int = OpTypeInt 32 0 -%none = OpConstant %int 0 %workgroup = OpConstant %int 2 +%acqrel_workgroup = OpConstant %int 264 %ptr_int_Output = OpTypePointer Output %int %var = OpVariable %ptr_int_Output Output %func_ty = OpTypeFunction %void @@ -1701,7 +1728,7 @@ OpReturnValue %ld OpFunctionEnd %barrier_func = OpFunction %void None %func_ty %3 = OpLabel -OpControlBarrier %workgroup %workgroup %none +OpControlBarrier %workgroup %workgroup %acqrel_workgroup OpReturn OpFunctionEnd %st_func = OpFunction %void None %st_func_ty @@ -1717,21 +1744,22 @@ OpFunctionEnd TEST_F(UpgradeMemoryModelTest, ChangeControlBarrierMemoryScope) { std::string text = R"( -; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2 -; CHECK: [[queuefamily:%\w+]] = OpConstant {{%\w+}} 5 -; CHECK: OpControlBarrier [[workgroup]] [[queuefamily]] +; CHECK: [[workgroup:%\w+]] = OpConstant {{%\w+}} 2{{\s*$}} +; CHECK: [[acqrel_workgroup:%\w+]] = OpConstant {{%\w+}} 264{{\s*$}} +; CHECK: [[queuefamily:%\w+]] = OpConstant {{%\w+}} 5{{\s*$}} +; CHECK: OpControlBarrier [[workgroup]] [[queuefamily]] [[acqrel_workgroup]]{{\s*$}} OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %func "func" %void = OpTypeVoid %int = OpTypeInt 32 0 -%none = OpConstant %int 0 %device = OpConstant %int 1 %workgroup = OpConstant %int 2 +%acqrel_workgroup = OpConstant %int 264 %func_ty = OpTypeFunction %void %func = OpFunction %void None %func_ty %1 = OpLabel -OpControlBarrier %workgroup %device %none +OpControlBarrier %workgroup %device %acqrel_workgroup OpReturn OpFunctionEnd )"; @@ -1741,19 +1769,20 @@ OpFunctionEnd TEST_F(UpgradeMemoryModelTest, ChangeMemoryBarrierMemoryScope) { std::string text = R"( -; CHECK: [[queuefamily:%\w+]] = OpConstant {{%\w+}} 5 -; CHECK: OpMemoryBarrier [[queuefamily]] +; CHECK: [[acqrel_workgroup:%\w+]] = OpConstant {{%\w+}} 264{{\s*$}} +; CHECK: [[queuefamily:%\w+]] = OpConstant {{%\w+}} 5{{\s*$}} +; CHECK: OpMemoryBarrier [[queuefamily]] [[acqrel_workgroup]]{{\s*$}} OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %func "func" %void = OpTypeVoid %int = OpTypeInt 32 0 -%none = OpConstant %int 0 %device = OpConstant %int 1 +%acqrel_workgroup = OpConstant %int 264 %func_ty = OpTypeFunction %void %func = OpFunction %void None %func_ty %1 = OpLabel -OpMemoryBarrier %device %none +OpMemoryBarrier %device %acqrel_workgroup OpReturn OpFunctionEnd )"; diff --git a/third_party/spirv-tools/test/text_to_binary.extension_test.cpp b/third_party/spirv-tools/test/text_to_binary.extension_test.cpp index 39accfc10f..385df77b23 100644 --- a/third_party/spirv-tools/test/text_to_binary.extension_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.extension_test.cpp @@ -858,41 +858,42 @@ INSTANTIATE_TEST_SUITE_P( {"OpExtension \"SPV_NV_shader_subgroup_partitioned\"\n", MakeInstruction(spv::Op::OpExtension, MakeVector("SPV_NV_shader_subgroup_partitioned"))}, - {"OpCapability GroupNonUniformPartitionedNV\n", + {"OpCapability GroupNonUniformPartitionedEXT\n", MakeInstruction( spv::Op::OpCapability, - {(uint32_t)spv::Capability::GroupNonUniformPartitionedNV})}, + {(uint32_t)spv::Capability::GroupNonUniformPartitionedEXT})}, // Check the new capability's token number - {"OpCapability GroupNonUniformPartitionedNV\n", + {"OpCapability GroupNonUniformPartitionedEXT\n", MakeInstruction(spv::Op::OpCapability, {5297})}, - {"%2 = OpGroupNonUniformPartitionNV %1 %3\n", - MakeInstruction(spv::Op::OpGroupNonUniformPartitionNV, {1, 2, 3})}, + {"%2 = OpGroupNonUniformPartitionEXT %1 %3\n", + MakeInstruction(spv::Op::OpGroupNonUniformPartitionEXT, + {1, 2, 3})}, // Check the new instruction's token number - {"%2 = OpGroupNonUniformPartitionNV %1 %3\n", + {"%2 = OpGroupNonUniformPartitionEXT %1 %3\n", MakeInstruction(static_cast(5296), {1, 2, 3})}, // Check the new group operations - {"%2 = OpGroupIAdd %1 %3 PartitionedReduceNV %4\n", + {"%2 = OpGroupIAdd %1 %3 PartitionedReduceEXT %4\n", MakeInstruction( spv::Op::OpGroupIAdd, - {1, 2, 3, (uint32_t)spv::GroupOperation::PartitionedReduceNV, + {1, 2, 3, (uint32_t)spv::GroupOperation::PartitionedReduceEXT, 4})}, - {"%2 = OpGroupIAdd %1 %3 PartitionedReduceNV %4\n", + {"%2 = OpGroupIAdd %1 %3 PartitionedReduceEXT %4\n", MakeInstruction(spv::Op::OpGroupIAdd, {1, 2, 3, 6, 4})}, - {"%2 = OpGroupIAdd %1 %3 PartitionedInclusiveScanNV %4\n", + {"%2 = OpGroupIAdd %1 %3 PartitionedInclusiveScanEXT %4\n", MakeInstruction( spv::Op::OpGroupIAdd, {1, 2, 3, (uint32_t)spv::GroupOperation::PartitionedInclusiveScanNV, 4})}, - {"%2 = OpGroupIAdd %1 %3 PartitionedInclusiveScanNV %4\n", + {"%2 = OpGroupIAdd %1 %3 PartitionedInclusiveScanEXT %4\n", MakeInstruction(spv::Op::OpGroupIAdd, {1, 2, 3, 7, 4})}, - {"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanNV %4\n", + {"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanEXT %4\n", MakeInstruction( spv::Op::OpGroupIAdd, {1, 2, 3, - (uint32_t)spv::GroupOperation::PartitionedExclusiveScanNV, + (uint32_t)spv::GroupOperation::PartitionedExclusiveScanEXT, 4})}, - {"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanNV %4\n", + {"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanEXT %4\n", MakeInstruction(spv::Op::OpGroupIAdd, {1, 2, 3, 8, 4})}, }))); @@ -1568,5 +1569,36 @@ INSTANTIATE_TEST_SUITE_P( }))); +// SPV_ARM_graph +INSTANTIATE_TEST_SUITE_P( + SPV_ARM_graph, ExtensionRoundTripTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_6, + SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1, SPV_ENV_VULKAN_1_2, + SPV_ENV_VULKAN_1_3, SPV_ENV_OPENCL_2_1), + ValuesIn(std::vector{ + {"OpExtension \"SPV_ARM_graph\"\n", + MakeInstruction(spv::Op::OpExtension, + MakeVector("SPV_ARM_graph"))}, + {"OpCapability GraphARM\n", + MakeInstruction(spv::Op::OpCapability, + {(uint32_t)spv::Capability::GraphARM})}, + {"%1 = OpTypeGraphARM 1 %2 %3\n", + MakeInstruction(spv::Op::OpTypeGraphARM, {1, 1, 2, 3})}, + {"%2 = OpGraphConstantARM %1 42\n", + MakeInstruction(spv::Op::OpGraphConstantARM, {1, 2, 42})}, + {"%2 = OpGraphARM %1\n", + MakeInstruction(spv::Op::OpGraphARM, {1, 2})}, + {"OpGraphEndARM\n", + MakeInstruction(spv::Op::OpGraphEndARM, {})}, + {"%2 = OpGraphInputARM %1 %3\n", + MakeInstruction(spv::Op::OpGraphInputARM, {1, 2, 3})}, + {"%2 = OpGraphInputARM %1 %3 %4\n", + MakeInstruction(spv::Op::OpGraphInputARM, {1, 2, 3, 4})}, + {"OpGraphSetOutputARM %1 %2\n", + MakeInstruction(spv::Op::OpGraphSetOutputARM, {1, 2})}, + {"OpGraphSetOutputARM %1 %2 %3\n", + MakeInstruction(spv::Op::OpGraphSetOutputARM, {1, 2, 3})}, + }))); + } // namespace } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/CMakeLists.txt b/third_party/spirv-tools/test/val/CMakeLists.txt index d481b60ca9..8932b0e091 100644 --- a/third_party/spirv-tools/test/val/CMakeLists.txt +++ b/third_party/spirv-tools/test/val/CMakeLists.txt @@ -48,6 +48,9 @@ add_spvtools_unittest(TARGET val_abcde val_extension_spv_khr_terminate_invocation_test.cpp val_extension_spv_khr_subgroup_rotate_test.cpp val_extension_spv_nv_raw_access_chains.cpp + val_extension_spv_intel_function_variants.cpp + val_extension_spv_intel_inline_assembly.cpp + val_extension_spv_ext_descriptor_heap.cpp val_ext_inst_test.cpp val_ext_inst_debug_test.cpp ${VAL_TEST_COMMON_SRCS} @@ -72,13 +75,16 @@ add_spvtools_unittest(TARGET val_limits add_spvtools_unittest(TARGET val_fghijklmnop SRCS val_function_test.cpp + val_graph_test.cpp val_id_test.cpp val_image_test.cpp val_interfaces_test.cpp val_layout_test.cpp val_literals_test.cpp + val_logical_pointers_test.cpp val_logicals_test.cpp val_memory_test.cpp + val_memory_semantics_test.cpp val_mesh_shading_test.cpp val_misc_test.cpp val_modes_test.cpp diff --git a/third_party/spirv-tools/test/val/val_arithmetics_test.cpp b/third_party/spirv-tools/test/val/val_arithmetics_test.cpp index 85653c5f19..445c579df2 100644 --- a/third_party/spirv-tools/test/val/val_arithmetics_test.cpp +++ b/third_party/spirv-tools/test/val/val_arithmetics_test.cpp @@ -1210,6 +1210,199 @@ TEST_F(ValidateArithmetics, DotBfloat16) { ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); } +std::string GenerateFmaCode(const std::string& main_body) { + const std::string prefix = + R"( +OpCapability Shader +OpCapability Int64 +OpCapability Float16 +OpCapability Float64 +OpCapability FMAKHR +OpExtension "SPV_KHR_fma" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f16 = OpTypeFloat 16 +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%f64 = OpTypeFloat 64 +%f16vec2 = OpTypeVector %f16 2 +%f32vec2 = OpTypeVector %f32 2 +%f64vec2 = OpTypeVector %f64 2 +%f16vec3 = OpTypeVector %f16 3 +%f32vec3 = OpTypeVector %f32 3 +%f64vec3 = OpTypeVector %f64 3 +%f16vec4 = OpTypeVector %f16 4 +%f32vec4 = OpTypeVector %f32 4 +%f64vec4 = OpTypeVector %f64 4 +%u32vec2 = OpTypeVector %u32 2 + +%f16_1 = OpConstant %f16 1 +%f16_2 = OpConstant %f16 2 +%f16_4 = OpConstant %f16 4 + +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_4 = OpConstant %f32 4 + +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_4 = OpConstant %f64 4 + +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_4 = OpConstant %u32 4 + +%f16vec2_12 = OpConstantComposite %f16vec2 %f16_1 %f16_2 +%f16vec2_24 = OpConstantComposite %f16vec2 %f16_2 %f16_4 +%f16vec3_124 = OpConstantComposite %f16vec3 %f16_1 %f16_2 %f16_4 +%f16vec4_1241 = OpConstantComposite %f16vec4 %f16_1 %f16_2 %f16_4 %f16_1 + +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec2_24 = OpConstantComposite %f32vec2 %f32_2 %f32_4 +%f32vec3_124 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_4 +%f32vec4_1241 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_4 %f32_1 + +%f64vec2_12 = OpConstantComposite %f64vec2 %f64_1 %f64_2 +%f64vec2_24 = OpConstantComposite %f64vec2 %f64_2 %f64_4 +%f64vec3_124 = OpConstantComposite %f64vec3 %f64_1 %f64_2 %f64_4 +%f64vec4_1241 = OpConstantComposite %f64vec4 %f64_1 %f64_2 %f64_4 %f64_1 + +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec2_24 = OpConstantComposite %u32vec2 %u32_2 %u32_4 + +%main = OpFunction %void None %func +%main_entry = OpLabel)"; + + const std::string suffix = + R"( +OpReturn +OpFunctionEnd)"; + + return prefix + main_body + suffix; +} + +TEST_F(ValidateArithmetics, FmaSuccess) { + const std::string body = R"( +%val1 = OpFmaKHR %f16 %f16_1 %f16_2 %f16_4 +%val2 = OpFmaKHR %f32 %f32_1 %f32_2 %f32_4 +%val3 = OpFmaKHR %f64 %f64_1 %f64_2 %f64_4 +%val4 = OpFmaKHR %f16vec2 %f16vec2_12 %f16vec2_24 %f16vec2_12 +%val5 = OpFmaKHR %f32vec2 %f32vec2_12 %f32vec2_24 %f32vec2_12 +%val6 = OpFmaKHR %f64vec2 %f64vec2_12 %f64vec2_24 %f64vec2_12 +%val7 = OpFmaKHR %f16vec3 %f16vec3_124 %f16vec3_124 %f16vec3_124 +%val8 = OpFmaKHR %f32vec3 %f32vec3_124 %f32vec3_124 %f32vec3_124 +%val9 = OpFmaKHR %f64vec3 %f64vec3_124 %f64vec3_124 %f64vec3_124 +%val10 = OpFmaKHR %f16vec4 %f16vec4_1241 %f16vec4_1241 %f16vec4_1241 +%val11 = OpFmaKHR %f32vec4 %f32vec4_1241 %f32vec4_1241 %f32vec4_1241 +%val12 = OpFmaKHR %f64vec4 %f64vec4_1241 %f64vec4_1241 %f64vec4_1241 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, FmaTypeIdU32) { + const std::string body = R"( +%val = OpFmaKHR %u32 %u32_1 %u32_2 %u32_4 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected floating scalar or vector type as Result Type: FmaKHR")); +} + +TEST_F(ValidateArithmetics, FmaTypeIdVec2U32) { + const std::string body = R"( +%val = OpFmaKHR %u32vec2 %u32vec2_12 %u32vec2_24 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected floating scalar or vector type as Result Type: FmaKHR")); +} + +TEST_F(ValidateArithmetics, FmaWrongOperand1) { + const std::string body = R"( +%val = OpFmaKHR %f32 %u32_1 %f32_2 %f32_4 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FmaKHR operand index 2")); +} + +TEST_F(ValidateArithmetics, FmaWrongOperand2) { + const std::string body = R"( +%val = OpFmaKHR %f32 %f32_1 %u32_2 %f32_4 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FmaKHR operand index 3")); +} + +TEST_F(ValidateArithmetics, FmaWrongOperand3) { + const std::string body = R"( +%val = OpFmaKHR %f32 %f32_1 %f32_2 %u32_4 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FmaKHR operand index 4")); +} + +TEST_F(ValidateArithmetics, FmaWrongVectorOperand1) { + const std::string body = R"( +%val = OpFmaKHR %f64vec3 %f32vec3_124 %f64vec3_124 %f64vec3_124 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FmaKHR operand index 2")); +} + +TEST_F(ValidateArithmetics, FmaWrongVectorOperand2) { + const std::string body = R"( +%val = OpFmaKHR %f32vec3 %f32vec3_124 %f64vec3_124 %f32vec3_124 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FmaKHR operand index 3")); +} + +TEST_F(ValidateArithmetics, FmaWrongVectorOperand3) { + const std::string body = R"( +%val = OpFmaKHR %f32vec3 %f32vec3_124 %f32vec3_124 %f64vec3_124 +)"; + + CompileSuccessfully(GenerateFmaCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FmaKHR operand index 4")); +} + std::string GenerateCoopMatCode(const std::string& extra_types, const std::string& main_body) { const std::string prefix = @@ -1220,6 +1413,7 @@ OpCapability CooperativeMatrixNV OpExtension "SPV_NV_cooperative_matrix" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 32 1 1 %void = OpTypeVoid %func = OpTypeFunction %void %bool = OpTypeBool @@ -1324,9 +1518,9 @@ TEST_F(ValidateArithmetics, CoopMatMatrixTimesScalarMismatchFail) { TEST_F(ValidateArithmetics, CoopMatScopeFail) { const std::string types = R"( -%device = OpConstant %u32 1 +%workgroup = OpConstant %u32 2 -%mat16x16_dv = OpTypeCooperativeMatrixNV %f16 %device %u32_16 %u32_16 +%mat16x16_dv = OpTypeCooperativeMatrixNV %f16 %workgroup %u32_16 %u32_16 %f16matdv_16x16_1 = OpConstantComposite %mat16x16_dv %f16_1 )"; @@ -1527,6 +1721,7 @@ OpExtension "SPV_NV_cooperative_matrix2" OpExtension "SPV_KHR_vulkan_memory_model" OpMemoryModel Logical Vulkan OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 32 1 1 %void = OpTypeVoid %func = OpTypeFunction %void %bool = OpTypeBool @@ -1631,8 +1826,8 @@ TEST_F(ValidateArithmetics, CoopMatMatrixKHRTimesScalarMismatchFail) { TEST_F(ValidateArithmetics, CoopMatKHRScopeFail) { const std::string types = R"( -%device = OpConstant %u32 1 -%mat16x16_dv = OpTypeCooperativeMatrixKHR %f16 %device %u32_16 %u32_16 %useC +%workgroup = OpConstant %u32 2 +%mat16x16_dv = OpTypeCooperativeMatrixKHR %f16 %workgroup %u32_16 %u32_16 %useC %f16matdv_16x16_1 = OpConstantComposite %mat16x16_dv %f16_1 )"; @@ -2056,14 +2251,14 @@ TEST_F(ValidateArithmetics, CoopVecDimFail) { TEST_F(ValidateArithmetics, CoopVecComponentTypeNotScalarNumeric) { const std::string types = R"( -%bad = OpTypeCooperativeVectorNV %bool %u32_8 +%bad = OpTypeCooperativeVectorNV %f16vec %u32_8 )"; CompileSuccessfully(GenerateCoopVecCode(types, "").c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("OpTypeCooperativeVectorNV Component Type " - "'5[%bool]' is not a scalar numerical type.")); + HasSubstr("OpTypeVectorIdEXT Component Type " + "'14[%14]' is not a scalar numerical type.")); } TEST_F(ValidateArithmetics, CoopVecDimNotConstantInt) { @@ -2074,8 +2269,8 @@ TEST_F(ValidateArithmetics, CoopVecDimNotConstantInt) { CompileSuccessfully(GenerateCoopVecCode(types, "").c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("OpTypeCooperativeVectorNV component count " - "'19[%float_1]' is not a constant integer type")); + HasSubstr("OpTypeVectorIdEXT component count type " + "'7[%float]' is not a 32-bit integer type")); } } // namespace diff --git a/third_party/spirv-tools/test/val/val_atomics_test.cpp b/third_party/spirv-tools/test/val/val_atomics_test.cpp index 4edd8840df..a243ff66d8 100644 --- a/third_party/spirv-tools/test/val/val_atomics_test.cpp +++ b/third_party/spirv-tools/test/val/val_atomics_test.cpp @@ -66,6 +66,8 @@ OpCapability Shader %acquire_release = OpConstant %u32 8 %acquire_and_release = OpConstant %u32 6 %sequentially_consistent = OpConstant %u32 16 +%acquire_uniform_workgroup = OpConstant %u32 322 +%release_uniform_workgroup = OpConstant %u32 324 %acquire_release_uniform_workgroup = OpConstant %u32 328 %f32_ptr = OpTypePointer Workgroup %f32 @@ -261,7 +263,7 @@ TEST_F(ValidateAtomics, AtomicLoadInt64KernelSuccess) { TEST_F(ValidateAtomics, AtomicLoadInt32VulkanSuccess) { const std::string body = R"( %val1 = OpAtomicLoad %u32 %u32_var %device %relaxed -%val2 = OpAtomicLoad %u32 %u32_var %workgroup %acquire +%val2 = OpAtomicLoad %u32 %u32_var %workgroup %acquire_uniform_workgroup %val3 = OpAtomicLoad %u32 %u32_var %invocation %relaxed )"; @@ -694,7 +696,7 @@ OpExtension "SPV_EXT_shader_atomic_float_min_max" TEST_F(ValidateAtomics, AtomicLoadFloatVulkan) { const std::string body = R"( %val1 = OpAtomicLoad %f32 %f32_var %device %relaxed -%val2 = OpAtomicLoad %f32 %f32_var %workgroup %acquire +%val2 = OpAtomicLoad %f32 %f32_var %workgroup %acquire_uniform_workgroup )"; CompileSuccessfully(GenerateShaderComputeCode(body), SPV_ENV_VULKAN_1_0); @@ -737,7 +739,7 @@ TEST_F(ValidateAtomics, AtomicExchangeFloatVulkan) { TEST_F(ValidateAtomics, AtomicLoadInt64WithCapabilityVulkanSuccess) { const std::string body = R"( %val1 = OpAtomicLoad %u64 %u64_var %device %relaxed - %val2 = OpAtomicLoad %u64 %u64_var %workgroup %acquire + %val2 = OpAtomicLoad %u64 %u64_var %workgroup %acquire_uniform_workgroup %val3 = OpAtomicLoad %u64 %u64_var %invocation %relaxed )"; @@ -781,7 +783,8 @@ OpAtomicStore %f32_var_function %device %relaxed %f32_1 AnyVUID("VUID-StandaloneSpirv-None-04686")); EXPECT_THAT( getDiagnosticString(), - HasSubstr("AtomicStore: Vulkan spec only allows storage classes for " + HasSubstr("AtomicStore: Function is not allowed, the Vulkan spec only " + "allows storage classes for " "atomic to be: Uniform, Workgroup, Image, StorageBuffer, " "PhysicalStorageBuffer or TaskPayloadWorkgroupEXT.")); } @@ -803,7 +806,7 @@ OpAtomicStore %f32_var_function %device %relaxed %f32_1 // reenable once fixed. TEST_F(ValidateAtomics, DISABLED_AtomicLoadVulkanSubgroup) { const std::string body = R"( -%val1 = OpAtomicLoad %u32 %u32_var %subgroup %acquire +%val1 = OpAtomicLoad %u32 %u32_var %subgroup %acquire_uniform_workgroup )"; CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); @@ -813,54 +816,9 @@ TEST_F(ValidateAtomics, DISABLED_AtomicLoadVulkanSubgroup) { "limited to Device, Workgroup and Invocation")); } -TEST_F(ValidateAtomics, AtomicLoadVulkanRelease) { - const std::string body = R"( -%val1 = OpAtomicLoad %u32 %u32_var %workgroup %release -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpAtomicLoad-04731")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics " - "Release, AcquireRelease and SequentiallyConsistent")); -} - -TEST_F(ValidateAtomics, AtomicLoadVulkanAcquireRelease) { - const std::string body = R"( -%val1 = OpAtomicLoad %u32 %u32_var %workgroup %acquire_release -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpAtomicLoad-04731")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics " - "Release, AcquireRelease and SequentiallyConsistent")); -} - -TEST_F(ValidateAtomics, AtomicLoadVulkanSequentiallyConsistent) { - const std::string body = R"( -%val1 = OpAtomicLoad %u32 %u32_var %workgroup %sequentially_consistent -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpAtomicLoad-04731")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics " - "Release, AcquireRelease and SequentiallyConsistent")); -} - TEST_F(ValidateAtomics, AtomicLoadVulkanInvocationSemantics) { const std::string body = R"( -%val1 = OpAtomicLoad %u32 %u32_var %invocation %acquire +%val1 = OpAtomicLoad %u32 %u32_var %invocation %acquire_uniform_workgroup )"; CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); @@ -870,7 +828,7 @@ TEST_F(ValidateAtomics, AtomicLoadVulkanInvocationSemantics) { EXPECT_THAT( getDiagnosticString(), HasSubstr("AtomicLoad: Vulkan specification requires Memory Semantics to " - "be None if used with Invocation Memory Scope")); + "be Relaxed if used with Invocation Memory Scope")); } TEST_F(ValidateAtomics, AtomicLoadShaderFloat) { @@ -1067,7 +1025,7 @@ OpAtomicStore %u32_var %subgroup %sequentially_consistent %u32_1 TEST_F(ValidateAtomics, AtomicStoreVulkanSuccess) { const std::string body = R"( -OpAtomicStore %u32_var %device %release %u32_1 +OpAtomicStore %u32_var %device %release_uniform_workgroup %u32_1 OpAtomicStore %u32_var %invocation %relaxed %u32_1 )"; @@ -1075,54 +1033,9 @@ OpAtomicStore %u32_var %invocation %relaxed %u32_1 ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); } -TEST_F(ValidateAtomics, AtomicStoreVulkanAcquire) { - const std::string body = R"( -OpAtomicStore %u32_var %device %acquire %u32_1 -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpAtomicStore-04730")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics " - "Acquire, AcquireRelease and SequentiallyConsistent")); -} - -TEST_F(ValidateAtomics, AtomicStoreVulkanAcquireRelease) { - const std::string body = R"( -OpAtomicStore %u32_var %device %acquire_release %u32_1 -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpAtomicStore-04730")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics " - "Acquire, AcquireRelease and SequentiallyConsistent")); -} - -TEST_F(ValidateAtomics, AtomicStoreVulkanSequentiallyConsistent) { - const std::string body = R"( -OpAtomicStore %u32_var %device %sequentially_consistent %u32_1 -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpAtomicStore-04730")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics " - "Acquire, AcquireRelease and SequentiallyConsistent")); -} - TEST_F(ValidateAtomics, AtomicStoreVulkanInvocationSemantics) { const std::string body = R"( -OpAtomicStore %u32_var %invocation %acquire %u32_1 +OpAtomicStore %u32_var %invocation %release_uniform_workgroup %u32_1 )"; CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); @@ -1132,7 +1045,7 @@ OpAtomicStore %u32_var %invocation %acquire %u32_1 EXPECT_THAT( getDiagnosticString(), HasSubstr("AtomicStore: Vulkan specification requires Memory Semantics " - "to be None if used with Invocation Memory Scope")); + "to be Relaxed if used with Invocation Memory Scope")); } TEST_F(ValidateAtomics, AtomicStoreWrongPointerType) { @@ -1169,7 +1082,8 @@ OpAtomicStore %f32_im_var %device %relaxed %f32_1 ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_OPENCL_1_2)); EXPECT_THAT( getDiagnosticString(), - HasSubstr("AtomicStore: storage class must be Function, Workgroup, " + HasSubstr("AtomicStore: storage class is Image, but must be Function, " + "Workgroup, " "CrossWorkGroup or Generic in the OpenCL environment.")); } @@ -1181,8 +1095,8 @@ OpAtomicStore %f32_uc_var %device %relaxed %f32_1 CompileSuccessfully(GenerateKernelCode(body)); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("AtomicStore: storage class forbidden by universal " - "validation rules.")); + HasSubstr("AtomicStore: Can not be used with storage class " + "UniformConstant by universal validation rules")); } TEST_F(ValidateAtomics, AtomicStoreWrongScopeType) { @@ -1337,7 +1251,7 @@ OpAtomicStore %f32_var %device %relaxed %f32_1 TEST_F(ValidateAtomics, AtomicExchangeVulkanInvocationSemantics) { const std::string body = R"( OpAtomicStore %u32_var %invocation %relaxed %u32_1 -%val2 = OpAtomicExchange %u32 %u32_var %invocation %acquire %u32_0 +%val2 = OpAtomicExchange %u32 %u32_var %invocation %acquire_uniform_workgroup %u32_0 )"; CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); @@ -1346,8 +1260,9 @@ OpAtomicStore %u32_var %invocation %relaxed %u32_1 AnyVUID("VUID-StandaloneSpirv-None-04641")); EXPECT_THAT( getDiagnosticString(), - HasSubstr("AtomicExchange: Vulkan specification requires Memory " - "Semantics to be None if used with Invocation Memory Scope")); + HasSubstr( + "AtomicExchange: Vulkan specification requires Memory Semantics to " + "be Relaxed if used with Invocation Memory Scope")); } TEST_F(ValidateAtomics, AtomicCompareExchangeShaderSuccess) { @@ -1469,9 +1384,10 @@ OpAtomicStore %u32_var %device %relaxed %u32_1 CompileSuccessfully(GenerateKernelCode(body)); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("AtomicCompareExchange: Memory Semantics Release and " - "AcquireRelease cannot be used for operand Unequal")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicCompareExchange Unequal Memory Semantics must not use " + "Release or AcquireRelease memory order")); } TEST_F(ValidateAtomics, AtomicCompareExchangeWrongValueType) { @@ -1526,7 +1442,7 @@ OpAtomicStore %f32_var %device %relaxed %f32_1 TEST_F(ValidateAtomics, AtomicCompareExchangeVulkanInvocationSemanticsEqual) { const std::string body = R"( OpAtomicStore %u32_var %device %relaxed %u32_1 -%val2 = OpAtomicCompareExchange %u32 %u32_var %invocation %release %relaxed %u32_0 %u32_0 +%val2 = OpAtomicCompareExchange %u32 %u32_var %invocation %release_uniform_workgroup %relaxed %u32_0 %u32_0 )"; CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); @@ -1535,14 +1451,15 @@ OpAtomicStore %u32_var %device %relaxed %u32_1 AnyVUID("VUID-StandaloneSpirv-None-04641")); EXPECT_THAT( getDiagnosticString(), - HasSubstr("AtomicCompareExchange: Vulkan specification requires Memory " - "Semantics to be None if used with Invocation Memory Scope")); + HasSubstr( + "AtomicCompareExchange: Vulkan specification requires Memory " + "Semantics to be Relaxed if used with Invocation Memory Scope")); } TEST_F(ValidateAtomics, AtomicCompareExchangeVulkanInvocationSemanticsUnequal) { const std::string body = R"( OpAtomicStore %u32_var %device %relaxed %u32_1 -%val2 = OpAtomicCompareExchange %u32 %u32_var %invocation %relaxed %acquire %u32_0 %u32_0 +%val2 = OpAtomicCompareExchange %u32 %u32_var %invocation %acquire_uniform_workgroup %acquire_uniform_workgroup %u32_0 %u32_0 )"; CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); @@ -1551,8 +1468,9 @@ OpAtomicStore %u32_var %device %relaxed %u32_1 AnyVUID("VUID-StandaloneSpirv-None-04641")); EXPECT_THAT( getDiagnosticString(), - HasSubstr("AtomicCompareExchange: Vulkan specification requires Memory " - "Semantics to be None if used with Invocation Memory Scope")); + HasSubstr( + "AtomicCompareExchange: Vulkan specification requires Memory " + "Semantics to be Relaxed if used with Invocation Memory Scope")); } TEST_F(ValidateAtomics, AtomicArithmeticsSuccess) { @@ -1666,9 +1584,10 @@ OpAtomicFlagClear %u32_var %device %acquire CompileSuccessfully(GenerateKernelCode(body)); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Memory Semantics Acquire and AcquireRelease cannot be " - "used with AtomicFlagClear")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicFlagClear: MemorySemantics must not use Acquire or " + "AcquireRelease memory order with AtomicFlagClear")); } TEST_F(ValidateAtomics, AtomicFlagClearNotPointer) { @@ -1743,9 +1662,8 @@ OpAtomicStore %u32_var %device %relaxed %u32_1 CompileSuccessfully(GenerateKernelCode(body)); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("AtomicIIncrement: Memory Semantics can have at most " - "one of the following bits set: Acquire, Release, " - "AcquireRelease or SequentiallyConsistent")); + HasSubstr("AtomicIIncrement: Memory Semantics must have at most " + "one non-relaxed memory order bit set")); } TEST_F(ValidateAtomics, AtomicUniformMemorySemanticsShader) { @@ -1794,357 +1712,6 @@ OpAtomicStore %u32_var %device %relaxed %u32_1 ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); } -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicLoad) { - const std::string body = R"( -%ld = OpAtomicLoad %u32 %u32_var %workgroup %sequentially_consistent -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicStore) { - const std::string body = R"( -OpAtomicStore %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, - VulkanMemoryModelBanSequentiallyConsistentAtomicExchange) { - const std::string body = R"( -%ex = OpAtomicExchange %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, - VulkanMemoryModelBanSequentiallyConsistentAtomicCompareExchangeEqual) { - const std::string body = R"( -%ex = OpAtomicCompareExchange %u32 %u32_var %workgroup %sequentially_consistent %relaxed %u32_0 %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, - VulkanMemoryModelBanSequentiallyConsistentAtomicCompareExchangeUnequal) { - const std::string body = R"( -%ex = OpAtomicCompareExchange %u32 %u32_var %workgroup %relaxed %sequentially_consistent %u32_0 %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, - VulkanMemoryModelBanSequentiallyConsistentAtomicIIncrement) { - const std::string body = R"( -%inc = OpAtomicIIncrement %u32 %u32_var %workgroup %sequentially_consistent -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, - VulkanMemoryModelBanSequentiallyConsistentAtomicIDecrement) { - const std::string body = R"( -%dec = OpAtomicIDecrement %u32 %u32_var %workgroup %sequentially_consistent -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicIAdd) { - const std::string body = R"( -%add = OpAtomicIAdd %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicISub) { - const std::string body = R"( -%sub = OpAtomicISub %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicSMin) { - const std::string body = R"( -%min = OpAtomicSMin %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicUMin) { - const std::string body = R"( -%min = OpAtomicUMin %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicFMinEXT) { - const std::string body = R"( -%max = OpAtomicFMinEXT %f32 %f32_var %workgroup %sequentially_consistent %f32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpCapability AtomicFloat32MinMaxEXT -OpExtension "SPV_KHR_vulkan_memory_model" -OpExtension "SPV_EXT_shader_atomic_float_min_max" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicSMax) { - const std::string body = R"( -%max = OpAtomicSMax %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicUMax) { - const std::string body = R"( -%max = OpAtomicUMax %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicFMaxEXT) { - const std::string body = R"( -%max = OpAtomicFMaxEXT %f32 %f32_var %workgroup %sequentially_consistent %f32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpCapability AtomicFloat32MinMaxEXT -OpExtension "SPV_KHR_vulkan_memory_model" -OpExtension "SPV_EXT_shader_atomic_float_min_max" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicAnd) { - const std::string body = R"( -%and = OpAtomicAnd %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicOr) { - const std::string body = R"( -%or = OpAtomicOr %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateAtomics, VulkanMemoryModelBanSequentiallyConsistentAtomicXor) { - const std::string body = R"( -%xor = OpAtomicXor %u32 %u32_var %workgroup %sequentially_consistent %u32_0 -)"; - - const std::string extra = R"( -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -)"; - - CompileSuccessfully(GenerateShaderCode(body, extra, "", "VulkanKHR"), - SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - TEST_F(ValidateAtomics, OutputMemoryKHRRequiresVulkanMemoryModelKHR) { const std::string text = R"( OpCapability Shader @@ -2226,130 +1793,6 @@ OpFunctionEnd "capability VulkanMemoryModelKHR")); } -TEST_F(ValidateAtomics, MakeAvailableKHRRequiresReleaseSemantics) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %1 "func" -OpExecutionMode %1 OriginUpperLeft -%2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%semantics = OpConstant %3 8448 -%5 = OpTypeFunction %2 -%workgroup = OpConstant %3 2 -%ptr = OpTypePointer Workgroup %3 -%var = OpVariable %ptr Workgroup -%1 = OpFunction %2 None %5 -%7 = OpLabel -OpAtomicStore %var %workgroup %semantics %workgroup -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("AtomicStore: MakeAvailableKHR Memory Semantics also requires " - "either Release or AcquireRelease Memory Semantics")); -} - -TEST_F(ValidateAtomics, MakeVisibleKHRRequiresAcquireSemantics) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %1 "func" -OpExecutionMode %1 OriginUpperLeft -%2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%semantics = OpConstant %3 16640 -%5 = OpTypeFunction %2 -%workgroup = OpConstant %3 2 -%ptr = OpTypePointer Workgroup %3 -%var = OpVariable %ptr Workgroup -%1 = OpFunction %2 None %5 -%7 = OpLabel -%ld = OpAtomicLoad %3 %var %workgroup %semantics -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("AtomicLoad: MakeVisibleKHR Memory Semantics also requires " - "either Acquire or AcquireRelease Memory Semantics")); -} - -TEST_F(ValidateAtomics, MakeAvailableKHRRequiresStorageSemantics) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %1 "func" -OpExecutionMode %1 OriginUpperLeft -%2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%semantics = OpConstant %3 8196 -%5 = OpTypeFunction %2 -%workgroup = OpConstant %3 2 -%ptr = OpTypePointer Workgroup %3 -%var = OpVariable %ptr Workgroup -%1 = OpFunction %2 None %5 -%7 = OpLabel -OpAtomicStore %var %workgroup %semantics %workgroup -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr( - "AtomicStore: expected Memory Semantics to include a storage class")); -} - -TEST_F(ValidateAtomics, MakeVisibleKHRRequiresStorageSemantics) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %1 "func" -OpExecutionMode %1 OriginUpperLeft -%2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%semantics = OpConstant %3 16386 -%5 = OpTypeFunction %2 -%workgroup = OpConstant %3 2 -%ptr = OpTypePointer Workgroup %3 -%var = OpVariable %ptr Workgroup -%1 = OpFunction %2 None %5 -%7 = OpLabel -%ld = OpAtomicLoad %3 %var %workgroup %semantics -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr( - "AtomicLoad: expected Memory Semantics to include a storage class")); -} - TEST_F(ValidateAtomics, VulkanMemoryModelAllowsQueueFamilyKHR) { const std::string body = R"( %val = OpAtomicAnd %u32 %u32_var %queuefamily %relaxed %u32_1 @@ -2374,8 +1817,8 @@ TEST_F(ValidateAtomics, NonVulkanMemoryModelDisallowsQueueFamilyKHR) { EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1)); EXPECT_THAT(getDiagnosticString(), HasSubstr("AtomicAnd: Memory Scope QueueFamilyKHR requires " - "capability VulkanMemoryModelKHR\n %42 = OpAtomicAnd " - "%uint %29 %uint_5 %uint_0_1 %uint_1\n")); + "capability VulkanMemoryModelKHR\n %44 = OpAtomicAnd " + "%uint %31 %uint_5 %uint_0_1 %uint_1\n")); } TEST_F(ValidateAtomics, SemanticsSpecConstantShader) { @@ -2536,64 +1979,6 @@ TEST_F(ValidateAtomics, CompareExchangeWeakV14Bad) { "AtomicCompareExchangeWeak requires SPIR-V version 1.3 or earlier")); } -TEST_F(ValidateAtomics, CompareExchangeVolatileMatch) { - const std::string spirv = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpCapability Linkage -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -%void = OpTypeVoid -%int = OpTypeInt 32 0 -%int_0 = OpConstant %int 0 -%int_1 = OpConstant %int 1 -%workgroup = OpConstant %int 2 -%volatile = OpConstant %int 32768 -%ptr_wg_int = OpTypePointer Workgroup %int -%wg_var = OpVariable %ptr_wg_int Workgroup -%void_fn = OpTypeFunction %void -%func = OpFunction %void None %void_fn -%entry = OpLabel -%cmp_ex = OpAtomicCompareExchange %int %wg_var %workgroup %volatile %volatile %int_0 %int_1 -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); -} - -TEST_F(ValidateAtomics, CompareExchangeVolatileMismatch) { - const std::string spirv = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpCapability Linkage -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -%void = OpTypeVoid -%int = OpTypeInt 32 0 -%int_0 = OpConstant %int 0 -%int_1 = OpConstant %int 1 -%workgroup = OpConstant %int 2 -%volatile = OpConstant %int 32768 -%non_volatile = OpConstant %int 0 -%ptr_wg_int = OpTypePointer Workgroup %int -%wg_var = OpVariable %ptr_wg_int Workgroup -%void_fn = OpTypeFunction %void -%func = OpFunction %void None %void_fn -%entry = OpLabel -%cmp_ex = OpAtomicCompareExchange %int %wg_var %workgroup %non_volatile %volatile %int_0 %int_1 -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Volatile mask setting must match for Equal and " - "Unequal memory semantics")); -} - TEST_F(ValidateAtomics, CompareExchangeVolatileMismatchCooperativeMatrix) { const std::string spirv = R"( OpCapability Shader diff --git a/third_party/spirv-tools/test/val/val_barriers_test.cpp b/third_party/spirv-tools/test/val/val_barriers_test.cpp index bd84353e64..6f2cb45b85 100644 --- a/third_party/spirv-tools/test/val/val_barriers_test.cpp +++ b/third_party/spirv-tools/test/val/val_barriers_test.cpp @@ -469,7 +469,7 @@ OpControlBarrier %workgroup %invocation %none TEST_F(ValidateBarriers, OpControlBarrierVulkanInvocationFailure) { const std::string body = R"( -OpControlBarrier %workgroup %invocation %acquire +OpControlBarrier %workgroup %invocation %acquire_uniform_workgroup )"; CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); @@ -478,8 +478,9 @@ OpControlBarrier %workgroup %invocation %acquire AnyVUID("VUID-StandaloneSpirv-None-04641")); EXPECT_THAT( getDiagnosticString(), - HasSubstr("ControlBarrier: Vulkan specification requires Memory " - "Semantics to be None if used with Invocation Memory Scope")); + HasSubstr( + "ControlBarrier: Vulkan specification requires Memory " + "Semantics to be Relaxed if used with Invocation Memory Scope")); } TEST_F(ValidateBarriers, OpControlBarrierAcquireAndRelease) { @@ -490,58 +491,8 @@ OpControlBarrier %device %device %acquire_and_release_uniform CompileSuccessfully(GenerateShaderCode(body)); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("ControlBarrier: Memory Semantics can have at most one " - "of the following bits set: Acquire, Release, " - "AcquireRelease or SequentiallyConsistent")); -} - -TEST_F(ValidateBarriers, OpControlBarrierVulkanSubgroupStorageClass) { - const std::string body = R"( -OpControlBarrier %workgroup %device %acquire_release_subgroup -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpControlBarrier-04650")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr( - "ControlBarrier: expected Memory Semantics to include a " - "Vulkan-supported storage class if Memory Semantics is not None")); -} - -TEST_F(ValidateBarriers, OpControlBarrierVulkanAcquireRelease) { - const std::string body = R"( -OpControlBarrier %workgroup %device %acquire_release -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpControlBarrier-04650")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr( - "ControlBarrier: expected Memory Semantics to include a " - "Vulkan-supported storage class if Memory Semantics is not None")); -} - -TEST_F(ValidateBarriers, OpControlBarrierVulkanWorkgroupMemory) { - const std::string body = R"( -OpControlBarrier %workgroup %workgroup %workgroup_memory -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpControlBarrier-10609")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr( - "ControlBarrier: Vulkan specification requires non-zero " - "Memory Semantics to have one of the following bits set: Acquire, " - "Release, AcquireRelease or SequentiallyConsistent")); + HasSubstr("ControlBarrier: Memory Semantics must have at most " + "one non-relaxed memory order bit set")); } TEST_F(ValidateBarriers, OpControlBarrierSubgroupExecutionFragment1p1) { @@ -832,53 +783,8 @@ OpMemoryBarrier %device %acquire_and_release_uniform CompileSuccessfully(GenerateShaderCode(body)); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("MemoryBarrier: Memory Semantics can have at most one " - "of the following bits set: Acquire, Release, " - "AcquireRelease or SequentiallyConsistent")); -} - -TEST_F(ValidateBarriers, OpMemoryBarrierVulkanMemorySemanticsNone) { - const std::string body = R"( -OpMemoryBarrier %device %none -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04732")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("MemoryBarrier: Vulkan specification requires Memory Semantics " - "to have one of the following bits set: Acquire, Release, " - "AcquireRelease or SequentiallyConsistent")); -} - -TEST_F(ValidateBarriers, OpMemoryBarrierVulkanMemorySemanticsAcquire) { - const std::string body = R"( -OpMemoryBarrier %device %acquire -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04733")); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("MemoryBarrier: expected Memory Semantics to include a " - "Vulkan-supported storage class")); -} - -TEST_F(ValidateBarriers, OpMemoryBarrierVulkanSubgroupStorageClass) { - const std::string body = R"( -OpMemoryBarrier %device %acquire_release_subgroup -)"; - - CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); - ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04733")); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("MemoryBarrier: expected Memory Semantics to include a " - "Vulkan-supported storage class")); + HasSubstr("MemoryBarrier: Memory Semantics must have at most one " + "non-relaxed memory order bit set")); } TEST_F(ValidateBarriers, OpNamedBarrierInitializeSuccess) { @@ -991,9 +897,8 @@ OpMemoryNamedBarrier %barrier %workgroup %acquire_and_release ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); EXPECT_THAT(getDiagnosticString(), - HasSubstr("MemoryNamedBarrier: Memory Semantics can have at most " - "one of the following bits set: Acquire, Release, " - "AcquireRelease or SequentiallyConsistent")); + HasSubstr("MemoryNamedBarrier: Memory Semantics must have " + "at most one non-relaxed memory order bit set")); } TEST_F(ValidateBarriers, TypeAsMemoryScope) { @@ -1007,64 +912,6 @@ OpMemoryBarrier %u32 %u32_0 "type")); } -TEST_F(ValidateBarriers, - OpControlBarrierVulkanMemoryModelBanSequentiallyConsistent) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %1 "func" -OpExecutionMode %1 OriginUpperLeft -%2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%4 = OpConstant %3 16 -%5 = OpTypeFunction %2 -%6 = OpConstant %3 5 -%1 = OpFunction %2 None %5 -%7 = OpLabel -OpControlBarrier %6 %6 %4 -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - -TEST_F(ValidateBarriers, - OpMemoryBarrierVulkanMemoryModelBanSequentiallyConsistent) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %1 "func" -OpExecutionMode %1 OriginUpperLeft -%2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%4 = OpConstant %3 16 -%5 = OpTypeFunction %2 -%6 = OpConstant %3 5 -%1 = OpFunction %2 None %5 -%7 = OpLabel -OpMemoryBarrier %6 %4 -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("SequentiallyConsistent memory semantics cannot be " - "used with the VulkanKHR memory model.")); -} - TEST_F(ValidateBarriers, OutputMemoryKHRRequireVulkanMemoryModelKHR) { const std::string text = R"( OpCapability Shader @@ -1140,120 +987,6 @@ OpFunctionEnd "requires capability VulkanMemoryModelKHR")); } -TEST_F(ValidateBarriers, MakeAvailableKHRRequiresReleaseSemantics) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %func "func" -OpExecutionMode %func OriginUpperLeft -%void = OpTypeVoid -%int = OpTypeInt 32 0 -%workgroup = OpConstant %int 2 -%semantics = OpConstant %int 8448 -%functy = OpTypeFunction %void -%func = OpFunction %void None %functy -%1 = OpLabel -OpControlBarrier %workgroup %workgroup %semantics -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("ControlBarrier: MakeAvailableKHR Memory Semantics also " - "requires either Release or AcquireRelease Memory Semantics")); -} - -TEST_F(ValidateBarriers, MakeVisibleKHRRequiresAcquireSemantics) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %func "func" -OpExecutionMode %func OriginUpperLeft -%void = OpTypeVoid -%int = OpTypeInt 32 0 -%workgroup = OpConstant %int 2 -%semantics = OpConstant %int 16640 -%functy = OpTypeFunction %void -%func = OpFunction %void None %functy -%1 = OpLabel -OpControlBarrier %workgroup %workgroup %semantics -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("ControlBarrier: MakeVisibleKHR Memory Semantics also requires " - "either Acquire or AcquireRelease Memory Semantics")); -} - -TEST_F(ValidateBarriers, MakeAvailableKHRRequiresStorageSemantics) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %func "func" -OpExecutionMode %func OriginUpperLeft -%void = OpTypeVoid -%int = OpTypeInt 32 0 -%workgroup = OpConstant %int 2 -%semantics = OpConstant %int 8196 -%functy = OpTypeFunction %void -%func = OpFunction %void None %functy -%1 = OpLabel -OpMemoryBarrier %workgroup %semantics -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("MemoryBarrier: expected Memory Semantics to include a " - "storage class")); -} - -TEST_F(ValidateBarriers, MakeVisibleKHRRequiresStorageSemantics) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -OpEntryPoint Fragment %func "func" -OpExecutionMode %func OriginUpperLeft -%void = OpTypeVoid -%int = OpTypeInt 32 0 -%workgroup = OpConstant %int 2 -%semantics = OpConstant %int 16386 -%functy = OpTypeFunction %void -%func = OpFunction %void None %functy -%1 = OpLabel -OpMemoryBarrier %workgroup %semantics -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("MemoryBarrier: expected Memory Semantics to include a " - "storage class")); -} - TEST_F(ValidateBarriers, SemanticsSpecConstantShader) { const std::string spirv = R"( OpCapability Shader @@ -1365,7 +1098,7 @@ OpExecutionMode %func OriginUpperLeft %void = OpTypeVoid %int = OpTypeInt 32 0 %device = OpConstant %int 1 -%semantics = OpConstant %int 0 +%semantics = OpConstant %int 72 %functy = OpTypeFunction %void %func = OpFunction %void None %functy %1 = OpLabel @@ -1395,7 +1128,7 @@ OpExecutionMode %func OriginUpperLeft %void = OpTypeVoid %int = OpTypeInt 32 0 %device = OpConstant %int 1 -%semantics = OpConstant %int 0 +%semantics = OpConstant %int 72 %functy = OpTypeFunction %void %func = OpFunction %void None %functy %1 = OpLabel @@ -1408,62 +1141,6 @@ OpFunctionEnd EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); } -TEST_F(ValidateBarriers, VolatileMemoryBarrier) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpCapability VulkanMemoryModelDeviceScopeKHR -OpCapability Linkage -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -%void = OpTypeVoid -%int = OpTypeInt 32 0 -%device = OpConstant %int 1 -%semantics = OpConstant %int 32768 -%functy = OpTypeFunction %void -%func = OpFunction %void None %functy -%1 = OpLabel -OpMemoryBarrier %device %semantics -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Memory Semantics Volatile can only be used with " - "atomic instructions")); -} - -TEST_F(ValidateBarriers, VolatileControlBarrier) { - const std::string text = R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -OpCapability VulkanMemoryModelDeviceScopeKHR -OpCapability Linkage -OpExtension "SPV_KHR_vulkan_memory_model" -OpMemoryModel Logical VulkanKHR -%void = OpTypeVoid -%int = OpTypeInt 32 0 -%device = OpConstant %int 1 -%semantics = OpConstant %int 32768 -%functy = OpTypeFunction %void -%func = OpFunction %void None %functy -%1 = OpLabel -OpControlBarrier %device %device %semantics -OpReturn -OpFunctionEnd -)"; - - CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); - EXPECT_EQ(SPV_ERROR_INVALID_DATA, - ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Memory Semantics Volatile can only be used with " - "atomic instructions")); -} - TEST_F(ValidateBarriers, CooperativeMatrixSpecConstantVolatile) { const std::string text = R"( OpCapability Shader diff --git a/third_party/spirv-tools/test/val/val_builtins_test.cpp b/third_party/spirv-tools/test/val/val_builtins_test.cpp index 1e5a948f1c..27b86d740c 100644 --- a/third_party/spirv-tools/test/val/val_builtins_test.cpp +++ b/third_party/spirv-tools/test/val/val_builtins_test.cpp @@ -26,8 +26,6 @@ #include #include "gmock/gmock.h" -#include "source/spirv_target_env.h" -#include "test/unit_spirv.h" #include "test/val/val_code_generator.h" #include "test/val/val_fixtures.h" @@ -99,6 +97,10 @@ CodeGenerator GetInMainCodeGenerator(const char* const built_in, generator.before_types_ += built_in; generator.before_types_ += "\n"; + if (strncmp(built_in, "TessLevel", 9) == 0) { + generator.before_types_ += "OpMemberDecorate %built_in_type 0 Patch\n"; + } + std::ostringstream after_types; after_types << "%built_in_type = OpTypeStruct " << data_type << "\n"; @@ -139,7 +141,11 @@ CodeGenerator GetInMainCodeGenerator(const char* const built_in, execution_modes << "OpExecutionMode %" << entry_point.name << " OutputPoints\n"; } - if (0 == std::strcmp(execution_model, "GLCompute")) { + if (0 == std::strcmp(execution_model, "GLCompute") || + 0 == std::strcmp(execution_model, "MeshEXT") || + 0 == std::strcmp(execution_model, "MeshNV") || + 0 == std::strcmp(execution_model, "MeshEXT") || + 0 == std::strcmp(execution_model, "TaskNV")) { execution_modes << "OpExecutionMode %" << entry_point.name << " LocalSize 1 1 1\n"; } @@ -258,6 +264,10 @@ CodeGenerator GetInFunctionCodeGenerator(const char* const built_in, generator.before_types_ += built_in; generator.before_types_ += "\n"; + if (strncmp(built_in, "TessLevel", 9) == 0) { + generator.before_types_ += "OpMemberDecorate %built_in_type 0 Patch\n"; + } + std::ostringstream after_types; after_types << "%built_in_type = OpTypeStruct " << data_type << "\n"; if (InitializerRequired(storage_class)) { @@ -297,7 +307,11 @@ CodeGenerator GetInFunctionCodeGenerator(const char* const built_in, execution_modes << "OpExecutionMode %" << entry_point.name << " OutputPoints\n"; } - if (0 == std::strcmp(execution_model, "GLCompute")) { + if (0 == std::strcmp(execution_model, "GLCompute") || + 0 == std::strcmp(execution_model, "MeshEXT") || + 0 == std::strcmp(execution_model, "MeshNV") || + 0 == std::strcmp(execution_model, "MeshEXT") || + 0 == std::strcmp(execution_model, "TaskNV")) { execution_modes << "OpExecutionMode %" << entry_point.name << " LocalSize 1 1 1\n"; } @@ -395,6 +409,11 @@ CodeGenerator GetVariableCodeGenerator(const char* const built_in, generator.before_types_ = "OpDecorate %built_in_var BuiltIn "; generator.before_types_ += built_in; generator.before_types_ += "\n"; + + if (strncmp(built_in, "TessLevel", 9) == 0) { + generator.before_types_ += "OpDecorate %built_in_var Patch\n"; + } + if ((0 == std::strcmp(storage_class, "Input")) && (0 == std::strcmp(execution_model, "Fragment"))) { // ensure any needed input types that might require Flat @@ -423,7 +442,7 @@ CodeGenerator GetVariableCodeGenerator(const char* const built_in, } // Any kind of reference would do. entry_point.body = R"( -%val = OpBitcast %u32 %built_in_var +%val = OpCopyObject %built_in_ptr %built_in_var )"; std::ostringstream execution_modes; @@ -441,7 +460,11 @@ CodeGenerator GetVariableCodeGenerator(const char* const built_in, execution_modes << "OpExecutionMode %" << entry_point.name << " OutputPoints\n"; } - if (0 == std::strcmp(execution_model, "GLCompute")) { + if (0 == std::strcmp(execution_model, "GLCompute") || + 0 == std::strcmp(execution_model, "MeshEXT") || + 0 == std::strcmp(execution_model, "MeshNV") || + 0 == std::strcmp(execution_model, "MeshEXT") || + 0 == std::strcmp(execution_model, "TaskNV")) { execution_modes << "OpExecutionMode %" << entry_point.name << " LocalSize 1 1 1\n"; } @@ -846,6 +869,45 @@ INSTANTIATE_TEST_SUITE_P( "needs to be a 3-component 32-bit int vector", "has components with bit width 64")))); +INSTANTIATE_TEST_SUITE_P( + LocalInvocationIndexSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("LocalInvocationIndex"), Values("GLCompute"), + Values("Input"), Values("%u32"), Values(nullptr), + Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + LocalInvocationIndexNotGLCompute, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("LocalInvocationIndex"), + Values("Vertex", "Fragment", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32"), + Values("VUID-LocalInvocationIndex-LocalInvocationIndex-04284"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with GLCompute, MeshNV, " + "TaskNV, MeshEXT or TaskEXT execution model")))); + +INSTANTIATE_TEST_SUITE_P( + LocalInvocationIndexNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("LocalInvocationIndex"), Values("GLCompute"), + Values("Output"), Values("%u32"), + Values("VUID-LocalInvocationIndex-LocalInvocationIndex-04285"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output")))); + +INSTANTIATE_TEST_SUITE_P( + LocalInvocationIndexNot32Int, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("LocalInvocationIndex"), Values("GLCompute"), + Values("Input"), Values("%u32vec3", "%f32"), + Values("VUID-LocalInvocationIndex-LocalInvocationIndex-04286"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar")))); + INSTANTIATE_TEST_SUITE_P( InvocationIdSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, @@ -2635,7 +2697,7 @@ CodeGenerator GetArrayedVariableCodeGenerator(const char* const built_in, entry_point.interfaces = "%built_in_var"; // Any kind of reference would do. entry_point.body = R"( -%val = OpBitcast %u32 %built_in_var +%val = OpCopyObject %built_in_ptr %built_in_var )"; std::ostringstream execution_modes; @@ -2653,7 +2715,11 @@ CodeGenerator GetArrayedVariableCodeGenerator(const char* const built_in, execution_modes << "OpExecutionMode %" << entry_point.name << " OutputPoints\n"; } - if (0 == std::strcmp(execution_model, "GLCompute")) { + if (0 == std::strcmp(execution_model, "GLCompute") || + 0 == std::strcmp(execution_model, "MeshEXT") || + 0 == std::strcmp(execution_model, "MeshNV") || + 0 == std::strcmp(execution_model, "MeshEXT") || + 0 == std::strcmp(execution_model, "TaskNV")) { execution_modes << "OpExecutionMode %" << entry_point.name << " LocalSize 1 1 1\n"; } @@ -3565,6 +3631,7 @@ OpDecorate %gl_ViewportIndex PerPrimitiveNV EntryPoint entry_point; entry_point.name = "main_d_r"; entry_point.execution_model = "MeshNV"; + entry_point.execution_modes = "OpExecutionMode %main_d_r LocalSize 1 1 1"; entry_point.interfaces = "%gl_PrimitiveID %gl_Layer %gl_ViewportIndex"; generator.entry_points_.push_back(std::move(entry_point)); @@ -3603,7 +3670,9 @@ OpDecorate %gl_ViewportIndex PerPrimitiveNV EntryPoint entry_point; entry_point.name = "main_d_r"; entry_point.execution_model = "MeshNV"; + entry_point.execution_modes = "OpExecutionMode %main_d_r LocalSize 1 1 1"; entry_point.interfaces = "%gl_PrimitiveID %gl_Layer %gl_ViewportIndex"; + entry_point.body = "%ref_load = OpLoad %_arr_float_uint_81 %gl_PrimitiveID"; generator.entry_points_.push_back(std::move(entry_point)); CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_1); @@ -4655,6 +4724,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinPrimtiveIDWithPerPrimitiveEXT) { %gl_PrimitiveID = OpVariable %_ptr_Output__arr_int_int_1 Output %MainMesh = OpFunction %void None %9 %25 = OpLabel +%ref_load = OpLoad %_arr_int_int_1 %gl_PrimitiveID OpSetMeshOutputsEXT %uint_3 %uint_1 OpReturn OpFunctionEnd @@ -4701,6 +4771,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinViewportIndexWithPerPrimitiveEXT) { %gl_ViewportIndex = OpVariable %_ptr_Output__arr_int_int_1 Output %MainMesh = OpFunction %void None %9 %25 = OpLabel +%ref_load = OpLoad %_arr_int_int_1 %gl_ViewportIndex OpSetMeshOutputsEXT %uint_3 %uint_1 OpReturn OpFunctionEnd @@ -4983,6 +5054,59 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinPrimitiveTriangleIndicesEXT) { "PrimitiveTriangleIndicesEXT-07054")); } +// https://github.com/KhronosGroup/SPIRV-Tools/issues/6307 +TEST_F(ValidateBuiltIns, VulkanBuiltinPrimitiveTriangleIndicesMultiEntrypoint) { + const std::string text = R"( + OpCapability Shader + OpCapability MeshShadingEXT + OpCapability VulkanMemoryModel + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical Vulkan + OpEntryPoint MeshEXT %1 "mesh" %positions %indices + OpEntryPoint Fragment %4 "frag" %color + OpExecutionMode %1 LocalSize 1 1 1 + OpExecutionMode %1 OutputVertices 3 + OpExecutionMode %1 OutputPrimitivesEXT 1 + OpExecutionMode %1 OutputTrianglesEXT + OpExecutionMode %4 OriginUpperLeft + OpDecorate %_arr_v4float_uint_3 ArrayStride 16 + OpDecorate %_arr_v3uint_uint_1 ArrayStride 16 + OpDecorate %positions BuiltIn Position + OpDecorate %indices BuiltIn PrimitiveTriangleIndicesEXT + OpDecorate %color Location 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%_arr_v3uint_uint_1 = OpTypeArray %v3uint %uint_1 +%_ptr_Output__arr_v3uint_uint_1 = OpTypePointer Output %_arr_v3uint_uint_1 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %positions = OpVariable %_ptr_Output__arr_v4float_uint_3 Output + %indices = OpVariable %_ptr_Output__arr_v3uint_uint_1 Output + %color = OpVariable %_ptr_Output_v4float Output + %1 = OpFunction %void None %18 + %21 = OpLabel + OpSetMeshOutputsEXT %uint_0 %uint_0 + OpNoLine + OpReturn + OpFunctionEnd + %4 = OpFunction %void None %18 + %22 = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + TEST_F(ValidateBuiltIns, BadVulkanPrimitivePointIndicesArraySizeMeshEXT) { const std::string text = R"( OpCapability MeshShadingEXT @@ -5123,6 +5247,320 @@ TEST_F(ValidateBuiltIns, BadVulkanPrimitiveTriangleIndicesArraySizeMeshEXT) { "PrimitiveTriangleIndicesEXT-07058")); } +// https://godbolt.org/z/xqsMqqnxd +TEST_F(ValidateBuiltIns, VulkanMeshMultipleTopology) { + const std::string text = R"( + OpCapability MeshShadingEXT + OpCapability Shader + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main1 "main1" %26 %vertices_color + OpEntryPoint MeshEXT %main2 "main2" %43 %vertices_color_0 + OpExecutionMode %main1 OutputVertices 3 + OpExecutionMode %main1 OutputPrimitivesEXT 1 + OpExecutionMode %main1 LocalSize 1 1 1 + OpExecutionMode %main1 OutputTrianglesEXT + OpExecutionMode %main2 OutputVertices 3 + OpExecutionMode %main2 OutputPrimitivesEXT 1 + OpExecutionMode %main2 LocalSize 1 1 1 + OpExecutionMode %main2 OutputLinesEXT + OpDecorate %vertices_color Location 0 + OpDecorate %26 BuiltIn PrimitiveTriangleIndicesEXT + OpDecorate %vertices_color_0 Location 0 + OpDecorate %43 BuiltIn PrimitiveLineIndicesEXT + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 +%_arr_v4float_int_3 = OpTypeArray %v4float %int_3 +%_ptr_Output__arr_v4float_int_3 = OpTypePointer Output %_arr_v4float_int_3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %v3uint = OpTypeVector %uint 3 + %int_1 = OpConstant %int 1 +%_arr_v3uint_int_1 = OpTypeArray %v3uint %int_1 +%_ptr_Output__arr_v3uint_int_1 = OpTypePointer Output %_arr_v3uint_int_1 +%_ptr_Output_v3uint = OpTypePointer Output %v3uint + %uint_2 = OpConstant %uint 2 + %29 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 + %38 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %v2uint = OpTypeVector %uint 2 +%_arr_v2uint_int_1 = OpTypeArray %v2uint %int_1 +%_ptr_Output__arr_v2uint_int_1 = OpTypePointer Output %_arr_v2uint_int_1 +%_ptr_Output_v2uint = OpTypePointer Output %v2uint + %46 = OpConstantComposite %v2uint %uint_0 %uint_1 +%vertices_color = OpVariable %_ptr_Output__arr_v4float_int_3 Output + %26 = OpVariable %_ptr_Output__arr_v3uint_int_1 Output +%vertices_color_0 = OpVariable %_ptr_Output__arr_v4float_int_3 Output + %43 = OpVariable %_ptr_Output__arr_v2uint_int_1 Output + %main1 = OpFunction %void None %3 + %4 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %17 = OpAccessChain %_ptr_Output_v4float %vertices_color %uint_0 + OpStore %17 %19 + %28 = OpAccessChain %_ptr_Output_v3uint %26 %uint_0 + OpStore %28 %29 + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %3 + %34 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %37 = OpAccessChain %_ptr_Output_v4float %vertices_color_0 %uint_0 + OpStore %37 %38 + %45 = OpAccessChain %_ptr_Output_v2uint %43 %uint_0 + OpStore %45 %46 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + +// https://godbolt.org/z/MeTadeYEr +TEST_F(ValidateBuiltIns, VulkanMeshMultipleArraySizes) { + const std::string text = R"( + OpCapability MeshShadingEXT + OpCapability Shader + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main1 "main1" %var1 %vertices_color + OpEntryPoint MeshEXT %main2 "main2" %var2 %vertices_color_0 + OpExecutionMode %main1 OutputVertices 3 + OpExecutionMode %main1 OutputPrimitivesEXT 2 + OpExecutionMode %main1 LocalSize 1 1 1 + OpExecutionMode %main1 OutputTrianglesEXT + OpExecutionMode %main2 OutputVertices 3 + OpExecutionMode %main2 OutputPrimitivesEXT 4 + OpExecutionMode %main2 LocalSize 1 1 1 + OpExecutionMode %main2 OutputTrianglesEXT + OpSource Slang 1 + OpName %vertices_color "vertices.color" + OpName %main1 "main1" + OpName %vertices_color_0 "vertices.color" + OpName %main2 "main2" + OpDecorate %vertices_color Location 0 + OpDecorate %var1 BuiltIn PrimitiveTriangleIndicesEXT + OpDecorate %var2 BuiltIn PrimitiveTriangleIndicesEXT + OpDecorate %vertices_color_0 Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 +%_arr_v4float_int_3 = OpTypeArray %v4float %int_3 +%_ptr_Output__arr_v4float_int_3 = OpTypePointer Output %_arr_v4float_int_3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %v3uint = OpTypeVector %uint 3 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 +%_arr_v3uint_int_2 = OpTypeArray %v3uint %int_2 +%_arr_v3uint_int_4 = OpTypeArray %v3uint %int_4 +%_ptr_Output__arr_v3uint_int_2 = OpTypePointer Output %_arr_v3uint_int_2 +%_ptr_Output__arr_v3uint_int_4 = OpTypePointer Output %_arr_v3uint_int_4 +%_ptr_Output_v3uint = OpTypePointer Output %v3uint + %uint_2 = OpConstant %uint 2 + %29 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 + %38 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %41 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 +%vertices_color = OpVariable %_ptr_Output__arr_v4float_int_3 Output + %var1 = OpVariable %_ptr_Output__arr_v3uint_int_2 Output + %var2 = OpVariable %_ptr_Output__arr_v3uint_int_4 Output +%vertices_color_0 = OpVariable %_ptr_Output__arr_v4float_int_3 Output + %main1 = OpFunction %void None %3 + %4 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %17 = OpAccessChain %_ptr_Output_v4float %vertices_color %uint_0 + OpStore %17 %19 + %28 = OpAccessChain %_ptr_Output_v3uint %var1 %uint_0 + OpStore %28 %29 + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %3 + %34 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %37 = OpAccessChain %_ptr_Output_v4float %vertices_color_0 %uint_0 + OpStore %37 %38 + %40 = OpAccessChain %_ptr_Output_v3uint %var2 %uint_0 + OpStore %40 %41 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + +TEST_F(ValidateBuiltIns, BadVulkanMeshMultipleArraySizes) { + const std::string text = R"( + OpCapability MeshShadingEXT + OpCapability Shader + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main1 "main1" %26 %vertices_color + OpEntryPoint MeshEXT %main2 "main2" %26 %vertices_color_0 + OpExecutionMode %main1 OutputVertices 3 + OpExecutionMode %main1 OutputPrimitivesEXT 2 + OpExecutionMode %main1 LocalSize 1 1 1 + OpExecutionMode %main1 OutputTrianglesEXT + OpExecutionMode %main2 OutputVertices 3 + OpExecutionMode %main2 OutputPrimitivesEXT 42 + OpExecutionMode %main2 LocalSize 1 1 1 + OpExecutionMode %main2 OutputTrianglesEXT + OpSource Slang 1 + OpName %vertices_color "vertices.color" + OpName %main1 "main1" + OpName %vertices_color_0 "vertices.color" + OpName %main2 "main2" + OpDecorate %vertices_color Location 0 + OpDecorate %26 BuiltIn PrimitiveTriangleIndicesEXT + OpDecorate %vertices_color_0 Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 +%_arr_v4float_int_3 = OpTypeArray %v4float %int_3 +%_ptr_Output__arr_v4float_int_3 = OpTypePointer Output %_arr_v4float_int_3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %v3uint = OpTypeVector %uint 3 + %int_2 = OpConstant %int 2 +%_arr_v3uint_int_2 = OpTypeArray %v3uint %int_2 +%_ptr_Output__arr_v3uint_int_2 = OpTypePointer Output %_arr_v3uint_int_2 +%_ptr_Output_v3uint = OpTypePointer Output %v3uint + %uint_2 = OpConstant %uint 2 + %29 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 + %38 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %41 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 +%vertices_color = OpVariable %_ptr_Output__arr_v4float_int_3 Output + %26 = OpVariable %_ptr_Output__arr_v3uint_int_2 Output +%vertices_color_0 = OpVariable %_ptr_Output__arr_v4float_int_3 Output + %main1 = OpFunction %void None %3 + %4 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %17 = OpAccessChain %_ptr_Output_v4float %vertices_color %uint_0 + OpStore %17 %19 + %28 = OpAccessChain %_ptr_Output_v3uint %26 %uint_0 + OpStore %28 %29 + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %3 + %34 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %37 = OpAccessChain %_ptr_Output_v4float %vertices_color_0 %uint_0 + OpStore %37 %38 + %40 = OpAccessChain %_ptr_Output_v3uint %26 %uint_0 + OpStore %40 %41 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-PrimitiveTriangleIndicesEXT-" + "PrimitiveTriangleIndicesEXT-07058")); +} + +TEST_F(ValidateBuiltIns, BadVulkanMeshMultipleArraySizesSharedVariable) { + const std::string text = R"( + OpCapability MeshShadingEXT + OpCapability Shader + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main1 "main1" %26 %vertices_color + OpEntryPoint MeshEXT %main2 "main2" %26 %vertices_color_0 + OpExecutionMode %main1 OutputVertices 3 + OpExecutionMode %main1 OutputPrimitivesEXT 2 + OpExecutionMode %main1 LocalSize 1 1 1 + OpExecutionMode %main1 OutputTrianglesEXT + OpExecutionMode %main2 OutputVertices 3 + OpExecutionMode %main2 OutputPrimitivesEXT 4 + OpExecutionMode %main2 LocalSize 1 1 1 + OpExecutionMode %main2 OutputTrianglesEXT + OpSource Slang 1 + OpName %vertices_color "vertices.color" + OpName %main1 "main1" + OpName %vertices_color_0 "vertices.color" + OpName %main2 "main2" + OpDecorate %vertices_color Location 0 + OpDecorate %26 BuiltIn PrimitiveTriangleIndicesEXT + OpDecorate %vertices_color_0 Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 +%_arr_v4float_int_3 = OpTypeArray %v4float %int_3 +%_ptr_Output__arr_v4float_int_3 = OpTypePointer Output %_arr_v4float_int_3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %v3uint = OpTypeVector %uint 3 + %int_2 = OpConstant %int 2 +%_arr_v3uint_int_2 = OpTypeArray %v3uint %int_2 +%_ptr_Output__arr_v3uint_int_2 = OpTypePointer Output %_arr_v3uint_int_2 +%_ptr_Output_v3uint = OpTypePointer Output %v3uint + %uint_2 = OpConstant %uint 2 + %29 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 + %38 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %41 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 +%vertices_color = OpVariable %_ptr_Output__arr_v4float_int_3 Output + %26 = OpVariable %_ptr_Output__arr_v3uint_int_2 Output +%vertices_color_0 = OpVariable %_ptr_Output__arr_v4float_int_3 Output + %main1 = OpFunction %void None %3 + %4 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %17 = OpAccessChain %_ptr_Output_v4float %vertices_color %uint_0 + OpStore %17 %19 + %28 = OpAccessChain %_ptr_Output_v3uint %26 %uint_0 + OpStore %28 %29 + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %3 + %34 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %37 = OpAccessChain %_ptr_Output_v4float %vertices_color_0 %uint_0 + OpStore %37 %38 + %40 = OpAccessChain %_ptr_Output_v3uint %26 %uint_0 + OpStore %40 %41 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-PrimitiveTriangleIndicesEXT-" + "PrimitiveTriangleIndicesEXT-07058")); +} + TEST_F(ValidateBuiltIns, BadExecModelVulkanPrimitivePointIndicesEXT) { const std::string text = R"( OpCapability MeshShadingNV @@ -5246,6 +5684,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinCullPrimitiveEXTBlockArraySize) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_16 Output %main = OpFunction %void None %3 %5 = OpLabel + %ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_16 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -5288,6 +5727,7 @@ TEST_F(ValidateBuiltIns, VulkanBuiltinCullPrimitiveEXTMissingBlock) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -5333,6 +5773,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinCullPrimitiveEXTType) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -5543,6 +5984,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinCullPrimitiveEXTInterfaceVariable) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_2 Output %main = OpFunction %void None %21 %23 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_2 %gl_MeshPrimitivesEXT %24 = OpLoad %uint %gl_LocalInvocationIndex OpSetMeshOutputsEXT %uint_2 %uint_2 %25 = OpAccessChain %_ptr_Output_bool %5 %24 @@ -5632,6 +6074,7 @@ TEST_F(ValidateBuiltIns, BadBuiltinCullPrimitiveEXTWithPerPrimitiveEXT) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel + %ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -5676,6 +6119,7 @@ TEST_F(ValidateBuiltIns, BadBuiltinPrimitiveShadingRateWithPerPrimitiveEXT) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -5837,6 +6281,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinLayerArrayTypeMeshEXT) { %gl_Layer = OpVariable %_ptr_Output__arr_gl_Layer_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_Layer_uint_32 %gl_Layer OpReturn OpFunctionEnd )"; @@ -5879,6 +6324,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinLayerInBlockMeshEXTType) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel + %ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -5916,6 +6362,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinLayerArrayOfIntSizeMeshEXT) { %gl_Layer = OpVariable %_ptr_Output__arr_gl_Layer_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_Layer_uint_32 %gl_Layer OpReturn OpFunctionEnd )"; @@ -5958,6 +6405,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinLayerInBlockArraySizeMeshEXT) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -6001,6 +6449,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinLayerWithPerPrimitiveEXT) { %gl_Layer = OpVariable %_ptr_Output__arr_int_int_1 Output %MainMesh = OpFunction %void None %9 %25 = OpLabel +%ref_load = OpLoad %_arr_int_int_1 %gl_Layer OpSetMeshOutputsEXT %uint_3 %uint_1 OpReturn OpFunctionEnd @@ -6077,15 +6526,20 @@ TEST_F(ValidateBuiltIns, %void = OpTypeVoid %3 = OpTypeFunction %void %uint = OpTypeInt 32 0 +%int = OpTypeInt 32 1 %uint_32 = OpConstant %uint 32 %uint_1 = OpConstant %uint 1 -%int = OpTypeInt 32 1 +%uint_0 = OpConstant %uint 0 +%int_0 = OpConstant %int 0 %bool = OpTypeBool %_arr_gl_PrimitiveShadingRateEXT_uint_32 = OpTypeArray %int %uint_32 %_ptr_Output__arr_gl_PrimitiveShadingRateEXT_uint_32 = OpTypePointer Output %_arr_gl_PrimitiveShadingRateEXT_uint_32 %gl_PrimitiveShadingRateEXT = OpVariable %_ptr_Output__arr_gl_PrimitiveShadingRateEXT_uint_32 Output +%uint_ptr = OpTypePointer Output %int %main = OpFunction %void None %3 %5 = OpLabel + %21 = OpAccessChain %uint_ptr %gl_PrimitiveShadingRateEXT %uint_0 + OpStore %21 %int_0 OpReturn OpFunctionEnd )"; @@ -6126,6 +6580,7 @@ TEST_F(ValidateBuiltIns, %gl_PrimitiveShadingRateEXT = OpVariable %_ptr_Output__arr_gl_PrimitiveShadingRateEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel + %ref_load = OpLoad %_arr_gl_PrimitiveShadingRateEXT_uint_32 %gl_PrimitiveShadingRateEXT OpReturn OpFunctionEnd )"; @@ -6173,6 +6628,7 @@ TEST_F(ValidateBuiltIns, %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -6220,6 +6676,7 @@ TEST_F(ValidateBuiltIns, %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -6263,6 +6720,7 @@ TEST_F(ValidateBuiltIns, %gl_PrimitiveShadingRateEXT = OpVariable %_ptr_Output__arr_gl_PrimitiveShadingRateEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_PrimitiveShadingRateEXT_uint_32 %gl_PrimitiveShadingRateEXT OpReturn OpFunctionEnd )"; @@ -6385,6 +6843,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinViewportIndexInBlockTypeMeshEXT) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -6424,6 +6883,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinViewportIndexAsArrayTypeMeshEXT) { %gl_ViewportIndex = OpVariable %_ptr_Output__arr_gl_ViewportIndex_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_ViewportIndex_uint_32 %gl_ViewportIndex OpReturn OpFunctionEnd )"; @@ -6467,6 +6927,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinViewportIndexInBlockArraySizeMeshEXT) { %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_MeshPerPrimitiveEXT_uint_32 %gl_MeshPrimitivesEXT OpReturn OpFunctionEnd )"; @@ -6506,6 +6967,7 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinViewportIndexAsArrayOfIntSizeMeshEXT) { %gl_ViewportIndex = OpVariable %_ptr_Output__arr_gl_ViewportIndex_uint_32 Output %main = OpFunction %void None %3 %5 = OpLabel +%ref_load = OpLoad %_arr_gl_ViewportIndex_uint_32 %gl_ViewportIndex OpReturn OpFunctionEnd )"; @@ -6547,7 +7009,156 @@ TEST_F(ValidateBuiltIns, BadVulkanBuiltinPrimitiveIdFragmentWithRayTracing) { CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-PrimitiveId-PrimitiveId-04333")); + AnyVUID("VUID-PrimitiveId-Fragment-04333")); +} + +TEST_F(ValidateBuiltIns, TessellationMissingPatch) { + const std::string spirv = R"( + OpCapability Tessellation + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %main = OpFunction %void None %4 + %6 = OpLabel + %17 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %17 %float_1 + %22 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %22 %float_1 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("BuiltIn TessLevelInner variable needs to also have a " + "Patch decoration")); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-TessLevelInner-10880")); +} + +// From dEQP-VK.mesh_shader.ext.builtin.primitive_id_spirv +TEST_F(ValidateBuiltIns, PrimitiveIdInFragmentWithMeshCapability) { + const std::string spirv = R"( + OpCapability Shader + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %gl_PrimitiveID + OpExecutionMode %4 OriginUpperLeft + OpDecorate %9 Location 0 + OpDecorate %gl_PrimitiveID Flat + OpDecorate %gl_PrimitiveID BuiltIn PrimitiveId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %9 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_PrimitiveID = OpVariable %_ptr_Input_int Input +%int_1629198956 = OpConstant %int 1629198956 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v4bool = OpTypeVector %bool 4 + %4 = OpFunction %void None %3 + %5 = OpLabel + %13 = OpLoad %int %gl_PrimitiveID + %16 = OpIEqual %bool %13 %int_1629198956 + %22 = OpCompositeConstruct %v4bool %16 %16 %16 %16 + %23 = OpSelect %v4float %22 %19 %20 + OpStore %9 %23 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + +// https://github.com/KhronosGroup/SPIRV-Tools/issues/6237 +TEST_F(ValidateBuiltIns, MeshBuiltinUnsignedInt) { + const std::string spirv = R"( + OpCapability FragmentShadingRateKHR + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + OpExtension "SPV_KHR_fragment_shading_rate" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %gl_MeshPrimitivesEXT + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 81 + OpExecutionMode %main OutputPrimitivesEXT 32 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %gl_MeshPerPrimitiveEXT Block + OpMemberDecorate %gl_MeshPerPrimitiveEXT 0 BuiltIn PrimitiveId + OpMemberDecorate %gl_MeshPerPrimitiveEXT 0 PerPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 1 BuiltIn Layer + OpMemberDecorate %gl_MeshPerPrimitiveEXT 1 PerPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 2 BuiltIn ViewportIndex + OpMemberDecorate %gl_MeshPerPrimitiveEXT 2 PerPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 3 BuiltIn CullPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 3 PerPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 4 BuiltIn PrimitiveShadingRateKHR + OpMemberDecorate %gl_MeshPerPrimitiveEXT 4 PerPrimitiveEXT + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_81 = OpConstant %uint 81 + %uint_32 = OpConstant %uint 32 +%gl_MeshPerPrimitiveEXT = OpTypeStruct %uint %uint %uint %bool %uint +%_arr_gl_MeshPerPrimitiveEXT_uint_32 = OpTypeArray %gl_MeshPerPrimitiveEXT %uint_32 +%_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 = OpTypePointer Output %_arr_gl_MeshPerPrimitiveEXT_uint_32 +%gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %4 + %6 = OpLabel + OpSetMeshOutputsEXT %uint_81 %uint_32 + %20 = OpAccessChain %_ptr_Output_uint %gl_MeshPrimitivesEXT %int_0 %uint_0 + OpStore %20 %uint_1 + %22 = OpAccessChain %_ptr_Output_uint %gl_MeshPrimitivesEXT %int_0 %uint_1 + OpStore %22 %uint_2 + %24 = OpAccessChain %_ptr_Output_uint %gl_MeshPrimitivesEXT %int_0 %uint_2 + OpStore %24 %uint_3 + %26 = OpAccessChain %_ptr_Output_uint %gl_MeshPrimitivesEXT %int_0 %uint_4 + OpStore %26 %uint_4 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); } } // namespace diff --git a/third_party/spirv-tools/test/val/val_cfg_test.cpp b/third_party/spirv-tools/test/val/val_cfg_test.cpp index ae2e45bb62..ba2733a76b 100644 --- a/third_party/spirv-tools/test/val/val_cfg_test.cpp +++ b/third_party/spirv-tools/test/val/val_cfg_test.cpp @@ -2600,20 +2600,20 @@ TEST_F(ValidateCFG, VarPtrShaderWithPhiPtr) { OpExecutionMode %1 LocalSize 1 1 1 OpSource HLSL 600 %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool +%_ptr_Workgroup_bool = OpTypePointer Workgroup %bool + %7 = OpVariable %_ptr_Workgroup_bool Workgroup + %8 = OpVariable %_ptr_Workgroup_bool Workgroup %void = OpTypeVoid %5 = OpTypeFunction %void %1 = OpFunction %void None %5 %6 = OpLabel - %7 = OpVariable %_ptr_Function_bool Function - %8 = OpVariable %_ptr_Function_bool Function %9 = OpUndef %bool OpSelectionMerge %10 None OpBranchConditional %9 %11 %10 %11 = OpLabel OpBranch %10 %10 = OpLabel - %12 = OpPhi %_ptr_Function_bool %7 %6 %8 %11 + %12 = OpPhi %_ptr_Workgroup_bool %7 %6 %8 %11 OpReturn OpFunctionEnd )"; @@ -2625,7 +2625,7 @@ TEST_F(ValidateCFG, VarPtrShaderWithPhiPtr) { TEST_F(ValidateCFG, VarPtrStgBufShaderWithPhiStgBufPtr) { const std::string text = R"( OpCapability Shader - OpCapability VariablePointersStorageBuffer + OpCapability VariablePointers OpExtension "SPV_KHR_variable_pointers" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %1 "main" diff --git a/third_party/spirv-tools/test/val/val_composites_test.cpp b/third_party/spirv-tools/test/val/val_composites_test.cpp index 7ac0df2355..b7e887611c 100644 --- a/third_party/spirv-tools/test/val/val_composites_test.cpp +++ b/third_party/spirv-tools/test/val/val_composites_test.cpp @@ -315,6 +315,19 @@ TEST_F(ValidateComposites, CompositeConstructVectorOnlyOneConstituent) { HasSubstr("Expected number of constituents to be at least 2")); } +TEST_F(ValidateComposites, CompositeConstructLongVectorOnlyOneConstituent) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec4 %f32vec4_0123 +)"; + const std::string caps = R"( +OpCapability LongVectorEXT +OpExtension "SPV_EXT_long_vector" +)"; + + CompileSuccessfully(GenerateShaderCode(body, caps).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + TEST_F(ValidateComposites, CompositeConstructVectorWrongConsituent1) { const std::string body = R"( %val1 = OpCompositeConstruct %f32vec4 %f32 %f32vec2_12 @@ -2290,6 +2303,1169 @@ OpFunctionEnd)"; ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); } +TEST_F(ValidateComposites, CoopMatVecConvBitCastArrayQCOM1) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%u8int = OpTypeInt 8 0 +%uint = OpTypeInt 32 0 +%half = OpTypeFloat 16 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%_arr_u8int_uint_8 = OpTypeArray %u8int %uint_8 +%_arr_half_uint_16 = OpTypeArray %half %uint_16 +%_ptr_Function__arr_half_uint_16 = OpTypePointer Function %_arr_half_uint_16 +%main = OpFunction %void None %3 +%5 = OpLabel +%hvec8A = OpVariable %_ptr_Function__arr_half_uint_16 Function +%16 = OpLoad %_arr_half_uint_16 %hvec8A +%18 = OpBitCastArrayQCOM %_arr_u8int_uint_8 %16 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode BitCastArrayQCOM requires the result element " + "type be one of 32-bit OpTypeInt (signed/unsigned), " + "32-bit OpTypeFloat and 16-bit OpTypeFloat")); +} + +TEST_F(ValidateComposites, CoopMatVecConvBitCastArrayQCOM2) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%u8int = OpTypeInt 8 0 +%uint = OpTypeInt 32 0 +;%half = OpTypeFloat 16 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_arr_u8int_uint_32 = OpTypeArray %u8int %uint_32 +%_ptr_Function__arr_u8int_uint_32 = OpTypePointer Function %_arr_u8int_uint_32 +%main = OpFunction %void None %3 +%5 = OpLabel +%u8A = OpVariable %_ptr_Function__arr_u8int_uint_32 Function +%16 = OpLoad %_arr_u8int_uint_32 %u8A +%18 = OpBitCastArrayQCOM %_arr_uint_uint_8 %16 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode BitCastArrayQCOM requires the source element " + "type be one of 32-bit OpTypeInt (signed/unsigned), " + "32-bit OpTypeFloat and 16-bit OpTypeFloat")); +} + +TEST_F(ValidateComposites, CoopMatVecConvBitCastArrayQCOM3) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%half = OpTypeFloat 16 +%uint_16 = OpConstant %uint 16 +%_arr_uint_uint_16 = OpTypeArray %uint %uint_16 +%_arr_half_uint_16 = OpTypeArray %half %uint_16 +%_ptr_Function__arr_half_uint_16 = OpTypePointer Function %_arr_half_uint_16 +%main = OpFunction %void None %3 +%5 = OpLabel +%hvec8A = OpVariable %_ptr_Function__arr_half_uint_16 Function +%16 = OpLoad %_arr_half_uint_16 %hvec8A +%18 = OpBitCastArrayQCOM %_arr_uint_uint_16 %16 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode BitCastArrayQCOM requires source and result " + "types be compatible for conversion.")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractSubArrayQCOM1) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_8 = OpConstant %uint 8 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_64 = OpTypeArray %uint %uint_64 +%_arr_float_uint_8 = OpTypeArray %float %uint_8 +%_ptr_Function__arr_uint_uint_64 = OpTypePointer Function %_arr_uint_uint_64 +%main = OpFunction %void None %3 +%5 = OpLabel +%uvec64Acc = OpVariable %_ptr_Function__arr_uint_uint_64 Function +%83 = OpLoad %_arr_uint_uint_64 %uvec64Acc +%86 = OpExtractSubArrayQCOM %_arr_float_uint_8 %83 %uint_0 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode ExtractSubArrayQCOM requires the input " + "and result element types match.")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMTy) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_u8int_uint_32 = OpTypeArray %u8int %uint_32 +%_ptr_Function__arr_u8int_uint_32 = OpTypePointer Function %_arr_u8int_uint_32 +%113 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_64 %uint_8 %uint_0 +%main = OpFunction %void None %3 +%5 = OpLabel +%u8_32 = OpVariable %_ptr_Function__arr_u8int_uint_32 Function +%116 = OpLoad %_arr_u8int_uint_32 %u8_32 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires ether " + "the input element type is equal to the result element " + "type or it is the unsigned 32-bit integer.")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMA1) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_64 %uint_8 %uint_0 +%main = OpFunction %void None %3 +%5 = OpLabel +%u32_8 = OpVariable %_ptr_Function__arr_uint_uint_8 Function +%116 = OpLoad %_arr_uint_uint_8 %u32_8 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires " + "the result element type is one of 8-bit OpTypeInt " + "signed/unsigned, 16- or 32-bit OpTypeFloat when " + "result coopmat's use is MatrixAKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMA2) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_64 %uint_16 %uint_0 +%main = OpFunction %void None %3 +%5 = OpLabel +%u32_8 = OpVariable %_ptr_Function__arr_uint_uint_8 Function +%116 = OpLoad %_arr_uint_uint_8 %u32_8 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires " + "the columns of the result coopmat have the bit " + "length of 256 when result coopmat's use is " + "MatrixAKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMA3) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_u8int_uint_16 = OpTypeArray %u8int %uint_16 +%_ptr_Function__arr_u8int_uint_16 = OpTypePointer Function %_arr_u8int_uint_16 +%113 = OpTypeCooperativeMatrixKHR %u8int %uint_3 %uint_64 %uint_32 %uint_0 +%main = OpFunction %void None %3 +%5 = OpLabel +%u8_16 = OpVariable %_ptr_Function__arr_u8int_uint_16 Function +%116 = OpLoad %_arr_u8int_uint_16 %u8_16 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires " + "the source array length be 8 if its elt type is " + "32-bit unsigned OpTypeInt and be the result's " + "number of columns, otherwise when result coopmat's " + "use is MatrixAKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMB1) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%float = OpTypeFloat 32 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_8 %uint_64 %uint_1 +%main = OpFunction %void None %3 +%5 = OpLabel +%u32_8 = OpVariable %_ptr_Function__arr_uint_uint_8 Function +%116 = OpLoad %_arr_uint_uint_8 %u32_8 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires " + "the result element type is one of 8-bit OpTypeInt " + "signed/unsigned, 16- or 32-bit OpTypeFloat when " + "result coopmat's use is MatrixBKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMB2) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%float = OpTypeFloat 32 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_16 %uint_64 %uint_1 +%main = OpFunction %void None %3 +%5 = OpLabel +%u32_8 = OpVariable %_ptr_Function__arr_uint_uint_8 Function +%116 = OpLoad %_arr_uint_uint_8 %u32_8 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires " + "the rows of the result operand have the bit " + "length of 256 when result coopmat's use is " + "MatrixBKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMB3) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_u8int_uint_16 = OpTypeArray %u8int %uint_16 +%_ptr_Function__arr_u8int_uint_16 = OpTypePointer Function %_arr_u8int_uint_16 +%113 = OpTypeCooperativeMatrixKHR %u8int %uint_3 %uint_32 %uint_64 %uint_1 +%main = OpFunction %void None %3 +%5 = OpLabel +%u8_16 = OpVariable %_ptr_Function__arr_u8int_uint_16 Function +%116 = OpLoad %_arr_u8int_uint_16 %u8_16 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires " + "the source array length be 8 if its elt type " + "is 32-bit unsigned OpTypeInt and be the result's " + "number of rows, otherwise when result coopmat's use is " + "MatrixBKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMAcc1) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_u8int_uint_32 = OpTypeArray %u8int %uint_32 +%_ptr_Function__arr_u8int_uint_32 = OpTypePointer Function %_arr_u8int_uint_32 +%113 = OpTypeCooperativeMatrixKHR %u8int %uint_3 %uint_64 %uint_64 %uint_2 +%main = OpFunction %void None %3 +%5 = OpLabel +%u8_32 = OpVariable %_ptr_Function__arr_u8int_uint_32 Function +%116 = OpLoad %_arr_u8int_uint_32 %u8_32 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires " + "the result element type is one of 32-bit " + "OpTypeInt signed/unsigned, 16- or 32-bit " + "OpTypeFloat when result coopmat's use is " + "MatrixAccumulatorKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvConstructQCOMAcc2) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%half = OpTypeFloat 16 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_16 = OpConstant %uint 16 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_16 = OpTypeArray %uint %uint_16 +%_ptr_Function__arr_uint_uint_16 = OpTypePointer Function %_arr_uint_uint_16 +%113 = OpTypeCooperativeMatrixKHR %half %uint_3 %uint_64 %uint_64 %uint_2 +%main = OpFunction %void None %3 +%5 = OpLabel +%u32_16 = OpVariable %_ptr_Function__arr_uint_uint_16 Function +%116 = OpLoad %_arr_uint_uint_16 %u32_16 +%118 = OpCompositeConstructCoopMatQCOM %113 %116 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeConstructCoopMatQCOM requires " + "the source array length be a half of the number " + "of columns of the resulting cooerative matrix if " + "the matrix's componet type is 16-bit OpTypeFloat " + "and be equal to the number of columns, otherwise, " + "when result coopmat's use is " + "MatrixAccumulatorKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMA1) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_64 %uint_8 %uint_0 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u32_64_8 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u32_64_8 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_8 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM requires " + "the source element type be one of 8-bit " + "OpTypeInt signed/unsigned, 16- or 32-bit " + "OpTypeFloat when source coopmat's use is " + "MatrixAKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMA2) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_64 %uint_16 %uint_0 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u32_64_8 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u32_64_8 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_8 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM " + "requires the columns of the source " + "coopmat have the bit length of 256 " + "when source coopmat's use is " + "MatrixAKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMA3) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_u8int_uint_64 = OpTypeArray %u8int %uint_64 +%_ptr_Function__arr_u8int_uint_64 = OpTypePointer Function %_arr_u8int_uint_64 +%113 = OpTypeCooperativeMatrixKHR %u8int %uint_3 %uint_64 %uint_32 %uint_0 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u8_64_32 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u8_64_32 +%251 = OpCompositeExtractCoopMatQCOM %_arr_u8int_uint_64 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM requires " + "either the result element type be the same as " + "the source cooperative matrix's component type " + "and its length be the same as the number of " + "columns of the matrix or the result element " + "type be unsigned 32-bit OpTypeInt and the " + "length be 8 when source coopmat's use is " + "MatrixAKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMA4) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_16 = OpTypeArray %uint %uint_16 +%_ptr_Function__arr_uint_uint_16 = OpTypePointer Function %_arr_uint_uint_16 +%113 = OpTypeCooperativeMatrixKHR %u8int %uint_3 %uint_64 %uint_32 %uint_0 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u8_64_32 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u8_64_32 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_16 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM requires " + "either the result element type be the same as " + "the source cooperative matrix's component type " + "and its length be the same as the number of " + "columns of the matrix or the result element " + "type be unsigned 32-bit OpTypeInt and the " + "length be 8 when source coopmat's use is " + "MatrixAKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMB1) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_8 %uint_64 %uint_1 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u32_64_8 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u32_64_8 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_8 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM " + "requires the source element type be " + "one of 8-bit OpTypeInt signed/unsigned, " + "16- or 32-bit OpTypeFloat when source " + "coopmat's use is " + "MatrixBKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMB2) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_16 %uint_64 %uint_1 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u32_64_8 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u32_64_8 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_8 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM requires " + "the rows of the source coopmat have the bit " + "length of 256 when source coopmat's use is " + "MatrixBKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMB3) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_16 = OpConstant %uint 16 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_u8int_uint_16 = OpTypeArray %u8int %uint_16 +%_ptr_Function__arr_u8int_uint_16 = OpTypePointer Function %_arr_u8int_uint_16 +%113 = OpTypeCooperativeMatrixKHR %u8int %uint_3 %uint_32 %uint_64 %uint_1 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u8_16_64 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u8_16_64 +%251 = OpCompositeExtractCoopMatQCOM %_arr_u8int_uint_16 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM requires " + "either the result element type be the same as " + "the source cooperative matrix's component type " + "and its length be the same as the number of " + "rows of the matrix or the result element " + "type be unsigned 32-bit OpTypeInt and the " + "length be 8 when source coopmat's use is " + "MatrixBKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMB4) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%u8int = OpTypeInt 8 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%uint_16 = OpConstant %uint 16 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_16 = OpTypeArray %uint %uint_16 +%_ptr_Function__arr_uint_uint_16 = OpTypePointer Function %_arr_uint_uint_16 +%113 = OpTypeCooperativeMatrixKHR %u8int %uint_3 %uint_32 %uint_64 %uint_1 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u8_32_64 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u8_32_64 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_16 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM requires " + "either the result element type be the same as " + "the source cooperative matrix's component type " + "and its length be the same as the number of " + "rows of the matrix or the result element " + "type be unsigned 32-bit OpTypeInt and the " + "length be 8 when source coopmat's use is " + "MatrixBKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMAcc1) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%u8int = OpTypeInt 8 0 +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_8 = OpConstant %uint 8 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Function__arr_uint_uint_8 = OpTypePointer Function %_arr_uint_uint_8 +%113 = OpTypeCooperativeMatrixKHR %u8int %uint_3 %uint_64 %uint_64 %uint_2 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u32_64_64 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u32_64_64 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_8 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM " + "requires the source element type be " + "one of 32-bit OpTypeInt signed/unsigned, " + "16- or 32-bit OpTypeFloat when source " + "coopmat's use is " + "MatrixAccumulatorKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMAcc2) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_32 = OpConstant %uint 32 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Function__arr_uint_uint_32 = OpTypePointer Function %_arr_uint_uint_32 +%113 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_64 %uint_64 %uint_2 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_u32_64_64 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_u32_64_64 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_32 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM requires " + "either the result element type be the same as " + "the source cooperative matrix's component type " + "and its length be the same as the number of " + "columns of the matrix or the result element " + "type be unsigned 32-bit OpTypeInt and the length " + "be the number of the columns of the matrix if " + "its component type is 32-bit OpTypeFloat and be " + "a half of the number of the columns of the matrix " + "if its component type is 16-bit OpTypeFloat when " + "source coopmat's use is " + "MatrixAccumulatorKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractQCOMAcc3) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%half = OpTypeFloat 16 +%uint_0 = OpConstant %uint 0 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_64 = OpConstant %uint 64 +%_arr_uint_uint_64 = OpTypeArray %uint %uint_64 +%_ptr_Function__arr_uint_uint_64 = OpTypePointer Function %_arr_uint_uint_64 +%113 = OpTypeCooperativeMatrixKHR %half %uint_3 %uint_64 %uint_64 %uint_2 +%_ptr_Function_113 = OpTypePointer Function %113 +%main = OpFunction %void None %3 +%5 = OpLabel +%matA_f16_64_64 = OpVariable %_ptr_Function_113 Function +%249 = OpLoad %113 %matA_f16_64_64 +%251 = OpCompositeExtractCoopMatQCOM %_arr_uint_uint_64 %249 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode CompositeExtractCoopMatQCOM requires " + "either the result element type be the same as " + "the source cooperative matrix's component type " + "and its length be the same as the number of " + "columns of the matrix or the result element " + "type be unsigned 32-bit OpTypeInt and the length " + "be the number of the columns of the matrix if " + "its component type is 32-bit OpTypeFloat and be " + "a half of the number of the columns of the matrix " + "if its component type is 16-bit OpTypeFloat when " + "source coopmat's use is " + "MatrixAccumulatorKHR")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractSubArrayQCOM2) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int8 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%u8int = OpTypeInt 8 0 +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_8 = OpConstant %uint 8 +%uint_64 = OpConstant %uint 64 +%_arr_u8int_uint_8 = OpTypeArray %u8int %uint_8 +%_arr_u8int_uint_64 = OpTypeArray %u8int %uint_64 +%_ptr_Function__arr_u8int_uint_64 = OpTypePointer Function %_arr_u8int_uint_64 +%main = OpFunction %void None %3 +%5 = OpLabel +%uvec64Acc = OpVariable %_ptr_Function__arr_u8int_uint_64 Function +%83 = OpLoad %_arr_u8int_uint_64 %uvec64Acc +%86 = OpExtractSubArrayQCOM %_arr_u8int_uint_8 %83 %uint_0 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode ExtractSubArrayQCOM requires the element type " + "be one of 32-bit OpTypeInt (signed/unsigned), 32-bit " + "OpTypeFloat and 16-bit OpTypeFloat")); +} + +TEST_F(ValidateComposites, CoopMatVecConvExtractSubArrayQCOM3) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability Int16 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%ui16 = OpTypeInt 16 0 +%uint = OpTypeInt 32 0 +%f16 = OpTypeFloat 16 +%u16int_0 = OpConstant %ui16 0 +%uint_8 = OpConstant %uint 8 +%uint_64 = OpConstant %uint 64 +%_arr_f16_uint_8 = OpTypeArray %f16 %uint_8 +%_arr_f16_uint_64 = OpTypeArray %f16 %uint_64 +%_ptr_Function__arr_f16_uint_64 = OpTypePointer Function %_arr_f16_uint_64 +%main = OpFunction %void None %3 +%5 = OpLabel +%f16vec64Acc = OpVariable %_ptr_Function__arr_f16_uint_64 Function +%83 = OpLoad %_arr_f16_uint_64 %f16vec64Acc +%86 = OpExtractSubArrayQCOM %_arr_f16_uint_8 %83 %u16int_0 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode ExtractSubArrayQCOM requires the type of the " + "start index operand be 32-bit OpTypeInt")); +} + } // namespace } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_constants_test.cpp b/third_party/spirv-tools/test/val/val_constants_test.cpp index 47278777dc..074cd136e3 100644 --- a/third_party/spirv-tools/test/val/val_constants_test.cpp +++ b/third_party/spirv-tools/test/val/val_constants_test.cpp @@ -50,9 +50,11 @@ using ValidateConstant = spvtest::ValidateBase; "%true = OpConstantTrue %bool " \ "%null = OpConstantNull %_ptr_uint " -#define kShaderPreamble \ - "OpCapability Shader\n" \ - "OpCapability Linkage\n" \ +#define kShaderPreamble \ + "OpCapability Shader\n" \ + "OpCapability Linkage\n" \ + "OpCapability VariablePointers\n" \ + "OpExtension \"SPV_KHR_variable_pointers\"\n" \ "OpMemoryModel Logical Simple\n" #define kKernelPreamble \ @@ -343,9 +345,11 @@ INSTANTIATE_TEST_SUITE_P( // SPV_AMD_gpu_shader_int16 should enable UConvert for OpSpecConstantOp // https://github.com/KhronosGroup/glslang/issues/848 {SPV_ENV_UNIVERSAL_1_0, - "OpCapability Shader " + "OpCapability Shader\n" + "OpCapability VariablePointers\n" "OpCapability Linkage ; So we don't need to define a function\n" - "OpExtension \"SPV_AMD_gpu_shader_int16\" " + "OpExtension \"SPV_AMD_gpu_shader_int16\"\n" + "OpExtension \"SPV_KHR_variable_pointers\"\n" "OpMemoryModel Logical Simple " kBasicTypes "%v = OpSpecConstantOp %uint UConvert %uint_0", true, ""}, diff --git a/third_party/spirv-tools/test/val/val_conversion_test.cpp b/third_party/spirv-tools/test/val/val_conversion_test.cpp index 2d18333f45..b65ecbb0d6 100644 --- a/third_party/spirv-tools/test/val/val_conversion_test.cpp +++ b/third_party/spirv-tools/test/val/val_conversion_test.cpp @@ -1371,6 +1371,7 @@ OpExtension "SPV_KHR_cooperative_matrix" OpExtension "SPV_KHR_vulkan_memory_model" OpMemoryModel Logical VulkanKHR OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 32 1 1 %void = OpTypeVoid %func = OpTypeFunction %void %bool = OpTypeBool @@ -1384,11 +1385,11 @@ OpEntryPoint GLCompute %main "main" %u32_8 = OpConstant %u32 8 %u32_4 = OpConstant %u32 4 %subgroup = OpConstant %u32 3 -%device = OpConstant %u32 1 +%workgroup = OpConstant %u32 2 %use_A = OpConstant %u32 0 %f16mat = OpTypeCooperativeMatrixKHR %f16 %subgroup %u32_8 %u32_8 %use_A -%f32mat = OpTypeCooperativeMatrixKHR %f32 %device %u32_8 %u32_8 %use_A +%f32mat = OpTypeCooperativeMatrixKHR %f32 %workgroup %u32_8 %u32_8 %use_A %f16_1 = OpConstant %f16 1 @@ -1515,9 +1516,12 @@ TEST_F(ValidateConversion, BitcastPtrWrongInputType) { CompileSuccessfully(GenerateKernelCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected input to be a pointer or int scalar if " - "Result Type is pointer: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In SPIR-V 1.4 or earlier (and without " + "SPV_KHR_physical_storage_buffer), expected input to be a " + "pointer or int scalar if " + "Result Type is pointer: Bitcast")); } TEST_F(ValidateConversion, BitcastPtrWrongInputTypeSPV1p5) { @@ -1528,9 +1532,12 @@ TEST_F(ValidateConversion, BitcastPtrWrongInputTypeSPV1p5) { CompileSuccessfully(GenerateKernelCode(body).c_str(), SPV_ENV_UNIVERSAL_1_5); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_UNIVERSAL_1_5)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected input to be a pointer, int scalar or 32-bit " - "int vector if Result Type is pointer: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In SPIR-V 1.5 or later (or with " + "SPV_KHR_physical_storage_buffer), expected input to be a " + "pointer, int scalar or 32-bit " + "int vector if Result Type is pointer: Bitcast")); } TEST_F(ValidateConversion, BitcastPtrWrongInputTypePhysicalStorageBufferKHR) { @@ -1543,9 +1550,12 @@ TEST_F(ValidateConversion, BitcastPtrWrongInputTypePhysicalStorageBufferKHR) { "\nOpExtension \"SPV_KHR_physical_storage_buffer\"") .c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected input to be a pointer, int scalar or 32-bit " - "int vector if Result Type is pointer: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In SPIR-V 1.5 or later (or with " + "SPV_KHR_physical_storage_buffer), expected input to be a " + "pointer, int scalar or 32-bit " + "int vector if Result Type is pointer: Bitcast")); } TEST_F(ValidateConversion, BitcastPtrWrongInputTypeIntVectorSPV1p5) { @@ -1556,9 +1566,12 @@ TEST_F(ValidateConversion, BitcastPtrWrongInputTypeIntVectorSPV1p5) { CompileSuccessfully(GenerateKernelCode(body).c_str(), SPV_ENV_UNIVERSAL_1_5); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_UNIVERSAL_1_5)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected input to be a pointer, int scalar or 32-bit " - "int vector if Result Type is pointer: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In SPIR-V 1.5 or later (or with " + "SPV_KHR_physical_storage_buffer), expected input to be a " + "pointer, int scalar or 32-bit " + "int vector if Result Type is pointer: Bitcast")); } TEST_F(ValidateConversion, @@ -1572,9 +1585,12 @@ TEST_F(ValidateConversion, "\nOpExtension \"SPV_KHR_physical_storage_buffer\"") .c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected input to be a pointer, int scalar or 32-bit " - "int vector if Result Type is pointer: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In SPIR-V 1.5 or later (or with " + "SPV_KHR_physical_storage_buffer), expected input to be a " + "pointer, int scalar or 32-bit " + "int vector if Result Type is pointer: Bitcast")); } TEST_F(ValidateConversion, BitcastPtrWrongResultType) { @@ -1585,7 +1601,9 @@ TEST_F(ValidateConversion, BitcastPtrWrongResultType) { CompileSuccessfully(GenerateKernelCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Pointer can only be converted to another pointer or " + HasSubstr("In SPIR-V 1.4 or earlier (and without " + "SPV_KHR_physical_storage_buffer), pointer can only be " + "converted to another pointer or " "int scalar: Bitcast")); } @@ -1597,9 +1615,13 @@ TEST_F(ValidateConversion, BitcastPtrWrongResultTypeSPV1p5) { CompileSuccessfully(GenerateKernelCode(body).c_str(), SPV_ENV_UNIVERSAL_1_5); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_UNIVERSAL_1_5)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Pointer can only be converted to another pointer, int " - "scalar or 32-bit int vector: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In SPIR-V 1.5 or later (or with SPV_KHR_physical_storage_buffer), " + "pointer can only be converted " + "to another pointer, int " + "scalar or 32-bit int vector: Bitcast")); } TEST_F(ValidateConversion, BitcastPtrWrongResultTypePhysicalStorageBufferKHR) { @@ -1612,9 +1634,13 @@ TEST_F(ValidateConversion, BitcastPtrWrongResultTypePhysicalStorageBufferKHR) { "\nOpExtension \"SPV_KHR_physical_storage_buffer\"") .c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Pointer can only be converted to another pointer, int " - "scalar or 32-bit int vector: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In SPIR-V 1.5 or later (or with SPV_KHR_physical_storage_buffer), " + "pointer can only be converted " + "to another pointer, int " + "scalar or 32-bit int vector: Bitcast")); } TEST_F(ValidateConversion, BitcastPtrWrongResultTypeIntVectorSPV1p5) { @@ -1625,9 +1651,13 @@ TEST_F(ValidateConversion, BitcastPtrWrongResultTypeIntVectorSPV1p5) { CompileSuccessfully(GenerateKernelCode(body).c_str(), SPV_ENV_UNIVERSAL_1_5); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_UNIVERSAL_1_5)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Pointer can only be converted to another pointer, int " - "scalar or 32-bit int vector: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In SPIR-V 1.5 or later (or with SPV_KHR_physical_storage_buffer), " + "pointer can only be converted " + "to another pointer, int " + "scalar or 32-bit int vector: Bitcast")); } TEST_F(ValidateConversion, @@ -1641,9 +1671,13 @@ TEST_F(ValidateConversion, "\nOpExtension \"SPV_KHR_physical_storage_buffer\"") .c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Pointer can only be converted to another pointer, int " - "scalar or 32-bit int vector: Bitcast")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In SPIR-V 1.5 or later (or with SPV_KHR_physical_storage_buffer), " + "pointer can only be converted " + "to another pointer, int " + "scalar or 32-bit int vector: Bitcast")); } TEST_F(ValidateConversion, BitcastDifferentTotalBitWidth) { @@ -1990,25 +2024,30 @@ OpExtension "SPV_KHR_ray_query" TEST_F(ValidateConversion, BitcastUntypedPointerInput) { const std::string spirv = R"( OpCapability Shader +OpCapability Int64 OpCapability VariablePointers OpCapability UntypedPointersKHR OpCapability WorkgroupMemoryExplicitLayoutKHR +OpCapability PhysicalStorageBufferAddresses OpExtension "SPV_KHR_workgroup_memory_explicit_layout" OpExtension "SPV_KHR_variable_pointers" OpExtension "SPV_KHR_untyped_pointers" -OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %main "main" %var +OpExtension "SPV_KHR_physical_storage_buffer" +OpMemoryModel PhysicalStorageBuffer64 GLSL450 +OpEntryPoint GLCompute %main "main" OpDecorate %struct Block OpMemberDecorate %struct 0 Offset 0 %void = OpTypeVoid %int = OpTypeInt 32 0 +%long = OpTypeInt 64 0 +%long_0 = OpConstant %long 0 %struct = OpTypeStruct %int -%ptr = OpTypeUntypedPointerKHR Workgroup -%var = OpUntypedVariableKHR %ptr Workgroup %struct +%ptr = OpTypeUntypedPointerKHR PhysicalStorageBuffer %void_fn = OpTypeFunction %void %main = OpFunction %void None %void_fn %entry = OpLabel -%cast = OpBitcast %int %var +%ptr_cast = OpBitcast %ptr %long_0 +%cast = OpBitcast %long %ptr_cast OpReturn OpFunctionEnd )"; @@ -2020,23 +2059,27 @@ OpFunctionEnd TEST_F(ValidateConversion, BitcastUntypedPointerOutput) { const std::string spirv = R"( OpCapability Shader +OpCapability Int64 OpCapability VariablePointers OpCapability UntypedPointersKHR OpCapability WorkgroupMemoryExplicitLayoutKHR +OpCapability PhysicalStorageBufferAddresses OpExtension "SPV_KHR_workgroup_memory_explicit_layout" OpExtension "SPV_KHR_variable_pointers" OpExtension "SPV_KHR_untyped_pointers" -OpMemoryModel Logical GLSL450 +OpExtension "SPV_KHR_physical_storage_buffer" +OpMemoryModel PhysicalStorageBuffer64 GLSL450 OpEntryPoint GLCompute %main "main" %void = OpTypeVoid %int = OpTypeInt 32 0 %int_0 = OpConstant %int 0 -%ptr = OpTypeUntypedPointerKHR Workgroup -%var = OpUntypedVariableKHR %ptr Workgroup %int +%long = OpTypeInt 64 0 +%long_0 = OpConstant %long 0 +%ptr = OpTypeUntypedPointerKHR PhysicalStorageBuffer %void_fn = OpTypeFunction %void %main = OpFunction %void None %void_fn %entry = OpLabel -%cast = OpBitcast %ptr %int_0 +%cast = OpBitcast %ptr %long_0 OpReturn OpFunctionEnd )"; diff --git a/third_party/spirv-tools/test/val/val_data_test.cpp b/third_party/spirv-tools/test/val/val_data_test.cpp index b6996495cc..b7b809b9a7 100644 --- a/third_party/spirv-tools/test/val/val_data_test.cpp +++ b/third_party/spirv-tools/test/val/val_data_test.cpp @@ -898,6 +898,8 @@ TEST_F(ValidateData, vulkan_RTA_array_at_end_of_struct) { OpMemberDecorate %struct_t 0 Offset 0 OpMemberDecorate %struct_t 1 Offset 4 OpDecorate %struct_t Block + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 %uint_t = OpTypeInt 32 0 %array_t = OpTypeRuntimeArray %uint_t %struct_t = OpTypeStruct %uint_t %array_t diff --git a/third_party/spirv-tools/test/val/val_decoration_test.cpp b/third_party/spirv-tools/test/val/val_decoration_test.cpp index 7a19df616a..74959e4c04 100644 --- a/third_party/spirv-tools/test/val/val_decoration_test.cpp +++ b/third_party/spirv-tools/test/val/val_decoration_test.cpp @@ -21,6 +21,7 @@ #include "gmock/gmock.h" #include "source/val/decoration.h" +#include "spirv-tools/libspirv.h" #include "test/unit_spirv.h" #include "test/val/val_code_generator.h" #include "test/val/val_fixtures.h" @@ -1519,9 +1520,9 @@ TEST_F(ValidateDecorations, BlockMissingArrayStrideBad) { CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("must be explicitly laid out with ArrayStride decorations")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must be explicitly laid out with ArrayStride or " + "ArrayStrideIdEXT decorations")); } TEST_F(ValidateDecorations, BufferBlockMissingArrayStrideBad) { @@ -1551,9 +1552,9 @@ TEST_F(ValidateDecorations, BufferBlockMissingArrayStrideBad) { CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("must be explicitly laid out with ArrayStride decorations")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must be explicitly laid out with ArrayStride or " + "ArrayStrideIdEXT decorations")); } TEST_F(ValidateDecorations, BlockNestedStructMissingArrayStrideBad) { @@ -1588,9 +1589,9 @@ TEST_F(ValidateDecorations, BlockNestedStructMissingArrayStrideBad) { CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("must be explicitly laid out with ArrayStride decorations")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must be explicitly laid out with ArrayStride or " + "ArrayStrideIdEXT decorations")); } TEST_F(ValidateDecorations, BufferBlockNestedStructMissingArrayStrideBad) { @@ -1625,9 +1626,9 @@ TEST_F(ValidateDecorations, BufferBlockNestedStructMissingArrayStrideBad) { CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("must be explicitly laid out with ArrayStride decorations")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must be explicitly laid out with ArrayStride or " + "ArrayStrideIdEXT decorations")); } TEST_F(ValidateDecorations, BlockMissingMatrixStrideBad) { @@ -1863,6 +1864,8 @@ TEST_F(ValidateDecorations, BlockStandardUniformBufferLayout) { OpMemberDecorate %Output 6 MatrixStride 16 OpMemberDecorate %Output 7 Offset 128 OpDecorate %Output Block + OpDecorate %dataOutput DescriptorSet 0 + OpDecorate %dataOutput Binding 0 %void = OpTypeVoid %3 = OpTypeFunction %void %float = OpTypeFloat 32 @@ -2549,6 +2552,10 @@ TEST_F(ValidateDecorations, BufferBlock16bitStandardStorageBufferLayout) { OpMemberDecorate %SSBO16 0 Offset 0 OpDecorate %SSBO32 BufferBlock OpDecorate %SSBO16 BufferBlock + OpDecorate %varSSBO32 DescriptorSet 0 + OpDecorate %varSSBO32 Binding 0 + OpDecorate %varSSBO16 DescriptorSet 0 + OpDecorate %varSSBO16 Binding 1 %void = OpTypeVoid %voidf = OpTypeFunction %void %u32 = OpTypeInt 32 0 @@ -3476,6 +3483,7 @@ TEST_F(ValidateDecorations, VulkanStorageBufferMissingDescriptorSetBad) { OpExecutionMode %1 OriginUpperLeft OpDecorate %struct Block + OpMemberDecorate %struct 0 Offset 0 OpDecorate %var Binding 0 %void = OpTypeVoid @@ -3518,6 +3526,7 @@ TEST_F(ValidateDecorations, VulkanStorageBufferMissingBindingBad) { OpExecutionMode %1 OriginUpperLeft OpDecorate %struct Block + OpMemberDecorate %struct 0 Offset 0 OpDecorate %var DescriptorSet 0 %void = OpTypeVoid @@ -3560,6 +3569,7 @@ TEST_F(ValidateDecorations, OpExecutionMode %1 OriginUpperLeft OpDecorate %struct Block + OpMemberDecorate %struct 0 Offset 0 OpDecorate %var Binding 0 %void = OpTypeVoid @@ -3598,35 +3608,6 @@ TEST_F(ValidateDecorations, "decorations specified")); } -TEST_F(ValidateDecorations, - VulkanStorageBufferMissingDescriptorAndBindingUnusedGood) { - std::string spirv = R"( - OpCapability Shader - OpExtension "SPV_KHR_storage_buffer_storage_class" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %1 "main" - OpExecutionMode %1 OriginUpperLeft - OpDecorate %struct Block - OpMemberDecorate %struct 0 Offset 0 - - %void = OpTypeVoid - %voidfn = OpTypeFunction %void - %float = OpTypeFloat 32 - %struct = OpTypeStruct %float - %ptr = OpTypePointer StorageBuffer %struct - %var = OpVariable %ptr StorageBuffer - - %1 = OpFunction %void None %voidfn - %label = OpLabel - OpReturn - OpFunctionEnd -)"; - - CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); - EXPECT_EQ(SPV_SUCCESS, - ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_1)); -} - TEST_F(ValidateDecorations, UniformMissingDescriptorSetGood) { std::string spirv = R"( OpCapability Shader @@ -3903,6 +3884,8 @@ TEST_F(ValidateDecorations, BufferBlockStandardStorageBufferLayout) { OpMemberDecorate %Output 6 MatrixStride 16 OpMemberDecorate %Output 7 Offset 96 OpDecorate %Output BufferBlock + OpDecorate %dataOutput DescriptorSet 0 + OpDecorate %dataOutput Binding 0 %void = OpTypeVoid %3 = OpTypeFunction %void %float = OpTypeFloat 32 @@ -4036,6 +4019,8 @@ TEST_F(ValidateDecorations, OpMemberDecorate %Output 6 MatrixStride 16 OpMemberDecorate %Output 7 Offset 128 OpDecorate %Output Block + OpDecorate %dataOutput DescriptorSet 0 + OpDecorate %dataOutput Binding 0 %void = OpTypeVoid %3 = OpTypeFunction %void %float = OpTypeFloat 32 @@ -4104,6 +4089,8 @@ TEST_F(ValidateDecorations, OpMemberDecorate %Output 6 MatrixStride 16 OpMemberDecorate %Output 7 Offset 128 OpDecorate %Output Block + OpDecorate %dataOutput DescriptorSet 0 + OpDecorate %dataOutput Binding 0 %void = OpTypeVoid %3 = OpTypeFunction %void %float = OpTypeFloat 32 @@ -5445,6 +5432,97 @@ OpFunctionEnd EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } +// OpDecorateId + +TEST_F(ValidateDecorations, DecorateIdGood) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpName %subgroupscope "subgroupscope" +OpName %int0 "int0" +OpName %fn "fn" +OpDecorateId %int0 UniformId %subgroupscope +%void = OpTypeVoid +%float = OpTypeFloat 32 +%int = OpTypeInt 32 1 +%subgroupscope = OpConstant %int 3 +%int0 = OpConstantNull %int +%fn = OpTypeFunction %void +%main = OpFunction %void None %fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_4); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, DecorateIdGroupBad) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpName %subgroupscope "subgroupscope" +OpName %int0 "int0" +OpName %fn "fn" +OpName %group "group" +OpDecorateId %group UniformId %subgroupscope +%group = OpDecorationGroup +OpGroupDecorate %group %int0 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%int = OpTypeInt 32 1 +%subgroupscope = OpConstant %int 3 +%int0 = OpConstantNull %int +%fn = OpTypeFunction %void +%main = OpFunction %void None %fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_4); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not be an OpDecorationGroup instruction.\n" + " OpDecorateId %group UniformId %subgroupscope")); +} + +TEST_F(ValidateDecorations, DecorateIdOutOfOrderBad) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpName %subgroupscope "subgroupscope" +OpName %int0 "int0" +OpName %fn "fn" +OpDecorateId %int0 UniformId %subgroupscope +%void = OpTypeVoid +%float = OpTypeFloat 32 +%int = OpTypeInt 32 1 +%int0 = OpConstantNull %int +%subgroupscope = OpConstant %int 3 +%fn = OpTypeFunction %void +%main = OpFunction %void None %fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_4); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("[%subgroupscope]' must appear earlier in the" + " binary than the target\n" + " OpDecorateId %int0 UniformId %subgroupscope")); +} + // Uniform and UniformId decorations TEST_F(ValidateDecorations, UniformDecorationGood) { @@ -5486,6 +5564,7 @@ OpName %subgroupscope "subgroupscope" OpName %call "call" OpName %myfunc "myfunc" OpName %int0 "int0" +OpName %int1 "int1" OpName %float0 "float0" OpName %fn "fn" )") + inst + @@ -5493,10 +5572,11 @@ OpName %fn "fn" %void = OpTypeVoid %float = OpTypeFloat 32 %int = OpTypeInt 32 1 -%int0 = OpConstantNull %int +%int1 = OpConstant %int 1 %int_99 = OpConstant %int 99 %subgroupscope = OpConstant %int 3 %float0 = OpConstantNull %float +%int0 = OpConstantNull %int %fn = OpTypeFunction %void %myfunc = OpFunction %void None %fn %myfuncentry = OpLabel @@ -5613,7 +5693,7 @@ TEST_F(ValidateDecorations, TEST_F(ValidateDecorations, UniformDecorationWithScopeIdV14VulkanEnv) { const std::string spirv = - ShaderWithUniformLikeDecoration("OpDecorateId %int0 UniformId %int0"); + ShaderWithUniformLikeDecoration("OpDecorateId %int0 UniformId %int1"); CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1_SPIRV_1_4); EXPECT_EQ(SPV_ERROR_INVALID_DATA, @@ -7363,9 +7443,9 @@ TEST_F(ValidateDecorations, ComponentDecoration64Vec2BadVulkan) { EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState(env)); EXPECT_THAT(getDiagnosticString(), AnyVUID("VUID-StandaloneSpirv-Component-04922")); - HasSubstr( - "Sequence of components starting with 2 " - "and ending with 6 gets larger than 3"); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Sequence of components starting with 2 " + "and ending with 5 gets larger than 3")); } TEST_F(ValidateDecorations, ComponentDecoration64VecWideBadVulkan) { @@ -7502,6 +7582,8 @@ OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 OpDecorate %struct Block OpMemberDecorate %struct 0 Offset 0 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 %void = OpTypeVoid %uint = OpTypeInt 32 0 %struct = OpTypeStruct %uint @@ -7615,6 +7697,8 @@ OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 OpDecorate %struct Block OpMemberDecorate %struct 0 Offset 0 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 %void = OpTypeVoid %uint = OpTypeInt 32 0 %struct = OpTypeStruct %uint @@ -7639,6 +7723,8 @@ OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 OpDecorate %struct BufferBlock OpMemberDecorate %struct 0 Offset 0 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 %void = OpTypeVoid %uint = OpTypeInt 32 0 %struct = OpTypeStruct %uint @@ -9453,9 +9539,9 @@ OpFunctionEnd CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_4); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("Non-unique OpEntryPoint interface '2[%var]' is disallowed")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("In SPIR-V 1.4 or later, non-unique OpEntryPoint " + "interface '2[%var]' is disallowed")); } TEST_F(ValidateDecorations, PhysicalStorageBufferMissingOffset) { @@ -10304,6 +10390,7 @@ OpMemberDecorate %struct 0 Offset 0 OpMemberDecorate %struct 1 Offset 4 )" + set + R"(OpMemberDecorate %test_type 0 Offset 0 OpMemberDecorate %test_type 1 Offset 1 +OpDecorate %ptr ArrayStride 16 %void = OpTypeVoid %int = OpTypeInt 32 0 %int_0 = OpConstant %int 0 @@ -10312,7 +10399,8 @@ OpMemberDecorate %test_type 1 Offset 1 %test_val = OpConstantNull %test_type %ptr = OpTypeUntypedPointerKHR )" + sc + R"( -%var = OpUntypedVariableKHR %ptr )" + sc + R"( %struct +%var = OpUntypedVariableKHR %ptr )" + + sc + R"( %struct %void_fn = OpTypeFunction %void %main = OpFunction %void None %void_fn %entry = OpLabel @@ -10355,6 +10443,7 @@ OpDecorate %struct Block OpMemberDecorate %struct 0 Offset 0 OpMemberDecorate %struct 1 Offset 4 )" + set + R"(OpDecorate %test_type ArrayStride 4 +OpDecorate %ptr ArrayStride 16 %void = OpTypeVoid %int = OpTypeInt 32 0 %int_0 = OpConstant %int 0 @@ -10365,7 +10454,8 @@ OpMemberDecorate %struct 1 Offset 4 %struct = OpTypeStruct %int %int %ptr = OpTypeUntypedPointerKHR )" + sc + R"( -%var = OpUntypedVariableKHR %ptr )" + sc + R"( %struct +%var = OpUntypedVariableKHR %ptr )" + + sc + R"( %struct %void_fn = OpTypeFunction %void %main = OpFunction %void None %void_fn %entry = OpLabel @@ -10519,8 +10609,8 @@ const std::string kNodeShaderPostlude = R"( %node1 = OpConstantStringAMDX "node1" %node2 = OpConstantStringAMDX "node2" %S = OpTypeStruct -%_payloadarr_S = OpTypeNodePayloadArrayAMDX %S %_payloadarr_S_0 = OpTypeNodePayloadArrayAMDX %S +%_payloadarr_S = OpTypeNodePayloadArrayAMDX %S %bool = OpTypeBool %true = OpConstantTrue %bool %void = OpTypeVoid @@ -11171,6 +11261,139 @@ OpFunctionEnd AnyVUID("VUID-StandaloneSpirv-OpTypeRuntimeArray-04680")); } +TEST_F(ValidateDecorations, LongVectorUniformPass) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Int8 +OpCapability UniformAndStorageBuffer8BitAccess +OpCapability LongVectorEXT + +OpExtension "SPV_KHR_8bit_storage" +OpExtension "SPV_EXT_long_vector" + +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %BP_main "main" + +OpDecorate %input0 DescriptorSet 0 +OpDecorate %input0 Binding 0 +OpDecorate %a10testtype ArrayStride 12 +OpDecorate %buf BufferBlock +OpMemberDecorate %buf 0 Offset 0 + +%void = OpTypeVoid +%bool = OpTypeBool +%u32 = OpTypeInt 32 0 +%voidf = OpTypeFunction %void +%c_u32_10 = OpConstant %u32 10 +%vectorSizeConst = OpConstant %u32 12 + +%scalartype = OpTypeInt 8 1 +%testtype = OpTypeVectorIdEXT %scalartype %vectorSizeConst + +%a10testtype = OpTypeArray %testtype %c_u32_10 +%buf = OpTypeStruct %a10testtype +%bufptr = OpTypePointer Uniform %buf + +%input0 = OpVariable %bufptr Uniform + + +%BP_main = OpFunction %void None %voidf +%BP_label = OpLabel +OpReturn +OpFunctionEnd + +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateDecorations, LongVectorUniformSpecConstantFail) { + const std::string spirv = R"( +OpCapability Shader +OpCapability LongVectorEXT + +OpExtension "SPV_EXT_long_vector" + +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %BP_main "main" + +OpDecorate %input0 DescriptorSet 0 +OpDecorate %input0 Binding 0 +OpDecorate %buf BufferBlock +OpMemberDecorate %buf 0 Offset 0 +OpDecorate %spec_const SpecId 1 + +%void = OpTypeVoid +%bool = OpTypeBool +%u32 = OpTypeInt 32 0 +%voidf = OpTypeFunction %void +%spec_const = OpSpecConstant %u32 12 + +%scalartype = OpTypeInt 32 1 +%testtype = OpTypeVectorIdEXT %scalartype %spec_const + +%buf = OpTypeStruct %testtype +%bufptr = OpTypePointer Uniform %buf + +%input0 = OpVariable %bufptr Uniform + + +%BP_main = OpFunction %void None %voidf +%BP_label = OpLabel +OpReturn +OpFunctionEnd + +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-Function-12294")); +} + +TEST_F(ValidateDecorations, LongVectorWorkgroupSpecConstantFail) { + const std::string spirv = R"( +OpCapability Shader +OpCapability LongVectorEXT +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" + +OpExtension "SPV_EXT_long_vector" + +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %BP_main "main" + +OpDecorate %spec_const SpecId 1 +OpMemberDecorate %str 0 Offset 0 +OpDecorate %str Block + +%void = OpTypeVoid +%bool = OpTypeBool +%u32 = OpTypeInt 32 0 +%voidf = OpTypeFunction %void +%spec_const = OpSpecConstant %u32 12 + +%scalartype = OpTypeInt 32 1 +%testtype = OpTypeVectorIdEXT %scalartype %spec_const + +%str = OpTypeStruct %testtype +%ptr_str_Workgroup = OpTypePointer Workgroup %str +%var = OpVariable %ptr_str_Workgroup Workgroup + +%BP_main = OpFunction %void None %voidf +%BP_label = OpLabel +OpReturn +OpFunctionEnd + +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-Function-12294")); +} + } // namespace } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_entry_point_test.cpp b/third_party/spirv-tools/test/val/val_entry_point_test.cpp index f28cf5d19c..80b90a505a 100644 --- a/third_party/spirv-tools/test/val/val_entry_point_test.cpp +++ b/third_party/spirv-tools/test/val/val_entry_point_test.cpp @@ -50,6 +50,33 @@ OpFunctionEnd HasSubstr("Entry points cannot share the same name")); } +TEST_F(ValidateEntryPoints, DuplicateConditionalEntryPointsAllowed) { + const std::string body = R"( +OpCapability Shader +OpCapability SpecConditionalINTEL +OpExtension "SPV_INTEL_function_variants" +OpMemoryModel Logical GLSL450 +OpConditionalEntryPointINTEL %10 GLCompute %3 "foo" +OpConditionalEntryPointINTEL %11 GLCompute %4 "foo" +%bool = OpTypeBool +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%10 = OpSpecConstantTrue %bool +%11 = OpSpecConstantFalse %bool +%3 = OpFunction %1 None %2 +%20 = OpLabel +OpReturn +OpFunctionEnd +%4 = OpFunction %1 None %2 +%21 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(body); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + TEST_F(ValidateEntryPoints, UniqueEntryPoints) { const std::string body = R"( OpCapability Shader diff --git a/third_party/spirv-tools/test/val/val_extension_spv_ext_descriptor_heap.cpp b/third_party/spirv-tools/test/val/val_extension_spv_ext_descriptor_heap.cpp new file mode 100644 index 0000000000..5feef7d9b2 --- /dev/null +++ b/third_party/spirv-tools/test/val/val_extension_spv_ext_descriptor_heap.cpp @@ -0,0 +1,2367 @@ +// Copyright 2025 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Tests for SPV_EXT_descriptor_heap + +#include + +#include "gmock/gmock.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; + +using ValidateSpvEXTDescriptorHeap = spvtest::ValidateBase; + +TEST_F(ValidateSpvEXTDescriptorHeap, Valid) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability ShaderNonUniform + OpCapability UniformBufferArrayNonUniformIndexing + OpCapability StorageBufferArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %sampler_heap %fragColor %uvs %index + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %sampler_heap "sampler_heap" + OpName %uvs "uvs" + OpName %index "index" + OpName %UniformBuffer "UniformBuffer" + OpMemberName %UniformBuffer 0 "colorOffset" + OpName %StorageBufferA "StorageBufferA" + OpMemberName %StorageBufferA 0 "a" + OpName %StorageBufferB "StorageBufferB" + OpMemberName %StorageBufferB 0 "b" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorateId %_runtimearr_14 ArrayStrideIdEXT %17 + OpDecorate %sampler_heap BuiltIn SamplerHeapEXT + OpDecorateId %_runtimearr_22 ArrayStrideIdEXT %uint_2 + OpDecorate %uvs Location 0 + OpDecorate %index Flat + OpDecorate %index Location 1 + OpDecorate %38 NonUniform + OpDecorate %UniformBuffer Block + OpMemberDecorate %UniformBuffer 0 Offset 0 + OpDecorateId %_runtimearr_41 ArrayStrideIdEXT %42 + OpDecorate %44 NonUniform + OpDecorate %46 NonUniform + OpDecorate %48 NonUniform + OpDecorate %StorageBufferA Block + OpMemberDecorate %StorageBufferA 0 Offset 0 + OpDecorateId %_runtimearr_58 ArrayStrideIdEXT %59 + OpDecorate %64 NonUniform + OpDecorate %StorageBufferB Block + OpMemberDecorate %StorageBufferB 0 Offset 0 + OpDecorateId %_runtimearr_58_0 ArrayStrideIdEXT %69 + OpDecorate %71 NonUniform + OpDecorate %73 NonUniform + OpDecorate %77 NonUniform + OpDecorate %44 NonReadable + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %fragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_27 = OpConstant %int 27 + %14 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform + %17 = OpConstantSizeOfEXT %int %14 +%_runtimearr_14 = OpTypeRuntimeArray %14 +%sampler_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int_0 = OpConstant %int 0 + %22 = OpTypeSampler + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_runtimearr_22 = OpTypeRuntimeArray %22 + %28 = OpTypeSampledImage %14 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %uvs = OpVariable %_ptr_Input_v2float Input +%_ptr_Input_uint = OpTypePointer Input %uint + %index = OpVariable %_ptr_Input_uint Input +%UniformBuffer = OpTypeStruct %v4float + %41 = OpTypeBufferEXT Uniform + %42 = OpConstantSizeOfEXT %int %41 +%_runtimearr_41 = OpTypeRuntimeArray %41 + %int_1 = OpConstant %int 1 +%StorageBufferA = OpTypeStruct %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %55 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 +%_ptr_StorageBuffer = OpTypeUntypedPointerKHR StorageBuffer + %58 = OpTypeBufferEXT StorageBuffer + %59 = OpConstantSizeOfEXT %int %58 +%_runtimearr_58 = OpTypeRuntimeArray %58 + %v3float = OpTypeVector %float 3 +%StorageBufferB = OpTypeStruct %v3float + %uint_0 = OpConstant %uint 0 + %69 = OpConstantSizeOfEXT %int %58 +%_runtimearr_58_0 = OpTypeRuntimeArray %58 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_14 %resource_heap %int_27 + %19 = OpLoad %14 %16 + %23 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_22 %sampler_heap %int_0 + %27 = OpLoad %22 %23 + %29 = OpSampledImage %28 %19 %27 + %33 = OpLoad %v2float %uvs + %34 = OpImageSampleImplicitLod %v4float %29 %33 + OpStore %fragColor %34 + %37 = OpLoad %uint %index + %38 = OpCopyObject %uint %37 + %40 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_41 %resource_heap %38 + %44 = OpBufferPointerEXT %_ptr_Uniform %40 + %45 = OpUntypedAccessChainKHR %_ptr_Uniform %UniformBuffer %44 %int_0 + %46 = OpLoad %v4float %45 + %47 = OpLoad %v4float %fragColor + %48 = OpFAdd %v4float %47 %46 + OpStore %fragColor %48 + %57 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_58 %resource_heap %int_1 + %61 = OpBufferPointerEXT %_ptr_StorageBuffer %57 + %62 = OpUntypedAccessChainKHR %_ptr_StorageBuffer %StorageBufferA %61 %int_0 + OpStore %62 %55 + %63 = OpLoad %uint %index + %64 = OpCopyObject %uint %63 + %68 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_58_0 %resource_heap %64 + %71 = OpBufferPointerEXT %_ptr_StorageBuffer %68 + %72 = OpUntypedAccessChainKHR %_ptr_StorageBuffer %StorageBufferB %71 %int_0 %uint_0 + %73 = OpLoad %float %72 + %75 = OpAccessChain %_ptr_Output_float %fragColor %uint_0 + %76 = OpLoad %float %75 + %77 = OpFAdd %float %76 %73 + %78 = OpAccessChain %_ptr_Output_float %fragColor %uint_0 + OpStore %78 %77 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OffsetId64BitIndexingGood) { + const std::string str = R"( + OpCapability Shader + OpCapability Shader64BitIndexingEXT + OpCapability DescriptorHeapEXT + OpCapability Int64 + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_EXT_shader_64bit_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 + OpExecutionMode %2 LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %4 0 Offset 0 + OpMemberDecorate %4 1 Offset 4 + OpMemberDecorate %4 2 Offset 8 + OpMemberDecorate %4 3 Offset 12 + OpDecorate %4 Block + OpDecorate %3 Binding 0 + OpDecorate %3 DescriptorSet 0 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeInt 32 0 + %8 = OpTypeInt 64 0 + %4 = OpTypeStruct %7 %7 %7 %7 + %9 = OpTypePointer StorageBuffer %4 + %3 = OpVariable %9 StorageBuffer + %10 = OpTypeInt 32 1 + %11 = OpConstant %10 0 + %12 = OpConstant %10 1 + %13 = OpConstant %10 2 + %14 = OpConstant %10 3 + %15 = OpTypePointer StorageBuffer %7 + %16 = OpTypeBufferEXT StorageBuffer + %17 = OpTypeBufferEXT Uniform + %18 = OpTypeImage %7 2D 0 0 0 1 Unknown + %19 = OpTypeSampler + %20 = OpConstantSizeOfEXT %8 %16 + %21 = OpConstantSizeOfEXT %8 %17 + %22 = OpConstantSizeOfEXT %8 %18 + %23 = OpConstantSizeOfEXT %8 %19 + %2 = OpFunction %5 None %6 + %24 = OpLabel + %25 = OpAccessChain %15 %3 %11 + %26 = OpAccessChain %15 %3 %12 + %27 = OpAccessChain %15 %3 %13 + %28 = OpAccessChain %15 %3 %14 + %29 = OpUConvert %7 %20 + %30 = OpUConvert %7 %21 + %31 = OpUConvert %7 %22 + %32 = OpUConvert %7 %23 + OpStore %25 %29 + OpStore %26 %30 + OpStore %27 %31 + OpStore %28 %32 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, AtomicImageFuncs) { + const std::string str = R"( + OpCapability Shader + OpCapability Image1D + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %resource_heap + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %resource_heap "resource_heap" + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorateId %_runtimearr_10 ArrayStrideIdEXT %13 + %void = OpTypeVoid + %3 = OpTypeFunction %void +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %10 = OpTypeImage %int 1D 0 0 0 2 R32i + %13 = OpConstantSizeOfEXT %int %10 +%_runtimearr_10 = OpTypeRuntimeArray %10 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Image_int = OpTypePointer Image %int + %_ptr_Image = OpTypeUntypedPointerKHR Image + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_10 %resource_heap %int_1 + %19 = OpUntypedImageTexelPointerEXT %_ptr_Image %10 %12 %int_1 %uint_0 + %21 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %int_1 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, ValidMemberDecorateIdExt) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability BindlessTextureNV + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpExtension "SPV_NV_bindless_texture" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpSamplerImageAddressingModeNV 64 + OpEntryPoint Fragment %main "main" %resource_heap %fragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "uv" + OpMemberName %U 1 "k" + OpMemberName %U 2 "g" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorateIdEXT %U 0 OffsetIdEXT %specA + OpMemberDecorateIdEXT %U 1 OffsetIdEXT %specB + OpMemberDecorateIdEXT %U 2 OffsetIdEXT %specC + OpDecorateId %_runtimearr_20 ArrayStrideIdEXT %uint_2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %fragColor = OpVariable %_ptr_Output_v2float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %samplerTy = OpTypeSampler +%_runtimearr_sampler = OpTypeRuntimeArray %samplerTy + %specA = OpSpecConstant %int 0 + %specB = OpSpecConstant %int 4 + %specC = OpSpecConstant %int 8 + %U = OpTypeStruct %samplerTy %samplerTy %_runtimearr_sampler + %int_0 = OpConstant %int 0 +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform + %20 = OpTypeBufferEXT Uniform + %uint_2 = OpConstant %uint 2 +%_runtimearr_20 = OpTypeRuntimeArray %20 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_20 %resource_heap %int_3 + %23 = OpBufferPointerEXT %_ptr_Uniform %19 + %24 = OpUntypedAccessChainKHR %_ptr_Uniform %U %23 %int_0 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, ValidMemberDecorateIdExt2) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability BindlessTextureNV + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpExtension "SPV_NV_bindless_texture" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpSamplerImageAddressingModeNV 64 + OpEntryPoint Fragment %main "main" %resource_heap %fragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "uv" + OpMemberName %U 1 "k" + OpMemberName %U 2 "g" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorateIdEXT %U 0 OffsetIdEXT %specA + OpMemberDecorateIdEXT %U 1 OffsetIdEXT %specB + OpMemberDecorateIdEXT %U 2 OffsetIdEXT %specC + OpDecorateId %_runtimearr_20 ArrayStrideIdEXT %uint_2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %fragColor = OpVariable %_ptr_Output_v2float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %samplerTy = OpTypeSampler +%_runtimearr_sampler = OpTypeRuntimeArray %samplerTy + %specA = OpSpecConstant %int 0 + %specB = OpSpecConstant %int 4 + %specC = OpSpecConstant %int 8 + %U = OpTypeStruct %v2float %int %_runtimearr_sampler + %int_0 = OpConstant %int 0 +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform + %20 = OpTypeBufferEXT Uniform + %uint_2 = OpConstant %uint 2 +%_runtimearr_20 = OpTypeRuntimeArray %20 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_20 %resource_heap %int_3 + %23 = OpBufferPointerEXT %_ptr_Uniform %19 + %24 = OpUntypedAccessChainKHR %_ptr_Uniform %U %23 %int_0 + %25 = OpLoad %v2float %24 + OpStore %fragColor %25 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); +} + +// From VVL CTS +TEST_F(ValidateSpvEXTDescriptorHeap, Alignment) { + const std::string str = R"( + OpCapability Shader + OpCapability SampledBuffer + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 %4 %5 + OpExecutionMode %2 LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpDecorate %3 BuiltIn ResourceHeapEXT + OpDecorateId %_runtimearr_12 ArrayStrideIdEXT %7 + OpDecorate %4 Binding 0 + OpDecorate %4 DescriptorSet 0 + OpDecorate %_struct_8 Block + OpMemberDecorate %_struct_8 0 Offset 0 + OpDecorate %5 Binding 1 + OpDecorate %5 DescriptorSet 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %12 = OpTypeImage %uint Buffer 0 0 0 1 Unknown +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant + %15 = OpTypeFunction %uint %_ptr_UniformConstant + %uint_0 = OpConstant %uint 0 + %v4uint = OpTypeVector %uint 4 + %v2uint = OpTypeVector %uint 2 + %3 = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %7 = OpConstantSizeOfEXT %uint %12 +%_runtimearr_12 = OpTypeRuntimeArray %12 +%_ptr_Function_uint = OpTypePointer Function %uint + %4 = OpVariable %_ptr_UniformConstant_12 UniformConstant + %uint_1 = OpConstant %uint 1 + %_struct_8 = OpTypeStruct %v2uint +%_ptr_StorageBuffer__struct_8 = OpTypePointer StorageBuffer %_struct_8 + %5 = OpVariable %_ptr_StorageBuffer__struct_8 StorageBuffer +%_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint + %v3uint = OpTypeVector %uint 3 + %24 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %25 = OpFunction %uint None %15 + %26 = OpFunctionParameter %_ptr_UniformConstant + %27 = OpLabel + %28 = OpLoad %12 %26 + %29 = OpImageFetch %v4uint %28 %uint_0 ZeroExtend + %30 = OpCompositeExtract %uint %29 0 + OpReturnValue %30 + OpFunctionEnd + %2 = OpFunction %void None %10 + %31 = OpLabel + %32 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_12 %3 %uint_0 + %33 = OpUntypedAccessChainKHR %_ptr_UniformConstant %12 %4 + %34 = OpFunctionCall %uint %25 %32 + %35 = OpFunctionCall %uint %25 %33 + %36 = OpCompositeConstruct %v2uint %34 %35 + %37 = OpAccessChain %_ptr_StorageBuffer_v2uint %5 %uint_0 + OpStore %37 %36 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, HeapBaseVarStorageClassResource) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %o "o" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "inputData" + OpDecorate %o Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_17 ArrayStrideIdEXT %18 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %o = OpVariable %_ptr_Output_uint Output +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform +%resource_heap = OpUntypedVariableKHR %_ptr_Uniform Uniform + %int = OpTypeInt 32 1 + %int_9 = OpConstant %int 9 + %U = OpTypeStruct %uint + %int_0 = OpConstant %int 0 + %17 = OpTypeBufferEXT Uniform + %18 = OpConstantSizeOfEXT %int %17 +%_runtimearr_17 = OpTypeRuntimeArray %17 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_Uniform %_runtimearr_17 %resource_heap %int_9 + %20 = OpBufferPointerEXT %_ptr_Uniform %16 + %21 = OpUntypedAccessChainKHR %_ptr_Uniform %U %20 %int_0 + %22 = OpLoad %uint %21 + OpStore %o %22 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-StandaloneSpirv-OpUntypedVariableKHR-11167")); + EXPECT_THAT( + diag, + HasSubstr("Storage class is Uniform, but Vulkan requires that Data Type " + "be specified when not using UniformConstant storage class")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, HeapBaseVarStorageClassSampler) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %sampler_heap %fragColor %uvs + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %sampler_heap "sampler_heap" + OpName %uvs "uvs" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorateId %_runtimearr_14 ArrayStrideIdEXT %17 + OpDecorate %sampler_heap BuiltIn SamplerHeapEXT + OpDecorateId %_runtimearr_22 ArrayStrideIdEXT %uint_2 + OpDecorate %uvs Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %fragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_StorageBuffer = OpTypeUntypedPointerKHR StorageBuffer + %int = OpTypeInt 32 1 + %int_27 = OpConstant %int 27 + %14 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant + %17 = OpConstantSizeOfEXT %int %14 +%_runtimearr_14 = OpTypeRuntimeArray %14 +%sampler_heap = OpUntypedVariableKHR %_ptr_StorageBuffer StorageBuffer +%resource_heap = OpUntypedVariableKHR %_ptr_StorageBuffer StorageBuffer + %int_0 = OpConstant %int 0 + %22 = OpTypeSampler + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_runtimearr_22 = OpTypeRuntimeArray %22 + %28 = OpTypeSampledImage %14 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %uvs = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_StorageBuffer %_runtimearr_14 %resource_heap %int_27 + %19 = OpLoad %14 %16 + %23 = OpUntypedAccessChainKHR %_ptr_StorageBuffer %_runtimearr_22 %sampler_heap %int_0 + %27 = OpLoad %22 %23 + %29 = OpSampledImage %28 %19 %27 + %33 = OpLoad %v2float %uvs + %34 = OpImageSampleImplicitLod %v4float %29 %33 + OpStore %fragColor %34 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-StandaloneSpirv-OpUntypedVariableKHR-11167")); + EXPECT_THAT( + diag, + HasSubstr( + "Storage class is StorageBuffer, but Vulkan requires that Data Type " + "be specified when not using UniformConstant storage class")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, ResourceHeapWorkgroup) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability WorkgroupMemoryExplicitLayoutKHR + OpExtension "SPV_KHR_workgroup_memory_explicit_layout" + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + %void = OpTypeVoid + %3 = OpTypeFunction %void + %15 = OpTypeBufferEXT StorageBuffer +%_ptr_workgroup = OpTypeUntypedPointerKHR Workgroup +%resource_heap = OpUntypedVariableKHR %_ptr_workgroup Workgroup %15 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-ResourceHeapEXT-ResourceHeapEXT-11241")); + EXPECT_THAT(diag, + HasSubstr("The variable decorated with ResourceHeapEXT must be " + "declared using the UniformConstant storage class")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, SamplerHeapWorkgroup) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability WorkgroupMemoryExplicitLayoutKHR + OpExtension "SPV_KHR_workgroup_memory_explicit_layout" + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %resource_heap BuiltIn SamplerHeapEXT + %void = OpTypeVoid + %3 = OpTypeFunction %void + %15 = OpTypeBufferEXT StorageBuffer +%_ptr_workgroup = OpTypeUntypedPointerKHR Workgroup +%resource_heap = OpUntypedVariableKHR %_ptr_workgroup Workgroup %15 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-SamplerHeapEXT-SamplerHeapEXT-11239")); + EXPECT_THAT(diag, + HasSubstr("The variable decorated with SamplerHeapEXT must be " + "declared using the UniformConstant storage class")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, LoadDescHeapDerivedSampler) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %sampler_heap %fragColor %uvs + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %sampler_heap "sampler_heap" + OpName %uvs "uvs" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorateId %_runtimearr_14 ArrayStrideIdEXT %17 + OpDecorate %sampler_heap BuiltIn ResourceHeapEXT + OpDecorateId %_runtimearr_22 ArrayStrideIdEXT %uint_2 + OpDecorate %uvs Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %fragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_27 = OpConstant %int 27 + %14 = OpTypeImage %float 2D 0 0 0 1 Unknown + %17 = OpConstantSizeOfEXT %int %14 +%_runtimearr_14 = OpTypeRuntimeArray %14 +%sampler_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int_0 = OpConstant %int 0 + %22 = OpTypeSampler + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_runtimearr_22 = OpTypeRuntimeArray %22 + %28 = OpTypeSampledImage %14 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %uvs = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_14 %resource_heap %int_27 + %19 = OpLoad %14 %16 + %23 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_22 %sampler_heap %int_0 + %27 = OpLoad %22 %23 + %29 = OpSampledImage %28 %19 %27 + %33 = OpLoad %v2float %uvs + %34 = OpImageSampleImplicitLod %v4float %29 %33 + OpStore %fragColor %34 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-StandaloneSpirv-Result-11336")); + EXPECT_THAT( + diag, + HasSubstr( + "pointer instruction has no descriptor set or binding " + "and is not derived from a variable decorated with SamplerHeapEXT")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, LoadDescHeapDerivedImage) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %sampler_heap %fragColor %uvs + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %sampler_heap "sampler_heap" + OpName %uvs "uvs" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn SamplerHeapEXT + OpDecorateId %_runtimearr_14 ArrayStrideIdEXT %17 + OpDecorate %sampler_heap BuiltIn SamplerHeapEXT + OpDecorateId %_runtimearr_22 ArrayStrideIdEXT %uint_2 + OpDecorate %uvs Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %fragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_27 = OpConstant %int 27 + %14 = OpTypeImage %float 2D 0 0 0 1 Unknown + %17 = OpConstantSizeOfEXT %int %14 +%_runtimearr_14 = OpTypeRuntimeArray %14 +%sampler_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int_0 = OpConstant %int 0 + %22 = OpTypeSampler + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_runtimearr_22 = OpTypeRuntimeArray %22 + %28 = OpTypeSampledImage %14 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %uvs = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_14 %resource_heap %int_27 + %19 = OpLoad %14 %16 + %23 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_22 %sampler_heap %int_0 + %27 = OpLoad %22 %23 + %29 = OpSampledImage %28 %19 %27 + %33 = OpLoad %v2float %uvs + %34 = OpImageSampleImplicitLod %v4float %29 %33 + OpStore %fragColor %34 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-StandaloneSpirv-Result-11337")); + EXPECT_THAT( + diag, + HasSubstr( + "pointer instruction has no descriptor set or binding " + "and is not derived from a variable decorated with ResourceHeapEXT")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, LoadDescHeapDerivedAccStruct) { + const std::string str = R"( + OpCapability Shader + OpCapability RayQueryKHR + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpExtension "SPV_KHR_ray_query" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %resource_heap + OpExecutionMode %main LocalSize 1 1 1 + OpName %resource_heap "resource_heap" + OpDecorate %resource_heap BuiltIn SamplerHeapEXT + OpDecorateId %_runtimearr_14 ArrayStrideIdEXT %17 + %_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant + %resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_27 = OpConstant %int 27 + %void = OpTypeVoid + %as = OpTypeAccelerationStructureKHR + %ptr_as = OpTypePointer Function %as + %void_fn = OpTypeFunction %void + %17 = OpConstantSizeOfEXT %int %as + %_runtimearr_14 = OpTypeRuntimeArray %as + %main = OpFunction %void None %void_fn + %entry = OpLabel + %var = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_14 %resource_heap %int_27 + %value = OpLoad %as %var + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-StandaloneSpirv-Result-11339")); + EXPECT_THAT( + diag, + HasSubstr( + "pointer instruction has no descriptor set or binding " + "and is not derived from a variable decorated with ResourceHeapEXT")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, ConstantSizeOfScalarIntType) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %o "o" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "inputData" + OpDecorate %o Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_17 ArrayStrideIdEXT %18 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %o = OpVariable %_ptr_Output_uint Output +%_ptr_Uniform = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_Uniform UniformConstant + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_9 = OpConstant %int 9 + %U = OpTypeStruct %uint + %int_0 = OpConstant %int 0 + %17 = OpTypeBufferEXT Uniform + %18 = OpConstantSizeOfEXT %v2int %17 +%_runtimearr_17 = OpTypeRuntimeArray %17 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_Uniform %_runtimearr_17 %resource_heap %int_9 + %20 = OpBufferPointerEXT %_ptr_Uniform %16 + %21 = OpUntypedAccessChainKHR %_ptr_Uniform %U %20 %int_0 + %22 = OpLoad %uint %21 + OpStore %o %22 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + HasSubstr( + "ArrayStrideIdEXT extra operand must be a 32-bit int scalar type")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, ConstantSizeOfDescriptorTypeTarget) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %o "o" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "inputData" + OpDecorate %o Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_17 ArrayStrideIdEXT %18 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %o = OpVariable %_ptr_Output_uint Output +%_ptr_Uniform = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_Uniform UniformConstant + %int = OpTypeInt 32 1 + %int_9 = OpConstant %int 9 + %U = OpTypeStruct %uint + %int_0 = OpConstant %int 0 + %17 = OpTypeBufferEXT Uniform + %18 = OpConstantSizeOfEXT %int %U +%_runtimearr_17 = OpTypeRuntimeArray %17 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_Uniform %_runtimearr_17 %resource_heap %int_9 + %20 = OpBufferPointerEXT %_ptr_Uniform %16 + %21 = OpUntypedAccessChainKHR %_ptr_Uniform %U %20 %int_0 + %22 = OpLoad %uint %21 + OpStore %o %22 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, + HasSubstr("For OpConstantSizeOfEXT instruction, its Type operand " + " '5[%U]' must be a Descriptor type")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OffsetId64BitIndexingBad) { + const std::string str = R"( + OpCapability Shader + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 + OpExecutionMode %2 LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %4 0 Offset 0 + OpMemberDecorate %4 1 Offset 4 + OpMemberDecorate %4 2 Offset 8 + OpMemberDecorate %4 3 Offset 12 + OpDecorate %4 Block + OpDecorate %3 Binding 0 + OpDecorate %3 DescriptorSet 0 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeInt 32 0 + %8 = OpTypeInt 64 0 + %4 = OpTypeStruct %7 %7 %7 %7 + %9 = OpTypePointer StorageBuffer %4 + %3 = OpVariable %9 StorageBuffer + %10 = OpTypeInt 32 1 + %11 = OpConstant %10 0 + %12 = OpConstant %10 1 + %13 = OpConstant %10 2 + %14 = OpConstant %10 3 + %15 = OpTypePointer StorageBuffer %7 + %16 = OpTypeBufferEXT StorageBuffer + %17 = OpTypeBufferEXT Uniform + %18 = OpTypeImage %7 2D 0 0 0 1 Unknown + %19 = OpTypeSampler + %20 = OpConstantSizeOfEXT %8 %16 + %21 = OpConstantSizeOfEXT %8 %17 + %22 = OpConstantSizeOfEXT %8 %18 + %23 = OpConstantSizeOfEXT %8 %19 + %2 = OpFunction %5 None %6 + %24 = OpLabel + %25 = OpAccessChain %15 %3 %11 + %26 = OpAccessChain %15 %3 %12 + %27 = OpAccessChain %15 %3 %13 + %28 = OpAccessChain %15 %3 %14 + %29 = OpUConvert %7 %20 + %30 = OpUConvert %7 %21 + %31 = OpUConvert %7 %22 + %32 = OpUConvert %7 %23 + OpStore %25 %29 + OpStore %26 %30 + OpStore %27 %31 + OpStore %28 %32 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + HasSubstr("Using a 64-bit integer type requires the Int64 capability.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, TypeBufferEXTStorageClass) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %o "o" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "inputData" + OpDecorate %o Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_17 ArrayStrideIdEXT %18 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %o = OpVariable %_ptr_Output_uint Output +%_ptr_Uniform = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_Uniform UniformConstant + %int = OpTypeInt 32 1 + %int_9 = OpConstant %int 9 + %U = OpTypeStruct %uint + %int_0 = OpConstant %int 0 + %17 = OpTypeBufferEXT UniformConstant + %18 = OpConstantSizeOfEXT %int %17 +%_runtimearr_17 = OpTypeRuntimeArray %17 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_Uniform %_runtimearr_17 %resource_heap %int_9 + %20 = OpBufferPointerEXT %_ptr_Uniform %16 + %21 = OpUntypedAccessChainKHR %_ptr_Uniform %U %20 %int_0 + %22 = OpLoad %uint %21 + OpStore %o %22 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, HasSubstr("TypeBufferEXT StorageClass could only be " + "StorageBuffer or Uniform.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, BufferPointerEXTStorageClass) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %o "o" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "inputData" + OpDecorate %o Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_17 ArrayStrideIdEXT %18 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %o = OpVariable %_ptr_Output_uint Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_9 = OpConstant %int 9 + %U = OpTypeStruct %uint + %int_0 = OpConstant %int 0 + %17 = OpTypeBufferEXT Uniform + %18 = OpConstantSizeOfEXT %int %17 +%_runtimearr_17 = OpTypeRuntimeArray %17 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_17 %resource_heap %int_9 + %20 = OpBufferPointerEXT %_ptr_UniformConstant %16 + %21 = OpUntypedAccessChainKHR %_ptr_UniformConstant %U %20 %int_0 + %22 = OpLoad %uint %21 + OpStore %o %22 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + HasSubstr("OpBufferPointerEXT's Result Type must be a pointer " + "type with a Storage Class of Uniform or StorageBuffer.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, BufferPointerEXTLayout) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %o "o" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "inputData" + OpDecorate %o Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_17 ArrayStrideIdEXT %18 + OpDecorate %_ptr_UniformConstant Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %o = OpVariable %_ptr_Output_uint Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_9 = OpConstant %int 9 + %U = OpTypeStruct %uint + %int_0 = OpConstant %int 0 + %17 = OpTypeBufferEXT Uniform + %18 = OpConstantSizeOfEXT %int %17 +%_runtimearr_17 = OpTypeRuntimeArray %17 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_17 %resource_heap %int_9 + %20 = OpBufferPointerEXT %_ptr_UniformConstant %16 + %21 = OpUntypedAccessChainKHR %_ptr_UniformConstant %U %20 %int_0 + %22 = OpLoad %uint %21 + OpStore %o %22 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-StandaloneSpirv-Result-11346")); + EXPECT_THAT( + diag, HasSubstr("The result type operand of OpBufferPointerEXT " + "must have a Type operand that is explicitly laid out")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, BufferPointerEXTDecorate) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %o "o" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "inputData" + OpDecorate %o Location 0 + OpDecorate %resource_heap BuiltIn SamplerHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_17 ArrayStrideIdEXT %18 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %o = OpVariable %_ptr_Output_uint Output +%_ptr_Uniform = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_Uniform UniformConstant + %int = OpTypeInt 32 1 + %int_9 = OpConstant %int 9 + %U = OpTypeStruct %uint + %int_0 = OpConstant %int 0 + %17 = OpTypeBufferEXT Uniform + %18 = OpConstantSizeOfEXT %int %17 +%_runtimearr_17 = OpTypeRuntimeArray %17 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_Uniform %_runtimearr_17 %resource_heap %int_9 + %20 = OpBufferPointerEXT %_ptr_Uniform %16 + %21 = OpUntypedAccessChainKHR %_ptr_Uniform %U %20 %int_0 + %22 = OpLoad %uint %21 + OpStore %o %22 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, HasSubstr("OpBufferPointerEXT's buffer must be an untyped " + "pointer into a variable declared with the " + "ResourceHeapEXT built-in")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, BufferPointerEXTNonWritable) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %fragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "uv" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_18 ArrayStrideIdEXT %uint_2 + OpDecorate %22 NonWritable + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %fragColor = OpVariable %_ptr_Output_v2float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %U = OpTypeStruct %v2float + %int_0 = OpConstant %int 0 +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform + %18 = OpTypeBufferEXT Uniform + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_runtimearr_18 = OpTypeRuntimeArray %18 + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_18 %resource_heap %int_3 + %22 = OpBufferPointerEXT %_ptr_Uniform %17 + %23 = OpUntypedAccessChainKHR %_ptr_Uniform %U %22 %int_0 + %24 = OpLoad %v2float %23 + OpStore %fragColor %24 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, HasSubstr("Target of NonWritable decoration is invalid")); + EXPECT_THAT( + diag, + HasSubstr( + "cannot be used to OpBufferPointerEXT with Uniform storage class")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, BufferPointerEXTNonWritableWithSSBO) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %resource_heap %fragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "uv" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpDecorateId %_runtimearr_18 ArrayStrideIdEXT %uint_2 + OpDecorate %22 NonWritable + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %fragColor = OpVariable %_ptr_Output_v2float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %U = OpTypeStruct %v2float + %int_0 = OpConstant %int 0 +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform +%_ptr_Buffer = OpTypeUntypedPointerKHR StorageBuffer + %18 = OpTypeBufferEXT Uniform + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_runtimearr_18 = OpTypeRuntimeArray %18 + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_18 %resource_heap %int_3 + %22 = OpBufferPointerEXT %_ptr_Buffer %17 + %23 = OpUntypedAccessChainKHR %_ptr_Buffer %U %22 %int_0 + %24 = OpLoad %v2float %23 + OpStore %fragColor %24 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, MemberDecorateIdExtStruct) { + const std::string str = R"( + OpCapability Shader + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 %4 + OpExecutionMode %2 LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %5 0 Offset 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 0 + OpDecorate %5 Block + OpDecorate %6 Block + OpDecorate %7 SpecId 0 + OpMemberDecorateIdEXT %11 0 OffsetIdEXT %7 + OpMemberDecorate %6 1 Offset 4 + OpMemberDecorateIdEXT %6 2 OffsetIdEXT %8 + %9 = OpTypeVoid + %10 = OpTypeFunction %9 + %11 = OpTypeInt 32 0 + %5 = OpTypeStruct %11 + %12 = OpTypePointer StorageBuffer %5 + %13 = OpTypeImage %11 2D 0 0 0 1 Unknown + %14 = OpTypeBufferEXT Uniform + %15 = OpConstantSizeOfEXT %11 %13 + %16 = OpConstantSizeOfEXT %11 %14 + %17 = OpConstant %11 1 + %18 = OpConstant %11 8 + %19 = OpSpecConstantOp %11 IAdd %18 %15 + %20 = OpSpecConstantOp %11 ISub %19 %17 + %21 = OpSpecConstantOp %11 UDiv %20 %15 + %22 = OpSpecConstantOp %11 IMul %21 %15 + %23 = OpSpecConstantOp %11 IAdd %22 %15 + %24 = OpSpecConstantOp %11 IAdd %23 %16 + %25 = OpSpecConstantOp %11 ISub %24 %17 + %26 = OpSpecConstantOp %11 UDiv %25 %16 + %27 = OpSpecConstantOp %11 IMul %26 %16 + %8 = OpSpecConstantOp %11 IAdd %27 %16 + %7 = OpSpecConstant %11 4 + %3 = OpVariable %12 StorageBuffer + %28 = OpConstant %11 0 + %6 = OpTypeStruct %11 %11 %11 + %29 = OpTypePointer Uniform %6 + %4 = OpVariable %29 Uniform + %30 = OpTypePointer StorageBuffer %11 + %31 = OpConstant %11 2 + %2 = OpFunction %9 None %10 + %32 = OpLabel + %33 = OpAccessChain %30 %4 %28 + %34 = OpLoad %11 %33 + %35 = OpAccessChain %30 %4 %31 + %36 = OpLoad %11 %35 + %37 = OpIAdd %11 %34 %36 + %38 = OpAccessChain %30 %3 %28 + OpStore %38 %37 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, HasSubstr("MemberDecorateIdEXT Structure type")); + EXPECT_THAT(diag, HasSubstr("is not a struct type.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, DecorateIdArrayStrideIdEXT) { + const std::string str = R"( + OpCapability Shader + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 %4 + OpExecutionMode %2 LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %5 0 Offset 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 0 + OpDecorate %5 Block + OpDecorate %6 Block + OpDecorate %7 SpecId 0 + OpDecorateId %5 ArrayStrideIdEXT %7 + OpMemberDecorate %6 1 Offset 4 + OpMemberDecorateIdEXT %6 2 OffsetIdEXT %8 + %9 = OpTypeVoid + %10 = OpTypeFunction %9 + %11 = OpTypeInt 32 0 + %5 = OpTypeStruct %11 + %12 = OpTypePointer StorageBuffer %5 + %13 = OpTypeImage %11 2D 0 0 0 1 Unknown + %14 = OpTypeBufferEXT Uniform + %15 = OpConstantSizeOfEXT %11 %13 + %16 = OpConstantSizeOfEXT %11 %14 + %17 = OpConstant %11 1 + %18 = OpConstant %11 8 + %19 = OpSpecConstantOp %11 IAdd %18 %15 + %20 = OpSpecConstantOp %11 ISub %19 %17 + %21 = OpSpecConstantOp %11 UDiv %20 %15 + %22 = OpSpecConstantOp %11 IMul %21 %15 + %23 = OpSpecConstantOp %11 IAdd %22 %15 + %24 = OpSpecConstantOp %11 IAdd %23 %16 + %25 = OpSpecConstantOp %11 ISub %24 %17 + %26 = OpSpecConstantOp %11 UDiv %25 %16 + %27 = OpSpecConstantOp %11 IMul %26 %16 + %8 = OpSpecConstantOp %11 IAdd %27 %16 + %7 = OpSpecConstant %11 4 + %3 = OpVariable %12 StorageBuffer + %28 = OpConstant %11 0 + %6 = OpTypeStruct %11 %11 %11 + %29 = OpTypePointer Uniform %6 + %4 = OpVariable %29 Uniform + %30 = OpTypePointer StorageBuffer %11 + %31 = OpConstant %11 2 + %2 = OpFunction %9 None %10 + %32 = OpLabel + %33 = OpAccessChain %30 %4 %28 + %34 = OpLoad %11 %33 + %35 = OpAccessChain %30 %4 %31 + %36 = OpLoad %11 %35 + %37 = OpIAdd %11 %34 %36 + %38 = OpAccessChain %30 %3 %28 + OpStore %38 %37 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + HasSubstr( + "ArrayStrideIdEXT decoration must only be applied to array types.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, ArrayStrideNonDescriptor) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %resource_heap + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %ssbo Block + OpMemberDecorate %ssbo 0 BuiltIn ResourceHeapEXT + OpMemberDecorate %ssbo 0 Offset 0 + OpDecorateId %_runtimearr_13 ArrayStrideIdEXT %16 + OpDecorateId %_runtimearr_24 ArrayStrideIdEXT %25 + %void = OpTypeVoid + %3 = OpTypeFunction %void +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_16 = OpConstant %int 16 + %v4int = OpTypeVector %int 4 + %ssbo = OpTypeStruct %v4int + %int_0 = OpConstant %int 0 + %13 = OpTypeImage %int 2D 0 0 0 2 Rgba8i +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform + %16 = OpConstantSizeOfEXT %int %13 +%_runtimearr_13 = OpTypeRuntimeArray %13 + %24 = OpTypeBufferEXT StorageBuffer + %25 = OpConstantSizeOfEXT %int %24 +%_runtimearr_24 = OpTypeRuntimeArray %int + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, + HasSubstr("ArrayStrideIdEXT decoration must only be applied to " + "array type containing a Descriptor type.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, MemberDecorateIdArrayStrideIdEXT) { + const std::string str = R"( + OpCapability Shader + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 %4 + OpExecutionMode %2 LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %5 0 Offset 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 0 + OpDecorate %5 Block + OpDecorate %6 Block + OpDecorate %7 SpecId 0 + OpMemberDecorateIdEXT %6 0 ArrayStrideIdEXT %7 + OpMemberDecorate %6 1 Offset 4 + OpMemberDecorateIdEXT %6 2 OffsetIdEXT %8 + %9 = OpTypeVoid + %10 = OpTypeFunction %9 + %11 = OpTypeInt 32 0 + %5 = OpTypeStruct %11 + %12 = OpTypePointer StorageBuffer %5 + %13 = OpTypeImage %11 2D 0 0 0 1 Unknown + %14 = OpTypeBufferEXT Uniform + %15 = OpConstantSizeOfEXT %11 %13 + %16 = OpConstantSizeOfEXT %11 %14 + %17 = OpConstant %11 1 + %18 = OpConstant %11 8 + %19 = OpSpecConstantOp %11 IAdd %18 %15 + %20 = OpSpecConstantOp %11 ISub %19 %17 + %21 = OpSpecConstantOp %11 UDiv %20 %15 + %22 = OpSpecConstantOp %11 IMul %21 %15 + %23 = OpSpecConstantOp %11 IAdd %22 %15 + %24 = OpSpecConstantOp %11 IAdd %23 %16 + %25 = OpSpecConstantOp %11 ISub %24 %17 + %26 = OpSpecConstantOp %11 UDiv %25 %16 + %27 = OpSpecConstantOp %11 IMul %26 %16 + %8 = OpSpecConstantOp %11 IAdd %27 %16 + %7 = OpSpecConstant %11 4 + %3 = OpVariable %12 StorageBuffer + %28 = OpConstant %11 0 + %6 = OpTypeStruct %11 %11 %11 + %29 = OpTypePointer Uniform %6 + %4 = OpVariable %29 Uniform + %30 = OpTypePointer StorageBuffer %11 + %31 = OpConstant %11 2 + %2 = OpFunction %9 None %10 + %32 = OpLabel + %33 = OpAccessChain %30 %4 %28 + %34 = OpLoad %11 %33 + %35 = OpAccessChain %30 %4 %31 + %36 = OpLoad %11 %35 + %37 = OpIAdd %11 %34 %36 + %38 = OpAccessChain %30 %3 %28 + OpStore %38 %37 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, HasSubstr("ArrayStrideIdEXT could only be directly applied " + "to array type using OpDecorateId.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, MemberDecorateIdOffsetIdEXT) { + const std::string str = R"( + OpCapability Shader + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 %4 + OpExecutionMode %2 LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %5 0 Offset 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 0 + OpDecorate %5 Block + OpDecorate %6 Block + OpDecorate %7 SpecId 0 + OpMemberDecorateIdEXT %6 0 OffsetIdEXT %7 + OpMemberDecorate %6 1 Offset 4 + OpMemberDecorateIdEXT %6 2 ArrayStrideIdEXT %8 + %9 = OpTypeVoid + %10 = OpTypeFunction %9 + %11 = OpTypeInt 32 0 + %5 = OpTypeStruct %11 + %12 = OpTypePointer StorageBuffer %5 + %13 = OpTypeImage %11 2D 0 0 0 1 Unknown + %14 = OpTypeBufferEXT Uniform + %15 = OpConstantSizeOfEXT %11 %13 + %16 = OpConstantSizeOfEXT %11 %14 + %17 = OpConstant %11 1 + %18 = OpConstant %11 8 + %19 = OpSpecConstantOp %11 IAdd %18 %15 + %20 = OpSpecConstantOp %11 ISub %19 %17 + %21 = OpSpecConstantOp %11 UDiv %20 %15 + %22 = OpSpecConstantOp %11 IMul %21 %15 + %23 = OpSpecConstantOp %11 IAdd %22 %15 + %24 = OpSpecConstantOp %11 IAdd %23 %16 + %25 = OpSpecConstantOp %11 ISub %24 %17 + %26 = OpSpecConstantOp %11 UDiv %25 %16 + %27 = OpSpecConstantOp %11 IMul %26 %16 + %8 = OpSpecConstantOp %11 IAdd %27 %16 + %7 = OpSpecConstant %11 4 + %3 = OpVariable %12 StorageBuffer + %28 = OpConstant %11 0 + %6 = OpTypeStruct %11 %11 %11 + %29 = OpTypePointer Uniform %6 + %4 = OpVariable %29 Uniform + %30 = OpTypePointer StorageBuffer %11 + %31 = OpConstant %11 2 + %2 = OpFunction %9 None %10 + %32 = OpLabel + %33 = OpAccessChain %30 %4 %28 + %34 = OpLoad %11 %33 + %35 = OpAccessChain %30 %4 %31 + %36 = OpLoad %11 %35 + %37 = OpIAdd %11 %34 %36 + %38 = OpAccessChain %30 %3 %28 + OpStore %38 %37 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + HasSubstr( + "OffsetIdEXT decoration in MemberDecorateIdEXT must only be applied " + "to members of structs where the struct contains descriptor types.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OffsetIdAllSingleImages) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability ImageBuffer + OpExtension "SPV_KHR_untyped_pointers" + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %2 BuiltIn ResourceHeapEXT + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorateIdEXT %_struct_3 1 OffsetIdEXT %uint_0 + OpMemberDecorate %_struct_3 2 Offset 16 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_51966 = OpConstant %uint 51966 + %uint_0_0 = OpConstant %uint 0 +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant + %2 = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %14 = OpTypeImage %uint Buffer 0 0 0 2 R32ui + %_struct_3 = OpTypeStruct %14 %14 %14 + %1 = OpFunction %void None %7 + %15 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_struct_3 %2 %uint_2 + %17 = OpLoad %14 %16 + OpImageWrite %17 %uint_0 %uint_51966 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OffsetIdAllImages) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability ImageBuffer + OpExtension "SPV_KHR_untyped_pointers" + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %2 BuiltIn ResourceHeapEXT + OpDecorate %4 SpecId 0 + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorateIdEXT %_struct_3 1 OffsetIdEXT %4 + OpMemberDecorateIdEXT %_struct_3 2 OffsetIdEXT %5 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_51966 = OpConstant %uint 51966 + %uint_0_0 = OpConstant %uint 0 + %4 = OpSpecConstant %uint 0 + %5 = OpSpecConstantOp %uint IMul %4 %uint_2 +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant + %2 = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %14 = OpTypeImage %uint Buffer 0 0 0 2 R32ui + %_struct_3 = OpTypeStruct %14 %14 %14 + %1 = OpFunction %void None %7 + %15 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_struct_3 %2 %uint_2 + %17 = OpLoad %14 %16 + OpImageWrite %17 %uint_0 %uint_51966 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OffsetIdStructOfStructOfImage) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability ImageBuffer + OpExtension "SPV_KHR_untyped_pointers" + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %2 BuiltIn ResourceHeapEXT + OpMemberDecorate %struct 0 Offset 0 + OpMemberDecorateIdEXT %struct 1 OffsetIdEXT %uint_0 + OpMemberDecorate %image_struct 0 Offset 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_51966 = OpConstant %uint 51966 + %uint_0_0 = OpConstant %uint 0 +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant + %2 = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %14 = OpTypeImage %uint Buffer 0 0 0 2 R32ui + %image_struct = OpTypeStruct %14 + %struct = OpTypeStruct %uint %image_struct + %1 = OpFunction %void None %7 + %15 = OpLabel + %16 = OpUntypedAccessChainKHR %_ptr_UniformConstant %struct %2 %uint_1 %uint_0 + %17 = OpLoad %14 %16 + OpImageWrite %17 %uint_0 %uint_51966 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, MemberDecorateIdDecorator) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability BindlessTextureNV + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpExtension "SPV_NV_bindless_texture" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpSamplerImageAddressingModeNV 64 + OpEntryPoint Fragment %main "main" %resource_heap %fragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "uv" + OpMemberName %U 1 "k" + OpMemberName %U 2 "g" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpMemberDecorate %U 1 Offset 8 + OpMemberDecorateIdEXT %U 2 Offset 0 + OpDecorateId %_runtimearr_20 ArrayStrideIdEXT %uint_2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %fragColor = OpVariable %_ptr_Output_v2float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %specC = OpSpecConstant %int 4 + %samplerTy = OpTypeSampler +%_runtimearr_sampler = OpTypeRuntimeArray %samplerTy + %U = OpTypeStruct %v2float %int %_runtimearr_sampler + %int_0 = OpConstant %int 0 +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform + %20 = OpTypeBufferEXT Uniform + %uint_2 = OpConstant %uint 2 +%_runtimearr_20 = OpTypeRuntimeArray %20 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpUntypedAccessChainKHR %_ptr_Uniform %_runtimearr_20 %resource_heap %int_3 + %23 = OpBufferPointerEXT %_ptr_Uniform %19 + %24 = OpUntypedAccessChainKHR %_ptr_Uniform %U %23 %int_0 + %25 = OpLoad %v2float %24 + OpStore %fragColor %25 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, HasSubstr("Decoration operand could only be OffsetIdEXT.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, MemberDecorateIdExtraIdOrder) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpCapability BindlessTextureNV + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpExtension "SPV_NV_bindless_texture" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpSamplerImageAddressingModeNV 64 + OpEntryPoint Fragment %main "main" %resource_heap %fragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %fragColor "fragColor" + OpName %resource_heap "resource_heap" + OpName %U "U" + OpMemberName %U 0 "uv" + OpMemberName %U 1 "k" + OpMemberName %U 2 "g" + OpDecorate %fragColor Location 0 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %U Block + OpMemberDecorate %U 0 Offset 0 + OpMemberDecorate %U 1 Offset 8 + OpMemberDecorateIdEXT %U 2 OffsetIdEXT %specC + OpDecorateId %_runtimearr_20 ArrayStrideIdEXT %uint_2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %fragColor = OpVariable %_ptr_Output_v2float Output +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %samplerTy = OpTypeSampler +%_runtimearr_sampler = OpTypeRuntimeArray %samplerTy + %U = OpTypeStruct %v2float %int %_runtimearr_sampler + %specC = OpSpecConstant %int 4 + %int_0 = OpConstant %int 0 +%_ptr_Uniform = OpTypeUntypedPointerKHR Uniform + %20 = OpTypeBufferEXT Uniform + %uint_2 = OpConstant %uint 2 +%_runtimearr_20 = OpTypeRuntimeArray %20 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpUntypedAccessChainKHR %_ptr_Uniform %_runtimearr_20 %resource_heap %int_3 + %23 = OpBufferPointerEXT %_ptr_Uniform %19 + %24 = OpUntypedAccessChainKHR %_ptr_Uniform %U %23 %int_0 + %25 = OpLoad %v2float %24 + OpStore %fragColor %25 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + HasSubstr("All Extra Operands must appear before Structure Type.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OpMemberDecorateIdDuplicateOffset) { + const std::string str = R"( + OpCapability Shader + OpCapability SampledBuffer + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorateIdEXT %struct 0 OffsetIdEXT %uint_0 + OpMemberDecorateIdEXT %struct 1 OffsetIdEXT %uint_0 + OpMemberDecorateIdEXT %struct 1 OffsetIdEXT %uint_0 + OpMemberDecorateIdEXT %struct 2 OffsetIdEXT %uint_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %14 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%struct = OpTypeStruct %14 %uint %uint + %void = OpTypeVoid + %3 = OpTypeFunction %void + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("member '1' decorated with OffsetIdEXT multiple times " + "is not allowed")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OffsetAndOffsetId) { + const std::string str = R"( + OpCapability Shader + OpCapability SampledBuffer + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorate %struct 0 Offset 0 + OpMemberDecorateIdEXT %struct 0 OffsetIdEXT %uint_0 + OpMemberDecorateIdEXT %struct 1 OffsetIdEXT %uint_0 + OpMemberDecorateIdEXT %struct 2 OffsetIdEXT %uint_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %14 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%struct = OpTypeStruct %14 %uint %uint + %void = OpTypeVoid + %3 = OpTypeFunction %void + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("member '0' decorated with both OffsetIdEXT and Offset " + "is not allowed")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, AtomicImageType) { + const std::string str = R"( + OpCapability Shader + OpCapability Image1D + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %resource_heap + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %resource_heap "resource_heap" + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorateId %_runtimearr_10 ArrayStrideIdEXT %13 + %void = OpTypeVoid + %3 = OpTypeFunction %void +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %10 = OpTypeImage %int 1D 0 0 0 2 Rgba16i + %13 = OpConstantSizeOfEXT %int %10 +%_runtimearr_10 = OpTypeRuntimeArray %10 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Image_int = OpTypePointer Image %int + %_ptr_Image = OpTypeUntypedPointerKHR Image + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_10 %resource_heap %int_1 + %19 = OpUntypedImageTexelPointerEXT %_ptr_Image %10 %12 %int_1 %uint_0 + %21 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %int_1 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + AnyVUID("VUID-StandaloneSpirv-OpUntypedImageTexelPointerEXT-11416")); + EXPECT_THAT(diag, + HasSubstr("Expected the Image Format in Image to be R64i, R64ui, " + "R32f, R32i, or R32ui for Vulkan environment using " + "OpUntypedImageTexelPointerEXT")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, UntypedPointerStorageClass) { + const std::string str = R"( + OpCapability Shader + OpCapability Image1D + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %resource_heap + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %resource_heap "resource_heap" + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorateId %_runtimearr_10 ArrayStrideIdEXT %13 + %void = OpTypeVoid + %3 = OpTypeFunction %void +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %10 = OpTypeImage %int 1D 0 0 0 2 R32i +%_ptr_Uniform = OpTypeUntypedPointerKHR Private + %13 = OpConstantSizeOfEXT %int %10 +%_runtimearr_10 = OpTypeRuntimeArray %10 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Image_int = OpTypePointer Image %int + %_ptr_Image = OpTypeUntypedPointerKHR Image + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpUntypedAccessChainKHR %_ptr_Uniform %_runtimearr_10 %resource_heap %int_1 + %19 = OpUntypedImageTexelPointerEXT %_ptr_Image %10 %12 %int_1 %uint_0 + %21 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %int_1 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, + AnyVUID("VUID-StandaloneSpirv-OpTypeUntypedPointerKHR-11417")); + EXPECT_THAT(diag, HasSubstr("In Vulkan, untyped pointers can only be used " + "in an explicitly laid out storage class")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, InvalidStoreToHeap) { + const std::string str = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %resource_heap %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_descriptor_heap" + OpName %main "main" + OpName %resource_heap "resource_heap" + OpName %A "A" + OpMemberName %A 0 "a" + OpName %PushConstant "PushConstant" + OpMemberName %PushConstant 0 "b" + OpName %_ "" + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %A Block + OpMemberDecorate %A 0 BuiltIn ResourceHeapEXT + OpMemberDecorate %A 0 Offset 0 + OpDecorate %PushConstant Block + OpMemberDecorate %PushConstant 0 Offset 0 + OpDecorateId %_runtimearr_20 ArrayStrideIdEXT %21 + %void = OpTypeVoid + %3 = OpTypeFunction %void +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %A = OpTypeStruct %uint +%PushConstant = OpTypeStruct %uint +%_ptr_PushConstant_PushConstant = OpTypePointer PushConstant %PushConstant + %_ = OpVariable %_ptr_PushConstant_PushConstant PushConstant +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer = OpTypeUntypedPointerKHR StorageBuffer + %20 = OpTypeBufferEXT StorageBuffer + %21 = OpConstantSizeOfEXT %int %20 +%_runtimearr_20 = OpTypeRuntimeArray %20 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %27 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %17 = OpLoad %uint %16 + OpStore %resource_heap %17 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, HasSubstr("OpStore Pointer ")); + EXPECT_THAT(diag, HasSubstr("storage class is read-only")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, NonDescriptorOpaqueType) { + std::string spirv = R"( + OpCapability Shader + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" +%float = OpTypeFloat 32 +%image = OpTypeImage %float 2D 0 0 0 1 Unknown +%sampled = OpTypeSampledImage %image +%struct = OpTypeStruct %sampled +%void = OpTypeVoid +%func = OpTypeFunction %void +%main = OpFunction %void None %func + %l = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, AnyVUID("VUID-StandaloneSpirv-DescriptorHeapEXT-11482")); + EXPECT_THAT( + diag, + HasSubstr( + "In Vulkan, OpTypeStruct must not contain an invalid opaque type.")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, ResourceHeapBuiltinOnMemeber) { + std::string spirv = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %resource_heap %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %resource_heap BuiltIn ResourceHeapEXT + OpDecorate %A Block + OpMemberDecorate %A 0 BuiltIn ResourceHeapEXT + OpMemberDecorate %A 0 Offset 0 + OpDecorate %PushConstant Block + OpMemberDecorate %PushConstant 0 Offset 0 + OpDecorateId %_runtimearr_21 ArrayStrideIdEXT %22 + %void = OpTypeVoid + %3 = OpTypeFunction %void +%_ptr_UniformConstant = OpTypeUntypedPointerKHR UniformConstant +%resource_heap = OpUntypedVariableKHR %_ptr_UniformConstant UniformConstant + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %uint = OpTypeInt 32 0 + %A = OpTypeStruct %uint + %int_0 = OpConstant %int 0 +%PushConstant = OpTypeStruct %uint +%_ptr_PushConstant_PushConstant = OpTypePointer PushConstant %PushConstant + %_ = OpVariable %_ptr_PushConstant_PushConstant PushConstant +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer = OpTypeUntypedPointerKHR StorageBuffer + %21 = OpTypeBufferEXT StorageBuffer + %22 = OpConstantSizeOfEXT %int %21 +%_runtimearr_21 = OpTypeRuntimeArray %21 + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %18 = OpLoad %uint %17 + %20 = OpUntypedAccessChainKHR %_ptr_UniformConstant %_runtimearr_21 %resource_heap %int_2 + %24 = OpBufferPointerEXT %_ptr_StorageBuffer %20 + %25 = OpUntypedAccessChainKHR %_ptr_StorageBuffer %A %24 %int_0 + OpStore %25 %18 + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "BuiltIn ResourceHeapEXT cannot be used as a member decoration")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OffsetIdFloat) { + const std::string str = R"( + OpCapability Shader + OpCapability SampledBuffer + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorateIdEXT %struct 0 OffsetIdEXT %float_0 + OpMemberDecorateIdEXT %struct 1 OffsetIdEXT %uint_0 + OpMemberDecorateIdEXT %struct 2 OffsetIdEXT %uint_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %14 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%struct = OpTypeStruct %14 %uint %uint + %void = OpTypeVoid + %3 = OpTypeFunction %void + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OffsetIdEXT extra operand must be a 32-bit int scalar type")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, OffsetIdNonConstant) { + const std::string str = R"( + OpCapability Shader + OpCapability SampledBuffer + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorateIdEXT %struct 0 OffsetIdEXT %void + OpMemberDecorateIdEXT %struct 1 OffsetIdEXT %uint_0 + OpMemberDecorateIdEXT %struct 2 OffsetIdEXT %uint_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %14 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%struct = OpTypeStruct %14 %uint %uint + %void = OpTypeVoid + %3 = OpTypeFunction %void + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OffsetIdEXT extra operand must be a 32-bit int scalar type")); +} + +TEST_F(ValidateSpvEXTDescriptorHeap, ArrayStrideFloat) { + const std::string str = R"( + OpCapability Shader + OpCapability DescriptorHeapEXT + OpExtension "SPV_EXT_descriptor_heap" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorateId %array ArrayStrideIdEXT %float_4 +%float = OpTypeFloat 32 +%float_4 = OpConstant %float 4 +%int = OpTypeInt 32 0 +%int_2 = OpConstant %int 2 +%sampler = OpTypeSampler +%array = OpTypeArray %sampler %int_2 +%void = OpTypeVoid + %3 = OpTypeFunction %void +%main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + + )"; + CompileSuccessfully(str.c_str(), SPV_ENV_VULKAN_1_4); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "ArrayStrideIdEXT extra operand must be a 32-bit int scalar type")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_extension_spv_intel_function_variants.cpp b/third_party/spirv-tools/test/val/val_extension_spv_intel_function_variants.cpp new file mode 100644 index 0000000000..adb243f455 --- /dev/null +++ b/third_party/spirv-tools/test/val/val_extension_spv_intel_function_variants.cpp @@ -0,0 +1,123 @@ +// Copyright 2025 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Tests for SPV_INTEL_inline_assembly + +#include + +#include "gmock/gmock.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; + +using ValidateSpvINTELFunctionVariants = spvtest::ValidateBase; + +TEST_F(ValidateSpvINTELFunctionVariants, Valid) { + const std::string str = R"( + OpCapability Kernel + OpCapability Linkage + OpCapability SpecConditionalINTEL + OpCapability FunctionVariantsINTEL + OpConditionalCapabilityINTEL %1 Int8 + OpExtension "SPV_INTEL_function_variants" + OpMemoryModel Logical OpenCL + %bool = OpTypeBool + %1 = OpSpecConstantTrue %bool + )"; + CompileSuccessfully(str.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSpvINTELFunctionVariants, RequiresExtension1) { + const std::string str = R"( + OpCapability Kernel + OpCapability Linkage + OpCapability SpecConditionalINTEL + OpMemoryModel Logical OpenCL + )"; + CompileSuccessfully(str.c_str()); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions()); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, HasSubstr("1st operand of Capability: operand " + "SpecConditionalINTEL(6245) requires " + "one of these extensions: SPV_INTEL_function_variants")); + EXPECT_THAT(diag, HasSubstr("OpCapability SpecConditionalINTEL")); +} + +TEST_F(ValidateSpvINTELFunctionVariants, RequiresExtension2) { + const std::string str = R"( + OpCapability Kernel + OpCapability Linkage + OpCapability FunctionVariantsINTEL + OpMemoryModel Logical OpenCL + )"; + CompileSuccessfully(str.c_str()); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions()); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, HasSubstr("1st operand of Capability: operand " + "FunctionVariantsINTEL(6246) requires " + "one of these extensions: SPV_INTEL_function_variants")); + EXPECT_THAT(diag, HasSubstr("OpCapability FunctionVariantsINTEL")); +} + +TEST_F(ValidateSpvINTELFunctionVariants, RequiresCapability1) { + const std::string str = R"( + OpCapability Kernel + OpCapability Linkage + OpConditionalCapabilityINTEL %1 Int8 + OpExtension "SPV_INTEL_function_variants" + OpMemoryModel Logical OpenCL + %bool = OpTypeBool + %1 = OpSpecConstantTrue %bool +)"; + CompileSuccessfully(str.c_str()); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions()); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, HasSubstr("Opcode ConditionalCapabilityINTEL requires one of these " + "capabilities: SpecConditionalINTEL")); + EXPECT_THAT(diag, HasSubstr("OpConditionalCapabilityINTEL %1 Int8")); +} + +TEST_F(ValidateSpvINTELFunctionVariants, RequiresCapability2) { + const std::string str = R"( + OpCapability Kernel + OpCapability Linkage + OpCapability SpecConditionalINTEL + OpConditionalCapabilityINTEL %1 Int8 + OpExtension "SPV_INTEL_function_variants" + OpMemoryModel Logical OpenCL + %bool = OpTypeBool + %1 = OpSpecConstantArchitectureINTEL %bool 0 0 170 0 +)"; + CompileSuccessfully(str.c_str()); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions()); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + HasSubstr("Opcode SpecConstantArchitectureINTEL requires one of these " + "capabilities: FunctionVariantsINTEL")); + EXPECT_THAT( + diag, HasSubstr("%1 = OpSpecConstantArchitectureINTEL %bool 0 0 170 0")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_extension_spv_intel_inline_assembly.cpp b/third_party/spirv-tools/test/val/val_extension_spv_intel_inline_assembly.cpp new file mode 100644 index 0000000000..a683afd7ef --- /dev/null +++ b/third_party/spirv-tools/test/val/val_extension_spv_intel_inline_assembly.cpp @@ -0,0 +1,109 @@ +// Copyright 2025 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Tests for SPV_INTEL_inline_assembly + +#include + +#include "gmock/gmock.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; + +using ValidateSpvINTELInlineAssembly = spvtest::ValidateBase; + +TEST_F(ValidateSpvINTELInlineAssembly, Valid) { + const std::string str = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Linkage + OpCapability AsmINTEL + OpExtension "SPV_INTEL_inline_assembly" + OpMemoryModel Physical32 OpenCL + OpDecorate %1 SideEffectsINTEL + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpAsmTargetINTEL "spirv64-unknown-unknown" + %1 = OpAsmINTEL %2 %3 %4 "nop" "" + %5 = OpFunction %2 None %3 + %6 = OpLabel + %7 = OpAsmCallINTEL %2 %1 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSpvINTELInlineAssembly, RequiresExtension) { + const std::string str = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Linkage + OpCapability AsmINTEL + OpMemoryModel Physical32 OpenCL + OpDecorate %1 SideEffectsINTEL + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpAsmTargetINTEL "spirv64-unknown-unknown" + %1 = OpAsmINTEL %2 %3 %4 "nop" "" + %5 = OpFunction %2 None %3 + %6 = OpLabel + %7 = OpAsmCallINTEL %2 %1 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str.c_str()); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions()); + const std::string diag = getDiagnosticString(); + EXPECT_THAT( + diag, + HasSubstr("1st operand of Capability: operand AsmINTEL(5606) requires " + "one of these extensions: SPV_INTEL_inline_assembly")); + EXPECT_THAT(diag, HasSubstr("OpCapability AsmINTEL")); +} + +TEST_F(ValidateSpvINTELInlineAssembly, RequiresCapability) { + const std::string str = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Linkage + OpExtension "SPV_INTEL_inline_assembly" + OpMemoryModel Physical32 OpenCL + OpDecorate %1 SideEffectsINTEL + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpAsmTargetINTEL "spirv64-unknown-unknown" + %1 = OpAsmINTEL %2 %3 %4 "nop" "" + %5 = OpFunction %2 None %3 + %6 = OpLabel + %7 = OpAsmCallINTEL %2 %1 + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str.c_str()); + EXPECT_NE(SPV_SUCCESS, ValidateInstructions()); + const std::string diag = getDiagnosticString(); + EXPECT_THAT(diag, HasSubstr("Operand 2 of Decorate requires one of these " + "capabilities: AsmINTEL")); + EXPECT_THAT(diag, HasSubstr("OpDecorate %1 SideEffectsINTEL")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_extensions_test.cpp b/third_party/spirv-tools/test/val/val_extensions_test.cpp index cba306cd7b..555fd319cc 100644 --- a/third_party/spirv-tools/test/val/val_extensions_test.cpp +++ b/third_party/spirv-tools/test/val/val_extensions_test.cpp @@ -132,6 +132,134 @@ TEST_F(ValidateExtensionCapabilities, DeclCapabilityFailure) { EXPECT_THAT(getDiagnosticString(), HasSubstr("SPV_KHR_device_group")); } +TEST_F(ValidateExtensionCapabilities, SpirvVersionImageProcessingQCOM) { + const std::string str = R"( + OpCapability Shader + OpCapability TextureBlockMatch2QCOM + OpExtension "SPV_QCOM_image_processing" + OpExtension "SPV_QCOM_image_processing2" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %v_texcoord %fragColor %target_samp %ref_samp + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_QCOM_image_processing" + OpSourceExtension "GL_QCOM_image_processing2" + OpDecorate %v_texcoord Location 0 + OpDecorate %fragColor Location 0 + OpDecorate %target_samp DescriptorSet 0 + OpDecorate %target_samp Binding 4 + OpDecorate %ref_samp DescriptorSet 0 + OpDecorate %ref_samp Binding 5 + OpDecorate %target_samp BlockMatchTextureQCOM + OpDecorate %target_samp BlockMatchSamplerQCOM + OpDecorate %ref_samp BlockMatchTextureQCOM + OpDecorate %ref_samp BlockMatchSamplerQCOM + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %v_texcoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %39 = OpConstantComposite %v2uint %uint_4 %uint_4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %fragColor = OpVariable %_ptr_Output_v4float Output + %42 = OpTypeImage %float 2D 0 0 0 1 Unknown + %43 = OpTypeSampledImage %42 +%_ptr_UniformConstant_43 = OpTypePointer UniformConstant %43 +%target_samp = OpVariable %_ptr_UniformConstant_43 UniformConstant + %ref_samp = OpVariable %_ptr_UniformConstant_43 UniformConstant + %main = OpFunction %void None %3 + %5 = OpLabel + %tgt_coords = OpVariable %_ptr_Function_v2uint Function + %ref_coords = OpVariable %_ptr_Function_v2uint Function + %blockSize = OpVariable %_ptr_Function_v2uint Function + %16 = OpAccessChain %_ptr_Input_float %v_texcoord %uint_0 + %17 = OpLoad %float %16 + %18 = OpConvertFToU %uint %17 + %20 = OpAccessChain %_ptr_Function_uint %tgt_coords %uint_0 + OpStore %20 %18 + %22 = OpAccessChain %_ptr_Input_float %v_texcoord %uint_1 + %23 = OpLoad %float %22 + %24 = OpConvertFToU %uint %23 + %25 = OpAccessChain %_ptr_Function_uint %tgt_coords %uint_0 + OpStore %25 %24 + %28 = OpAccessChain %_ptr_Input_float %v_texcoord %uint_2 + %29 = OpLoad %float %28 + %30 = OpConvertFToU %uint %29 + %31 = OpAccessChain %_ptr_Function_uint %ref_coords %uint_0 + OpStore %31 %30 + %33 = OpAccessChain %_ptr_Input_float %v_texcoord %uint_3 + %34 = OpLoad %float %33 + %35 = OpConvertFToU %uint %34 + %36 = OpAccessChain %_ptr_Function_uint %ref_coords %uint_1 + OpStore %36 %35 + OpStore %blockSize %39 + %46 = OpLoad %43 %target_samp + %47 = OpLoad %v2uint %tgt_coords + %49 = OpLoad %43 %ref_samp + %50 = OpLoad %v2uint %ref_coords + %51 = OpLoad %v2uint %blockSize + %52 = OpImageBlockMatchWindowSADQCOM %v4float %46 %47 %49 %50 %51 + OpStore %fragColor %52 + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str.c_str(), SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_WRONG_VERSION, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("SPV_QCOM_image_processing extension requires SPIR-V " + "version 1.4 or later.")); +} + +TEST_F(ValidateExtensionCapabilities, SpirvVersionCoopMatConversionQCOM) { + const std::string body = R"( +OpCapability Shader +OpCapability Float16 +OpCapability CooperativeMatrixKHR +OpCapability VulkanMemoryModelKHR +OpCapability CooperativeMatrixConversionQCOM +OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_QCOM_cooperative_matrix_conversion" +OpMemoryModel Logical VulkanKHR +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%f16 = OpTypeFloat 16 +%uint_0 = OpConstant %uint 0 +%uint_8 = OpConstant %uint 8 +%uint_64 = OpConstant %uint 64 +%_arr_f16_uint_8 = OpTypeArray %f16 %uint_8 +%_arr_f16_uint_64 = OpTypeArray %f16 %uint_64 +%_ptr_Function__arr_f16_uint_64 = OpTypePointer Function %_arr_f16_uint_64 +%main = OpFunction %void None %3 +%5 = OpLabel +%f16vec64Acc = OpVariable %_ptr_Function__arr_f16_uint_64 Function +%83 = OpLoad %_arr_f16_uint_64 %f16vec64Acc +%86 = OpExtractSubArrayQCOM %_arr_f16_uint_8 %83 %uint_0 +OpReturn +OpFunctionEnd)"; + + CompileSuccessfully(body.c_str()); + ASSERT_EQ(SPV_ERROR_WRONG_VERSION, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("SPV_KHR_vulkan_memory_model extension requires SPIR-V " + "version 1.3 or later.")); +} + TEST_F(ValidateExtensionCapabilities, DeclCapabilityFailureBlockMatchWIndowSAD) { const std::string str = R"( @@ -223,8 +351,9 @@ TEST_F(ValidateExtensionCapabilities, OpReturn OpFunctionEnd )"; - CompileSuccessfully(str.c_str()); - ASSERT_EQ(SPV_ERROR_MISSING_EXTENSION, ValidateInstructions()); + CompileSuccessfully(str.c_str(), SPV_ENV_UNIVERSAL_1_4); + ASSERT_EQ(SPV_ERROR_MISSING_EXTENSION, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); EXPECT_THAT(getDiagnosticString(), HasSubstr("2nd operand of Decorate")); EXPECT_THAT(getDiagnosticString(), HasSubstr("requires one of these extensions")); @@ -332,8 +461,9 @@ TEST_F(ValidateExtensionCapabilities, OpReturn OpFunctionEnd )"; - CompileSuccessfully(str.c_str()); - ASSERT_EQ(SPV_ERROR_MISSING_EXTENSION, ValidateInstructions()); + CompileSuccessfully(str.c_str(), SPV_ENV_UNIVERSAL_1_4); + ASSERT_EQ(SPV_ERROR_MISSING_EXTENSION, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); EXPECT_THAT(getDiagnosticString(), HasSubstr("2nd operand of Decorate")); EXPECT_THAT(getDiagnosticString(), HasSubstr("requires one of these extensions")); @@ -482,7 +612,8 @@ TEST_P(ValidateExtIntoCore, DoNotAskForExtensionInLaterVersion) { GetParam().cap + R"( OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %main "main" %builtin - OpDecorate %builtin BuiltIn )" + GetParam().builtin + R"( + OpDecorate %builtin BuiltIn )" + + GetParam().builtin + R"( %void = OpTypeVoid %3 = OpTypeFunction %void %int = OpTypeInt 32 1 diff --git a/third_party/spirv-tools/test/val/val_function_test.cpp b/third_party/spirv-tools/test/val/val_function_test.cpp index 119edd3e6c..ea53ca8988 100644 --- a/third_party/spirv-tools/test/val/val_function_test.cpp +++ b/third_party/spirv-tools/test/val/val_function_test.cpp @@ -836,6 +836,200 @@ TEST_F(ValidateFunctionCall, LogicallyMismatchedPointersArraySize) { HasSubstr("type does not match Function ")); } +TEST_F(ValidateFunctionCall, PointerReturnTypeStorageBuffer) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypePointer StorageBuffer %int +%null = OpConstantNull %ptr +%foo_ty = OpTypeFunction %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr None %foo_ty +%foo_entry = OpLabel +OpReturnValue %null +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In Logical addressing, functions may only return a storage " + "buffer pointer if the VariablePointersStorageBuffer " + "capability is declared")); +} + +TEST_F(ValidateFunctionCall, PointerReturnTypeStorageBufferUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%null = OpConstantNull %ptr +%foo_ty = OpTypeFunction %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr None %foo_ty +%foo_entry = OpLabel +OpReturnValue %null +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In Logical addressing, functions may only return a storage " + "buffer pointer if the VariablePointersStorageBuffer " + "capability is declared")); +} + +TEST_F(ValidateFunctionCall, PointerReturnTypeWorkgroup) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypePointer Workgroup %int +%null = OpConstantNull %ptr +%foo_ty = OpTypeFunction %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr None %foo_ty +%foo_entry = OpLabel +OpReturnValue %null +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In Logical addressing, functions may only return a workgroup " + "pointer if the VariablePointers capability is declared")); +} + +TEST_F(ValidateFunctionCall, PointerReturnTypeWorkgroupUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%ptr = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr +%foo_ty = OpTypeFunction %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr None %foo_ty +%foo_entry = OpLabel +OpReturnValue %null +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In Logical addressing, functions may only return a workgroup " + "pointer if the VariablePointers capability is declared")); +} + +TEST_F(ValidateFunctionCall, PointerReturnTypePrivate) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypePointer Private %int +%var = OpVariable %ptr Private +%foo_ty = OpTypeFunction %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr None %foo_ty +%foo_entry = OpLabel +OpReturnValue %var +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("In Logical addressing, functions may not return a " + "pointer in this storage class")); +} + +TEST_F(ValidateFunctionCall, PointerReturnTypePrivateUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypeUntypedPointerKHR Private +%var = OpUntypedVariableKHR %ptr Private %int +%foo_ty = OpTypeFunction %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr None %foo_ty +%foo_entry = OpLabel +OpReturnValue %var +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("In Logical addressing, functions may not return a " + "pointer in this storage class")); +} + TEST_F(ValidateFunctionCall, UntypedPointerParameterMismatch) { const std::string spirv = R"( OpCapability Shader diff --git a/third_party/spirv-tools/test/val/val_graph_test.cpp b/third_party/spirv-tools/test/val/val_graph_test.cpp new file mode 100644 index 0000000000..72bbde8760 --- /dev/null +++ b/third_party/spirv-tools/test/val/val_graph_test.cpp @@ -0,0 +1,1362 @@ +// Copyright (c) 2023-2025 Arm Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +// TODO(kpet) Tests with spec constants + +namespace spvtools { +namespace val { +namespace { + +using ::testing::ContainsRegex; +using ::testing::HasSubstr; + +using ValidateGraph = spvtest::ValidateBase; + +constexpr spv_target_env SPVENV = SPV_ENV_VULKAN_1_3; + +std::string GenerateModule(const std::string& src) { + const std::string boilerplate = R"( + OpCapability Shader + OpCapability VulkanMemoryModel + OpCapability Int8 + OpCapability GraphARM + OpCapability TensorsARM + OpCapability RuntimeDescriptorArray + OpExtension "SPV_ARM_graph" + OpExtension "SPV_ARM_tensors" + OpMemoryModel Logical Vulkan + OpDecorate %var_int8tensor DescriptorSet 0 + OpDecorate %var_int8tensor Binding 0 + OpDecorate %var_int32tensor DescriptorSet 0 + OpDecorate %var_int32tensor Binding 1 + OpDecorate %var_int8tensor_array3 DescriptorSet 0 + OpDecorate %var_int8tensor_array3 Binding 2 + OpDecorate %var_int8tensor_runtime_array DescriptorSet 0 + OpDecorate %var_int8tensor_runtime_array Binding 3 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %int8 = OpTypeInt 8 1 + %int32 = OpTypeInt 32 1 + %float = OpTypeFloat 32 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %float_1 = OpConstant %float 1.0 + %int8tensor = OpTypeTensorARM %int8 %uint_4 + %int8r3tensor = OpTypeTensorARM %int8 %uint_3 + %int32tensor = OpTypeTensorARM %int32 %uint_4 +%int8tensor_array3 = OpTypeArray %int8tensor %uint_3 +%int32tensor_array3 = OpTypeArray %int32tensor %uint_3 +%int8tensor_runtime_array = OpTypeRuntimeArray %int8tensor +%int32tensor_runtime_array = OpTypeRuntimeArray %int32tensor +%ptr_Input_int8tensor = OpTypePointer Input %int8tensor +%var_int8tensor_wrong_storage_class = OpVariable %ptr_Input_int8tensor Input +%ptr_UniformConstant_int8tensor = OpTypePointer UniformConstant %int8tensor +%ptr_UniformConstant_int32tensor = OpTypePointer UniformConstant %int32tensor +%ptr_UniformConstant_int8tensor_array3 = OpTypePointer UniformConstant %int8tensor_array3 +%ptr_UniformConstant_int8tensor_runtime_array = OpTypePointer UniformConstant %int8tensor_runtime_array + %var_int8tensor = OpVariable %ptr_UniformConstant_int8tensor UniformConstant + %var_int32tensor = OpVariable %ptr_UniformConstant_int32tensor UniformConstant +%var_int8tensor_array3 = OpVariable %ptr_UniformConstant_int8tensor_array3 UniformConstant +%var_int8tensor_runtime_array = OpVariable %ptr_UniformConstant_int8tensor_runtime_array UniformConstant +)"; + return boilerplate + src; +} + +std::string GenerateModuleWithGraphEntryPoint(const std::string& header) { + const std::string src = R"( +%default_graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %default_graph "default_entry_point" %var_int8tensor %var_int8tensor + %default_graph = OpGraphARM %default_graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM + )"; + return GenerateModule(header) + src; +} + +// +// Layout tests +// + +TEST_F(ValidateGraph, InvalidNoGraphEntryPoint) { + std::string spvasm = GenerateModule(""); + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("No OpGraphEntryPointARM instruction was found but the " + "GraphARM capability is declared.")); +} + +TEST_F(ValidateGraph, InvalidGraphInGraph) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + %graph = OpGraphARM %graph_type + %graph2 = OpGraphARM %graph_type +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Cannot define a graph in a graph")); +} + +TEST_F(ValidateGraph, InvalidGraphEndOutsideGraph) { + const std::string src = R"( + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GraphEndARM must be preceded by at least one " + "OpGraphSetOutputARM instruction")); +} + +TEST_F(ValidateGraph, InvalidGraphEntryPointInsideGraph) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphEntryPointARM %graph "main" %in %in +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "GraphEntryPointARM cannot appear in the definition of a graph")); +} + +TEST_F(ValidateGraph, InvalidNonGraphInstructionInGraphSection) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + %ftype = OpTypeFunction %void %void + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM + %fn = OpFunction %void None %ftype +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Function cannot appear in the graph definitions section")); +} + +TEST_F(ValidateGraph, InvalidGraphInputOusideGraph) { + const std::string src = R"( + %in = OpGraphInputARM %int8tensor %uint_0 +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpGraphInputARM must immediately follow an OpGraphARM " + "or OpGraphInputARM instruction.")); +} + +TEST_F(ValidateGraph, InvalidGraphSetOutputsOusideGraph) { + const std::string src = R"( + OpGraphSetOutputARM %uint_0 %uint_0 +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpGraphSetOutputARM must immediately precede an " + "OpGraphEndARM or OpGraphSetOutputARM instruction")); +} + +TEST_F(ValidateGraph, ValidGraphConstantOusideGraph) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + %cst = OpGraphConstantARM %int8tensor 1 + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphWithNoInputsNoBody) { + const std::string src = R"( + %cst = OpGraphConstantARM %int8tensor 1 + %graph_type = OpTypeGraphARM 0 %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor + %graph = OpGraphARM %graph_type + OpGraphSetOutputARM %cst %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, InvalidGraphWithDisallowedBodyInstructions) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + %val = OpCompositeExtract %int8r3tensor %in 0 + %out = OpCompositeInsert %int8tensor %val %in 0 + OpGraphSetOutputARM %out %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpCompositeInsert cannot appear in the graph definitions section")); +} + +TEST_F(ValidateGraph, InvalidInstructionOutsideGraphAfterGraph) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + %cst = OpGraphConstantARM %int8tensor 1 + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM + %val = OpCompositeExtract %int8r3tensor %cst 0 +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpCompositeExtract must appear in a graph body")); +} + +// +// Type tests +// +TEST_F(ValidateGraph, ValidGraphTypeOneTensorOutputNoInputs) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 0 %int8tensor +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphTypeOneTensorArrayOutputNoInputs) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 0 %int8tensor_array3 +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphTypeOneTensorRuntimeArrayOutputNoInputs) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 0 %int8tensor_runtime_array +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphTypeOneTensorOutputOneTensorInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int32tensor +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphTypeOneTensorOutputOneTensorArrayInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int32tensor +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphTypeOneTensorOutputOneTensorRuntimeArrayInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor_runtime_array %int32tensor +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, + ValidGraphTypeOneTensorOutputOneTensorInputOneTensorArrayInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 2 %int8tensor %int8tensor_array3 %int32tensor +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F( + ValidateGraph, + ValidGraphTypeOneTensorOutputOneTensorRuntimeArrayInputOneTensorArrayInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor_runtime_array %int8tensor_array3 %int32tensor +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphTypeOneTensorArrayOutputOneTensorInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int32tensor_array3 +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphTypeOneTensorRuntimeArrayOutputOneTensorInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int32tensor_runtime_array +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, + ValidGraphTypeOneTensorRuntimeArrayOutputOneTensorOuputOneTensorInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int32tensor_runtime_array %int32tensor +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F( + ValidateGraph, + ValidGraphTypeOneTensorRuntimeArrayOutputOneTensorArrayOutputOneTensorOuputOneTensorInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %int32tensor_runtime_array %int32tensor_array3 %int32tensor +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} +TEST_F(ValidateGraph, + ValidGraphTypeOneTensorRuntimeArrayOutputOnteTensorOuputOneTensorInput) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int32tensor_array3 +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, InvalidGraphTypeWithNotEnoughIOTypes) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 10 %int8tensor %int8tensor +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("2 I/O types were provided but the graph has 10 inputs")); +} + +TEST_F(ValidateGraph, InvalidGraphTypeWithNonGraphInterfaceTypeIO) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor %uint +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + ContainsRegex("I/O type '.*' is not a Graph Interface Type.*")); +} + +TEST_F(ValidateGraph, InvalidGraphTypeWithOneInputZeroOutputs) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 1 %int8tensor +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("A graph type must have at least one output")); +} + +TEST_F(ValidateGraph, InvalidGraphTypeWithZeroInputsZeroOutputs) { + const std::string src = R"( + %graph_type = OpTypeGraphARM 0 +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("A graph type must have at least one output")); +} + +// +// Constant tests +// +TEST_F(ValidateGraph, ValidGraphConstantTensorUnranked) { + const std::string src = R"( + %tensor_type = OpTypeTensorARM %uint + %cst = OpGraphConstantARM %tensor_type 25 +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphConstantTensorRanked) { + const std::string src = R"( + %tensor_type = OpTypeTensorARM %uint %uint_4 + %cst = OpGraphConstantARM %tensor_type 25 +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidGraphConstantTensorShaped) { + const std::string src = R"( + %uint_array2 = OpTypeArray %uint %uint_2 + %tensor_shape = OpConstantComposite %uint_array2 %uint_1 %uint_4 + %tensor_type = OpTypeTensorARM %uint %uint_2 %tensor_shape + %cst = OpGraphConstantARM %tensor_type 25 +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, InvalidGraphConstantDuplicateIDs) { + const std::string src = R"( + %cst = OpGraphConstantARM %int8tensor 25 + %cst2 = OpGraphConstantARM %int32tensor 25 +)"; + std::string spvasm = GenerateModuleWithGraphEntryPoint(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("No two OpGraphConstantARM instructions may have the " + "same GraphConstantID")); +} + +TEST_F(ValidateGraph, InvalidGraphConstantWithNonTensorType) { + const std::string src = R"( + %cst = OpGraphConstantARM %uint 25 +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "GraphConstantARM must have a Result Type that is a tensor type")); +} + +// +// EntryPoint tests +// +TEST_F(ValidateGraph, InvalidModuleWithNoGraphEntryPoint) { + std::string spvasm = GenerateModule(""); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("No OpGraphEntryPointARM instruction was found but the " + "GraphARM capability is declared.")); +} +TEST_F(ValidateGraph, InvalidGraphEntryPointNotAGraph) { + const std::string src = R"( + OpGraphEntryPointARM %uint_0 "longname" +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "GraphEntryPointARM Graph must be a OpGraphARM but found Constant")); +} + +TEST_F(ValidateGraph, InvalidGraphEntryPointInterfaceIDNotOpVariable) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %uint_0 %uint_0 + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + ContainsRegex( + "GraphEntryPointARM Interface ID '.*' must " + "come from OpVariable with UniformConstant Storage Class.*")); +} + +TEST_F(ValidateGraph, InvalidGraphEntryPointInterfaceIDWrongStorageClass) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_wrong_storage_class %var_int8tensor_wrong_storage_class + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + ContainsRegex( + "GraphEntryPointARM Interface ID '.*' must " + "come from OpVariable with UniformConstant Storage Class.*")); +} + +TEST_F(ValidateGraph, InvalidGraphEntryPointNotEnoughInterfaceIDs) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + ContainsRegex( + "GraphEntryPointARM Interface list contains 1 IDs but Graph's type " + "'.*' has 2 inputs and outputs.*")); +} + +TEST_F(ValidateGraph, InvalidGraphEntryPointTooManyInterfaceIDs) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + ContainsRegex( + "GraphEntryPointARM Interface list contains 3 IDs but Graph's type " + "'.*' has 2 inputs and outputs.*")); +} + +TEST_F(ValidateGraph, + InvalidGraphEntryPointInterfaceIDTypeMismatchesGraphIOType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int32tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + ContainsRegex("GraphEntryPointARM Interface ID type " + "'.*' must match the type of the " + "corresponding graph I/O '.*'.*")); +} + +// +// Graph tests +// +TEST_F(ValidateGraph, InvalidGraphResultType) { + const std::string src = R"( + OpGraphEntryPointARM %graph "foo" + %graph = OpGraphARM %uint + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GraphARM Result Type must be an OpTypeGraphARM")); +} + +// +// Input tests +// +TEST_F(ValidateGraph, ValidTensorInput) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorArrayInputCompositeExtract) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor + %graph = OpGraphARM %graph_type +%in_tensors = OpGraphInputARM %int8tensor_array3 %uint_0 + %out = OpCompositeExtract %int8tensor %in_tensors 1 + OpGraphSetOutputARM %out %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorArrayInputWithElementIndex) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor + %graph = OpGraphARM %graph_type + %out = OpGraphInputARM %int8tensor %uint_0 %uint_1 + OpGraphSetOutputARM %out %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorRuntimeArrayInputCompositeExtract) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_runtime_array %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_runtime_array %var_int8tensor + %graph = OpGraphARM %graph_type +%in_tensors = OpGraphInputARM %int8tensor_runtime_array %uint_0 + %out = OpCompositeExtract %int8tensor %in_tensors 1 + OpGraphSetOutputARM %out %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorRuntimeArrayInputWithElementIndex) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_runtime_array %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_runtime_array %var_int8tensor + %graph = OpGraphARM %graph_type + %out = OpGraphInputARM %int8tensor %uint_0 %uint_1 + OpGraphSetOutputARM %out %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, InvalidGraphInputIndexWrongType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %float_1 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GraphInputARM InputIndex must be a 32-bit integer")); +} + +TEST_F(ValidateGraph, InvalidGraphInputElementIndexWrongType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 %float_1 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GraphInputARM ElementIndex must be a 32-bit integer")); +} + +TEST_F(ValidateGraph, InvalidGraphInputIndexDuplicate) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + %in2 = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Two OpGraphInputARM instructions with the same " + "InputIndex must not be part of the same " + "graph definition unless ElementIndex is present in " + "both with different values.")); +} + +TEST_F(ValidateGraph, InvalidGraphInputAndElementIndexDuplicate) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 %uint_1 + %in2 = OpGraphInputARM %int8tensor %uint_0 %uint_1 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Two OpGraphInputARM instructions with the same " + "InputIndex must not be part of the same " + "graph definition unless ElementIndex is present in " + "both with different values.")); +} + +TEST_F(ValidateGraph, + InvalidGraphInputIndexDuplicateWithAndWithoutElementIndex) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor_array3 %uint_0 + %in2 = OpGraphInputARM %int8tensor %uint_0 %uint_1 + OpGraphSetOutputARM %in2 %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Two OpGraphInputARM instructions with the same " + "InputIndex must not be part of the same " + "graph definition unless ElementIndex is present in " + "both with different values.")); +} + +TEST_F(ValidateGraph, ValidGraphInputIndexDuplicateWithDifferentElementIndex) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_runtime_array %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_runtime_array %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 %uint_2 + %in2 = OpGraphInputARM %int8tensor %uint_0 %uint_1 + OpGraphSetOutputARM %in2 %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, InvalidGraphInputElementIndexWithNonArrayInput) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 %uint_1 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpGraphInputARM ElementIndex not allowed when the graph input " + "selected by " + "InputIndex is not an OpTypeArray or OpTypeRuntimeArray")); +} + +TEST_F(ValidateGraph, InvalidGraphInputElementIndexOutOfRange) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 %uint_3 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + ContainsRegex("OpGraphInputARM ElementIndex out of range. The " + "type of the graph input being accessed '.*' is an " + "array of 3 elements but ElementIndex is 3.*")); +} + +TEST_F(ValidateGraph, InvalidGraphInputIndexOutOfRange) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 2 %int8tensor %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in0 = OpGraphInputARM %int8tensor %uint_0 + %in1 = OpGraphInputARM %int8tensor %uint_1 + %in2 = OpGraphInputARM %int8tensor %uint_2 + OpGraphSetOutputARM %in0 %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + ContainsRegex("Type '.*' for graph '.*' " + "has 2 inputs but found an OpGraphInputARM " + "instruction with an InputIndex that is 2.*")); +} + +TEST_F(ValidateGraph, InvalidGraphFirstInputTypeDoesNotMatchGraphType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 2 %int8tensor %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in0 = OpGraphInputARM %int32tensor %uint_0 + %in1 = OpGraphInputARM %int8tensor %uint_1 + OpGraphSetOutputARM %in1 %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + ContainsRegex("Result Type '.*' of graph input instruction " + "'.*' does not match the type " + "'.*' of input 0 in the graph type.*")); +} + +TEST_F(ValidateGraph, InvalidGraphLastInputTypeDoesNotMatchGraphType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 2 %int8tensor %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in0 = OpGraphInputARM %int8tensor %uint_0 + %in1 = OpGraphInputARM %int32tensor %uint_1 + OpGraphSetOutputARM %in0 %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + ContainsRegex("Result Type '.*' of graph input instruction " + "'.*' does not match the type " + "'.*' of input 1 in the graph type.*")); +} + +TEST_F(ValidateGraph, InvalidGraphInputAfterNonGraphInputOrGraph) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 2 %int8tensor_array3 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor_array3 %uint_0 + %val = OpCompositeExtract %int8tensor %in 0 + %in2 = OpGraphInputARM %int8tensor %uint_1 + OpGraphSetOutputARM %val %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpGraphInputARM must immediately follow an OpGraphARM " + "or OpGraphInputARM instruction")); +} + +// +// Output tests +// +TEST_F(ValidateGraph, ValidTensorOutput) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorOutputWholeArray) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor_array3 + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor_array3 + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor_array3 %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorOutputArraySingleElement) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor_array3 + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor_array3 + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %uint_1 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorOutputArrayMultipleElements) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor_array3 + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor_array3 + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %uint_1 + OpGraphSetOutputARM %in %uint_0 %uint_2 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorOutputWholeRuntimeArray) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_runtime_array %int8tensor_runtime_array + OpGraphEntryPointARM %graph "longname" %var_int8tensor_runtime_array %var_int8tensor_runtime_array + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor_runtime_array %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorOutputRuntimeArraySingleElement) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor_runtime_array + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor_runtime_array + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %uint_1 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, ValidTensorOutputRuntimeArrayMultipleElements) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor_runtime_array + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor_runtime_array + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %uint_1 + OpGraphSetOutputARM %in %uint_0 %uint_2 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, InvalidGraphOutputIndexWrongType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %float_1 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("GraphSetOutputARM OutputIndex must be a 32-bit integer")); +} + +TEST_F(ValidateGraph, InvalidGraphOutputElementIndexWrongType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor_array3 + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor_array3 + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %float_1 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("GraphSetOutputARM ElementIndex must be a 32-bit integer")); +} + +TEST_F(ValidateGraph, InvalidGraphOutputIndexDuplicate) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Two OpGraphSetOutputARM instructions with the same " + "OutputIndex must not be part of the same " + "graph definition unless ElementIndex is present in " + "both with different values.")); +} + +TEST_F(ValidateGraph, InvalidGraphOutputAndElementIndexDuplicate) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor_array3 + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor_array3 + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %uint_1 + OpGraphSetOutputARM %in %uint_0 %uint_1 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Two OpGraphSetOutputARM instructions with the same " + "OutputIndex must not be part of the same " + "graph definition unless ElementIndex is present in " + "both with different values.")); +} + +TEST_F(ValidateGraph, + InvalidGraphOutputIndexDuplicateWithAndWithoutElementIndex) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor_array3 + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor_array3 + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor_array3 %uint_0 + %in_single = OpCompositeExtract %int8tensor %in 0 + OpGraphSetOutputARM %in %uint_0 + OpGraphSetOutputARM %in_single %uint_0 %uint_1 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Two OpGraphSetOutputARM instructions with the same " + "OutputIndex must not be part of the same " + "graph definition unless ElementIndex is present in " + "both with different values.")); +} + +TEST_F(ValidateGraph, ValidGraphOutputIndexDuplicateWithDifferentElementIndex) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor_runtime_array + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor_runtime_array + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %uint_1 + OpGraphSetOutputARM %in %uint_0 %uint_4 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPVENV)); +} + +TEST_F(ValidateGraph, InvalidGraphOutputElementIndexWithNonArrayOutput) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpGraphSetOutputARM ElementIndex not allowed when the graph " + "output selected by " + "OutputIndex is not an OpTypeArray or OpTypeRuntimeArray")); +} + +TEST_F(ValidateGraph, InvalidGraphOutputElementIndexOutOfRange) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor_array3 + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor_array3 + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 %uint_3 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + ContainsRegex("OpGraphSetOutputARM ElementIndex out of range. The " + "type of the graph output being accessed '.*' is an " + "array of 3 elements but ElementIndex is 3.*")); +} + +TEST_F(ValidateGraph, InvalidGraphOutputNotBeforeEndOrOutput) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor_array3 %int8tensor_array3 %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor_array3 %var_int8tensor_array3 %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor_array3 %uint_0 + OpGraphSetOutputARM %in %uint_0 + %val = OpCompositeExtract %int8tensor %in 0 + OpGraphSetOutputARM %val %uint_1 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "CompositeExtract cannot appear after a graph output instruction")); +} + +TEST_F(ValidateGraph, InvalidGraphOutputIndexOutOfRange) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphSetOutputARM %in %uint_2 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GraphSetOutputARM setting OutputIndex 2 but graph " + "only has 2 outputs.")); +} + +TEST_F(ValidateGraph, InvalidGraphFirstOutputValueTypeDoesNotMatchOutputType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int32tensor %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int32tensor %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int32tensor %uint_0 + OpGraphSetOutputARM %in %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + ContainsRegex( + "The type '.*' of Value provided to the graph output instruction " + "'.*' does not match the type '.*' of output 0 in the graph type.*")); +} + +TEST_F(ValidateGraph, InvalidGraphLastOutputValueTypeDoesNotMatchOutputType) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int32tensor %int32tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int32tensor %var_int32tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int32tensor %uint_0 + OpGraphSetOutputARM %in %uint_1 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPVENV)); + EXPECT_THAT( + getDiagnosticString(), + ContainsRegex( + "The type '.*' of Value provided to the graph output instruction " + "'.*' does not match the type '.*' of output 1 in the graph type.*")); +} + +TEST_F(ValidateGraph, InvalidGraphNoSetOuputBeforeEnd) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 + OpGraphEndARM +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GraphEndARM must be preceded by at least one " + "OpGraphSetOutputARM instruction")); +} + +// +// End tests +// +TEST_F(ValidateGraph, InvalidGraphNoEnd) { + const std::string src = R"( +%graph_type = OpTypeGraphARM 1 %int8tensor %int8tensor + OpGraphEntryPointARM %graph "longname" %var_int8tensor %var_int8tensor + %graph = OpGraphARM %graph_type + %in = OpGraphInputARM %int8tensor %uint_0 +)"; + std::string spvasm = GenerateModule(src); + + CompileSuccessfully(spvasm, SPVENV); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions(SPVENV)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Missing OpGraphEndARM at end of module")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_id_test.cpp b/third_party/spirv-tools/test/val/val_id_test.cpp index b376afe977..b372aa0d10 100644 --- a/third_party/spirv-tools/test/val/val_id_test.cpp +++ b/third_party/spirv-tools/test/val/val_id_test.cpp @@ -1160,9 +1160,9 @@ TEST_P(ValidateIdWithMessage, OpTypeStructOpaqueTypeBad) { EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0)); EXPECT_THAT(getDiagnosticString(), AnyVUID("VUID-StandaloneSpirv-None-04667")); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr(make_message("OpTypeStruct must not contain an opaque type"))); + EXPECT_THAT(getDiagnosticString(), + HasSubstr(make_message( + "OpTypeStruct must not contain an invalid opaque type"))); } TEST_P(ValidateIdWithMessage, OpTypePointerGood) { @@ -1755,7 +1755,7 @@ TEST_P(ValidateIdWithMessage, OpConstantNullGood) { %4 = OpConstantNull %3 %5 = OpTypeFloat 32 %6 = OpConstantNull %5 - %7 = OpTypePointer UniformConstant %3 + %7 = OpTypePointer Workgroup %3 %8 = OpConstantNull %7 %9 = OpTypeEvent %10 = OpConstantNull %9 @@ -2391,12 +2391,18 @@ TEST_P(ValidateIdWithMessage, OpVariableInitializerConstantGood) { EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } TEST_P(ValidateIdWithMessage, OpVariableInitializerGlobalVariableGood) { - std::string spirv = kGLSL450MemoryModel + R"( -%1 = OpTypeInt 32 0 -%2 = OpTypePointer Uniform %1 -%3 = OpVariable %2 Uniform -%4 = OpTypePointer Private %2 ; pointer to pointer -%5 = OpVariable %4 Private %3 + std::string spirv = kOpenCLMemoryModel64 + R"( +%2 = OpTypeInt 32 0 +%3 = OpTypePointer CrossWorkgroup %2 +%4 = OpVariable %3 CrossWorkgroup +%5 = OpTypePointer Function %3 ; pointer to pointer +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%func = OpFunction %void None %void_fn +%entry = OpLabel +%6 = OpVariable %5 Function %4 +OpReturn +OpFunctionEnd )"; CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); @@ -2447,10 +2453,10 @@ OpFunctionEnd } TEST_P(ValidateIdWithMessage, OpVariableInitializerIsModuleVarGood) { - std::string spirv = kGLSL450MemoryModel + R"( + std::string spirv = kOpenCLMemoryModel64 + R"( %int = OpTypeInt 32 0 -%ptrint = OpTypePointer Uniform %int -%mvar = OpVariable %ptrint Uniform +%ptrint = OpTypePointer CrossWorkgroup %int +%mvar = OpVariable %ptrint CrossWorkgroup %ptrptrint = OpTypePointer Function %ptrint %void = OpTypeVoid %fnty = OpTypeFunction %void @@ -2666,7 +2672,8 @@ OpFunctionEnd EXPECT_THAT( getDiagnosticString(), HasSubstr(make_message( - "In Logical addressing, variables may not allocate a pointer type"))); + "In Logical addressing, variables can only allocate a workgroup " + "pointer if the VariablePointers capability is declared"))); } TEST_P(ValidateIdWithMessage, @@ -2744,8 +2751,8 @@ OpExtension "SPV_KHR_variable_pointers" OpMemoryModel Logical GLSL450 %void = OpTypeVoid %int = OpTypeInt 32 0 -%_ptr_workgroup_int = OpTypePointer Workgroup %int -%_ptr_function_ptr = OpTypePointer Function %_ptr_workgroup_int +%_ptr_storagebuffer_int = OpTypePointer StorageBuffer %int +%_ptr_function_ptr = OpTypePointer Function %_ptr_storagebuffer_int %voidfn = OpTypeFunction %void %func = OpFunction %void None %voidfn %entry = OpLabel @@ -4032,6 +4039,7 @@ TEST_P(AccessChainInstructionTest, AccessChainGood) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } @@ -4051,6 +4059,7 @@ OpFunctionEnd const std::string expected_err = "The Result Type of " + instr + " '36[%36]' must be " "OpTypePointer. Found OpTypeFloat."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4067,6 +4076,7 @@ TEST_P(AccessChainInstructionTest, AccessChainBaseTypeVoidBad) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr("Operand '1[%void]' cannot be a " @@ -4084,6 +4094,7 @@ TEST_P(AccessChainInstructionTest, AccessChainBaseTypeNonPtrVariableBad) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), @@ -4105,6 +4116,7 @@ OpFunctionEnd const std::string expected_err = "The result pointer storage class and base pointer storage class in " + instr + " do not match."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4126,6 +4138,7 @@ OpFunctionEnd const std::string expected_err = instr + " reached non-composite type while " "indexes still remain to be traversed."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4143,6 +4156,7 @@ TEST_P(AccessChainInstructionTest, AccessChainNoIndexesGood) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } @@ -4159,12 +4173,49 @@ TEST_P(AccessChainInstructionTest, AccessChainNoIndexesBad) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("result type (OpTypeMatrix) does not match the type that " - "results from indexing into the base (OpTypeFloat).")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("result type '6[%mat4v3float]' (OpTypeMatrix) " + "does not match the type that results from indexing " + "into the base '4[%float]' (OpTypeFloat)")); +} + +TEST_P(AccessChainInstructionTest, AccessChainDifferentIntTypes) { + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_uint_uint_32 ArrayStride 4 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 + %SSBO = OpTypeStruct %_arr_uint_uint_32 +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%ptr_ssbo_int = OpTypePointer StorageBuffer %int + %main = OpFunction %void None %4 + %6 = OpLabel + %18 = OpAccessChain %ptr_ssbo_int %_ %int_0 %int_0 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The types must be the exact same Id, so the two types " + "referenced are slighlty different")); } // Valid: 255 indexes passed to the access chain instruction. Limit is 255. @@ -4208,6 +4259,7 @@ TEST_P(AccessChainInstructionTest, AccessChainTooManyIndexesGood) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv.str()); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } @@ -4228,6 +4280,7 @@ TEST_P(AccessChainInstructionTest, AccessChainTooManyIndexesBad) { )"; const std::string expected_err = "The number of indexes in " + instr + " may not exceed 255. Found 256 indexes."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv.str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4275,6 +4328,7 @@ TEST_P(AccessChainInstructionTest, CustomizedAccessChainTooManyIndexesGood) { OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; spvValidatorOptionsSetUniversalLimit( options_, spv_validator_limit_max_access_chain_indexes, 10u); CompileSuccessfully(spirv.str()); @@ -4297,6 +4351,7 @@ TEST_P(AccessChainInstructionTest, CustomizedAccessChainTooManyIndexesBad) { )"; const std::string expected_err = "The number of indexes in " + instr + " may not exceed 10. Found 11 indexes."; + getValidatorOptions()->relax_logical_pointer = true; spvValidatorOptionsSetUniversalLimit( options_, spv_validator_limit_max_access_chain_indexes, 10u); CompileSuccessfully(spirv.str()); @@ -4318,6 +4373,7 @@ OpFunctionEnd )"; const std::string expected_err = "Indexes passed to " + instr + " must be of type integer."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4335,6 +4391,7 @@ TEST_P(AccessChainInstructionTest, AccessChainStructIndexNotConstantBad) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr("The passed to " + instr)); @@ -4354,10 +4411,12 @@ TEST_P(AccessChainInstructionTest, OpReturn OpFunctionEnd )"; - const std::string expected_err = instr + - " result type (OpTypeFloat) does not match " - "the type that results from indexing into " - "the base (OpTypeVector)."; + const std::string expected_err = + instr + + " result type '4[%float]' (OpTypeFloat) does not match the type " + "that results from indexing into the base '18[%v4float]' " + "(OpTypeVector)."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4377,6 +4436,7 @@ OpFunctionEnd const std::string expected_err = instr + " reached non-composite type while " "indexes still remain to be traversed."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4397,6 +4457,7 @@ OpFunctionEnd " cannot find index 3 into the structure " " '25[%_struct_25]'. This structure " "has 3 members. Largest valid index is 2."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4431,6 +4492,7 @@ TEST_P(AccessChainInstructionTest, AccessChainIndexIntoAllTypesGood) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv.str()); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } @@ -4449,6 +4511,7 @@ TEST_P(AccessChainInstructionTest, AccessChainIndexIntoRuntimeArrayGood) { OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } @@ -4467,6 +4530,7 @@ OpFunctionEnd const std::string expected_err = instr + " reached non-composite type while indexes still remain to be traversed."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4487,6 +4551,7 @@ OpFunctionEnd const std::string expected_err = instr + " reached non-composite type while " "indexes still remain to be traversed."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4504,10 +4569,12 @@ TEST_P(AccessChainInstructionTest, OpReturn OpFunctionEnd )"; - const std::string expected_err = instr + - " result type (OpTypeMatrix) does not match " - "the type that results from indexing into " - "the base (OpTypeFloat)."; + const std::string expected_err = + instr + + " result type '6[%mat4v3float]' (OpTypeMatrix) does not match the " + "type that results from indexing into the base '4[%float]' " + "(OpTypeFloat)."; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); @@ -4952,6 +5019,40 @@ TEST_P(ValidateIdWithMessage, OpVectorShuffleFloatGood) { EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } +TEST_P(ValidateIdWithMessage, OpVectorIdShuffleFloatGood) { + std::string spirv = "OpCapability LongVectorEXT\n" + kOpCapabilitySetup + + kOpVariablePtrSetUp + + "OpExtension \"SPV_EXT_long_vector\"" + R"( +OpMemoryModel Logical GLSL450 +%float = OpTypeFloat 32 +%uint = OpTypeInt 32 0 +%u2 = OpConstant %uint 2 +%u3 = OpConstant %uint 3 +%u4 = OpConstant %uint 4 +%vec2 = OpTypeVectorIdEXT %float %u2 +%vec3 = OpTypeVectorIdEXT %float %u3 +%vec4 = OpTypeVectorIdEXT %float %u4 +%ptr_vec2 = OpTypePointer Function %vec2 +%ptr_vec3 = OpTypePointer Function %vec3 +%float_1 = OpConstant %float 1 +%float_2 = OpConstant %float 2 +%1 = OpConstantComposite %vec2 %float_2 %float_1 +%2 = OpConstantComposite %vec3 %float_1 %float_2 %float_2 +%3 = OpTypeFunction %vec4 +%4 = OpFunction %vec4 None %3 +%5 = OpLabel +%var = OpVariable %ptr_vec2 Function %1 +%var2 = OpVariable %ptr_vec3 Function %2 +%6 = OpLoad %vec2 %var +%7 = OpLoad %vec3 %var2 +%8 = OpVectorShuffle %vec4 %6 %7 4 3 1 0xffffffff + OpReturnValue %8 + OpFunctionEnd)"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + TEST_P(ValidateIdWithMessage, OpVectorShuffleScalarResultType) { std::string spirv = kGLSL450MemoryModel + R"( %float = OpTypeFloat 32 @@ -4972,7 +5073,7 @@ TEST_P(ValidateIdWithMessage, OpVectorShuffleScalarResultType) { EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(make_message( - "Result Type of OpVectorShuffle must be OpTypeVector."))); + "Result Type of OpVectorShuffle must be a vector type."))); } TEST_P(ValidateIdWithMessage, OpVectorShuffleComponentCount) { @@ -5019,7 +5120,7 @@ TEST_P(ValidateIdWithMessage, OpVectorShuffleVector1Type) { EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT( getDiagnosticString(), - HasSubstr(make_message("The type of Vector 1 must be OpTypeVector."))); + HasSubstr(make_message("The type of Vector 1 must be a vector type."))); } TEST_P(ValidateIdWithMessage, OpVectorShuffleVector2Type) { @@ -5042,7 +5143,7 @@ TEST_P(ValidateIdWithMessage, OpVectorShuffleVector2Type) { EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT( getDiagnosticString(), - HasSubstr(make_message("The type of Vector 2 must be OpTypeVector."))); + HasSubstr(make_message("The type of Vector 2 must be a vector type."))); } TEST_P(ValidateIdWithMessage, OpVectorShuffleVector1ComponentType) { diff --git a/third_party/spirv-tools/test/val/val_image_test.cpp b/third_party/spirv-tools/test/val/val_image_test.cpp index 1376f6dbb1..1ad7dc93e1 100644 --- a/third_party/spirv-tools/test/val/val_image_test.cpp +++ b/third_party/spirv-tools/test/val/val_image_test.cpp @@ -50,7 +50,9 @@ OpCapability ImageGatherExtended OpCapability MinLod OpCapability Sampled1D OpCapability ImageQuery +OpCapability Int16 OpCapability Int64 +OpCapability Float16 OpCapability Float64 OpCapability SparseResidency OpCapability ImageBuffer @@ -116,6 +118,8 @@ OpDecorate %uniform_image_f32_2d_0002 DescriptorSet 1 OpDecorate %uniform_image_f32_2d_0002 Binding 3 OpDecorate %uniform_image_s32_2d_0002 DescriptorSet 1 OpDecorate %uniform_image_s32_2d_0002 Binding 4 +OpDecorate %uniform_image_u32_3d_0001 DescriptorSet 1 +OpDecorate %uniform_image_u32_3d_0001 Binding 5 OpDecorate %uniform_image_f32_spd_0002 DescriptorSet 2 OpDecorate %uniform_image_f32_spd_0002 Binding 0 OpDecorate %uniform_image_f32_3d_0111 DescriptorSet 2 @@ -124,6 +128,8 @@ OpDecorate %uniform_image_f32_cube_0101 DescriptorSet 2 OpDecorate %uniform_image_f32_cube_0101 Binding 2 OpDecorate %uniform_image_f32_cube_0102_rgba32f DescriptorSet 2 OpDecorate %uniform_image_f32_cube_0102_rgba32f Binding 3 +OpDecorate %uniform_image_f32_3d_0001 DescriptorSet 2 +OpDecorate %uniform_image_f32_3d_0001 Binding 4 OpDecorate %uniform_sampler DescriptorSet 3 OpDecorate %uniform_sampler Binding 0 OpDecorate %input_flat_u32 Flat @@ -135,12 +141,15 @@ OpDecorate %input_flat_u32 Location 0 %void = OpTypeVoid %func = OpTypeFunction %void %bool = OpTypeBool +%f16 = OpTypeFloat 16 %f32 = OpTypeFloat 32 %f64 = OpTypeFloat 64 +%u16 = OpTypeInt 16 0 %u32 = OpTypeInt 32 0 %s32 = OpTypeInt 32 1 %u64 = OpTypeInt 64 0 %s64 = OpTypeInt 64 1 +%f16vec2 = OpTypeVector %f16 2 %s32vec2 = OpTypeVector %s32 2 %u32vec2 = OpTypeVector %u32 2 %f32vec2 = OpTypeVector %f32 2 @@ -152,6 +161,8 @@ OpDecorate %input_flat_u32 Location 0 %f32vec4 = OpTypeVector %f32 4 %boolvec4 = OpTypeVector %bool 4 +%f16_0 = OpConstant %f16 0 + %f32_0 = OpConstant %f32 0 %f32_1 = OpConstant %f32 1 %f32_0_5 = OpConstant %f32 0.5 @@ -168,6 +179,8 @@ OpDecorate %input_flat_u32 Location 0 %s32_4 = OpConstant %s32 4 %s32_m1 = OpConstant %s32 -1 +%u16_0 = OpConstant %u16 0 + %u32_0 = OpConstant %u32 0 %u32_1 = OpConstant %u32 1 %u32_2 = OpConstant %u32 2 @@ -183,6 +196,7 @@ OpDecorate %input_flat_u32 Location 0 %u32vec2arr3 = OpTypeArray %u32vec2 %u32_3 %u32arr4 = OpTypeArray %u32 %u32_4 %u32vec3arr4 = OpTypeArray %u32vec3 %u32_4 +%f16vec2arr4 = OpTypeArray %f16vec2 %u32_4 %struct_u32_f32vec4 = OpTypeStruct %u32 %f32vec4 %struct_u64_f32vec4 = OpTypeStruct %u64 %f32vec4 @@ -210,6 +224,8 @@ OpDecorate %input_flat_u32 Location 0 %s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 %s32vec4_1234 = OpConstantComposite %s32vec4 %s32_1 %s32_2 %s32_3 %s32_4 +%f16vec2_00 = OpConstantComposite %f16vec2 %f16_0 %f16_0 + %f32vec2_00 = OpConstantComposite %f32vec2 %f32_0 %f32_0 %f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 %f32vec2_10 = OpConstantComposite %f32vec2 %f32_1 %f32_0 @@ -227,6 +243,7 @@ OpDecorate %input_flat_u32 Location 0 %const_offsets3x2 = OpConstantComposite %u32vec2arr3 %u32vec2_01 %u32vec2_12 %u32vec2_01 %const_offsets4xu = OpConstantComposite %u32arr4 %u32_0 %u32_0 %u32_0 %u32_0 %const_offsets4x3 = OpConstantComposite %u32vec3arr4 %u32vec3_012 %u32vec3_012 %u32vec3_012 %u32vec3_012 +%const_offsets4f16 = OpConstantComposite %f16vec2arr4 %f16vec2_00 %f16vec2_00 %f16vec2_00 %f16vec2_00 %type_image_f32_1d_0001 = OpTypeImage %f32 1D 0 0 0 1 Unknown %ptr_image_f32_1d_0001 = OpTypePointer UniformConstant %type_image_f32_1d_0001 @@ -368,6 +385,7 @@ OpCapability ImageQuery OpCapability ImageGatherExtended OpCapability InputAttachment OpCapability SampledRect +OpCapability Int16 )"; ss << capabilities_and_extensions; @@ -377,6 +395,7 @@ OpMemoryModel Physical32 OpenCL %func = OpTypeFunction %void %bool = OpTypeBool %f32 = OpTypeFloat 32 +%u16 = OpTypeInt 16 0 %u32 = OpTypeInt 32 0 %u32vec2 = OpTypeVector %u32 2 %f32vec2 = OpTypeVector %f32 2 @@ -391,6 +410,8 @@ OpMemoryModel Physical32 OpenCL %f32_0_25 = OpConstant %f32 0.25 %f32_0_75 = OpConstant %f32 0.75 +%u16_0 = OpConstant %u16 0 + %u32_0 = OpConstant %u32 0 %u32_1 = OpConstant %u32 1 %u32_2 = OpConstant %u32 2 @@ -1420,7 +1441,7 @@ TEST_F(ValidateImage, ImageTexelPointerImageNotResultTypePointer) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Operand '148[%148]' cannot be a " + HasSubstr("Operand '156[%156]' cannot be a " "type")); } @@ -1472,8 +1493,9 @@ TEST_F(ValidateImage, ImageTexelPointerImageCoordTypeBad) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be integer scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit integer scalar or vector")); } TEST_F(ValidateImage, ImageTexelPointerImageCoordSizeBad) { @@ -1631,8 +1653,9 @@ TEST_F(ValidateImage, SampleImplicitLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, SampleImplicitLodCoordinateSizeTooSmall) { @@ -1795,7 +1818,22 @@ TEST_F(ValidateImage, SampleExplicitLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + HasSubstr("Expected Coordinate to be a 32-bit integer or float " + "scalar or vector")); +} + +TEST_F(ValidateImage, SampleExplicitLodWrongCoordinateType16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f16vec2_00 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit scalar or vector")); } TEST_F(ValidateImage, SampleExplicitLodCoordinateSizeTooSmall) { @@ -1868,11 +1906,27 @@ TEST_F(ValidateImage, LodWrongType) { %simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler %res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Lod %f32vec2_hh)"; + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand Lod to be a 32-bit float scalar when " + "used with ExplicitLod")); +} + +TEST_F(ValidateImage, LodWithHalf) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Lod %f16_0 +)"; + CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Image Operand Lod to be float scalar when " - "used with ExplicitLod")); + HasSubstr("Expected Image Operand Lod to be a 32-bit float " + "scalar when used with ExplicitLod")); } TEST_F(ValidateImage, LodWrongDim) { @@ -1889,6 +1943,18 @@ TEST_F(ValidateImage, LodWrongDim) { "2D, 3D or Cube")); } +TEST_F(ValidateImage, LodWrongMultisample) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0011 %uniform_image_f32_2d_0011 +%res1 = OpImageFetch %f32vec4 %img %u32vec2_01 Lod|Sample %u32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operand Lod requires 'MS' parameter to be 0")); +} + TEST_F(ValidateImage, MinLodIncompatible) { const std::string body = R"( %img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 @@ -1946,8 +2012,24 @@ TEST_F(ValidateImage, SampleImplicitLodBiasWrongType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Image Operand Bias to be float scalar")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand Bias to be a 32-bit float scalar")); +} + +TEST_F(ValidateImage, SampleImplicitLodBias16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh Bias %f16_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand Bias to be a 32-bit float scalar")); } TEST_F(ValidateImage, SampleImplicitLodBiasWrongDim) { @@ -1975,9 +2057,10 @@ TEST_F(ValidateImage, SampleExplicitLodGradDxWrongType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected both Image Operand Grad ids to be float " - "scalars or vectors")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected both Image Operand Grad ids to be 32-bit float " + "scalars or vectors")); } TEST_F(ValidateImage, SampleExplicitLodGradDyWrongType) { @@ -1986,13 +2069,29 @@ TEST_F(ValidateImage, SampleExplicitLodGradDyWrongType) { %sampler = OpLoad %type_sampler %uniform_sampler %simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler %res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Grad %f32vec3_hhh %s32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected both Image Operand Grad ids to be 32-bit float " + "scalars or vectors")); +} + +TEST_F(ValidateImage, SampleExplicitLodGrad16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Grad %f16vec2_00 %f32vec2_00 )"; CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected both Image Operand Grad ids to be float " - "scalars or vectors")); + HasSubstr("Expected both Image Operand Grad ids to be 32-bit " + "float scalars or vectors")); } TEST_F(ValidateImage, SampleExplicitLodGradDxWrongSize) { @@ -2053,10 +2152,24 @@ TEST_F(ValidateImage, SampleImplicitLodConstOffsetWrongType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr( - "Expected Image Operand ConstOffset to be int scalar or vector")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand ConstOffset to be a 32-bit int " + "scalar or vector")); +} + +TEST_F(ValidateImage, SampleImplicitLodConstOffset16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_00 ConstOffset %u16_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand ConstOffset to be a 32-bit int " + "scalar or vector")); } TEST_F(ValidateImage, SampleImplicitLodConstOffsetWrongSize) { @@ -2117,7 +2230,24 @@ TEST_F(ValidateImage, SampleImplicitLodOffsetWrongType) { ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT( getDiagnosticString(), - HasSubstr("Expected Image Operand Offset to be int scalar or vector")); + HasSubstr( + "Expected Image Operand Offset to be a 32-bit int scalar or vector")); +} + +TEST_F(ValidateImage, SampleImplicitLodOffset16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 Offset %u16_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand Offset to be a 32-bit int scalar or vector")); } TEST_F(ValidateImage, SampleImplicitLodOffsetWrongSize) { @@ -2224,8 +2354,24 @@ TEST_F(ValidateImage, SampleImplicitLodMinLodWrongType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Image Operand MinLod to be float scalar")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand MinLod to be a 32-bit float scalar")); +} + +TEST_F(ValidateImage, SampleImplicitLodMinLod16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 MinLod %f16_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand MinLod to be a 32-bit float scalar")); } TEST_F(ValidateImage, SampleImplicitLodMinLodWrongDim) { @@ -2280,6 +2426,20 @@ TEST_F(ValidateImage, SampleProjExplicitLodSuccessRect) { ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); } +TEST_F(ValidateImage, GradWrongMultisample) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0011 %uniform_image_f32_2d_0011 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0011 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Grad %f32vec2_01 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Sampling operation is invalid for multisample image")); +} + TEST_F(ValidateImage, SampleProjExplicitLodWrongResultType) { const std::string body = R"( %img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 @@ -2372,8 +2532,9 @@ TEST_F(ValidateImage, SampleProjExplicitLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, SampleProjExplicitLodCoordinateSizeTooSmall) { @@ -2508,8 +2669,9 @@ TEST_F(ValidateImage, SampleProjImplicitLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, SampleProjImplicitLodCoordinateSizeTooSmall) { @@ -2634,8 +2796,9 @@ TEST_F(ValidateImage, SampleDrefImplicitLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, SampleDrefImplicitLodCoordinateSizeTooSmall) { @@ -2791,8 +2954,9 @@ TEST_F(ValidateImage, SampleDrefExplicitLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, SampleDrefExplicitLodCoordinateSizeTooSmall) { @@ -2931,8 +3095,9 @@ TEST_F(ValidateImage, SampleProjDrefImplicitLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, SampleProjDrefImplicitLodCoordinateSizeTooSmall) { @@ -3070,8 +3235,9 @@ TEST_F(ValidateImage, SampleProjDrefExplicitLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, SampleProjDrefExplicitLodCoordinateSizeTooSmall) { @@ -3234,8 +3400,9 @@ TEST_F(ValidateImage, FetchWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be int scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit integer scalar or vector")); } TEST_F(ValidateImage, FetchCoordinateSizeTooSmall) { @@ -3259,9 +3426,26 @@ TEST_F(ValidateImage, FetchLodNotInt) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Image Operand Lod to be int scalar when used " - "with OpImageFetch")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand Lod to be a 32-bit int scalar when used " + "with OpImageFetch")); +} + +TEST_F(ValidateImage, FetchLod16Int) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageFetch %f32vec4 %img %u32vec2_01 Lod %u16_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand Lod to be a 32-bit int scalar when used " + "with OpImageFetch")); } TEST_F(ValidateImage, FetchMultisampledMissingSample) { @@ -3392,8 +3576,9 @@ TEST_F(ValidateImage, GatherWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, GatherCoordinateSizeTooSmall) { @@ -3533,7 +3718,7 @@ TEST_F(ValidateImage, GatherConstOffsetsArrayNotVector) { ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr("Expected Image Operand ConstOffsets array components " - "to be int vectors of size 2")); + "to be a 32-bit int vectors of size 2")); } TEST_F(ValidateImage, GatherConstOffsetsArrayVectorWrongSize) { @@ -3548,7 +3733,22 @@ TEST_F(ValidateImage, GatherConstOffsetsArrayVectorWrongSize) { ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr("Expected Image Operand ConstOffsets array components " - "to be int vectors of size 2")); + "to be a 32-bit int vectors of size 2")); +} + +TEST_F(ValidateImage, GatherConstOffsetsArrayVector16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 ConstOffsets %const_offsets4f16 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand ConstOffsets array components " + "to be a 32-bit int vectors of size 2")); } TEST_F(ValidateImage, GatherConstOffsetsArrayNotConst) { @@ -3868,17 +4068,28 @@ TEST_F(ValidateImage, ReadVoidSampledType) { ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); } -TEST_F(ValidateImage, ReadWrongCoordinateType) { +TEST_F(ValidateImage, ReadFloatCoordinateType) { const std::string body = R"( %img = OpLoad %type_image_u32_2d_0002 %uniform_image_u32_2d_0002 %res1 = OpImageRead %u32vec4 %img %f32vec2_00 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, ReadWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0002 %uniform_image_u32_2d_0002 +%res1 = OpImageRead %u32vec4 %img %f16vec2_00 )"; const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be int scalar or vector")); + HasSubstr("Expected Coordinate to be a 32-bit scalar or vector")); } TEST_F(ValidateImage, ReadCoordinateSizeTooSmall) { @@ -4042,17 +4253,28 @@ OpImageWrite %img %u32vec2_01 %f32vec4_0000 HasSubstr("Expected Image 'Sampled' parameter to be 0 or 2")); } -TEST_F(ValidateImage, WriteWrongCoordinateType) { +TEST_F(ValidateImage, WriteFloatCoordinateType) { const std::string body = R"( %img = OpLoad %type_image_u32_2d_0002 %uniform_image_u32_2d_0002 OpImageWrite %img %f32vec2_00 %u32vec4_0123 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, WriteWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0002 %uniform_image_u32_2d_0002 +OpImageWrite %img %f16vec2_00 %u32vec4_0123 )"; const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be int scalar or vector")); + HasSubstr("Expected Coordinate to be a 32-bit scalar or vector")); } TEST_F(ValidateImage, WriteCoordinateSizeTooSmall) { @@ -4141,8 +4363,34 @@ OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %f32_1 declarations) .c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Image Operand Sample to be int scalar")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand Sample to be a 32-bit int scalar")); +} + +TEST_F(ValidateImage, WriteSample16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0012 %uniform_image_f32_2d_0012 +OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %u16_0 +)"; + + const std::string extra = R"( + OpCapability StorageImageWriteWithoutFormat + OpCapability StorageImageMultisample + )"; + const std::string declarations = R"( +%type_image_f32_2d_0012 = OpTypeImage %f32 2D 0 0 1 2 Unknown +%ptr_image_f32_2d_0012 = OpTypePointer UniformConstant %type_image_f32_2d_0012 +%uniform_image_f32_2d_0012 = OpVariable %ptr_image_f32_2d_0012 UniformConstant + )"; + CompileSuccessfully(GenerateShaderCode(body, extra, "Fragment", "", + SPV_ENV_UNIVERSAL_1_0, "GLSL450", + declarations) + .c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand Sample to be a 32-bit int scalar")); } TEST_F(ValidateImage, WriteSampleNotMultisampled) { @@ -4447,7 +4695,19 @@ TEST_F(ValidateImage, QuerySizeLodWrongLodType) { CompileSuccessfully(GenerateKernelCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Level of Detail to be int scalar")); + HasSubstr("Expected Level of Detail to be a 32-bit int scalar")); +} + +TEST_F(ValidateImage, QuerySizeLodWrong16Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQuerySizeLod %u32vec2 %img %u16_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Level of Detail to be a 32-bit int scalar")); } TEST_F(ValidateImage, QuerySizeSuccess) { @@ -4630,8 +4890,9 @@ TEST_F(ValidateImage, QueryLodWrongCoordinateType) { CompileSuccessfully(GenerateShaderCode(body).c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Expected Coordinate to be float scalar or vector")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Coordinate to be a 32-bit float scalar or vector")); } TEST_F(ValidateImage, QueryLodCoordinateSizeTooSmall) { @@ -6488,7 +6749,8 @@ TEST_F(ValidateImage, ImageTexelPointerRgba32iVulkan) { AnyVUID("VUID-StandaloneSpirv-OpImageTexelPointer-04658")); EXPECT_THAT(getDiagnosticString(), HasSubstr("Expected the Image Format in Image to be R64i, R64ui, " - "R32f, R32i, or R32ui for Vulkan environment")); + "R32f, R32i, or R32ui for Vulkan environment using " + "OpImageTexelPointer")); } TEST_F(ValidateImage, ImageTexelPointerRgba16fVulkan) { @@ -6513,7 +6775,8 @@ TEST_F(ValidateImage, ImageTexelPointerRgba16fVulkan) { AnyVUID("VUID-StandaloneSpirv-OpImageTexelPointer-04658")); EXPECT_THAT(getDiagnosticString(), HasSubstr("Expected the Image Format in Image to be R64i, R64ui, " - "R32f, R32i, or R32ui for Vulkan environment")); + "R32f, R32i, or R32ui for Vulkan environment using " + "OpImageTexelPointer")); } TEST_F(ValidateImage, ImageExecutionModeLimitationNoMode) { diff --git a/third_party/spirv-tools/test/val/val_interfaces_test.cpp b/third_party/spirv-tools/test/val/val_interfaces_test.cpp index e5cc97d6e5..d3c431bf55 100644 --- a/third_party/spirv-tools/test/val/val_interfaces_test.cpp +++ b/third_party/spirv-tools/test/val/val_interfaces_test.cpp @@ -160,6 +160,7 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = true; CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); EXPECT_THAT( @@ -215,9 +216,9 @@ OpFunctionEnd CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_4); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("Non-unique OpEntryPoint interface '2[%var]' is disallowed")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("In SPIR-V 1.4 or later, non-unique OpEntryPoint " + "interface '2[%var]' is disallowed")); } TEST_F(ValidateInterfacesTest, MissingGlobalVarSPV1p3) { @@ -1996,6 +1997,8 @@ OpFunctionEnd CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-OpTypeFloat-10823")); EXPECT_THAT( getDiagnosticString(), HasSubstr("FP8 E4M3/E5M2 OpVariable '2[%2]' must not be declared " @@ -2028,12 +2031,73 @@ OpFunctionEnd CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-OpTypeFloat-10823")); EXPECT_THAT( getDiagnosticString(), HasSubstr("FP8 E4M3/E5M2 OpVariable '2[%2]' must not be declared " "with a Storage Class of Input or Output.\n")); } +TEST_F(ValidateInterfacesTest, VectorIdFragmentInputOutputPass) { + const std::string text = R"( +OpCapability Shader +OpCapability LongVectorEXT +OpExtension "SPV_EXT_long_vector" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in %out +OpExecutionMode %main OriginUpperLeft +OpDecorate %in Location 0 +OpDecorate %out Location 0 +%void = OpTypeVoid +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u4 = OpConstant %u32 4 +%f32vec = OpTypeVectorIdEXT %f32 %u4 +%in_ptr = OpTypePointer Input %f32vec +%out_ptr = OpTypePointer Output %f32vec +%in = OpVariable %in_ptr Input +%out = OpVariable %out_ptr Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + +TEST_F(ValidateInterfacesTest, VectorIdVertexInputOutputPass) { + const std::string text = R"( +OpCapability Shader +OpCapability LongVectorEXT +OpExtension "SPV_EXT_long_vector" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %in %out +OpDecorate %in Location 0 +OpDecorate %out Location 0 +%void = OpTypeVoid +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u4 = OpConstant %u32 4 +%f32vec = OpTypeVectorIdEXT %f32 %u4 +%in_ptr = OpTypePointer Input %f32vec +%out_ptr = OpTypePointer Output %f32vec +%in = OpVariable %in_ptr Input +%out = OpVariable %out_ptr Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text, SPV_ENV_VULKAN_1_3); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + } // namespace } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_invalid_type_test.cpp b/third_party/spirv-tools/test/val/val_invalid_type_test.cpp index d19b274cdb..5f8cf73995 100644 --- a/third_party/spirv-tools/test/val/val_invalid_type_test.cpp +++ b/third_party/spirv-tools/test/val/val_invalid_type_test.cpp @@ -48,6 +48,7 @@ OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 OpSource GLSL 450 OpName %main "main" +%bool = OpTypeBool %void = OpTypeVoid %bfloat16 = OpTypeFloat 16 BFloat16KHR %func = OpTypeFunction %void @@ -88,6 +89,22 @@ TEST_F(ValidateInvalidType, Bfloat16InvalidArithmeticInstruction) { HasSubstr("FMul doesn't support BFloat16 type.")); } +TEST_F(ValidateInvalidType, Bfloat16InvalidRelationalInstruction) { + const std::string body = R"( +%v1 = OpVariable %_ptr_Function_bfloat16 Function +%v2 = OpVariable %_ptr_Function_bfloat16 Function +%12 = OpLoad %bfloat16 %v1 +%14 = OpLoad %bfloat16 %v2 +%15 = OpFOrdEqual %bool %12 %14 +)"; + + CompileSuccessfully(GenerateBFloatCode(body).c_str(), SPV_ENV_VULKAN_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_6)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("FOrdEqual doesn't support BFloat16 type.")); +} + TEST_F(ValidateInvalidType, Bfloat16InvalidAtomicInstruction) { const std::string body = R"( %val1 = OpAtomicFAddEXT %bfloat16 %bf16_var %u1 %u0 %bf16_1 @@ -128,6 +145,7 @@ OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 OpSource GLSL 450 OpName %main "main" +%bool = OpTypeBool %void = OpTypeVoid %fp8e4m3 = OpTypeFloat 8 Float8E4M3EXT %fp8e5m2 = OpTypeFloat 8 Float8E5M2EXT @@ -191,6 +209,38 @@ TEST_F(ValidateInvalidType, FP8E5M2InvalidArithmeticInstruction) { HasSubstr("FMul doesn't support FP8 E4M3/E5M2 types.")); } +TEST_F(ValidateInvalidType, FP8E4M3InvalidRelationalInstruction) { + const std::string body = R"( +%v1 = OpVariable %_ptr_Function_fp8e4m3 Function +%v2 = OpVariable %_ptr_Function_fp8e4m3 Function +%12 = OpLoad %fp8e4m3 %v1 +%14 = OpLoad %fp8e4m3 %v2 +%15 = OpFOrdEqual %bool %12 %14 +)"; + + CompileSuccessfully(GenerateFP8Code(body).c_str(), SPV_ENV_VULKAN_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_6)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("FOrdEqual doesn't support FP8 E4M3/E5M2 types.")); +} + +TEST_F(ValidateInvalidType, FP8E5M2InvalidRelationalInstruction) { + const std::string body = R"( +%v1 = OpVariable %_ptr_Function_fp8e5m2 Function +%v2 = OpVariable %_ptr_Function_fp8e5m2 Function +%12 = OpLoad %fp8e5m2 %v1 +%14 = OpLoad %fp8e5m2 %v2 +%15 = OpFOrdEqual %bool %12 %14 +)"; + + CompileSuccessfully(GenerateFP8Code(body).c_str(), SPV_ENV_VULKAN_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_6)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("FOrdEqual doesn't support FP8 E4M3/E5M2 types.")); +} + TEST_F(ValidateInvalidType, FP8E4M3InvalidAtomicInstruction) { const std::string body = R"( %val1 = OpAtomicFAddEXT %fp8e4m3 %fp8e4m3_var %u1 %u0 %fp8e4m3_1 diff --git a/third_party/spirv-tools/test/val/val_layout_test.cpp b/third_party/spirv-tools/test/val/val_layout_test.cpp index e809abf812..4fd7fe4977 100644 --- a/third_party/spirv-tools/test/val/val_layout_test.cpp +++ b/third_party/spirv-tools/test/val/val_layout_test.cpp @@ -460,9 +460,11 @@ TEST_F(ValidateEntryPoint, NoEntryPointBad) { OpMemoryModel Logical GLSL450)"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("No OpEntryPoint instruction was found. This is only " - "allowed if the Linkage capability is being used.")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "No OpEntryPoint instruction was found. This is only " + "allowed if the Linkage or GraphARM capability is being used.")); } // Invalid. A function may not be a target of both OpEntryPoint and @@ -631,7 +633,8 @@ TEST_F(ValidateLayout, ModuleProcessedInvalidInFunctionBeforeLabel) { ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); EXPECT_THAT( getDiagnosticString(), - HasSubstr("ModuleProcessed cannot appear in a function declaration")); + HasSubstr( + "ModuleProcessed cannot appear in the graph definitions section")); } TEST_F(ValidateLayout, ModuleProcessedInvalidInBasicBlock) { @@ -653,7 +656,8 @@ TEST_F(ValidateLayout, ModuleProcessedInvalidInBasicBlock) { ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); EXPECT_THAT( getDiagnosticString(), - HasSubstr("ModuleProcessed cannot appear in a function declaration")); + HasSubstr( + "ModuleProcessed cannot appear in the graph definitions section")); } // TODO(umar): Test optional instructions diff --git a/third_party/spirv-tools/test/val/val_logical_pointers_test.cpp b/third_party/spirv-tools/test/val/val_logical_pointers_test.cpp new file mode 100644 index 0000000000..3b09b26710 --- /dev/null +++ b/third_party/spirv-tools/test/val/val_logical_pointers_test.cpp @@ -0,0 +1,2456 @@ +// Copyright (c) 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::Combine; +using ::testing::Eq; +using ::testing::HasSubstr; +using ::testing::Values; +using ::testing::ValuesIn; + +using ValidateLogicalPointersTest = spvtest::ValidateBase; + +enum class MatrixTrace : uint32_t { + kNotAMatrix, + kColumn, + kComponent, +}; + +const MatrixTrace traces[] = {MatrixTrace::kNotAMatrix, MatrixTrace::kColumn, + MatrixTrace::kComponent}; + +using MatrixTraceTypedTest = spvtest::ValidateBase; + +TEST_P(MatrixTraceTypedTest, PhiLoopOp1) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +OpBranch %loop +%loop = OpLabel +%phi = OpPhi )" + type + R"( %gep %entry %copy %continue +OpLoopMerge %merge %continue None +OpBranchConditional %bool_cond %merge %continue +%continue = OpLabel +%copy = OpCopyObject )" + type + + R"( %phi +OpBranch %loop +%merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, PhiLoopOp2) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +OpBranch %loop +%loop = OpLabel +%phi = OpPhi )" + type + R"( %copy %continue %gep %entry +OpLoopMerge %merge %continue None +OpBranchConditional %bool_cond %merge %continue +%continue = OpLabel +%copy = OpCopyObject )" + type + + R"( %phi +OpBranch %loop +%merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, SelectOp1) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpCopyObject )" + type + + R"( %gep +%sel = OpSelect )" + type + R"( %bool_cond %copy %null +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, SelectOp2) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpCopyObject )" + type + + R"( %gep +%sel = OpSelect )" + type + R"( %bool_cond %null %copy +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, FunctionVariable) { + const auto trace_type = GetParam(); + std::string gep, type, ld_type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_func_wg_v2float"; + ld_type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var_mat2x2 %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_func_wg_float"; + ld_type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var_mat2x2 %index %index"; + break; + default: + type = "%ptr_func_wg_float"; + ld_type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var_float"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_float = OpTypePointer Workgroup %float +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_mat2x2 = OpTypePointer Workgroup %mat2x2 +%ptr_func_wg_float = OpTypePointer Function %ptr_wg_float +%ptr_func_wg_v2float = OpTypePointer Function %ptr_wg_v2float +%var_mat2x2 = OpVariable %ptr_wg_mat2x2 Workgroup +%var_float = OpVariable %ptr_wg_float Workgroup +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%func_var = OpVariable )" + type + + R"( Function +%gep = )" + gep + R"( +OpStore %func_var %gep +%ld = OpLoad )" + ld_type + R"( %func_var +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, PrivateVariable) { + const auto trace_type = GetParam(); + std::string gep, type, ld_type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_priv_wg_v2float"; + ld_type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var_mat2x2 %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_priv_wg_float"; + ld_type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var_mat2x2 %index %index"; + break; + default: + type = "%ptr_priv_wg_float"; + ld_type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var_float"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_float = OpTypePointer Workgroup %float +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_mat2x2 = OpTypePointer Workgroup %mat2x2 +%ptr_priv_wg_float = OpTypePointer Private %ptr_wg_float +%ptr_priv_wg_v2float = OpTypePointer Private %ptr_wg_v2float +%var_mat2x2 = OpVariable %ptr_wg_mat2x2 Workgroup +%var_float = OpVariable %ptr_wg_float Workgroup +%priv_var = OpVariable )" + type + + R"( Private +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +OpStore %priv_var %gep +%ld = OpLoad )" + ld_type + R"( %priv_var +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, FunctionVariableAggregate) { + const auto trace_type = GetParam(); + std::string gep, var_type, gep_type, ld_type; + switch (trace_type) { + case MatrixTrace::kColumn: + var_type = "%ptr_func_wg_struct_v2float"; + gep_type = "%ptr_func_wg_v2float"; + ld_type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var_mat2x2 %index"; + break; + case MatrixTrace::kComponent: + var_type = "%ptr_func_wg_struct_float"; + gep_type = "%ptr_func_wg_float"; + ld_type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var_mat2x2 %index %index"; + break; + default: + var_type = "%ptr_func_wg_struct_float"; + gep_type = "%ptr_func_wg_float"; + ld_type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var_float"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_float = OpTypePointer Workgroup %float +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_mat2x2 = OpTypePointer Workgroup %mat2x2 +%func_array_float = OpTypeArray %ptr_wg_float %int_1 +%func_array_v2float = OpTypeArray %ptr_wg_v2float %int_1 +%func_struct_float = OpTypeStruct %func_array_float +%func_struct_v2float = OpTypeStruct %func_array_v2float +%ptr_func_wg_struct_float = OpTypePointer Function %func_struct_float +%ptr_func_wg_struct_v2float = OpTypePointer Function %func_struct_v2float +%ptr_func_wg_float = OpTypePointer Function %ptr_wg_float +%ptr_func_wg_v2float = OpTypePointer Function %ptr_wg_v2float +%var_mat2x2 = OpVariable %ptr_wg_mat2x2 Workgroup +%var_float = OpVariable %ptr_wg_float Workgroup +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%func_var = OpVariable )" + var_type + + R"( Function +%gep = )" + gep + R"( +%store_gep = OpAccessChain )" + + gep_type + R"( %func_var %int_0 %index +%store_gep_copy = OpCopyObject )" + + gep_type + R"( %store_gep +OpStore %store_gep_copy %gep +%ld_gep = OpAccessChain )" + gep_type + + R"( %func_var %int_0 %index +%ld = OpLoad )" + ld_type + R"( %ld_gep +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, FunctionCallParam1) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%foo_fn = OpTypeFunction %void )" + + type + R"( %bool +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpCopyObject )" + type + + R"( %gep +%call = OpFunctionCall %void %foo %copy %bool_cond +OpReturn +OpFunctionEnd +%foo = OpFunction %void None %foo_fn +%ptr_param = OpFunctionParameter )" + + type + R"( +%bool_param = OpFunctionParameter %bool +%foo_entry = OpLabel +%sel = OpSelect )" + type + R"( %bool_param %ptr_param %null +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, FunctionCallParam2) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%foo_fn = OpTypeFunction %void %bool )" + + type + R"( +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpCopyObject )" + type + + R"( %gep +%call = OpFunctionCall %void %foo %bool_cond %copy +OpReturn +OpFunctionEnd +%foo = OpFunction %void None %foo_fn +%bool_param = OpFunctionParameter %bool +%ptr_param = OpFunctionParameter )" + + type + R"( +%foo_entry = OpLabel +%sel = OpSelect )" + type + R"( %bool_param %ptr_param %null +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, FunctionCall) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%foo_ty = OpTypeFunction )" + + type + R"( +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall )" + type + + R"( %foo +OpReturn +OpFunctionEnd +%foo = OpFunction )" + type + + R"( None %foo_ty +%foo_entry = OpLabel +%gep = )" + gep + R"( +OpReturnValue %gep +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, FunctionCallMultiReturn1) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%foo_ty = OpTypeFunction )" + + type + R"( +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall )" + type + + R"( %foo +OpReturn +OpFunctionEnd +%foo = OpFunction )" + type + + R"( None %foo_ty +%foo_entry = OpLabel +%gep = )" + gep + R"( +OpSelectionMerge %merge None +OpBranchConditional %bool_cond %then %merge +%then = OpLabel +OpReturnValue %gep +%merge = OpLabel +OpReturnValue %null +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceTypedTest, FunctionCallMultiReturn2) { + const auto trace_type = GetParam(); + std::string gep, type; + switch (trace_type) { + case MatrixTrace::kColumn: + type = "%ptr_wg_v2float"; + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + type = "%ptr_wg_float"; + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull )" + type + + R"( +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%foo_ty = OpTypeFunction )" + + type + R"( +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall )" + type + + R"( %foo +OpReturn +OpFunctionEnd +%foo = OpFunction )" + type + + R"( None %foo_ty +%foo_entry = OpLabel +%gep = )" + gep + R"( +OpSelectionMerge %merge None +OpBranchConditional %bool_cond %then %merge +%then = OpLabel +OpReturnValue %null +%merge = OpLabel +OpReturnValue %gep +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +INSTANTIATE_TEST_SUITE_P(ValidateLogicalPointersMatrixTraceTyped, + MatrixTraceTypedTest, ValuesIn(traces)); + +using MatrixTraceUntypedTest = spvtest::ValidateBase; + +TEST_P(MatrixTraceUntypedTest, PhiLoopOp1) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +OpBranch %loop +%loop = OpLabel +%phi = OpPhi %ptr_wg %gep %entry %copy %continue +OpLoopMerge %merge %continue None +OpBranchConditional %bool_cond %merge %continue +%continue = OpLabel +%copy = OpCopyObject %ptr_wg %phi +OpBranch %loop +%merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} +TEST_P(MatrixTraceUntypedTest, PhiLoopOp2) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +OpBranch %loop +%loop = OpLabel +%phi = OpPhi %ptr_wg %copy %continue %gep %entry +OpLoopMerge %merge %continue None +OpBranchConditional %bool_cond %merge %continue +%continue = OpLabel +%copy = OpCopyObject %ptr_wg %phi +OpBranch %loop +%merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, SelectOp1) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpCopyObject %ptr_wg %gep +%sel = OpSelect %ptr_wg %bool_cond %copy %null +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, SelectOp2) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpCopyObject %ptr_wg %gep +%sel = OpSelect %ptr_wg %bool_cond %null %copy +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, FunctionVariable) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %mat2x2 %var_mat2x2 %index"; + break; + case MatrixTrace::kComponent: + gep = "OpUntypedAccessChainKHR %ptr_wg %mat2x2 %var_mat2x2 %index %index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %float %var_float"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%ptr_func_wg = OpTypePointer Function %ptr_wg +%var_mat2x2 = OpUntypedVariableKHR %ptr_wg Workgroup %mat2x2 +%var_float = OpUntypedVariableKHR %ptr_wg Workgroup %float +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%func_var = OpVariable %ptr_func_wg Function +%gep = )" + gep + R"( +OpStore %func_var %gep +%ld = OpLoad %ptr_wg %func_var +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, PrivateVariable) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %mat2x2 %var_mat2x2 %index"; + break; + case MatrixTrace::kComponent: + gep = "OpUntypedAccessChainKHR %ptr_wg %mat2x2 %var_mat2x2 %index %index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %float %var_float"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%ptr_priv_wg = OpTypePointer Private %ptr_wg +%var_mat2x2 = OpUntypedVariableKHR %ptr_wg Workgroup %mat2x2 +%var_float = OpUntypedVariableKHR %ptr_wg Workgroup %float +%priv_var = OpVariable %ptr_priv_wg Private +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +OpStore %priv_var %gep +%ld = OpLoad %ptr_wg %priv_var +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, FunctionVariableAggregate) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %mat2x2 %var_mat2x2 %index"; + break; + case MatrixTrace::kComponent: + gep = "OpUntypedAccessChainKHR %ptr_wg %mat2x2 %var_mat2x2 %index %index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %float %var_float"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%func_array = OpTypeArray %ptr_wg %int_1 +%func_struct = OpTypeStruct %func_array +%ptr_func_wg_struct = OpTypePointer Function %func_struct +%ptr_func_wg = OpTypePointer Function %ptr_wg +%var_mat2x2 = OpUntypedVariableKHR %ptr_wg Workgroup %mat2x2 +%var_float = OpUntypedVariableKHR %ptr_wg Workgroup %float +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%func_var = OpVariable %ptr_func_wg_struct Function +%gep = )" + gep + R"( +%store_gep = OpAccessChain %ptr_func_wg %func_var %int_0 %index +%store_gep_copy = OpCopyObject %ptr_func_wg %store_gep +OpStore %store_gep_copy %gep +%ld_gep = OpAccessChain %ptr_func_wg %func_var %int_0 %index +%ld = OpLoad %ptr_wg %ld_gep +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, FunctionCallParam1) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%foo_fn = OpTypeFunction %void %ptr_wg %bool +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpCopyObject %ptr_wg %gep +%call = OpFunctionCall %void %foo %copy %bool_cond +OpReturn +OpFunctionEnd +%foo = OpFunction %void None %foo_fn +%ptr_param = OpFunctionParameter %ptr_wg +%bool_param = OpFunctionParameter %bool +%foo_entry = OpLabel +%sel = OpSelect %ptr_wg %bool_param %ptr_param %null +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, FunctionCallParam2) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%foo_fn = OpTypeFunction %void %bool %ptr_wg +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpCopyObject %ptr_wg %gep +%call = OpFunctionCall %void %foo %bool_cond %copy +OpReturn +OpFunctionEnd +%foo = OpFunction %void None %foo_fn +%bool_param = OpFunctionParameter %bool +%ptr_param = OpFunctionParameter %ptr_wg +%foo_entry = OpLabel +%sel = OpSelect %ptr_wg %bool_param %ptr_param %null +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, FunctionCall) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%foo_ty = OpTypeFunction %ptr_wg +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr_wg %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr_wg None %foo_ty +%foo_entry = OpLabel +%gep = )" + gep + R"( +OpReturnValue %gep +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, FunctionCallMultiReturn1) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%foo_ty = OpTypeFunction %ptr_wg +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr_wg %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr_wg None %foo_ty +%foo_entry = OpLabel +%gep = )" + gep + R"( +OpSelectionMerge %merge None +OpBranchConditional %bool_cond %then %merge +%then = OpLabel +OpReturnValue %gep +%merge = OpLabel +OpReturnValue %null +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, FunctionCallMultiReturn2) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = + "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_0 %index %index " + "%index"; + break; + default: + gep = "OpUntypedAccessChainKHR %ptr_wg %struct %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%null = OpConstantNull %ptr_wg +%var = OpUntypedVariableKHR %ptr_wg Workgroup %struct +%void_fn = OpTypeFunction %void +%foo_ty = OpTypeFunction %ptr_wg +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %ptr_wg %foo +OpReturn +OpFunctionEnd +%foo = OpFunction %ptr_wg None %foo_ty +%foo_entry = OpLabel +%gep = )" + gep + R"( +OpSelectionMerge %merge None +OpBranchConditional %bool_cond %then %merge +%then = OpLabel +OpReturnValue %null +%merge = OpLabel +OpReturnValue %gep +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +TEST_P(MatrixTraceUntypedTest, MixedTypes) { + const auto trace_type = GetParam(); + std::string gep; + switch (trace_type) { + case MatrixTrace::kColumn: + gep = "OpAccessChain %ptr_wg_v2float %var %int_0 %index %index"; + break; + case MatrixTrace::kComponent: + gep = "OpAccessChain %ptr_wg_float %var %int_0 %index %index %index"; + break; + default: + gep = "OpAccessChain %ptr_wg_float %var %int_1"; + break; + } + + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%index = OpUndef %int +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%array = OpTypeArray %mat2x2 %int_2 +%struct = OpTypeStruct %array %float +%ptr_wg = OpTypeUntypedPointerKHR Workgroup +%ptr_wg_struct = OpTypePointer Workgroup %struct +%ptr_wg_v2float = OpTypePointer Workgroup %v2float +%ptr_wg_float = OpTypePointer Workgroup %float +%null = OpConstantNull %ptr_wg +%var = OpVariable %ptr_wg_struct Workgroup +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = )" + gep + R"( +%copy = OpUntypedAccessChainKHR %ptr_wg %struct %gep +%sel = OpSelect %ptr_wg %bool_cond %copy %null +OpReturn +OpFunctionEnd +)"; + + const auto expected = trace_type == MatrixTrace::kNotAMatrix + ? SPV_SUCCESS + : SPV_ERROR_INVALID_DATA; + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(expected, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + if (expected) { + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to a column or a " + "component of a column of a matrix")); + } +} + +INSTANTIATE_TEST_SUITE_P(ValidateLogicalPointersMatrixTraceUntyped, + MatrixTraceUntypedTest, ValuesIn(traces)); + +TEST_F(ValidateLogicalPointersTest, SelectDifferentBuffersTyped) { + const std::string spirv = R"( +OpCapability VariablePointersStorageBuffer +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%struct = OpTypeStruct %int +%ptr_struct = OpTypePointer StorageBuffer %struct +%v1 = OpVariable %ptr_struct StorageBuffer +%v2 = OpVariable %ptr_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%select = OpSelect %ptr_struct %bool_cond %v1 %v2 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointers must point into the same structure " + "(or OpConstantNull)")); +} + +TEST_F(ValidateLogicalPointersTest, SelectDifferentBuffersUntyped) { + const std::string spirv = R"( +OpCapability VariablePointersStorageBuffer +OpCapability Shader +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%struct = OpTypeStruct %int +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%v1 = OpUntypedVariableKHR %ptr StorageBuffer %struct +%v2 = OpUntypedVariableKHR %ptr StorageBuffer %struct +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%select = OpSelect %ptr %bool_cond %v1 %v2 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointers must point into the same structure " + "(or OpConstantNull)")); +} + +TEST_F(ValidateLogicalPointersTest, PhiDifferentBuffersTyped) { + const std::string spirv = R"( +OpCapability VariablePointersStorageBuffer +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%struct = OpTypeStruct %int +%ptr_struct = OpTypePointer StorageBuffer %struct +%v1 = OpVariable %ptr_struct StorageBuffer +%v2 = OpVariable %ptr_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpSelectionMerge %merge None +OpBranchConditional %bool_cond %then %merge +%then = OpLabel +OpBranch %merge +%merge = OpLabel +%phi = OpPhi %ptr_struct %v1 %entry %v2 %then +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointers must point into the same structure " + "(or OpConstantNull)")); +} + +TEST_F(ValidateLogicalPointersTest, PhiDifferentBuffersUntyped) { + const std::string spirv = R"( +OpCapability VariablePointersStorageBuffer +OpCapability Shader +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%int = OpTypeInt 32 0 +%struct = OpTypeStruct %int +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%v1 = OpUntypedVariableKHR %ptr StorageBuffer %struct +%v2 = OpUntypedVariableKHR %ptr StorageBuffer %struct +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpSelectionMerge %merge None +OpBranchConditional %bool_cond %then %merge +%then = OpLabel +OpBranch %merge +%merge = OpLabel +%phi = OpPhi %ptr %v1 %entry %v2 %then +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointers must point into the same structure " + "(or OpConstantNull)")); +} + +TEST_F(ValidateLogicalPointersTest, BlockArrayTyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%struct = OpTypeStruct %int +%array = OpTypeArray %struct %int_4 +%ptr_array = OpTypePointer StorageBuffer %array +%ptr_int = OpTypePointer StorageBuffer %int +%var = OpVariable %ptr_array StorageBuffer +%null = OpConstantNull %ptr_array +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%select = OpSelect %ptr_array %bool_cond %null %var +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to an array of Block- " + "or BufferBlock-decorated structs")); +} + +TEST_F(ValidateLogicalPointersTest, BlockArrayUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%bool_cond = OpUndef %bool +%struct = OpTypeStruct %int +%array = OpTypeArray %struct %int_4 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr StorageBuffer %array +%null = OpConstantNull %ptr +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%select = OpSelect %ptr %bool_cond %null %var +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to an array of Block- " + "or BufferBlock-decorated structs")); +} + +TEST_F(ValidateLogicalPointersTest, UntypedMatrixLoad) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%struct = OpTypeStruct %mat2x2 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr StorageBuffer %struct +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld = OpLoad %struct %var +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); +} + +TEST_F(ValidateLogicalPointersTest, UntypedMatrixLoadVariablePointer) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%struct = OpTypeStruct %mat2x2 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr StorageBuffer %struct +%null = OpConstantNull %ptr +%bool = OpTypeBool +%cond = OpUndef %bool +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%sel = OpSelect %ptr %cond %var %null +%ld = OpLoad %struct %sel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to an object that is " + "or contains a matrix")); +} + +TEST_F(ValidateLogicalPointersTest, UntypedMatrixStore) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%zero = OpConstantNull %mat2x2 +%struct = OpTypeStruct %mat2x2 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr StorageBuffer %struct +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %var %zero +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); +} + +TEST_F(ValidateLogicalPointersTest, UntypedMatrixStoreVariablePointer) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%mat2x2 = OpTypeMatrix %v2float 2 +%zero = OpConstantNull %mat2x2 +%struct = OpTypeStruct %mat2x2 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr StorageBuffer %struct +%null = OpConstantNull %ptr +%bool = OpTypeBool +%cond = OpUndef %bool +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%sel = OpSelect %ptr %cond %var %null +OpStore %sel %zero +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variable pointer must not point to an object that is " + "or contains a matrix")); +} + +TEST_F(ValidateLogicalPointersTest, LogicalPointerOperandFailure) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Kernel +OpCapability Addresses +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%v2int = OpTypeVector %int 2 +%ptr_v2int = OpTypePointer StorageBuffer %v2int +%var = OpVariable %ptr_v2int StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpInBoundsPtrAccessChain %ptr_v2int %var %int_0 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Instruction may not have a logical pointer operand")); +} + +TEST_F(ValidateLogicalPointersTest, + LogicalPointerOperandVariablePointerStorageBuffer) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpCapability Addresses +OpMemoryModel Logical GLSL450 +OpDecorate %ptr_int ArrayStride 4 +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%array = OpTypeArray %int %int_4 +%ptr_array = OpTypePointer StorageBuffer %array +%ptr_int = OpTypePointer StorageBuffer %int +%var = OpVariable %ptr_array StorageBuffer +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%foo = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpAccessChain %ptr_int %var %int_0 +%ptr_gep = OpPtrAccessChain %ptr_int %gep %int_0 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Instruction may only have a logical pointer operand in the " + "StorageBuffer or " + "Workgroup storage classes with appropriate variable pointers " + "capability")); +} + +TEST_F(ValidateLogicalPointersTest, + LogicalPointerOperandVariablePointerWorkgroup) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%array = OpTypeArray %int %int_4 +%ptr_array = OpTypePointer Workgroup %array +%ptr_int = OpTypePointer Workgroup %int +%var = OpVariable %ptr_array Workgroup +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%foo = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpAccessChain %ptr_int %var %int_0 +%ptr_gep = OpPtrAccessChain %ptr_int %gep %int_0 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Instruction may only have a logical pointer operand in the " + "StorageBuffer or " + "Workgroup storage classes with appropriate variable pointers " + "capability")); +} + +TEST_F(ValidateLogicalPointersTest, + LogicalPointerReturnVariablePointerStorageBuffer) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%int = OpTypeInt 32 0 +%ptr = OpTypePointer StorageBuffer %int +%null = OpConstantNull %ptr +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Instruction may only return a logical pointer in the " + "StorageBuffer or " + "Workgroup storage classes with appropriate variable pointers " + "capability")); +} + +TEST_F(ValidateLogicalPointersTest, + LogicalPointerReturnVariablePointerWorkgroup) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +%int = OpTypeInt 32 0 +%ptr = OpTypePointer Workgroup %int +%null = OpConstantNull %ptr +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Instruction may only return a logical pointer in the " + "StorageBuffer or " + "Workgroup storage classes with appropriate variable pointers " + "capability")); +} + +TEST_F(ValidateLogicalPointersTest, ArrayLengthInvalidVariablePointer) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%array = OpTypeRuntimeArray %int +%struct = OpTypeStruct %array +%ptr = OpTypePointer StorageBuffer %struct +%var = OpVariable %ptr StorageBuffer +%null = OpConstantNull %ptr +%bool = OpTypeBool +%cond = OpUndef %bool +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%sel = OpSelect %ptr %cond %null %var +%len = OpArrayLength %int %sel 0 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Pointer operand must not be a variable pointer")); +} + +TEST_F(ValidateLogicalPointersTest, ArrayLengthUntypedInvalidVariablePointer) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%array = OpTypeRuntimeArray %int +%struct = OpTypeStruct %array +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr StorageBuffer %struct +%null = OpConstantNull %ptr +%bool = OpTypeBool +%cond = OpUndef %bool +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%sel = OpSelect %ptr %cond %null %var +%len = OpUntypedArrayLengthKHR %int %struct %sel 0 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Pointer operand must not be a variable pointer")); +} + +TEST_F(ValidateLogicalPointersTest, FunctionParameterOperandOfFunctionCall) { + const std::string spirv = R"( + OpCapability ClipDistance + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 " " + OpExecutionMode %2 OriginUpperLeft + %void = OpTypeVoid + %32 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %35 = OpTypeFunction %float %_ptr_Function_float +%float_1_35631564en19 = OpConstant %float 1.35631564e-19 +%float_1_35631564en19_0 = OpConstant %float 1.35631564e-19 + %2 = OpFunction %void None %32 + %8447 = OpLabel + OpUnreachable + OpFunctionEnd + %9 = OpFunction %float None %35 + %10 = OpFunctionParameter %_ptr_Function_float + %65535 = OpLabel + %217 = OpVariable %_ptr_Function_float Function + %218 = OpLoad %float %10 + %2097407 = OpFunctionCall %float %9 %10 + %231 = OpLoad %float %217 + %232 = OpFDiv %float %218 %231 + %233 = OpExtInst %float %1 SmoothStep %float_1_35631564en19 %float_1_35631564en19_0 %232 + OpReturnValue %233 + OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicalPointersTest, RecursiveCalls) { + const std::string spirv = R"( + OpCapability ClipDistance + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 " " + OpExecutionMode %2 OriginUpperLeft + %void = OpTypeVoid + %32 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %35 = OpTypeFunction %float %_ptr_Function_float +%float_1_35631564en19 = OpConstant %float 1.35631564e-19 +%float_1_35631564en19_0 = OpConstant %float 1.35631564e-19 + %2 = OpFunction %void None %32 + %8447 = OpLabel + OpUnreachable + OpFunctionEnd + %9 = OpFunction %float None %35 + %10 = OpFunctionParameter %_ptr_Function_float + %65535 = OpLabel + %217 = OpVariable %_ptr_Function_float Function + %218 = OpLoad %float %10 + %2097407 = OpFunctionCall %float %20 %10 + %231 = OpLoad %float %217 + %232 = OpFDiv %float %218 %231 + %233 = OpExtInst %float %1 SmoothStep %float_1_35631564en19 %float_1_35631564en19_0 %232 + OpReturnValue %233 + OpFunctionEnd + %20 = OpFunction %float None %35 + %21 = OpFunctionParameter %_ptr_Function_float + %22 = OpLabel + %23 = OpFunctionCall %float %9 %21 + OpReturnValue %float_1_35631564en19 + OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_logicals_test.cpp b/third_party/spirv-tools/test/val/val_logicals_test.cpp index c1406728a0..07b502c132 100644 --- a/third_party/spirv-tools/test/val/val_logicals_test.cpp +++ b/third_party/spirv-tools/test/val/val_logicals_test.cpp @@ -631,38 +631,54 @@ OpStore %y %f32vec4_1234 } TEST_F(ValidateLogicals, OpSelectPointerWithCapability1) { - const std::string body = R"( -%x = OpVariable %f32vec4ptr Function -%y = OpVariable %f32vec4ptr Function -OpStore %x %f32vec4_0123 -OpStore %y %f32vec4_1234 -%val1 = OpSelect %f32vec4ptr %true %x %y -)"; - - const std::string extra_cap_ext = R"( + const std::string spirv = R"( +OpCapability Shader OpCapability VariablePointers OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%bool = OpTypeBool +%undef = OpUndef %bool +%ptr = OpTypePointer Workgroup %int +%var = OpVariable %ptr Workgroup +%null = OpConstantNull %ptr +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%sel = OpSelect %ptr %undef %var %null +OpReturn +OpFunctionEnd )"; - CompileSuccessfully(GenerateShaderCode(body, extra_cap_ext).c_str()); + CompileSuccessfully(spirv); ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); } TEST_F(ValidateLogicals, OpSelectPointerWithCapability2) { - const std::string body = R"( -%x = OpVariable %f32vec4ptr Function -%y = OpVariable %f32vec4ptr Function -OpStore %x %f32vec4_0123 -OpStore %y %f32vec4_1234 -%val1 = OpSelect %f32vec4ptr %true %x %y -)"; - - const std::string extra_cap_ext = R"( + const std::string spirv = R"( +OpCapability Shader OpCapability VariablePointersStorageBuffer OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%bool = OpTypeBool +%undef = OpUndef %bool +%ptr = OpTypePointer StorageBuffer %int +%var = OpVariable %ptr StorageBuffer +%null = OpConstantNull %ptr +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%sel = OpSelect %ptr %undef %var %null +OpReturn +OpFunctionEnd )"; - CompileSuccessfully(GenerateShaderCode(body, extra_cap_ext).c_str()); + CompileSuccessfully(spirv); ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); } diff --git a/third_party/spirv-tools/test/val/val_memory_semantics_test.cpp b/third_party/spirv-tools/test/val/val_memory_semantics_test.cpp new file mode 100644 index 0000000000..96f812d763 --- /dev/null +++ b/third_party/spirv-tools/test/val/val_memory_semantics_test.cpp @@ -0,0 +1,688 @@ +// Copyright (c) 2025 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "gmock/gmock.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::Combine; +using ::testing::HasSubstr; +using ::testing::Values; +using ::testing::ValuesIn; +using ::testing::internal::ParamGenerator; + +// clang-format off +#define MEMORY_SEMANTICS_OPERANDS \ + OpMemoryBarrier, \ + OpControlBarrier, \ + OpAtomicLoad, \ + OpAtomicStore, \ + OpAtomicExchange, \ + OpAtomicIIncrement, \ + OpAtomicIDecrement, \ + OpAtomicIAdd, \ + OpAtomicISub, \ + OpAtomicSMin, \ + OpAtomicSMax, \ + OpAtomicUMin, \ + OpAtomicUMax, \ + OpAtomicAnd, \ + OpAtomicOr, \ + OpAtomicXor, \ + OpAtomicCompareExchangeEqual, \ + OpAtomicCompareExchangeUnequal + +enum Operand { MEMORY_SEMANTICS_OPERANDS }; +const Operand Operands[] = { MEMORY_SEMANTICS_OPERANDS }; +const size_t OperandsCount = sizeof(Operands) / sizeof(Operand); +#undef MEMORY_SEMANTICS_OPERANDS +// clang-format on + +enum Value { + None = uint32_t(spv::MemorySemanticsMask::MaskNone), + Acquire = uint32_t(spv::MemorySemanticsMask::Acquire), + Release = uint32_t(spv::MemorySemanticsMask::Release), + AcqRel = uint32_t(spv::MemorySemanticsMask::AcquireRelease), + SeqCst = uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent), + Uniform = uint32_t(spv::MemorySemanticsMask::UniformMemory), + Subgroup = uint32_t(spv::MemorySemanticsMask::SubgroupMemory), + Workgroup = uint32_t(spv::MemorySemanticsMask::WorkgroupMemory), + CrossWorkgroup = uint32_t(spv::MemorySemanticsMask::CrossWorkgroupMemory), + AtomicCounter = uint32_t(spv::MemorySemanticsMask::AtomicCounterMemory), + Image = uint32_t(spv::MemorySemanticsMask::ImageMemory), + Output = uint32_t(spv::MemorySemanticsMask::OutputMemory), + Available = uint32_t(spv::MemorySemanticsMask::MakeAvailable), + Visible = uint32_t(spv::MemorySemanticsMask::MakeVisible), + Volatile = uint32_t(spv::MemorySemanticsMask::Volatile) +}; + +struct TestResult { + explicit TestResult(spv_result_t in_result = SPV_SUCCESS, + const char* in_vuid = nullptr, + const char* in_error = nullptr) + : result(in_result), vuid(in_vuid), error(in_error) {} + spv_result_t result; + const char* vuid; + const char* error; +}; + +template +ParamGenerator ValuesInExcept(const T* items, const size_t count, + const Ts... skip) { + std::vector filtered; + std::initializer_list excluded = {skip...}; + std::copy_if(items, items + count, std::back_inserter(filtered), + [&excluded](const T& value) { + return std::all_of( + excluded.begin(), excluded.end(), + [&value](const T& other) { return value != other; }); + }); + return ValuesIn(filtered); +} + +std::string GenerateInstruction(const Operand operand) { + switch (operand) { + case OpMemoryBarrier: + return "OpMemoryBarrier %scope %semantics"; + case OpControlBarrier: + return "OpControlBarrier %uint_2 %scope %semantics"; + case OpAtomicLoad: + return "%result = OpAtomicLoad %uint %var %scope %semantics"; + case OpAtomicStore: + return "OpAtomicStore %var %scope %semantics %uint_1"; + case OpAtomicExchange: + return "%result = OpAtomicExchange %uint %var %scope %semantics %uint_1"; + case OpAtomicCompareExchangeEqual: + return "%result = OpAtomicCompareExchange %uint %var %scope %semantics " + "%semantics_min %uint_1 %uint_0"; + case OpAtomicCompareExchangeUnequal: + return "%result = OpAtomicCompareExchange %uint %var %scope " + "%semantics_max %semantics %uint_1 %uint_0"; + case OpAtomicIIncrement: + return "%result = OpAtomicIIncrement %uint %var %scope %semantics"; + case OpAtomicIDecrement: + return "%result = OpAtomicIDecrement %uint %var %scope %semantics"; + case OpAtomicIAdd: + return "%result = OpAtomicIAdd %uint %var %scope %semantics %uint_1"; + case OpAtomicISub: + return "%result = OpAtomicISub %uint %var %scope %semantics %uint_1"; + case OpAtomicSMin: + return "%result = OpAtomicSMin %uint %var %scope %semantics %uint_1"; + case OpAtomicUMin: + return "%result = OpAtomicUMin %uint %var %scope %semantics %uint_1"; + case OpAtomicSMax: + return "%result = OpAtomicSMax %uint %var %scope %semantics %uint_1"; + case OpAtomicUMax: + return "%result = OpAtomicUMax %uint %var %scope %semantics %uint_1"; + case OpAtomicAnd: + return "%result = OpAtomicAnd %uint %var %scope %semantics %uint_1"; + case OpAtomicOr: + return "%result = OpAtomicOr %uint %var %scope %semantics %uint_1"; + case OpAtomicXor: + return "%result = OpAtomicXor %uint %var %scope %semantics %uint_1"; + default: + return ""; + } +} + +std::string GenerateVulkanCode(const std::string instruction, + const uint32_t semantics, + const uint32_t semantics2 = 0) { + std::ostringstream ss; + ss << R"( +OpCapability Shader +OpCapability VulkanMemoryModel +OpExtension "SPV_KHR_vulkan_memory_model" +OpMemoryModel Logical Vulkan +OpEntryPoint GLCompute %main "main" %var +OpExecutionMode %main LocalSize 32 1 1 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%func = OpTypeFunction %void +%uint_ptr = OpTypePointer Workgroup %uint +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_4 = OpConstant %uint 4 +%scope = OpConstant %uint 5 +%semantics = OpConstant %uint )" + << semantics << R"( +%semantics2 = OpConstant %uint )" + << semantics2 << R"( +%semantics_min = OpConstant %uint )" + << (semantics & Volatile) << R"( +%semantics_max = OpConstant %uint )" + << (32712 | (semantics & Volatile)) << R"( +%var = OpVariable %uint_ptr Workgroup +%main = OpFunction %void None %func +%label = OpLabel +)" << instruction + << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +using VulkanMemorySemantics = + spvtest::ValidateBase>; +using VulkanUnequalMemorySemantics = spvtest::ValidateBase< + std::tuple>; + +INSTANTIATE_TEST_SUITE_P( + ErrorMultipleMemoryOrderBits, VulkanMemorySemantics, + Combine( + Values(Acquire | Release, Acquire | AcqRel, Release | AcqRel, + Acquire | SeqCst, Release | SeqCst, AcqRel | SeqCst), + Values(None, Uniform | Workgroup | Image | Output), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesIn(Operands), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10865", + "Memory Semantics must have at most one non-relaxed memory order " + "bit set")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorSequentiallyConsistentMemoryOrder, VulkanMemorySemantics, + Combine( + Values(SeqCst), Values(None, Uniform | Workgroup | Image | Output), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesIn(Operands), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10866", + "Memory Semantics with SequentiallyConsistent memory order must " + "not be used in the Vulkan API")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorAtomicStoreWithAcquireMemoryOrder, VulkanMemorySemantics, + Combine(Values(Acquire, AcqRel), + Values(None, Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Visible, Available, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpAtomicStore), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10867", + "MemorySemantics must not use Acquire or AcquireRelease " + "memory order with AtomicStore")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorAtomicLoadWithReleaseMemoryOrder, VulkanMemorySemantics, + Combine(Values(Release, AcqRel), + Values(None, Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpAtomicLoad), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10868", + "MemorySemantics must not use Release or AcquireRelease " + "memory order with AtomicLoad")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMemoryBarrierWithRelaxedMemoryOrder, VulkanMemorySemantics, + Combine(Values(None), + Values(None, Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpMemoryBarrier), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10869", + "MemorySemantics must not use Relaxed memory order with " + "MemoryBarrier")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorNonRelaxedSemanticsWithoutStorageClass, VulkanMemorySemantics, + Combine(Values(Acquire, Release, AcqRel), Values(None), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpAtomicLoad, + OpAtomicStore), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10870", + "Memory Semantics with a non-relaxed memory order (Acquire, " + "Release, or AcquireRelease) must have at least one " + "Vulkan-supported storage class semantics bit set " + "(UniformMemory, WorkgroupMemory, ImageMemory, " + "or OutputMemory)")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorNonRelaxedSemanticsWithoutStorageClassLoad, VulkanMemorySemantics, + Combine(Values(Acquire), Values(None), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpAtomicLoad), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10870", + "Memory Semantics with a non-relaxed memory order (Acquire, " + "Release, or AcquireRelease) must have at least one " + "Vulkan-supported storage class semantics bit set " + "(UniformMemory, WorkgroupMemory, ImageMemory, or " + "OutputMemory)")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorNonRelaxedSemanticsWithoutStorageClassStore, VulkanMemorySemantics, + Combine(Values(Release), Values(None), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpAtomicStore), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10870", + "Memory Semantics with a non-relaxed memory order (Acquire, " + "Release, or AcquireRelease) must have at least one " + "Vulkan-supported storage class semantics bit set " + "(UniformMemory, WorkgroupMemory, ImageMemory, or " + "OutputMemory)")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorRelaxedSemanticsWithStorageClass, VulkanMemorySemantics, + Combine( + Values(None), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpMemoryBarrier), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10871", + "Memory Semantics with at least one Vulkan-supported storage class " + "semantics bit set (UniformMemory, WorkgroupMemory, ImageMemory, " + "or OutputMemory) must use a non-relaxed memory order (Acquire, " + "Release, or AcquireRelease)")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMakeAvailableWithRelaxedMemoryOrder, VulkanMemorySemantics, + Combine(Values(None), Values(None), Values(Available, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpMemoryBarrier), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10872", + "Memory Semantics with MakeAvailable bit set must use Release " + "or AcquireRelease memory order")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMakeAvailableWithAcquireMemoryOrder, VulkanMemorySemantics, + Combine(Values(Acquire), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(Available, Available | Visible), Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpAtomicStore), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10872", + "Memory Semantics with MakeAvailable bit set must use Release " + "or AcquireRelease memory order")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMakeVisibleWithRelaxedMemoryOrder, VulkanMemorySemantics, + Combine(Values(None), Values(None), Values(Visible), Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpMemoryBarrier), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10873", + "Memory Semantics with MakeVisible bit set must use Acquire " + "or AcquireRelease memory order")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMakeVisibleWithReleaseMemoryOrder, VulkanMemorySemantics, + Combine(Values(Release), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(Visible, Available | Visible), Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpAtomicLoad), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10873", + "Memory Semantics with MakeVisible bit set must use Acquire " + "or AcquireRelease memory order")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorVolatileBarrierWithRelaxedSemantics, VulkanMemorySemantics, + Combine(Values(None), Values(None), Values(None), Values(Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpControlBarrier), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10874", + "Memory Semantics with Volatile bit set must not be used with " + "barrier instructions")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorVolatileBarrierWithNonRelaxedSemantics, VulkanMemorySemantics, + Combine(Values(Acquire, Acquire | Visible, Release, Release | Available, + AcqRel, AcqRel | Visible, AcqRel | Available, + AcqRel | Available | Visible), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None), Values(Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpControlBarrier, OpMemoryBarrier), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-MemorySemantics-10874", + "Memory Semantics with Volatile bit set must not be used with " + "barrier instructions")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorCompareExchangeUnequalSemanticsWithRelease, VulkanMemorySemantics, + Combine(Values(Release, AcqRel, AcqRel | Visible), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Available), Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpAtomicCompareExchangeUnequal), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-UnequalMemorySemantics-10875", + "AtomicCompareExchange Unequal Memory Semantics must not use " + "Release or AcquireRelease memory order")))); + +INSTANTIATE_TEST_SUITE_P( + SuccessAtomicsRelaxed, VulkanMemorySemantics, + Combine(Values(None), Values(None), Values(None), Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpMemoryBarrier, + OpControlBarrier), + Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + SuccessAtomicsAcquire, VulkanMemorySemantics, + Combine(Values(Acquire), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Visible), Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpMemoryBarrier, + OpControlBarrier, OpAtomicStore), + Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + SuccessAtomicsRelease, VulkanMemorySemantics, + Combine(Values(Release), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Available), Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpMemoryBarrier, + OpControlBarrier, OpAtomicLoad, + OpAtomicCompareExchangeUnequal), + Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + SuccessAtomicsAcqRel, VulkanMemorySemantics, + Combine(Values(AcqRel), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Available, Visible, Available | Visible), + Values(None, Volatile), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + ValuesInExcept(Operands, OperandsCount, OpMemoryBarrier, + OpControlBarrier, OpAtomicLoad, OpAtomicStore, + OpAtomicCompareExchangeUnequal), + Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + SuccessBarriersRelaxed, VulkanMemorySemantics, + Combine(Values(None), Values(None), Values(None), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpControlBarrier), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + SuccessBarriersNonRelaxed, VulkanMemorySemantics, + Combine(Values(Acquire, Acquire | Visible, Release, Release | Available, + AcqRel, AcqRel | Available, AcqRel | Visible, + AcqRel | Available | Visible), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(OpControlBarrier, OpMemoryBarrier), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMemoryOrderTooWeak, VulkanUnequalMemorySemantics, + Combine(Values(None), Values(None), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(Acquire), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None, Visible), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(true, false), Values(None, Volatile), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-UnequalMemorySemantics-10876", + "AtomicCompareExchange Unequal Memory Semantics must not use a " + "stronger memory order than the corresponding Equal Memory " + "Semantics")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMissingStorageClassSemanticsFlags, VulkanUnequalMemorySemantics, + Combine( + Values(Acquire, Acquire | Visible, Release, Release | Available, AcqRel, + AcqRel | Visible, AcqRel | Available, + AcqRel | Available | Visible), + Values(Uniform | Workgroup), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(Acquire), Values(Uniform | Image, Output), Values(None, Visible), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(true, false), Values(None, Volatile), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-UnequalMemorySemantics-10877", + "AtomicCompareExchange Unequal Memory Semantics must not have any " + "Vulkan-supported storage class semantics bit set (UniformMemory, " + "WorkgroupMemory, ImageMemory, or OutputMemory) unless this bit is " + "also set in the corresponding Equal Memory Semantics")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMissingMakeVisibleFlag, VulkanUnequalMemorySemantics, + Combine(Values(Acquire, Release, Release | Available, AcqRel, + AcqRel | Available), + Values(Uniform | Workgroup | Image | Output), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(Acquire), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(Visible), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(true, false), Values(None, Volatile), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-UnequalMemorySemantics-10878", + "AtomicCompareExchange Unequal Memory Semantics must not have " + "MakeVisible bit set unless this bit is also set in the " + "corresponding Equal Memory Semantics")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMismatchingVolatileFlagsRelaxedAndRelaxed, + VulkanUnequalMemorySemantics, + Combine( + Values(None), Values(None), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), Values(None), + Values(None), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), Values(false), + Values(None, Volatile), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-UnequalMemorySemantics-10879", + "AtomicCompareExchange Unequal Memory Semantics must have Volatile " + "bit set if and only if this bit is also set in the corresponding " + "Equal Memory Semantics")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMismatchingVolatileFlagsNonRelaxedAndRelaxed, + VulkanUnequalMemorySemantics, + Combine( + Values(Acquire, Acquire | Visible, Release, Release | Available, AcqRel, + AcqRel | Visible, AcqRel | Available, + AcqRel | Available | Visible), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None), Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(None), Values(None), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), Values(false), + Values(None, Volatile), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-UnequalMemorySemantics-10879", + "AtomicCompareExchange Unequal Memory Semantics must have Volatile " + "bit set if and only if this bit is also set in the corresponding " + "Equal Memory Semantics")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMismatchingVolatileFlagsNonRelaxedAndAcquire, + VulkanUnequalMemorySemantics, + Combine( + Values(Acquire, Acquire | Visible, Release, Release | Available, AcqRel, + AcqRel | Visible, AcqRel | Available, + AcqRel | Available | Visible), + Values(Uniform | Workgroup | Image | Output), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(Acquire), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None), Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(false), Values(None, Volatile), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-UnequalMemorySemantics-10879", + "AtomicCompareExchange Unequal Memory Semantics must have Volatile " + "bit set if and only if this bit is also set in the corresponding " + "Equal Memory Semantics")))); + +INSTANTIATE_TEST_SUITE_P( + ErrorMismatchingVolatileFlagsNonRelaxedAndAcquireVisible, + VulkanUnequalMemorySemantics, + Combine( + Values(Acquire, AcqRel, AcqRel | Available), + Values(Uniform | Workgroup | Image | Output), Values(Visible), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(Acquire), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(Visible), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), Values(false), + Values(None, Volatile), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "VUID-StandaloneSpirv-UnequalMemorySemantics-10879", + "AtomicCompareExchange Unequal Memory Semantics must have Volatile " + "bit set if and only if this bit is also set in the corresponding " + "Equal Memory Semantics")))); + +INSTANTIATE_TEST_SUITE_P( + SuccessNonRelaxedAndAcquire, VulkanUnequalMemorySemantics, + Combine(Values(Acquire, Acquire | Visible, Release, Release | Available, + AcqRel, AcqRel | Visible, AcqRel | Available, + AcqRel | Available | Visible), + Values(Uniform | Workgroup | Image | Output), Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(Acquire), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(None), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(true), Values(None, Volatile), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + SuccessNonRelaxedAndAcquireVisible, VulkanUnequalMemorySemantics, + Combine(Values(Acquire, AcqRel, AcqRel | Available), + Values(Uniform | Workgroup | Image | Output), Values(Visible), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(Acquire), + Values(Uniform, Workgroup, Image, Output, + Uniform | Workgroup | Image | Output), + Values(Visible), + Values(None, Subgroup | CrossWorkgroup | AtomicCounter), + Values(true), Values(None, Volatile), Values(TestResult()))); + +TEST_P(VulkanMemorySemantics, Case) { + const uint32_t semantics = std::get<0>(GetParam()) | std::get<1>(GetParam()) | + std::get<2>(GetParam()) | std::get<3>(GetParam()) | + std::get<4>(GetParam()); + const Operand operand = std::get<5>(GetParam()); + const TestResult& result = std::get<6>(GetParam()); + const std::string instruction = GenerateInstruction(operand); + + CompileSuccessfully(GenerateVulkanCode(instruction, semantics), + SPV_ENV_VULKAN_1_4); + ASSERT_EQ(result.result, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + if (result.vuid) { + EXPECT_THAT(getDiagnosticString(), AnyVUID(result.vuid)); + } + if (result.error) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(result.error)); + } +} + +TEST_P(VulkanUnequalMemorySemantics, Case) { + const uint32_t equal_volatile = std::get<9>(GetParam()); + const uint32_t unequal_volatile = + std::get<8>(GetParam()) ? equal_volatile : Volatile ^ equal_volatile; + const uint32_t equal = std::get<0>(GetParam()) | std::get<1>(GetParam()) | + std::get<2>(GetParam()) | std::get<3>(GetParam()) | + equal_volatile; + const uint32_t unequal = std::get<4>(GetParam()) | std::get<5>(GetParam()) | + std::get<6>(GetParam()) | std::get<7>(GetParam()) | + unequal_volatile; + const TestResult& result = std::get<10>(GetParam()); + const std::string instruction = + "%result = OpAtomicCompareExchange %uint %var %scope %semantics " + "%semantics2 %uint_1 %uint_0"; + + CompileSuccessfully(GenerateVulkanCode(instruction, equal, unequal), + SPV_ENV_VULKAN_1_4); + ASSERT_EQ(result.result, ValidateInstructions(SPV_ENV_VULKAN_1_4)); + if (result.vuid) { + EXPECT_THAT(getDiagnosticString(), AnyVUID(result.vuid)); + } + if (result.error) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(result.error)); + } +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_memory_test.cpp b/third_party/spirv-tools/test/val/val_memory_test.cpp index 15b1663d15..1ee428d313 100644 --- a/third_party/spirv-tools/test/val/val_memory_test.cpp +++ b/third_party/spirv-tools/test/val/val_memory_test.cpp @@ -599,10 +599,39 @@ TEST_F(ValidateMemory, ArrayLenResultNotIntType) { getDiagnosticString(), HasSubstr( "The Result Type of OpArrayLength '10[%10]' must be OpTypeInt " - "with width 32 and signedness 0.\n %10 = OpArrayLength %float %9 " + "with width 32 or 64 and signedness 0.\n %10 = OpArrayLength %float " + "%9 " "0\n")); } +TEST_F(ValidateMemory, ArrayLenResultUnsizedPointer) { + std::string spirv = R"( + OpCapability ClipDistance + OpMemoryModel Logical GLSL450 + OpName %65312 "arrayLen" + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %_struct_5 = OpTypeStruct %v2float +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 + %6 = OpVariable %_ptr_Uniform__struct_5 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %2105376 = OpFunction %void None %8 + %8224 = OpLabel + %65312 = OpArrayLength %_ptr_Uniform_v2float %6 538976288 + OpUnreachable + OpFunctionEnd +)"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("The Result Type of OpArrayLength '1[%arrayLen]' must be " + "OpTypeInt with width 32 or 64 and signedness 0.")); +} + TEST_F(ValidateMemory, ArrayLenResultNot32bits) { std::string spirv = R"( OpCapability Shader @@ -632,7 +661,8 @@ TEST_F(ValidateMemory, ArrayLenResultNot32bits) { getDiagnosticString(), HasSubstr( "The Result Type of OpArrayLength '11[%11]' must be OpTypeInt " - "with width 32 and signedness 0.\n %11 = OpArrayLength %ushort %10 " + "with width 32 or 64 and signedness 0.\n %11 = OpArrayLength " + "%ushort %10 " "0\n")); } @@ -664,7 +694,8 @@ TEST_F(ValidateMemory, ArrayLenResultSigned) { getDiagnosticString(), HasSubstr( "The Result Type of OpArrayLength '11[%11]' must be OpTypeInt " - "with width 32 and signedness 0.\n %11 = OpArrayLength %int %10 " + "with width 32 or 64 and signedness 0.\n %11 = OpArrayLength %int " + "%10 " "0\n")); } @@ -1890,7 +1921,6 @@ OpMemoryModel PhysicalStorageBuffer64 GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft OpDecorate %val1 AliasedPointer -%int = OpTypeInt 32 0 %uint64 = OpTypeInt 64 0 %u64_1 = OpConstant %uint64 1 %ptr = OpTypePointer PhysicalStorageBuffer %uint64 @@ -1902,8 +1932,8 @@ OpDecorate %val1 AliasedPointer %val1 = OpVariable %pptr_f Function %val2 = OpLoad %ptr %val1 %val3 = OpLoad %ptr %val1 -OpCopyMemory %val2 %val3 Aligned 4 -OpCopyMemory %val3 %val2 Aligned 4 Aligned 4 +OpCopyMemory %val2 %val3 Aligned 8 +OpCopyMemory %val3 %val2 Aligned 8 Aligned 8 OpReturn OpFunctionEnd )"; @@ -1922,7 +1952,6 @@ OpMemoryModel PhysicalStorageBuffer64 GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft OpDecorate %val1 AliasedPointer -%int = OpTypeInt 32 0 %uint64 = OpTypeInt 64 0 %u64_1 = OpConstant %uint64 1 %ptr = OpTypePointer PhysicalStorageBuffer %uint64 @@ -1934,7 +1963,7 @@ OpDecorate %val1 AliasedPointer %val1 = OpVariable %pptr_f Function %val2 = OpLoad %ptr %val1 %val3 = OpLoad %ptr %val1 -OpCopyMemory %val2 %val3 Volatile Aligned 4 +OpCopyMemory %val2 %val3 Volatile Aligned 8 OpReturn OpFunctionEnd )"; @@ -1958,7 +1987,6 @@ OpMemoryModel PhysicalStorageBuffer64 GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft OpDecorate %val1 AliasedPointer -%int = OpTypeInt 32 0 %uint64 = OpTypeInt 64 0 %u64_1 = OpConstant %uint64 1 %ptr = OpTypePointer PhysicalStorageBuffer %uint64 @@ -1970,7 +1998,7 @@ OpDecorate %val1 AliasedPointer %val1 = OpVariable %pptr_f Function %val2 = OpLoad %ptr %val1 %val3 = OpLoad %ptr %val1 -OpCopyMemory %val2 %val3 Aligned 4 Volatile +OpCopyMemory %val2 %val3 Aligned 8 Volatile OpReturn OpFunctionEnd )"; @@ -1994,7 +2022,6 @@ OpMemoryModel PhysicalStorageBuffer64 GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft OpDecorate %val1 AliasedPointer -%int = OpTypeInt 32 0 %uint64 = OpTypeInt 64 0 %u64_1 = OpConstant %uint64 1 %ptr = OpTypePointer PhysicalStorageBuffer %uint64 @@ -2048,6 +2075,562 @@ OpFunctionEnd HasSubstr("PhysicalStorageBuffer must not be used with OpVariable")); } +TEST_F(ValidateMemory, PSBStoreAlignedOneWithUvec4) { + const std::string body = R"( + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %Ptr Block + OpMemberDecorate %Ptr 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_Ptr PhysicalStorageBuffer + %SSBO = OpTypeStruct %_ptr_PhysicalStorageBuffer_Ptr + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %Ptr = OpTypeStruct %v4uint +%_ptr_PhysicalStorageBuffer_Ptr = OpTypePointer PhysicalStorageBuffer %Ptr +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_Ptr = OpTypePointer StorageBuffer %_ptr_PhysicalStorageBuffer_Ptr + %uint_0 = OpConstant %uint 0 + %20 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 +%_ptr_PhysicalStorageBuffer_v4uint = OpTypePointer PhysicalStorageBuffer %v4uint + %main = OpFunction %void None %4 + %6 = OpLabel + %17 = OpAccessChain %_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_Ptr %_ %int_0 + %18 = OpLoad %_ptr_PhysicalStorageBuffer_Ptr %17 + %22 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4uint %18 %int_0 + OpStore %22 %20 Aligned 1 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_2); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory accesses Aligned operand value 1 is too small, " + "the largest scalar type is 4 bytes")); +} + +TEST_F(ValidateMemory, PSBStoreAlignedOneWithUint32) { + const std::string body = R"( + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %B Block + OpMemberDecorate %B 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_B PhysicalStorageBuffer + %SSBO = OpTypeStruct %_ptr_PhysicalStorageBuffer_B + %uint = OpTypeInt 32 0 + %B = OpTypeStruct %uint +%_ptr_PhysicalStorageBuffer_B = OpTypePointer PhysicalStorageBuffer %B +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_B = OpTypePointer StorageBuffer %_ptr_PhysicalStorageBuffer_B + %uint_0 = OpConstant %uint 0 +%_ptr_PhysicalStorageBuffer_uint = OpTypePointer PhysicalStorageBuffer %uint + %main = OpFunction %void None %4 + %6 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_B %_ %int_0 + %17 = OpLoad %_ptr_PhysicalStorageBuffer_B %16 + %20 = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %17 %int_0 + OpStore %20 %uint_0 Aligned 2 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_2); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory accesses Aligned operand value 2 is too small, " + "the largest scalar type is 4 bytes")); +} + +// https://github.com/KhronosGroup/glslang/issues/4024 +TEST_F(ValidateMemory, PSBStoreAlignedPointerNot8) { + const std::string body = R"( + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %B Block + OpMemberDecorate %B 0 Offset 0 + OpDecorate %A Block + OpMemberDecorate %A 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_B PhysicalStorageBuffer + %SSBO = OpTypeStruct %_ptr_PhysicalStorageBuffer_B + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_A PhysicalStorageBuffer + %B = OpTypeStruct %_ptr_PhysicalStorageBuffer_A + %uint = OpTypeInt 32 0 + %A = OpTypeStruct %uint +%_ptr_PhysicalStorageBuffer_A = OpTypePointer PhysicalStorageBuffer %A +%_ptr_PhysicalStorageBuffer_B = OpTypePointer PhysicalStorageBuffer %B +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_B = OpTypePointer StorageBuffer %_ptr_PhysicalStorageBuffer_B +%_ptr_PhysicalStorageBuffer__ptr_PhysicalStorageBuffer_A = OpTypePointer PhysicalStorageBuffer %_ptr_PhysicalStorageBuffer_A + %uint_0 = OpConstant %uint 0 +%_ptr_PhysicalStorageBuffer_uint = OpTypePointer PhysicalStorageBuffer %uint + %main = OpFunction %void None %4 + %6 = OpLabel + %18 = OpAccessChain %_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_B %_ %int_0 + %19 = OpLoad %_ptr_PhysicalStorageBuffer_B %18 + %21 = OpAccessChain %_ptr_PhysicalStorageBuffer__ptr_PhysicalStorageBuffer_A %19 %int_0 + %22 = OpLoad %_ptr_PhysicalStorageBuffer_A %21 Aligned 4 + %25 = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %22 %int_0 + OpStore %25 %uint_0 Aligned 4 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_2); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory accesses Aligned operand value 4 is too small, " + "the largest scalar type is 8 bytes")); +} + +// https://godbolt.org/z/sbGv6a7os +TEST_F(ValidateMemory, PSBStoreAlignedStructCopyWithDeepDouble) { + const std::string body = R"( + OpCapability Shader + OpCapability Float64 + OpCapability PhysicalStorageBufferAddresses + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %A 0 Offset 0 + OpMemberDecorate %A 1 Offset 8 + OpMemberDecorate %B 0 Offset 0 + OpMemberDecorate %B 1 Offset 16 + OpMemberDecorate %C 0 Offset 0 + OpMemberDecorate %C 1 Offset 32 + OpDecorate %Ptr Block + OpMemberDecorate %Ptr 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_Ptr PhysicalStorageBuffer + %SSBO = OpTypeStruct %_ptr_PhysicalStorageBuffer_Ptr + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %uint = OpTypeInt 32 0 + %double = OpTypeFloat 64 + %A = OpTypeStruct %uint %double + %B = OpTypeStruct %v3float %A + %C = OpTypeStruct %B %uint + %Ptr = OpTypeStruct %C +%_ptr_PhysicalStorageBuffer_Ptr = OpTypePointer PhysicalStorageBuffer %Ptr +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_Ptr = OpTypePointer StorageBuffer %_ptr_PhysicalStorageBuffer_Ptr + %A_0 = OpTypeStruct %uint %double + %B_0 = OpTypeStruct %v3float %A_0 + %C_0 = OpTypeStruct %B_0 %uint +%_ptr_Function_C_0 = OpTypePointer Function %C_0 +%_ptr_PhysicalStorageBuffer_C = OpTypePointer PhysicalStorageBuffer %C + %main = OpFunction %void None %4 + %6 = OpLabel + %newC = OpVariable %_ptr_Function_C_0 Function + %22 = OpAccessChain %_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_Ptr %_ %int_0 + %23 = OpLoad %_ptr_PhysicalStorageBuffer_Ptr %22 + %29 = OpLoad %C_0 %newC + %31 = OpAccessChain %_ptr_PhysicalStorageBuffer_C %23 %int_0 + %32 = OpCopyLogical %C %29 + OpStore %31 %32 Aligned 4 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_2); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory accesses Aligned operand value 4 is too small, " + "the largest scalar type is 8 bytes")); +} + +TEST_F(ValidateMemory, PSBStoreAlignedPtrAccessChain) { + const std::string body = R"( + OpCapability PhysicalStorageBufferAddresses + OpCapability Int64 + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + OpExtension "SPV_KHR_physical_storage_buffer" + %2 = OpExtInstImport "NonSemantic.Shader.DebugInfo.100" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %computeMain "main" %globalParams + OpExecutionMode %computeMain LocalSize 1 1 1 + OpDecorate %_ptr_PhysicalStorageBuffer_ulong ArrayStride 8 + OpDecorate %GlobalParams_std140 Block + OpMemberDecorate %GlobalParams_std140 0 Offset 0 + OpDecorate %globalParams Binding 0 + OpDecorate %globalParams DescriptorSet 0 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %12 = OpTypeFunction %void + %ulong = OpTypeInt 64 0 +%_ptr_PhysicalStorageBuffer_ulong = OpTypePointer PhysicalStorageBuffer %ulong +%GlobalParams_std140 = OpTypeStruct %_ptr_PhysicalStorageBuffer_ulong +%_ptr_Uniform_GlobalParams_std140 = OpTypePointer Uniform %GlobalParams_std140 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform__ptr_PhysicalStorageBuffer_ulong = OpTypePointer Uniform %_ptr_PhysicalStorageBuffer_ulong + %ulong_1 = OpConstant %ulong 1 +%globalParams = OpVariable %_ptr_Uniform_GlobalParams_std140 Uniform +%computeMain = OpFunction %void None %12 + %13 = OpLabel + %36 = OpInBoundsAccessChain %_ptr_Uniform__ptr_PhysicalStorageBuffer_ulong %globalParams %int_0 + %37 = OpLoad %_ptr_PhysicalStorageBuffer_ulong %36 + %38 = OpPtrAccessChain %_ptr_PhysicalStorageBuffer_ulong %37 %int_0 + OpStore %38 %ulong_1 Aligned 4 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_2); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory accesses Aligned operand value 4 is too small, " + "the largest scalar type is 8 bytes")); +} + +TEST_F(ValidateMemory, PSBStoreAlignedUntypedStorageBuffer) { + const std::string body = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %B Block + OpMemberDecorate %B 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_B PhysicalStorageBuffer + %SSBO = OpTypeStruct %_ptr_PhysicalStorageBuffer_B + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %B = OpTypeStruct %uint +%_ptr_PhysicalStorageBuffer_B = OpTypePointer PhysicalStorageBuffer %B +%_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_B = OpTypePointer StorageBuffer %_ptr_PhysicalStorageBuffer_B +%untyped_ptr = OpTypeUntypedPointerKHR StorageBuffer + %_ = OpUntypedVariableKHR %untyped_ptr StorageBuffer %SSBO +%_ptr_PhysicalStorageBuffer_uint = OpTypePointer PhysicalStorageBuffer %uint + %main = OpFunction %void None %4 + %6 = OpLabel + %16 = OpUntypedAccessChainKHR %untyped_ptr %SSBO %_ %int_0 + %17 = OpLoad %_ptr_PhysicalStorageBuffer_B %16 + %20 = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %17 %int_0 + OpStore %20 %uint_0 Aligned 2 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_2); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory accesses Aligned operand value 2 is too small, " + "the largest scalar type is 4 bytes")); +} + +TEST_F(ValidateMemory, PSBStoreAlignedUntypedPhysicalStorageBuffer) { + const std::string body = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %B Block + OpMemberDecorate %B 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_B PhysicalStorageBuffer + %SSBO = OpTypeStruct %_ptr_PhysicalStorageBuffer_B + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %B = OpTypeStruct %uint +%_ptr_PhysicalStorageBuffer_B = OpTypePointer PhysicalStorageBuffer %B +%_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_B = OpTypePointer StorageBuffer %_ptr_PhysicalStorageBuffer_B +%untyped_ptr = OpTypeUntypedPointerKHR StorageBuffer + %_ = OpUntypedVariableKHR %untyped_ptr StorageBuffer %SSBO +%_ptr_PhysicalStorageBuffer_uint = OpTypePointer PhysicalStorageBuffer %uint + %main = OpFunction %void None %4 + %6 = OpLabel + %16 = OpUntypedAccessChainKHR %untyped_ptr %SSBO %_ %int_0 + %17 = OpLoad %_ptr_PhysicalStorageBuffer_B %16 + %20 = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %17 %int_0 + OpStore %20 %uint_0 Aligned 2 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_2); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory accesses Aligned operand value 2 is too small, " + "the largest scalar type is 4 bytes")); +} + +TEST_F(ValidateMemory, PSBStoreAlignedVariousTypeSuccess) { + const std::string body = R"( + OpCapability Shader + OpCapability Float64 + OpCapability Int8 + OpCapability StorageBuffer8BitAccess + OpCapability PhysicalStorageBufferAddresses + %2 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %SSBO Block + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %Ptr Block + OpMemberDecorate %Ptr 0 Offset 0 + OpMemberDecorate %Ptr 1 Offset 4 + OpMemberDecorate %Ptr 2 Offset 8 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_Ptr PhysicalStorageBuffer + %SSBO = OpTypeStruct %_ptr_PhysicalStorageBuffer_Ptr + %uchar = OpTypeInt 8 0 + %uint = OpTypeInt 32 0 + %double = OpTypeFloat 64 + %Ptr = OpTypeStruct %uchar %uint %double +%_ptr_PhysicalStorageBuffer_Ptr = OpTypePointer PhysicalStorageBuffer %Ptr +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_Ptr = OpTypePointer StorageBuffer %_ptr_PhysicalStorageBuffer_Ptr + %uchar_0 = OpConstant %uchar 0 +%_ptr_PhysicalStorageBuffer_uchar = OpTypePointer PhysicalStorageBuffer %uchar + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 +%_ptr_PhysicalStorageBuffer_uint = OpTypePointer PhysicalStorageBuffer %uint + %int_2 = OpConstant %int 2 + %double_0 = OpConstant %double 0 +%_ptr_PhysicalStorageBuffer_double = OpTypePointer PhysicalStorageBuffer %double + %main = OpFunction %void None %4 + %6 = OpLabel + %18 = OpAccessChain %_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_Ptr %_ %int_0 + %19 = OpLoad %_ptr_PhysicalStorageBuffer_Ptr %18 + %22 = OpAccessChain %_ptr_PhysicalStorageBuffer_uchar %19 %int_0 + OpStore %22 %uchar_0 Aligned 1 + %23 = OpAccessChain %_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_Ptr %_ %int_0 + %24 = OpLoad %_ptr_PhysicalStorageBuffer_Ptr %23 + %28 = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %24 %int_1 + OpStore %28 %uint_0 Aligned 4 + %29 = OpAccessChain %_ptr_StorageBuffer__ptr_PhysicalStorageBuffer_Ptr %_ %int_0 + %30 = OpLoad %_ptr_PhysicalStorageBuffer_Ptr %29 + %34 = OpAccessChain %_ptr_PhysicalStorageBuffer_double %30 %int_2 + OpStore %34 %double_0 Aligned 8 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_2); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +// https://github.com/KhronosGroup/SPIRV-Tools/issues/6322 +TEST_F(ValidateMemory, PSBStoreAlignedUntypedBitcaseSuccess) { + const std::string body = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpCapability VulkanMemoryModel +OpCapability VulkanMemoryModelDeviceScopeKHR +OpCapability Int8 +OpCapability PhysicalStorageBufferAddresses +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpExtension "SPV_KHR_untyped_pointers" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_KHR_physical_storage_buffer" +OpMemoryModel PhysicalStorageBuffer64 Vulkan +OpEntryPoint GLCompute %main "main" %id +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %id BuiltIn GlobalInvocationId +OpDecorate %untyped_phys_ptr ArrayStride 1 +OpDecorate %data_buffer Block +OpMemberDecorate %data_buffer 0 Offset 0 +OpDecorate %phys_ptrs_struct Block +OpMemberDecorate %phys_ptrs_struct 0 Offset 0 +OpMemberDecorate %phys_ptrs_struct 1 Offset 8 +OpDecorate %all_data_var DescriptorSet 0 +OpDecorate %all_data_var Binding 0 + +%uint32 = OpTypeInt 32 0 +%void = OpTypeVoid +%uint8 = OpTypeInt 8 0 +%vec3_uint32 = OpTypeVector %uint32 3 +%void_func = OpTypeFunction %void +%c_uint32_0 = OpConstant %uint32 0 +%c_uint32_1 = OpConstant %uint32 1 +%c_uint32_32 = OpConstant %uint32 32 + +%uint32_input_ptr = OpTypePointer Input %uint32 +%vec3_uint32_input_ptr = OpTypePointer Input %vec3_uint32 +%data_buffer = OpTypeStruct %uint8 +%untyped_phys_ptr = OpTypeUntypedPointerKHR PhysicalStorageBuffer +%uint8_phys_ptr = OpTypePointer PhysicalStorageBuffer %uint8 +%data_buffer_phys_ptr = OpTypePointer PhysicalStorageBuffer %data_buffer +%data_buffer_phys_ptr_ptr = OpTypePointer StorageBuffer %data_buffer_phys_ptr +%phys_ptrs_struct = OpTypeStruct %data_buffer_phys_ptr %data_buffer_phys_ptr +%phys_ptrs_struct_ptr = OpTypePointer StorageBuffer %phys_ptrs_struct +%all_data_var = OpVariable %phys_ptrs_struct_ptr StorageBuffer +%id = OpVariable %vec3_uint32_input_ptr Input +%main = OpFunction %void None %void_func +%label_main = OpLabel +%input_ptr = OpAccessChain %data_buffer_phys_ptr_ptr %all_data_var %c_uint32_0 +%input = OpLoad %data_buffer_phys_ptr %input_ptr +%input_loc = OpAccessChain %uint8_phys_ptr %input %c_uint32_0 +%output_ptr = OpAccessChain %data_buffer_phys_ptr_ptr %all_data_var %c_uint32_1 +%output = OpLoad %data_buffer_phys_ptr %output_ptr +%output_loc = OpUntypedAccessChainKHR %untyped_phys_ptr %data_buffer %output %c_uint32_0 +%bitcasted = OpBitcast %untyped_phys_ptr %input_loc +%bitcasted_val = OpLoad %uint8 %bitcasted Aligned 1 +OpStore %output_loc %bitcasted_val Aligned 1 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +// https://github.com/KhronosGroup/SPIRV-Tools/issues/6322 +TEST_F(ValidateMemory, PSBStoreAlignedUntypedBitcase) { + const std::string body = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpCapability VulkanMemoryModel +OpCapability VulkanMemoryModelDeviceScopeKHR +OpCapability Int16 +OpCapability PhysicalStorageBufferAddresses +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpExtension "SPV_KHR_untyped_pointers" +OpExtension "SPV_KHR_vulkan_memory_model" +OpExtension "SPV_KHR_physical_storage_buffer" +OpMemoryModel PhysicalStorageBuffer64 Vulkan +OpEntryPoint GLCompute %main "main" %id +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %id BuiltIn GlobalInvocationId +OpDecorate %untyped_phys_ptr ArrayStride 1 +OpDecorate %data_buffer Block +OpMemberDecorate %data_buffer 0 Offset 0 +OpDecorate %phys_ptrs_struct Block +OpMemberDecorate %phys_ptrs_struct 0 Offset 0 +OpMemberDecorate %phys_ptrs_struct 1 Offset 8 +OpDecorate %all_data_var DescriptorSet 0 +OpDecorate %all_data_var Binding 0 + +%uint32 = OpTypeInt 32 0 +%void = OpTypeVoid +%uint16 = OpTypeInt 16 0 +%vec3_uint32 = OpTypeVector %uint32 3 +%void_func = OpTypeFunction %void +%c_uint32_0 = OpConstant %uint32 0 +%c_uint32_1 = OpConstant %uint32 1 +%c_uint32_32 = OpConstant %uint32 32 + +%uint32_input_ptr = OpTypePointer Input %uint32 +%vec3_uint32_input_ptr = OpTypePointer Input %vec3_uint32 +%data_buffer = OpTypeStruct %uint16 +%untyped_phys_ptr = OpTypeUntypedPointerKHR PhysicalStorageBuffer +%uint16_phys_ptr = OpTypePointer PhysicalStorageBuffer %uint16 +%data_buffer_phys_ptr = OpTypePointer PhysicalStorageBuffer %data_buffer +%data_buffer_phys_ptr_ptr = OpTypePointer StorageBuffer %data_buffer_phys_ptr +%phys_ptrs_struct = OpTypeStruct %data_buffer_phys_ptr %data_buffer_phys_ptr +%phys_ptrs_struct_ptr = OpTypePointer StorageBuffer %phys_ptrs_struct +%all_data_var = OpVariable %phys_ptrs_struct_ptr StorageBuffer +%id = OpVariable %vec3_uint32_input_ptr Input +%main = OpFunction %void None %void_func +%label_main = OpLabel +%input_ptr = OpAccessChain %data_buffer_phys_ptr_ptr %all_data_var %c_uint32_0 +%input = OpLoad %data_buffer_phys_ptr %input_ptr +%input_loc = OpAccessChain %uint16_phys_ptr %input %c_uint32_0 +%output_ptr = OpAccessChain %data_buffer_phys_ptr_ptr %all_data_var %c_uint32_1 +%output = OpLoad %data_buffer_phys_ptr %output_ptr +%output_loc = OpUntypedAccessChainKHR %untyped_phys_ptr %data_buffer %output %c_uint32_0 +%bitcasted = OpBitcast %untyped_phys_ptr %input_loc +%bitcasted_val = OpLoad %uint16 %bitcasted Aligned 1 +OpStore %output_loc %bitcasted_val Aligned 1 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory accesses Aligned operand value 1 is too small, " + "the largest scalar type is 2 bytes")); +} + std::string GenCoopMatLoadStoreShader(const std::string& storeMemoryAccess, const std::string& loadMemoryAccess) { std::string s = R"( @@ -2232,7 +2815,8 @@ OpStore %111 %115 %116 = OpLoad %71 %111 %121 = OpLoad %6 %60 %122 = OpAccessChain %82 %120 %79 %121 -OpCooperativeMatrixStoreNV %122 %116 %84 %86 )" + storeMemoryAccess + R"( %81 +OpCooperativeMatrixStoreNV %122 %116 %84 %86 )" + + storeMemoryAccess + R"( %81 OpReturn OpFunctionEnd )"; @@ -2414,19 +2998,21 @@ OpFunctionEnd)"; EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } -std::string GenCoopMatLoadStoreShaderKHR(const std::string& storeMemoryAccess, - const std::string& loadMemoryAccess, - unsigned layout = 0, - bool useSpecConstantLayout = false, - bool useStoreStride = true, - bool useLoadStride = true) { +std::string GenCoopMatLoadStoreShaderKHR( + const std::string& storeMemoryAccess, const std::string& loadMemoryAccess, + unsigned layout = 0, bool useSpecConstantLayout = false, + bool useStoreStride = true, bool useLoadStride = true, + bool useConstantStride = true, unsigned stride = 4, unsigned rows = 16, + unsigned cols = 16) { std::string s = R"( OpCapability Shader OpCapability GroupNonUniform OpCapability VulkanMemoryModelKHR OpCapability CooperativeMatrixKHR +OpCapability CooperativeMatrixLayoutsARM OpExtension "SPV_KHR_vulkan_memory_model" OpExtension "SPV_KHR_cooperative_matrix" +OpExtension "SPV_ARM_cooperative_matrix_layouts" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical VulkanKHR OpEntryPoint GLCompute %4 "main" %11 %21 @@ -2466,6 +3052,7 @@ OpDecorate %129 BuiltIn WorkgroupSize %7 = OpTypeVector %6 2 %8 = OpTypePointer Function %7 %10 = OpTypePointer Input %6 +%ptr_uint_Function = OpTypePointer Function %6 %11 = OpVariable %10 Input %13 = OpConstant %6 2 %19 = OpTypeVector %6 3 @@ -2475,7 +3062,8 @@ OpDecorate %129 BuiltIn WorkgroupSize %31 = OpTypePointer Function %6 %33 = OpConstant %6 1024 %34 = OpConstant %6 1 -%38 = OpConstant %6 8 +%cols = OpConstant %6 )" + + std::to_string(cols) + R"( %uint_0 = OpConstant %6 0 )"; if (useSpecConstantLayout) { @@ -2485,9 +3073,10 @@ OpDecorate %129 BuiltIn WorkgroupSize } s += R"( %68 = OpTypeFloat 32 -%69 = OpConstant %6 16 -%70 = OpConstant %6 3 -%71 = OpTypeCooperativeMatrixKHR %68 %70 %69 %38 %uint_0 +%rows = OpConstant %6 )" + + std::to_string(rows) + R"( +%scope = OpConstant %6 3 +%71 = OpTypeCooperativeMatrixKHR %68 %scope %rows %cols %uint_0 %72 = OpTypePointer Function %71 %74 = OpTypeRuntimeArray %68 %75 = OpTypeStruct %74 @@ -2497,7 +3086,11 @@ OpDecorate %129 BuiltIn WorkgroupSize %79 = OpConstant %78 0 %81 = OpConstant %6 5 %82 = OpTypePointer StorageBuffer %68 -%stride = OpConstant %6 64 +)"; + if (useConstantStride) { + s += "%stride = OpConstant %6 " + std::to_string(stride); + } + s += R"( %88 = OpTypePointer Private %71 %89 = OpVariable %88 Private %92 = OpTypeRuntimeArray %68 @@ -2528,6 +3121,7 @@ OpDecorate %129 BuiltIn WorkgroupSize %5 = OpLabel %9 = OpVariable %8 Function %18 = OpVariable %8 Function +%stride_var = OpVariable %ptr_uint_Function Function %32 = OpVariable %31 Function %44 = OpVariable %31 Function %52 = OpVariable %31 Function @@ -2535,6 +3129,11 @@ OpDecorate %129 BuiltIn WorkgroupSize %73 = OpVariable %72 Function %91 = OpVariable %72 Function %101 = OpVariable %72 Function +)"; + if (!useConstantStride) { + s += "%stride = OpLoad %6 %stride_var"; + } + s += R"( %12 = OpLoad %6 %11 %14 = OpUMod %6 %12 %13 %15 = OpLoad %6 %11 @@ -2555,7 +3154,7 @@ OpStore %18 %30 %37 = OpIMul %6 %33 %36 %40 = OpAccessChain %31 %18 %uint_0 %41 = OpLoad %6 %40 -%42 = OpIMul %6 %38 %41 +%42 = OpIMul %6 %cols %41 %43 = OpIAdd %6 %37 %42 OpStore %32 %43 %45 = OpAccessChain %31 %18 %34 @@ -2563,7 +3162,7 @@ OpStore %32 %43 %47 = OpIMul %6 %33 %46 %48 = OpAccessChain %31 %18 %uint_0 %49 = OpLoad %6 %48 -%50 = OpIMul %6 %38 %49 +%50 = OpIMul %6 %cols %49 %51 = OpIAdd %6 %47 %50 OpStore %44 %51 %53 = OpAccessChain %31 %18 %34 @@ -2571,7 +3170,7 @@ OpStore %44 %51 %55 = OpIMul %6 %33 %54 %56 = OpAccessChain %31 %18 %uint_0 %57 = OpLoad %6 %56 -%58 = OpIMul %6 %38 %57 +%58 = OpIMul %6 %cols %57 %59 = OpIAdd %6 %55 %58 OpStore %52 %59 %61 = OpAccessChain %31 %18 %34 @@ -2579,7 +3178,7 @@ OpStore %52 %59 %63 = OpIMul %6 %33 %62 %64 = OpAccessChain %31 %18 %uint_0 %65 = OpLoad %6 %64 -%66 = OpIMul %6 %38 %65 +%66 = OpIMul %6 %cols %65 %67 = OpIAdd %6 %63 %66 OpStore %60 %67 %80 = OpLoad %6 %32 @@ -2658,7 +3257,19 @@ INSTANTIATE_TEST_SUITE_P( true}, StrideMissingCase{ (unsigned)spv::CooperativeMatrixLayout::ColumnMajorKHR, true, - false})); + false}, + StrideMissingCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, + false, true}, + StrideMissingCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, + true, false}, + StrideMissingCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + false, true}, + StrideMissingCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + true, false})); TEST_P(ValidateCoopMatrixStrideMissing, CoopMatKHRLoadStrideMissingFail) { const StrideMissingCase& param = GetParam(); @@ -2707,6 +3318,189 @@ TEST_F(ValidateMemory, CoopMatKHRLoadMemoryAccessFail) { HasSubstr("MakePointerAvailableKHR cannot be used with OpLoad")); } +TEST_F(ValidateMemory, + CoopMatLoadArmRowBlockedInterleavedLayoutNonConstantStrideFail) { + std::string spirv = GenCoopMatLoadStoreShaderKHR( + "MakePointerAvailableKHR|NonPrivatePointerKHR", + "MakePointerAvailableKHR|NonPrivatePointerKHR", + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, + false, /* useSpecConstantLayout */ + true, /* useStoreStride */ + true, /* useLoadStride */ + false /* useConstantStride */); + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("MemoryLayout 4202 requires Stride come from a " + "constant instruction")); +} + +TEST_F(ValidateMemory, + CoopMatLoadArmColumnBlockedInterleavedLayoutNonConstantStrideFail) { + std::string spirv = GenCoopMatLoadStoreShaderKHR( + "MakePointerAvailableKHR|NonPrivatePointerKHR", + "MakePointerAvailableKHR|NonPrivatePointerKHR", + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + false, /* useSpecConstantLayout */ + true, /* useStoreStride */ + true, /* useLoadStride */ + false /* useConstantStride */); + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("MemoryLayout 4203 requires Stride come from a " + "constant instruction")); +} + +struct StrideValueCase { + unsigned layout; + unsigned stride; + bool valid; +}; + +using ValidateCoopMatrixStrideValue = spvtest::ValidateBase; + +INSTANTIATE_TEST_SUITE_P( + CoopMatrixStrideValue, ValidateCoopMatrixStrideValue, + Values( + StrideValueCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 1, + true}, + StrideValueCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 2, + true}, + StrideValueCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 4, + true}, + StrideValueCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 8, + false}, + StrideValueCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 1, true}, + StrideValueCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 2, true}, + StrideValueCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 4, true}, + StrideValueCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 8, false})); + +TEST_P(ValidateCoopMatrixStrideValue, CoopMatLoadStoreStrideValue) { + const StrideValueCase& param = GetParam(); + std::string spirv = GenCoopMatLoadStoreShaderKHR( + "MakePointerAvailableKHR|NonPrivatePointerKHR", + "MakePointerVisibleKHR|NonPrivatePointerKHR", param.layout, + false /*useSpecConstantLayout*/, true /*useStoreStride*/, + true /*useLoadStride*/, true /*useConstantStride*/, param.stride); + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + if (param.valid) { + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + } else { + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("MemoryLayout " + std::to_string(param.layout) + + " requires Stride be 1, 2, or 4")); + } +} + +struct MatrixSizeCase { + unsigned layout; + unsigned rows; + unsigned cols; + unsigned stride; + bool valid_rows; + bool valid_cols; +}; + +using ValidateCoopMatrixSize = spvtest::ValidateBase; + +INSTANTIATE_TEST_SUITE_P( + CoopMatrixMatrixSize, ValidateCoopMatrixSize, + Values( + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 4, + 4, 1, true, true}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 4, + 8, 2, true, true}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 2, + 4, 1, false, true}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 2, + 4, 2, false, false}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 4, + 2, 1, true, false}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM, 4, + 4, 2, true, false}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 4, 4, 1, true, true}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 8, 4, 2, true, true}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 4, 2, 1, true, false}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 4, 2, 2, false, false}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 2, 4, 1, false, true}, + MatrixSizeCase{ + (unsigned)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM, + 4, 4, 2, false, true})); + +TEST_P(ValidateCoopMatrixSize, CoopMatLoadStoreMatrixSize) { + const MatrixSizeCase& param = GetParam(); + std::string spirv = GenCoopMatLoadStoreShaderKHR( + "MakePointerAvailableKHR|NonPrivatePointerKHR", + "MakePointerVisibleKHR|NonPrivatePointerKHR", param.layout, + false /*useSpecConstantLayout*/, true /*useStoreStride*/, + true /*useLoadStride*/, true /*useConstantStride*/, param.stride, + param.rows, param.cols); + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + + uint32_t rows_required_multiple = 4; + uint32_t cols_required_multiple = + 16 / 4; // The shader always uses FP32 matrix components + + if (param.layout == + (uint64_t)spv::CooperativeMatrixLayout::RowBlockedInterleavedARM) { + cols_required_multiple *= param.stride; + } + if (param.layout == + (uint64_t)spv::CooperativeMatrixLayout::ColumnBlockedInterleavedARM) { + rows_required_multiple *= param.stride; + } + + if (param.valid_rows && param.valid_cols) { + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + } else if (param.valid_rows) { + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryLayout " + std::to_string(param.layout) + + " with a Stride of " + std::to_string(param.stride) + + " requires that the number of columns be a multiple of " + + std::to_string(cols_required_multiple))); + } else { + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryLayout " + std::to_string(param.layout) + + " with a Stride of " + std::to_string(param.stride) + + " requires that the number of rows be a multiple of " + + std::to_string(rows_required_multiple))); + } +} + TEST_F(ValidateMemory, CoopMatKHRInvalidStorageClassFail) { const std::string body = R"( OpCapability Shader @@ -2888,7 +3682,8 @@ OpFunctionEnd "OpVariable, '5[%5]', is attempting to create memory for an " "illegal type, OpTypeRuntimeArray.\nFor Vulkan OpTypeRuntimeArray " "can only appear as the final member of an OpTypeStruct, thus cannot " - "be instantiated via OpVariable\n %5 = OpVariable " + "be instantiated via OpVariable, unless the RuntimeDescriptorArray " + "Capability is declared\n %5 = OpVariable " "%_ptr_UniformConstant__runtimearr_2 UniformConstant\n")); } @@ -2902,6 +3697,10 @@ OpEntryPoint Fragment %func "func" OpExecutionMode %func OriginUpperLeft OpDecorate %struct Block OpMemberDecorate %struct 0 Offset 0 +OpDecorate %2 DescriptorSet 0 +OpDecorate %2 Binding 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 1 %sampler_t = OpTypeSampler %uint = OpTypeInt 32 0 %array_t = OpTypeRuntimeArray %sampler_t @@ -2951,7 +3750,7 @@ OpFunctionEnd AnyVUID("VUID-StandaloneSpirv-OpTypeRuntimeArray-04680")); EXPECT_THAT( getDiagnosticString(), - HasSubstr("For Vulkan with RuntimeDescriptorArrayEXT, a variable " + HasSubstr("For Vulkan with RuntimeDescriptorArray, a variable " "containing OpTypeRuntimeArray must have storage class of " "StorageBuffer, Uniform, or UniformConstant.\n %5 = " "OpVariable %_ptr_Workgroup__runtimearr_uint Workgroup\n")); @@ -2966,6 +3765,8 @@ OpExecutionMode %func OriginUpperLeft OpDecorate %array_t ArrayStride 4 OpMemberDecorate %struct_t 0 Offset 0 OpDecorate %struct_t Block +OpDecorate %2 DescriptorSet 0 +OpDecorate %2 Binding 0 %uint_t = OpTypeInt 32 0 %array_t = OpTypeRuntimeArray %uint_t %struct_t = OpTypeStruct %array_t @@ -3057,6 +3858,8 @@ OpExecutionMode %func OriginUpperLeft OpDecorate %array_t ArrayStride 4 OpMemberDecorate %struct_t 0 Offset 0 OpDecorate %struct_t BufferBlock +OpDecorate %2 DescriptorSet 0 +OpDecorate %2 Binding 0 %uint_t = OpTypeInt 32 0 %array_t = OpTypeRuntimeArray %uint_t %struct_t = OpTypeStruct %array_t @@ -3074,13 +3877,17 @@ OpFunctionEnd EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); } -TEST_F(ValidateMemory, VulkanRTAInsideUniformStructWithoutBufferBlockBad) { +TEST_F(ValidateMemory, VulkanRTAInsideUniformStructWithoutBufferBlock) { std::string spirv = R"( OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %func "func" OpExecutionMode %func OriginUpperLeft +OpDecorate %array_t ArrayStride 16 OpDecorate %struct_t Block +OpMemberDecorate %struct_t 0 Offset 0 +OpDecorate %2 Binding 0 +OpDecorate %2 DescriptorSet 0 %uint_t = OpTypeInt 32 0 %array_t = OpTypeRuntimeArray %uint_t %struct_t = OpTypeStruct %array_t @@ -3092,17 +3899,44 @@ OpDecorate %struct_t Block %1 = OpLabel OpReturn OpFunctionEnd +)"; + + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +TEST_F(ValidateMemory, VulkanArrayLengthUniformRuntimeArray) { + std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +OpExecutionMode %func OriginUpperLeft +OpDecorate %array_t ArrayStride 16 +OpDecorate %struct_t Block +OpMemberDecorate %struct_t 0 Offset 0 +OpDecorate %2 Binding 0 +OpDecorate %2 DescriptorSet 0 +%uint_t = OpTypeInt 32 0 +%array_t = OpTypeRuntimeArray %uint_t +%struct_t = OpTypeStruct %array_t +%struct_ptr = OpTypePointer Uniform %struct_t +%2 = OpVariable %struct_ptr Uniform +%void = OpTypeVoid +%func_t = OpTypeFunction %void +%func = OpFunction %void None %func_t +%1 = OpLabel +%length = OpArrayLength %uint_t %2 0 +OpReturn +OpFunctionEnd )"; CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-OpTypeRuntimeArray-04680")); + AnyVUID("VUID-StandaloneSpirv-OpArrayLength-11805")); EXPECT_THAT(getDiagnosticString(), - HasSubstr("For Vulkan, an OpTypeStruct variable containing an " - "OpTypeRuntimeArray must be decorated with BufferBlock " - "if it has storage class Uniform.\n %6 = OpVariable " - "%_ptr_Uniform__struct_2 Uniform\n")); + HasSubstr("OpArrayLength must not be used on the " + "OpTypeRuntimeArray inside a Uniform block")); } TEST_F(ValidateMemory, VulkanRTAInsideRTABad) { @@ -3182,6 +4016,8 @@ OpEntryPoint Fragment %func "func" OpExecutionMode %func OriginUpperLeft OpMemberDecorate %struct_t 0 Offset 0 OpDecorate %struct_t Block +OpDecorate %2 DescriptorSet 0 +OpDecorate %2 Binding 0 %uint_t = OpTypeInt 32 0 %struct_t = OpTypeStruct %uint_t %array_t = OpTypeRuntimeArray %struct_t @@ -3427,6 +4263,8 @@ OpExecutionMode %func OriginUpperLeft OpDecorate %inner_array_t ArrayStride 4 OpMemberDecorate %struct_t 0 Offset 0 OpDecorate %struct_t Block +OpDecorate %2 DescriptorSet 0 +OpDecorate %2 Binding 0 %uint_t = OpTypeInt 32 0 %inner_array_t = OpTypeRuntimeArray %uint_t %struct_t = OpTypeStruct %inner_array_t @@ -3456,6 +4294,8 @@ OpExecutionMode %func OriginUpperLeft OpDecorate %inner_array_t ArrayStride 4 OpMemberDecorate %struct_t 0 Offset 0 OpDecorate %struct_t Block +OpDecorate %2 DescriptorSet 0 +OpDecorate %2 Binding 0 %uint_t = OpTypeInt 32 0 %inner_array_t = OpTypeRuntimeArray %uint_t %struct_t = OpTypeStruct %inner_array_t @@ -3826,7 +4666,7 @@ OpFunctionEnd EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Instruction cannot for logical addressing model be " + HasSubstr("Instruction on logical pointers cannot be " "used without a variable pointers capability")); } } @@ -5716,7 +6556,45 @@ OpFunctionEnd CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Vulkan requires that data type be specified")); + AnyVUID("VUID-StandaloneSpirv-OpUntypedVariableKHR-11167")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Storage class is StorageBuffer, but Vulkan requires that Data Type " + "be specified when not using UniformConstant storage class")); +} + +TEST_F(ValidateMemory, UntypedVariableNoDataTypeNonHeapVulkan) { + const std::string spirv = R"( +OpCapability Shader +OpCapability DescriptorHeapEXT +OpCapability UntypedPointersKHR +OpExtension "SPV_EXT_descriptor_heap" +OpExtension "SPV_KHR_untyped_pointers" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%ptr = OpTypeUntypedPointerKHR UniformConstant +%var = OpUntypedVariableKHR %ptr UniformConstant +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-OpUntypedVariableKHR-11347")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Storage class is UniformConstant, but Vulkan requires " + "that Data Type be specified if the variable is not " + "decorated with SamplerHeapEXT or ResourceHeapEXT")); } TEST_F(ValidateMemory, PtrAccessChainArrayStrideBad) { @@ -5959,8 +6837,8 @@ OpFunctionEnd CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), HasSubstr("is out of bounds")); - EXPECT_THAT(getDiagnosticString(), HasSubstr("cannot find index -224")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Index at word 4 may not have a negative value")); } TEST_F(ValidateMemory, AccessChainNegativeStructIndex64) { @@ -5987,8 +6865,8 @@ OpFunctionEnd CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), HasSubstr("is out of bounds")); - EXPECT_THAT(getDiagnosticString(), HasSubstr("cannot find index -224")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Index at word 4 may not have a negative value")); } TEST_F(ValidateMemory, UntypedVariableFunctionOutsideFunction) { @@ -6148,6 +7026,7 @@ TEST_P(ValidateMemoryUntypedAccessChain, GoodTypedPointerBase) { const bool ptr = opcode == "OpUntypedPtrAccessChainKHR" || opcode == "OpUntypedInBoundsPtrAccessChainKHR"; const std::string extra_param = ptr ? "%int_0" : ""; + const std::string deco = ptr ? "OpDecorate %ptr_ssbo ArrayStride 4" : ""; const std::string spirv = R"( OpCapability Shader @@ -6158,6 +7037,7 @@ OpExtension "SPV_KHR_storage_buffer_storage_class" OpExtension "SPV_KHR_untyped_pointers" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" +)" + deco + R"( %void = OpTypeVoid %int = OpTypeInt 32 0 %int_0 = OpConstant %int 0 @@ -6174,6 +7054,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } @@ -6183,6 +7065,7 @@ TEST_P(ValidateMemoryUntypedAccessChain, GoodUntypedPointerBase) { const bool ptr = opcode == "OpUntypedPtrAccessChainKHR" || opcode == "OpUntypedInBoundsPtrAccessChainKHR"; const std::string extra_param = ptr ? "%int_0" : ""; + const std::string deco = ptr ? "OpDecorate %ptr ArrayStride 4" : ""; const std::string spirv = R"( OpCapability Shader @@ -6193,6 +7076,7 @@ OpExtension "SPV_KHR_storage_buffer_storage_class" OpExtension "SPV_KHR_untyped_pointers" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" +)" + deco + R"( %void = OpTypeVoid %int = OpTypeInt 32 0 %int_0 = OpConstant %int 0 @@ -6209,6 +7093,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } @@ -6246,6 +7132,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), @@ -6285,6 +7173,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), @@ -6323,6 +7213,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), @@ -6361,6 +7253,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), @@ -6399,6 +7293,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), @@ -6438,6 +7334,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT( @@ -6479,6 +7377,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), @@ -6518,6 +7418,8 @@ OpReturn OpFunctionEnd )"; + getValidatorOptions()->relax_logical_pointer = + opcode == "OpUntypedInBoundsPtrAccessChainKHR"; CompileSuccessfully(spirv); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), @@ -7136,8 +8038,9 @@ OpFunctionEnd CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("must be OpTypeInt with width 32 and signedness 0")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be OpTypeInt with width 32 or 64 and signedness 0")); } TEST_F(ValidateMemory, UntypedArrayLengthBadPointer) { @@ -7171,7 +8074,46 @@ OpFunctionEnd CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); EXPECT_THAT(getDiagnosticString(), - HasSubstr("Pointer must be an untyped pointer")); + HasSubstr("Pointer must be an untyped pointer object")); +} + +TEST_F(ValidateMemory, UntypedArrayLengthBadPointer2) { + const std::string spirv = R"( + OpCapability Shader + OpCapability UntypedPointersKHR + OpCapability Int64 + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %b + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %B Block + OpMemberDecorate %B 0 NonWritable + OpMemberDecorate %B 0 Offset 0 + OpDecorate %b NonWritable + OpDecorate %b Binding 0 + OpDecorate %b DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %B = OpTypeStruct %_runtimearr_float + %ptr = OpTypeUntypedPointerKHR StorageBuffer + %b = OpUntypedVariableKHR %ptr StorageBuffer %B + %ulong = OpTypeInt 64 0 + %long = OpTypeInt 64 1 + %main = OpFunction %void None %4 + %6 = OpLabel + %13 = OpUntypedArrayLengthKHR %ulong %b %ptr 0 + %15 = OpBitcast %long %13 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Pointer must be an untyped pointer object")); } TEST_F(ValidateMemory, UntypedArrayLengtBadStruct) { @@ -7456,6 +8398,561 @@ OpFunctionEnd EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); } +TEST_F(ValidateMemory, PtrAccessChainElementNotInteger) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %ptr_int ArrayStride 4 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_4 = OpConstant %int 4 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_0 = OpConstant %float 0 +%array = OpTypeArray %int %int_4 +%ptr_array = OpTypePointer Workgroup %array +%ptr_int = OpTypePointer Workgroup %int +%var = OpVariable %ptr_array Workgroup +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpAccessChain %ptr_int %var %int_0 +%ptr_gep = OpPtrAccessChain %ptr_int %gep %float_0 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), HasSubstr("Element must be an integer")); +} + +TEST_F(ValidateMemory, PtrAccessChainElementNotIntegerUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_untyped_pointers" +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %ptr_int ArrayStride 4 +OpDecorate %array ArrayStride 4 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_4 = OpConstant %int 4 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_0 = OpConstant %float 0 +%array = OpTypeArray %int %int_4 +%block = OpTypeStruct %array +%ptr_block = OpTypeUntypedPointerKHR Workgroup +%ptr_int = OpTypeUntypedPointerKHR Workgroup +%var = OpUntypedVariableKHR %ptr_block Workgroup %block +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpUntypedAccessChainKHR %ptr_int %block %var %int_0 %int_0 +%ptr_gep = OpUntypedPtrAccessChainKHR %ptr_int %int %gep %float_0 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_2)); + EXPECT_THAT(getDiagnosticString(), HasSubstr("Element must be an integer")); +} + +TEST_F(ValidateMemory, PtrAccessChainElementBlockArrayNonZeroConstant) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_4 = OpConstant %int 4 +%int_1 = OpConstant %int 1 +%int_0 = OpConstant %int 0 +%block = OpTypeStruct %int +%array = OpTypeArray %block %int_4 +%ptr_array = OpTypePointer StorageBuffer %array +%ptr_block = OpTypePointer StorageBuffer %block +%var = OpVariable %ptr_array StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpAccessChain %ptr_block %var %int_0 +%ptr_gep = OpPtrAccessChain %ptr_block %gep %int_1 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Element must be 0 if the interpretation type is a " + "Block- or BufferBlock-decorated structure")); +} + +TEST_F(ValidateMemory, PtrAccessChainElementBlockArrayNonZeroConstantUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_4 = OpConstant %int 4 +%int_1 = OpConstant %int 1 +%int_0 = OpConstant %int 0 +%block = OpTypeStruct %int +%array = OpTypeArray %block %int_4 +%ptr_array = OpTypeUntypedPointerKHR StorageBuffer +%ptr_block = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr_array StorageBuffer %array +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpUntypedAccessChainKHR %ptr_block %array %var %int_0 +%ptr_gep = OpUntypedPtrAccessChainKHR %ptr_block %block %gep %int_1 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Element must be 0 if the interpretation type is a " + "Block- or BufferBlock-decorated structure")); +} + +TEST_F(ValidateMemory, UntypedAccessChainBlockArrayMismatch1) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpCapability VariablePointers +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_0 = OpConstant %int 0 +%block = OpTypeStruct %int +%array1 = OpTypeArray %block %int_4 +%array2 = OpTypeArray %block %int_4 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr StorageBuffer %array1 +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpUntypedAccessChainKHR %ptr %array2 %var +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("If Base or Base Type is a Block or BufferBlock array, " + "the other must also be the same array")); +} + +TEST_F(ValidateMemory, UntypedAccessChainBlockArrayMismatch2) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpCapability VariablePointers +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_0 = OpConstant %int 0 +%block = OpTypeStruct %int +%array1 = OpTypeArray %block %int_4 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%var = OpUntypedVariableKHR %ptr StorageBuffer %array1 +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpUntypedAccessChainKHR %ptr %block %var +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Both Base Type and Base must be Block or BufferBlock " + "arrays or neither can be")); +} + +TEST_F(ValidateMemory, UntypedAccessChainBlockArrayMismatch3) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpCapability VariablePointers +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_0 = OpConstant %int 0 +%block = OpTypeStruct %int +%array1 = OpTypeArray %block %int_4 +%array2 = OpTypeArray %block %int_4 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%ptr_block_array = OpTypePointer StorageBuffer %array1 +%var = OpVariable %ptr_block_array StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%copy1 = OpCopyObject %ptr_block_array %var +%copy2 = OpCopyObject %ptr_block_array %copy1 +%gep = OpUntypedAccessChainKHR %ptr %array2 %copy2 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("If Base or Base Type is a Block or BufferBlock array, " + "the other must also be the same array")); +} + +TEST_F(ValidateMemory, UntypedAccessChainBlockArrayMismatch4) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpCapability VariablePointers +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %var DescriptorSet 0 +OpDecorate %var Binding 0 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_0 = OpConstant %int 0 +%block = OpTypeStruct %int +%array1 = OpTypeArray %block %int_4 +%ptr = OpTypeUntypedPointerKHR StorageBuffer +%ptr_block_array = OpTypePointer StorageBuffer %array1 +%var = OpVariable %ptr_block_array StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%copy = OpCopyObject %ptr_block_array %var +%gep = OpUntypedAccessChainKHR %ptr %block %copy +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Both Base Type and Base must be Block or BufferBlock " + "arrays or neither can be")); +} + +TEST_F(ValidateMemory, VariableFunctionPointer) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypePointer Function %int +%ptr_ptr = OpTypePointer Function %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpVariable %ptr_ptr Function +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In Logical addressing, variables can only allocate a pointer " + "to the StorageBuffer or Workgroup storage classes")); +} + +TEST_F(ValidateMemory, VariableFunctionPointerUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypeUntypedPointerKHR Function +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpUntypedVariableKHR %ptr Function %ptr +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("In Logical addressing, variables can only allocate a pointer " + "to the StorageBuffer or Workgroup storage classes")); +} + +TEST_F(ValidateMemory, VariableStorageBufferPointer) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypePointer StorageBuffer %int +%ptr_ptr = OpTypePointer Function %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpVariable %ptr_ptr Function +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In Logical addressing, variables can only allocate a storage " + "buffer pointer if the VariablePointersStorageBuffer capability " + "is declared")); +} + +TEST_F(ValidateMemory, VariableStorageBufferPointerUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr_s = OpTypeUntypedPointerKHR StorageBuffer +%ptr_f = OpTypeUntypedPointerKHR Function +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpUntypedVariableKHR %ptr_f Function %ptr_s +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In Logical addressing, variables can only allocate a storage " + "buffer pointer if the VariablePointersStorageBuffer capability " + "is declared")); +} + +TEST_F(ValidateMemory, VariableWorkgroupPointer) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypePointer Workgroup %int +%ptr_ptr = OpTypePointer Function %ptr +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpVariable %ptr_ptr Function +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In Logical addressing, variables can only allocate a workgroup " + "pointer if the VariablePointers capability is declared")); +} + +TEST_F(ValidateMemory, VariableWorkgroupPointerUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr_w = OpTypeUntypedPointerKHR Workgroup +%ptr_f = OpTypeUntypedPointerKHR Function +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpUntypedVariableKHR %ptr_f Function %ptr_w +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In Logical addressing, variables can only allocate a workgroup " + "pointer if the VariablePointers capability is declared")); +} + +TEST_F(ValidateMemory, VariablePointerBadStorageClass) { + const std::string spirv = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr = OpTypePointer Workgroup %int +%ptr_ptr = OpTypePointer Workgroup %ptr +%var = OpVariable %ptr_ptr Workgroup +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In Logical addressing with variable pointers, variables that " + "allocate pointers must be in Function or Private storage classes")); +} + +TEST_F(ValidateMemory, VariablePointerBadStorageClassUntyped) { + const std::string spirv = R"( +OpCapability Shader +OpCapability UntypedPointersKHR +OpCapability VariablePointers +OpExtension "SPV_KHR_untyped_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 0 +%ptr_w = OpTypeUntypedPointerKHR Workgroup +%var = OpUntypedVariableKHR %ptr_w Workgroup %ptr_w +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In Logical addressing with variable pointers, variables that " + "allocate pointers must be in Function or Private storage classes")); +} + +TEST_F(ValidateMemory, AccessChainNegativeSignedIndex) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_4 = OpConstant %int 4 +%array = OpTypeArray %int %int_4 +%ptr_array = OpTypePointer Workgroup %array +%ptr_int = OpTypePointer Workgroup %int +%var = OpVariable %ptr_array Workgroup +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gep = OpAccessChain %ptr_int %var %int_n1 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Index at word 4 may not have a negative value")); +} + std::string GenCoopMat2Shader(const std::string& extra_types, const std::string& main_body, const std::string& after_main = "", @@ -8172,7 +9669,8 @@ OpDecorate %48 DescriptorSet 0 %56 = OpCooperativeVectorLoadNV %42 %52 %50 )" + loadMemoryAccess + R"( %82 %77 = OpLoad %42 %73 -OpCooperativeVectorStoreNV %52 %50 %77 )" + storeMemoryAccess + R"( %82 +OpCooperativeVectorStoreNV %52 %50 %77 )" + + storeMemoryAccess + R"( %82 OpReturn OpFunctionEnd )"; @@ -8224,6 +9722,7 @@ OpExtension "SPV_EXT_replicated_composites" OpExtension "SPV_KHR_vulkan_memory_model" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 %void = OpTypeVoid %func = OpTypeFunction %void %f16 = OpTypeFloat 16 @@ -8245,8 +9744,9 @@ OpEntryPoint GLCompute %main "main" OpReturn OpFunctionEnd)"; - CompileSuccessfully(body.c_str(), SPV_ENV_UNIVERSAL_1_3); - ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_1_SPIRV_1_4); + ASSERT_EQ(SPV_ERROR_INVALID_ID, + ValidateInstructions(SPV_ENV_VULKAN_1_1_SPIRV_1_4)); EXPECT_THAT( getDiagnosticString(), HasSubstr( @@ -8256,25 +9756,32 @@ OpFunctionEnd)"; } std::string GenCoopVecShader(const std::string& extra_types, - const std::string& main_body) { + const std::string& main_body, + const std::string& execution_modes = "") { const std::string prefix = R"( OpCapability Shader OpCapability Float16 OpCapability Int64 +OpCapability Int16 OpCapability StorageBuffer16BitAccess OpCapability VulkanMemoryModel OpCapability CooperativeVectorNV OpCapability CooperativeVectorTrainingNV OpCapability ReplicatedCompositesEXT +OpCapability Shader64BitIndexingEXT OpExtension "SPV_EXT_replicated_composites" OpExtension "SPV_KHR_vulkan_memory_model" OpExtension "SPV_NV_cooperative_vector" +OpExtension "SPV_EXT_shader_64bit_indexing" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical Vulkan OpEntryPoint GLCompute %main "main" %48 %73 OpExecutionMode %main LocalSize 1 1 1 +)" + execution_modes + + R"( + OpDecorate %f16_arr ArrayStride 2 OpDecorate %46 Block OpMemberDecorate %46 0 Offset 0 @@ -8492,22 +9999,23 @@ OpCooperativeVectorOuterProductAccumulateNV %array_ptr %offset %input4 %input8f3 "types '11[%half]' and '28[%float]' do not match")); } -TEST_F(ValidateMemory, CoopVecOuterProductInt32OffsetFail) { +TEST_F(ValidateMemory, CoopVecOuterProductIntOffsetFail) { std::string spirv = GenCoopVecShader( R"( -%u64 = OpTypeInt 64 0 -%u64_0 = OpConstant %u64 0 +%u16 = OpTypeInt 16 0 +%u16_0 = OpConstant %u16 0 )", R"( -OpCooperativeVectorOuterProductAccumulateNV %array_ptr %u64_0 %input4 %input8 %interp %interp +OpCooperativeVectorOuterProductAccumulateNV %array_ptr %u16_0 %input4 %input8 %interp %interp )"); CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1_SPIRV_1_4); ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1_SPIRV_1_4)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("OpCooperativeVectorOuterProductAccumulateNV Offset " - "type '28[%ulong]' is not a 32 bit integer")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpCooperativeVectorOuterProductAccumulateNV Offset " + "type '28[%ushort]' is not a 32 or 64 bit integer")); } TEST_F(ValidateMemory, CoopVecOuterProductInt32MatrixStrideFail) { @@ -8547,14 +10055,14 @@ OpCooperativeVectorOuterProductAccumulateNV %array_ptr %offset %f16c %input8 %in " '28[%v4half]' is not a cooperative vector type")); } -TEST_F(ValidateMemory, CoopVecReduceSumInt32OffsetFail) { +TEST_F(ValidateMemory, CoopVecReduceSumIntOffsetFail) { std::string spirv = GenCoopVecShader( R"( -%u64 = OpTypeInt 64 0 -%u64_0 = OpConstant %u64 0 +%u16 = OpTypeInt 16 0 +%u16_0 = OpConstant %u16 0 )", R"( -OpCooperativeVectorReduceSumAccumulateNV %array_ptr %u64_0 %input4 +OpCooperativeVectorReduceSumAccumulateNV %array_ptr %u16_0 %input4 )"); CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1_SPIRV_1_4); @@ -8562,7 +10070,21 @@ OpCooperativeVectorReduceSumAccumulateNV %array_ptr %u64_0 %input4 ValidateInstructions(SPV_ENV_VULKAN_1_1_SPIRV_1_4)); EXPECT_THAT(getDiagnosticString(), HasSubstr("OpCooperativeVectorReduceSumAccumulateNV Offset type " - " '28[%ulong]' is not a 32 bit integer")); + " '28[%ushort]' is not a 32 or 64 bit integer")); +} + +TEST_F(ValidateMemory, CoopVecOuterProductInt64OffsetPass) { + std::string spirv = GenCoopVecShader( + R"( +%u64 = OpTypeInt 64 0 +%u64_0 = OpConstant %u64 0 + )", + R"( +OpCooperativeVectorOuterProductAccumulateNV %array_ptr %u64_0 %input4 %input8 %interp %interp + )"); + + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1_SPIRV_1_4); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1_SPIRV_1_4)); } TEST_F(ValidateMemory, CoopVecReduceSumVectorTypeFail) { @@ -8582,6 +10104,248 @@ OpCooperativeVectorReduceSumAccumulateNV %array_ptr %offset %f16c HasSubstr("OpCooperativeVectorReduceSumAccumulateNV V type " "'28[%v4half]' is not a cooperative vector type.")); } + +TEST_F(ValidateMemory, CoopMatMatrixBFloatFAdd) { + const std::string body = + R"( + OpCapability Shader + OpCapability Float16 + OpCapability BFloat16TypeKHR + OpCapability BFloat16CooperativeMatrixKHR + OpCapability VulkanMemoryModel + OpCapability CooperativeMatrixKHR + OpExtension "SPV_KHR_bfloat16" + OpExtension "SPV_KHR_vulkan_memory_model" + OpExtension "SPV_KHR_cooperative_matrix" + OpMemoryModel Logical Vulkan + OpEntryPoint GLCompute %main "main" %_ %__0 %__1 + OpExecutionMode %main LocalSize 32 1 1 + OpDecorate %_arr_bfloat16_uint_64 ArrayStride 2 + OpDecorate %A Block + OpMemberDecorate %A 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + OpDecorate %_arr_bfloat16_uint_64_0 ArrayStride 2 + OpDecorate %B Block + OpMemberDecorate %B 0 Offset 0 + OpDecorate %__0 Binding 1 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_arr_bfloat16_uint_64_1 ArrayStride 2 + OpDecorate %R Block + OpMemberDecorate %R 0 Offset 0 + OpDecorate %__1 Binding 2 + OpDecorate %__1 DescriptorSet 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %bfloat16 = OpTypeFloat 16 BFloat16KHR + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %uint_8 = OpConstant %uint 8 + %uint_0 = OpConstant %uint 0 + %12 = OpTypeCooperativeMatrixKHR %bfloat16 %uint_3 %uint_8 %uint_8 %uint_0 +%_ptr_Function_12 = OpTypePointer Function %12 + %uint_64 = OpConstant %uint 64 +%_arr_bfloat16_uint_64 = OpTypeArray %bfloat16 %uint_64 + %A = OpTypeStruct %_arr_bfloat16_uint_64 +%_ptr_StorageBuffer_A = OpTypePointer StorageBuffer %A + %_ = OpVariable %_ptr_StorageBuffer_A StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer_bfloat16 = OpTypePointer StorageBuffer %bfloat16 +%_arr_bfloat16_uint_64_0 = OpTypeArray %bfloat16 %uint_64 + %B = OpTypeStruct %_arr_bfloat16_uint_64_0 +%_ptr_StorageBuffer_B = OpTypePointer StorageBuffer %B + %__0 = OpVariable %_ptr_StorageBuffer_B StorageBuffer + %v3uint = OpTypeVector %uint 3 + %uint_32 = OpConstant %uint 32 + %uint_1 = OpConstant %uint 1 + %35 = OpConstantComposite %v3uint %uint_32 %uint_1 %uint_1 +%_arr_bfloat16_uint_64_1 = OpTypeArray %bfloat16 %uint_64 + %R = OpTypeStruct %_arr_bfloat16_uint_64_1 +%_ptr_StorageBuffer_R = OpTypePointer StorageBuffer %R + %__1 = OpVariable %_ptr_StorageBuffer_R StorageBuffer + %main = OpFunction %void None %4 + %6 = OpLabel + %matX = OpVariable %_ptr_Function_12 Function + %matY = OpVariable %_ptr_Function_12 Function + %23 = OpAccessChain %_ptr_StorageBuffer_bfloat16 %_ %int_0 %uint_0 + %24 = OpCooperativeMatrixLoadKHR %12 %23 %int_0 %uint_8 None + OpStore %matX %24 + %30 = OpAccessChain %_ptr_StorageBuffer_bfloat16 %__0 %int_0 %uint_0 + %31 = OpCooperativeMatrixLoadKHR %12 %30 %int_0 %uint_8 None + OpStore %matY %31 + %32 = OpLoad %12 %matX + %33 = OpLoad %12 %matY + %34 = OpFAdd %12 %32 %33 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("FAdd doesn't support BFloat16 type")); +} + +TEST_F(ValidateMemory, CoopMatMatrixFloat8FAdd) { + const std::string body = + R"( + OpCapability Shader + OpCapability Float8EXT + OpCapability Float8CooperativeMatrixEXT + OpCapability VulkanMemoryModel + OpCapability CooperativeMatrixKHR + OpExtension "SPV_EXT_float8" + OpExtension "SPV_KHR_cooperative_matrix" + OpExtension "SPV_KHR_vulkan_memory_model" + OpMemoryModel Logical Vulkan + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 32 1 1 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %4 = OpTypeFunction %void + %fp8e4m3 = OpTypeFloat 8 Float8E4M3EXT + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %uint_16 = OpConstant %uint 16 + %uint_0 = OpConstant %uint 0 + %12 = OpTypeCooperativeMatrixKHR %fp8e4m3 %uint_3 %uint_16 %uint_16 %uint_0 +%_ptr_Function_12 = OpTypePointer Function %12 + %v3uint = OpTypeVector %uint 3 + %uint_32 = OpConstant %uint 32 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_32 %uint_1 %uint_1 + %main = OpFunction %void None %4 + %6 = OpLabel + %matR = OpVariable %_ptr_Function_12 Function + %matX = OpVariable %_ptr_Function_12 Function + %matY = OpVariable %_ptr_Function_12 Function + %16 = OpLoad %12 %matX + %18 = OpLoad %12 %matY + %19 = OpFAdd %12 %16 %18 + OpStore %matR %19 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("FAdd doesn't support FP8 E4M3/E5M2 types")); +} + +TEST_F(ValidateMemory, PhysicalStorageBufferArray) { + const std::string body = + R"( + OpCapability Shader + OpCapability Int64 + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpExtension "SPV_KHR_physical_storage_buffer" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %18 "main" + OpExecutionMode %18 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 256 + OpDecorate %array ArrayStride 16 + %uint = OpTypeInt 32 0 + %void = OpTypeVoid + %ulong = OpTypeInt 64 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %17 = OpTypeFunction %void + %ulong_0 = OpConstant %ulong 0 + %uint_3 = OpConstant %uint 3 + %array = OpTypeArray %v4float %uint_3 + %S = OpTypeStruct %array %uint + %ptr_S = OpTypePointer PhysicalStorageBuffer %S + %float_0 = OpConstant %float 0 + %v4float_0 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %23 = OpConstantComposite %array %v4float_0 %v4float_0 %v4float_0 + %24 = OpConstantComposite %S %23 %uint_3 + %18 = OpFunction %void None %17 + %19 = OpLabel + %58 = OpConvertUToPtr %ptr_S %ulong_0 + OpStore %58 %24 Aligned 4 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateMemory, LongVectorPrivateStorageClassGood) { + std::string spirv = R"( +OpCapability Shader +OpCapability LongVectorEXT +OpExtension "SPV_EXT_long_vector" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %func "func" +%float = OpTypeFloat 32 +%vec5 = OpTypeVector %float 5 +%vec5ptr = OpTypePointer Private %vec5 +%1 = OpVariable %vec5ptr Private +%void = OpTypeVoid +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%2 = OpLabel +OpReturn +OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +TEST_F(ValidateMemory, LongVectorInputStorageClassBad) { + std::string spirv = R"( +OpCapability Shader +OpCapability LongVectorEXT +OpExtension "SPV_EXT_long_vector" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %func "func" +%float = OpTypeFloat 32 +%vec5 = OpTypeVector %float 5 +%vec5ptr = OpTypePointer Input %vec5 +%1 = OpVariable %vec5ptr Input +%void = OpTypeVoid +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%2 = OpLabel +OpReturn +OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Long vector types with more than 4 components (or types " + "containing them) not supported in storage class Input")); +} + +TEST_F(ValidateMemory, LongVectorMissingCapabilityBad) { + std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %func "func" +%float = OpTypeFloat 32 +%vec5 = OpTypeVector %float 5 +%vec5ptr = OpTypePointer Private %vec5 +%1 = OpVariable %vec5ptr Private +%void = OpTypeVoid +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%2 = OpLabel +OpReturn +OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_1); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Illegal number of components (5) for TypeVector")); +} + } // namespace } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_mesh_shading_test.cpp b/third_party/spirv-tools/test/val/val_mesh_shading_test.cpp index 75937194d4..d12c27dd3a 100644 --- a/third_party/spirv-tools/test/val/val_mesh_shading_test.cpp +++ b/third_party/spirv-tools/test/val/val_mesh_shading_test.cpp @@ -128,6 +128,104 @@ TEST_F(ValidateMeshShading, BasicMeshSuccess) { EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_5)); } +// https://godbolt.org/z/Kvb1rsceP +TEST_F(ValidateMeshShading, BasicMeshBuiltinSuccess) { + const std::string body = R"( + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %gl_MeshVerticesEXT %vertexOutput %gl_MeshPrimitivesEXT %gl_LocalInvocationIndex %gl_PrimitiveTriangleIndicesEXT + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 3 + OpExecutionMode %main OutputPrimitivesEXT 1 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %gl_MeshPerVertexEXT Block + OpMemberDecorate %gl_MeshPerVertexEXT 0 BuiltIn Position + OpMemberDecorate %gl_MeshPerVertexEXT 1 BuiltIn PointSize + OpMemberDecorate %gl_MeshPerVertexEXT 2 BuiltIn ClipDistance + OpMemberDecorate %gl_MeshPerVertexEXT 3 BuiltIn CullDistance + OpDecorate %VertexOutput Block + OpDecorate %vertexOutput Location 0 + OpDecorate %gl_MeshPerPrimitiveEXT Block + OpMemberDecorate %gl_MeshPerPrimitiveEXT 0 BuiltIn PrimitiveId + OpMemberDecorate %gl_MeshPerPrimitiveEXT 0 PerPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 1 BuiltIn Layer + OpMemberDecorate %gl_MeshPerPrimitiveEXT 1 PerPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 2 BuiltIn ViewportIndex + OpMemberDecorate %gl_MeshPerPrimitiveEXT 2 PerPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 3 BuiltIn CullPrimitiveEXT + OpMemberDecorate %gl_MeshPerPrimitiveEXT 3 PerPrimitiveEXT + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %gl_PrimitiveTriangleIndicesEXT BuiltIn PrimitiveTriangleIndicesEXT + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_MeshPerVertexEXT = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_MeshPerVertexEXT_uint_3 = OpTypeArray %gl_MeshPerVertexEXT %uint_3 +%_ptr_Output__arr_gl_MeshPerVertexEXT_uint_3 = OpTypePointer Output %_arr_gl_MeshPerVertexEXT_uint_3 +%gl_MeshVerticesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerVertexEXT_uint_3 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%VertexOutput = OpTypeStruct %v4float +%_arr_VertexOutput_uint_3 = OpTypeArray %VertexOutput %uint_3 +%_ptr_Output__arr_VertexOutput_uint_3 = OpTypePointer Output %_arr_VertexOutput_uint_3 +%vertexOutput = OpVariable %_ptr_Output__arr_VertexOutput_uint_3 Output + %bool = OpTypeBool +%gl_MeshPerPrimitiveEXT = OpTypeStruct %int %int %int %bool +%_arr_gl_MeshPerPrimitiveEXT_uint_1 = OpTypeArray %gl_MeshPerPrimitiveEXT %uint_1 +%_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_1 = OpTypePointer Output %_arr_gl_MeshPerPrimitiveEXT_uint_1 +%gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_1 Output +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %int_3 = OpConstant %int 3 + %false = OpConstantFalse %bool +%_ptr_Output_bool = OpTypePointer Output %bool + %v3uint = OpTypeVector %uint 3 +%_arr_v3uint_uint_1 = OpTypeArray %v3uint %uint_1 +%_ptr_Output__arr_v3uint_uint_1 = OpTypePointer Output %_arr_v3uint_uint_1 +%gl_PrimitiveTriangleIndicesEXT = OpVariable %_ptr_Output__arr_v3uint_uint_1 Output + %uint_0 = OpConstant %uint 0 + %52 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 +%_ptr_Output_v3uint = OpTypePointer Output %v3uint + %main = OpFunction %void None %4 + %6 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %22 = OpAccessChain %_ptr_Output_v4float %gl_MeshVerticesEXT %int_0 %int_0 + OpStore %22 %20 + %24 = OpAccessChain %_ptr_Output_v4float %gl_MeshVerticesEXT %int_1 %int_0 + OpStore %24 %20 + %26 = OpAccessChain %_ptr_Output_v4float %gl_MeshVerticesEXT %int_2 %int_0 + OpStore %26 %20 + %31 = OpAccessChain %_ptr_Output_v4float %vertexOutput %int_0 %int_0 + OpStore %31 %20 + %32 = OpAccessChain %_ptr_Output_v4float %vertexOutput %int_1 %int_0 + OpStore %32 %20 + %33 = OpAccessChain %_ptr_Output_v4float %vertexOutput %int_2 %int_0 + OpStore %33 %20 + %41 = OpLoad %uint %gl_LocalInvocationIndex + %45 = OpAccessChain %_ptr_Output_bool %gl_MeshPrimitivesEXT %41 %int_3 + OpStore %45 %false + %50 = OpLoad %uint %gl_LocalInvocationIndex + %54 = OpAccessChain %_ptr_Output_v3uint %gl_PrimitiveTriangleIndicesEXT %50 + OpStore %54 %52 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + TEST_F(ValidateMeshShading, VulkanBasicMeshAndTaskSuccess) { const std::string body = R"( OpCapability MeshShadingEXT @@ -136,6 +234,8 @@ TEST_F(ValidateMeshShading, VulkanBasicMeshAndTaskSuccess) { OpMemoryModel Logical GLSL450 OpEntryPoint MeshEXT %mainMesh "mainMesh" OpEntryPoint TaskEXT %mainTask "mainTask" + OpExecutionMode %mainMesh LocalSize 1 1 1 + OpExecutionMode %mainTask LocalSize 1 1 1 OpExecutionMode %mainMesh OutputVertices 1 OpExecutionMode %mainMesh OutputPrimitivesEXT 1 OpExecutionMode %mainMesh OutputTrianglesEXT @@ -488,7 +588,8 @@ TEST_F(ValidateMeshShading, BadMultipleTaskPayloadWorkgroupEXT) { CompileSuccessfully(body, SPV_ENV_UNIVERSAL_1_5); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_5)); EXPECT_THAT(getDiagnosticString(), - HasSubstr("There can be at most one OpVariable with storage " + HasSubstr("There can be at most one " + "OpVariable with storage " "class TaskPayloadWorkgroupEXT associated with " "an OpEntryPoint")); } @@ -671,6 +772,81 @@ TEST_F(ValidateMeshShading, OpEmitMeshTasksZeroSuccess) { EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_5)); } +TEST_F(ValidateMeshShading, MeshOutputScalar) { + const std::string body = R"( + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %x + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 3 + OpExecutionMode %main OutputPrimitivesEXT 1 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %x Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%uint_3 = OpConstant %uint 3 +%o_ptr = OpTypePointer Output %uint + %x = OpVariable %o_ptr Output + %main = OpFunction %void None %4 + %6 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("In the MeshEXT Execution Mode, all Output Variables " + "must contain an Array.")); +} + +TEST_F(ValidateMeshShading, MeshOutputScalarStruct) { + const std::string body = R"( + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %vertexOutput + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 3 + OpExecutionMode %main OutputPrimitivesEXT 1 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %VertexOutput Block + OpMemberDecorate %VertexOutput 0 Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%VertexOutput = OpTypeStruct %v4float +%_ptr_Output_uint_3 = OpTypePointer Output %VertexOutput +%vertexOutput = OpVariable %_ptr_Output_uint_3 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %4 + %6 = OpLabel + OpSetMeshOutputsEXT %uint_3 %uint_1 + %21 = OpAccessChain %_ptr_Output_v4float %vertexOutput %int_0 + OpStore %21 %19 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("In the MeshEXT Execution Mode, all Output Variables " + "must contain an Array.")); +} + TEST_F(ValidateMeshShading, BadPerPrimitiveEXTStorageClassInMeshEXT) { const std::string body = R"( OpCapability MeshShadingEXT @@ -982,6 +1158,231 @@ TEST_F(ValidateMeshShading, PerPrimitiveEXTStorageClassInMeshEXT) { EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_5)); } +TEST_F(ValidateMeshShading, MeshWriteOutput) { + const std::string body = R"( + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %x %y + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 3 + OpExecutionMode %main OutputPrimitivesEXT 1 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %x Location 1 + OpDecorate %y Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %x = OpVariable %_ptr_Output__arr_uint_uint_3 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 + %y = OpVariable %_ptr_Output__arr_v4float_uint_3 Output + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %4 + %6 = OpLabel + %16 = OpAccessChain %_ptr_Output_uint %x %int_0 + OpStore %16 %uint_1 + %25 = OpAccessChain %_ptr_Output_v4float %y %int_0 + OpStore %25 %23 + OpSetMeshOutputsEXT %uint_3 %uint_1 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3)); +} + +TEST_F(ValidateMeshShading, MeshReadOutputInt) { + const std::string body = R"( + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %x + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 3 + OpExecutionMode %main OutputPrimitivesEXT 1 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %x Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %x = OpVariable %_ptr_Output__arr_uint_uint_3 Output + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %4 + %6 = OpLabel + %y = OpVariable %_ptr_Function_uint Function + %18 = OpAccessChain %_ptr_Output_uint %x %int_1 + %19 = OpLoad %uint %18 + OpStore %y %19 + OpSetMeshOutputsEXT %uint_3 %uint_1 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-MeshEXT-07107")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Output Storage Class in a Mesh Execution Model " + "must not be read from")); +} + +TEST_F(ValidateMeshShading, MeshReadOutputVec) { + const std::string body = R"( + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + %2 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %x + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 3 + OpExecutionMode %main OutputPrimitivesEXT 1 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %x Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 + %x = OpVariable %_ptr_Output__arr_v4float_uint_3 Output + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %4 + %6 = OpLabel + %y = OpVariable %_ptr_Function_v4float Function + %20 = OpAccessChain %_ptr_Output_v4float %x %int_1 + %21 = OpLoad %v4float %20 + OpStore %y %21 + OpSetMeshOutputsEXT %uint_3 %uint_1 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-MeshEXT-07107")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Output Storage Class in a Mesh Execution Model " + "must not be read from")); +} + +TEST_F(ValidateMeshShading, MeshReadOutputStruct) { + const std::string body = R"( + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + %2 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %x_0 + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 3 + OpExecutionMode %main OutputPrimitivesEXT 1 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %x_0 Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %Bar = OpTypeStruct %uint + %Foo = OpTypeStruct %Bar + %uint_3 = OpConstant %uint 3 +%_arr_Foo_uint_3 = OpTypeArray %Foo %uint_3 +%_ptr_Output__arr_Foo_uint_3 = OpTypePointer Output %_arr_Foo_uint_3 + %x_0 = OpVariable %_ptr_Output__arr_Foo_uint_3 Output + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %4 + %6 = OpLabel + %x = OpVariable %_ptr_Function_uint Function + %21 = OpAccessChain %_ptr_Output_uint %x_0 %int_2 %int_0 %int_0 + %22 = OpLoad %uint %21 + OpStore %x %22 + OpSetMeshOutputsEXT %uint_3 %uint_1 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-MeshEXT-07107")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Output Storage Class in a Mesh Execution Model " + "must not be read from")); +} + +TEST_F(ValidateMeshShading, MeshReadOutputIntUntyped) { + const std::string body = R"( + OpCapability MeshShadingEXT + OpCapability UntypedPointersKHR + OpExtension "SPV_EXT_mesh_shader" + OpExtension "SPV_KHR_untyped_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %x + OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1 + OpExecutionMode %main OutputVertices 3 + OpExecutionMode %main OutputPrimitivesEXT 1 + OpExecutionMode %main OutputTrianglesEXT + OpDecorate %x Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %x = OpVariable %_ptr_Output__arr_uint_uint_3 Output + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Output_uint = OpTypeUntypedPointerKHR Output + %main = OpFunction %void None %4 + %6 = OpLabel + %y = OpVariable %_ptr_Function_uint Function + %18 = OpUntypedAccessChainKHR %_ptr_Output_uint %_arr_uint_uint_3 %x %int_1 + %19 = OpLoad %uint %18 + OpStore %y %19 + OpSetMeshOutputsEXT %uint_3 %uint_1 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(body, SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("In Vulkan, untyped pointers can only be used in an " + "explicitly laid out storage class")); +} + } // namespace } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_misc_test.cpp b/third_party/spirv-tools/test/val/val_misc_test.cpp index f645512c45..f54b20cdcf 100644 --- a/third_party/spirv-tools/test/val/val_misc_test.cpp +++ b/third_party/spirv-tools/test/val/val_misc_test.cpp @@ -444,6 +444,61 @@ OpFunctionEnd)"; "before LocalSizeId constant value")); } +TEST_F(ValidateMisc, CoopMatDeviceScope) { + const std::string body = R"( + OpCapability Shader + OpCapability Float16 + OpCapability VulkanMemoryModel + OpCapability CooperativeMatrixKHR + OpExtension "SPV_KHR_cooperative_matrix" + OpMemoryModel Logical Vulkan + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 32 1 1 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %InputA Block + OpMemberDecorate %InputA 0 Offset 0 + OpDecorate %_ Binding 0 + OpDecorate %_ DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %4 = OpTypeFunction %void + %half = OpTypeFloat 16 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_16 = OpConstant %uint 16 + %uint_0 = OpConstant %uint 0 + ;; Using Device Scope + %12 = OpTypeCooperativeMatrixKHR %half %uint_1 %uint_16 %uint_16 %uint_0 +%_ptr_Function_12 = OpTypePointer Function %12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %InputA = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_InputA = OpTypePointer StorageBuffer %InputA + %_ = OpVariable %_ptr_StorageBuffer_InputA StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_5 = OpConstant %uint 5 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %v3uint = OpTypeVector %uint 3 + %uint_32 = OpConstant %uint 32 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_32 %uint_1 %uint_1 + %main = OpFunction %void None %4 + %6 = OpLabel + %A = OpVariable %_ptr_Function_12 Function + %23 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 %uint_0 + %24 = OpCooperativeMatrixLoadKHR %12 %23 %int_0 %uint_16 MakePointerVisible|NonPrivatePointer %uint_5 + OpStore %A %24 + OpReturn + OpFunctionEnd)"; + + CompileSuccessfully(body.c_str(), SPV_ENV_VULKAN_1_3); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-Scope-12243")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpTypeCooperativeMatrixKHR Scope is limited to " + "Workgroup and Subgroup")); +} + } // namespace } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_modes_test.cpp b/third_party/spirv-tools/test/val/val_modes_test.cpp index 293940c80c..01e215cb9f 100644 --- a/third_party/spirv-tools/test/val/val_modes_test.cpp +++ b/third_party/spirv-tools/test/val/val_modes_test.cpp @@ -64,7 +64,7 @@ OpEntryPoint GLCompute %main "main" CompileSuccessfully(spirv, env); EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(env)); EXPECT_THAT(getDiagnosticString(), - AnyVUID("VUID-StandaloneSpirv-LocalSize-06426")); + AnyVUID("VUID-StandaloneSpirv-None-10685")); EXPECT_THAT( getDiagnosticString(), HasSubstr( @@ -73,6 +73,53 @@ OpEntryPoint GLCompute %main "main" "or an object decorated with WorkgroupSize must be specified.")); } +TEST_F(ValidateMode, MeshNoModeVulkan) { + const std::string spirv = R"( +OpCapability Shader +OpCapability MeshShadingEXT +OpExtension "SPV_EXT_mesh_shader" +OpMemoryModel Logical GLSL450 +OpEntryPoint MeshEXT %main "main" +OpExecutionMode %main OutputVertices 81 +OpExecutionMode %main OutputPrimitivesEXT 16 +OpExecutionMode %main OutputPoints +)" + kVoidFunction; + + spv_target_env env = SPV_ENV_VULKAN_1_3; + CompileSuccessfully(spirv, env); + EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(env)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-None-10685")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In the Vulkan environment, MeshEXT execution model entry " + "points require either the LocalSize or LocalSizeId execution mode " + "or an object decorated with WorkgroupSize must be specified.")); +} + +TEST_F(ValidateMode, TaskNoModeVulkan) { + const std::string spirv = R"( +OpCapability Shader +OpCapability MeshShadingEXT +OpExtension "SPV_EXT_mesh_shader" +OpMemoryModel Logical GLSL450 +OpEntryPoint TaskEXT %main "main" +)" + kVoidFunction; + + spv_target_env env = SPV_ENV_VULKAN_1_3; + CompileSuccessfully(spirv, env); + EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(env)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-None-10685")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "In the Vulkan environment, TaskEXT execution model entry " + "points require either the LocalSize or LocalSizeId execution mode " + "or an object decorated with WorkgroupSize must be specified.")); +} + TEST_F(ValidateMode, GLComputeNoModeVulkanWorkgroupSize) { const std::string spirv = R"( OpCapability Shader @@ -183,6 +230,83 @@ OpDecorate %var BuiltIn WorkgroupSize EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } +TEST_F(ValidateMode, GLComputeWorkgroupSizeDerivativeGroupQuads) { + const std::string spirv = R"( +OpCapability Shader +OpCapability ComputeDerivativeGroupQuadsKHR +OpExtension "SPV_KHR_compute_shader_derivatives" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main DerivativeGroupQuadsKHR +OpDecorate %int3_1 BuiltIn WorkgroupSize +%int = OpTypeInt 32 0 +%int3 = OpTypeVector %int 3 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int3_1 = OpConstantComposite %int3 %int_1 %int_2 %int_1 +)" + kVoidFunction; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-DerivativeGroupQuadsKHR-10151")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("WorkgroupSize decorations has a static dimensions of (X = 1, " + "Y = 2) but Entry Point id 1 has an DerivativeGroupQuadsKHR " + "execution mode, so both dimensions must be a multiple of 2")); +} + +TEST_F(ValidateMode, GLComputeWorkgroupSizeDerivativeGroupLinear) { + const std::string spirv = R"( +OpCapability Shader +OpCapability ComputeDerivativeGroupLinearKHR +OpExtension "SPV_KHR_compute_shader_derivatives" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main DerivativeGroupLinearKHR +OpDecorate %int3_1 BuiltIn WorkgroupSize +%int = OpTypeInt 32 0 +%uvec3 = OpTypeVector %int 3 +%int_3 = OpConstant %int 3 +%int_2 = OpConstant %int 2 +%int3_1 = OpConstantComposite %uvec3 %int_3 %int_3 %int_2 +)" + kVoidFunction; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-DerivativeGroupLinearKHR-10152")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "WorkgroupSize decorations has a static dimensions of (X = 3, Y = 3, " + "Z = 2) but Entry Point id 1 has an DerivativeGroupLinearKHR " + "execution mode, so the product (18) must be a multiple of 4")); +} + +TEST_F(ValidateMode, GLComputeWorkgroupSizeDerivativeGroupQuadsOverride) { + // "If an object is decorated with the WorkgroupSize decoration, this takes + // precedence over any LocalSize or LocalSizeId execution mode." + const std::string spirv = R"( +OpCapability Shader +OpCapability ComputeDerivativeGroupQuadsKHR +OpExtension "SPV_KHR_compute_shader_derivatives" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main DerivativeGroupQuadsKHR +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %int3_1 BuiltIn WorkgroupSize +%int = OpTypeInt 32 0 +%int3 = OpTypeVector %int 3 +%int_2 = OpConstant %int 2 +%int3_1 = OpConstantComposite %int3 %int_2 %int_2 %int_2 +)" + kVoidFunction; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1); + EXPECT_THAT(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + TEST_F(ValidateMode, GLComputeVulkanLocalSize) { const std::string spirv = R"( OpCapability Shader @@ -228,6 +352,65 @@ OpExecutionMode %main LocalSize 1 1 0 HasSubstr("Local Size execution mode must not have a product of zero")); } +TEST_F(ValidateMode, GLComputeLocalSizeDerivativeGroupQuads) { + const std::string spirv = R"( +OpCapability Shader +OpCapability ComputeDerivativeGroupQuadsKHR +OpExtension "SPV_KHR_compute_shader_derivatives" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpExecutionMode %main DerivativeGroupQuadsKHR +)" + kVoidFunction; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-DerivativeGroupQuadsKHR-10151")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Local Size execution mode dimensions is (X = 1, Y = 1) but " + "Entry Point id 1 also has an DerivativeGroupQuadsKHR " + "execution mode, so both dimensions must be a multiple of 2")); +} + +TEST_F(ValidateMode, GLComputeLocalSizeDerivativeGroupLinear) { + const std::string spirv = R"( +OpCapability Shader +OpCapability ComputeDerivativeGroupLinearKHR +OpExtension "SPV_KHR_compute_shader_derivatives" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main DerivativeGroupLinearKHR +OpExecutionMode %main LocalSize 3 3 3 +)" + kVoidFunction; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-DerivativeGroupLinearKHR-10152")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Local Size execution mode dimensions is (X = 3, Y = 3, Z = 3) " + "but Entry Point id 1 also has an DerivativeGroupLinearKHR " + "execution mode, so the product (27) must be a multiple of 4")); +} + +TEST_F(ValidateMode, GLComputeLocalSizeDerivativeGroupQuadsCapabiltyOnly) { + // Declares capability but doesn't have OpExecutionMode + const std::string spirv = R"( +OpCapability Shader +OpCapability ComputeDerivativeGroupQuadsKHR +OpExtension "SPV_KHR_compute_shader_derivatives" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +)" + kVoidFunction; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + EXPECT_THAT(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + TEST_F(ValidateMode, GLComputeVulkanLocalSizeIdBad) { const std::string spirv = R"( OpCapability Shader @@ -278,8 +461,7 @@ OpExecutionModeId %main LocalSizeId %int_1 %int_0 %int_1 EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(env)); EXPECT_THAT( getDiagnosticString(), - HasSubstr( - "Local Size Id execution mode must not have a product of zero")); + HasSubstr("LocalSizeId execution mode must not have a product of zero")); } TEST_F(ValidateMode, GLComputeZeroSpecLocalSizeId) { @@ -316,8 +498,7 @@ OpExecutionModeId %main LocalSizeId %int_1 %int_0 %int_1 EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(env)); EXPECT_THAT( getDiagnosticString(), - HasSubstr( - "Local Size Id execution mode must not have a product of zero")); + HasSubstr("LocalSizeId execution mode must not have a product of zero")); } // https://github.com/KhronosGroup/SPIRV-Tools/issues/5939 @@ -351,6 +532,55 @@ TEST_F(ValidateMode, KernelZeroLocalSize64) { EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } +TEST_F(ValidateMode, GLComputeLocalSizeIdDerivativeGroupQuads) { + const std::string spirv = R"( +OpCapability Shader +OpCapability ComputeDerivativeGroupQuadsKHR +OpExtension "SPV_KHR_compute_shader_derivatives" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionModeId %main LocalSizeId %int_2 %int_1 %int_2 +OpExecutionMode %main DerivativeGroupQuadsKHR +%int = OpTypeInt 32 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +)" + kVoidFunction; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_3); + EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-DerivativeGroupQuadsKHR-10151")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("LocalSizeId execution mode dimensions is (X = 2, Y = 1) but " + "Entry Point id 1 also has an DerivativeGroupQuadsKHR " + "execution mode, so both dimensions must be a multiple of 2")); +} + +TEST_F(ValidateMode, GLComputeLocalSizeIdDerivativeGroupLinear) { + const std::string spirv = R"( +OpCapability Shader +OpCapability ComputeDerivativeGroupLinearKHR +OpExtension "SPV_KHR_compute_shader_derivatives" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionModeId %main LocalSizeId %int_1 %int_1 %int_1 +OpExecutionMode %main DerivativeGroupLinearKHR +%int = OpTypeInt 32 0 +%int_1 = OpConstant %int 1 +)" + kVoidFunction; + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_3); + EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_3)); + EXPECT_THAT(getDiagnosticString(), + AnyVUID("VUID-StandaloneSpirv-DerivativeGroupLinearKHR-10152")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("LocalSizeId execution mode dimensions is (X = 1, Y = 1, Z = " + "1) but Entry Point id 1 also has an DerivativeGroupLinearKHR " + "execution mode, so the product (1) must be a multiple of 4")); +} + TEST_F(ValidateMode, FragmentOriginLowerLeftVulkan) { const std::string spirv = R"( OpCapability Shader @@ -2543,8 +2773,8 @@ const std::string kNodeShaderPostlude = R"( %node1 = OpConstantStringAMDX "node1" %node2 = OpConstantStringAMDX "node2" %S = OpTypeStruct -%_payloadarr_S = OpTypeNodePayloadArrayAMDX %S %_payloadarr_S_0 = OpTypeNodePayloadArrayAMDX %S +%_payloadarr_S = OpTypeNodePayloadArrayAMDX %S %bool = OpTypeBool %true = OpConstantTrue %bool %void = OpTypeVoid @@ -2743,7 +2973,6 @@ OpCapability TileShadingQCOM OpExtension "SPV_QCOM_tile_shading" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" -OpExecutionMode %main NonCoherentTileAttachmentReadQCOM )" + kVoidFunction; spv_target_env env = SPV_ENV_VULKAN_1_4; diff --git a/third_party/spirv-tools/test/val/val_non_uniform_test.cpp b/third_party/spirv-tools/test/val/val_non_uniform_test.cpp index 530676d5e4..b9ea5da2c6 100644 --- a/third_party/spirv-tools/test/val/val_non_uniform_test.cpp +++ b/third_party/spirv-tools/test/val/val_non_uniform_test.cpp @@ -958,7 +958,7 @@ OpFunctionEnd ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); EXPECT_THAT( getDiagnosticString(), - HasSubstr("Before SPIR-V 1.5, Id must be a constant instruction")); + HasSubstr("In SPIR-V 1.4 or earlier, Id must be a constant instruction")); } TEST_F(ValidateGroupNonUniform, BroadcastNonConstantSpv1p5) { @@ -1028,7 +1028,8 @@ OpFunctionEnd ValidateInstructions(SPV_ENV_UNIVERSAL_1_4)); EXPECT_THAT( getDiagnosticString(), - HasSubstr("Before SPIR-V 1.5, Index must be a constant instruction")); + HasSubstr( + "In SPIR-V 1.4 or earlier, Index must be a constant instruction")); } TEST_F(ValidateGroupNonUniform, QuadBroadcastNonConstantSpv1p5) { diff --git a/third_party/spirv-tools/test/val/val_ray_tracing_reorder_test.cpp b/third_party/spirv-tools/test/val/val_ray_tracing_reorder_test.cpp index a41af80c91..4c6f4f04ae 100644 --- a/third_party/spirv-tools/test/val/val_ray_tracing_reorder_test.cpp +++ b/third_party/spirv-tools/test/val/val_ray_tracing_reorder_test.cpp @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Tests instructions from SPV_NV_shader_invocation_reorder. +// Tests instructions from SPV_NV_shader_invocation_reorder and +// SPV_EXT_shader_invocation_reorder. #include #include @@ -791,6 +792,778 @@ TEST_F(ValidateRayTracingReorderNV, LSSIsLSSHitNV) { SPV_ENV_VULKAN_1_2); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); } + +// EXT Extension Tests +using ValidateRayTracingReorderEXT = spvtest::ValidateBase; + +std::string GenerateReorderThreadCodeEXT(const std::string& body = "", + const std::string& declarations = "", + const std::string& extensions = "", + const std::string& capabilities = "") { + std::ostringstream ss; + ss << R"( + OpCapability RayTracingKHR + OpCapability ShaderInvocationReorderEXT + )"; + ss << capabilities; + ss << R"( + OpExtension "SPV_KHR_ray_tracing" + OpExtension "SPV_EXT_shader_invocation_reorder" + )"; + ss << extensions; + ss << R"( + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint RayGenerationNV %main "main" %hObj + OpSourceExtension "GL_EXT_ray_tracing" + OpSourceExtension "GL_EXT_shader_invocation_reorder" + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %6 = OpTypeHitObjectEXT +%_ptr_Private_6 = OpTypePointer Private %6 + %hObj = OpVariable %_ptr_Private_6 Private + )"; + ss << declarations; + + ss << R"( + %main = OpFunction %void None %3 + %5 = OpLabel + )"; + + ss << body; + + ss << R"( + OpReturn + OpFunctionEnd + )"; + return ss.str(); +} + +std::string GenerateReorderShaderCodeEXT(const std::string& body = "", + const std::string& declarations = "", + const std::string& extensions = "", + const std::string& capabilties = "") { + std::ostringstream ss; + ss << R"( + OpCapability RayTracingKHR + OpCapability ShaderInvocationReorderEXT + )"; + ss << capabilties; + ss << R"( OpExtension "SPV_KHR_ray_tracing" + OpExtension "SPV_EXT_shader_invocation_reorder" + )"; + ss << extensions; + ss << R"( + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint RayGenerationKHR %main "main" %attr %_ %hObj %payload %__0 %as %__1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_ray_tracing" + OpSourceExtension "GL_EXT_shader_invocation_reorder" + OpName %main "main" + OpName %attr "attr" + OpName %hBlock "hBlock" + OpMemberName %hBlock 0 "attrval" + OpName %_ "" + OpName %hObj "hObj" + OpName %payload "payload" + OpName %pBlock "pBlock" + OpMemberName %pBlock 0 "val1" + OpMemberName %pBlock 1 "val2" + OpName %__0 "" + OpName %as "as" + OpName %block "block" + OpMemberName %block 0 "op" + OpName %__1 "" + OpDecorate %hBlock Block + OpDecorate %pBlock Block + OpDecorate %as DescriptorSet 0 + OpDecorate %as Binding 0 + OpMemberDecorate %block 0 Offset 0 + OpDecorate %block Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_HitObjectAttributeEXT_v2float = OpTypePointer HitObjectAttributeEXT %v2float + %attr = OpVariable %_ptr_HitObjectAttributeEXT_v2float HitObjectAttributeEXT + %float_1 = OpConstant %float 1 + %11 = OpConstantComposite %v2float %float_1 %float_1 + %hBlock = OpTypeStruct %float +%_ptr_HitObjectAttributeEXT_hBlock = OpTypePointer HitObjectAttributeEXT %hBlock + %_ = OpVariable %_ptr_HitObjectAttributeEXT_hBlock HitObjectAttributeEXT + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_2 = OpConstant %float 2 +%_ptr_HitObjectAttributeEXT_float = OpTypePointer HitObjectAttributeEXT %float + %20 = OpTypeHitObjectEXT + %_ptr_Private_20 = OpTypePointer Private %20 + %hObj = OpVariable %_ptr_Private_20 Private + %23 = OpTypeAccelerationStructureKHR + %_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 + %as = OpVariable %_ptr_UniformConstant_23 UniformConstant + %v4float = OpTypeVector %float 4 +%_ptr_RayPayloadKHR_v4float = OpTypePointer RayPayloadKHR %v4float + %payload = OpVariable %_ptr_RayPayloadKHR_v4float RayPayloadKHR + %pBlock = OpTypeStruct %v2float %v2float +%_ptr_RayPayloadKHR_pBlock = OpTypePointer RayPayloadKHR %pBlock + %__0 = OpVariable %_ptr_RayPayloadKHR_pBlock RayPayloadKHR + %block = OpTypeStruct %float +%_ptr_StorageBuffer_block = OpTypePointer StorageBuffer %block + %__1 = OpVariable %_ptr_StorageBuffer_block StorageBuffer + )"; + + ss << declarations; + + ss << R"( + %main = OpFunction %void None %3 + %5 = OpLabel + )"; + + ss << body; + + ss << R"( + OpReturn + OpFunctionEnd)"; + return ss.str(); +} + +TEST_F(ValidateRayTracingReorderEXT, ReorderThreadWithHintEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + )"; + + const std::string body = R"( + OpReorderThreadWithHintEXT %uint_4 %uint_4 + )"; + + CompileSuccessfully(GenerateReorderThreadCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, ReorderThreadWithHitObjectEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + )"; + + const std::string body = R"( + OpReorderThreadWithHitObjectEXT %hObj + OpReorderThreadWithHitObjectEXT %hObj %uint_4 %uint_2 + )"; + + CompileSuccessfully(GenerateReorderThreadCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectTraceRayEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %v3float = OpTypeVector %float 3 + %float_0_5 = OpConstant %float 0.5 + %31 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %32 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int_1 = OpConstant %int 1 + )"; + + const std::string body = R"( + OpStore %attr %11 + %26 = OpLoad %23 %as + OpHitObjectTraceRayEXT %hObj %26 %uint_1 %uint_1 %uint_1 %uint_1 %uint_1 %31 %float_0_5 %32 %float_1 %payload + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectTraceRayMotionEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %v3float = OpTypeVector %float 3 + %float_0_5 = OpConstant %float 0.5 + %31 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %32 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_10 = OpConstant %float 10 + %int_2 = OpConstant %int 2 + )"; + + const std::string body = R"( + OpStore %attr %11 + %26 = OpLoad %23 %as + OpHitObjectTraceRayMotionEXT %hObj %26 %uint_1 %uint_1 %uint_1 %uint_1 %uint_1 %31 %float_0_5 %32 %float_1 %float_10 %__0 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectRecordEmptyEXT) { + const std::string body = R"( + OpHitObjectRecordEmptyEXT %hObj + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectRecordMissEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %v3float = OpTypeVector %float 3 + %float_0_5 = OpConstant %float 0.5 + %29 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %float_1_5 = OpConstant %float 1.5 + %31 = OpConstantComposite %v3float %float_1_5 %float_1_5 %float_1_5 + %float_5 = OpConstant %float 5 + )"; + + const std::string body = R"( + OpHitObjectRecordMissEXT %hObj %uint_1 %uint_1 %29 %float_2 %31 %float_5 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectIsHitEXT) { + const std::string declarations = R"( + %bool = OpTypeBool + %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + )"; + + const std::string body = R"( + %26 = OpHitObjectIsHitEXT %bool %hObj + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + %33 = OpAccessChain %_ptr_StorageBuffer_float %__1 %int_0 + OpStore %33 %float_1 + OpBranch %28 + %28 = OpLabel + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectIsMissEXT) { + const std::string declarations = R"( + %bool = OpTypeBool + %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + )"; + + const std::string body = R"( + %26 = OpHitObjectIsMissEXT %bool %hObj + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + %33 = OpAccessChain %_ptr_StorageBuffer_float %__1 %int_0 + OpStore %33 %float_1 + OpBranch %28 + %28 = OpLabel + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectIsEmptyEXT) { + const std::string declarations = R"( + %bool = OpTypeBool + %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + )"; + + const std::string body = R"( + %26 = OpHitObjectIsEmptyEXT %bool %hObj + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + %33 = OpAccessChain %_ptr_StorageBuffer_float %__1 %int_0 + OpStore %33 %float_1 + OpBranch %28 + %28 = OpLabel + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetGeometryIndexEXT) { + const std::string declarations = R"( + %_ptr_Function_int = OpTypePointer Function %int + )"; + + const std::string body = R"( + %id = OpVariable %_ptr_Function_int Function + %12 = OpHitObjectGetGeometryIndexEXT %int %hObj + OpStore %id %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetPrimitiveIndexEXT) { + const std::string declarations = R"( + %_ptr_Function_int = OpTypePointer Function %int + )"; + + const std::string body = R"( + %id = OpVariable %_ptr_Function_int Function + %12 = OpHitObjectGetPrimitiveIndexEXT %int %hObj + OpStore %id %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetInstanceIdEXT) { + const std::string declarations = R"( + %_ptr_Function_int = OpTypePointer Function %int + )"; + + const std::string body = R"( + %id = OpVariable %_ptr_Function_int Function + %12 = OpHitObjectGetInstanceIdEXT %int %hObj + OpStore %id %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetInstanceCustomIndexEXT) { + const std::string declarations = R"( + %_ptr_Function_int = OpTypePointer Function %int + )"; + + const std::string body = R"( + %id = OpVariable %_ptr_Function_int Function + %12 = OpHitObjectGetInstanceCustomIndexEXT %int %hObj + OpStore %id %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetHitKindEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %_ptr_Function_uint = OpTypePointer Function %uint + )"; + + const std::string body = R"( + %uid = OpVariable %_ptr_Function_uint Function + %12 = OpHitObjectGetHitKindEXT %uint %hObj + OpStore %uid %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetCurrentTimeEXT) { + const std::string declarations = R"( + %_ptr_Function_float = OpTypePointer Function %float + )"; + + const std::string body = R"( + %time = OpVariable %_ptr_Function_float Function + %12 = OpHitObjectGetCurrentTimeEXT %float %hObj + OpStore %time %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetObjectRayOriginEXT) { + const std::string declarations = R"( + %v3float = OpTypeVector %float 3 + %_ptr_Function_v3float = OpTypePointer Function %v3float + )"; + + const std::string body = R"( + %oorig = OpVariable %_ptr_Function_v3float Function + %13 = OpHitObjectGetObjectRayOriginEXT %v3float %hObj + OpStore %oorig %13 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetObjectRayDirectionEXT) { + const std::string declarations = R"( + %v3float = OpTypeVector %float 3 + %_ptr_Function_v3float = OpTypePointer Function %v3float + )"; + + const std::string body = R"( + %odir = OpVariable %_ptr_Function_v3float Function + %13 = OpHitObjectGetObjectRayDirectionEXT %v3float %hObj + OpStore %odir %13 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetRayTMaxEXT) { + const std::string declarations = R"( + %_ptr_Function_float = OpTypePointer Function %float + )"; + + const std::string body = R"( + %tmax = OpVariable %_ptr_Function_float Function + %12 = OpHitObjectGetRayTMaxEXT %float %hObj + OpStore %tmax %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetRayTMinEXT) { + const std::string declarations = R"( + %_ptr_Function_float = OpTypePointer Function %float + )"; + + const std::string body = R"( + %tmin = OpVariable %_ptr_Function_float Function + %12 = OpHitObjectGetRayTMinEXT %float %hObj + OpStore %tmin %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetRayFlagsEXT) { + const std::string declarations = R"( + %_ptr_Function_int = OpTypePointer Function %int + )"; + + const std::string body = R"( + %flags = OpVariable %_ptr_Function_int Function + %12 = OpHitObjectGetRayFlagsEXT %int %hObj + OpStore %flags %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetWorldRayOriginEXT) { + const std::string declarations = R"( + %v3float = OpTypeVector %float 3 + %_ptr_Function_v3float = OpTypePointer Function %v3float + )"; + + const std::string body = R"( + %orig = OpVariable %_ptr_Function_v3float Function + %13 = OpHitObjectGetWorldRayOriginEXT %v3float %hObj + OpStore %orig %13 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetWorldRayDirectionEXT) { + const std::string declarations = R"( + %v3float = OpTypeVector %float 3 + %_ptr_Function_v3float = OpTypePointer Function %v3float + )"; + + const std::string body = R"( + %dir = OpVariable %_ptr_Function_v3float Function + %13 = OpHitObjectGetWorldRayDirectionEXT %v3float %hObj + OpStore %dir %13 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetObjectToWorldEXT) { + const std::string declarations = R"( + %v3float = OpTypeVector %float 3 + %mat4v3float = OpTypeMatrix %v3float 4 + %_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + )"; + + const std::string body = R"( + %otw = OpVariable %_ptr_Function_mat4v3float Function + %14 = OpHitObjectGetObjectToWorldEXT %mat4v3float %hObj + OpStore %otw %14 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetWorldToObjectEXT) { + const std::string declarations = R"( + %v3float = OpTypeVector %float 3 + %mat4v3float = OpTypeMatrix %v3float 4 + %_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + )"; + + const std::string body = R"( + %wto = OpVariable %_ptr_Function_mat4v3float Function + %14 = OpHitObjectGetWorldToObjectEXT %mat4v3float %hObj + OpStore %wto %14 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetShaderRecordBufferHandleEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %_ptr_Function_v2uint = OpTypePointer Function %v2uint + )"; + + const std::string body = R"( + %handle = OpVariable %_ptr_Function_v2uint Function + %13 = OpHitObjectGetShaderRecordBufferHandleEXT %v2uint %hObj + OpStore %handle %13 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, + HitObjectGetShaderBindingTableRecordIndexEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %_ptr_Function_uint = OpTypePointer Function %uint + )"; + + const std::string body = R"( + %rid = OpVariable %_ptr_Function_uint Function + %12 = OpHitObjectGetShaderBindingTableRecordIndexEXT %uint %hObj + OpStore %rid %12 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, + HitObjectSetShaderBindingTableRecordIndexEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 + )"; + + const std::string body = R"( + OpHitObjectSetShaderBindingTableRecordIndexEXT %hObj %uint_5 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectGetAttributesEXT) { + const std::string body = R"( + OpHitObjectGetAttributesEXT %hObj %attr + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectExecuteShaderEXT) { + const std::string body = R"( + OpHitObjectExecuteShaderEXT %hObj %payload + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, + HitObjectGetIntersectionTriangleVertexPositionsEXT) { + const std::string declarations = R"( + %v3float = OpTypeVector %float 3 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %arr_3_v3float = OpTypeArray %v3float %uint_3 + %_ptr_Function_arr_3_v3float = OpTypePointer Function %arr_3_v3float + )"; + + const std::string body = R"( + %vertices = OpVariable %_ptr_Function_arr_3_v3float Function + %result = OpHitObjectGetIntersectionTriangleVertexPositionsEXT %arr_3_v3float %hObj + OpStore %vertices %result + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectRecordFromQueryEXT) { + const std::string cap = R"( + OpCapability RayQueryKHR + )"; + const std::string extensions = R"( + OpExtension "SPV_KHR_ray_query" + )"; + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 + %rayquery_type = OpTypeRayQueryKHR + %_ptr_Function_rayquery = OpTypePointer Function %rayquery_type + )"; + + const std::string body = R"( + %ray_query = OpVariable %_ptr_Function_rayquery Function + OpHitObjectRecordFromQueryEXT %hObj %ray_query %uint_5 %attr + )"; + + CompileSuccessfully( + GenerateReorderShaderCodeEXT(body, declarations, extensions, cap).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectRecordMissMotionEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %v3float = OpTypeVector %float 3 + %float_0_5 = OpConstant %float 0.5 + %29 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %float_1_5 = OpConstant %float 1.5 + %31 = OpConstantComposite %v3float %float_1_5 %float_1_5 %float_1_5 + %float_5 = OpConstant %float 5 + %float_10 = OpConstant %float 10 + )"; + + const std::string body = R"( + OpHitObjectRecordMissMotionEXT %hObj %uint_1 %uint_1 %29 %float_2 %31 %float_5 %float_10 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +// Fused Hit Object Instructions Tests + +TEST_F(ValidateRayTracingReorderEXT, HitObjectReorderExecuteShaderEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + )"; + + const std::string body = R"( + OpHitObjectReorderExecuteShaderEXT %hObj %payload + OpHitObjectReorderExecuteShaderEXT %hObj %payload %uint_4 %uint_2 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectTraceReorderExecuteEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %v3float = OpTypeVector %float 3 + %float_0_5 = OpConstant %float 0.5 + %31 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %32 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int_1 = OpConstant %int 1 + )"; + + const std::string body = R"( + OpStore %attr %11 + %26 = OpLoad %23 %as + OpHitObjectTraceReorderExecuteEXT %hObj %26 %uint_1 %uint_1 %uint_1 %uint_1 %uint_1 %31 %float_0_5 %32 %float_1 %payload + OpHitObjectTraceReorderExecuteEXT %hObj %26 %uint_1 %uint_1 %uint_1 %uint_1 %uint_1 %31 %float_0_5 %32 %float_1 %payload %uint_4 %uint_2 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + +TEST_F(ValidateRayTracingReorderEXT, HitObjectTraceMotionReorderExecuteEXT) { + const std::string declarations = R"( + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %v3float = OpTypeVector %float 3 + %float_0_5 = OpConstant %float 0.5 + %31 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %32 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_10 = OpConstant %float 10 + %int_2 = OpConstant %int 2 + )"; + + const std::string body = R"( + OpStore %attr %11 + %26 = OpLoad %23 %as + OpHitObjectTraceMotionReorderExecuteEXT %hObj %26 %uint_1 %uint_1 %uint_1 %uint_1 %uint_1 %31 %float_0_5 %32 %float_1 %float_10 %__0 + OpHitObjectTraceMotionReorderExecuteEXT %hObj %26 %uint_1 %uint_1 %uint_1 %uint_1 %uint_1 %31 %float_0_5 %32 %float_1 %float_10 %__0 %uint_4 %uint_2 + )"; + + CompileSuccessfully(GenerateReorderShaderCodeEXT(body, declarations).c_str(), + SPV_ENV_VULKAN_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); +} + } // namespace } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_tensor_test.cpp b/third_party/spirv-tools/test/val/val_tensor_test.cpp index 19eec4e674..c0dd134e10 100644 --- a/third_party/spirv-tools/test/val/val_tensor_test.cpp +++ b/third_party/spirv-tools/test/val/val_tensor_test.cpp @@ -41,6 +41,8 @@ std::string GenerateModule(const std::string& body) { OpDecorate %tensor_var Binding 0 OpDecorate %tensor_var_float_unranked DescriptorSet 0 OpDecorate %tensor_var_float_unranked Binding 1 + OpDecorate %tensor_var_spec_rank DescriptorSet 0 + OpDecorate %tensor_var_spec_rank Binding 2 %void = OpTypeVoid %uint = OpTypeInt 32 0 %float = OpTypeFloat 32 diff --git a/third_party/spirv-tools/tools/CMakeLists.txt b/third_party/spirv-tools/tools/CMakeLists.txt index f5e830f57c..b1fad95ca7 100644 --- a/third_party/spirv-tools/tools/CMakeLists.txt +++ b/third_party/spirv-tools/tools/CMakeLists.txt @@ -77,7 +77,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) target_include_directories(spirv-cfg PRIVATE ${spirv-tools_SOURCE_DIR} ${SPIRV_HEADER_INCLUDE_DIR}) set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt - spirv-cfg spirv-link spirv-lint) + spirv-cfg spirv-link spirv-lint spirv-diff) if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Android")) add_spvtools_tool(TARGET spirv-objdump diff --git a/third_party/spirv-tools/tools/as/as.cpp b/third_party/spirv-tools/tools/as/as.cpp index f857bac566..833e9292c6 100644 --- a/third_party/spirv-tools/tools/as/as.cpp +++ b/third_party/spirv-tools/tools/as/as.cpp @@ -86,11 +86,13 @@ int main(int, const char** argv) { options |= SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS; } - if (flags::positional_arguments.size() != 1) { - fprintf(stderr, "error: exactly one input file must be specified.\n"); + if (flags::positional_arguments.size() > 1) { + fprintf(stderr, "error: one input file at most must be specified.\n"); return 1; } - std::string inFile = flags::positional_arguments[0]; + std::string inFile = flags::positional_arguments.size() == 1 + ? flags::positional_arguments[0] + : "-"; std::vector contents; if (!ReadTextFile(inFile.c_str(), &contents)) return 1; diff --git a/third_party/spirv-tools/tools/link/linker.cpp b/third_party/spirv-tools/tools/link/linker.cpp index 2f47dd4bb1..9a512d4264 100644 --- a/third_party/spirv-tools/tools/link/linker.cpp +++ b/third_party/spirv-tools/tools/link/linker.cpp @@ -72,6 +72,15 @@ Options (in lexicographical order): be invalid. --verify-ids Verify that IDs in the resulting modules are truly unique. + --fnvar-targets + CSV file specifying OpSpecConditionalTarget parameters for each + linked module. + --fnvar-architectures + CSV file specifying OpSpecConditionalArchitecture parameters for + each linked module. + --fnvar-capabilities + For each function variant, include its required capabilities + under OpSpecConditionalCapabilitiesINTEL. --version Display linker version information. )", @@ -90,6 +99,9 @@ FLAG_LONG_bool( allow_partial_linkage, /* default_value= */ false, FLAG_LONG_bool( allow_pointer_mismatch, /* default_value= */ false, /* required= */ false); FLAG_SHORT_string(o, /* default_value= */ "", /* required= */ false); FLAG_LONG_string( target_env, /* default_value= */ kDefaultEnvironment, /* required= */ false); +FLAG_LONG_string( fnvar_targets, /* default_value= */ "", /* required= */ false); +FLAG_LONG_string( fnvar_architectures, /* default_value= */ "", /* required= */ false); +FLAG_LONG_bool( fnvar_capabilities, /* default_value= */ false, /* required= */ false); FLAG_LONG_bool( use_highest_version, /* default_value= */ false, /* required= */ false); // clang-format on @@ -140,6 +152,33 @@ int main(int, const char* argv[]) { fprintf(stderr, "error: No input file specified\n"); return 1; } + options.SetInFiles(inFiles); + + if (!flags::fnvar_targets.value().empty()) { + std::vector fn_variants_csv_chars; + const bool ret = ReadTextFile(flags::fnvar_targets.value().c_str(), + &fn_variants_csv_chars); + if (!ret) { + return 1; + } + const std::string csv_text(fn_variants_csv_chars.begin(), + fn_variants_csv_chars.end()); + options.SetFnVarTargetsCsv(csv_text); + } + + if (!flags::fnvar_architectures.value().empty()) { + std::vector fn_variants_csv_chars; + const bool ret = ReadTextFile(flags::fnvar_architectures.value().c_str(), + &fn_variants_csv_chars); + if (!ret) { + return 1; + } + const std::string csv_text(fn_variants_csv_chars.begin(), + fn_variants_csv_chars.end()); + options.SetFnVarArchitecturesCsv(csv_text); + } + + options.SetHasFnVarCapabilities(flags::fnvar_capabilities.value()); std::vector> contents(inFiles.size()); for (size_t i = 0u; i < inFiles.size(); ++i) { diff --git a/third_party/spirv-tools/tools/sva/src/spirv.data.js b/third_party/spirv-tools/tools/sva/src/spirv.data.js index 67c0966cdc..4b29a65039 100644 --- a/third_party/spirv-tools/tools/sva/src/spirv.data.js +++ b/third_party/spirv-tools/tools/sva/src/spirv.data.js @@ -4034,6 +4034,18 @@ export default { "ExplicitInterpAMD": { "value": 4999 }, + "ArrayStrideIdEXT": { + "value": 5124, + "params": [ + "IdRef" + ] + }, + "OffsetIdEXT": { + "value": 5125, + "params": [ + "IdRef" + ] + }, "CounterBuffer": { "value": 5634, "params": [ @@ -4379,6 +4391,9 @@ export default { "QuadControlKHR": { "value": 5087 }, + "DescriptorHeapEXT": { + "value": 5128 + }, "FragmentFullyCoveredEXT": { "value": 5265 }, diff --git a/third_party/spirv-tools/tools/val/val.cpp b/third_party/spirv-tools/tools/val/val.cpp index dddfeaed8c..377fd0b1a2 100644 --- a/third_party/spirv-tools/tools/val/val.cpp +++ b/third_party/spirv-tools/tools/val/val.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -27,12 +28,15 @@ void print_usage(char* argv0) { std::string target_env_list = spvTargetEnvList(36, 105); printf( - R"(%s - Validate a SPIR-V binary file. + R"(%s - Validate a SPIR-V binary file(s). -USAGE: %s [options] [] +USAGE: %s [options] [] -The SPIR-V binary is read from . If no file is specified, -or if the filename is "-", then the binary is read from standard input. +The SPIR-V binary is read from . If no path is specified, +or if the path is "-", then the binary is read from standard input. +The parameter may also specify a directory; in this case, +the tool will recursively process all regular files with the .spv +extension within that directory. NOTE: The validator is a work in progress. @@ -79,6 +83,53 @@ Options: argv0, argv0, target_env_list.c_str()); } +bool process_single_file(const char* filename, spv_target_env& target_env, + spvtools::ValidatorOptions& options, + bool use_default_msg_consumer) { + std::vector contents; + if (!ReadBinaryFile(filename, &contents)) return false; + + spvtools::SpirvTools tools(target_env); + + // Use a lambda expression here so filename can be captured. Messages use a + // fairly standard notation of `filename:line`. + auto CLIMessageConsumerWithFilename = + [filename](spv_message_level_t level, const char*, + const spv_position_t& position, const char* message) { + const char* pretty_filename = filename; + if (!filename || 0 == strcmp(filename, "-")) { + pretty_filename = "stdin"; + } + + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + std::cerr << "error: " << pretty_filename << ":" << position.index + << ": " << message << std::endl; + break; + case SPV_MSG_WARNING: + std::cout << "warning: " << pretty_filename << ":" << position.index + << ": " << message << std::endl; + break; + case SPV_MSG_INFO: + std::cout << "info: " << pretty_filename << ":" << position.index + << ": " << message << std::endl; + break; + default: + break; + } + }; + + if (use_default_msg_consumer) { + tools.SetMessageConsumer(spvtools::utils::CLIMessageConsumer); + } else { + tools.SetMessageConsumer(CLIMessageConsumerWithFilename); + } + + return tools.Validate(contents.data(), contents.size(), options); +} + int main(int argc, char** argv) { const char* inFile = nullptr; spv_target_env target_env = SPV_ENV_UNIVERSAL_1_6; @@ -201,13 +252,35 @@ int main(int argc, char** argv) { return return_code; } - std::vector contents; - if (!ReadBinaryFile(inFile, &contents)) return 1; + if (inFile && + std::filesystem::is_directory(std::filesystem::status(inFile))) { + const std::filesystem::path dir(inFile); + bool succeed = true; + for (auto const& entry : + std::filesystem::recursive_directory_iterator(dir)) { + if (!entry.is_regular_file()) { + continue; + } - spvtools::SpirvTools tools(target_env); - tools.SetMessageConsumer(spvtools::utils::CLIMessageConsumer); + std::filesystem::path filepath = entry.path(); - bool succeed = tools.Validate(contents.data(), contents.size(), options); + if (filepath.extension() != ".spv") continue; - return !succeed; + // Copy the string, because in C++20 the result type of + // std::filesystem::path::u8string changes type from std::string to + // std::u8string, and the pointer type ends up incompatible. Normalize + // to std::string first via copying. + const auto filepath_u8str = filepath.u8string(); + const std::string filepath_str(filepath_u8str.begin(), + filepath_u8str.end()); + if (!process_single_file(filepath_str.c_str(), target_env, options, + false)) { + succeed = false; + } + } + + return !succeed; + } + + return !process_single_file(inFile, target_env, options, true); } diff --git a/third_party/spirv-tools/utils/vscode/src/schema/schema.go b/third_party/spirv-tools/utils/vscode/src/schema/schema.go index 4a34feca8d..b7931ae9ee 100755 --- a/third_party/spirv-tools/utils/vscode/src/schema/schema.go +++ b/third_party/spirv-tools/utils/vscode/src/schema/schema.go @@ -30160,6 +30160,20 @@ var ( Parameters: []Parameter{}, Version: "None", }, + Enumerant{ + Enumerant: "ArrayStrideIdEXT", + Value: 5124, + Capabilities: []string{"Shader",}, + Parameters: []Parameter{{OperandKindIdRef, "'Array Stride'"},}, + Version: "1.0", + }, + Enumerant{ + Enumerant: "OffsetIdEXT", + Value: 5125, + Capabilities: []string{"Shader",}, + Parameters: []Parameter{{OperandKindIdRef, "'Byte Offset'"},}, + Version: "1.0", + }, Enumerant{ Enumerant: "OverrideCoverageNV", Value: 5248,