update glslang to slime73/glslang@72d1590 (16.3.0 plus fixes for love)

This commit is contained in:
Sasha Szpakowski
2026-07-24 16:50:17 -03:00
parent 17258d8179
commit b392d21536
63 changed files with 13103 additions and 9272 deletions
+1 -3
View File
@@ -1486,15 +1486,13 @@ add_library(love_3p_glslang
src/libraries/glslang/SPIRV/Logger.cpp
src/libraries/glslang/SPIRV/Logger.h
src/libraries/glslang/SPIRV/NonSemanticDebugPrintf.h
src/libraries/glslang/SPIRV/NonSemanticShaderDebugInfo100.h
src/libraries/glslang/SPIRV/NonSemanticShaderDebugInfo.h
src/libraries/glslang/SPIRV/spirv.hpp11
src/libraries/glslang/SPIRV/SpvBuilder.cpp
src/libraries/glslang/SPIRV/SpvBuilder.h
src/libraries/glslang/SPIRV/spvIR.h
src/libraries/glslang/SPIRV/spvUtil.h
src/libraries/glslang/SPIRV/SpvPostProcess.cpp
src/libraries/glslang/SPIRV/SPVRemapper.cpp
src/libraries/glslang/SPIRV/SPVRemapper.h
src/libraries/glslang/SPIRV/SpvTools.cpp
src/libraries/glslang/SPIRV/SpvTools.h
)
@@ -79,7 +79,6 @@
D9DB6E362B4B41100037A1F6 /* ResourceLimits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D9DB6E332B4B41100037A1F6 /* ResourceLimits.cpp */; };
D9DB6E372B4B41100037A1F6 /* ResourceLimits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D9DB6E332B4B41100037A1F6 /* ResourceLimits.cpp */; };
D9DB6E3E2B4B41580037A1F6 /* NonSemanticDebugPrintf.h in Headers */ = {isa = PBXBuildFile; fileRef = D9DB6E382B4B41570037A1F6 /* NonSemanticDebugPrintf.h */; };
D9DB6E3F2B4B41580037A1F6 /* NonSemanticShaderDebugInfo100.h in Headers */ = {isa = PBXBuildFile; fileRef = D9DB6E392B4B41570037A1F6 /* NonSemanticShaderDebugInfo100.h */; };
D9DB6E402B4B41580037A1F6 /* GLSL.ext.ARM.h in Headers */ = {isa = PBXBuildFile; fileRef = D9DB6E3A2B4B41570037A1F6 /* GLSL.ext.ARM.h */; };
D9DB6E412B4B41580037A1F6 /* GLSL.ext.QCOM.h in Headers */ = {isa = PBXBuildFile; fileRef = D9DB6E3B2B4B41580037A1F6 /* GLSL.ext.QCOM.h */; };
D9DB6E452B4B80E80037A1F6 /* build_info.h in Headers */ = {isa = PBXBuildFile; fileRef = D9DB6E442B4B80E80037A1F6 /* build_info.h */; };
@@ -94,6 +93,7 @@
D9F0C2DB2C680A5500BB2D25 /* OpenSSLConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = D9F0C2D12C680A5500BB2D25 /* OpenSSLConnection.h */; };
D9F0C2DC2C680A5500BB2D25 /* UnixLibraryLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D9F0C2D22C680A5500BB2D25 /* UnixLibraryLoader.cpp */; };
D9F0C2DD2C680A5500BB2D25 /* UnixLibraryLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D9F0C2D22C680A5500BB2D25 /* UnixLibraryLoader.cpp */; };
D9F318AE3013F85300CFB9D0 /* NonSemanticShaderDebugInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = D9F318AD3013F85300CFB9D0 /* NonSemanticShaderDebugInfo.h */; };
FA0A3A5F23366CE9001C269E /* floattypes.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0A3A5D23366CE9001C269E /* floattypes.h */; };
FA0A3A6023366CE9001C269E /* floattypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0A3A5E23366CE9001C269E /* floattypes.cpp */; };
FA0A3A6123366CE9001C269E /* floattypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0A3A5E23366CE9001C269E /* floattypes.cpp */; };
@@ -1312,7 +1312,6 @@
FAF140BB1E20934C00F898D2 /* ossource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF140211E20934C00F898D2 /* ossource.cpp */; };
FAF140BC1E20934C00F898D2 /* ossource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF140211E20934C00F898D2 /* ossource.cpp */; };
FAF140C41E20934C00F898D2 /* ShaderLang.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF140291E20934C00F898D2 /* ShaderLang.h */; };
FAF6C9DA23C2DE2900D7B5BC /* SPVRemapper.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF6C9C123C2DE2900D7B5BC /* SPVRemapper.h */; };
FAF6C9DB23C2DE2900D7B5BC /* SpvBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF6C9C223C2DE2900D7B5BC /* SpvBuilder.h */; };
FAF6C9DC23C2DE2900D7B5BC /* SpvPostProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF6C9C323C2DE2900D7B5BC /* SpvPostProcess.cpp */; };
FAF6C9DD23C2DE2900D7B5BC /* SpvPostProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF6C9C323C2DE2900D7B5BC /* SpvPostProcess.cpp */; };
@@ -1335,8 +1334,6 @@
FAF6C9EF23C2DE2900D7B5BC /* disassemble.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF6C9D123C2DE2900D7B5BC /* disassemble.h */; };
FAF6C9F023C2DE2900D7B5BC /* GlslangToSpv.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF6C9D223C2DE2900D7B5BC /* GlslangToSpv.h */; };
FAF6C9F123C2DE2900D7B5BC /* GLSL.std.450.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF6C9D323C2DE2900D7B5BC /* GLSL.std.450.h */; };
FAF6C9F223C2DE2900D7B5BC /* SPVRemapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF6C9D423C2DE2900D7B5BC /* SPVRemapper.cpp */; };
FAF6C9F323C2DE2900D7B5BC /* SPVRemapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF6C9D423C2DE2900D7B5BC /* SPVRemapper.cpp */; };
FAF6C9F423C2DE2900D7B5BC /* Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF6C9D523C2DE2900D7B5BC /* Logger.cpp */; };
FAF6C9F523C2DE2900D7B5BC /* Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF6C9D523C2DE2900D7B5BC /* Logger.cpp */; };
FAF6C9F623C2DE2900D7B5BC /* hex_float.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF6C9D623C2DE2900D7B5BC /* hex_float.h */; };
@@ -1441,7 +1438,6 @@
D9DB6E282B4B40970037A1F6 /* span.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = span.h; sourceTree = "<group>"; };
D9DB6E332B4B41100037A1F6 /* ResourceLimits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLimits.cpp; sourceTree = "<group>"; };
D9DB6E382B4B41570037A1F6 /* NonSemanticDebugPrintf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NonSemanticDebugPrintf.h; sourceTree = "<group>"; };
D9DB6E392B4B41570037A1F6 /* NonSemanticShaderDebugInfo100.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NonSemanticShaderDebugInfo100.h; sourceTree = "<group>"; };
D9DB6E3A2B4B41570037A1F6 /* GLSL.ext.ARM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLSL.ext.ARM.h; sourceTree = "<group>"; };
D9DB6E3B2B4B41580037A1F6 /* GLSL.ext.QCOM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLSL.ext.QCOM.h; sourceTree = "<group>"; };
D9DB6E442B4B80E80037A1F6 /* build_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = build_info.h; sourceTree = "<group>"; };
@@ -1452,6 +1448,7 @@
D9F0C2D02C680A5500BB2D25 /* OpenSSLConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OpenSSLConnection.cpp; sourceTree = "<group>"; };
D9F0C2D12C680A5500BB2D25 /* OpenSSLConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenSSLConnection.h; sourceTree = "<group>"; };
D9F0C2D22C680A5500BB2D25 /* UnixLibraryLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnixLibraryLoader.cpp; sourceTree = "<group>"; };
D9F318AD3013F85300CFB9D0 /* NonSemanticShaderDebugInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NonSemanticShaderDebugInfo.h; sourceTree = "<group>"; };
FA08F5AE16C7525600F007B5 /* liblove-macosx.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "liblove-macosx.plist"; path = "macosx/liblove-macosx.plist"; sourceTree = "<group>"; };
FA0A3A5D23366CE9001C269E /* floattypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = floattypes.h; sourceTree = "<group>"; };
FA0A3A5E23366CE9001C269E /* floattypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = floattypes.cpp; sourceTree = "<group>"; };
@@ -2299,7 +2296,6 @@
FAF140211E20934C00F898D2 /* ossource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ossource.cpp; sourceTree = "<group>"; };
FAF140291E20934C00F898D2 /* ShaderLang.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShaderLang.h; sourceTree = "<group>"; };
FAF1889C1E9DA834008C1479 /* Optional.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Optional.h; sourceTree = "<group>"; };
FAF6C9C123C2DE2900D7B5BC /* SPVRemapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPVRemapper.h; sourceTree = "<group>"; };
FAF6C9C223C2DE2900D7B5BC /* SpvBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpvBuilder.h; sourceTree = "<group>"; };
FAF6C9C323C2DE2900D7B5BC /* SpvPostProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpvPostProcess.cpp; sourceTree = "<group>"; };
FAF6C9C423C2DE2900D7B5BC /* SpvTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpvTools.h; sourceTree = "<group>"; };
@@ -2317,7 +2313,6 @@
FAF6C9D123C2DE2900D7B5BC /* disassemble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disassemble.h; sourceTree = "<group>"; };
FAF6C9D223C2DE2900D7B5BC /* GlslangToSpv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlslangToSpv.h; sourceTree = "<group>"; };
FAF6C9D323C2DE2900D7B5BC /* GLSL.std.450.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLSL.std.450.h; sourceTree = "<group>"; };
FAF6C9D423C2DE2900D7B5BC /* SPVRemapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SPVRemapper.cpp; sourceTree = "<group>"; };
FAF6C9D523C2DE2900D7B5BC /* Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Logger.cpp; sourceTree = "<group>"; };
FAF6C9D623C2DE2900D7B5BC /* hex_float.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hex_float.h; sourceTree = "<group>"; };
FAF6C9D723C2DE2900D7B5BC /* Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logger.h; sourceTree = "<group>"; };
@@ -4096,14 +4091,12 @@
FAF6C9D723C2DE2900D7B5BC /* Logger.h */,
FAF6C9D523C2DE2900D7B5BC /* Logger.cpp */,
D9DB6E382B4B41570037A1F6 /* NonSemanticDebugPrintf.h */,
D9DB6E392B4B41570037A1F6 /* NonSemanticShaderDebugInfo100.h */,
D9F318AD3013F85300CFB9D0 /* NonSemanticShaderDebugInfo.h */,
D91C76102DE3D088001FC408 /* spirv.hpp11 */,
FAF6C9C223C2DE2900D7B5BC /* SpvBuilder.h */,
FAF6C9CA23C2DE2900D7B5BC /* SpvBuilder.cpp */,
FAF6C9CF23C2DE2900D7B5BC /* spvIR.h */,
FAF6C9C323C2DE2900D7B5BC /* SpvPostProcess.cpp */,
FAF6C9C123C2DE2900D7B5BC /* SPVRemapper.h */,
FAF6C9D423C2DE2900D7B5BC /* SPVRemapper.cpp */,
FAF6C9C423C2DE2900D7B5BC /* SpvTools.h */,
FAF6C9C523C2DE2900D7B5BC /* SpvTools.cpp */,
D91C76112DE3D088001FC408 /* spvUtil.h */,
@@ -4155,7 +4148,6 @@
FAF6C9EF23C2DE2900D7B5BC /* disassemble.h in Headers */,
FA18CF4123DCF67900263725 /* spirv_common.hpp in Headers */,
FAC7CD901FE35E95006A60C7 /* physfs_miniz.h in Headers */,
D9DB6E3F2B4B41580037A1F6 /* NonSemanticShaderDebugInfo100.h in Headers */,
FA0B791D1A958E3B000E1D17 /* b64.h in Headers */,
FA0B7DC61A95902C000E1D17 /* wrap_JoystickModule.h in Headers */,
FA0B7D201A95902C000E1D17 /* ImageRasterizer.h in Headers */,
@@ -4265,7 +4257,6 @@
FA0B7B391A958EA3000E1D17 /* wuff_internal.h in Headers */,
FAC7CD771FE35E95006A60C7 /* physfs_internal.h in Headers */,
FA0B7D881A95902C000E1D17 /* ImageData.h in Headers */,
FAF6C9DA23C2DE2900D7B5BC /* SPVRemapper.h in Headers */,
FA0B7EE11A95902D000E1D17 /* wrap_Touch.h in Headers */,
FA9D8DDB1DEF8411002CD881 /* Stream.h in Headers */,
FAF6C9E823C2DE2900D7B5BC /* GLSL.ext.EXT.h in Headers */,
@@ -4509,6 +4500,7 @@
FA0B79261A958E3B000E1D17 /* Exception.h in Headers */,
D9DB6E402B4B41580037A1F6 /* GLSL.ext.ARM.h in Headers */,
FA0B7D4D1A95902C000E1D17 /* Shader.h in Headers */,
D9F318AE3013F85300CFB9D0 /* NonSemanticShaderDebugInfo.h in Headers */,
FA0B793D1A958E3B000E1D17 /* runtime.h in Headers */,
FAF6C9E323C2DE2900D7B5BC /* GLSL.ext.AMD.h in Headers */,
FA57FB9A1AE1993600F2AD6D /* noise1234.h in Headers */,
@@ -5043,7 +5035,6 @@
FAF6C9FB23C2DE2900D7B5BC /* disassemble.cpp in Sources */,
FA18CEDD23DBC6E000263725 /* Metal.mm in Sources */,
FAE64A822071363100BC7981 /* physfs_archiver_grp.c in Sources */,
FAF6C9F323C2DE2900D7B5BC /* SPVRemapper.cpp in Sources */,
FA0B79331A958E3B000E1D17 /* Object.cpp in Sources */,
FAE64A8D2071363500BC7981 /* physfs_platform_apple.m in Sources */,
FA0B7E5B1A95902C000E1D17 /* wrap_MotorJoint.cpp in Sources */,
@@ -5519,7 +5510,6 @@
FA0B7D281A95902C000E1D17 /* wrap_GlyphData.cpp in Sources */,
FABDA9F92552448300B5C523 /* b2_polygon_shape.cpp in Sources */,
FA0B7DE21A95902C000E1D17 /* wrap_RandomGenerator.cpp in Sources */,
FAF6C9F223C2DE2900D7B5BC /* SPVRemapper.cpp in Sources */,
FA18CEEF23DC9B3E00263725 /* Texture.mm in Sources */,
FABDAA012552448300B5C523 /* b2_distance.cpp in Sources */,
FACA02F61F5E396B0084B28F /* wrap_DataModule.cpp in Sources */,
+5 -3
View File
@@ -1,5 +1,5 @@
/*
** Copyright (c) 2022 ARM Limited
** Copyright (c) 2022, 2025 ARM Limited
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
@@ -28,8 +28,10 @@
#define GLSLextARM_H
static const int GLSLextARMVersion = 100;
static const int GLSLextARMRevision = 1;
static const int GLSLextARMRevision = 2;
static const char * const E_SPV_ARM_core_builtins = "SPV_ARM_core_builtins";
static const char* const E_SPV_ARM_core_builtins = "SPV_ARM_core_builtins";
static const char* const E_SPV_ARM_cooperative_matrix_layouts = "SPV_ARM_cooperative_matrix_layouts";
static const char* const E_SPV_ARM_tensors = "SPV_ARM_tensors";
#endif // #ifndef GLSLextARM_H
+3 -1
View File
@@ -41,7 +41,9 @@ static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader
static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64";
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_ARM_cooperative_matrix_layouts = "SPV_ARM_cooperative_matrix_layouts";
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
+5 -1
View File
@@ -55,6 +55,7 @@ static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_w
static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow";
static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragment_shader_barycentric";
static const char* const E_SPV_KHR_quad_control = "SPV_KHR_quad_control";
static const char* const E_SPV_KHR_compute_shader_derivatives = "SPV_KHR_compute_shader_derivatives";
static const char* const E_SPV_AMD_shader_early_and_late_fragment_tests = "SPV_AMD_shader_early_and_late_fragment_tests";
static const char* const E_SPV_KHR_ray_tracing_position_fetch = "SPV_KHR_ray_tracing_position_fetch";
static const char* const E_SPV_KHR_cooperative_matrix = "SPV_KHR_cooperative_matrix";
@@ -66,5 +67,8 @@ 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";
static const char* const E_SPV_KHR_abort = "SPV_KHR_abort";
static const char* const E_SPV_KHR_constant_data = "SPV_KHR_constant_data";
#endif // #ifndef GLSLextKHR_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
@@ -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";
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,173 @@
// Copyright (c) 2018 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_NonSemanticShaderDebugInfo_H_
#define SPIRV_UNIFIED1_NonSemanticShaderDebugInfo_H_
#ifdef __cplusplus
extern "C" {
#endif
enum {
NonSemanticShaderDebugInfoVersion = 101,
NonSemanticShaderDebugInfoVersion_BitWidthPadding = 0x7fffffff
};
enum {
NonSemanticShaderDebugInfoRevision = 6,
NonSemanticShaderDebugInfoRevision_BitWidthPadding = 0x7fffffff
};
enum NonSemanticShaderDebugInfoInstructions {
NonSemanticShaderDebugInfoDebugInfoNone = 0,
NonSemanticShaderDebugInfoDebugCompilationUnit = 1,
NonSemanticShaderDebugInfoDebugTypeBasic = 2,
NonSemanticShaderDebugInfoDebugTypePointer = 3,
NonSemanticShaderDebugInfoDebugTypeQualifier = 4,
NonSemanticShaderDebugInfoDebugTypeArray = 5,
NonSemanticShaderDebugInfoDebugTypeVector = 6,
NonSemanticShaderDebugInfoDebugTypedef = 7,
NonSemanticShaderDebugInfoDebugTypeFunction = 8,
NonSemanticShaderDebugInfoDebugTypeEnum = 9,
NonSemanticShaderDebugInfoDebugTypeComposite = 10,
NonSemanticShaderDebugInfoDebugTypeMember = 11,
NonSemanticShaderDebugInfoDebugTypeInheritance = 12,
NonSemanticShaderDebugInfoDebugTypePtrToMember = 13,
NonSemanticShaderDebugInfoDebugTypeTemplate = 14,
NonSemanticShaderDebugInfoDebugTypeTemplateParameter = 15,
NonSemanticShaderDebugInfoDebugTypeTemplateTemplateParameter = 16,
NonSemanticShaderDebugInfoDebugTypeTemplateParameterPack = 17,
NonSemanticShaderDebugInfoDebugGlobalVariable = 18,
NonSemanticShaderDebugInfoDebugFunctionDeclaration = 19,
NonSemanticShaderDebugInfoDebugFunction = 20,
NonSemanticShaderDebugInfoDebugLexicalBlock = 21,
NonSemanticShaderDebugInfoDebugLexicalBlockDiscriminator = 22,
NonSemanticShaderDebugInfoDebugScope = 23,
NonSemanticShaderDebugInfoDebugNoScope = 24,
NonSemanticShaderDebugInfoDebugInlinedAt = 25,
NonSemanticShaderDebugInfoDebugLocalVariable = 26,
NonSemanticShaderDebugInfoDebugInlinedVariable = 27,
NonSemanticShaderDebugInfoDebugDeclare = 28,
NonSemanticShaderDebugInfoDebugValue = 29,
NonSemanticShaderDebugInfoDebugOperation = 30,
NonSemanticShaderDebugInfoDebugExpression = 31,
NonSemanticShaderDebugInfoDebugMacroDef = 32,
NonSemanticShaderDebugInfoDebugMacroUndef = 33,
NonSemanticShaderDebugInfoDebugImportedEntity = 34,
NonSemanticShaderDebugInfoDebugSource = 35,
NonSemanticShaderDebugInfoDebugFunctionDefinition = 101,
NonSemanticShaderDebugInfoDebugSourceContinued = 102,
NonSemanticShaderDebugInfoDebugLine = 103,
NonSemanticShaderDebugInfoDebugNoLine = 104,
NonSemanticShaderDebugInfoDebugBuildIdentifier = 105,
NonSemanticShaderDebugInfoDebugStoragePath = 106,
NonSemanticShaderDebugInfoDebugEntryPoint = 107,
NonSemanticShaderDebugInfoDebugTypeMatrix = 108,
NonSemanticShaderDebugInfoDebugTypeVectorIdEXT = 109,
NonSemanticShaderDebugInfoDebugTypeCooperativeMatrixKHR = 110,
NonSemanticShaderDebugInfoInstructionsMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfoDebugInfoFlags {
NonSemanticShaderDebugInfoNone = 0x0000,
NonSemanticShaderDebugInfoFlagIsProtected = 0x01,
NonSemanticShaderDebugInfoFlagIsPrivate = 0x02,
NonSemanticShaderDebugInfoFlagIsPublic = 0x03,
NonSemanticShaderDebugInfoFlagIsLocal = 0x04,
NonSemanticShaderDebugInfoFlagIsDefinition = 0x08,
NonSemanticShaderDebugInfoFlagFwdDecl = 0x10,
NonSemanticShaderDebugInfoFlagArtificial = 0x20,
NonSemanticShaderDebugInfoFlagExplicit = 0x40,
NonSemanticShaderDebugInfoFlagPrototyped = 0x80,
NonSemanticShaderDebugInfoFlagObjectPointer = 0x100,
NonSemanticShaderDebugInfoFlagStaticMember = 0x200,
NonSemanticShaderDebugInfoFlagIndirectVariable = 0x400,
NonSemanticShaderDebugInfoFlagLValueReference = 0x800,
NonSemanticShaderDebugInfoFlagRValueReference = 0x1000,
NonSemanticShaderDebugInfoFlagIsOptimized = 0x2000,
NonSemanticShaderDebugInfoFlagIsEnumClass = 0x4000,
NonSemanticShaderDebugInfoFlagTypePassByValue = 0x8000,
NonSemanticShaderDebugInfoFlagTypePassByReference = 0x10000,
NonSemanticShaderDebugInfoFlagUnknownPhysicalLayout = 0x20000,
NonSemanticShaderDebugInfoDebugInfoFlagsMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfoBuildIdentifierFlags {
NonSemanticShaderDebugInfoIdentifierPossibleDuplicates = 0x01,
NonSemanticShaderDebugInfoBuildIdentifierFlagsMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfoDebugBaseTypeAttributeEncoding {
NonSemanticShaderDebugInfoUnspecified = 0,
NonSemanticShaderDebugInfoAddress = 1,
NonSemanticShaderDebugInfoBoolean = 2,
NonSemanticShaderDebugInfoFloat = 3,
NonSemanticShaderDebugInfoSigned = 4,
NonSemanticShaderDebugInfoSignedChar = 5,
NonSemanticShaderDebugInfoUnsigned = 6,
NonSemanticShaderDebugInfoUnsignedChar = 7,
NonSemanticShaderDebugInfoDebugBaseTypeAttributeEncodingMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfoDebugCompositeType {
NonSemanticShaderDebugInfoClass = 0,
NonSemanticShaderDebugInfoStructure = 1,
NonSemanticShaderDebugInfoUnion = 2,
NonSemanticShaderDebugInfoDebugCompositeTypeMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfoDebugTypeQualifier {
NonSemanticShaderDebugInfoConstType = 0,
NonSemanticShaderDebugInfoVolatileType = 1,
NonSemanticShaderDebugInfoRestrictType = 2,
NonSemanticShaderDebugInfoAtomicType = 3,
NonSemanticShaderDebugInfoDebugTypeQualifierMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfoDebugOperation {
NonSemanticShaderDebugInfoDeref = 0,
NonSemanticShaderDebugInfoPlus = 1,
NonSemanticShaderDebugInfoMinus = 2,
NonSemanticShaderDebugInfoPlusUconst = 3,
NonSemanticShaderDebugInfoBitPiece = 4,
NonSemanticShaderDebugInfoSwap = 5,
NonSemanticShaderDebugInfoXderef = 6,
NonSemanticShaderDebugInfoStackValue = 7,
NonSemanticShaderDebugInfoConstu = 8,
NonSemanticShaderDebugInfoFragment = 9,
NonSemanticShaderDebugInfoDebugOperationMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfoDebugImportedEntity {
NonSemanticShaderDebugInfoImportedModule = 0,
NonSemanticShaderDebugInfoImportedDeclaration = 1,
NonSemanticShaderDebugInfoDebugImportedEntityMax = 0x7fffffff
};
#ifdef __cplusplus
}
#endif
#endif // SPIRV_UNIFIED1_NonSemanticShaderDebugInfo_H_
@@ -1,171 +0,0 @@
// Copyright (c) 2018 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_
File diff suppressed because it is too large Load Diff
-300
View File
@@ -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 <string>
#include <vector>
#include <cstdlib>
#include <exception>
#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 <functional>
#include <cstdint>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <cassert>
#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<std::uint32_t>& spv, const std::vector<std::string>& whiteListStrings,
std::uint32_t opts = DO_EVERYTHING);
// remap on an existing binary in memory - legacy interface without white list
void remap(std::vector<std::uint32_t>& spv, std::uint32_t opts = DO_EVERYTHING);
// Type for error/log handler functions
typedef std::function<void(const std::string&)> errorfn_t;
typedef std::function<void(const std::string&)> 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<spv::Id, spv::Id> idmap_t;
typedef std::unordered_set<spv::Id> idset_t;
typedef std::unordered_map<spv::Id, int> blockmap_t;
void remap(std::uint32_t opts = DO_EVERYTHING);
// Map of names to IDs
typedef std::unordered_map<std::string, spv::Id> namemap_t;
typedef std::uint32_t spirword_t;
typedef std::pair<unsigned, unsigned> range_t;
typedef std::function<void(spv::Id&)> idfn_t;
typedef std::function<bool(spv::Op, unsigned start)> 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<spirword_t> typeentry_t;
typedef std::map<spv::Id, typeentry_t> globaltypes_t;
// A set that preserves position order, and a reverse map
typedef std::set<int> posmap_t;
typedef std::unordered_map<spv::Id, int> posmap_rev_t;
// Maps and ID to the size of its base type, if known.
typedef std::unordered_map<spv::Id, unsigned> 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<bool> 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<spirword_t> spv; // SPIR words
std::vector<std::string> stripWhiteList;
namemap_t nameMap; // ID names from OpName
// Since we want to also do binary ops, we can't use std::vector<bool>. we could use
// boost::dynamic_bitset, but we're trying to avoid a boost dependency.
typedef std::uint64_t bits_t;
std::vector<bits_t> 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<spv::Id, range_t> fnPos;
// Which functions are called, anywhere in the module, with a call count
std::unordered_map<spv::Id, int> 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<spv::Id> 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<range_t> 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
File diff suppressed because it is too large Load Diff
+182 -23
View File
@@ -56,7 +56,7 @@
namespace spv {
#include "GLSL.ext.KHR.h"
#include "GLSL.ext.EXT.h"
#include "NonSemanticShaderDebugInfo100.h"
#include "NonSemanticShaderDebugInfo.h"
}
#include <algorithm>
@@ -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,40 +238,39 @@ public:
Id makeBFloat16Type();
Id makeFloatE5M2Type();
Id makeFloatE4M3Type();
Id makeStructType(const std::vector<Id>& members, const char* name, bool const compilerGenerated = true);
Id makeStructType(const std::vector<Id>& members, const std::vector<spv::StructMemberDebugInfo>& 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<Id>& 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);
Id makeCooperativeVectorTypeNV(Id componentType, Id components);
Id makeTensorTypeARM(Id elementType, Id rank);
Id makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands);
// SPIR-V NonSemantic Shader DebugInfo Instructions
struct DebugTypeLoc {
std::string name {};
int line {0};
int column {0};
};
std::unordered_map<Id, DebugTypeLoc> debugTypeLocs;
Id makeDebugInfoNone();
Id makeBoolDebugType(int const size);
Id makeIntegerDebugType(int const width, bool const hasSign);
Id makeFloatDebugType(int const width);
Id makeSequentialDebugType(Id const baseType, Id const componentCount, NonSemanticShaderDebugInfo100Instructions const sequenceType);
Id makeFloatDebugType(int const width, Id const fpEncoding = NoType);
Id makeSequentialDebugType(Id const baseType, Id const componentCount, NonSemanticShaderDebugInfoInstructions const sequenceType);
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<Id> 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<Id> const& memberTypes, std::vector<StructMemberDebugInfo> const& memberDebugInfo,
char const* const name, NonSemanticShaderDebugInfoDebugCompositeType const tag);
Id makeOpaqueDebugType(char const* const name);
Id makeVectorIdDebugType(Id componentType, Id componentCount);
Id makeCooperativeMatrixDebugTypeKHR(Id componentType, Id scope, Id rows, Id cols, Id use);
Id makePointerDebugType(StorageClass storageClass, Id const baseType);
Id makeForwardPointerDebugType(StorageClass storageClass);
Id makeDebugSource(const Id fileName);
@@ -271,6 +297,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); }
@@ -292,6 +320,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)); }
@@ -309,6 +345,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; }
@@ -322,6 +359,7 @@ public:
}
bool isTensorViewType(Id typeId) const { return getTypeClass(typeId) == Op::OpTypeTensorViewNV; }
bool isCooperativeVectorType(Id typeId) const { return getTypeClass(typeId) == Op::OpTypeCooperativeVectorNV; }
bool isTensorTypeARM(Id typeId) const { return getTypeClass(typeId) == Op::OpTypeTensorARM; }
bool isAggregateType(Id typeId) const
{ return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
bool isImageType(Id typeId) const { return getTypeClass(typeId) == Op::OpTypeImage; }
@@ -421,6 +459,11 @@ public:
Id makeFpConstant(Id type, double d, bool specConstant = false);
Id importNonSemanticShaderDebugInfoInstructions();
// Ensure the NonSemantic.Shader.DebugInfo import string names at least `version`.
// If the import instruction already exists, its name is patched in place.
// If it has not been created yet, importNonSemanticShaderDebugInfoInstructions()
// will use the updated version when it runs.
void requireNonSemanticShaderDebugInfoVersion(unsigned version);
// Turn the array of constants into a proper spv constant of the requested type.
Id makeCompositeConstant(Id type, const std::vector<Id>& comps, bool specConst = false);
@@ -443,6 +486,7 @@ public:
void addMemberDecoration(Id, unsigned int member, Decoration, const char*);
void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector<unsigned>& literals);
void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector<const char*>& strings);
void addMemberDecorationIdEXT(Id, unsigned int member, Decoration, const std::vector<unsigned>& operands);
// At the end of what block do the next create*() instructions go?
// Also reset current last DebugScope and current source line to unknown
@@ -497,13 +541,24 @@ public:
// such as OpEmitMeshTasksEXT
void makeStatementTerminator(spv::Op opcode, const std::vector<Id>& 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);
@@ -517,7 +572,7 @@ public:
Id createAccessChain(StorageClass, Id base, const std::vector<Id>& 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);
@@ -544,6 +599,7 @@ public:
Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3);
Id createOp(Op, Id typeId, const std::vector<Id>& operands);
Id createOp(Op, Id typeId, const std::vector<IdImmediate>& operands);
Id createConstData(Op opCode, Id typeId, const std::vector<const char*> operands);
Id createFunctionCall(spv::Function*, const std::vector<spv::Id>&);
Id createSpecConstantOp(Op, Id typeId, const std::vector<spv::Id>& operands, const std::vector<unsigned>& literals);
@@ -760,6 +816,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<Instruction*> 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(); }
@@ -826,10 +894,15 @@ public:
// clear accessChain
void clearAccessChain();
Id createDescHeapAccessChain();
Id createConstantSizeOfEXT(Id typeId);
uint32_t isStructureHeapMember(Id id, std::vector<Id> 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;
}
@@ -840,6 +913,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)
{
@@ -922,7 +1014,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<Id>& comps, size_t numMembers);
@@ -948,6 +1044,12 @@ public:
int sourceVersion;
spv::Id nonSemanticShaderCompilationUnitId {0};
spv::Id nonSemanticShaderDebugInfo {0};
// Pointer to the OpExtInstImport instruction for NonSemantic.Shader.DebugInfo.
// Kept so requireNonSemanticShaderDebugInfoVersion() can patch the name in place.
Instruction* nonSemanticShaderDebugInfoImportInst {nullptr};
// Spec version encoded in the NonSemantic.Shader.DebugInfo import name.
// Defaults to 100. Promoted to N the first time a version-N opcode is emitted.
unsigned int nonSemanticShaderDebugInfoVersion{100};
spv::Id debugInfoNone {0};
spv::Id debugExpression {0}; // Debug expression with zero operations.
std::string sourceText;
@@ -988,6 +1090,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;
@@ -1005,8 +1109,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<unsigned>{}(k.typeClass), std::hash<unsigned>{}(k.opcode));
size_t hash2 = hash_combine(std::hash<Id>{}(k.value1), std::hash<unsigned>{}(k.value2));
size_t hash3 = hash_combine(hash1, hash2);
return hash_combine(hash3, std::hash<unsigned>{}(k.typeId));
}
};
// map type opcodes to constant inst.
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedConstants;
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedCompositeConstants;
// map struct-id to constant instructions
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedStructConstants;
// map type opcodes to type instructions
@@ -1015,6 +1169,8 @@ public:
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedDebugTypes;
// list of OpConstantNull instructions
std::vector<Instruction*> nullConstants;
// map scalar constants to result IDs
std::unordered_map<ScalarConstantKey, Id, ScalarConstantKeyHash> groupedScalarConstantResultIDs;
// Track which types have explicit layouts, to avoid reusing in storage classes without layout.
// Currently only tracks array types.
@@ -1032,8 +1188,11 @@ public:
// map from include file name ids to their contents
std::map<spv::Id, const std::string*> includeFiles;
// map from core id to debug id
std::map <spv::Id, spv::Id> debugId;
// maps from OpTypeXXX id to DebugTypeXXX id
std::unordered_map<spv::Id, spv::Id> debugTypeIdLookup;
// maps from OpFunction id to DebugFunction id
std::unordered_map<spv::Id, spv::Id> debugFuncIdLookup;
// map from file name string id to DebugSource id
std::unordered_map<spv::Id, spv::Id> debugSourceId;
+89 -6
View File
@@ -43,6 +43,7 @@
#include <unordered_set>
#include <algorithm>
#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:
@@ -171,6 +175,15 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
default:
break;
}
if (basicTypeOp == Op::OpTypeInt) {
if (width == 16)
addCapability(Capability::Int16);
else if (width == 8)
addCapability(Capability::Int8);
} else if (basicTypeOp == Op::OpTypeFloat) {
if (width == 16)
addCapability(Capability::Float16);
}
break;
case Op::OpAccessChain:
case Op::OpPtrAccessChain:
@@ -201,6 +214,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 +293,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 +309,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 +322,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 +353,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<void>(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;
+1
View File
@@ -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
+57 -53
View File
@@ -57,17 +57,17 @@ namespace spv {
#include "GLSL.ext.AMD.h"
#include "GLSL.ext.NV.h"
#include "GLSL.ext.ARM.h"
#include "NonSemanticShaderDebugInfo100.h"
#include "NonSemanticShaderDebugInfo.h"
#include "GLSL.ext.QCOM.h"
}
}
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
static const char* GlslStd450DebugNames[spv::GLSLstd450Count];
namespace spv {
static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
static const char* GLSLextNVGetDebugNames(const char*, unsigned);
static const char* NonSemanticShaderDebugInfo100GetDebugNames(unsigned);
static const char* NonSemanticShaderDebugInfoGetDebugNames(unsigned);
static void Kill(std::ostream& out, const char* message)
{
@@ -83,7 +83,7 @@ enum ExtInstSet {
OpenCLExtInst,
NonSemanticDebugPrintfExtInst,
NonSemanticDebugBreakExtInst,
NonSemanticShaderDebugInfo100
NonSemanticShaderDebugInfo
};
// Container class for a single instance of a SPIR-V stream, with methods for disassembly.
@@ -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:
@@ -546,8 +547,9 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
extInstSet = NonSemanticDebugPrintfExtInst;
} else if (strcmp("NonSemantic.DebugBreak", name) == 0) {
extInstSet = NonSemanticDebugBreakExtInst;
} else if (strcmp("NonSemantic.Shader.DebugInfo.100", name) == 0) {
extInstSet = NonSemanticShaderDebugInfo100;
} else if (strncmp("NonSemantic.Shader.DebugInfo.", name, strlen("NonSemantic.Shader.DebugInfo.")) ==
0) {
extInstSet = NonSemanticShaderDebugInfo;
} else if (strcmp(spv::E_SPV_AMD_shader_ballot, name) == 0 ||
strcmp(spv::E_SPV_AMD_shader_trinary_minmax, name) == 0 ||
strcmp(spv::E_SPV_AMD_shader_explicit_vertex_parameter, name) == 0 ||
@@ -575,8 +577,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
out << "(DebugPrintf)";
} else if (extInstSet == NonSemanticDebugBreakExtInst) {
out << "(DebugBreak)";
} else if (extInstSet == NonSemanticShaderDebugInfo100) {
out << "(" << NonSemanticShaderDebugInfo100GetDebugNames(entrypoint) << ")";
} else if (extInstSet == NonSemanticShaderDebugInfo) {
out << "(" << NonSemanticShaderDebugInfoGetDebugNames(entrypoint) << ")";
}
}
break;
@@ -823,53 +825,55 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
return "Bad";
}
static const char* NonSemanticShaderDebugInfo100GetDebugNames(unsigned entrypoint)
static const char* NonSemanticShaderDebugInfoGetDebugNames(unsigned entrypoint)
{
switch (entrypoint) {
case NonSemanticShaderDebugInfo100DebugInfoNone: return "DebugInfoNone";
case NonSemanticShaderDebugInfo100DebugCompilationUnit: return "DebugCompilationUnit";
case NonSemanticShaderDebugInfo100DebugTypeBasic: return "DebugTypeBasic";
case NonSemanticShaderDebugInfo100DebugTypePointer: return "DebugTypePointer";
case NonSemanticShaderDebugInfo100DebugTypeQualifier: return "DebugTypeQualifier";
case NonSemanticShaderDebugInfo100DebugTypeArray: return "DebugTypeArray";
case NonSemanticShaderDebugInfo100DebugTypeVector: return "DebugTypeVector";
case NonSemanticShaderDebugInfo100DebugTypedef: return "DebugTypedef";
case NonSemanticShaderDebugInfo100DebugTypeFunction: return "DebugTypeFunction";
case NonSemanticShaderDebugInfo100DebugTypeEnum: return "DebugTypeEnum";
case NonSemanticShaderDebugInfo100DebugTypeComposite: return "DebugTypeComposite";
case NonSemanticShaderDebugInfo100DebugTypeMember: return "DebugTypeMember";
case NonSemanticShaderDebugInfo100DebugTypeInheritance: return "DebugTypeInheritance";
case NonSemanticShaderDebugInfo100DebugTypePtrToMember: return "DebugTypePtrToMember";
case NonSemanticShaderDebugInfo100DebugTypeTemplate: return "DebugTypeTemplate";
case NonSemanticShaderDebugInfo100DebugTypeTemplateParameter: return "DebugTypeTemplateParameter";
case NonSemanticShaderDebugInfo100DebugTypeTemplateTemplateParameter: return "DebugTypeTemplateTemplateParameter";
case NonSemanticShaderDebugInfo100DebugTypeTemplateParameterPack: return "DebugTypeTemplateParameterPack";
case NonSemanticShaderDebugInfo100DebugGlobalVariable: return "DebugGlobalVariable";
case NonSemanticShaderDebugInfo100DebugFunctionDeclaration: return "DebugFunctionDeclaration";
case NonSemanticShaderDebugInfo100DebugFunction: return "DebugFunction";
case NonSemanticShaderDebugInfo100DebugLexicalBlock: return "DebugLexicalBlock";
case NonSemanticShaderDebugInfo100DebugLexicalBlockDiscriminator: return "DebugLexicalBlockDiscriminator";
case NonSemanticShaderDebugInfo100DebugScope: return "DebugScope";
case NonSemanticShaderDebugInfo100DebugNoScope: return "DebugNoScope";
case NonSemanticShaderDebugInfo100DebugInlinedAt: return "DebugInlinedAt";
case NonSemanticShaderDebugInfo100DebugLocalVariable: return "DebugLocalVariable";
case NonSemanticShaderDebugInfo100DebugInlinedVariable: return "DebugInlinedVariable";
case NonSemanticShaderDebugInfo100DebugDeclare: return "DebugDeclare";
case NonSemanticShaderDebugInfo100DebugValue: return "DebugValue";
case NonSemanticShaderDebugInfo100DebugOperation: return "DebugOperation";
case NonSemanticShaderDebugInfo100DebugExpression: return "DebugExpression";
case NonSemanticShaderDebugInfo100DebugMacroDef: return "DebugMacroDef";
case NonSemanticShaderDebugInfo100DebugMacroUndef: return "DebugMacroUndef";
case NonSemanticShaderDebugInfo100DebugImportedEntity: return "DebugImportedEntity";
case NonSemanticShaderDebugInfo100DebugSource: return "DebugSource";
case NonSemanticShaderDebugInfo100DebugFunctionDefinition: return "DebugFunctionDefinition";
case NonSemanticShaderDebugInfo100DebugSourceContinued: return "DebugSourceContinued";
case NonSemanticShaderDebugInfo100DebugLine: return "DebugLine";
case NonSemanticShaderDebugInfo100DebugNoLine: return "DebugNoLine";
case NonSemanticShaderDebugInfo100DebugBuildIdentifier: return "DebugBuildIdentifier";
case NonSemanticShaderDebugInfo100DebugStoragePath: return "DebugStoragePath";
case NonSemanticShaderDebugInfo100DebugEntryPoint: return "DebugEntryPoint";
case NonSemanticShaderDebugInfo100DebugTypeMatrix: return "DebugTypeMatrix";
case NonSemanticShaderDebugInfoDebugInfoNone: return "DebugInfoNone";
case NonSemanticShaderDebugInfoDebugCompilationUnit: return "DebugCompilationUnit";
case NonSemanticShaderDebugInfoDebugTypeBasic: return "DebugTypeBasic";
case NonSemanticShaderDebugInfoDebugTypePointer: return "DebugTypePointer";
case NonSemanticShaderDebugInfoDebugTypeQualifier: return "DebugTypeQualifier";
case NonSemanticShaderDebugInfoDebugTypeArray: return "DebugTypeArray";
case NonSemanticShaderDebugInfoDebugTypeVector: return "DebugTypeVector";
case NonSemanticShaderDebugInfoDebugTypedef: return "DebugTypedef";
case NonSemanticShaderDebugInfoDebugTypeFunction: return "DebugTypeFunction";
case NonSemanticShaderDebugInfoDebugTypeEnum: return "DebugTypeEnum";
case NonSemanticShaderDebugInfoDebugTypeComposite: return "DebugTypeComposite";
case NonSemanticShaderDebugInfoDebugTypeMember: return "DebugTypeMember";
case NonSemanticShaderDebugInfoDebugTypeInheritance: return "DebugTypeInheritance";
case NonSemanticShaderDebugInfoDebugTypePtrToMember: return "DebugTypePtrToMember";
case NonSemanticShaderDebugInfoDebugTypeTemplate: return "DebugTypeTemplate";
case NonSemanticShaderDebugInfoDebugTypeTemplateParameter: return "DebugTypeTemplateParameter";
case NonSemanticShaderDebugInfoDebugTypeTemplateTemplateParameter: return "DebugTypeTemplateTemplateParameter";
case NonSemanticShaderDebugInfoDebugTypeTemplateParameterPack: return "DebugTypeTemplateParameterPack";
case NonSemanticShaderDebugInfoDebugGlobalVariable: return "DebugGlobalVariable";
case NonSemanticShaderDebugInfoDebugFunctionDeclaration: return "DebugFunctionDeclaration";
case NonSemanticShaderDebugInfoDebugFunction: return "DebugFunction";
case NonSemanticShaderDebugInfoDebugLexicalBlock: return "DebugLexicalBlock";
case NonSemanticShaderDebugInfoDebugLexicalBlockDiscriminator: return "DebugLexicalBlockDiscriminator";
case NonSemanticShaderDebugInfoDebugScope: return "DebugScope";
case NonSemanticShaderDebugInfoDebugNoScope: return "DebugNoScope";
case NonSemanticShaderDebugInfoDebugInlinedAt: return "DebugInlinedAt";
case NonSemanticShaderDebugInfoDebugLocalVariable: return "DebugLocalVariable";
case NonSemanticShaderDebugInfoDebugInlinedVariable: return "DebugInlinedVariable";
case NonSemanticShaderDebugInfoDebugDeclare: return "DebugDeclare";
case NonSemanticShaderDebugInfoDebugValue: return "DebugValue";
case NonSemanticShaderDebugInfoDebugOperation: return "DebugOperation";
case NonSemanticShaderDebugInfoDebugExpression: return "DebugExpression";
case NonSemanticShaderDebugInfoDebugMacroDef: return "DebugMacroDef";
case NonSemanticShaderDebugInfoDebugMacroUndef: return "DebugMacroUndef";
case NonSemanticShaderDebugInfoDebugImportedEntity: return "DebugImportedEntity";
case NonSemanticShaderDebugInfoDebugSource: return "DebugSource";
case NonSemanticShaderDebugInfoDebugFunctionDefinition: return "DebugFunctionDefinition";
case NonSemanticShaderDebugInfoDebugSourceContinued: return "DebugSourceContinued";
case NonSemanticShaderDebugInfoDebugLine: return "DebugLine";
case NonSemanticShaderDebugInfoDebugNoLine: return "DebugNoLine";
case NonSemanticShaderDebugInfoDebugBuildIdentifier: return "DebugBuildIdentifier";
case NonSemanticShaderDebugInfoDebugStoragePath: return "DebugStoragePath";
case NonSemanticShaderDebugInfoDebugEntryPoint: return "DebugEntryPoint";
case NonSemanticShaderDebugInfoDebugTypeMatrix: return "DebugTypeMatrix";
case NonSemanticShaderDebugInfoDebugTypeVectorIdEXT: return "DebugTypeVectorIdEXT";
case NonSemanticShaderDebugInfoDebugTypeCooperativeMatrixKHR: return "DebugTypeCooperativeMatrixKHR";
default: return "Bad";
}
+363 -19
View File
@@ -209,8 +209,11 @@ const char* ExecutionModeString(int mode)
case (int)ExecutionMode::OutputLinesNV: return "OutputLinesNV";
case (int)ExecutionMode::OutputPrimitivesNV: return "OutputPrimitivesNV";
case (int)ExecutionMode::OutputTrianglesNV: return "OutputTrianglesNV";
case (int)ExecutionMode::DerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV";
case (int)ExecutionMode::DerivativeGroupLinearNV: return "DerivativeGroupLinearNV";
// DerivativeGroupQuadsKHR is an alias of DerivativeGroupQuadsNV
case (int)ExecutionMode::DerivativeGroupQuadsKHR: return "DerivativeGroupQuadsKHR";
// DerivativeGroupLinearKHR is an alias of DerivativeGroupLinearNV
case (int)ExecutionMode::DerivativeGroupLinearKHR: return "DerivativeGroupLinearKHR";
case (int)ExecutionMode::PixelInterlockOrderedEXT: return "PixelInterlockOrderedEXT";
case (int)ExecutionMode::PixelInterlockUnorderedEXT: return "PixelInterlockUnorderedEXT";
@@ -231,6 +234,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 +270,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 +350,16 @@ 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";
case (int)Decoration::UTFEncodedKHR: return "UTF8EncodedKHR";
}
}
@@ -487,6 +501,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 +993,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,10 +1039,12 @@ 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";
// ComputeDerivativeGroupQuadsKHR is an alias of ComputeDerivativeGroupQuadsNV
case (int)Capability::ComputeDerivativeGroupQuadsKHR: return "ComputeDerivativeGroupQuadsKHR";
// ComputeDerivativeGroupLinearKHR is an alias of ComputeDerivativeGroupLinearNV
case (int)Capability::ComputeDerivativeGroupLinearKHR: return "ComputeDerivativeGroupLinearKHR";
case (int)Capability::FragmentBarycentricKHR: return "FragmentBarycentricKHR";
case (int)Capability::MeshShadingNV: return "MeshShadingNV";
case (int)Capability::ImageFootprintNV: return "ImageFootprintNV";
@@ -1071,15 +1089,16 @@ 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";
case (int)Capability::TileImageStencilReadAccessEXT: return "TileImageStencilReadAccessEXT";
case (int)Capability::CooperativeMatrixLayoutsARM: return "CooperativeMatrixLayoutsARM";
case (int)Capability::TensorsARM: return "TensorsARM";
case (int)Capability::FragmentShadingRateKHR: return "FragmentShadingRateKHR";
@@ -1088,10 +1107,14 @@ 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";
case (int)Capability::AbortKHR: return "AbortKHR";
case (int)Capability::ConstantDataKHR: return "ConstantDataKHR";
case (int)Capability::AtomicFloat16AddEXT: return "AtomicFloat16AddEXT";
case (int)Capability::AtomicFloat32AddEXT: return "AtomicFloat32AddEXT";
@@ -1100,12 +1123,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";
@@ -1113,7 +1137,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";
@@ -1125,12 +1151,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";
}
@@ -1513,6 +1544,18 @@ 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::OpAbortKHR: return "OpAbortKHR";
case (int)Op::OpConstantDataKHR: return "OpConstantDataKHR";
case (int)Op::OpSpecConstantDataKHR: return "OpSpecConstantDataKHR";
case (int)Op::OpAtomicFAddEXT: return "OpAtomicFAddEXT";
case (int)Op::OpAtomicFMinEXT: return "OpAtomicFMinEXT";
@@ -1626,6 +1669,11 @@ const char* OpcodeString(int op)
case (int)Op::OpTensorViewSetStrideNV: return "OpTensorViewSetStrideNV";
case (int)Op::OpTensorViewSetClipNV: return "OpTensorViewSetClipNV";
case (int)Op::OpTypeTensorARM: return "OpTypeTensorARM";
case (int)Op::OpTensorReadARM: return "OpTensorReadARM";
case (int)Op::OpTensorWriteARM: return "OpTensorWriteARM";
case (int)Op::OpTensorQuerySizeARM: return "OpTensorQuerySizeARM";
case (int)Op::OpTypeCooperativeVectorNV: return "OpTypeCooperativeVectorNV";
case (int)Op::OpCooperativeVectorMatrixMulNV: return "OpCooperativeVectorMatrixMulNV";
case (int)Op::OpCooperativeVectorMatrixMulAddNV: return "OpCooperativeVectorMatrixMulAddNV";
@@ -1694,6 +1742,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";
@@ -1705,6 +1758,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";
}
@@ -1762,6 +1852,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);
@@ -1832,6 +1923,11 @@ 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);
InstructionDesc[enumCast(Op::OpTensorWriteARM)].setResultAndType(false, false);
// Specific additional context-dependent operands
@@ -1982,6 +2078,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'");
@@ -2009,6 +2106,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);
@@ -2056,6 +2156,11 @@ void Parameterize()
InstructionDesc[enumCast(Op::OpMemberDecorate)].operands.push(OperandDecoration, "");
InstructionDesc[enumCast(Op::OpMemberDecorate)].operands.push(OperandVariableLiterals, "See <<Decoration,'Decoration'>>.");
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 <<Decoration,'Decoration'>>.");
InstructionDesc[enumCast(Op::OpMemberDecorateStringGOOGLE)].operands.push(OperandId, "'Structure Type'");
InstructionDesc[enumCast(Op::OpMemberDecorateStringGOOGLE)].operands.push(OperandLiteralNumber, "'Member'");
InstructionDesc[enumCast(Op::OpMemberDecorateStringGOOGLE)].operands.push(OperandDecoration, "");
@@ -2262,6 +2367,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'");
@@ -3099,12 +3207,31 @@ 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'");
InstructionDesc[enumCast(Op::OpGroupNonUniformQuadAnyKHR)].operands.push(OperandId, "'Predicate'");
InstructionDesc[enumCast(Op::OpTypeAccelerationStructureKHR)].setResultAndType(true, false);
InstructionDesc[enumCast(Op::OpConstantDataKHR)].operands.push(OperandLiteralString, "'Data'");
InstructionDesc[enumCast(Op::OpSpecConstantDataKHR)].operands.push(OperandLiteralString, "'Data'");
InstructionDesc[enumCast(Op::OpAbortKHR)].operands.push(OperandId, "'Message Type'");
InstructionDesc[enumCast(Op::OpAbortKHR)].operands.push(OperandId, "'Message'");
InstructionDesc[enumCast(Op::OpAbortKHR)].setResultAndType(false, false);
InstructionDesc[enumCast(Op::OpTraceNV)].operands.push(OperandId, "'Acceleration Structure'");
InstructionDesc[enumCast(Op::OpTraceNV)].operands.push(OperandId, "'Ray Flags'");
InstructionDesc[enumCast(Op::OpTraceNV)].operands.push(OperandId, "'Cull Mask'");
@@ -3714,6 +3841,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'");
@@ -3805,6 +3945,210 @@ void Parameterize()
InstructionDesc[enumCast(Op::OpSUDotAccSatKHR)].operands.push(OperandId, "'Vector2'");
InstructionDesc[enumCast(Op::OpSUDotAccSatKHR)].operands.push(OperandId, "'Accumulator'");
InstructionDesc[enumCast(Op::OpSUDotAccSatKHR)].operands.push(OperandLiteralNumber, "'PackedVectorFormat'");
InstructionDesc[enumCast(Op::OpTypeTensorARM)].operands.push(OperandId, "'Element Type'");
InstructionDesc[enumCast(Op::OpTypeTensorARM)].operands.push(OperandId, "'Rank'");
InstructionDesc[enumCast(Op::OpTensorReadARM)].operands.push(OperandId, "'Tensor'");
InstructionDesc[enumCast(Op::OpTensorReadARM)].operands.push(OperandId, "'Coordinate'");
InstructionDesc[enumCast(Op::OpTensorReadARM)].operands.push(OperandLiteralNumber, "'Tensor Operand'", true);
InstructionDesc[enumCast(Op::OpTensorReadARM)].operands.push(OperandVariableIds, "'Tensor Operands'");
InstructionDesc[enumCast(Op::OpTensorWriteARM)].operands.push(OperandId, "'Tensor'");
InstructionDesc[enumCast(Op::OpTensorWriteARM)].operands.push(OperandId, "'Coordinate'");
InstructionDesc[enumCast(Op::OpTensorWriteARM)].operands.push(OperandId, "'Object'");
InstructionDesc[enumCast(Op::OpTensorWriteARM)].operands.push(OperandLiteralNumber, "'Tensor Operand'", true);
InstructionDesc[enumCast(Op::OpTensorWriteARM)].operands.push(OperandVariableIds, "'Tensor Operands'");
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)].operands.push(OperandId, "'Hit Kind'");
InstructionDesc[enumCast(Op::OpHitObjectRecordFromQueryEXT)].setResultAndType(false, false);
InstructionDesc[enumCast(Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT)].operands.push(OperandId, "'HitObject'");
InstructionDesc[enumCast(Op::OpHitObjectGetIntersectionTriangleVertexPositionsEXT)].setResultAndType(true, true);
});
}
+19 -4
View File
@@ -252,6 +252,7 @@ struct HexFloatTraits {
// The bias of the exponent. (How much we need to subtract from the stored
// value to get the correct value.)
static const uint32_t exponent_bias = 0;
static bool supportsInfinity() { return true; }
};
// Traits for IEEE float.
@@ -266,6 +267,7 @@ struct HexFloatTraits<FloatProxy<float>> {
static const uint_type num_exponent_bits = 8;
static const uint_type num_fraction_bits = 23;
static const uint_type exponent_bias = 127;
static bool supportsInfinity() { return true; }
};
// Traits for IEEE double.
@@ -280,6 +282,7 @@ struct HexFloatTraits<FloatProxy<double>> {
static const uint_type num_exponent_bits = 11;
static const uint_type num_fraction_bits = 52;
static const uint_type exponent_bias = 1023;
static bool supportsInfinity() { return true; }
};
// Traits for IEEE half.
@@ -294,6 +297,7 @@ struct HexFloatTraits<FloatProxy<Float16>> {
static const uint_type num_exponent_bits = 5;
static const uint_type num_fraction_bits = 10;
static const uint_type exponent_bias = 15;
static bool supportsInfinity() { return true; }
};
template <>
@@ -306,6 +310,7 @@ struct HexFloatTraits<FloatProxy<FloatE5M2>> {
static const uint_type num_exponent_bits = 5;
static const uint_type num_fraction_bits = 2;
static const uint_type exponent_bias = 15;
static bool supportsInfinity() { return true; }
};
template <>
@@ -318,6 +323,7 @@ struct HexFloatTraits<FloatProxy<FloatE4M3>> {
static const uint_type num_exponent_bits = 4;
static const uint_type num_fraction_bits = 3;
static const uint_type exponent_bias = 7;
static bool supportsInfinity() { return false; }
};
enum round_direction {
@@ -337,6 +343,7 @@ class HexFloat {
typedef typename Traits::int_type int_type;
typedef typename Traits::underlying_type underlying_type;
typedef typename Traits::native_type native_type;
using Traits_T = Traits;
explicit HexFloat(T f) : value_(f) {}
@@ -678,14 +685,22 @@ class HexFloat {
(getBits() & exponent_mask) == exponent_mask && significand != 0;
bool is_inf =
!is_nan &&
((exponent + carried) > static_cast<int_type>(other_T::exponent_bias) ||
(((exponent + carried) > static_cast<int_type>(other_T::exponent_bias) && other_T::Traits_T::supportsInfinity()) ||
((exponent + carried) > static_cast<int_type>(other_T::exponent_bias + 1) && !other_T::Traits_T::supportsInfinity()) ||
(significand == 0 && (getBits() & exponent_mask) == exponent_mask));
// If we are Nan or Inf we should pass that through.
if (is_inf) {
other.set_value(BitwiseCast<typename other_T::underlying_type>(
static_cast<typename other_T::uint_type>(
(negate ? other_T::sign_mask : 0) | other_T::exponent_mask)));
if (other_T::Traits_T::supportsInfinity()) {
// encode as +/-inf
other.set_value(BitwiseCast<typename other_T::underlying_type>(
static_cast<typename other_T::uint_type>(
(negate ? other_T::sign_mask : 0) | other_T::exponent_mask)));
} else {
// encode as +/-nan
other.set_value(BitwiseCast<typename other_T::underlying_type>(
static_cast<typename other_T::uint_type>(negate ? ~0 : ~other_T::sign_mask)));
}
return;
}
if (is_nan) {
+216 -10
View File
@@ -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,9 @@ enum class Decoration : unsigned {
PayloadNodeSparseArrayAMDX = 5099,
PayloadNodeArraySizeAMDX = 5100,
PayloadDispatchIndirectAMDX = 5105,
ArrayStrideIdEXT = 5124,
OffsetIdEXT = 5125,
UTFEncodedKHR = 5145,
OverrideCoverageNV = 5248,
PassthroughNV = 5250,
ViewportRelativeNV = 5252,
@@ -578,7 +583,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 +738,8 @@ enum class BuiltIn : unsigned {
FragStencilRefEXT = 5014,
RemainingRecursionLevelsAMDX = 5021,
ShaderIndexAMDX = 5073,
SamplerHeapEXT = 5122,
ResourceHeapEXT = 5123,
ViewportMaskNV = 5253,
SecondaryPositionNV = 5257,
SecondaryViewportMaskNV = 5258,
@@ -1070,8 +1080,9 @@ enum class Capability : unsigned {
TileImageColorReadAccessEXT = 4166,
TileImageDepthReadAccessEXT = 4167,
TileImageStencilReadAccessEXT = 4168,
CooperativeMatrixLayoutsARM = 4201,
Float8EXT = 4212,
TensorsARM = 4174,
CooperativeMatrixLayoutsARM = 4201,
Float8EXT = 4212,
Float8CooperativeMatrixEXT = 4213,
FragmentShadingRateKHR = 4422,
SubgroupBallotKHR = 4423,
@@ -1109,6 +1120,7 @@ enum class Capability : unsigned {
TextureBoxFilterQCOM = 4485,
TextureBlockMatchQCOM = 4486,
TileShadingQCOM = 4495,
CooperativeMatrixConversionQCOM = 4496,
TextureBlockMatch2QCOM = 4498,
Float16ImageAMD = 5008,
ImageGatherBiasLodAMD = 5009,
@@ -1122,6 +1134,9 @@ enum class Capability : unsigned {
BFloat16TypeKHR = 5116,
BFloat16DotProductKHR = 5117,
BFloat16CooperativeMatrixKHR = 5118,
AbortKHR = 5120,
DescriptorHeapEXT = 5128,
ConstantDataKHR = 5146,
SampleMaskOverrideCoverageNV = 5249,
GeometryShaderPassthroughNV = 5251,
ShaderViewportIndexLayerEXT = 5254,
@@ -1186,6 +1201,7 @@ enum class Capability : unsigned {
DisplacementMicromapNV = 5380,
RayTracingOpacityMicromapEXT = 5381,
ShaderInvocationReorderNV = 5383,
ShaderInvocationReorderEXT = 5388,
BindlessTextureNV = 5390,
RayQueryPositionFetchKHR = 5391,
CooperativeVectorNV = 5394,
@@ -1194,6 +1210,9 @@ enum class Capability : unsigned {
RawAccessChainsNV = 5414,
RayTracingSpheresGeometryNV = 5418,
RayTracingLinearSweptSpheresGeometryNV = 5419,
PushConstantBanksNV = 5423,
LongVectorEXT = 5425,
Shader64BitIndexingEXT = 5426,
CooperativeMatrixReductionsNV = 5430,
CooperativeMatrixConversionsNV = 5431,
CooperativeMatrixPerElementOperationsNV = 5432,
@@ -1460,6 +1479,18 @@ enum class TensorAddressingOperandsMask : unsigned {
DecodeFunc = 0x00000002,
};
enum class TensorOperandsShift : unsigned {
NontemporalARM = 0,
OutOfBoundsValueARM = 1,
Max = 0x7fffffff,
};
enum class TensorOperandsMask : unsigned {
MaskNone = 0,
NontemporalARM = 0x00000001,
OutOfBoundsValueARM = 0x00000002,
};
enum class InitializationModeQualifier : unsigned {
InitOnDeviceReprogramINTEL = 0,
InitOnDeviceResetINTEL = 1,
@@ -1546,8 +1577,8 @@ enum class RawAccessChainOperandsMask : unsigned {
enum class FPEncoding : unsigned {
BFloat16KHR = 0,
Float8E4M3EXT = 4214,
Float8E5M2EXT = 4215,
Float8E4M3EXT = 4214,
Float8E5M2EXT = 4215,
Max = 0x7fffffff,
};
@@ -1926,6 +1957,10 @@ enum class Op : unsigned {
OpColorAttachmentReadEXT = 4160,
OpDepthAttachmentReadEXT = 4161,
OpStencilAttachmentReadEXT = 4162,
OpTypeTensorARM = 4163,
OpTensorReadARM = 4164,
OpTensorWriteARM = 4165,
OpTensorQuerySizeARM = 4166,
OpTerminateInvocation = 4416,
OpTypeUntypedPointerKHR = 4417,
OpUntypedVariableKHR = 4418,
@@ -1979,10 +2014,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,
@@ -2004,6 +2043,14 @@ enum class Op : unsigned {
OpSpecConstantStringAMDX = 5104,
OpGroupNonUniformQuadAllKHR = 5110,
OpGroupNonUniformQuadAnyKHR = 5111,
OpTypeBufferEXT = 5115,
OpBufferPointerEXT = 5119,
OpAbortKHR = 5121,
OpUntypedImageTexelPointerEXT = 5126,
OpMemberDecorateIdEXT = 5127,
OpConstantSizeOfEXT = 5129,
OpConstantDataKHR = 5147,
OpSpecConstantDataKHR = 5148,
OpHitObjectRecordHitMotionNV = 5249,
OpHitObjectRecordHitWithIndexMotionNV = 5250,
OpHitObjectRecordMissMotionNV = 5251,
@@ -2039,6 +2086,7 @@ enum class Op : unsigned {
OpTypeHitObjectNV = 5281,
OpImageSampleFootprintNV = 5283,
OpTypeCooperativeVectorNV = 5288,
OpTypeVectorIdEXT = 5288,
OpCooperativeVectorMatrixMulNV = 5289,
OpCooperativeVectorOuterProductAccumulateNV = 5290,
OpCooperativeVectorReduceSumAccumulateNV = 5291,
@@ -2052,6 +2100,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,
@@ -2065,6 +2143,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,
@@ -2735,6 +2819,10 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case Op::OpColorAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
case Op::OpDepthAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
case Op::OpStencilAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
case Op::OpTypeTensorARM: *hasResult = true; *hasResultType = false; break;
case Op::OpTensorReadARM: *hasResult = true; *hasResultType = true; break;
case Op::OpTensorWriteARM: *hasResult = false; *hasResultType = false; break;
case Op::OpTensorQuerySizeARM: *hasResult = true; *hasResultType = true; break;
case Op::OpTerminateInvocation: *hasResult = false; *hasResultType = false; break;
case Op::OpTypeUntypedPointerKHR: *hasResult = true; *hasResultType = false; break;
case Op::OpUntypedVariableKHR: *hasResult = true; *hasResultType = true; break;
@@ -2749,6 +2837,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;
@@ -2782,10 +2875,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;
@@ -2807,6 +2904,9 @@ 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::OpAbortKHR: *hasResult = false; *hasResultType = false; break;
case Op::OpConstantDataKHR: *hasResult = true; *hasResultType = true; break;
case Op::OpSpecConstantDataKHR : *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;
@@ -2855,6 +2955,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;
@@ -2866,6 +2996,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;
@@ -3320,6 +3456,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";
@@ -3369,6 +3506,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";
@@ -3600,7 +3738,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";
@@ -3616,6 +3754,7 @@ inline const char* DecorationToString(Decoration value) {
case Decoration::PayloadNodeSparseArrayAMDX: return "PayloadNodeSparseArrayAMDX";
case Decoration::PayloadNodeArraySizeAMDX: return "PayloadNodeArraySizeAMDX";
case Decoration::PayloadDispatchIndirectAMDX: return "PayloadDispatchIndirectAMDX";
case Decoration::UTFEncodedKHR: return "UTFEncodedKHR";
case Decoration::OverrideCoverageNV: return "OverrideCoverageNV";
case Decoration::PassthroughNV: return "PassthroughNV";
case Decoration::ViewportRelativeNV: return "ViewportRelativeNV";
@@ -3627,7 +3766,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";
@@ -3944,9 +4086,10 @@ inline const char* CapabilityToString(Capability value) {
case Capability::TileImageColorReadAccessEXT: return "TileImageColorReadAccessEXT";
case Capability::TileImageDepthReadAccessEXT: return "TileImageDepthReadAccessEXT";
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";
@@ -3981,6 +4124,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";
@@ -3994,6 +4138,8 @@ inline const char* CapabilityToString(Capability value) {
case Capability::BFloat16TypeKHR: return "BFloat16TypeKHR";
case Capability::BFloat16DotProductKHR: return "BFloat16DotProductKHR";
case Capability::BFloat16CooperativeMatrixKHR: return "BFloat16CooperativeMatrixKHR";
case Capability::AbortKHR: return "AbortKHR";
case Capability::ConstantDataKHR: return "ConstantDataKHR";
case Capability::SampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV";
case Capability::GeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV";
case Capability::ShaderViewportIndexLayerEXT: return "ShaderViewportIndexLayerEXT";
@@ -4037,6 +4183,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";
@@ -4045,6 +4192,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";
@@ -4285,8 +4435,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";
}
}
@@ -4671,6 +4821,10 @@ inline const char* OpToString(Op value) {
case Op::OpColorAttachmentReadEXT: return "OpColorAttachmentReadEXT";
case Op::OpDepthAttachmentReadEXT: return "OpDepthAttachmentReadEXT";
case Op::OpStencilAttachmentReadEXT: return "OpStencilAttachmentReadEXT";
case Op::OpTypeTensorARM: return "OpTypeTensorARM";
case Op::OpTensorReadARM: return "OpTensorReadARM";
case Op::OpTensorWriteARM: return "OpTensorWriteARM";
case Op::OpTensorQuerySizeARM: return "OpTensorQuerySizeARM";
case Op::OpTerminateInvocation: return "OpTerminateInvocation";
case Op::OpTypeUntypedPointerKHR: return "OpTypeUntypedPointerKHR";
case Op::OpUntypedVariableKHR: return "OpUntypedVariableKHR";
@@ -4685,6 +4839,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";
@@ -4718,10 +4877,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";
@@ -4743,6 +4906,9 @@ inline const char* OpToString(Op value) {
case Op::OpSpecConstantStringAMDX: return "OpSpecConstantStringAMDX";
case Op::OpGroupNonUniformQuadAllKHR: return "OpGroupNonUniformQuadAllKHR";
case Op::OpGroupNonUniformQuadAnyKHR: return "OpGroupNonUniformQuadAnyKHR";
case Op::OpAbortKHR: return "OpAbortKHR";
case Op::OpConstantDataKHR: return "OpConstantDataKHR";
case Op::OpSpecConstantDataKHR: return "OpSpecConstantDataKHR";
case Op::OpHitObjectRecordHitMotionNV: return "OpHitObjectRecordHitMotionNV";
case Op::OpHitObjectRecordHitWithIndexMotionNV: return "OpHitObjectRecordHitWithIndexMotionNV";
case Op::OpHitObjectRecordMissMotionNV: return "OpHitObjectRecordMissMotionNV";
@@ -4791,6 +4957,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";
@@ -4802,6 +4998,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";
@@ -5171,6 +5373,10 @@ constexpr TensorAddressingOperandsMask operator|(TensorAddressingOperandsMask a,
constexpr TensorAddressingOperandsMask operator&(TensorAddressingOperandsMask a, TensorAddressingOperandsMask b) { return TensorAddressingOperandsMask(unsigned(a) & unsigned(b)); }
constexpr TensorAddressingOperandsMask operator^(TensorAddressingOperandsMask a, TensorAddressingOperandsMask b) { return TensorAddressingOperandsMask(unsigned(a) ^ unsigned(b)); }
constexpr TensorAddressingOperandsMask operator~(TensorAddressingOperandsMask a) { return TensorAddressingOperandsMask(~unsigned(a)); }
constexpr TensorOperandsMask operator|(TensorOperandsMask a, TensorOperandsMask b) { return TensorOperandsMask(unsigned(a) | unsigned(b)); }
constexpr TensorOperandsMask operator&(TensorOperandsMask a, TensorOperandsMask b) { return TensorOperandsMask(unsigned(a) & unsigned(b)); }
constexpr TensorOperandsMask operator^(TensorOperandsMask a, TensorOperandsMask b) { return TensorOperandsMask(unsigned(a) ^ unsigned(b)); }
constexpr TensorOperandsMask operator~(TensorOperandsMask a) { return TensorOperandsMask(~unsigned(a)); }
constexpr MatrixMultiplyAccumulateOperandsMask operator|(MatrixMultiplyAccumulateOperandsMask a, MatrixMultiplyAccumulateOperandsMask b) { return MatrixMultiplyAccumulateOperandsMask(unsigned(a) | unsigned(b)); }
constexpr MatrixMultiplyAccumulateOperandsMask operator&(MatrixMultiplyAccumulateOperandsMask a, MatrixMultiplyAccumulateOperandsMask b) { return MatrixMultiplyAccumulateOperandsMask(unsigned(a) & unsigned(b)); }
constexpr MatrixMultiplyAccumulateOperandsMask operator^(MatrixMultiplyAccumulateOperandsMask a, MatrixMultiplyAccumulateOperandsMask b) { return MatrixMultiplyAccumulateOperandsMask(unsigned(a) ^ unsigned(b)); }
+9 -1
View File
@@ -189,6 +189,11 @@ public:
operands[idx] = immediate;
}
void clearOperands() {
operands.clear();
idOperand.clear();
}
void addStringOperand(const char* str)
{
unsigned int word = 0;
@@ -222,6 +227,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];
@@ -380,6 +386,7 @@ public:
case Op::OpReturn:
case Op::OpReturnValue:
case Op::OpUnreachable:
case Op::OpAbortKHR:
return true;
default:
return false;
@@ -574,7 +581,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);
}
@@ -69,11 +69,14 @@ enum TBasicType {
EbtReference,
EbtRayQuery,
EbtHitObjectNV,
EbtHitObjectEXT,
EbtCoopmat,
EbtFunction,
EbtTensorLayoutNV,
EbtTensorViewNV,
EbtCoopvecNV,
EbtTensorARM,
EbtLongVector,
// SPIR-V type defined by spirv_type
EbtSpirvType,
@@ -110,6 +113,7 @@ enum TStorageQualifier {
EvqCallableData,
EvqCallableDataIn,
EvqHitObjectAttrNV,
EvqHitObjectAttrEXT,
EvqtaskPayloadSharedEXT,
@@ -140,6 +144,10 @@ enum TStorageQualifier {
EvqTileImageEXT,
// EXT_structured_descriptor_heap
EvqSamplerHeap,
EvqResourceHeap,
// end of list
EvqLast
};
@@ -350,6 +358,9 @@ enum TBuiltInVariable {
EbvTileOffsetQCOM,
EbvTileDimensionQCOM,
EbvTileApronSizeQCOM,
// GL_EXT_descriptor_heap
EbvSamplerHeapEXT,
EbvResourceHeapEXT,
EbvLast
};
@@ -397,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";
}
}
@@ -599,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);
@@ -899,6 +899,17 @@ public:
unionArray = new TConstUnionVector(size, val);
}
TConstUnionArray* clone() const
{
TConstUnionArray *copy = new TConstUnionArray(size());
if (unionArray) {
for (const auto i : *unionArray) {
copy->unionArray->push_back(i);
}
}
return copy;
}
int size() const { return unionArray ? (int)unionArray->size() : 0; }
TConstUnion& operator[](size_t index) { return (*unionArray)[index]; }
const TConstUnion& operator[](size_t index) const { return (*unionArray)[index]; }
@@ -84,9 +84,9 @@ public:
// makes the compiler print warnings about 0 length memsets,
// even with the if() protecting them.
# ifdef GUARD_BLOCKS
memset(preGuard(), guardBlockBeginVal, guardBlockSize);
memset(preGuard(), guardBlockBeginVal, guardBlockSize());
memset(data(), userDataFill, size);
memset(postGuard(), guardBlockEndVal, guardBlockSize);
memset(postGuard(), guardBlockEndVal, guardBlockSize());
# endif
}
@@ -100,12 +100,12 @@ public:
// Return total size needed to accommodate user buffer of 'size',
// plus our tracking data.
inline static size_t allocationSize(size_t size) {
return size + 2 * guardBlockSize + headerSize();
return size + 2 * guardBlockSize() + headerSize();
}
// Offset from surrounding buffer to get to user data buffer.
inline static unsigned char* offsetAllocation(unsigned char* m) {
return m + guardBlockSize + headerSize();
return m + guardBlockSize() + headerSize();
}
private:
@@ -113,7 +113,7 @@ private:
// Find offsets to pre and post guard blocks, and user data buffer
unsigned char* preGuard() const { return mem + headerSize(); }
unsigned char* data() const { return preGuard() + guardBlockSize; }
unsigned char* data() const { return preGuard() + guardBlockSize(); }
unsigned char* postGuard() const { return data() + size; }
size_t size; // size of the user data area
@@ -125,15 +125,19 @@ private:
static inline constexpr unsigned char userDataFill = 0xcd;
# ifdef GUARD_BLOCKS
static inline constexpr size_t guardBlockSize = 16;
inline static constexpr size_t headerSize() { return sizeof(TAllocation); }
inline static constexpr size_t guardBlockSize() {
constexpr size_t minGuardSize = 16;
constexpr size_t alignmentSize = 16;
constexpr size_t guardLayoutSize =
(minGuardSize + sizeof(TAllocation) + alignmentSize - 1) & ~(alignmentSize - 1);
static_assert((guardLayoutSize % alignmentSize) == 0,
"Guard block layout is not 16-byte aligned.");
return guardLayoutSize - sizeof(TAllocation);
}
# else
static inline constexpr size_t guardBlockSize = 0;
# endif
# ifdef GUARD_BLOCKS
inline static size_t headerSize() { return sizeof(TAllocation); }
# else
inline static size_t headerSize() { return 0; }
inline static constexpr size_t headerSize() { return 0; }
inline static constexpr size_t guardBlockSize() { return 0; }
# endif
};
@@ -292,8 +296,7 @@ public:
template<class Other>
pool_allocator(const pool_allocator<Other>& p) : allocator(p.getAllocator()) { }
GLSLANG_EXPORT_FOR_TESTS
pointer allocate(size_type n) {
return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T))); }
pointer allocate(size_type n, const void*) {
+231 -28
View File
@@ -47,6 +47,7 @@
#include "SpirvIntrinsics.h"
#include <algorithm>
#include <climits>
namespace glslang {
@@ -130,6 +131,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 +246,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 +518,7 @@ public:
spirvByReference = false;
spirvLiteral = false;
defaultBlock = false;
usedByAtomic = false;
}
// drop qualifiers that don't belong in a temporary variable
@@ -529,6 +538,7 @@ public:
spirvDecorate = nullptr;
spirvByReference = false;
spirvLiteral = false;
usedByAtomic = false;
}
void clearInterstage()
@@ -610,6 +620,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 +664,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 +831,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 +870,7 @@ public:
layoutFullQuads = false;
layoutQuadDeriv = false;
layoutHitObjectShaderRecordNV = false;
layoutHitObjectShaderRecordEXT = false;
layoutBindlessSampler = false;
layoutBindlessImage = false;
layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
@@ -864,6 +881,11 @@ public:
clearInterstageLayout();
layoutSpecConstantId = layoutSpecConstantIdEnd;
layoutBank = layoutBankEnd;
layoutDescriptorHeap = false;
layoutDescriptorStride = layoutDescriptorStrideEnd;
layoutHeapOffset = 0;
layoutDescriptorInnerBlock = false;
}
void clearInterstageLayout()
{
@@ -905,6 +927,7 @@ public:
TLayoutPacking layoutPacking : 4;
int layoutOffset;
int layoutAlign;
int layoutMemberOffset;
unsigned int layoutLocation : 12;
static const unsigned int layoutLocationEnd = 0xFFF;
@@ -936,8 +959,14 @@ public:
unsigned int layoutAttachment : 8; // for input_attachment_index
static const unsigned int layoutAttachmentEnd = 0XFF;
unsigned int layoutSpecConstantId : 11;
static const unsigned int layoutSpecConstantIdEnd = 0x7FF;
unsigned int layoutSpecConstantId;
static const unsigned int layoutSpecConstantIdEnd = UINT_MAX;
unsigned int layoutBank : 4;
static const unsigned int layoutBankEnd = 0xF;
unsigned int layoutDescriptorStride;
static const unsigned int layoutDescriptorStrideEnd = 0x0;
// stored as log2 of the actual alignment value
unsigned int layoutBufferReferenceAlign : 6;
@@ -954,6 +983,10 @@ public:
bool layoutFullQuads;
bool layoutQuadDeriv;
bool layoutHitObjectShaderRecordNV;
bool layoutHitObjectShaderRecordEXT;
bool layoutDescriptorHeap;
bool layoutDescriptorInnerBlock;
int layoutHeapOffset;
// GL_EXT_spirv_intrinsics
int spirvStorageClass;
@@ -979,6 +1012,7 @@ public:
layoutPacking = ElpNone;
layoutOffset = layoutNotSet;
layoutAlign = layoutNotSet;
layoutMemberOffset = layoutNotSet;
layoutSet = layoutSetEnd;
layoutBinding = layoutBindingEnd;
@@ -1065,6 +1099,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 +1137,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
@@ -1299,6 +1342,12 @@ public:
}
};
enum TDerivativeGroupExtension {
EdgNone,
EdgNV,
EdgKHR,
};
// Qualifiers that don't need to be kept per object. They have shader scope, not object scope.
// So, they will not be part of TType, TQualifier, etc.
struct TShaderQualifiers {
@@ -1325,8 +1374,9 @@ struct TShaderQualifiers {
int numViews; // multiview extenstions
TInterlockOrdering interlockOrdering;
bool layoutOverrideCoverage; // true if layout override_coverage set
bool layoutDerivativeGroupQuads; // true if layout derivative_group_quadsNV set
bool layoutDerivativeGroupLinear; // true if layout derivative_group_linearNV set
bool layoutDerivativeGroupQuads; // true if a derivative_group_quads* layout is set
bool layoutDerivativeGroupLinear; // true if a derivative_group_linear* layout is set
TDerivativeGroupExtension derivativeGroupExtension;
int primitives; // mesh shader "max_primitives"DerivativeGroupLinear; // true if layout derivative_group_linearNV set
bool layoutPrimitiveCulling; // true if layout primitive_culling set
bool layoutNonCoherentTileAttachmentReadQCOM; // fragment shaders -- per object
@@ -1367,6 +1417,7 @@ struct TShaderQualifiers {
layoutOverrideCoverage = false;
layoutDerivativeGroupQuads = false;
layoutDerivativeGroupLinear = false;
derivativeGroupExtension = EdgNone;
layoutPrimitiveCulling = false;
layoutNonCoherentTileAttachmentReadQCOM = false;
layoutTileShadingRateQCOM[0] = 0;
@@ -1438,6 +1489,8 @@ struct TShaderQualifiers {
layoutDerivativeGroupQuads = src.layoutDerivativeGroupQuads;
if (src.layoutDerivativeGroupLinear)
layoutDerivativeGroupLinear = src.layoutDerivativeGroupLinear;
if (src.derivativeGroupExtension != EdgNone)
derivativeGroupExtension = src.derivativeGroupExtension;
if (src.primitives != TQualifier::layoutNotSet)
primitives = src.primitives;
if (src.interlockOrdering != EioNone)
@@ -1501,7 +1554,9 @@ public:
bool coopmatNV : 1;
bool coopmatKHR : 1;
bool coopvecNV : 1;
bool longVector : 1;
bool tileAttachmentQCOM: 1;
uint32_t tensorRankARM : 4;
TArraySizes* arraySizes;
const TType* userDef;
TSourceLoc loc;
@@ -1513,11 +1568,17 @@ public:
bool isCoopmatNV() const { return coopmatNV; }
bool isCoopmatKHR() const { return coopmatKHR; }
bool isCoopvecNV() const { return coopvecNV; }
bool isCoopmatOrvec() const { return isCoopmat() || isCoopvecNV(); }
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() || isLongVector() || isTensorARM(); }
bool isTensorLayoutNV() const { return basicType == EbtTensorLayoutNV; }
bool isTensorViewNV() const { return basicType == EbtTensorViewNV; }
const TTypeParameters* getTypeParameters() const { return typeParameters; }
void initType(const TSourceLoc& l)
{
basicType = EbtVoid;
@@ -1531,7 +1592,9 @@ public:
coopmatNV = false;
coopmatKHR = false;
coopvecNV = false;
longVector = false;
tileAttachmentQCOM = false;
tensorRankARM = 0;
spirvType = nullptr;
}
@@ -1591,8 +1654,8 @@ 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<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
tileAttachmentQCOM(false), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(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)
{
assert(vs >= 0);
@@ -1607,8 +1670,8 @@ 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<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
tileAttachmentQCOM(false), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(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)
{
assert(vs >= 0);
@@ -1625,8 +1688,8 @@ 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),
tileAttachmentQCOM(p.tileAttachmentQCOM), arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters),
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)
{
if (basicType == EbtSampler)
@@ -1676,14 +1739,20 @@ public:
coopmatKHRUseValid = true;
}
}
if (p.isCoopvecNV() && p.typeParameters) {
if ((p.isCoopvecNV() || p.isLongVector()) && p.typeParameters) {
basicType = p.typeParameters->basicType;
}
if (p.isTensorARM() && p.typeParameters) {
basicType = p.typeParameters->basicType;
if (p.typeParameters->arraySizes->getNumDims() > 0) {
tensorRankARM = static_cast<uint32_t>(p.typeParameters->arraySizes->getDimSize(0)) & 0b1111;
}
}
}
// 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),
tileAttachmentQCOM(false), arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr),
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)
{
qualifier.clear();
@@ -1725,12 +1794,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;
@@ -1740,8 +1810,8 @@ 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),
tileAttachmentQCOM(false), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
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)
{
sampler.clear();
@@ -1750,8 +1820,8 @@ 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),
tileAttachmentQCOM(false), qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
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)
{
sampler.clear();
@@ -1760,7 +1830,7 @@ public:
// for block reference (first parameter must be EbtReference)
explicit TType(TBasicType t, const TType &p, const TString& n) :
basicType(t), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
tileAttachmentQCOM(false), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
spirvType(nullptr)
{
assert(t == EbtReference);
@@ -1799,7 +1869,9 @@ public:
coopmatKHRuse = copyOf.coopmatKHRuse;
coopmatKHRUseValid = copyOf.coopmatKHRUseValid;
coopvecNV = copyOf.isCoopVecNV();
longVector = copyOf.isLongVector();
tileAttachmentQCOM = copyOf.tileAttachmentQCOM;
tensorRankARM = copyOf.tensorRankARM;
}
// Make complete copy of the whole type graph rooted at 'copyOf'.
@@ -1839,6 +1911,7 @@ public:
return *typeName;
}
virtual bool hasFieldName() const { return (fieldName != nullptr); }
virtual const TString& getFieldName() const
{
assert(fieldName);
@@ -1883,7 +1956,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; }
@@ -1919,7 +1992,9 @@ 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; }
virtual bool isAttachmentEXT() const { return basicType == EbtSampler && getSampler().isAttachmentEXT(); }
@@ -1936,8 +2011,13 @@ public:
bool isCoopMatNV() const { return coopmatNV; }
bool isCoopMatKHR() const { return coopmatKHR; }
bool isCoopVecNV() const { return coopvecNV; }
bool isCoopMatOrVec() const { return isCoopMat() || isCoopVecNV(); }
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() || isLongVector() || isTensorARM(); }
int getTensorRankARM() const { return static_cast<int>(tensorRankARM); }
bool isReference() const { return getBasicType() == EbtReference; }
bool isSpirvType() const { return getBasicType() == EbtSpirvType; }
int getCoopMatKHRuse() const { return static_cast<int>(coopmatKHRuse); }
@@ -1969,6 +2049,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
{
@@ -1999,6 +2095,11 @@ public:
virtual bool containsNonOpaque() const
{
if (isTensorARM()) {
// Tensors have a numerical basicType even though it is Opaque
return false;
}
const auto nonOpaque = [](const TType* t) {
switch (t->basicType) {
case EbtVoid:
@@ -2044,6 +2145,10 @@ public:
{
return containsBasicType(EbtBFloat16);
}
bool contains8BitFloat() const
{
return containsBasicType(EbtFloatE5M2) || containsBasicType(EbtFloatE4M3);
}
bool contains64BitInt() const
{
return containsBasicType(EbtInt64) || containsBasicType(EbtUint64);
@@ -2064,6 +2169,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);
@@ -2187,6 +2296,8 @@ public:
case EbtTensorLayoutNV: return "tensorLayoutNV";
case EbtTensorViewNV: return "tensorViewNV";
case EbtCoopvecNV: return "coopvecNV";
case EbtTensorARM: return "tensorARM";
case EbtLongVector: return "vector";
default: return "unknown type";
}
}
@@ -2301,12 +2412,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(")");
}
}
@@ -2511,6 +2642,10 @@ public:
appendStr(" ");
appendStr("coopvecNV");
}
if (isLongVector()) {
appendStr(" ");
appendStr("vector");
}
appendStr("<");
for (int i = 0; i < (int)typeParameters->arraySizes->getNumDims(); ++i) {
@@ -2570,7 +2705,7 @@ public:
TString getBasicTypeString() const
{
if (basicType == EbtSampler)
return sampler.getString();
return TString{sampler.getString()};
else
return getBasicString();
}
@@ -2592,8 +2727,14 @@ public:
{
uint32_t components = 0;
if (isCoopVecNV()) {
components = typeParameters->arraySizes->getDimSize(0);
if (isCoopVecOrLongVector()) {
auto* arraySizes = typeParameters->arraySizes;
if (!arraySizes || arraySizes->getNumDims() < 1) {
// This is a malformed vector type. A later step will
// catch the error and emit a diagnostic.
return 0;
}
components = arraySizes->getDimSize(0);
} else if (getBasicType() == EbtStruct || getBasicType() == EbtBlock) {
for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++)
components += ((*tl).type)->computeNumComponents();
@@ -2609,6 +2750,10 @@ public:
return static_cast<int>(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
{
@@ -2799,6 +2944,8 @@ public:
isCoopMatNV() == right.isCoopMatNV() &&
isCoopMatKHR() == right.isCoopMatKHR() &&
isCoopVecNV() == right.isCoopVecNV() &&
isLongVector() == right.isLongVector() &&
isTensorARM() == right.isTensorARM() &&
sameStructType(right, lpidx, rpidx) &&
sameReferenceType(right);
}
@@ -2866,9 +3013,18 @@ public:
if (isTensorViewNV()) {
return right.isTensorViewNV() && right.typeParameters == nullptr && typeParameters != nullptr;
}
if (isTensorARM()) {
return right.isTensorARM() && right.typeParameters == nullptr && typeParameters != nullptr;
}
return false;
}
bool sameTensorBaseTypeARM(const TType &right) const {
return (typeParameters == nullptr || right.typeParameters == nullptr ||
(tensorRankARM == right.tensorRankARM && getBasicType() == right.getBasicType()));
}
bool sameCoopVecBaseType(const TType &right) const {
bool rv = false;
@@ -2885,6 +3041,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;
}
@@ -2915,6 +3091,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
{
@@ -3015,7 +3216,9 @@ 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;
TArraySizes* arraySizes; // nullptr unless an array; can be shared across types
@@ -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; }
@@ -0,0 +1,63 @@
//
// Copyright 2026 Google LLC
//
// 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 GLSLANG_INCLUDE_DEFER_H
#define GLSLANG_INCLUDE_DEFER_H
#include <utility>
namespace glslang {
// An object that, when destroyed, executes a given function.
// Use this to perform work along all exit paths from a function.
template <typename F>
class Defer {
public:
explicit Defer(F&& f) : f_(std::move(f)) { }
Defer(Defer&&) = default;
~Defer() { f_(); } // Run the given function.
private:
Defer(const Defer&) = delete;
Defer& operator=(const Defer&) = delete;
F f_;
};
// Template argument deduction guide for Defer.
template <typename T>
Defer(T) -> Defer<T>;
} // namespace glslang
#endif
@@ -479,6 +479,10 @@ enum TOperator {
EOpCooperativeVectorOuterProductAccumulateNV,
EOpCooperativeVectorReduceSumAccumulateNV,
EOpTensorReadARM,
EOpTensorWriteARM,
EOpTensorSizeARM,
EOpBeginInvocationInterlock, // Fragment only
EOpEndInvocationInterlock, // Fragment only
@@ -871,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
//
@@ -958,6 +1000,9 @@ enum TOperator {
EOpAssumeEXT,
EOpExpectEXT,
// GL_EXT_abort
EOpAbortEXT,
// Shader Clock Ops
EOpReadClockSubgroupKHR,
EOpReadClockDeviceKHR,
@@ -981,6 +1026,12 @@ enum TOperator {
EOpImageBlockMatchGatherSSDQCOM,
EOpImageBlockMatchGatherSADQCOM,
// Cooperative Matrix Conversion
EOpBitCastArrayQCOM,
EOpExtractSubArrayQCOM,
EOpCompositeConstructCoopMatQCOM,
EOpCompositeExtractCoopMatQCOM,
// GL_NV_cluster_acceleration_structure
EOpRayQueryGetIntersectionClusterIdNV,
EOpHitObjectGetClusterIdNV,
@@ -1011,6 +1062,7 @@ enum TLinkType {
};
class TIntermTraverser;
class TIntermVariableDecl;
class TIntermOperator;
class TIntermAggregate;
class TIntermUnary;
@@ -1039,6 +1091,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; }
@@ -1052,6 +1105,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; }
@@ -1082,6 +1136,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.
//
@@ -1104,6 +1189,7 @@ public:
virtual int getVectorSize() const { return type.getVectorSize(); }
virtual int getMatrixCols() const { return type.getMatrixCols(); }
virtual int getMatrixRows() const { return type.getMatrixRows(); }
virtual int getTensorRankARM() const { return type.getTensorRankARM(); }
virtual bool isMatrix() const { return type.isMatrix(); }
virtual bool isArray() const { return type.isArray(); }
virtual bool isVector() const { return type.isVector(); }
@@ -1125,7 +1211,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),
@@ -1144,10 +1230,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;
@@ -1181,7 +1277,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
@@ -1742,24 +1838,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; }
@@ -1786,6 +1884,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&);
@@ -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
@@ -46,7 +46,7 @@ namespace {
using namespace glslang;
const double pi = 3.1415926535897932384626433832795;
constexpr double pi = 3.1415926535897932384626433832795;
} // end anonymous namespace
File diff suppressed because it is too large Load Diff
@@ -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_
@@ -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
@@ -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;
@@ -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)
{ }
@@ -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() &&
@@ -424,7 +427,7 @@ const TFunction* TParseContextBase::selectFunction(
// to even be a potential match, number of arguments must be >= the number of
// fixed (non-default) parameters, and <= the total (including parameter with defaults).
if (call.getParamCount() < candidate.getFixedParamCount() ||
call.getParamCount() > candidate.getParamCount())
(call.getParamCount() > candidate.getParamCount() && !candidate.isVariadic()))
continue;
// see if arguments are convertible
@@ -463,7 +466,8 @@ const TFunction* TParseContextBase::selectFunction(
const auto betterParam = [&call, &better](const TFunction& can1, const TFunction& can2) -> bool {
// is call -> can2 better than call -> can1 for any parameter
bool hasBetterParam = false;
for (int param = 0; param < call.getParamCount(); ++param) {
const int paramCount = std::min({call.getParamCount(), can1.getParamCount(), can2.getParamCount()});
for (int param = 0; param < paramCount; ++param) {
if (better(*call[param].type, *can1[param].type, *can2[param].type)) {
hasBetterParam = true;
break;
@@ -474,7 +478,8 @@ const TFunction* TParseContextBase::selectFunction(
const auto equivalentParams = [&call, &better](const TFunction& can1, const TFunction& can2) -> bool {
// is call -> can2 equivalent to call -> can1 for all the call parameters?
for (int param = 0; param < call.getParamCount(); ++param) {
const int paramCount = std::min({call.getParamCount(), can1.getParamCount(), can2.getParamCount()});
for (int param = 0; param < paramCount; ++param) {
if (better(*call[param].type, *can1[param].type, *can2[param].type) ||
better(*call[param].type, *can2[param].type, *can1[param].type))
return false;
@@ -482,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);
@@ -497,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;
}
File diff suppressed because it is too large Load Diff
@@ -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; }
@@ -344,6 +344,7 @@ public:
TIntermTyped* handleUnaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* childNode);
TIntermTyped* handleDotDereference(const TSourceLoc&, TIntermTyped* base, const TString& field);
TIntermTyped* handleDotSwizzle(const TSourceLoc&, TIntermTyped* base, const TString& field);
TIntermTyped* handleTypeCast(const TSourceLoc&, TType *castType, TIntermTyped *base);
void blockMemberExtensionCheck(const TSourceLoc&, const TIntermTyped* base, int member, const TString& memberName);
TFunction* handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype);
TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&);
@@ -357,6 +358,7 @@ public:
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const;
TIntermTyped* addAssign(const TSourceLoc&, TOperator op, TIntermTyped* left, TIntermTyped* right);
void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);
void requireDerivativeLayout(const TSourceLoc&, const char* featureDesc);
void nonOpBuiltInCheck(const TSourceLoc&, const TFunction&, TIntermAggregate&);
void userFunctionCallCheck(const TSourceLoc&, TIntermAggregate&);
void samplerConstructorLocationCheck(const TSourceLoc&, const char* token, TIntermNode*);
@@ -381,6 +383,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 +400,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&);
@@ -407,14 +411,14 @@ public:
void setDefaultPrecision(const TSourceLoc&, TPublicType&, TPrecisionQualifier);
int computeSamplerTypeIndex(TSampler&);
TPrecisionQualifier getDefaultPrecision(TPublicType&);
void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&, bool isCoopMatOrVec);
void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&, bool hasTypeParameter);
void parameterTypeCheck(const TSourceLoc&, TStorageQualifier qualifier, const TType& type);
bool containsFieldWithBasicType(const TType& type ,TBasicType basicType);
TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&);
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);
@@ -450,8 +454,13 @@ public:
TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&);
TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&);
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset);
void makeVariadic(TFunction *F, const TSourceLoc &loc);
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);
@@ -510,6 +519,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;
@@ -520,6 +531,32 @@ protected:
virtual void setAtomicCounterBlockDefaults(TType& block) const override;
virtual void setInvariant(const TSourceLoc& loc, const char* builtin) override;
// Returns true if the given long vector type is correctly parameterized.
// Otherwise emits an error and returns false.
template<typename TTYPE>
bool isValidLongVectorElseError(const TSourceLoc& loc, const TTYPE& type) {
assert(type.isLongVector());
const TTypeParameters* typeParams = type.getTypeParameters();
if (typeParams == nullptr) {
error(loc, "vector type missing type parameters", "", "");
return false;
}
const auto basicType = typeParams->basicType;
if (!isTypeInt(basicType) && !isTypeFloat(basicType) && basicType != EbtBool) {
error(loc, "invalid element type for vector", TType::getBasicString(typeParams->basicType), "");
return false;
}
if (typeParams->arraySizes == nullptr) {
error(loc, "vector type missing element count", "", "");
return false;
}
if (typeParams->arraySizes->getNumDims() != 1) {
error(loc, "vector type requires exactly 1 element count", "", "");
return false;
}
return true;
}
public:
//
// Generally, bison productions, the scanner, and the PP need read/write access to these; just give them direct access
@@ -548,6 +585,7 @@ protected:
TString currentCaller; // name of last function body entered (not valid when at global scope)
int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point
bool anyIndexLimits;
bool khrDerivativeLayoutQualifierSpecified;
TIdSetType inductiveLoopIds;
TVector<TIntermTyped*> needsIndexLimitationChecking;
TStructRecord matrixFixRecord;
@@ -148,7 +148,7 @@ void TAllocation::checkGuardBlock(unsigned char*, unsigned char, const char*) co
#endif
{
#ifdef GUARD_BLOCKS
for (size_t x = 0; x < guardBlockSize; x++) {
for (size_t x = 0; x < guardBlockSize(); x++) {
if (blockMem[x] != val) {
const int maxSize = 80;
char assertMsg[maxSize];
@@ -160,7 +160,7 @@ void TAllocation::checkGuardBlock(unsigned char*, unsigned char, const char*) co
}
}
#else
assert(guardBlockSize == 0);
assert(guardBlockSize() == 0);
#endif
}
@@ -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;
}
};
//
@@ -769,11 +769,19 @@ const std::unordered_map<const char*, int, str_hash, str_eq> KeywordMap {
{"hitObjectNV",HITOBJECTNV},
{"hitObjectAttributeNV",HITOBJECTATTRNV},
{"tensorARM",TENSORARM},
{"hitObjectEXT",HITOBJECTEXT},
{"hitObjectAttributeEXT",HITOBJECTATTREXT},
{"__function",FUNCTION},
{"tensorLayoutNV",TENSORLAYOUTNV},
{"tensorViewNV",TENSORVIEWNV},
{"coopvecNV",COOPVECNV},
{"vector",VECTOR},
{"resourceheap",RESOURCEHEAP},
{"samplerheap",SAMPLERHEAP},
};
const std::unordered_set<const char*, str_hash, str_eq> ReservedSet {
"common",
@@ -834,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;
@@ -848,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;
@@ -1338,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:
@@ -1355,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:
@@ -1372,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:
@@ -1389,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:
@@ -1419,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:
@@ -1450,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:
@@ -1484,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();
@@ -1497,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();
@@ -1508,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();
@@ -1519,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();
@@ -1791,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:
@@ -1843,32 +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:
if (parseContext.symbolTable.atBuiltInLevel() ||
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:
@@ -1899,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
@@ -1906,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();
@@ -1927,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;
}
}
@@ -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;
@@ -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<std::string>& base) { intermediate->setResourceSetBinding(base); }
void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); }
@@ -63,13 +63,13 @@ TSpirvRequirement* TParseContext::makeSpirvRequirement(const TSourceLoc& loc, co
if (name == "extensions") {
assert(extensions);
for (auto extension : extensions->getSequence()) {
for (const auto& extension : extensions->getSequence()) {
assert(extension->getAsConstantUnion());
spirvReq->extensions.insert(*extension->getAsConstantUnion()->getConstArray()[0].getSConst());
}
} else if (name == "capabilities") {
assert(capabilities);
for (auto capability : capabilities->getSequence()) {
for (const auto& capability : capabilities->getSequence()) {
assert(capability->getAsConstantUnion());
spirvReq->capabilities.insert(capability->getAsConstantUnion()->getConstArray()[0].getIConst());
}
@@ -105,10 +105,10 @@ void TIntermediate::insertSpirvRequirement(const TSpirvRequirement* spirvReq)
if (!spirvRequirement)
spirvRequirement = new TSpirvRequirement;
for (auto extension : spirvReq->extensions)
for (const auto& extension : spirvReq->extensions)
spirvRequirement->extensions.insert(extension);
for (auto capability : spirvReq->capabilities)
for (const auto& capability : spirvReq->capabilities)
spirvRequirement->capabilities.insert(capability);
}
@@ -122,7 +122,7 @@ void TIntermediate::insertSpirvExecutionMode(int executionMode, const TIntermAgg
TVector<const TIntermConstantUnion*> extraOperands;
if (args) {
for (auto arg : args->getSequence()) {
for (const auto& arg : args->getSequence()) {
auto extraOperand = arg->getAsConstantUnion();
assert(extraOperand != nullptr);
extraOperands.push_back(extraOperand);
@@ -139,7 +139,7 @@ void TIntermediate::insertSpirvExecutionModeId(int executionMode, const TIntermA
assert(args);
TVector<const TIntermTyped*> extraOperands;
for (auto arg : args->getSequence()) {
for (const auto& arg : args->getSequence()) {
auto extraOperand = arg->getAsTyped();
assert(extraOperand != nullptr && extraOperand->getQualifier().isConstant());
extraOperands.push_back(extraOperand);
@@ -157,7 +157,7 @@ void TQualifier::setSpirvDecorate(int decoration, const TIntermAggregate* args)
TVector<const TIntermConstantUnion*> extraOperands;
if (args) {
for (auto arg : args->getSequence()) {
for (const auto& arg : args->getSequence()) {
auto extraOperand = arg->getAsConstantUnion();
assert(extraOperand != nullptr);
extraOperands.push_back(extraOperand);
@@ -173,7 +173,7 @@ void TQualifier::setSpirvDecorateId(int decoration, const TIntermAggregate* args
assert(args);
TVector<const TIntermTyped*> extraOperands;
for (auto arg : args->getSequence()) {
for (const auto& arg : args->getSequence()) {
auto extraOperand = arg->getAsTyped();
assert(extraOperand != nullptr);
extraOperands.push_back(extraOperand);
@@ -188,7 +188,7 @@ void TQualifier::setSpirvDecorateString(int decoration, const TIntermAggregate*
assert(args);
TVector<const TIntermConstantUnion*> extraOperands;
for (auto arg : args->getSequence()) {
for (const auto& arg : args->getSequence()) {
auto extraOperand = arg->getAsConstantUnion();
assert(extraOperand != nullptr);
extraOperands.push_back(extraOperand);
@@ -234,30 +234,30 @@ TString TQualifier::getSpirvDecorateQualifierString() const
}
};
for (auto& decorate : spirvDecorate->decorates) {
for (const auto& decorate : spirvDecorate->decorates) {
appendStr("spirv_decorate(");
appendInt(decorate.first);
for (auto extraOperand : decorate.second) {
for (const auto& extraOperand : decorate.second) {
appendStr(", ");
appendDecorate(extraOperand);
}
appendStr(") ");
}
for (auto& decorateId : spirvDecorate->decorateIds) {
for (const auto& decorateId : spirvDecorate->decorateIds) {
appendStr("spirv_decorate_id(");
appendInt(decorateId.first);
for (auto extraOperand : decorateId.second) {
for (const auto& extraOperand : decorateId.second) {
appendStr(", ");
appendDecorate(extraOperand);
}
appendStr(") ");
}
for (auto& decorateString : spirvDecorate->decorateStrings) {
for (const auto& decorateString : spirvDecorate->decorateStrings) {
appendStr("spirv_decorate_string(");
appendInt(decorateString.first);
for (auto extraOperand : decorateString.second) {
for (const auto& extraOperand : decorateString.second) {
appendStr(", ");
appendDecorate(extraOperand);
}
@@ -55,7 +55,9 @@ namespace glslang {
//
void TType::buildMangledName(TString& mangledName) const
{
if (isMatrix())
if (isTensorARM())
mangledName += 'T';
else if (isMatrix())
mangledName += 'm';
else if (isVector())
mangledName += 'v';
@@ -84,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:
@@ -344,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<std::vector<const char *>(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).
@@ -423,6 +444,7 @@ TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf)
defined = copyOf.defined;
prototyped = copyOf.prototyped;
implicitThis = copyOf.implicitThis;
variadic = copyOf.variadic;
illegalImplicitThis = copyOf.illegalImplicitThis;
defaultParamCount = copyOf.defaultParamCount;
spirvInst = copyOf.spirvInst;
@@ -69,6 +69,9 @@
#include "../Include/intermediate.h"
#include "../Include/InfoSink.h"
#include <functional>
#include <unordered_map>
namespace glslang {
//
@@ -232,6 +235,13 @@ struct TParameter {
name = nullptr;
type = param.type->clone();
defaultValue = param.defaultValue;
if (defaultValue) {
// The defaultValue of a builtin is created in a TPoolAllocator that no longer exists
// when parsing the user program, so make a deep copy.
if (const auto *constUnion = defaultValue->getAsConstantUnion()) {
defaultValue = new TIntermConstantUnion(*constUnion->getConstArray().clone(), constUnion->getType());
}
}
return *this;
}
TBuiltInVariable getDeclaredBuiltIn() const { return type->getQualifier().declaredBuiltIn; }
@@ -245,12 +255,12 @@ public:
explicit TFunction(TOperator o) :
TSymbol(nullptr),
op(o),
defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) { }
defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), variadic(false), defaultParamCount(0) { }
TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) :
TSymbol(name),
mangledName(*name + '('),
op(tOp),
defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0),
defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), variadic(false), defaultParamCount(0),
linkType(ELinkNone)
{
returnType.shallowCopy(retType);
@@ -268,6 +278,7 @@ public:
virtual void addParameter(TParameter& p)
{
assert(writable);
assert(!variadic && "cannot add more parameters if function is marked variadic");
parameters.push_back(p);
p.type->appendMangledName(mangledName);
@@ -310,6 +321,13 @@ public:
virtual bool hasImplicitThis() const { return implicitThis; }
virtual void setIllegalImplicitThis() { assert(writable); illegalImplicitThis = true; }
virtual bool hasIllegalImplicitThis() const { return illegalImplicitThis; }
virtual void setVariadic() {
assert(writable);
assert(!variadic && "function was already marked variadic");
variadic = true;
mangledName += 'z';
}
virtual bool isVariadic() const { return variadic; }
// Return total number of parameters
virtual int getParamCount() const { return static_cast<int>(parameters.size()); }
@@ -352,6 +370,7 @@ protected:
// even if it finds member variables in the symbol table.
// This is important for a static member function that has member variables in scope,
// but is not allowed to use them, or see hidden symbols instead.
bool variadic;
int defaultParamCount;
TSpirvInstruction spirvInst; // SPIR-V instruction qualifiers
@@ -487,6 +506,11 @@ public:
retargetedSymbols.push_back({from, to});
}
void collectRetargetedSymbols(std::unordered_multimap<std::string, std::string> &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);
@@ -580,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<std::vector<const char *>(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;
@@ -643,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; }
@@ -810,6 +836,13 @@ public:
table[level]->retargetSymbol(from, to);
}
std::unordered_multimap<std::string, std::string> collectBuiltinAlias() {
std::unordered_multimap<std::string, std::string> 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
@@ -882,6 +915,12 @@ public:
table[level]->setFunctionExtensions(name, num, extensions);
}
void setFunctionExtensionsCallback(const char* name, std::function<std::vector<const char *>(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)
@@ -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;
@@ -268,6 +269,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_control_flow_attributes2] = EBhDisable;
extensionBehavior[E_GL_EXT_spec_constant_composites] = EBhDisable;
extensionBehavior[E_GL_EXT_abort] = EBhDisable;
extensionBehavior[E_GL_KHR_cooperative_matrix] = EBhDisable;
extensionBehavior[E_GL_NV_cooperative_vector] = EBhDisable;
@@ -304,6 +306,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_NV_ray_tracing] = EBhDisable;
extensionBehavior[E_GL_NV_ray_tracing_motion_blur] = EBhDisable;
extensionBehavior[E_GL_NV_fragment_shader_barycentric] = EBhDisable;
extensionBehavior[E_GL_KHR_compute_shader_derivatives] = EBhDisable;
extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable;
extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable;
extensionBehavior[E_GL_NV_mesh_shader] = EBhDisable;
@@ -316,14 +319,21 @@ 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;
extensionBehavior[E_GL_NV_explicit_typecast] = EBhDisable;
// ARM
extensionBehavior[E_GL_ARM_shader_core_builtins] = EBhDisable;
extensionBehavior[E_GL_ARM_tensors] = EBhDisable;
extensionBehavior[E_GL_ARM_tensors_bfloat16] = EBhDisable;
extensionBehavior[E_GL_ARM_tensors_float_e5m2] = EBhDisable;
extensionBehavior[E_GL_ARM_tensors_float_e4m3] = EBhDisable;
// QCOM
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;
@@ -342,6 +352,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;
@@ -383,6 +394,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;
@@ -408,6 +423,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);
}
@@ -429,6 +446,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"
@@ -448,6 +466,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"
@@ -464,6 +483,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) {
@@ -517,6 +537,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"
@@ -537,6 +558,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_shared_memory_block 1\n"
"#define GL_EXT_shader_integer_mix 1\n"
"#define GL_EXT_spec_constant_composites 1\n"
"#define GL_EXT_abort 1\n"
// GL_KHR_shader_subgroup
"#define GL_KHR_shader_subgroup_basic 1\n"
@@ -584,6 +606,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_NV_ray_tracing 1\n"
"#define GL_NV_ray_tracing_motion_blur 1\n"
"#define GL_NV_fragment_shader_barycentric 1\n"
"#define GL_KHR_compute_shader_derivatives 1\n"
"#define GL_NV_compute_shader_derivatives 1\n"
"#define GL_NV_shader_texture_footprint 1\n"
"#define GL_NV_mesh_shader 1\n"
@@ -591,10 +614,12 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_NV_integer_cooperative_matrix 1\n"
"#define GL_NV_shader_invocation_reorder 1\n"
"#define GL_NV_cooperative_matrix2 1\n"
"#define GL_NV_explicit_typecast 1\n"
"#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"
@@ -623,6 +648,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) {
@@ -644,6 +674,20 @@ void TParseVersions::getPreamble(std::string& preamble)
if (version >= 130) {
preamble +="#define GL_FRAGMENT_PRECISION_HIGH 1\n";
}
if (version >= 460) {
preamble +=
"#define GL_ARM_tensors 1\n"
"#define GL_ARM_tensors_bfloat16 1\n"
"#define GL_ARM_tensors_float_e5m2 1\n"
"#define GL_ARM_tensors_float_e4m3 1\n"
;
}
}
if ((!isEsProfile() && version >= 460) ||
(isEsProfile() && version >= 320)) {
preamble += "#define GL_EXT_nontemporal_keyword 1\n";
}
if ((!isEsProfile() && version >= 140) ||
@@ -712,8 +756,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;
}
}
@@ -1463,6 +1507,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) {
@@ -1487,6 +1539,22 @@ void TParseVersions::intattachmentCheck(const TSourceLoc& loc, const char* op, b
}
}
void TParseVersions::tensorCheckARM(const TSourceLoc& loc, const char* op, bool builtIn)
{
if (!builtIn) {
const char* const extensions[] = {E_GL_ARM_tensors};
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
}
}
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)
{
@@ -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";
@@ -185,6 +186,7 @@ const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_lo
const char* const E_GL_EXT_shader_16bit_storage = "GL_EXT_shader_16bit_storage";
const char* const E_GL_EXT_shader_8bit_storage = "GL_EXT_shader_8bit_storage";
const char* const E_GL_EXT_abort = "GL_EXT_abort";
// EXT extensions
@@ -226,6 +228,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
@@ -275,6 +281,7 @@ const char* const E_GL_NV_shading_rate_image = "GL_NV_shading
const char* const E_GL_NV_ray_tracing = "GL_NV_ray_tracing";
const char* const E_GL_NV_ray_tracing_motion_blur = "GL_NV_ray_tracing_motion_blur";
const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragment_shader_barycentric";
const char* const E_GL_KHR_compute_shader_derivatives = "GL_KHR_compute_shader_derivatives";
const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives";
const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint";
const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_shader";
@@ -290,9 +297,15 @@ 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";
const char* const E_GL_NV_explicit_typecast = "GL_NV_explicit_typecast";
// ARM
const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins";
const char* const E_GL_ARM_tensors = "GL_ARM_tensors";
const char* const E_GL_ARM_tensors_bfloat16 = "GL_ARM_tensors_bfloat16";
const char* const E_GL_ARM_tensors_float_e5m2 = "GL_ARM_tensors_float_e5m2";
const char* const E_GL_ARM_tensors_float_e4m3 = "GL_ARM_tensors_float_e4m3";
// Arrays of extensions for the above viewportEXTs duplications
@@ -303,6 +316,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";
@@ -361,6 +375,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
File diff suppressed because it is too large Load Diff
@@ -231,308 +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 */
SAMPLERCUBEARRAY = 439, /* SAMPLERCUBEARRAY */
SAMPLERCUBEARRAYSHADOW = 440, /* SAMPLERCUBEARRAYSHADOW */
ISAMPLERCUBEARRAY = 441, /* ISAMPLERCUBEARRAY */
USAMPLERCUBEARRAY = 442, /* USAMPLERCUBEARRAY */
SAMPLER1D = 443, /* SAMPLER1D */
SAMPLER1DARRAY = 444, /* SAMPLER1DARRAY */
SAMPLER1DARRAYSHADOW = 445, /* SAMPLER1DARRAYSHADOW */
ISAMPLER1D = 446, /* ISAMPLER1D */
SAMPLER1DSHADOW = 447, /* SAMPLER1DSHADOW */
SAMPLER2DRECT = 448, /* SAMPLER2DRECT */
SAMPLER2DRECTSHADOW = 449, /* SAMPLER2DRECTSHADOW */
ISAMPLER2DRECT = 450, /* ISAMPLER2DRECT */
USAMPLER2DRECT = 451, /* USAMPLER2DRECT */
SAMPLERBUFFER = 452, /* SAMPLERBUFFER */
ISAMPLERBUFFER = 453, /* ISAMPLERBUFFER */
USAMPLERBUFFER = 454, /* USAMPLERBUFFER */
SAMPLER2DMS = 455, /* SAMPLER2DMS */
ISAMPLER2DMS = 456, /* ISAMPLER2DMS */
USAMPLER2DMS = 457, /* USAMPLER2DMS */
SAMPLER2DMSARRAY = 458, /* SAMPLER2DMSARRAY */
ISAMPLER2DMSARRAY = 459, /* ISAMPLER2DMSARRAY */
USAMPLER2DMSARRAY = 460, /* USAMPLER2DMSARRAY */
SAMPLEREXTERNALOES = 461, /* SAMPLEREXTERNALOES */
SAMPLEREXTERNAL2DY2YEXT = 462, /* SAMPLEREXTERNAL2DY2YEXT */
ISAMPLER1DARRAY = 463, /* ISAMPLER1DARRAY */
USAMPLER1D = 464, /* USAMPLER1D */
USAMPLER1DARRAY = 465, /* USAMPLER1DARRAY */
F16SAMPLER1D = 466, /* F16SAMPLER1D */
F16SAMPLER2D = 467, /* F16SAMPLER2D */
F16SAMPLER3D = 468, /* F16SAMPLER3D */
F16SAMPLER2DRECT = 469, /* F16SAMPLER2DRECT */
F16SAMPLERCUBE = 470, /* F16SAMPLERCUBE */
F16SAMPLER1DARRAY = 471, /* F16SAMPLER1DARRAY */
F16SAMPLER2DARRAY = 472, /* F16SAMPLER2DARRAY */
F16SAMPLERCUBEARRAY = 473, /* F16SAMPLERCUBEARRAY */
F16SAMPLERBUFFER = 474, /* F16SAMPLERBUFFER */
F16SAMPLER2DMS = 475, /* F16SAMPLER2DMS */
F16SAMPLER2DMSARRAY = 476, /* F16SAMPLER2DMSARRAY */
F16SAMPLER1DSHADOW = 477, /* F16SAMPLER1DSHADOW */
F16SAMPLER2DSHADOW = 478, /* F16SAMPLER2DSHADOW */
F16SAMPLER1DARRAYSHADOW = 479, /* F16SAMPLER1DARRAYSHADOW */
F16SAMPLER2DARRAYSHADOW = 480, /* F16SAMPLER2DARRAYSHADOW */
F16SAMPLER2DRECTSHADOW = 481, /* F16SAMPLER2DRECTSHADOW */
F16SAMPLERCUBESHADOW = 482, /* F16SAMPLERCUBESHADOW */
F16SAMPLERCUBEARRAYSHADOW = 483, /* F16SAMPLERCUBEARRAYSHADOW */
IMAGE1D = 484, /* IMAGE1D */
IIMAGE1D = 485, /* IIMAGE1D */
UIMAGE1D = 486, /* UIMAGE1D */
IMAGE2D = 487, /* IMAGE2D */
IIMAGE2D = 488, /* IIMAGE2D */
UIMAGE2D = 489, /* UIMAGE2D */
IMAGE3D = 490, /* IMAGE3D */
IIMAGE3D = 491, /* IIMAGE3D */
UIMAGE3D = 492, /* UIMAGE3D */
IMAGE2DRECT = 493, /* IMAGE2DRECT */
IIMAGE2DRECT = 494, /* IIMAGE2DRECT */
UIMAGE2DRECT = 495, /* UIMAGE2DRECT */
IMAGECUBE = 496, /* IMAGECUBE */
IIMAGECUBE = 497, /* IIMAGECUBE */
UIMAGECUBE = 498, /* UIMAGECUBE */
IMAGEBUFFER = 499, /* IMAGEBUFFER */
IIMAGEBUFFER = 500, /* IIMAGEBUFFER */
UIMAGEBUFFER = 501, /* UIMAGEBUFFER */
IMAGE1DARRAY = 502, /* IMAGE1DARRAY */
IIMAGE1DARRAY = 503, /* IIMAGE1DARRAY */
UIMAGE1DARRAY = 504, /* UIMAGE1DARRAY */
IMAGE2DARRAY = 505, /* IMAGE2DARRAY */
IIMAGE2DARRAY = 506, /* IIMAGE2DARRAY */
UIMAGE2DARRAY = 507, /* UIMAGE2DARRAY */
IMAGECUBEARRAY = 508, /* IMAGECUBEARRAY */
IIMAGECUBEARRAY = 509, /* IIMAGECUBEARRAY */
UIMAGECUBEARRAY = 510, /* UIMAGECUBEARRAY */
IMAGE2DMS = 511, /* IMAGE2DMS */
IIMAGE2DMS = 512, /* IIMAGE2DMS */
UIMAGE2DMS = 513, /* UIMAGE2DMS */
IMAGE2DMSARRAY = 514, /* IMAGE2DMSARRAY */
IIMAGE2DMSARRAY = 515, /* IIMAGE2DMSARRAY */
UIMAGE2DMSARRAY = 516, /* UIMAGE2DMSARRAY */
F16IMAGE1D = 517, /* F16IMAGE1D */
F16IMAGE2D = 518, /* F16IMAGE2D */
F16IMAGE3D = 519, /* F16IMAGE3D */
F16IMAGE2DRECT = 520, /* F16IMAGE2DRECT */
F16IMAGECUBE = 521, /* F16IMAGECUBE */
F16IMAGE1DARRAY = 522, /* F16IMAGE1DARRAY */
F16IMAGE2DARRAY = 523, /* F16IMAGE2DARRAY */
F16IMAGECUBEARRAY = 524, /* F16IMAGECUBEARRAY */
F16IMAGEBUFFER = 525, /* F16IMAGEBUFFER */
F16IMAGE2DMS = 526, /* F16IMAGE2DMS */
F16IMAGE2DMSARRAY = 527, /* F16IMAGE2DMSARRAY */
I64IMAGE1D = 528, /* I64IMAGE1D */
U64IMAGE1D = 529, /* U64IMAGE1D */
I64IMAGE2D = 530, /* I64IMAGE2D */
U64IMAGE2D = 531, /* U64IMAGE2D */
I64IMAGE3D = 532, /* I64IMAGE3D */
U64IMAGE3D = 533, /* U64IMAGE3D */
I64IMAGE2DRECT = 534, /* I64IMAGE2DRECT */
U64IMAGE2DRECT = 535, /* U64IMAGE2DRECT */
I64IMAGECUBE = 536, /* I64IMAGECUBE */
U64IMAGECUBE = 537, /* U64IMAGECUBE */
I64IMAGEBUFFER = 538, /* I64IMAGEBUFFER */
U64IMAGEBUFFER = 539, /* U64IMAGEBUFFER */
I64IMAGE1DARRAY = 540, /* I64IMAGE1DARRAY */
U64IMAGE1DARRAY = 541, /* U64IMAGE1DARRAY */
I64IMAGE2DARRAY = 542, /* I64IMAGE2DARRAY */
U64IMAGE2DARRAY = 543, /* U64IMAGE2DARRAY */
I64IMAGECUBEARRAY = 544, /* I64IMAGECUBEARRAY */
U64IMAGECUBEARRAY = 545, /* U64IMAGECUBEARRAY */
I64IMAGE2DMS = 546, /* I64IMAGE2DMS */
U64IMAGE2DMS = 547, /* U64IMAGE2DMS */
I64IMAGE2DMSARRAY = 548, /* I64IMAGE2DMSARRAY */
U64IMAGE2DMSARRAY = 549, /* U64IMAGE2DMSARRAY */
TEXTURECUBEARRAY = 550, /* TEXTURECUBEARRAY */
ITEXTURECUBEARRAY = 551, /* ITEXTURECUBEARRAY */
UTEXTURECUBEARRAY = 552, /* UTEXTURECUBEARRAY */
TEXTURE1D = 553, /* TEXTURE1D */
ITEXTURE1D = 554, /* ITEXTURE1D */
UTEXTURE1D = 555, /* UTEXTURE1D */
TEXTURE1DARRAY = 556, /* TEXTURE1DARRAY */
ITEXTURE1DARRAY = 557, /* ITEXTURE1DARRAY */
UTEXTURE1DARRAY = 558, /* UTEXTURE1DARRAY */
TEXTURE2DRECT = 559, /* TEXTURE2DRECT */
ITEXTURE2DRECT = 560, /* ITEXTURE2DRECT */
UTEXTURE2DRECT = 561, /* UTEXTURE2DRECT */
TEXTUREBUFFER = 562, /* TEXTUREBUFFER */
ITEXTUREBUFFER = 563, /* ITEXTUREBUFFER */
UTEXTUREBUFFER = 564, /* UTEXTUREBUFFER */
TEXTURE2DMS = 565, /* TEXTURE2DMS */
ITEXTURE2DMS = 566, /* ITEXTURE2DMS */
UTEXTURE2DMS = 567, /* UTEXTURE2DMS */
TEXTURE2DMSARRAY = 568, /* TEXTURE2DMSARRAY */
ITEXTURE2DMSARRAY = 569, /* ITEXTURE2DMSARRAY */
UTEXTURE2DMSARRAY = 570, /* UTEXTURE2DMSARRAY */
F16TEXTURE1D = 571, /* F16TEXTURE1D */
F16TEXTURE2D = 572, /* F16TEXTURE2D */
F16TEXTURE3D = 573, /* F16TEXTURE3D */
F16TEXTURE2DRECT = 574, /* F16TEXTURE2DRECT */
F16TEXTURECUBE = 575, /* F16TEXTURECUBE */
F16TEXTURE1DARRAY = 576, /* F16TEXTURE1DARRAY */
F16TEXTURE2DARRAY = 577, /* F16TEXTURE2DARRAY */
F16TEXTURECUBEARRAY = 578, /* F16TEXTURECUBEARRAY */
F16TEXTUREBUFFER = 579, /* F16TEXTUREBUFFER */
F16TEXTURE2DMS = 580, /* F16TEXTURE2DMS */
F16TEXTURE2DMSARRAY = 581, /* F16TEXTURE2DMSARRAY */
SUBPASSINPUT = 582, /* SUBPASSINPUT */
SUBPASSINPUTMS = 583, /* SUBPASSINPUTMS */
ISUBPASSINPUT = 584, /* ISUBPASSINPUT */
ISUBPASSINPUTMS = 585, /* ISUBPASSINPUTMS */
USUBPASSINPUT = 586, /* USUBPASSINPUT */
USUBPASSINPUTMS = 587, /* USUBPASSINPUTMS */
F16SUBPASSINPUT = 588, /* F16SUBPASSINPUT */
F16SUBPASSINPUTMS = 589, /* F16SUBPASSINPUTMS */
SPIRV_INSTRUCTION = 590, /* SPIRV_INSTRUCTION */
SPIRV_EXECUTION_MODE = 591, /* SPIRV_EXECUTION_MODE */
SPIRV_EXECUTION_MODE_ID = 592, /* SPIRV_EXECUTION_MODE_ID */
SPIRV_DECORATE = 593, /* SPIRV_DECORATE */
SPIRV_DECORATE_ID = 594, /* SPIRV_DECORATE_ID */
SPIRV_DECORATE_STRING = 595, /* SPIRV_DECORATE_STRING */
SPIRV_TYPE = 596, /* SPIRV_TYPE */
SPIRV_STORAGE_CLASS = 597, /* SPIRV_STORAGE_CLASS */
SPIRV_BY_REFERENCE = 598, /* SPIRV_BY_REFERENCE */
SPIRV_LITERAL = 599, /* SPIRV_LITERAL */
ATTACHMENTEXT = 600, /* ATTACHMENTEXT */
IATTACHMENTEXT = 601, /* IATTACHMENTEXT */
UATTACHMENTEXT = 602, /* UATTACHMENTEXT */
LEFT_OP = 603, /* LEFT_OP */
RIGHT_OP = 604, /* RIGHT_OP */
INC_OP = 605, /* INC_OP */
DEC_OP = 606, /* DEC_OP */
LE_OP = 607, /* LE_OP */
GE_OP = 608, /* GE_OP */
EQ_OP = 609, /* EQ_OP */
NE_OP = 610, /* NE_OP */
AND_OP = 611, /* AND_OP */
OR_OP = 612, /* OR_OP */
XOR_OP = 613, /* XOR_OP */
MUL_ASSIGN = 614, /* MUL_ASSIGN */
DIV_ASSIGN = 615, /* DIV_ASSIGN */
ADD_ASSIGN = 616, /* ADD_ASSIGN */
MOD_ASSIGN = 617, /* MOD_ASSIGN */
LEFT_ASSIGN = 618, /* LEFT_ASSIGN */
RIGHT_ASSIGN = 619, /* RIGHT_ASSIGN */
AND_ASSIGN = 620, /* AND_ASSIGN */
XOR_ASSIGN = 621, /* XOR_ASSIGN */
OR_ASSIGN = 622, /* OR_ASSIGN */
SUB_ASSIGN = 623, /* SUB_ASSIGN */
STRING_LITERAL = 624, /* STRING_LITERAL */
LEFT_PAREN = 625, /* LEFT_PAREN */
RIGHT_PAREN = 626, /* RIGHT_PAREN */
LEFT_BRACKET = 627, /* LEFT_BRACKET */
RIGHT_BRACKET = 628, /* RIGHT_BRACKET */
LEFT_BRACE = 629, /* LEFT_BRACE */
RIGHT_BRACE = 630, /* RIGHT_BRACE */
DOT = 631, /* DOT */
COMMA = 632, /* COMMA */
COLON = 633, /* COLON */
EQUAL = 634, /* EQUAL */
SEMICOLON = 635, /* SEMICOLON */
BANG = 636, /* BANG */
DASH = 637, /* DASH */
TILDE = 638, /* TILDE */
PLUS = 639, /* PLUS */
STAR = 640, /* STAR */
SLASH = 641, /* SLASH */
PERCENT = 642, /* PERCENT */
LEFT_ANGLE = 643, /* LEFT_ANGLE */
RIGHT_ANGLE = 644, /* RIGHT_ANGLE */
VERTICAL_BAR = 645, /* VERTICAL_BAR */
CARET = 646, /* CARET */
AMPERSAND = 647, /* AMPERSAND */
QUESTION = 648, /* QUESTION */
INVARIANT = 649, /* INVARIANT */
HIGH_PRECISION = 650, /* HIGH_PRECISION */
MEDIUM_PRECISION = 651, /* MEDIUM_PRECISION */
LOW_PRECISION = 652, /* LOW_PRECISION */
PRECISION = 653, /* PRECISION */
PACKED = 654, /* PACKED */
RESOURCE = 655, /* RESOURCE */
SUPERP = 656, /* SUPERP */
FLOATCONSTANT = 657, /* FLOATCONSTANT */
INTCONSTANT = 658, /* INTCONSTANT */
UINTCONSTANT = 659, /* UINTCONSTANT */
BOOLCONSTANT = 660, /* BOOLCONSTANT */
IDENTIFIER = 661, /* IDENTIFIER */
TYPE_NAME = 662, /* TYPE_NAME */
CENTROID = 663, /* CENTROID */
IN = 664, /* IN */
OUT = 665, /* OUT */
INOUT = 666, /* INOUT */
STRUCT = 667, /* STRUCT */
VOID = 668, /* VOID */
WHILE = 669, /* WHILE */
BREAK = 670, /* BREAK */
CONTINUE = 671, /* CONTINUE */
DO = 672, /* DO */
ELSE = 673, /* ELSE */
FOR = 674, /* FOR */
IF = 675, /* IF */
DISCARD = 676, /* DISCARD */
RETURN = 677, /* RETURN */
SWITCH = 678, /* SWITCH */
CASE = 679, /* CASE */
DEFAULT = 680, /* DEFAULT */
TERMINATE_INVOCATION = 681, /* TERMINATE_INVOCATION */
TERMINATE_RAY = 682, /* TERMINATE_RAY */
IGNORE_INTERSECTION = 683, /* IGNORE_INTERSECTION */
UNIFORM = 684, /* UNIFORM */
SHARED = 685, /* SHARED */
BUFFER = 686, /* BUFFER */
TILEIMAGEEXT = 687, /* TILEIMAGEEXT */
FLAT = 688, /* FLAT */
SMOOTH = 689, /* SMOOTH */
LAYOUT = 690, /* LAYOUT */
DOUBLECONSTANT = 691, /* DOUBLECONSTANT */
INT16CONSTANT = 692, /* INT16CONSTANT */
UINT16CONSTANT = 693, /* UINT16CONSTANT */
FLOAT16CONSTANT = 694, /* FLOAT16CONSTANT */
INT32CONSTANT = 695, /* INT32CONSTANT */
UINT32CONSTANT = 696, /* UINT32CONSTANT */
INT64CONSTANT = 697, /* INT64CONSTANT */
UINT64CONSTANT = 698, /* UINT64CONSTANT */
SUBROUTINE = 699, /* SUBROUTINE */
DEMOTE = 700, /* DEMOTE */
FUNCTION = 701, /* FUNCTION */
PAYLOADNV = 702, /* PAYLOADNV */
PAYLOADINNV = 703, /* PAYLOADINNV */
HITATTRNV = 704, /* HITATTRNV */
CALLDATANV = 705, /* CALLDATANV */
CALLDATAINNV = 706, /* CALLDATAINNV */
PAYLOADEXT = 707, /* PAYLOADEXT */
PAYLOADINEXT = 708, /* PAYLOADINEXT */
HITATTREXT = 709, /* HITATTREXT */
CALLDATAEXT = 710, /* CALLDATAEXT */
CALLDATAINEXT = 711, /* CALLDATAINEXT */
PATCH = 712, /* PATCH */
SAMPLE = 713, /* SAMPLE */
NONUNIFORM = 714, /* NONUNIFORM */
COHERENT = 715, /* COHERENT */
VOLATILE = 716, /* VOLATILE */
RESTRICT = 717, /* RESTRICT */
READONLY = 718, /* READONLY */
WRITEONLY = 719, /* WRITEONLY */
NONTEMPORAL = 720, /* NONTEMPORAL */
DEVICECOHERENT = 721, /* DEVICECOHERENT */
QUEUEFAMILYCOHERENT = 722, /* QUEUEFAMILYCOHERENT */
WORKGROUPCOHERENT = 723, /* WORKGROUPCOHERENT */
SUBGROUPCOHERENT = 724, /* SUBGROUPCOHERENT */
NONPRIVATE = 725, /* NONPRIVATE */
SHADERCALLCOHERENT = 726, /* SHADERCALLCOHERENT */
NOPERSPECTIVE = 727, /* NOPERSPECTIVE */
EXPLICITINTERPAMD = 728, /* EXPLICITINTERPAMD */
PERVERTEXEXT = 729, /* PERVERTEXEXT */
PERVERTEXNV = 730, /* PERVERTEXNV */
PERPRIMITIVENV = 731, /* PERPRIMITIVENV */
PERVIEWNV = 732, /* PERVIEWNV */
PERTASKNV = 733, /* PERTASKNV */
PERPRIMITIVEEXT = 734, /* PERPRIMITIVEEXT */
TASKPAYLOADWORKGROUPEXT = 735, /* TASKPAYLOADWORKGROUPEXT */
PRECISE = 736 /* 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
@@ -580,7 +586,7 @@ union YYSTYPE
glslang::TTypeParameters* typeParameters;
} interm;
#line 584 "MachineIndependent/glslang_tab.cpp.h"
#line 590 "MachineIndependent/glslang_tab.cpp.h"
};
typedef union YYSTYPE YYSTYPE;
@@ -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;
@@ -983,8 +989,13 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpCooperativeVectorOuterProductAccumulateNV: out.debug << "Cooperative vector outer product accumulate NV"; break;
case EOpCooperativeVectorReduceSumAccumulateNV: out.debug << "Cooperative vector reduce sum accumulate NV"; break;
case EOpTensorReadARM: out.debug << "Read from tensor"; break;
case EOpTensorWriteARM: out.debug << "Write to tensor"; break;
case EOpTensorSizeARM: out.debug << "Get tensor size"; break;
case EOpIsHelperInvocation: out.debug << "IsHelperInvocation"; break;
case EOpDebugPrintf: out.debug << "Debug printf"; break;
case EOpAbortEXT: out.debug << "Abort"; break;
case EOpHitObjectTraceRayNV: out.debug << "HitObjectTraceRayNV"; break;
case EOpHitObjectTraceRayMotionNV: out.debug << "HitObjectTraceRayMotionNV"; break;
@@ -1390,6 +1401,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
@@ -166,7 +166,7 @@ typedef std::vector<TVarLivePair> 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;
@@ -37,6 +37,7 @@
#define _IOMAPPER_INCLUDED
#include <cstdint>
#include <array>
#include <unordered_map>
#include <unordered_set>
//
@@ -55,6 +56,7 @@ public:
TDefaultIoResolverBase(const TIntermediate& intermediate);
typedef std::vector<int> TSlotSet;
typedef std::unordered_map<int, TSlotSet> TSlotSetMap;
typedef std::array<TSlotSetMap, EResCount> 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<TString, int> TVarSlotMap; // <resourceName, location/binding>
typedef std::map<int, TVarSlotMap> TSlotMap; // <resourceKey, TVarSlotMap>
typedef std::array<TSlotMap, EResCount> 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;
};
@@ -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(EShMessages messages, const TQualifier& quali
set = 1;
else if (qualifier.isHitObjectAttrNV())
set = 2;
else if (qualifier.isHitObjectAttrEXT())
set = 2;
else
return -1;
@@ -1997,7 +2028,7 @@ int TIntermediate::addUsedLocation(EShMessages messages, const TQualifier& quali
// 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);
@@ -48,6 +48,7 @@
#include <functional>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
class TInfoSink;
@@ -227,9 +228,9 @@ class TVariable;
// Texture and Sampler transformation mode.
//
enum ComputeDerivativeMode {
LayoutDerivativeNone, // default layout as SPV_NV_compute_shader_derivatives not enabled
LayoutDerivativeGroupQuads, // derivative_group_quadsNV
LayoutDerivativeGroupLinear, // derivative_group_linearNV
LayoutDerivativeNone,
LayoutDerivativeGroupQuads,
LayoutDerivativeGroupLinear,
};
//
@@ -339,6 +340,7 @@ public:
geoPassthroughEXT(false),
numShaderRecordBlocks(0),
computeDerivativeMode(LayoutDerivativeNone),
computeDerivativeExtension(EdgNone),
primitives(TQualifier::layoutNotSet),
numTaskNVBlocks(0),
layoutPrimitiveCulling(false),
@@ -351,6 +353,7 @@ public:
hlslOffsets(false),
hlslIoMapping(false),
useVariablePointers(false),
bindingsPerResourceType(false),
textureSamplerTransformMode(EShTexSampTransKeep),
needToLegalize(false),
binaryDoubleOutput(false),
@@ -574,8 +577,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 +766,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 +842,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<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
bool hasCounterBufferName(const TString& name) const {
@@ -965,9 +985,14 @@ public:
bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; }
void setGeoPassthroughEXT() { geoPassthroughEXT = true; }
bool getGeoPassthroughEXT() const { return geoPassthroughEXT; }
void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; }
void setLayoutDerivativeMode(ComputeDerivativeMode mode, TDerivativeGroupExtension extension)
{
computeDerivativeMode = mode;
computeDerivativeExtension = extension;
}
bool hasLayoutDerivativeModeNone() const { return computeDerivativeMode != LayoutDerivativeNone; }
ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; }
TDerivativeGroupExtension getLayoutDerivativeExtension() const { return computeDerivativeExtension; }
void setLayoutPrimitiveCulling() { layoutPrimitiveCulling = true; }
bool getLayoutPrimitiveCulling() const { return layoutPrimitiveCulling; }
bool setPrimitives(int m)
@@ -1151,6 +1176,13 @@ public:
void updateNumericFeature(TNumericFeatures::feature f, bool on)
{ on ? numericFeatures.insert(f) : numericFeatures.erase(f); }
void setBuiltinAliasLookup(std::unordered_multimap<std::string, std::string> symbolMap) {
builtinAliasLookup = std::move(symbolMap);
}
const std::unordered_multimap<std::string, std::string>& 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);
@@ -1261,6 +1293,7 @@ protected:
bool geoPassthroughEXT;
int numShaderRecordBlocks;
ComputeDerivativeMode computeDerivativeMode;
TDerivativeGroupExtension computeDerivativeExtension;
int primitives;
int numTaskNVBlocks;
bool layoutPrimitiveCulling;
@@ -1284,6 +1317,7 @@ protected:
bool hlslOffsets;
bool hlslIoMapping;
bool useVariablePointers;
bool bindingsPerResourceType;
std::set<TString> semanticNameSet;
@@ -1295,6 +1329,8 @@ protected:
bool maximallyReconverges;
bool usePhysicalStorageBuffer;
bool useReplicatedComposites { false };
bool promoteUint32Indices { false };
bool shader64BitIndexing { false };
TSpirvRequirement* spirvRequirement;
TSpirvExecutionMode* spirvExecutionMode;
@@ -1323,6 +1359,9 @@ protected:
// Included text. First string is a name, second is the included text
std::map<std::string, std::string> includeText;
// Maps from canonical symbol name to alias symbol names
std::unordered_multimap<std::string, std::string> builtinAliasLookup;
// for OpModuleProcessed, or equivalent
TProcesses processes;
@@ -124,9 +124,12 @@ 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; }
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
bool isForwardCompatible() const { return forwardCompatible; }
@@ -81,7 +81,6 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <cctype>
@@ -153,12 +152,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
@@ -679,12 +723,11 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
if (res->headerData != nullptr && res->headerLength > 0) {
// path for processing one or more tokens from an included header, hand off 'res'
const bool forNextLine = parseContext.lineDirectiveShouldSetNextLine();
std::ostringstream prologue;
std::ostringstream epilogue;
prologue << "#line " << forNextLine << " " << "\"" << res->headerName << "\"\n";
epilogue << (res->headerData[res->headerLength - 1] == '\n'? "" : "\n") <<
"#line " << directiveLoc.line + forNextLine << " " << directiveLoc.getStringNameOrNum() << "\n";
pushInput(new TokenizableIncludeFile(directiveLoc, prologue.str(), res, epilogue.str(), this));
std::string prologue = "#line " + std::to_string((int)forNextLine) + " \"" + res->headerName + "\"\n";
std::string epilogue = (res->headerData[res->headerLength - 1] == '\n' ? "" : "\n") +
std::string("#line ") + std::to_string(directiveLoc.line + forNextLine) + " " +
directiveLoc.getStringNameOrNum() + "\n";
pushInput(new TokenizableIncludeFile(directiveLoc, prologue, res, epilogue, this));
parseContext.intermediate.addIncludeText(res->headerName.c_str(), res->headerData, res->headerLength);
// There's no "current" location anymore.
parseContext.setCurrentColumn(0);
@@ -1119,7 +1162,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;
}
@@ -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) { }
@@ -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,22 @@ 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, E_GL_EXT_abort };
parseContext.requireExtensions(ppToken.loc, 3, string_literal_EXTs, "string literal");
if (!parseContext.extensionTurnedOn(E_GL_EXT_debug_printf) &&
!parseContext.extensionTurnedOn(E_GL_EXT_spirv_intrinsics)&&
!parseContext.extensionTurnedOn(E_GL_EXT_abort)) {
continue;
}
}
switch (token) {
case PpAtomConstString:
break;
case PpAtomIdentifier:
case PpAtomConstInt:
case PpAtomConstUint:
@@ -1281,17 +1311,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 +1318,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 +1359,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;
}
@@ -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));
@@ -134,7 +134,7 @@ class TConstUnionArray;
typedef enum {
EShSourceNone,
EShSourceGlsl, // GLSL, includes ESSL (OpenGL ES GLSL)
EShSourceHlsl, // HLSL
EShSourceHlsl, // HLSL (deprecated, see issue #4210)
LAST_ELEMENT_MARKER(EShSourceCount),
} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead
@@ -261,14 +261,14 @@ enum EShMessages : unsigned {
EShMsgSpvRules = (1 << 3), // issue messages for SPIR-V generation
EShMsgVulkanRules = (1 << 4), // issue messages for Vulkan-requirements of GLSL for SPIR-V
EShMsgOnlyPreprocessor = (1 << 5), // only print out errors produced by the preprocessor
EShMsgReadHlsl = (1 << 6), // use HLSL parsing rules and semantics
EShMsgReadHlsl = (1 << 6), // use HLSL parsing rules and semantics (deprecated, see issue #4210)
EShMsgCascadingErrors = (1 << 7), // get cascading errors; risks error-recovery issues, instead of an early exit
EShMsgKeepUncalled = (1 << 8), // for testing, don't eliminate uncalled functions
EShMsgHlslOffsets = (1 << 9), // allow block offsets to follow HLSL rules instead of GLSL rules
EShMsgHlslOffsets = (1 << 9), // allow block offsets to follow HLSL rules instead of GLSL rules (deprecated, see issue #4210)
EShMsgDebugInfo = (1 << 10), // save debug information
EShMsgHlslEnable16BitTypes = (1 << 11), // enable use of 16-bit types in SPIR-V for HLSL
EShMsgHlslLegalization = (1 << 12), // enable HLSL Legalization messages
EShMsgHlslDX9Compatible = (1 << 13), // enable HLSL DX9 compatible mode (for samplers and semantics)
EShMsgHlslEnable16BitTypes = (1 << 11), // enable use of 16-bit types in SPIR-V for HLSL (deprecated, see issue #4210)
EShMsgHlslLegalization = (1 << 12), // enable HLSL Legalization messages (deprecated, see issue #4210)
EShMsgHlslDX9Compatible = (1 << 13), // enable HLSL DX9 compatible mode (for samplers and semantics) (deprecated, see issue #4210)
EShMsgBuiltinSymbolTable = (1 << 14), // print the builtin symbol table
EShMsgEnhanced = (1 << 15), // enhanced message readability
EShMsgAbsolutePath = (1 << 16), // Output Absolute path for messages
@@ -436,6 +436,9 @@ enum TResourceType {
EResUbo,
EResSsbo,
EResUav,
EResCombinedSampler,
EResAs,
EResTensor,
EResCount
};
@@ -465,59 +468,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<std::string>&);
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<std::string>&);
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<std::string>& 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<std::string>& 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); // deprecated, see issue #4210
void setFlattenUniformArrays(bool flatten); // deprecated, see issue #4210
#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
@@ -571,8 +575,8 @@ public:
void getStrings(const char* const* &s, int& n) { s = strings; n = numStrings; }
#ifdef ENABLE_HLSL
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; } // deprecated, see issue #4210
bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; } // deprecated, see issue #4210
#else
bool getEnvTargetHlslFunctionality1() const { return false; }
#endif
@@ -666,7 +670,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&);
@@ -692,14 +696,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; }
@@ -746,17 +750,17 @@ 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, const TConstUnionArray* pConstArray = nullptr);
TObjectReflection(const std::string& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex, const TConstUnionArray* pConstArray = nullptr);
const TType* getType() const { return type; }
const TConstUnionArray* getConstArray() const { return constArray; }
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;
@@ -808,8 +812,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() {}
@@ -881,41 +884,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<TShader*>& 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
@@ -982,19 +985,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<TShader*> stages[EShLangCount];
@@ -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,
+1 -1
View File
@@ -34,7 +34,7 @@
#ifndef GLSLANG_BUILD_INFO
#define GLSLANG_BUILD_INFO
#define GLSLANG_VERSION_MAJOR 15
#define GLSLANG_VERSION_MAJOR 16
#define GLSLANG_VERSION_MINOR 3
#define GLSLANG_VERSION_PATCH 0
#define GLSLANG_VERSION_FLAVOR ""